@ComponentProfile(summary="Generate a unique value and attach it as metadata", tag="service,metadata") public class GenerateUniqueMetadataValueService extends MetadataServiceImpl
Uses the configured IdGenerator
instance to generate a unique value that is subsequently assigned to metadata. Note that
this is not designed to replace the unique-id that is associated with an AdaptrisMessage, but is intended to be an additional way
for you to generate unique ids that can be associated with a message.
In the adapter configuration file this class is aliased as generate-unique-metadata-value-service which is the preferred alternative to the fully qualified classname when building your configuration.
MetadataServiceImpl.LogWrapper
DEBUG, ERROR, INFO, TRACE, WARN
log
CONFIRMATION_ID_KEY
Constructor and Description |
---|
GenerateUniqueMetadataValueService() |
GenerateUniqueMetadataValueService(java.lang.String metadataKey) |
GenerateUniqueMetadataValueService(java.lang.String metadataKey,
IdGenerator generator) |
Modifier and Type | Method and Description |
---|---|
void |
doService(AdaptrisMessage msg)
Apply the service to the message.
|
IdGenerator |
getGenerator() |
java.lang.String |
getMetadataKey()
Returns the metadata key whose value should be checked.
|
void |
setGenerator(IdGenerator idg)
Set the generator to be used.
|
void |
setMetadataKey(java.lang.String s)
Sets the metadata key whose which will store the new value.
|
closeService, getMetadataLogger, initService, logMetadata, logMetadata, logMetadata, logMetadata, prepare, setMetadataLogger, withMetadataLogger
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getLookupName, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setLookupName, setUniqueId, start, stop
public GenerateUniqueMetadataValueService()
public GenerateUniqueMetadataValueService(java.lang.String metadataKey)
public GenerateUniqueMetadataValueService(java.lang.String metadataKey, IdGenerator generator)
public void doService(AdaptrisMessage msg) throws ServiceException
Service
Apply the service to the message.
msg
- the AdaptrisMessage
to processServiceException
- wrapping any underlying Exception
spublic java.lang.String getMetadataKey()
Returns the metadata key whose value should be checked.
public void setMetadataKey(java.lang.String s)
s
- the metadata key; if set to null, then a unique-key will be generated using the configured
setGenerator(IdGenerator)
.public IdGenerator getGenerator()
public void setGenerator(IdGenerator idg)
idg
- the generator; default is GuidGenerator