Class CheckMetadataValueService
- java.lang.Object
-
- com.adaptris.core.ServiceImp
-
- com.adaptris.core.services.duplicate.DuplicateMetadataValueService
-
- com.adaptris.core.services.duplicate.CheckMetadataValueService
-
- All Implemented Interfaces:
AdaptrisComponent
,ComponentLifecycle
,ComponentLifecycleExtension
,MessageEventGenerator
,Service
,StateManagedComponent
@ComponentProfile(summary="Perform a branch based on whether a metadata value has already been processed", tag="service,duplicate") public class CheckMetadataValueService extends DuplicateMetadataValueService
Branching
Service
implementation which checks the value stored against a configured metadata key against a list of previously received values. If the value to check is null or empty, aServiceException
is thrown. If the value has previously been received, the configurednextServiceIdIfDuplicate
is set on the message. If the value is not contained in the store of previous values,nextServiceIdIfUnique
is set.In the adapter configuration file this class is aliased as check-metadata-value-service which is the preferred alternative to the fully qualified classname when building your configuration.
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.services.duplicate.DuplicateMetadataValueService
previousValuesStore, store
-
Fields inherited from class com.adaptris.core.ServiceImp
log
-
-
Constructor Summary
Constructors Constructor Description CheckMetadataValueService()
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
doService(AdaptrisMessage msg)
Apply the service to the message.java.lang.String
getNextServiceIdIfDuplicate()
Returns the ID of the nextService
to apply if the metadata exists if the store of previous values.java.lang.String
getNextServiceIdIfUnique()
Returns the ID of the nextService
to apply if the metadata does not exist if the store of previous values.protected void
initService()
boolean
isBranching()
This is a branching service, even though its parent(s) aren't.void
setNextServiceIdIfDuplicate(java.lang.String s)
Sets the ID of the nextService
to apply if the metadata exists if the store of previous values.void
setNextServiceIdIfUnique(java.lang.String s)
Sets the ID of the nextService
to apply if the metadata does not exist if the store of previous values.-
Methods inherited from class com.adaptris.core.services.duplicate.DuplicateMetadataValueService
closeService, getMetadataKey, getStoreFileUrl, loadPreviouslyReceivedValues, prepare, setMetadataKey, setStoreFileUrl
-
Methods inherited from class com.adaptris.core.ServiceImp
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getUniqueId, init, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setUniqueId, start, stop
-
-
-
-
Method Detail
-
initService
protected void initService() throws CoreException
- Overrides:
initService
in classDuplicateMetadataValueService
- Throws:
CoreException
-
doService
public void doService(AdaptrisMessage msg) throws ServiceException
Description copied from interface:Service
Apply the service to the message.
- Parameters:
msg
- theAdaptrisMessage
to process- Throws:
ServiceException
- wrapping any underlyingException
s
-
isBranching
public boolean isBranching()
This is a branching service, even though its parent(s) aren't.
- Specified by:
isBranching
in interfaceService
- Overrides:
isBranching
in classServiceImp
- Returns:
- true if the implementation supports branching
- See Also:
ServiceImp.isBranching()
-
getNextServiceIdIfDuplicate
public java.lang.String getNextServiceIdIfDuplicate()
Returns the ID of the next
Service
to apply if the metadata exists if the store of previous values.- Returns:
- the ID of the next
Service
to apply if the metadata exists if the store of previous values
-
setNextServiceIdIfDuplicate
public void setNextServiceIdIfDuplicate(java.lang.String s)
Sets the ID of the next
Service
to apply if the metadata exists if the store of previous values. May not be null or empty.- Parameters:
s
- the ID of the nextService
to apply if the metadata exists if the store of previous values
-
getNextServiceIdIfUnique
public java.lang.String getNextServiceIdIfUnique()
Returns the ID of the next
Service
to apply if the metadata does not exist if the store of previous values.- Returns:
- the ID of the next
Service
to apply if the metadata does not exist if the store of previous values
-
setNextServiceIdIfUnique
public void setNextServiceIdIfUnique(java.lang.String s)
Sets the ID of the next
Service
to apply if the metadata does not exist if the store of previous values. May not be null or empty.- Parameters:
s
- the ID of the nextService
to apply if the metadata does not exist if the store of previous values
-
-