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 ServiceImpImplementation of
Servicethat writes metadata to the filesystem.Used in conjunction with
ReadMetadataFromFilesystemto 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 classWriteMetadataToFilesystem.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 voidcloseService()voiddoService(AdaptrisMessage msg)Apply the service to the message.java.lang.StringgetBaseUrl()FileNameCreatorgetFilenameCreator()MetadataFiltergetMetadataFilter()WriteMetadataToFilesystem.OutputStylegetOutputStyle()java.lang.BooleangetOverwriteIfExists()protected voidinitService()booleanoverwriteIfExists()voidprepare()Prepare for initialisation.voidsetBaseUrl(java.lang.String baseUrl)voidsetFilenameCreator(FileNameCreator creator)Set the filename creator implementation used to create the filename.voidsetMetadataFilter(MetadataFilter filter)Set a metadata filter that will filter out metadata before it is written to filesystemvoidsetOutputStyle(WriteMetadataToFilesystem.OutputStyle style)Set the output style for the metadata.voidsetOverwriteIfExists(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:ServiceApply the service to the message.
- Parameters:
msg- theAdaptrisMessageto process- Throws:
ServiceException- wrapping any underlyingExceptions
-
initService
protected void initService() throws CoreException- Specified by:
initServicein classServiceImp- Throws:
CoreException
-
closeService
protected void closeService()
- Specified by:
closeServicein 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 CoreExceptionDescription copied from interface:ComponentLifecycleExtensionPrepare for initialisation.- Throws:
CoreException
-
getBaseUrl
public java.lang.String getBaseUrl()
-
-