public abstract class FtpTransportSession
extends java.lang.Object
implements java.lang.Runnable
Modifier and Type | Field and Description |
---|---|
protected FTPClient |
client
Ftp client, used to connect with the remote host.
|
protected java.awt.event.ActionListener |
fileProcessor
Object notified when the file has been successfully transferred;
The notification must be done by the sub-class at the appropriate
location, using the ActionListener "notifyListener" method.
|
protected static java.lang.String |
FTPSESSION
Identifier used when logging alarms and status with the
"logger" member.
|
protected java.lang.String |
ipAddress
Remote ftp host ip address
|
protected java.io.File |
localDir
Remote ftp host ip address
|
protected Logger |
logger
Status/alarm logger
|
protected java.lang.String |
loginStr
Ftp login string
|
protected java.lang.String |
passStr
Password string
|
Constructor and Description |
---|
FtpTransportSession(java.lang.String ip,
java.lang.String login,
java.lang.String pass,
java.io.File dir,
java.awt.event.ActionListener al,
Logger l) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
get(java.io.File localFile,
java.lang.String remoteFile,
int fileType)
Get the remote file, of type ascii or binary, to the local file;
"fileType" must be the ascii or binary file type constants, as defined
in the FTP class in the commons-net-ftp package.
|
protected boolean |
login()
Logs into the remote host, using the "ipAddress", "loginStr" and
"passStr".
|
abstract void |
run()
Implements the Runnable interface, and must be defined by the
subclass; This method should do the actual procedures needed to
transport the file from the remote host to the local host, as well
as fulfill other device-specific conditions.
|
protected abstract void |
shutdown()
Abstract method to enforce some type of ftp session shutdown
mechanisms; This method is called by the FtpTransportHandler object.
|
protected static final java.lang.String FTPSESSION
protected FTPClient client
protected java.lang.String ipAddress
protected java.lang.String loginStr
protected java.lang.String passStr
protected java.io.File localDir
protected Logger logger
protected java.awt.event.ActionListener fileProcessor
public FtpTransportSession(java.lang.String ip, java.lang.String login, java.lang.String pass, java.io.File dir, java.awt.event.ActionListener al, Logger l)
ip
- Ip Address.login
- Login string.pass
- Password string.dir
- Local directoryal
- Object notified when file transfer is completed.l
- Logging object, used for alarms/status.protected boolean login()
protected boolean get(java.io.File localFile, java.lang.String remoteFile, int fileType) throws java.io.IOException
localFile
- Local file name.remoteFile
- Remote file name.fileType
- Determines whether ascii or binary file, as defined by
FTP.BINARY_FILE_TYPE/FTP.ASCII_FILE_TYPE.
java.io.IOException
protected abstract void shutdown()
public abstract void run()
run
in interface java.lang.Runnable