public final class FtpRenameCommand extends FtpCommand<ClassicFtpFileSystem> implements org.mule.extension.file.common.api.command.RenameCommand
ClassicFtpCommand which implements the RenameCommand| Modifier and Type | Field and Description |
|---|---|
protected org.apache.commons.net.ftp.FTPClient |
client |
| Constructor and Description |
|---|
FtpRenameCommand(ClassicFtpFileSystem fileSystem,
org.apache.commons.net.ftp.FTPClient client) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
doMkDirs(Path directoryPath)
Creates the directory pointed by
directoryPath also creating any missing parent directories |
protected void |
doRename(String filePath,
String newName)
Template method which works in tandem with
FtpCommand.rename(String, String, boolean). |
RuntimeException |
exception(String message)
Same as the super method but adding the FTP rely code
|
RuntimeException |
exception(String message,
Exception cause)
Same as the super method but adding the FTP rely code
|
protected String |
getCurrentWorkingDirectory() |
protected FtpFileAttributes |
getFile(String filePath,
boolean requireExistence) |
protected void |
makeDirectory(String directoryName)
Creates the directory of the given
directoryName in the current working directory |
void |
rename(String filePath,
String newName,
boolean overwrite)
Template method that renames the file at
filePath to newName. |
protected boolean |
tryChangeWorkingDirectory(String path)
Attempts to change the current working directory of the FTP
client. |
changeWorkingDirectory, changeWorkingDirectory, copy, createDirectory, exists, getBasePath, getExistingFile, getFilepublic FtpRenameCommand(ClassicFtpFileSystem fileSystem, org.apache.commons.net.ftp.FTPClient client)
public void rename(String filePath, String newName, boolean overwrite)
filePath to newName.
This method performs path resolution and validation and eventually delegates into FtpCommand.doRename(String, String), in which
the actual renaming implementation is.
rename in interface org.mule.extension.file.common.api.command.RenameCommandrename in class FtpCommand<ClassicFtpFileSystem>filePath - the path of the file to be renamednewName - the new nameoverwrite - whether to overwrite the target file if it already existsprotected FtpFileAttributes getFile(String filePath, boolean requireExistence)
getFile in class FtpCommand<ClassicFtpFileSystem>protected void doMkDirs(Path directoryPath)
directoryPath also creating any missing parent directoriesdoMkDirs in class org.mule.extension.file.common.api.command.FileCommand<ClassicFtpFileSystem>directoryPath - the Path to the directory you want to createprotected boolean tryChangeWorkingDirectory(String path)
client. If it was not possible (for example, because it
doesn't exists), it returns falsetryChangeWorkingDirectory in class FtpCommand<ClassicFtpFileSystem>path - the path to which you wish to movetrue if the CWD was changed. false otherwiseprotected void makeDirectory(String directoryName)
directoryName in the current working directorydirectoryName - the name of the directory you want to createprotected String getCurrentWorkingDirectory()
getCurrentWorkingDirectory in class FtpCommand<ClassicFtpFileSystem>client's working directoryprotected void doRename(String filePath, String newName) throws Exception
FtpCommand.rename(String, String, boolean).
Implementations are to perform the actual renaming logic here
doRename in class FtpCommand<ClassicFtpFileSystem>filePath - the path of the file to be renamednewName - the new nameException - if anything goes wrongpublic RuntimeException exception(String message)
exception in class org.mule.extension.file.common.api.command.FileCommand<ClassicFtpFileSystem>public RuntimeException exception(String message, Exception cause)
exception in class org.mule.extension.file.common.api.command.FileCommand<ClassicFtpFileSystem>Copyright © 2003–2017 MuleSoft, Inc.. All rights reserved.