
Environment variables are supported with the form $\{myEnvVariable}. | \- | Yes |
| backup-directory | The backup directory where files are put once a transfer has been processed. The backup files are never deleted by the component. \\
Environment variables are supported with the form $\{myEnvVariable}. | system temporary.directory | No |
| polling-period | The period between each polling in ms. | 1000 | No \\ |
| transfer-mode | The mode of transfer of the received file(s) as message payload. \\
Accepted values : content, attachment. | content | No \\ |
{table-plus}
h3. Consumer restrictions
The FileTransfer component supports only InOnly message exchange pattern as consumer.
The FileTransfer component does not support synchronous sendings as consumer.
h3. Consumer usage
If you want to invoke a service in the JBI bus with files, put the files in the configured directory (read-directory). At each configured polling period (polling-period), the component fetchs the incoming files.
For each received files and according to the transfer mode (transfer-mode), the component creates a new message exchange and attachs the file, either as source or as attachment.
If a file is put as a attachment, the name of the attachment is set to the name of the file, and in the source of the message exchange, the component put a XML structure like following :
{code:lang=xml}<attached-files>
<file-name>myFileName</file-name>
<attached-files>{code}
The resulted message exchange(s) are sent to the target endpoint.
During the transfer, if the backup directory (backup-directory) is set, the transfered file is moved into it and never deleted by the component. Otherwise the file is moved to the system temporary directory.
When deploying a service unit like in the previous code snippet, all the files put in the directory $PETALS_HOME/filetransfer/in would be set as the payload of an invocation to the FileService service.
h2. Transfer files out of the JBI bus
PROVIDE SERVICE : Write JBI messages XML content and attachments to directory.
\\ !worddav93ef27655066d2f8dbcd5b821bb00665.png|align=center!
h3. Service Unit descriptor
{code:lang=xml}<?xml version="1.0" encoding="UTF-8"?>
<jbi:jbi version="1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jbi="http://java.sun.com/xml/ns/jbi"
xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-4.0"
xmlns:filetransfer="http://petals.ow2.org/components/filetransfer/version-2.2"
xmlns:generatedNs="http://petals.ow2.org/filetransfer">
<jbi:services binding-component="true">
<jbi:provides
interface-name="generatedNs:put"
service-name="generatedNs:putService"
endpoint-name="putServiceEndpoint">
<!-- WSDL file -->
<petalsCDK:wsdl xsi:nil="true" />
<!-- FileTransfer specific fields -->
<filetransfer:write-directory>${PETALS_HOME}/filetransfer/out</filetransfer:write-directory>
<filetransfer:copy-mode>content-only</filetransfer:copy-mode>
<filetransfer:file-pattern>test.xml</filetransfer:file-pattern>
</jbi:provides>
</jbi:services>
</jbi:jbi>{code}
{include:0 CDK SU Provide Configuration}
{color:#333333} {color}
{table-plus}|| Parameter || Description \\ || Default \\ || Required \\ ||
| write-directory \\ | The location of the directory where to write JBI message. It must be an absolute address. \\
The directory MUST exists. \\
Environment variables are supported with the form $\{myEnvVariable}. \\ | \- | Yes \\ |
| copy-mode \\ | Transfer either the source, the attachments or both of the payload. \\
Possible values are contentonly, attachments-only or content-and-attachments. \\ | content-and-attachments \\ | No \\ |
| file-pattern \\ | The name of the file where the JBI message (the XMl content) will be written in. \\
The system date is appended on each created file. \\ | The operation name, else content.xml \\ | No \\ |
{table-plus}
h3. Provider restrictions
The FileTransfer component only supports InOnly message exchange pattern as service provider.
h3. Provider Usage
According to the configured mode (copy-mode), the XML message content, attachments or both are transfered to the target directory (write-directory).
If the received message is an XML content, the name of the created file would be either the configured file pattern (file-pattern), the operation of the message exchange, or the default name content.xml.
If the received message contains attachments, the name of the created files would be the names of the attachments.
For each file created, the system date is appended to this file name.
When deploying a service unit like in the previous code snippet, all the JBI messages received on the putService service will produce files in the $PETALS_HOME/filetransfer/out directory.
h2. Retrieve files from a folder : the GetFiles service
PROVIDE SERVICE : return files from a folder as XML message or attachements.
h3. Service Unit descriptor
{code:lang=xml}<?xml version="1.0" encoding="UTF-8"?>
<jbi:jbi version="1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jbi="http://java.sun.com/xml/ns/jbi"
xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-4.0"
xmlns:filetransfer="http://petals.ow2.org/components/filetransfer/version-2.2"
xmlns:generatedNs="http://petals.ow2.org/filetransfer">
<jbi:services binding-component="true">
<jbi:provides
interface-name="gefiletransfer:GetFiles"
service-name="generatedNs:myGetFilesService"
endpoint-name="getFilesServiceEndpoint">
<!-- WSDL file -->
<petalsCDK:wsdl xsi:nil="true" />
<!-- FileTransfer specific fields -->
<filetransfer:read-directory>${PETALS_HOME}/filetransfer</filetransfer:read-directory>
</jbi:provides>
</jbi:services>
</jbi:jbi>{code}