Class WriteMetadataToFilesystem
- java.lang.Object
-
- com.adaptris.core.ServiceImp
-
- com.adaptris.core.services.metadata.WriteMetadataToFilesystem
-
- All Implemented Interfaces:
AdaptrisComponent
,ComponentLifecycle
,ComponentLifecycleExtension
,MessageEventGenerator
,Service
,StateManagedComponent
@ComponentProfile(summary="Write the current set of metadata to the filesystem", tag="service,metadata") public class WriteMetadataToFilesystem extends ServiceImp
Implementation of
Service
that writes metadata to the filesystem.Used in conjunction with
ReadMetadataFromFilesystem
to allow preservation of metadata across integration points that make use of the filesystem.In the adapter configuration file this class is aliased as write-metadata-to-filesystem which is the preferred alternative to the fully qualified classname when building your configuration.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
WriteMetadataToFilesystem.OutputStyle
-
Field Summary
-
Fields inherited from class com.adaptris.core.ServiceImp
log
-
-
Constructor Summary
Constructors Constructor Description WriteMetadataToFilesystem()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
closeService()
void
doService(AdaptrisMessage msg)
Apply the service to the message.java.lang.String
getBaseUrl()
FileNameCreator
getFilenameCreator()
MetadataFilter
getMetadataFilter()
WriteMetadataToFilesystem.OutputStyle
getOutputStyle()
java.lang.Boolean
getOverwriteIfExists()
protected void
initService()
boolean
overwriteIfExists()
void
prepare()
Prepare for initialisation.void
setBaseUrl(java.lang.String baseUrl)
void
setFilenameCreator(FileNameCreator creator)
Set the filename creator implementation used to create the filename.void
setMetadataFilter(MetadataFilter filter)
Set a metadata filter that will filter out metadata before it is written to filesystemvoid
setOutputStyle(WriteMetadataToFilesystem.OutputStyle style)
Set the output style for the metadata.void
setOverwriteIfExists(java.lang.Boolean b)
If the file already exists then overwrite it with the current message in transit.-
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:Service
Apply the service to the message.
- Parameters:
msg
- theAdaptrisMessage
to process- Throws:
ServiceException
- wrapping any underlyingException
s
-
initService
protected void initService() throws CoreException
- Specified by:
initService
in classServiceImp
- Throws:
CoreException
-
closeService
protected void closeService()
- Specified by:
closeService
in classServiceImp
-
setBaseUrl
public void setBaseUrl(java.lang.String baseUrl)
-
getFilenameCreator
public FileNameCreator getFilenameCreator()
-
setFilenameCreator
public void setFilenameCreator(FileNameCreator creator)
Set the filename creator implementation used to create the filename.- Parameters:
creator
-
-
getOutputStyle
public WriteMetadataToFilesystem.OutputStyle getOutputStyle()
-
setOutputStyle
public void setOutputStyle(WriteMetadataToFilesystem.OutputStyle style)
Set the output style for the metadata.- Parameters:
style
- one of Text or XML (default is null, which means Text)- See Also:
WriteMetadataToFilesystem.OutputStyle
-
getOverwriteIfExists
public java.lang.Boolean getOverwriteIfExists()
- Returns:
- the overwriteIfExists
-
setOverwriteIfExists
public void setOverwriteIfExists(java.lang.Boolean b)
If the file already exists then overwrite it with the current message in transit.In reality, this performs a delete of the file (which fails silently if the file does not exist) prior to attempting to write the file with the payload.
- Parameters:
b
- true or false (default false).
-
overwriteIfExists
public boolean overwriteIfExists()
-
getMetadataFilter
public MetadataFilter getMetadataFilter()
-
setMetadataFilter
public void setMetadataFilter(MetadataFilter filter)
Set a metadata filter that will filter out metadata before it is written to filesystem- Parameters:
filter
- the filter.
-
prepare
public void prepare() throws CoreException
Description copied from interface:ComponentLifecycleExtension
Prepare for initialisation.- Throws:
CoreException
-
getBaseUrl
public java.lang.String getBaseUrl()
-
-