public class FTPTransfer extends Object implements FileTransfer
BATCH_SIZE, CONFLICT_RESOLUTION, CONFLICT_RESOLUTION_FAIL, CONFLICT_RESOLUTION_IGNORE, CONFLICT_RESOLUTION_NONE, CONFLICT_RESOLUTION_REJECT, CONFLICT_RESOLUTION_RENAME, CONFLICT_RESOLUTION_REPLACE, CONNECTION_TIMEOUT, CREATE_DIRECTORY, DATA_TIMEOUT, DELETE_ORIGINAL, DOT_RENAME, FILE_FILTER_REGEX, FILE_MODIFY_DATE_ATTR_FORMAT, FOLLOW_SYMLINK, HOSTNAME, IGNORE_DOTTED_FILES, LAST_MODIFIED_TIME, MAX_SELECTS, PASSWORD, PATH_FILTER_REGEX, PERMISSIONS, POLLING_INTERVAL, RECURSIVE_SEARCH, REJECT_ZERO_BYTE, REMOTE_GROUP, REMOTE_OWNER, REMOTE_PATH, REMOTE_POLL_BATCH_SIZE, TEMP_FILENAME, USE_COMPRESSION, USE_NATURAL_ORDERING, USERNAME| Constructor and Description |
|---|
FTPTransfer(ProcessContext context,
ComponentLog logger) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected org.apache.commons.net.ftp.FTPClient |
createClient(PropertyContext context,
Map<String,String> attributes) |
static Supplier<ProxyConfiguration> |
createComponentProxyConfigSupplier(PropertyContext ctx) |
void |
deleteDirectory(FlowFile flowFile,
String remoteDirectoryName) |
void |
deleteFile(FlowFile flowFile,
String path,
String remoteFileName) |
void |
ensureDirectoryExists(FlowFile flowFile,
File directoryName) |
private org.apache.commons.net.ftp.FTPClient |
getClient(FlowFile flowFile) |
String |
getHomeDirectory(FlowFile flowFile) |
List<FileInfo> |
getListing(boolean applyFilters) |
private List<FileInfo> |
getListing(String path,
int depth,
int maxResults,
boolean applyFilters) |
String |
getProtocolName() |
FlowFile |
getRemoteFile(String remoteFileName,
FlowFile origFlowFile,
ProcessSession session) |
FileInfo |
getRemoteFileInfo(FlowFile flowFile,
String path,
String remoteFileName) |
boolean |
isClosed() |
private FileInfo |
newFileInfo(org.apache.commons.net.ftp.FTPFile file,
String path) |
protected int |
numberPermissions(String perms) |
String |
put(FlowFile flowFile,
String path,
String filename,
InputStream content) |
void |
rename(FlowFile flowFile,
String source,
String target) |
private boolean |
resetWorkingDirectory() |
void |
sendCommands(List<String> commands,
FlowFile flowFile) |
private String |
setAndGetWorkingDirectory(String path) |
private boolean |
setWorkingDirectory(String path) |
static void |
validateProxySpec(ValidationContext context,
Collection<ValidationResult> results) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetAbsolutePathpublic static final String CONNECTION_MODE_ACTIVE
public static final String CONNECTION_MODE_PASSIVE
public static final String TRANSFER_MODE_ASCII
public static final String TRANSFER_MODE_BINARY
public static final String FTP_TIMEVAL_FORMAT
public static final String PROXY_TYPE_DIRECT
public static final String PROXY_TYPE_HTTP
public static final String PROXY_TYPE_SOCKS
public static final PropertyDescriptor CONNECTION_MODE
public static final PropertyDescriptor TRANSFER_MODE
public static final PropertyDescriptor PORT
public static final PropertyDescriptor PROXY_TYPE
public static final PropertyDescriptor PROXY_HOST
public static final PropertyDescriptor PROXY_PORT
public static final PropertyDescriptor HTTP_PROXY_USERNAME
public static final PropertyDescriptor HTTP_PROXY_PASSWORD
public static final PropertyDescriptor BUFFER_SIZE
public static final PropertyDescriptor UTF8_ENCODING
private static final int REPLY_CODE_FILE_UNAVAILABLE
private static final Pattern NOT_FOUND_MESSAGE_PATTERN
private static final FTPClientProvider FTP_CLIENT_PROVIDER
private static final ProxySpec[] PROXY_SPECS
public static final PropertyDescriptor PROXY_CONFIGURATION_SERVICE
private final ComponentLog logger
private final ProcessContext ctx
private boolean closed
private org.apache.commons.net.ftp.FTPClient client
private String homeDirectory
private String remoteHostName
private String remotePort
private String remoteUsername
private String remotePassword
public FTPTransfer(ProcessContext context, ComponentLog logger)
public static void validateProxySpec(ValidationContext context, Collection<ValidationResult> results)
public String getProtocolName()
getProtocolName in interface FileTransferpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic String getHomeDirectory(FlowFile flowFile) throws IOException
getHomeDirectory in interface FileTransferIOExceptionpublic List<FileInfo> getListing(boolean applyFilters) throws IOException
getListing in interface FileTransferIOExceptionprivate List<FileInfo> getListing(String path, int depth, int maxResults, boolean applyFilters) throws IOException
IOExceptionpublic FlowFile getRemoteFile(String remoteFileName, FlowFile origFlowFile, ProcessSession session) throws ProcessException, IOException
getRemoteFile in interface FileTransferProcessExceptionIOExceptionpublic FileInfo getRemoteFileInfo(FlowFile flowFile, String path, String remoteFileName) throws IOException
getRemoteFileInfo in interface FileTransferIOExceptionpublic void ensureDirectoryExists(FlowFile flowFile, File directoryName) throws IOException
ensureDirectoryExists in interface FileTransferIOExceptionprivate String setAndGetWorkingDirectory(String path) throws IOException
IOExceptionprivate boolean setWorkingDirectory(String path) throws IOException
IOExceptionprivate boolean resetWorkingDirectory()
throws IOException
IOExceptionpublic String put(FlowFile flowFile, String path, String filename, InputStream content) throws IOException
put in interface FileTransferIOExceptionpublic void rename(FlowFile flowFile, String source, String target) throws IOException
rename in interface FileTransferIOExceptionpublic void deleteFile(FlowFile flowFile, String path, String remoteFileName) throws IOException
deleteFile in interface FileTransferIOExceptionpublic void deleteDirectory(FlowFile flowFile, String remoteDirectoryName) throws IOException
deleteDirectory in interface FileTransferIOExceptionpublic boolean isClosed()
isClosed in interface FileTransferpublic void sendCommands(List<String> commands, FlowFile flowFile) throws IOException
IOExceptionprotected org.apache.commons.net.ftp.FTPClient createClient(PropertyContext context, Map<String,String> attributes)
private org.apache.commons.net.ftp.FTPClient getClient(FlowFile flowFile) throws IOException
IOExceptionprotected int numberPermissions(String perms)
public static Supplier<ProxyConfiguration> createComponentProxyConfigSupplier(PropertyContext ctx)
Copyright © 2023 Apache NiFi Project. All rights reserved.