Class FTPUploader


  • public class FTPUploader
    extends Object
    Utility class to upload directory to FTP server
    • Constructor Detail

      • FTPUploader

        public FTPUploader()
    • Method Detail

      • uploadDirectoryWithRetries

        public void uploadDirectoryWithRetries​(String ftpServer,
                                               String username,
                                               String password,
                                               String sourceDirectory,
                                               String targetDirectory,
                                               int maxRetryCount)
                                        throws com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException
        Upload directory to specified FTP server with retries.
        Throws:
        com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException
      • uploadDirectory

        protected boolean uploadDirectory​(String ftpServer,
                                          String username,
                                          String password,
                                          String sourceDirectoryPath,
                                          String targetDirectoryPath)
        Upload directory to specified FTP server without retries.
        Returns:
        Boolean to indicate whether uploading is successful.
      • uploadDirectory

        protected void uploadDirectory​(org.apache.commons.net.ftp.FTPClient ftpClient,
                                       String sourceDirectoryPath,
                                       String targetDirectoryPath,
                                       String logPrefix)
                                throws IOException
        Recursively upload a directory to FTP server with the provided FTP client object.
        Throws:
        IOException
      • uploadFile

        protected void uploadFile​(org.apache.commons.net.ftp.FTPClient ftpClient,
                                  String sourceFilePath,
                                  String targetFilePath,
                                  String logPrefix)
                           throws IOException
        Upload a single file to FTP server with the provided FTP client object.
        Throws:
        IOException
      • isCommandFailed

        private boolean isCommandFailed​(int replyCode)