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\}. | | |
| folder | Working directory where files are written or retrieved. 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 descriptor for the PEtALS' "petals-bc-filetransfer" component
(FileTransfer). Originally created for the version 2 of the component.
-->
<jbi:jbi version="1.0"
xmlns:filetransfer="http://petals.ow2.org/components/filetransfer/version-3"
xmlns:jbi="http://java.sun.com/xml/ns/jbi" xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-5"
xmlns:generateNs="http://petals.ow2.org/filetransfer" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!--
Import a Service into PEtALS or Expose a PEtALS Service => use a BC.
-->
<jbi:services binding-component="true">
<!-- Import a Service into PEtALS => provides a Service. -->
<jbi:provides endpoint-name="myFileTransferSUEndpointName"
interface-name="filetransfer:FileTransfer" service-name="filetransfer:myFileTransferSUServiceName">
<!-- CDK specific elements -->
<petalsCDK:wsdl>FileTransferService.wsdl</petalsCDK:wsdl>
<petalsCDK:validate-wsdl>true</petalsCDK:validate-wsdl>
<!-- Component specific elements -->
<filetransfer:folder>${PETALS_HOME}/filetransfer/out</filetransfer:folder>
<filetransfer:backup-directory>${PETALS_HOME}/filetransfer/backup</filetransfer:backup-directory>
<filetransfer:filename>gettingstarted.xml</filetransfer:filename>
</jbi:provides>
</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
If you want to invoke a service in the JBI bus with files, put the files in the configured directory (folder). 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 or base-msg), the component creates a new message exchange and attachs the file, either as source or 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 ccording to xop rules.
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 following code snippet, all the files put in the directory $PETALS_HOME/filetransfer/in would be set as the payload of an invocation to the _ftContentNoBaseMsgService_ service.
h2. Configurations
{include:0 CDK SU Consume Configuration}
\\
*Service Unit attributes to provide services*
|| Attribute \\ || Description \\ || Default Value \\ || Required \\ ||
| folder \\ | Working directory where files are written or retrieved. $ \{myEnvVariable\} environment variables are supported. | {center}\-{center}\\ | {center}Yes{center}\\ |
| backup-directory \\ | The directory where files are moved after being read.Environment variables are supported with the form $\{myEnvVariable\}. | | {center}No{center} |
| polling-period | Polling period in milliseconds | {center}1000{center}\\ | {center}No{center}\\ |
| filename | Pattern used filter files to read | {center}\*{center}\\ | {center}No{center}\\ |
| transfer-mode \\ | The mode of transfer of the received file(s) as message payload. \\
Accepted values : content, attachment. | {center}attachment{center}\\ | {center}No{center}\\ |
| base-message \\ | The skeleton of XML-message to send to the consumed service. \\
It may contain *$content* or *$attachment*, or none of them. This is the way the component should link the file with the returned message. \\
* *$content* will be replaced by the file content.
* *$attachment* will set the file in attachment. It will be replaced by a xop:include element which references the attachment (MTOM-like). | | {center}No{center} |
{note}The parameter "transfer-mode" and "base-msg" can not be used at the same time.{note}
h3. Service Unit descriptor
The service unit is configurable via its extensions in the jbi.xml file.
*Example 1{*}*: used parameter* *transfer{*}*\-mode*
{code:lang=xml}
<?xml version="1.0" encoding="UTF-8"?>
<jbi:jbi xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-5"
xmlns:wsdl="http://petals.ow2.org/filetransfer"
xmlns:filetransfer="http://petals.ow2.org/components/filetransfer/version-3"
xmlns:jbi="http://java.sun.com/xml/ns/jbi" version="1.0">
<jbi:services binding-component="false">
<jbi:consumes interface-name="wsdl:ftContentNoBaseMsg"
service-name="wsdl:ftContentNoBaseMsgService"
endpoint-name="ftContentNoBaseMsgEndpoint">
<petalsCDK:timeout>20</petalsCDK:timeout>
<petalsCDK:mep>InOnly</petalsCDK:mep>
<petalsCDK:operation>simplefiletransfer</petalsCDK:operation>
<filetransfer:folder>${PETALS_HOME}/filetransfer/in</filetransfer:folder>
<filetransfer:polling-period>3000</filetransfer:polling-period>
<filetransfer:transfer-mode>content</filetransfer:transfer-mode>
</jbi:consumes>
</jbi:services>
</jbi:jbi>
{code}
*Example 2 : used parameter base-msg*
{code:lang=xml}
<?xml version="1.0" encoding="UTF-8"?>
<jbi:jbi version="1.0"
xmlns:filetransfer="http://petals.ow2.org/components/filetransfer/version-3"
xmlns:generatedNs="http://petals.ow2.org/filetransfer"
xmlns:jbi="http://java.sun.com/xml/ns/jbi"
xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-5"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- Import a Service into Petals or Expose a Petals Service => use a BC. -->
<jbi:services binding-component="true">
<!-- Expose a Petals Service => consumes a Service. -->
<jbi:consumes
interface-name="itfNs:ftAttachmentBaseMsg"
service-name="generatedNs:ftAttachmentBaseMsgService"
endpoint-name="ftAttachmentBaseMsgEndpoint" xmlns:itfNs="http://petals.ow2.org/filetransfer">
<!-- CDK specific elements -->
<petalsCDK:timeout>30000</petalsCDK:timeout>
<petalsCDK:mep>InOnly</petalsCDK:mep>
<!-- Component specific elements -->
<filetransfer:folder>${PETALS_HOME}/filetransfer/in4</filetransfer:folder>
<filetransfer:polling-period>1000</filetransfer:polling-period>
<filetransfer:base-message><![CDATA[<customMessage><attachments><filein>$attachment</filein></attachments></customMessage>]]></filetransfer:base-message>
</jbi:consumes>
</jbi:services>
</jbi:jbi>
{code}
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: