org.mule.transport.sftp
Class SftpReceiverRequesterUtil

java.lang.Object
  extended by org.mule.transport.sftp.SftpReceiverRequesterUtil

public class SftpReceiverRequesterUtil
extends Object

Contains reusable methods not directly related to usage of the jsch sftp library (they can be found in the class SftpClient).

Author:
Magnus Larsson

Constructor Summary
SftpReceiverRequesterUtil(ImmutableEndpoint endpoint)
           
 
Method Summary
protected  boolean canProcessFile(String fileName, SftpClient client, long fileAge, long sizeCheckDelayMs)
          Checks if the file has been changed.
 String[] getAvailableFiles(boolean onlyGetTheFirstOne)
           
 InputStream retrieveFile(String fileName, SftpNotifier notifier)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SftpReceiverRequesterUtil

public SftpReceiverRequesterUtil(ImmutableEndpoint endpoint)
Method Detail

getAvailableFiles

public String[] getAvailableFiles(boolean onlyGetTheFirstOne)
                           throws Exception
Throws:
Exception

retrieveFile

public InputStream retrieveFile(String fileName,
                                SftpNotifier notifier)
                         throws Exception
Throws:
Exception

canProcessFile

protected boolean canProcessFile(String fileName,
                                 SftpClient client,
                                 long fileAge,
                                 long sizeCheckDelayMs)
                          throws Exception
Checks if the file has been changed.

Note! This assumes that the time on both servers are synchronized!

Parameters:
fileName - The file to check
client - instance of StftClient
fileAge - How old the file should be to be considered "old" and not changed
sizeCheckDelayMs - Wait time (in ms) between size-checks to determine if a file is ready to be processed.
Returns:
true if the file has changed
Throws:
Exception - Error


Copyright © 2003-2014 MuleSoft, Inc.. All Rights Reserved.