C - the generic type of the connection objectpublic abstract class FtpCommand<C extends FtpFileSystem>
extends org.mule.extension.file.common.api.command.FileCommand<C>
FileCommand implementations that target a FTP/SFTP server| Constructor and Description |
|---|
FtpCommand(C fileSystem)
Creates a new instance
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
changeWorkingDirectory(Path path)
Changes the current working directory to the given
path |
protected void |
changeWorkingDirectory(String path)
Changes the current working directory to the given
path |
protected void |
copy(org.mule.extension.file.common.api.FileConnectorConfig config,
String source,
String target,
boolean overwrite,
boolean createParentDirectory,
FtpCopyDelegate delegate)
Performs the base logic and delegates into
FtpCopyDelegate.doCopy(FileConnectorConfig, FileAttributes, Path, boolean) to perform the actual
copying logic |
protected void |
createDirectory(String directoryPath) |
protected abstract void |
doRename(String filePath,
String newName)
Template method which works in tandem with
rename(String, String, boolean). |
protected boolean |
exists(Path path) |
protected Path |
getBasePath(org.mule.extension.file.common.api.FileSystem fileSystem) |
protected abstract String |
getCurrentWorkingDirectory() |
protected FtpFileAttributes |
getExistingFile(String filePath)
|
FtpFileAttributes |
getFile(String filePath)
Obtains a
FtpFileAttributes for the given filePath by using the FTPClient.mlistFile(String) FTP
command |
protected abstract FtpFileAttributes |
getFile(String filePath,
boolean requireExistence) |
protected void |
rename(String filePath,
String newName,
boolean overwrite)
Template method that renames the file at
filePath to newName. |
protected abstract boolean |
tryChangeWorkingDirectory(String path)
Attempts to change the current working directory.
|
alreadyExistsException, assureParentFolderExists, cannotListFileException, cannotReadDirectoryException, doMkDirs, exception, exception, isVirtualDirectory, mkdirs, pathNotFoundException, resolveExistingPath, resolvePathpublic FtpCommand(C fileSystem)
fileSystem - a FtpFileSystem used as the connection objectprotected FtpFileAttributes getExistingFile(String filePath)
filePath - the path to the file you wantFtpFileAttributesIllegalArgumentException - if the filePath doesn't existspublic FtpFileAttributes getFile(String filePath)
FtpFileAttributes for the given filePath by using the FTPClient.mlistFile(String) FTP
commandfilePath - the path to the file you wantFtpFileAttributes or null if it doesn't existsprotected abstract FtpFileAttributes getFile(String filePath, boolean requireExistence)
protected boolean exists(Path path)
exists in class org.mule.extension.file.common.api.command.FileCommand<C extends FtpFileSystem>protected Path getBasePath(org.mule.extension.file.common.api.FileSystem fileSystem)
getBasePath in class org.mule.extension.file.common.api.command.FileCommand<C extends FtpFileSystem>protected void changeWorkingDirectory(Path path)
pathpath - the Path to which you wish to moveIllegalArgumentException - if the CWD could not be changedprotected void changeWorkingDirectory(String path)
pathpath - the path to which you wish to moveIllegalArgumentException - if the CWD could not be changedprotected abstract boolean tryChangeWorkingDirectory(String path)
falsepath - the path to which you wish to movetrue if the CWD was changed. false otherwiseprotected void rename(String filePath, String newName, boolean overwrite)
filePath to newName.
This method performs path resolution and validation and eventually delegates into doRename(String, String), in which
the actual renaming implementation is.
filePath - the path of the file to be renamednewName - the new nameoverwrite - whether to overwrite the target file if it already existsprotected abstract void doRename(String filePath, String newName) throws Exception
rename(String, String, boolean).
Implementations are to perform the actual renaming logic here
filePath - the path of the file to be renamednewName - the new nameException - if anything goes wrongprotected void createDirectory(String directoryPath)
protected final void copy(org.mule.extension.file.common.api.FileConnectorConfig config,
String source,
String target,
boolean overwrite,
boolean createParentDirectory,
FtpCopyDelegate delegate)
FtpCopyDelegate.doCopy(FileConnectorConfig, FileAttributes, Path, boolean) to perform the actual
copying logicconfig - the config that is parameterizing this operationsource - the path to be copiedtarget - the path to the target destinationoverwrite - whether to overwrite existing target pathscreateParentDirectory - whether to create the target's parent directory if it doesn't existsprotected abstract String getCurrentWorkingDirectory()
Copyright © 2003–2017 MuleSoft, Inc.. All rights reserved.