public abstract class AbstractOIFtpPusher
extends java.lang.Thread
Modifier and Type | Field and Description |
---|---|
protected boolean |
bFailed |
static int |
DEFAULT_FTP_PORT |
static int |
DEFAULT_SFTP_PORT |
protected int |
delay |
protected java.lang.String |
errMesg |
protected java.util.Vector |
filesToFTP |
protected FtpSupportIntf |
ftpClient |
protected java.lang.String |
ftpDirectory |
protected java.lang.String |
ftpExtension |
protected int |
ftpFileType |
protected java.io.FilenameFilter |
ftpFilter |
protected java.lang.String |
ftpHost |
protected java.lang.String |
ftpPasswd |
protected int |
ftpPort |
protected boolean |
ftpRunning |
protected long |
ftpTimeInterval |
protected java.lang.String |
ftpUser |
protected java.lang.String |
hostsFile |
protected int |
interruptDelay |
protected java.lang.String |
localDirectory |
protected LoggerIfc |
logger |
protected DCNode |
oinode |
protected boolean |
passiveMode |
protected boolean |
sftpUsed |
static java.lang.String |
SSH_KNOWN_HOSTS_FILE |
Constructor and Description |
---|
AbstractOIFtpPusher(LoggerIfc lgr,
java.lang.String localdir,
java.lang.String ftphost,
int ftpport,
java.lang.String ftpuser,
java.lang.String ftppasswd,
java.lang.String ftpdir,
java.lang.String ftpext,
boolean sftpUsed,
java.lang.String hostsFile)
Construct a new
AbsctractOIFtpPusher to be used within an
OITransport object. |
AbstractOIFtpPusher(LoggerIfc lgr,
java.lang.String localdir,
java.lang.String ftphost,
int ftpport,
java.lang.String ftpuser,
java.lang.String ftppasswd,
java.lang.String ftpdir,
java.lang.String ftpext,
boolean sftpUsed,
java.lang.String hostsFile,
int interruptDelay)
Construct a new
AbsctractOIFtpPusher to be used within an
OITransport object. |
AbstractOIFtpPusher(LoggerIfc lgr,
java.lang.String localdir,
java.lang.String ftphost,
java.lang.String ftpuser,
java.lang.String ftppasswd,
java.lang.String ftpdir,
java.lang.String ftpext,
boolean sftpUsed,
java.lang.String hostsFile)
Construct a new
AbsctractOIFtpPusher to be used within an
OITransport object. |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
doTransfer()
transfer the files in this method.
|
void |
enablePassiveMode(boolean passive)
Enable (or disable) passive FTP mode.
|
int |
getFileMode()
Returns the FTP transfer mode.
|
java.util.List |
getFiles() |
java.lang.String |
getFtpDirectory()
Return the destination directory on the remote FTP host.
|
java.lang.String |
getFtpExtension()
Returns the file extension for files that have been transferred.
|
java.lang.String |
getFtpHost()
Return the name/IP address of the remote FTP host.
|
java.lang.String |
getFtpLogin()
Return the login name for the remote FTP user.
|
java.lang.String |
getFtpPassword()
Return the password for the remote FTP user.
|
int |
getFtpPort() |
long |
getFtpTimeInterval()
get ftpTimeInterval and pass to the timer
|
java.lang.String |
getLocalDirectory()
Return the local directory containing the files to be transferred.
|
boolean |
isHealthy()
This method is used to check if the pusher is fully functional.
|
void |
run()
While there are files to transfer, attempt to make the connection
to the remote host and transfer all files.
|
void |
setAsciiFileMode()
Sets the FTP transfer mode to ascii.
|
void |
setBinaryFileMode()
Sets the FTP transfer mode to binary.
|
void |
setFiles(java.util.List fileNames)
Add each file in the given list to the list of files to be transferred.
|
void |
setFtpDirectory(java.lang.String dir)
Sets the destination directory on the remote FTP host.
|
void |
setFtpExtension(java.lang.String ext)
Sets the file extension for files that have been transferred.
|
void |
setFtpHost(java.lang.String host)
Sets the name/IP address of the remote FTP host.
|
void |
setFtpLogin(java.lang.String login)
Sets the login name for the remote FTP user.
|
void |
setFtpPassword(java.lang.String passwd)
Sets the password for the remote FTP user.
|
void |
setFtpPort(int port) |
void |
setFtpTimeInterval(long interval)
set ftpInterval when the pusher object is instantiated in a specific
node, the ftpTimeInterval is read in from the config file.
|
void |
setLocalDirectory(java.lang.String dir)
Sets the local directory containing the files to be transferred.
|
void |
shutdown()
Perform the necessary shutdown tasks.
|
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
public static final int DEFAULT_FTP_PORT
public static final int DEFAULT_SFTP_PORT
public static final java.lang.String SSH_KNOWN_HOSTS_FILE
protected boolean ftpRunning
protected boolean passiveMode
protected int delay
protected int ftpFileType
protected java.io.FilenameFilter ftpFilter
protected FtpSupportIntf ftpClient
protected LoggerIfc logger
protected java.lang.String errMesg
protected java.lang.String ftpDirectory
protected java.lang.String ftpExtension
protected java.lang.String ftpHost
protected int ftpPort
protected java.lang.String ftpPasswd
protected java.lang.String ftpUser
protected java.lang.String localDirectory
protected int interruptDelay
protected java.util.Vector filesToFTP
protected long ftpTimeInterval
protected boolean bFailed
protected DCNode oinode
protected boolean sftpUsed
protected java.lang.String hostsFile
public AbstractOIFtpPusher(LoggerIfc lgr, java.lang.String localdir, java.lang.String ftphost, java.lang.String ftpuser, java.lang.String ftppasswd, java.lang.String ftpdir, java.lang.String ftpext, boolean sftpUsed, java.lang.String hostsFile) throws NodeStartException
AbsctractOIFtpPusher
to be used within an
OITransport
object. The file transfers will occur
based upon the provided configuration parameters.lgr
- Reference to the log methods of the nodelocaldir
- Local directory containing the files to be
transferredftphost
- Name/IP address of the remote ftp hostftpuser
- Name used to login to the remote hostftppasswd
- Password used to login to the remote hostftpdir
- Remote directory in which to place the filesftpext
- File extension used to tag the local files as
having been transferred. If this parameter is
null or zero-length, the local files will be
deleted rather than renamed.sftpUsed
- If Sftp is usedhostsFile
- If Sftp is used, need to specify the hosts file
which contains the server finger prints.NodeStartException
public AbstractOIFtpPusher(LoggerIfc lgr, java.lang.String localdir, java.lang.String ftphost, int ftpport, java.lang.String ftpuser, java.lang.String ftppasswd, java.lang.String ftpdir, java.lang.String ftpext, boolean sftpUsed, java.lang.String hostsFile) throws NodeStartException
AbsctractOIFtpPusher
to be used within an
OITransport
object. The file transfers will occur
based upon the provided configuration parameters.lgr
- Reference to the log methods of the nodelocaldir
- Local directory containing the files to be
transferredftphost
- Name/IP address of the remote ftp hostftpport
- FTP port number, default is 21ftpuser
- Name used to login to the remote hostftppasswd
- Password used to login to the remote hostftpdir
- Remote directory in which to place the filesftpext
- File extension used to tag the local files as
having been transferred. If this parameter is
null or zero-length, the local files will be
deleted rather than renamed.sftpUsed
- If Sftp is usedhostsFile
- If Sftp is used, need to specify the hosts file
which contains the server finger prints.NodeStartException
public AbstractOIFtpPusher(LoggerIfc lgr, java.lang.String localdir, java.lang.String ftphost, int ftpport, java.lang.String ftpuser, java.lang.String ftppasswd, java.lang.String ftpdir, java.lang.String ftpext, boolean sftpUsed, java.lang.String hostsFile, int interruptDelay) throws NodeStartException
AbsctractOIFtpPusher
to be used within an
OITransport
object. The file transfers will occur
based upon the provided configuration parameters.lgr
- Reference to the log methods of the nodelocaldir
- Local directory containing the files to be
transferredftphost
- Name/IP address of the remote ftp hostftpport
- FTP port number, default is 21ftpuser
- Name used to login to the remote hostftppasswd
- Password used to login to the remote hostftpdir
- Remote directory in which to place the filesftpext
- File extension used to tag the local files as
having been transferred. If this parameter is
null or zero-length, the local files will be
deleted rather than renamed.sftpUsed
- If Sftp is usedhostsFile
- If Sftp is used, need to specify the hosts file
which contains the server finger prints.interruptDelay
- Timeout value for ftp connection, ftp transfer.NodeStartException
protected abstract void doTransfer() throws java.io.IOException
java.io.IOException
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void enablePassiveMode(boolean passive)
passive
- true
, if passive mode is desired.public void setBinaryFileMode()
public void setAsciiFileMode()
public int getFileMode()
public void setLocalDirectory(java.lang.String dir)
dir
- Local directory containing the files to be transferred.public java.lang.String getLocalDirectory()
public void setFtpHost(java.lang.String host)
host
- The remote FTP host.public java.lang.String getFtpHost()
public void setFtpPort(int port)
public int getFtpPort()
public void setFtpLogin(java.lang.String login)
login
- The remote login name.public java.lang.String getFtpLogin()
public void setFtpPassword(java.lang.String passwd)
passwd
- The password for the remote FTP user.public java.lang.String getFtpPassword()
public void setFtpDirectory(java.lang.String dir)
dir
- The destination directory on the remote FTP host.public java.lang.String getFtpDirectory()
public void setFtpExtension(java.lang.String ext)
ext
- The file extension for files that have been transferred.public java.lang.String getFtpExtension()
public void setFiles(java.util.List fileNames)
fileNames
- Vector of filenames which are to be transferred.public void shutdown()
public boolean isHealthy()
It includes checks if the local-directory exists and is readable and if the connection to the FTP server can be established.
public long getFtpTimeInterval()
public void setFtpTimeInterval(long interval)
public java.util.List getFiles()