All Packages Class Hierarchy This Package Previous Next Index
Class ProtocolLayer.FTPCon
ProtocolLayer.FTPCon
- public class FTPCon
Abstract FTP connection. FTPCon will include FTPCon name, remote site initial
directory, FTP server host name, FTP server host port(derault 21), login
user name/ password, local machine initial path for get operation,
file list to get/put, FTP mode and error message.
Field description :
String _id : Since JATLite ftp is assumed to be used by software agents,
unique FTP connection name will be necessary. For instance, if an agent
publishes some data to FTP server A and to FTP server B, the agent needs to
identify different FTP connection using _id.
String _remotePath : Remote path is an initial directory where you want to
send/save data to a remote file system. Change directory command will be
passed to FTP server if you set this parameter. For instnce, if an agent wants to
put data to a file /home/myName/AgentData , remote path will be /home/myName.
String _host : FTP server host name, e.g. cdr.stanford.edu
int _port : FTP server port number. Dafault is 21, which usually works. Change
port number only if your FTP server has different, special port number
String _userName, _password Valid user name and password for FTP server where
an agent wants to save/retrieve data. _userName can be "anonymous".
String _localPath : Initial local directory where an agent wants to save retrieved
data. If an agent wants to save data as a file /home/myName/fileRetrieved, then
_localPath is /home/myName.
String[] files : Files to save or to retrieve. Note that files should include
only the file names and should not include any directory information. Directory
information should be set by _remotePath and _localPath.
int _mode : Various mode parameters. Modes can be combined using bitwise OR(|).
FTPCon initially assumes PUT(e.g. save data to FTP server) mode. If GET(retrieve
from remote FTP site) mode, ISGETMODE should be set. If APPEND mode, APPEND should
be set. If you want to create a directory to FTP site, CREATEDIR should be set.
If you want to save/retrieve ASCII, ASCIITYPE should be set. If an agent is an applet,
ISAPPLET should be set.
String _errorMsg : Error message buffer if FTP error occurs.
-
_errorMsg
- Error message buffer, if error occurs during transaction
-
_files
- Files to GET or PUT
-
_host
-
FTP server host name, e.g.
-
_id
- Unique FTPCon name.
-
_localPath
- Local directory for GET operation
-
_mode
- Various mode definition.
-
_password
- Login password for FTP server
-
_port
- If you did not setup a special FTP port, you need not to set port number.
-
_remotePath
- FTP site initial directory
-
_userName
- Login user name for FTP server
-
APPEND
- Set append mode
-
ASCIITYPE
- ASCII transfer mode
-
CREATEDIR
- Create directory for remote site, if not exist
-
ISAPPLET
- Applet data transfer mode
-
ISGETMODE
- Set GET(retrieve file) mode
-
FTPCon()
- Default constructor.
-
FTPCon(String, String, String, int, String, String, String, String[], int)
- Constructor from FTP connection information
-
getErrorMessage()
- Get error message
-
getFiles()
- Get current files to PUT or GET
-
getHost()
- Get FTP host internet address
-
getID()
- Get FTPCon name
-
getLocalPath()
- Get current local path.
-
getMode()
- Get current mode
-
getPassword()
- Get FTP server login password
-
getPort()
- Get current FTP server port
-
getRemotePath()
- Get FTP site initial path
-
getUserName()
- Get FTP server login user name
-
isGetMode()
- See if current mode is GET
-
setErrorMessage(String)
- Set error message if error occurs
-
setFiles(String[])
- Set file list to PUT or GET
-
setHost(String)
- Set FTP server host name
-
setID(String)
- Set FTPCon name
-
setLocalPath(String)
- Set local directory for GET operation
-
setMode(int)
- Set FTPCon mode
-
setPassword(String)
- Set FTP server login password
-
setPort(int)
- Set FTP server port
-
setRemotePath(String)
- Set FTP site initial path
-
setUserName(String)
- Set FTP server user login name
-
toString()
- Make a readable string
-
toStringList()
- Get string list for FTPCon
_id
protected String _id
- Unique FTPCon name.
_remotePath
protected String _remotePath
- FTP site initial directory
_host
protected String _host
- FTP server host name, e.g. cdr.stanford.edu
_port
protected int _port
- If you did not setup a special FTP port, you need not to set port number. 21 is assumed
_userName
protected String _userName
- Login user name for FTP server
_password
protected String _password
- Login password for FTP server
_localPath
protected String _localPath
- Local directory for GET operation
_files
protected String _files[]
- Files to GET or PUT
_mode
protected int _mode
- Various mode definition. Initially, PUT, not append, not create directory,
binary transfer and stand alone will be assumed. If an agent has different
mode when transfers data, mode should be set using OR(|).
_errorMsg
protected String _errorMsg
- Error message buffer, if error occurs during transaction
ISGETMODE
public static final int ISGETMODE
- Set GET(retrieve file) mode
APPEND
public static final int APPEND
- Set append mode
CREATEDIR
public static final int CREATEDIR
- Create directory for remote site, if not exist
ASCIITYPE
public static final int ASCIITYPE
- ASCII transfer mode
ISAPPLET
public static final int ISAPPLET
- Applet data transfer mode
FTPCon
public FTPCon()
- Default constructor.
FTPCon
public FTPCon(String id,
String remotePath,
String host,
int port,
String userName,
String password,
String localPath,
String files[],
int mode)
- Constructor from FTP connection information
- Parameters:
- id - FTP connection name
- remotePath - FTP site initial directory
- host - FTP server host name
- port - 21. Otherwiser, you need to set
- userName - FTP server login user name
- password - FTP server login password
- localPath - Local machine initial directory
- files - Files to put or get
- mode - Mode definition
setID
public void setID(String id)
- Set FTPCon name
- Parameters:
- id - FTPCon name
getID
public String getID()
- Get FTPCon name
- Returns:
- FTPCon name
setRemotePath
public void setRemotePath(String path)
- Set FTP site initial path
- Parameters:
- path - FTPCon initial path
getRemotePath
public String getRemotePath()
- Get FTP site initial path
- Returns:
- Remote ftp site initial path, set for this FPTCon
setHost
public void setHost(String host)
- Set FTP server host name
- Parameters:
- host - FTP server host name
getHost
public String getHost()
- Get FTP host internet address
- Returns:
- FTP server host name.
setPort
public void setPort(int port)
- Set FTP server port
- Parameters:
- port - Port number
getPort
public int getPort()
- Get current FTP server port
- Returns:
- FTP server port
setUserName
public void setUserName(String username)
- Set FTP server user login name
- Parameters:
- username - FTP server user login name
getUserName
public String getUserName()
- Get FTP server login user name
- Returns:
- login user name
setPassword
public void setPassword(String password)
- Set FTP server login password
- Parameters:
- password - FTP server login password
getPassword
public String getPassword()
- Get FTP server login password
- Returns:
- login password
setLocalPath
public void setLocalPath(String path)
- Set local directory for GET operation
- Parameters:
- path - Local machine initial path
getLocalPath
public String getLocalPath()
- Get current local path.
- Returns:
- Current local path for GET operation
setFiles
public void setFiles(String files[])
- Set file list to PUT or GET
- Parameters:
- files - File name list
getFiles
public String[] getFiles()
- Get current files to PUT or GET
- Returns:
- file list
setMode
public void setMode(int mode)
- Set FTPCon mode
- Parameters:
- mode - FTPCon mode
getMode
public int getMode()
- Get current mode
- Returns:
- current mode
isGetMode
public boolean isGetMode()
- See if current mode is GET
- Returns:
- true if current mode is GET
toString
public String toString()
- Make a readable string
- Returns:
- FTPCon description
toStringList
public String[] toStringList()
- Get string list for FTPCon
- Returns:
- String list - _id,_remotePath,_host,_port,_userName,_password,_localPath,
"("file1 file2 ...")", _mode and _errorMsg.
setErrorMessage
public void setErrorMessage(String err)
- Set error message if error occurs
- Parameters:
- err - Error string
getErrorMessage
public String getErrorMessage()
- Get error message
- Returns:
- Error message.
All Packages Class Hierarchy This Package Previous Next Index