@ComponentProfile(summary="Read a file from a specific path into the message payload", tag="service,file") public class ReadFileService extends ServiceImp
In the adapter configuration file this class is aliased as read-file-service which is the preferred alternative to the fully qualified classname when building your configuration.
Modifier and Type | Class and Description |
---|---|
static interface |
ReadFileService.ContentTypeProbe |
log
CONFIRMATION_ID_KEY
Constructor and Description |
---|
ReadFileService() |
Modifier and Type | Method and Description |
---|---|
protected void |
closeService() |
protected ReadFileService.ContentTypeProbe |
contentTypeProbe() |
void |
doService(AdaptrisMessage message)
Apply the service to the message.
|
java.lang.String |
getContentTypeMetadataKey() |
ReadFileService.ContentTypeProbe |
getContentTypeProbe() |
java.lang.String |
getFilePath()
Get the file path parameter.
|
protected void |
initService() |
void |
prepare()
Prepare for initialisation.
|
void |
setContentTypeMetadataKey(java.lang.String contentTypeMetadataKey)
Sets the metadata key set the content type as, if not provided will not be set.
|
void |
setContentTypeProbe(ReadFileService.ContentTypeProbe contentTypeProbe)
If
setContentTypeMetadataKey(String) is set, then this interface is used to probe the content type of the file. |
void |
setFilePath(java.lang.String filePath)
Set the file path parameter.
|
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getLookupName, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setLookupName, setUniqueId, start, stop
public void doService(AdaptrisMessage message) throws ServiceException
Service
Apply the service to the message.
message
- the AdaptrisMessage
to processServiceException
- wrapping any underlying Exception
spublic void prepare() throws CoreException
ComponentLifecycleExtension
CoreException
protected void closeService()
closeService
in class ServiceImp
protected void initService() throws CoreException
initService
in class ServiceImp
CoreException
public java.lang.String getFilePath()
public void setFilePath(java.lang.String filePath)
filePath
- The file path parameter.public java.lang.String getContentTypeMetadataKey()
public void setContentTypeMetadataKey(java.lang.String contentTypeMetadataKey)
contentTypeMetadataKey
- public ReadFileService.ContentTypeProbe getContentTypeProbe()
public void setContentTypeProbe(ReadFileService.ContentTypeProbe contentTypeProbe)
setContentTypeMetadataKey(String)
is set, then this interface is used to probe the content type of the file.
By default Files.probeContentType(java.nio.file.Path)
is used which means no additional jars are required. This
implementation is platform dependent; so an alternative is available in the com.adaptris:interlok-filesystem
module.
contentTypeProbe
- how to probe for the content type; by default uses Files.probeContentType(java.nio.file.Path)
if not explicitly configured.protected ReadFileService.ContentTypeProbe contentTypeProbe()