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 DuplicateMetadataValueServiceBranching
Serviceimplementation 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, aServiceExceptionis thrown. If the value has previously been received, the configurednextServiceIdIfDuplicateis set on the message. If the value is not contained in the store of previous values,nextServiceIdIfUniqueis 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 voiddoService(AdaptrisMessage msg)Apply the service to the message.java.lang.StringgetNextServiceIdIfDuplicate()Returns the ID of the nextServiceto apply if the metadata exists if the store of previous values.java.lang.StringgetNextServiceIdIfUnique()Returns the ID of the nextServiceto apply if the metadata does not exist if the store of previous values.protected voidinitService()booleanisBranching()This is a branching service, even though its parent(s) aren't.voidsetNextServiceIdIfDuplicate(java.lang.String s)Sets the ID of the nextServiceto apply if the metadata exists if the store of previous values.voidsetNextServiceIdIfUnique(java.lang.String s)Sets the ID of the nextServiceto 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:
initServicein classDuplicateMetadataValueService- Throws:
CoreException
-
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
-
isBranching
public boolean isBranching()
This is a branching service, even though its parent(s) aren't.
- Specified by:
isBranchingin interfaceService- Overrides:
isBranchingin classServiceImp- Returns:
- true if the implementation supports branching
- See Also:
ServiceImp.isBranching()
-
getNextServiceIdIfDuplicate
public java.lang.String getNextServiceIdIfDuplicate()
Returns the ID of the next
Serviceto apply if the metadata exists if the store of previous values.- Returns:
- the ID of the next
Serviceto 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
Serviceto apply if the metadata exists if the store of previous values. May not be null or empty.- Parameters:
s- the ID of the nextServiceto apply if the metadata exists if the store of previous values
-
getNextServiceIdIfUnique
public java.lang.String getNextServiceIdIfUnique()
Returns the ID of the next
Serviceto apply if the metadata does not exist if the store of previous values.- Returns:
- the ID of the next
Serviceto 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
Serviceto 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 nextServiceto apply if the metadata does not exist if the store of previous values
-
-