public interface IProcessingComponent
IProcessingComponent
instances are initialized and disposed of (init(IControllerContext)
,
dispose()
) and how processing proceeds (beforeProcessing()
,
process()
, afterProcessing()
). See Controller
for a
reference implementation of this life cycle.Modifier and Type | Method and Description |
---|---|
void |
afterProcessing()
Invoked after the processing has finished, no matter whether an exception has been
thrown or not.
|
void |
beforeProcessing()
Invoked after the attributes marked with
Processing and Input
annotations have been bound, but before a call to process() . |
void |
dispose()
Invoked before this processing component is about to be destroyed.
|
void |
init(IControllerContext ctx)
Invoked after component's attributes marked with
Init and Input
annotations have been bound, but before calls to any other methods of this
component. |
void |
process()
Performs the processing required to fulfill the request.
|
void init(IControllerContext ctx) throws ComponentInitializationException
Init
and Input
annotations have been bound, but before calls to any other methods of this
component. After a call to this method completes without an exception, attributes
marked with Init
Output
will be collected. In this method,
components should perform initializations based on the initialization-time
attributes. This method is called once in the life time of a processing
component instance.ctx
- An instance of IControllerContext
of the controller to which this
component instance will be bound.ComponentInitializationException
- when initialization failed. If thrown, the
dispose()
method will be called on this component instance to
allow clean-up actions. The instance will not be used for any further
processing and should be made reclaimable to the garbage collector.
Finally, the exception will be rethrown from the controller method that
caused the component to initialize.void beforeProcessing() throws ProcessingException
Processing
and Input
annotations have been bound, but before a call to process()
. In this
method, the processing component should perform any initializations based on the
runtime attributes. This method is called once per request.ProcessingException
- when processing cannot start, e.g. because some
attributes were not bound. If thrown, the process()
method
will not be called. Instead, afterProcessing()
will be called
immediately to allow clean-up actions, and the component will be ready
to accept further requests or to be disposed of. Finally, the exception
will be rethrown from the controller method that caused the component
to perform processing.void process() throws ProcessingException
ProcessingException
- when processing failed. If thrown, the
afterProcessing()
method will be called and the component will
be ready to accept further requests or to be disposed of. Finally, the
exception will be rethrown from the controller method that caused the
component to perform processing.void afterProcessing()
Processing
and Output
annotations will be collected. In this
method, the processing component should dispose of any resources it has allocated
to fulfill the request. No matter whether a call to this method completes
successfully or with an exception, the component will be ready to accept further
requests or to be disposed of. This method is called once per request.void dispose()