Class SyntaxRoutingService
- java.lang.Object
-
- com.adaptris.core.ServiceImp
-
- com.adaptris.core.services.routing.SyntaxRoutingService
-
- All Implemented Interfaces:
AdaptrisComponent,ComponentLifecycle,ComponentLifecycleExtension,MessageEventGenerator,Service,StateManagedComponent
@ComponentProfile(summary="Identify a message, and set a metadata key based on the identifier", tag="service,routing") public class SyntaxRoutingService extends ServiceImpExtracts data from an AdaptrisMessage and stores it against metadata.This is somewhat similar to the available MetadataService, however it uses a list of
SyntaxIdentifiersin order to determine the value that should be stored against a particular metadata key.Each
SyntaxIdentifieris tried in turn, until true is returned by the methodisThisSyntax(AdaptrisMessage). At this point, the value returned bygetDestination()is stored against the configured key.In the adapter configuration file this class is aliased as syntax-routing-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 SyntaxRoutingService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSyntaxIdentifier(SyntaxIdentifier ident)Add a SyntaxIdentifier to the configured list.protected voidcloseService()voiddoService(AdaptrisMessage msg)Apply the service to the message.java.lang.StringgetRoutingKey()Get the metadata key that the value will be stored against.java.util.List<SyntaxIdentifier>getSyntaxIdentifiers()Return the list of configured SyntaxIdentifers.protected voidinitService()voidprepare()Prepare for initialisation.voidsetRoutingKey(java.lang.String key)Set the metadata key that the value will be stored against.voidsetSyntaxIdentifiers(java.util.List<SyntaxIdentifier> l)Sets the list of configured SyntaxIdentifers.-
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
-
-
-
-
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- See Also:
Service.doService(AdaptrisMessage)
-
addSyntaxIdentifier
public void addSyntaxIdentifier(SyntaxIdentifier ident)
Add a SyntaxIdentifier to the configured list.- Parameters:
ident- the SyntaxIdentifier.
-
getSyntaxIdentifiers
public java.util.List<SyntaxIdentifier> getSyntaxIdentifiers()
Return the list of configured SyntaxIdentifers.- Returns:
- the list.
-
setSyntaxIdentifiers
public void setSyntaxIdentifiers(java.util.List<SyntaxIdentifier> l)
Sets the list of configured SyntaxIdentifers.- Parameters:
l- the list.
-
setRoutingKey
public void setRoutingKey(java.lang.String key)
Set the metadata key that the value will be stored against.- Parameters:
key- the key.
-
getRoutingKey
public java.lang.String getRoutingKey()
Get the metadata key that the value will be stored against.- Returns:
- the key.
-
initService
protected void initService() throws CoreException- Specified by:
initServicein classServiceImp- Throws:
CoreException
-
closeService
protected void closeService()
- Specified by:
closeServicein classServiceImp
-
prepare
public void prepare() throws CoreExceptionDescription copied from interface:ComponentLifecycleExtensionPrepare for initialisation.- Throws:
CoreException
-
-