Class FileTransferOperator


  • public class FileTransferOperator
    extends java.lang.Object
    The File Transfer Operator that connects and Transfer Files to a target machine
    • Constructor Summary

      Constructors 
      Constructor Description
      FileTransferOperator​(java.util.Properties p, Log log)
      Constructor for the FileTransferAgent
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Closes the connection to the target
      void createDirectory​(java.lang.String dir)
      Create a directory on the target machine
      java.util.Vector<java.lang.String> getProtocolList()
      Iterates through all the protocols and tries to make a connection using each of them with the specified configuration
      boolean isExists​(java.lang.String filePath)
      Checks the given file exists or not on remote machine
      java.lang.String[] list​(java.lang.String path)
      Checks the given file exists or not on remote machine
      boolean prepareConnection()
      Creates a connection with the target machine
      void printDebugMessage​(java.lang.String msgKey, java.lang.Object[] params)
      Prints a debug message if debug mode for the Components is enabled.
      void receiveFile​(java.lang.String source, java.lang.String target)
      Receives a file from target to source
      void transferFile​(java.lang.String source, java.lang.String target)
      Transfers file from source to target
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FileTransferOperator

        public FileTransferOperator​(java.util.Properties p,
                                    Log log)
        Constructor for the FileTransferAgent
        Parameters:
        lp - The LogProxy for logging
        p - The configuration properties for the initialization of the connection
    • Method Detail

      • transferFile

        public void transferFile​(java.lang.String source,
                                 java.lang.String target)
                          throws java.lang.Exception
        Transfers file from source to target
        Parameters:
        source - Path to source file
        target - Path to destination file on target machine
        Throws:
        java.lang.Exception - If file transfer is unsuccessful
      • receiveFile

        public void receiveFile​(java.lang.String source,
                                java.lang.String target)
                         throws java.lang.Exception
        Receives a file from target to source
        Parameters:
        source - Path to source file
        target - Path to destination file on local machine
        Throws:
        java.lang.Exception - If file transfer is unsuccessful
      • createDirectory

        public void createDirectory​(java.lang.String dir)
                             throws java.lang.Exception
        Create a directory on the target machine
        Parameters:
        dir - Path of the folder to be created
        Throws:
        java.lang.Exception - If the directory creation is not successful.
      • isExists

        public boolean isExists​(java.lang.String filePath)
                         throws java.lang.Exception
        Checks the given file exists or not on remote machine
        Parameters:
        filePath - Path of the file
        Returns:
        true if the given file exists on remote machine otherwise false
        Throws:
        java.lang.Exception
      • list

        public java.lang.String[] list​(java.lang.String path)
                                throws java.lang.Exception
        Checks the given file exists or not on remote machine
        Parameters:
        path - Path of the file
        Returns:
        true if the given file exists on remote machine otherwise false
        Throws:
        java.lang.Exception
      • close

        public void close()
        Closes the connection to the target
      • getProtocolList

        public java.util.Vector<java.lang.String> getProtocolList()
        Iterates through all the protocols and tries to make a connection using each of them with the specified configuration
        Returns:
        String array of the protocols through which a successful connection could be made.
      • printDebugMessage

        public void printDebugMessage​(java.lang.String msgKey,
                                      java.lang.Object[] params)
        Prints a debug message if debug mode for the Components is enabled.
        Parameters:
        msgKey - message key
        params - place holder for debug messages