View Source

{section}
{column}
{info}Only release >= 3.0{info}

h1. Feature

The FileTransfer component is a Binding Component (BC) which supports file transfers.

This component allows to:

* Expose a file system connector as a service which provide a set of 8 operations:
** *put:* Write the received JBI messages in a file with a specified name
** *mput:* Write the JBI message attachments it receives into files.
** *get:* Retrieve *Xml* file corresponding to a pattern, from a folder. Return it as message payload.
** *getAsAttachment:* Retrieve the first file corresponding to a pattern, from a folder. Return it as message's attachment.(XOP standard)
** *mGet:* Retrieve files corresponding to a pattern, from a folder. Return them as message's attachment.
** *checkFile:* Check the availability of a file.
** *del:* Delete one file.
** *dir:* List the content of a folder.

* Poll a configured directory for incoming files. At a poll, each file retrieved is put into a new JBI message, set as source or attachment. The message is sent to a target JBI service.


{info}All attachment are processed by using XOP rules.(XML-binary Optimized Packaging : [http://www.w3.org/TR/xop10/] ){info}

h1. Exposing a file system access as a service

\\
{info}
All operation support wild card character.
{info}



h2. Usage


h3. Put Operation

When the put operation is set on the incoming IN message, the component writes the XML message to the configured directory.

The created file takes the name described in the service unit (filename parameter) otherwise the operation name is taken. For each file created, the system date is appended to this file name.

The IN message looks like :
{code:lang=xml}
<?xml version="1.0" encoding="UTF-8"?>
<ver:put xmlns:ver="http://petals.ow2.org/components/filetransfer/version-3">?</ver:put>
{code}
The service does not return a message.
The available exchange pattern is : *InOnly*.

h3. MPut Operation

When the mput operation is set on the incoming IN message, the component writes the attachments on the configured directory.
The IN message looks like :
{code:lang=xml}
<?xml version="1.0" encoding="UTF-8"?>
<ver:mput>
<ver:attachments xmlns:ver="http://petals.ow2.org/components/filetransfer/version-3">
<!--1 or more repetitions:-->
<ver:filename><xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:test1.xml"/></ver:filename>
<ver:filename><xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:test2.xml"/></ver:filename>
</ver:attachments>
</ver:mput>
{code}
The service does not return a message.

The available exchange pattern is : *InOnly*.

h3. Get Operation

When the get operation is set on the incoming IN message, the component retrieves ONE file from the configured directory and return it as an XML message content.
\\

The name of the file to retrieve is set in the XML IN content of the message.
\\

The IN message looks like :
\\
{code:lang=xml}<?xml version="1.0" encoding="UTF-8"?>
<ver:get xmlns:ver="http://petals.ow2.org/components/filetransfer/version-3">
<ver:filename>file name to retrieve</ver:filename>
</ver:get>
{code}
The OUT message returned to the consumer is the content of the XML file
\\

The service might return a Fault when an element in the request is missing or if an IO error occurs.
\\

The available exchange patterns is : *InOut*.

{info}Only xml file could be processed otherwise an error will be raised.{info}

h3. GetAsAttachement Operation

When the getAsAttachment operation is set on the incoming IN message, the component retrieve ONE file from the configured directory according to the filename(or filter) set in the XML request.
The retrieved file is set in the OUT message as an attachment.

The IN message looks like :
{code:lang=xml}
<?xml version="1.0" encoding="UTF-8"?>
<ver:getAsAttachment xmlns:ver="http://petals.ow2.org/components/ftp/version-3">
<ver:filename>file name to retrieve</ver:filename>
</ver:getAsAttachment>
{code}

The OUT message returned to the consumer contains files, as attachments, and an XML message report :
{code:lang=xml}
<?xml version="1.0" encoding="UTF-8"?>
<tns:getAsAttachmentResponse xmlns:tns="http://petals.ow2.org/components/filetransfer/version-3">
<tns:attachment>
<tns:filename><xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:test1.xml"/></tns:filename>
</tns:attachment>
</tns:getAsAttachmentResponse>
{code}

The service might return a Fault when an element in the request is missing or if an IO error occurs.

The available exchange pattern is : *InOut*.

h3. MGet Operation

When the mget operation is set on the incoming IN message, the component retrieves files from the configured directory, according to the filenames (or filters) set in the XML request.
There is no recursivity, sub folders are ignored.

Each file is set in the OUT message as an attachment.
The IN message looks like:
{code:lang=xml}
<?xml version="1.0" encoding="UTF-8"?>
<ver:mget xmlns:ver="http://petals.ow2.org/components/filetransfer/version-3">
<\!\--1 or more repetitions:-\->
<ver:filename>*.xml</ver:filename>
<ver:filename>myFile.txt</ver:filename>
</ver:mget>
{code}

The OUT message returned to the consumer contains files, as attachments:
{code:lang=xml}
<?xml version="1.0" encoding="UTF-8"?>
<tns:mgetResponse xmlns:tns="http://petals.ow2.org/components/filetransfer/version-3">
<tns:attachments>
<tns:filename><xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:test1.xml"/></tns:filename>
<tns:filename><xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:myFile.txt"/></tns:filename>
</tns:attachments>
</tns:mgetResponse>
{code}

The service might return a Fault when an element in the request is missing or if an IO error occurs.

The available exchange pattern is : *InOut*.

h3. Del Operation

When the del operation is set on the incoming IN message, the component deletes the remote file. The IN message looks like :
{code:lang=xml}<?xml version="1.0" encoding="UTF-8"?>
<ver:del xmlns:ver="http://petals.ow2.org/components/filetransfer/version-3">
<ver:filename>?</ver:filename>
</ver:del>
{code}
The service does not return a message.

The available exchange pattern is : *InOnly*.

h3. CheckFile Operation

When the check operation is set on the incoming IN message, the component check
if the specified file exist. The IN message looks like&nbsp;:
{code:lang=xml}
<ver:checkFile xmlns:ver="http://petals.ow2.org/components/filetransfer/version-3">
<ver:filename>?</ver:filename>
</ver:checkFile>
{code}

The OUT message returned to the consumer looks like&nbsp;:
{code:lang=xml}
<ver:checkFileResponse xmlns:ver="http://petals.ow2.org/components/filetransfer/version-3">
<ver:filename>?</ver:filename>
<ver:exist>true|false</ver:exist>
</ver:checkFileResponse>
{code}

The service might return an ioFault.
The available exchange pattern is : *InOut*.

h2. Configuration

{include:0 CDK SU Provide Configuration}

&nbsp; *Service Unit attributes to provide services*
{table-plus}



























|| Attribute || Description || Default value || Required ||
| filename\\ | 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\\ | {center}No{center} |
| backup-directory\\ | The directory where files are moved after being read. \\
Environment variables are supported with the form ${myEnvVariable}. | | {center}No{center}\\ |
| folder\\ | The location of the directory where to write JBI message, attachments or to searche files. \\
It must be an absolute address. The directory MUST exists.\\
Environment variables are supported with the form ${myEnvVariable}. | | {center}Yes{center}\\ |
{table-plus}

h3. Service Unit descriptor

The service unit is configurable via its extensions in the jbi.xml file:
\\
{code:lang=xml}<?xml version="1.0" encoding="UTF-8"?>
<jbi:jbi 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-5"
version="1.0">

<jbi:services binding-component="true">
....
</jbi:services>
</jbi:jbi>{code}

h3. Service Unit content

The Service Unit has to contain the following elements, packaged in an archive:
\\
* The META-INF/jbi.xml descriptor file, has described above,
* An optional wsdl file describing the related service

{code}service-unit.zip
+ META-INF
- jbi.xml (as defined above)
- service.wsdl (optional)
{code}

h1. Invoking service on incoming file

h2. Configurations


h3. Service Unit descriptor

h1. Component Configuration

The following attributes can be set during the installation phase to configure the component, using the params element of the jbi-install-component ANT task:

{include:0 CDK Component Configuration Table}

{include:0 CDK Parameter scope}
{column}
{column:width=25%}
{panel:title=Table of contents}{toc}{panel}
{panel:title=Contributors}{contributors:order=name|mode=list}{panel}
{column}
{section}