Class GenerateUniqueMetadataValueService
- java.lang.Object
-
- com.adaptris.core.ServiceImp
-
- com.adaptris.core.services.metadata.MetadataServiceImpl
-
- com.adaptris.core.services.metadata.GenerateUniqueMetadataValueService
-
- All Implemented Interfaces:
AdaptrisComponent,ComponentLifecycle,ComponentLifecycleExtension,MessageEventGenerator,Service,StateManagedComponent
@ComponentProfile(summary="Generate a unique value and attach it as metadata", tag="service,metadata") public class GenerateUniqueMetadataValueService extends MetadataServiceImplService implementation that generates a unique item of metadata.Uses the configured
IdGeneratorinstance 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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.adaptris.core.services.metadata.MetadataServiceImpl
MetadataServiceImpl.LogWrapper
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.services.metadata.MetadataServiceImpl
DEBUG, ERROR, INFO, TRACE, WARN
-
Fields inherited from class com.adaptris.core.ServiceImp
log
-
-
Constructor Summary
Constructors Constructor Description GenerateUniqueMetadataValueService()GenerateUniqueMetadataValueService(java.lang.String metadataKey)GenerateUniqueMetadataValueService(java.lang.String metadataKey, IdGenerator generator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddoService(AdaptrisMessage msg)Apply the service to the message.IdGeneratorgetGenerator()java.lang.StringgetMetadataKey()Returns the metadata key whose value should be checked.voidsetGenerator(IdGenerator idg)Set the generator to be used.voidsetMetadataKey(java.lang.String s)Sets the metadata key whose which will store the new value.-
Methods inherited from class com.adaptris.core.services.metadata.MetadataServiceImpl
closeService, getMetadataLogger, initService, logMetadata, logMetadata, logMetadata, logMetadata, prepare, setMetadataLogger, withMetadataLogger
-
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
-
GenerateUniqueMetadataValueService
public GenerateUniqueMetadataValueService()
-
GenerateUniqueMetadataValueService
public GenerateUniqueMetadataValueService(java.lang.String metadataKey)
-
GenerateUniqueMetadataValueService
public GenerateUniqueMetadataValueService(java.lang.String metadataKey, IdGenerator generator)
-
-
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
-
getMetadataKey
public java.lang.String getMetadataKey()
Returns the metadata key whose value should be checked.
- Returns:
- metadataKey the metadata key whose value should be checked
-
setMetadataKey
public void setMetadataKey(java.lang.String s)
Sets the metadata key whose which will store the new value.- Parameters:
s- the metadata key; if set to null, then a unique-key will be generated using the configuredsetGenerator(IdGenerator).
-
getGenerator
public IdGenerator getGenerator()
-
setGenerator
public void setGenerator(IdGenerator idg)
Set the generator to be used.- Parameters:
idg- the generator; default isGuidGenerator
-
-