public class FtpEIThread
extends java.lang.Thread
Modifier and Type | Field and Description |
---|---|
protected boolean |
deleteRemoteFiles |
protected FtpFileTracker |
ftpFileTracker |
protected FtpSupportIntf |
ftpSession |
protected static java.lang.String |
HOSTS_FILE |
protected int |
interruptTimeDelay |
protected SMGLock |
ioLock |
protected java.lang.String |
ipAddress |
protected java.lang.String |
localSuffix |
protected LoggerIfc |
logger |
protected static int |
MAX_RETRIES |
protected static int |
MILLISECS_PER_MINUTE |
protected DCNode |
node |
protected boolean |
overwriteExisting |
protected java.lang.String |
password |
protected static java.lang.String |
PATH_SEPARATOR |
protected static java.lang.String |
REMOTE_SUFFIX |
protected java.util.regex.Pattern |
remoteFilePattern |
protected java.lang.String |
remotePath |
protected java.lang.String |
remoteRegExp |
protected boolean |
renameRemoteFiles |
protected static int |
RETRY_DELAY |
protected boolean |
running |
protected SynchronizedDirectory |
sd
The SynchronizedDirectory ensures that files won't be processed prematurely.
|
protected static int |
SFTP_PORT |
protected int |
sleepTime |
protected boolean |
usePassiveFTP |
protected java.lang.String |
username |
protected static java.lang.String |
WILDCARD |
Constructor and Description |
---|
FtpEIThread(java.lang.String ftpType,
java.lang.String remoteHost,
java.lang.String login,
java.lang.String pass,
java.lang.String remoteFileDir,
java.lang.String mode,
java.lang.String prefix,
java.lang.String suffix,
java.lang.String regExp,
java.lang.String localSuffix,
int delayTime,
boolean binary,
boolean deleteFlag,
boolean renameFlag,
SynchronizedDirectory dir,
DCNode node,
FtpFileTracker tracker) |
FtpEIThread(java.lang.String ftpType,
java.lang.String remoteHost,
java.lang.String login,
java.lang.String pass,
java.lang.String remoteFileDir,
java.lang.String mode,
java.lang.String prefix,
java.lang.String suffix,
java.lang.String regExp,
java.lang.String localSuffix,
int delayTime,
boolean binary,
boolean deleteFlag,
boolean renameFlag,
SynchronizedDirectory dir,
DCNode node,
FtpFileTracker tracker,
int interruptDelay)
Constructor
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
connectAndGetFiles()
This method creates the connection, retrieves the files and notifies the consumer of
the files via the SynchronizedDirectory object.
|
java.lang.String |
getIPAddress() |
protected java.lang.String |
getLocalName(java.lang.String prefix,
java.lang.String filename)
Generates a unique local file name.
|
java.lang.String |
getLocalSuffix() |
java.lang.String |
getPassword() |
java.lang.String |
getRemotePath() |
java.lang.String |
getRemoteRegExp() |
int |
getSleepTime() |
SynchronizedDirectory |
getSynchronizedDirectory() |
java.lang.String |
getUsername() |
boolean |
isHealthy()
This method is used to check if the transport is fully functional.
|
protected java.util.ArrayList |
listFiles(java.lang.String path,
java.util.regex.Pattern pattern)
List all the files with the specified suffix that are
in the specified directory on the FTP server.
|
protected boolean |
retrieveSingleFile(java.lang.String remote)
This method will retrieve a single file from the remote FTP server.
|
void |
run()
Continuously polls for new files to retrieve until it's time to shut down.
|
void |
setASCIIMode() |
void |
setBinaryMode() |
void |
setIOLock(SMGLock lock) |
void |
setLocalSuffix(java.lang.String suffix) |
void |
setOverwriteExisting(boolean flag) |
void |
setRemotePath(java.lang.String path) |
void |
setSleepTime(int time) |
void |
setSynchronizedDirectory(SynchronizedDirectory dir) |
void |
shutdown() |
protected void |
sleep(int sleepSecs) |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
protected static final int MILLISECS_PER_MINUTE
protected static final java.lang.String WILDCARD
protected static final java.lang.String PATH_SEPARATOR
protected static final java.lang.String REMOTE_SUFFIX
protected static final java.lang.String HOSTS_FILE
protected static final int SFTP_PORT
protected java.lang.String ipAddress
protected java.lang.String username
protected java.lang.String password
protected FtpSupportIntf ftpSession
protected java.lang.String remotePath
protected java.lang.String remoteRegExp
protected java.util.regex.Pattern remoteFilePattern
protected java.lang.String localSuffix
protected LoggerIfc logger
protected boolean running
protected boolean deleteRemoteFiles
protected boolean renameRemoteFiles
protected boolean usePassiveFTP
protected boolean overwriteExisting
protected int sleepTime
protected static final int RETRY_DELAY
protected static final int MAX_RETRIES
protected DCNode node
protected FtpFileTracker ftpFileTracker
protected SynchronizedDirectory sd
protected int interruptTimeDelay
protected SMGLock ioLock
public FtpEIThread(java.lang.String ftpType, java.lang.String remoteHost, java.lang.String login, java.lang.String pass, java.lang.String remoteFileDir, java.lang.String mode, java.lang.String prefix, java.lang.String suffix, java.lang.String regExp, java.lang.String localSuffix, int delayTime, boolean binary, boolean deleteFlag, boolean renameFlag, SynchronizedDirectory dir, DCNode node, FtpFileTracker tracker, int interruptDelay)
ftpType
- The type of FTP to useremoteHost
- The IP address of the FTP serverlogin
- The username to use for logging inpass
- The password for the given usernameremoteFileDir
- The remote directory to retrieve from the FTP servermode
- The remote file filter pattern modeprefix
- The remote file prefixsuffix
- The remote file suffixregExp
- The regular expression for remote filelocalSuffix
- Specifies the local suffix for the retrieved filesdelayTime
- The number of milliseconds to wait between successive retrievalsbinary
- Determines if files should be retrieved in binary mode (false = ASCII mode)deleteFlag
- Determines whether to delete the remote files after processingrenameFlag
- Determines whether to rename the remote files after processingdir
- The local directory into which files will be placednode
- The EI Node that is using this FTP objectpublic FtpEIThread(java.lang.String ftpType, java.lang.String remoteHost, java.lang.String login, java.lang.String pass, java.lang.String remoteFileDir, java.lang.String mode, java.lang.String prefix, java.lang.String suffix, java.lang.String regExp, java.lang.String localSuffix, int delayTime, boolean binary, boolean deleteFlag, boolean renameFlag, SynchronizedDirectory dir, DCNode node, FtpFileTracker tracker)
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
protected boolean connectAndGetFiles()
protected void sleep(int sleepSecs) throws java.lang.InterruptedException
java.lang.InterruptedException
public void shutdown()
protected java.util.ArrayList listFiles(java.lang.String path, java.util.regex.Pattern pattern) throws java.io.IOException
path
- Remote file directorypattern
- Remote file pattern to retrievejava.io.IOException
protected boolean retrieveSingleFile(java.lang.String remote)
remote
- Specifies the name of the remote file (incl path)protected java.lang.String getLocalName(java.lang.String prefix, java.lang.String filename)
public boolean isHealthy()
public void setOverwriteExisting(boolean flag)
public void setBinaryMode()
public void setASCIIMode()
public void setRemotePath(java.lang.String path)
public java.lang.String getRemotePath()
public void setLocalSuffix(java.lang.String suffix)
public java.lang.String getLocalSuffix()
public java.lang.String getRemoteRegExp()
public void setSleepTime(int time)
public int getSleepTime()
public void setSynchronizedDirectory(SynchronizedDirectory dir)
public SynchronizedDirectory getSynchronizedDirectory()
public java.lang.String getUsername() throws java.lang.NullPointerException
java.lang.NullPointerException
public java.lang.String getPassword() throws java.lang.NullPointerException
java.lang.NullPointerException
public java.lang.String getIPAddress() throws java.lang.NullPointerException
java.lang.NullPointerException
public void setIOLock(SMGLock lock)