Class ThrowExceptionService
- java.lang.Object
-
- com.adaptris.core.ServiceImp
-
- com.adaptris.core.services.exception.ThrowExceptionService
-
- All Implemented Interfaces:
AdaptrisComponent,ComponentLifecycle,ComponentLifecycleExtension,MessageEventGenerator,Service,StateManagedComponent
@ComponentProfile(summary="Throw an exception based on some configured criteria", tag="service,error-handling") public class ThrowExceptionService extends ServiceImpThrows an exception based on a configurable set of criteria.Use this service as part of a workflow to throw an exception at a time and place of your choosing (rather than when the exception actually occurs perhaps). The
ServiceExceptionis generated by concrete implementations ofExceptionGenerator; if the generated exception is null, then no exception is thrown.- See Also:
ExceptionGenerator
In the adapter configuration file this class is aliased as throw-exception-service which is the preferred alternative to the fully qualified classname when building your configuration.
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.ServiceImp
log
-
-
Constructor Summary
Constructors Constructor Description ThrowExceptionService()ThrowExceptionService(ExceptionGenerator eg)ThrowExceptionService(java.lang.String uniqueId, ExceptionGenerator eg)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcloseService()voiddoService(AdaptrisMessage msg)Apply the service to the message.ExceptionGeneratorgetExceptionGenerator()protected voidinitService()voidprepare()Prepare for initialisation.voidsetExceptionGenerator(ExceptionGenerator eg)How to generate the exception for throwing.-
Methods inherited from class com.adaptris.core.ServiceImp
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setUniqueId, start, stop
-
-
-
-
Constructor Detail
-
ThrowExceptionService
public ThrowExceptionService()
-
ThrowExceptionService
public ThrowExceptionService(ExceptionGenerator eg)
-
ThrowExceptionService
public ThrowExceptionService(java.lang.String uniqueId, ExceptionGenerator eg)
-
-
Method Detail
-
doService
public void doService(AdaptrisMessage msg) throws ServiceException
Description copied from interface:ServiceApply the service to the message.
- Parameters:
msg- theAdaptrisMessageto process- Throws:
ServiceException- wrapping any underlyingExceptions
-
initService
protected void initService() throws CoreException- Specified by:
initServicein classServiceImp- Throws:
CoreException
-
closeService
protected void closeService()
- Specified by:
closeServicein classServiceImp
-
getExceptionGenerator
public ExceptionGenerator getExceptionGenerator()
-
setExceptionGenerator
public void setExceptionGenerator(ExceptionGenerator eg)
How to generate the exception for throwing.- Parameters:
eg- the generator.
-
prepare
public void prepare() throws CoreExceptionDescription copied from interface:ComponentLifecycleExtensionPrepare for initialisation.- Throws:
CoreException
-
-