Package com.levigo.jadice.web.server
Interface ServerOperation<P extends ServerOperationParameters<M>,M extends ServerOperationMessage>
- All Known Implementing Classes:
AbstractExportServerOperation
,AbstractPDFExportServerOperation
,AbstractPostscriptExportServerOperation
,AbstractTIFFExportServerOperation
,DnDSaveServerOperation
,ExportServerOperation
,SaveAnnotationServerOperation
public interface ServerOperation<P extends ServerOperationParameters<M>,M extends ServerOperationMessage>
Base interface for all
ServerOperation
implementations. Implementations perform a server
side operation on a document.
Be aware that the ServerOperation
affects the existing server side document. To be
precise, there is a copy of the server-side document is created internally, but all PageSegment
instances are shared!
Invocation works in the following way:
- The client sends a
ServerOperation.Request
containing the stateful document and a mandatory operation configuration - The server retrieves the client side representation of the document and updates generates a server-side document copy carrying the client side state with it
- The server retrieves the operation configuration
- The server asynchronously executes the
ServerOperation
by invoking itsinvoke(Request, ResponseChannel)
method on a separate server side thread - The server immediately answers the
ServerOperation.Request
by sending exactly oneServerOperationMessage
through theServerOperation.ResponseChannel
telling the client that the execution was started successfully - The server may send additional
ServerOperationMessage
s informing the client about the progress of the operation - The client may receive those
ServerOperationMessage
s, update its state and / or display the progress to the user - The server sends a final
ServerOperationMessage
containing the result of the operation - The client receives a final
ServerOperationMessage
inObserver.onCompleted()
, may update its state and display the result of theServerOperation
to the user
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
The client request including operation specific configuration:static interface
The channel to which the server sends messages to in order to notify the client. -
Method Summary
Modifier and TypeMethodDescriptionvoid
invoke
(ServerOperation.Request<P> request, ServerOperation.ResponseChannel<M> responseChannel) Executes the operation asynchronously on the server side.
-
Method Details
-
invoke
void invoke(ServerOperation.Request<P> request, ServerOperation.ResponseChannel<M> responseChannel) throws Exception Executes the operation asynchronously on the server side.- Parameters:
request
- The client request containing the configuration for the executionresponseChannel
- The channel which the server uses to notify the client- Throws:
Exception
- In the case of a server side error during the execution of the operation an exception is thrown. Catching this exception on the client side can be used to implement error handling.
-