Class AddTimestampMetadataService
- java.lang.Object
-
- com.adaptris.core.ServiceImp
-
- com.adaptris.core.services.metadata.AddTimestampMetadataService
-
- All Implemented Interfaces:
AdaptrisComponent,ComponentLifecycle,ComponentLifecycleExtension,MessageEventGenerator,Service,StateManagedComponent
@ComponentProfile(summary="Add a timestamp as metadata", tag="service,metadata,timestamp,datetime") public class AddTimestampMetadataService extends ServiceImpAdds timestamp information as metadata.In addition to supporting all the patterns allowed by
SimpleDateFormat, this service also supports the special valuesSECONDS_SINCE_EPOCHandMILLISECONDS_SINCE_EPOCHwhich 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.- See Also:
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.
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.ServiceImp
log
-
-
Constructor Summary
Constructors Constructor 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, TimestampGenerator s)AddTimestampMetadataService(java.lang.String format, java.lang.String metadataKey, java.lang.Boolean alwaysReplace, java.lang.String offset)
-
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.lang.BooleangetAlwaysReplace()DateFormatBuildergetDateFormatBuilder()java.lang.StringgetMetadataKey()TimestampGeneratorgetTimestampGenerator()protected voidinitService()voidprepare()Prepare for initialisation.voidsetAlwaysReplace(java.lang.Boolean b)Specify whether to always replace the metadata.voidsetDateFormatBuilder(DateFormatBuilder builder)voidsetMetadataKey(java.lang.String metadataKey)voidsetTimestampGenerator(TimestampGenerator 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
-
-
-
-
Constructor Detail
-
AddTimestampMetadataService
public AddTimestampMetadataService()
-
AddTimestampMetadataService
public AddTimestampMetadataService(java.lang.String format, java.lang.String metadataKey)
-
AddTimestampMetadataService
public AddTimestampMetadataService(java.lang.String format, java.lang.String metadataKey, java.lang.Boolean alwaysReplace)
-
AddTimestampMetadataService
public AddTimestampMetadataService(java.lang.String format, java.lang.String metadataKey, java.lang.Boolean alwaysReplace, java.lang.String offset)
-
AddTimestampMetadataService
public AddTimestampMetadataService(java.lang.String format, java.lang.String metadataKey, java.lang.Boolean alwaysReplace, TimestampGenerator s)
-
-
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(com.adaptris.core.AdaptrisMessage)
-
initService
protected void initService() throws CoreException- Specified by:
initServicein classServiceImp- Throws:
CoreException
-
closeService
protected void closeService()
- Specified by:
closeServicein classServiceImp
-
getMetadataKey
public java.lang.String getMetadataKey()
- Returns:
- the metadataKey
-
setMetadataKey
public void setMetadataKey(java.lang.String metadataKey)
- Parameters:
metadataKey- the metadataKey to set
-
getAlwaysReplace
public java.lang.Boolean getAlwaysReplace()
- Returns:
- the alwaysReplace
-
setAlwaysReplace
public void setAlwaysReplace(java.lang.Boolean b)
Specify whether to always replace the metadata.- Parameters:
b- the alwaysReplace to set, default is false.
-
prepare
public void prepare() throws CoreExceptionDescription copied from interface:ComponentLifecycleExtensionPrepare for initialisation.- Throws:
CoreException
-
getTimestampGenerator
public TimestampGenerator getTimestampGenerator()
- Returns:
- the timestampGenerator
-
setTimestampGenerator
public void setTimestampGenerator(TimestampGenerator s)
- Parameters:
s- the timestampGenerator to set
-
getDateFormatBuilder
public DateFormatBuilder getDateFormatBuilder()
-
setDateFormatBuilder
public void setDateFormatBuilder(DateFormatBuilder builder)
-
-