@ComponentProfile(summary="Add a timestamp as metadata", tag="service,metadata,timestamp,datetime") public class AddTimestampMetadataService extends ServiceImp
In addition to supporting all the patterns allowed by SimpleDateFormat
, this service also supports the special
values SECONDS_SINCE_EPOCH
and MILLISECONDS_SINCE_EPOCH
which describe the number of seconds and milliseconds
since midnight Jan 1, 1970 UTC respectively. If specified as the format, then the long value associated will be emitted.
DateFormatUtil.CustomDateFormat
In the adapter configuration file this class is aliased as add-timestamp-metadata-service which is the preferred alternative to the fully qualified classname when building your configuration.
log
CONFIRMATION_ID_KEY
Constructor and Description |
---|
AddTimestampMetadataService() |
AddTimestampMetadataService(java.lang.String format,
java.lang.String metadataKey) |
AddTimestampMetadataService(java.lang.String format,
java.lang.String metadataKey,
java.lang.Boolean alwaysReplace) |
AddTimestampMetadataService(java.lang.String format,
java.lang.String metadataKey,
java.lang.Boolean alwaysReplace,
java.lang.String offset) |
AddTimestampMetadataService(java.lang.String format,
java.lang.String metadataKey,
java.lang.Boolean alwaysReplace,
TimestampGenerator s) |
Modifier and Type | Method and Description |
---|---|
protected void |
closeService() |
void |
doService(AdaptrisMessage msg)
Apply the service to the message.
|
java.lang.Boolean |
getAlwaysReplace() |
DateFormatBuilder |
getDateFormatBuilder() |
java.lang.String |
getMetadataKey() |
TimestampGenerator |
getTimestampGenerator() |
protected void |
initService() |
void |
prepare()
Prepare for initialisation.
|
void |
setAlwaysReplace(java.lang.Boolean b)
Specify whether to always replace the metadata.
|
void |
setDateFormatBuilder(DateFormatBuilder builder) |
void |
setMetadataKey(java.lang.String metadataKey) |
void |
setTimestampGenerator(TimestampGenerator s) |
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getLookupName, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setLookupName, setUniqueId, start, stop
public AddTimestampMetadataService()
public AddTimestampMetadataService(java.lang.String format, java.lang.String metadataKey)
public AddTimestampMetadataService(java.lang.String format, java.lang.String metadataKey, java.lang.Boolean alwaysReplace)
public AddTimestampMetadataService(java.lang.String format, java.lang.String metadataKey, java.lang.Boolean alwaysReplace, java.lang.String offset)
public AddTimestampMetadataService(java.lang.String format, java.lang.String metadataKey, java.lang.Boolean alwaysReplace, TimestampGenerator s)
public void doService(AdaptrisMessage msg) throws ServiceException
Service
Apply the service to the message.
msg
- the AdaptrisMessage
to processServiceException
- wrapping any underlying Exception
sService.doService(com.adaptris.core.AdaptrisMessage)
protected void initService() throws CoreException
initService
in class ServiceImp
CoreException
protected void closeService()
closeService
in class ServiceImp
public java.lang.String getMetadataKey()
public void setMetadataKey(java.lang.String metadataKey)
metadataKey
- the metadataKey to setpublic java.lang.Boolean getAlwaysReplace()
public void setAlwaysReplace(java.lang.Boolean b)
b
- the alwaysReplace to set, default is false.public void prepare() throws CoreException
ComponentLifecycleExtension
CoreException
public TimestampGenerator getTimestampGenerator()
public void setTimestampGenerator(TimestampGenerator s)
s
- the timestampGenerator to setpublic DateFormatBuilder getDateFormatBuilder()
public void setDateFormatBuilder(DateFormatBuilder builder)