Table of Contents
<jbi version="1.0" xmlns='http://java.sun.com/xml/ns/jbi'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:petals="http://petals.objectweb.org/"
xmlns:extensions="http://petals.objectweb.org/extensions/"
xmlns:keyvalue="http://petals.objectweb.org/extensions/key-value/">
<services binding-component="true">
<consumes interface-name="Zip"
service-name="petals:ZipService"
endpoint-name="ZipEndpoint">
<extensions:extensions>
<keyvalue:extension>
<address>/home/petals/filetransfer/scandirectory</address>
<operation>zipfile</operation>
<polling-period>5000</polling-period>
<output-dir>/home/petals/filetransfer/outputdirectory</output-dir>
<filename-filter>.xml</filename-filter>
</keyvalue:extension>
</extensions:extensions>
</consumes>
</services>
</jbi>Table 2.1. service-unit attributes to provide services
| Attribute | Description | Default | Required |
|---|---|---|---|
| consumes | Name of the JBI service that will be called into the JBI environment. Only the interface (Qname) name can be provided (the container will choose a ServiceEndpoint for this interface), or you can only set service (qname) and endpoint (string) names, without the interface name. | Yes |
Table 2.2. extensions
| Attribute | Description | Default Value | Required |
|---|---|---|---|
| address | address of the polled directory. It is recommended to create absolute address. | yes | |
| operation | operation to invoke on the foreign JBI endpoint | yes | |
| attachment | send the file(s) as JBI attchament if value is true or put the file content as JBI message payload. | false | no |
| polling-period | the directory polling period in ms. | 2000 | no |
| output-dir | the directory used to save files returned by foreign JBI endpoint | $INSTALL/work | no |
| filename-filter | Used to filter just a subset of the direcotry files. If a file name contains the filter value, it will be added in the outgoing attachment. | [empty string] | no |
| mep | The MEP to use for the message exchange. Possible values are 'in-only', 'in-opt-out', 'in-out', 'robust-in-only' | in-only | no |
| add-tags | A list of white space separated strings such as 'tag1 tag2 tagN'. These values will be used to wrap the incoming message. A simple message like '<data>simple message content</data>' will becomeWrapped message will be '<tag1><tag2><tagN><data>simple message content</data></tagN></tag2></tag1>' and written to file. | no |
If you want to send files to a JBI endpoint, put files in the
directory defined by the address element. The
filetransfer component will detect new files in the directory and then
send them to the service and endpoint defined in the consumes section
of the service unit descriptor.
In the previous code
snippet, when '.xml' files are detected in the /home/petals/filetransfer/scandirectory
directory, a message exchange will be created, its operation will be
set the 'zipfile' and message will be sent to the
'ZipEndpoint'.
<jbi version="1.0" xmlns='http://java.sun.com/xml/ns/jbi'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:petals="http://petals.objectweb.org/"
xmlns:extensions="http://petals.objectweb.org/extensions/"
xmlns:keyvalue="http://petals.objectweb.org/extensions/key-value/">
<services binding-component="true">
<provides interface-name="TestOnJBIMessage"
service-name="petals:TestOnJBIMessageService"
endpoint-name="TestOnJBIMessageEndpoint">
<extensions:extensions>
<keyvalue:extension>
<address>/home/petals/filetransfer/receive</address>
</keyvalue:extension>
</extensions:extensions>
</provides>
</services>
</jbi>Table 2.3. service-unit attributes to provide services
| Attribute | Description | Default | Required |
|---|---|---|---|
| provides | Name of the JBI service that will be activated to expose the directory into the JBI environment. interface (qname), service (qname) and endpoint (string) name are required. | Yes |
Address is composed of these elements, which are destined to be configurable as extensions :
Table 2.4. address attributes for sending mails
| Attribute | Description | Default Value | Required |
|---|---|---|---|
| address | The name of the local host directory to write incoming JBI message to. It is recommended to create absolute address. | yes | |
| file-name | The file name prefix that will be used when created new files on incoming JBI messages. | content | no |
| remove-tags | A list of white space separated strings such as 'tag1 tag2 tagN'. These values will be used to unwrap the incoming message content. A simple message like <tag1><tag2><tagN><data>simple message content</data></tagN></tag2></tag1>' will become '<data>simple message content</data>'. | no | |
| script | The name of a system script to be launched on incoming JBI message. If the script is not found in the path if will throw an HandlingException. |
When deploying a service unit like in the previous code snippet, all
the JBI messages received on the TestOnJBIMessageService service will
be analyzed and will produce new files in the /home/petals/filetransfer/receive
directory defined in the extensions.


PEtALS 2.0 & pack (2007/09/28)




