Class MapMetadataService
- java.lang.Object
-
- com.adaptris.core.ServiceImp
-
- com.adaptris.core.services.metadata.MetadataServiceImpl
-
- com.adaptris.core.services.metadata.MapMetadataService
-
- All Implemented Interfaces:
AdaptrisComponent,ComponentLifecycle,ComponentLifecycleExtension,MessageEventGenerator,Service,StateManagedComponent
@ComponentProfile(summary="Change a metadata value based on a regular expression match", tag="service,metadata") public class MapMetadataService extends MetadataServiceImplChanges the value of a specific metadata key based on a regular expression match of the value associated with the key.It supports the special syntax of {n} as the replacement value. This indicates that the corresponding match group should be used as the replacement value.
There are similiarities between this service and
ReplaceMetadataValue. This service could be easily replaced with multiple instances ofReplaceMetadataValueand you should consider using that if you have to use match groups.- See Also:
Pattern
In the adapter configuration file this class is aliased as map-metadata-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 MapMetadataService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddoService(AdaptrisMessage msg)Apply the service to the message.java.lang.StringgetMetadataKey()KeyValuePairListgetMetadataKeyMap()Returns aKeyValuePairListin which the key is the regular expression to match the metadata value against, and the value is the replacement value.voidsetMetadataKey(java.lang.String s)voidsetMetadataKeyMap(KeyValuePairList m)Sets aKeyValuePairListin which the key is the regular expression to match the metadata value against, and the value is the replacement value (the replacement value may be an expression a-la%message{metadataKey}.-
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
-
-
-
-
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- See Also:
Service.doService(AdaptrisMessage)
-
getMetadataKeyMap
public KeyValuePairList getMetadataKeyMap()
Returns a
KeyValuePairListin which the key is the regular expression to match the metadata value against, and the value is the replacement value.It supports the special syntax of {n} which indicates that the corresponding match group should be used as the replacement value
- Returns:
- a
KeyValuePairList
-
setMetadataKeyMap
public void setMetadataKeyMap(KeyValuePairList m)
Sets a
KeyValuePairListin which the key is the regular expression to match the metadata value against, and the value is the replacement value (the replacement value may be an expression a-la%message{metadataKey}.- Parameters:
m- aKeyValuePairList
-
getMetadataKey
public java.lang.String getMetadataKey()
- Returns:
- the metadataKey
-
setMetadataKey
public void setMetadataKey(java.lang.String s)
- Parameters:
s- the metadataKey to set
-
-