Class AddFormattedMetadataService
- java.lang.Object
-
- com.adaptris.core.ServiceImp
-
- com.adaptris.core.services.metadata.AddFormattedMetadataService
-
- All Implemented Interfaces:
AdaptrisComponent,ComponentLifecycle,ComponentLifecycleExtension,MessageEventGenerator,Service,StateManagedComponent
@ComponentProfile(summary="Add a formatted metadata item to a Message", tag="service,metadata") public class AddFormattedMetadataService extends ServiceImpAdd a formatted metadata item to a Message.Allows you to add a new metadata key using
String.format()as the syntax.In the adapter configuration file this class is aliased as add-formatted-metadata-service which is the preferred alternative to the fully qualified classname when building your configuration.
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.ServiceImp
log
-
-
Constructor Summary
Constructors Constructor Description AddFormattedMetadataService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcloseService()voiddoService(AdaptrisMessage msg)Apply the service to the message.java.util.List<java.lang.String>getArgumentMetadataKeys()ElementFormattergetElementFormatter()Get the element formatter.java.lang.StringgetFormatString()java.lang.StringgetMetadataKey()protected voidinitService()voidprepare()Prepare for initialisation.voidsetArgumentMetadataKeys(java.util.List<java.lang.String> l)voidsetElementFormatter(ElementFormatter elementFormatter)Set the element formatter.voidsetFormatString(java.lang.String formatString)Set the format string that complies withString.format(String, Object...).voidsetMetadataKey(java.lang.String metadatakey)AddFormattedMetadataServicewithArgumentMetadataKeys(java.lang.String... s)AddFormattedMetadataServicewithArgumentMetadataKeys(java.util.List<java.lang.String> s)AddFormattedMetadataServicewithFormatString(java.lang.String s)AddFormattedMetadataServicewithMetadataKey(java.lang.String s)-
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
-
prepare
public void prepare() throws CoreExceptionDescription copied from interface:ComponentLifecycleExtensionPrepare for initialisation.- Throws:
CoreException
-
initService
protected void initService() throws CoreException- Specified by:
initServicein classServiceImp- Throws:
CoreException
-
closeService
protected void closeService()
- Specified by:
closeServicein classServiceImp
-
getFormatString
public java.lang.String getFormatString()
- Returns:
- the formatString
-
setFormatString
public void setFormatString(java.lang.String formatString)
Set the format string that complies withString.format(String, Object...).- Parameters:
formatString- the formatString to set
-
withFormatString
public AddFormattedMetadataService withFormatString(java.lang.String s)
-
getArgumentMetadataKeys
public java.util.List<java.lang.String> getArgumentMetadataKeys()
- Returns:
- the argumentMetadataKeys
-
setArgumentMetadataKeys
public void setArgumentMetadataKeys(java.util.List<java.lang.String> l)
- Parameters:
l- the argumentMetadataKeys to set
-
withArgumentMetadataKeys
public AddFormattedMetadataService withArgumentMetadataKeys(java.util.List<java.lang.String> s)
-
withArgumentMetadataKeys
public AddFormattedMetadataService withArgumentMetadataKeys(java.lang.String... s)
-
getMetadataKey
public java.lang.String getMetadataKey()
- Returns:
- the metadatakey
-
setMetadataKey
public void setMetadataKey(java.lang.String metadatakey)
- Parameters:
metadatakey- the metadatakey to set
-
withMetadataKey
public AddFormattedMetadataService withMetadataKey(java.lang.String s)
-
getElementFormatter
public ElementFormatter getElementFormatter()
Get the element formatter.- Returns:
- The element formatter.
-
setElementFormatter
public void setElementFormatter(ElementFormatter elementFormatter)
Set the element formatter.- Parameters:
elementFormatter- The element formatter.
-
-