@ComponentProfile(summary="Add Static Metadata to a Message", tag="service,metadata") public class AddMetadataService extends MetadataServiceImpl
Implementation of Service
that adds static metadata to be added to a message.
Each metadata-element is added in sequence to the message, overwriting any existing metadata.
Additional behaviour is possible based on the value portion of the metadata-element.
In the adapter configuration file this class is aliased as add-metadata-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 |
---|
AddMetadataService()
Creates a new instance.
|
AddMetadataService(java.util.Collection<MetadataElement> elements) |
AddMetadataService(MetadataElement... elements) |
Modifier and Type | Method and Description |
---|---|
void |
addMetadataElement(MetadataElement element)
Adds a
MetadataElement s to the Set that will be added to the AdaptrisMessage . |
void |
addMetadataElement(java.lang.String key,
java.lang.String value)
Adds a
MetadataElement s made up of the passed key and value to the Set that will be added to the
AdaptrisMessage . |
protected static MetadataElement |
build(MetadataElement e,
AdaptrisMessage msg) |
void |
doService(AdaptrisMessage msg)
Adds the configured metadata to the message.
|
java.util.Set<MetadataElement> |
getMetadataElements()
Returns the
MetadataElement s that will be added to the AdaptrisMessage . |
java.lang.Boolean |
getOverwrite() |
protected boolean |
overwrite(AdaptrisMessage msg,
java.lang.String key) |
void |
setMetadataElements(java.util.Set<MetadataElement> s)
Sets the
MetadataElement s that will be added to the AdaptrisMessage . |
void |
setOverwrite(java.lang.Boolean b)
Whether or not to always overwrite metadata with the values configured.
|
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 AddMetadataService()
Creates a new instance.
public AddMetadataService(java.util.Collection<MetadataElement> elements)
public AddMetadataService(MetadataElement... elements)
public void doService(AdaptrisMessage msg) throws ServiceException
Adds the configured metadata to the message.
msg
- the message to processServiceException
- wrapping any underlying Exception
spublic java.util.Set<MetadataElement> getMetadataElements()
Returns the MetadataElement
s that will be added to the AdaptrisMessage
.
MetadataElement
s that will be added to the AdaptrisMessage
public void setMetadataElements(java.util.Set<MetadataElement> s)
Sets the MetadataElement
s that will be added to the AdaptrisMessage
.
s
- the MetadataElement
s that will be added to the AdaptrisMessage
public void addMetadataElement(MetadataElement element)
Adds a MetadataElement
s to the Set
that will be added to the AdaptrisMessage
.
element
- a MetadataElement
s to add to the AdaptrisMessage
public void addMetadataElement(java.lang.String key, java.lang.String value)
Adds a MetadataElement
s made up of the passed key and value to the Set
that will be added to the
AdaptrisMessage
.
key
- the metadata key, may not be null or emptyvalue
- the metadata valuepublic java.lang.Boolean getOverwrite()
public void setOverwrite(java.lang.Boolean b)
b
- the overwrite to set, default is true.protected boolean overwrite(AdaptrisMessage msg, java.lang.String key)
protected static MetadataElement build(MetadataElement e, AdaptrisMessage msg) throws ServiceException
ServiceException