Class AbstractExportServerOperation<P extends ServerOperationParameters<M>,M extends ServerOperationMessage,T extends Exporter>
java.lang.Object
com.jadice.web.export.server.serveroperation.AbstractExportServerOperation<P,M,T>
- Type Parameters:
P
- the type of the expected parameter objectM
- the type of the allowed message objectsT
- the type ofExporter
to be used.
- All Implemented Interfaces:
ServerOperation<P,
M>
- Direct Known Subclasses:
AbstractPDFExportServerOperation
,AbstractPostscriptExportServerOperation
,AbstractTIFFExportServerOperation
,ExportServerOperation
public abstract class AbstractExportServerOperation<P extends ServerOperationParameters<M>,M extends ServerOperationMessage,T extends Exporter>
extends Object
implements ServerOperation<P,M>
Common base class for generating exports by implementing ServerOperation
and using a
specific Exporter
.
AbstractPostscriptExportServerOperation
AbstractTIFFExportServerOperation
AbstractPDFExportServerOperation
Usage
Extensions of this class are intended to be used as a ServerOperation
. As such, the
jadice web toolkit will take care of synchronizing the document from the client to the server to
ensure a consistent state when the export is to be executed.
Registration
An implementation of a AbstractExportServerOperation
shall be registered using the
standard mechanism for ServerOperations
using
ServerOperationRegistry
.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.levigo.jadice.web.server.ServerOperation
ServerOperation.Request<P>, ServerOperation.ResponseChannel<M>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract T
createExporter
(ServerOperation.Request<P> request) Create the appropriateExporter
instance.protected abstract void
doExport
(ServerOperation.Request<P> request, ServerOperation.ResponseChannel<M> responseChannel, T exporter) Perform the actual export process.void
invoke
(ServerOperation.Request<P> request, ServerOperation.ResponseChannel<M> responseChannel) Executes the operation asynchronously on the server side.protected void
onExportFailed
(ServerOperation.Request<P> request, ServerOperation.ResponseChannel<M> responseChannel, T exporter) A method that can be overridden if an export-fail should be handled
-
Constructor Details
-
AbstractExportServerOperation
public AbstractExportServerOperation()
-
-
Method Details
-
invoke
public void invoke(ServerOperation.Request<P> request, ServerOperation.ResponseChannel<M> responseChannel) throws Exception Description copied from interface:ServerOperation
Executes the operation asynchronously on the server side.- Specified by:
invoke
in interfaceServerOperation<P extends ServerOperationParameters<M>,
M extends ServerOperationMessage> - 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.
-
doExport
protected abstract void doExport(ServerOperation.Request<P> request, ServerOperation.ResponseChannel<M> responseChannel, T exporter) throws Exception Perform the actual export process.- Parameters:
request
- the associatedServerOperation.Request
. For Details seeServerOperation.Request
responseChannel
- the associatedServerOperation.ResponseChannel
. For details seeServerOperation.ResponseChannel
exporter
- theExporter
instance that shall be configured to perform the export.- Throws:
Exception
-
createExporter
Create the appropriateExporter
instance. The instance shall not be shared and will be used exclusively by a single export task.- Parameters:
request
-- Returns:
- an
Exporter
instance.
-
onExportFailed
protected void onExportFailed(ServerOperation.Request<P> request, ServerOperation.ResponseChannel<M> responseChannel, T exporter) A method that can be overridden if an export-fail should be handled- Parameters:
request
- the associatedServerOperation.Request
. For Details seeServerOperation.Request
responseChannel
- the associatedServerOperation.ResponseChannel
. For details seeServerOperation.ResponseChannel
exporter
- theExporter
instance that shall be configured to perform the export.
-