Package omero.cmd
Interface IRequest
-
- All Known Subinterfaces:
WrappableRequest<X>
- All Known Implementing Classes:
Chgrp2I,Chmod2I,Chown2I,CurrentSessionsRequestI,Delete2I,DiskUsage2I,DiskUsageI,DoAllI,DuplicateI,FindChildrenI,FindParentsI,FindPyramidsI,LegalGraphTargetsI,ListRequestsI,ManagedImportRequestI,ManageImageBinariesI,OriginalMetadataRequestI,RawAccessRequestI,ResetPasswordRequestI,SaveI,SendEmailRequestI,SkipHeadI,TimingI,UpdateSessionTimeoutRequestI,UsedFilesRequestI
public interface IRequestSPI Orthogonal interface hierarchy of types for working with theRequesthierarchy. All request implementations handled by the server must also be instances ofIRequest, which defines the lifecycle methods needed for processing.- Since:
- Beta4.3.2
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidbuildResponse(int step, java.lang.Object object)voidfinish()Method within the transaction boundaries after all processing has occurred.java.util.Map<java.lang.String,java.lang.String>getCallContext()Returns the desired call context for this request.ResponsegetResponse()Returns the current response value.voidinit(Helper helper)Method called within the transaction boundaries before any processing occurs.java.lang.Objectstep(int step)Single uncancellable action which will be performed by this IRequest.
-
-
-
Method Detail
-
getCallContext
java.util.Map<java.lang.String,java.lang.String> getCallContext()
Returns the desired call context for this request. Some request implementations will require "omero.group":"-1" for example and will hard-code that value. Others may permit users to pass in the desired values which will be merged into the staticMapas desired.- Returns:
- the call context for this request
-
init
void init(Helper helper) throws HandleI.Cancel
Method called within the transaction boundaries before any processing occurs. Implementations must properly initialize the "step" field of theStatusobject by callingHelper.setSteps(int). This count will define how many times thestep(int)method will be called. TheHelperinstance passed in contains those resources needed by IRequests to interact with data and should be stored for later use.- Parameters:
helper- the helper for this request- Throws:
HandleI.Cancel- if this request is cancelled
-
step
java.lang.Object step(int step) throws HandleI.CancelSingle uncancellable action which will be performed by this IRequest. The return value can be an ome.model object that is attached to the current thread and transaction. After processing and detachment from the transaction, the object will be passed tobuildResponse(int, Object)for conversion and storage.- Parameters:
step- the step number- Returns:
- an object to be used in building the response
- Throws:
HandleI.Cancel- if this request is cancelled
-
finish
void finish() throws HandleI.CancelMethod within the transaction boundaries after all processing has occurred. A thrownHandleI.Cancelwill still rollback the current transaction.- Throws:
HandleI.Cancel- if this request is cancelled- Since:
- 5.0.0
-
buildResponse
void buildResponse(int step, java.lang.Object object)- Parameters:
step- the step numberobject- an object to be used in building the response
-
getResponse
Response getResponse()
Returns the current response value. This method should be protected by synchronization where necessary, and should never raise an exception. It is also guaranteed to be called so that any state cleanup that is necessary can take place here.- Returns:
- the response to this request
-
-