Package com.nt.udc.ei.transport
Class FtpEITransportHandler
java.lang.Object
com.nt.udc.ei.transport.FtpEITransportHandler
Used to manage one or more FtpEITransport threads. This class
handles parsing an "ftp configuration" file for ftp usernames,
passwords, file suffixes, etc. and creates and runs a new
FtpEITransport thread for each unique IP address specified as
an FTP server in the configuration file. Use this class if
you want to allow your EI node to collect data from more than
one FTP server at a time. The EI node that uses this class
must have an "ftp configuration" file specified in its general
configuration file. An example of an ftp config file for retrieving
multiple files is:
#
# Comment lines begin with '#'...
#
NumberOfHosts 2
DelayTime 1
DelayTimeUnits Hours
### Host0 ###
RemoteHost0 132.l23.204.39
RemoteFile0 /SYSTEM/DCLOG/*.DC
Login0 someUsername
Password0 somePassword
### Host1 ###
RemoteHost1 132.l23.204.40
RemoteFile1 BAYACCTG.DAT
Login1 someUsername
Password1 somePassword
Note that you may specify multiple files by using the '*' character as a wildcard. Use the '/' as the path separator, as this is the path separator recognized by FTP servers regardless of the operating system. If your EI Node is running via the PSA Admin Client, then the ftp config file is generated automatically for you. If you don't use the PSA Admin Client then the ftp config files must be in the format specified above.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Config
Ftp configuration info:protected String[]
Indicators of FTP Type:protected String[]
IP Addresses of remote ftp hosts:protected String[]
Login strings:protected boolean
Transfer mode (same for all transport objects)protected String[]
Password strings:protected int
Number of remote ftp hosts: -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
FtpEITransportHandler
(SynchronizedDirectory localDir, String lSuffix, DCNode node) Creates a new instance of the transport handler class.FtpEITransportHandler
(SynchronizedDirectory localDir, String lSuffix, DCNode node, boolean rRenameFlag) Creates a new instance of the transport handler class. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Determines if any of the ftp threads are still alive.protected void
Retrieves the ftp configuration info from the ftp configuration file.boolean
boolean
This method is used to check if the transport handler is fully functional.void
setBinaryTransferMode
(boolean isBinaryTransferMode) void
setFactory
(FtpTransportFactory factory) void
shutdown()
Default shutdown method, which should be called by the node's shutdown method; This method currently just calls the FtpEITransport objects' shutdown methods.void
Used to create and start the individual Transport threads for each FTP server.
-
Field Details
-
totalHosts
protected int totalHostsNumber of remote ftp hosts: -
ftpType
Indicators of FTP Type: -
hosts
IP Addresses of remote ftp hosts: -
loginStrs
Login strings: -
pwStrs
Password strings: -
ftpConfig
Ftp configuration info: -
m_isBinaryTransferMode
protected boolean m_isBinaryTransferModeTransfer mode (same for all transport objects)
-
-
Constructor Details
-
FtpEITransportHandler
protected FtpEITransportHandler() -
FtpEITransportHandler
public FtpEITransportHandler(SynchronizedDirectory localDir, String lSuffix, DCNode node) throws NodeStartException Creates a new instance of the transport handler class.- Parameters:
localDir
- specifies the local directory that will store retrieved files until they are processedlSuffix
- specifies the suffix to use for files once they are retrieved to the local machinenode
- specifies the EI Node which is using this transport handler- Throws:
NodeStartException
-
FtpEITransportHandler
public FtpEITransportHandler(SynchronizedDirectory localDir, String lSuffix, DCNode node, boolean rRenameFlag) throws NodeStartException Creates a new instance of the transport handler class.- Parameters:
localDir
- specifies the local directory that will store retrieved files until they are processedlSuffix
- specifies the suffix to use for files once they are retrieved to the local machinenode
- specifies the EI Node which is using this transport handlerrRenameFlag
- specifies the Flag for Renaming- Throws:
NodeStartException
-
-
Method Details
-
isBinaryTransferMode
public boolean isBinaryTransferMode() -
setBinaryTransferMode
public void setBinaryTransferMode(boolean isBinaryTransferMode) -
getFtpConfig
Retrieves the ftp configuration info from the ftp configuration file. Note that for each remote host (FTP server) specified, the configuration file may specify a wildcard in the filename parameter (to retrieve multiple files) OR a single filename (to retrieve just one file each time). One configuration file may specify multiple files for one remote host and a single file for another remote host.- Throws:
NodeStartException
-
startRetrieval
public void startRetrieval()Used to create and start the individual Transport threads for each FTP server. The existence of the "RemoteFile" property determines which version of the Transport constructor is used. -
ftpThreadsAlive
public boolean ftpThreadsAlive()Determines if any of the ftp threads are still alive. This is necessary in order to guarantee a successful shutdown of the EI node.- Returns:
- indicates whether any of the ftp threads are still alive
-
shutdown
public void shutdown()Default shutdown method, which should be called by the node's shutdown method; This method currently just calls the FtpEITransport objects' shutdown methods. -
isHealthy
public boolean isHealthy()This method is used to check if the transport handler is fully functional. All ftpEITransport objects managed by the handler are checked. -
setFactory
-
getFactory
-