Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Raynard Fischer   on May 22 In Java Category.

  
Question Answered By: Hubert Taylor   on May 22

FTP
<ftp-provider>, <ftp-bus>, <ftp-listener> and <ftp-message-filter>: The <ftp-message-filter> can be added to either the <ftp-bus> or <ftp-listener> elements. Where the <ftp-provider> and <ftp-bus> specify the ftp  access properties, the <ftp-message-filter> specifies the message/file selection and processing properties

FTP Provider Configuration

Property Description Required
hostname Can be a combination of <host:port> of just <host> which will use port 21. Yes
username Username that will be used for the ftp connection. Yes
password Password for the above user Yes
directory The ftp directory that is monitored for incoming new files Yes
input-suffix The file suffix used to filter files targeted for consumption by the ESB (note: add the dot, so something like '.esbIn'). This can also be specified as an empty string to specify that all files should be retrieved. Yes
work-suffix The file suffix used while the file is being process, so that another thread or process won't pick it up too. Defaults to .esbInProcess. No
post-delete If true, the file will be deleted after it is processed. Note that in that case post-directory and post-suffix have no effect. Defaults to true. No
post-directory The ftp directory to which the file will be moved after it is processed by the ESB. Defaults to the value of directory above. No
post-suffix The file suffix which will be added to the file name after it is processed. Defaults to .esbDone. No
error-delete If true, the file will be deleted if an error occurs during processing. Note that in that case error-directory and error-suffix have no effect. Defaults to true. No
error-directory The ftp directory to which the file will be moved after when an error occurs during processing. Defaults to the value of directory above. No
error-suffix The file suffix which will be added to the file name after an error occurs during processing. Defaults to .esbError. No
protocol The protocol, can be one of:
sftp (SSH File Transfer Protocol)
ftps (FTP over SSL)
ftp (default).
No
passive Indicates that the ftp connection  is in passive. Setting this to true means the ftp client will establish two connections to the ftpserver. Defaults to false, meaning that the client will tell the ftpserver which port the ftpserver should connect  to. The ftpserver then establishes the connection to the client. No
read-only If true, the ftp server  does not permit write operations on files. Note that in this case the following properties have no effect: work-suffix, post-delete,post-directory, post-suffix, error-delete, error-directory, and error-suffix. Defaults to false. See section “Read-only FTP Listener for more information. No
certificate-url The url to a public server certificate for ftps server verification or to a private certificate for sftp client verification. An sftp certificate can be located as a resource embedded within a deployment artifact No
certificate-name The common name for a certificate for ftps server verification No
certificate-passphrase The pass-phrase of the private key for sftp client verification. No
FTP Provider Configuration


FTP Listener Configuration

Schedule Listener that polls for remote files based on the configured schedule (scheduleidref). See Service Scheduling.
Read-only FTP Listener
Setting the ftp-provider property “read-only” to true will tell the system that the remote file system does not allow write operations. This is often the case when the ftp server is running on a mainframe computer where permissions are given to a specific file.
The read-only implementation uses jboss  TreeCache to hold a list of the file names that have been retrieved and only fetch those that have not previously been retrieved. The cache should be configured to use a cacheloader to persist the cache to stable storage.
Please note that there must exist a strategy for removing the file names from the cache. There might be an archiving process on the mainframe that moves the files to a different location on a regular basis. The removal of fil enames from the cache could be done by having a database procedure that removes all file names from the cache every couple of days. Another strategy would be to specify a TreeCacheListener that upon evicting file names from the cache also removes them from the cacheloader. The eviction period would then be configurable. This can be configured by setting a property (removeFilesystemStrategy-cacheListener) in the ftp-listener configuration.
Name Description
scheduleidref Schedule used by the FTP listener. See Service Scheduling.
remoteFilesystemStrategy-class Override the remote file system strategy with a class that implements: org.jboss.soa.esb.listeners.gateway.remotestrategies.RemoteFileSystemStrategy. Defaults to org.jboss.soa.esb.listeners.gateway.remotestrategies.ReadOnlyRemoteFileSystemStrategy
remoteFilesystemStrategy-configFile Specify a JBoss TreeCache configuration file on the local file system or one that exists on the classpath. Defaults to looking for a file named /ftpfile-cache-config.xml which it expects to find in the root of the classpath
removeFilesystemStrategy-cacheListener Specifies an JBoss TreeCacheListener implementation to be used with the TreeCache. Default is no TreeCacheListener.
maxNodes The maximum number of files that will be stored in the cache. 0 denotes no limit
timeToLiveSeconds Time to idle (in seconds) before the node is swept away. 0 denotes no limit
maxAgeSeconds Time an object should exist in TreeCache (in seconds) regardless of idle time before the node is swept away. 0 denotes no limit
Read-only FTP Listener Configuration


Example configuration:
<ftp-listener name="FtpGateway"
busidref="helloFTPChannel"
maxThreads="1"
is-gateway="true"
schedule-frequency="5">
<property name="remoteFileSystemStrategy-configFile" value="./ftpfile-cache-config.xml"/>
<property name="remoteFileSystemStrategy-cacheListener" value="org.jboss.soa.esb.listeners.gateway.remotestrategies.cache.DeleteOnEvictTreeCacheListener"/>

</ftp-listener>

Example snippet from JBoss cache configuration:
<region name="/ftp/cache">
<attribute name="maxNodes">5000</attribute>
<attribute name="timeToLiveSeconds">1000</attribute>
<attribute name="maxAgeSeconds">86400</attribute>
</region>

The helloworld_ftp_action quickstart demonstrates the read-only configuration. Run 'ant help' in the helloworld_ftp_action quickstart directory for instructions on running the quickstart. Please refer to the JBoss Cache documentation for more information about the configuration options available (http://labs.jboss.com/jbosscache/docs/index.html).

Share: