Warning

This component has been deprecated in favor to servicemix-vfs component.

This component uses the Jakarta Commons Net library which provides access to file systems, jars/zips/bzip2, temporary files, WebDAV, Samba (CIFS), HTTP, HTTPS, FTP and SFTP among others.

It works similarly to the FTP component where it will write files to a directory (on the virtual file system in this case) and poll for files in a file system.

Here is an example of the component configured. First the poller as its much simpler

<sm:activationSpec componentName="filePoller" service="foo:filePoller" destinationService="foo:receiver">
  <sm:component><bean  class="org.apache.servicemix.components.vfs.FilePoller">
    <property name="workManager" ref="workManager"/>
    <property name="path" value="file:/tmp/servicemix/vfs/test"/>
    <property name="period" value="1000"/>
  </bean></sm:component>
</sm:activationSpec>

 

Then here's the sender. We're using a FileMarshaler here to turn JBI messages into files with an expression using XPath from the message content to generate the file name in the directory.

<sm:activationSpec componentName="fileSender" service="foo:fileSender">
  <sm:component><bean class="org.apache.servicemix.components.vfs.FileWriter">
    <property name="path" value="file:/tmp/servicemix/vfs/test"/>

    <property name="marshaler">
      <bean class="org.apache.servicemix.components.util.DefaultFileMarshaler">
        <property name="fileName">
          <bean class="org.apache.servicemix.expression.JaxenStringXPathExpression">
            <constructor-arg value="concat('sample_', /sample/@id, '.xml')"/>
          </bean>
        </property>
      </bean>
    </property>
  </bean></sm:component>
</sm:activationSpec>