Class FTPUploader
- java.lang.Object
-
- com.microsoft.azure.toolkit.lib.legacy.appservice.handlers.artifact.FTPUploader
-
public class FTPUploader extends Object
Utility class to upload directory to FTP server
-
-
Field Summary
Fields Modifier and Type Field Description static StringUPLOAD_DIRstatic StringUPLOAD_DIR_FAILUREstatic StringUPLOAD_DIR_FINISHstatic StringUPLOAD_DIR_STARTstatic StringUPLOAD_FAILUREstatic StringUPLOAD_FILEstatic StringUPLOAD_FILE_REPLYstatic StringUPLOAD_RETRY_FAILUREstatic StringUPLOAD_STARTstatic StringUPLOAD_SUCCESS
-
Constructor Summary
Constructors Constructor Description FTPUploader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.apache.commons.net.ftp.FTPClientgetFTPClient(String ftpServer, String username, String password)private booleanisCommandFailed(int replyCode)protected booleanuploadDirectory(String ftpServer, String username, String password, String sourceDirectoryPath, String targetDirectoryPath)Upload directory to specified FTP server without retries.protected voiduploadDirectory(org.apache.commons.net.ftp.FTPClient ftpClient, String sourceDirectoryPath, String targetDirectoryPath, String logPrefix)Recursively upload a directory to FTP server with the provided FTP client object.voiduploadDirectoryWithRetries(String ftpServer, String username, String password, String sourceDirectory, String targetDirectory, int maxRetryCount)Upload directory to specified FTP server with retries.protected voiduploadFile(org.apache.commons.net.ftp.FTPClient ftpClient, String sourceFilePath, String targetFilePath, String logPrefix)Upload a single file to FTP server with the provided FTP client object.
-
-
-
Field Detail
-
UPLOAD_START
public static final String UPLOAD_START
- See Also:
- Constant Field Values
-
UPLOAD_SUCCESS
public static final String UPLOAD_SUCCESS
- See Also:
- Constant Field Values
-
UPLOAD_FAILURE
public static final String UPLOAD_FAILURE
- See Also:
- Constant Field Values
-
UPLOAD_RETRY_FAILURE
public static final String UPLOAD_RETRY_FAILURE
- See Also:
- Constant Field Values
-
UPLOAD_DIR_START
public static final String UPLOAD_DIR_START
- See Also:
- Constant Field Values
-
UPLOAD_DIR_FINISH
public static final String UPLOAD_DIR_FINISH
- See Also:
- Constant Field Values
-
UPLOAD_DIR_FAILURE
public static final String UPLOAD_DIR_FAILURE
- See Also:
- Constant Field Values
-
UPLOAD_DIR
public static final String UPLOAD_DIR
- See Also:
- Constant Field Values
-
UPLOAD_FILE
public static final String UPLOAD_FILE
- See Also:
- Constant Field Values
-
UPLOAD_FILE_REPLY
public static final String UPLOAD_FILE_REPLY
- See Also:
- Constant Field Values
-
-
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 IOExceptionRecursively 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 IOExceptionUpload a single file to FTP server with the provided FTP client object.- Throws:
IOException
-
getFTPClient
protected org.apache.commons.net.ftp.FTPClient getFTPClient(String ftpServer, String username, String password) throws IOException
- Throws:
IOException
-
isCommandFailed
private boolean isCommandFailed(int replyCode)
-
-