Class FtpEITransportHandler

java.lang.Object
com.nt.udc.ei.transport.FtpEITransportHandler

public class FtpEITransportHandler extends Object
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 Details

    • totalHosts

      protected int totalHosts
      Number of remote ftp hosts:
    • ftpType

      protected String[] ftpType
      Indicators of FTP Type:
    • hosts

      protected String[] hosts
      IP Addresses of remote ftp hosts:
    • loginStrs

      protected String[] loginStrs
      Login strings:
    • pwStrs

      protected String[] pwStrs
      Password strings:
    • ftpConfig

      protected Config ftpConfig
      Ftp configuration info:
    • m_isBinaryTransferMode

      protected boolean m_isBinaryTransferMode
      Transfer 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 processed
      lSuffix - specifies the suffix to use for files once they are retrieved to the local machine
      node - 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 processed
      lSuffix - specifies the suffix to use for files once they are retrieved to the local machine
      node - specifies the EI Node which is using this transport handler
      rRenameFlag - specifies the Flag for Renaming
      Throws:
      NodeStartException
  • Method Details

    • isBinaryTransferMode

      public boolean isBinaryTransferMode()
    • setBinaryTransferMode

      public void setBinaryTransferMode(boolean isBinaryTransferMode)
    • getFtpConfig

      protected void getFtpConfig() throws NodeStartException
      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

      public void setFactory(FtpTransportFactory factory)
    • getFactory

      public FtpTransportFactory getFactory()