Class SFTPTransfer
java.lang.Object
org.apache.nifi.processors.standard.util.SFTPTransfer
- All Implemented Interfaces:
Closeable,AutoCloseable,FileTransfer
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Stringprivate Stringprivate Stringprivate Stringprivate Stringprivate Stringstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorprivate static final SshClientProviderprivate org.apache.sshd.client.session.ClientSessionprivate booleanprivate final org.apache.nifi.context.PropertyContextstatic final org.apache.nifi.components.PropertyDescriptorProperty which is used to decide if theensureDirectoryExists(FlowFile, File)method should perform a list before calling mkdir.private final booleanprivate static final Stringprivate Stringstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorprivate final org.apache.nifi.logging.ComponentLogstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorprivate static final ProxySpec[]private static final Stringprivate static final Stringprivate org.apache.sshd.sftp.client.SftpClientstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorFields inherited from interface org.apache.nifi.processor.util.file.transfer.FileTransfer
BATCH_SIZE, CONFLICT_RESOLUTION, CONFLICT_RESOLUTION_ALLOWABLE_VALUES, CONFLICT_RESOLUTION_FAIL, CONFLICT_RESOLUTION_FAIL_ALLOWABLE, CONFLICT_RESOLUTION_IGNORE, CONFLICT_RESOLUTION_IGNORE_ALLOWABLE, CONFLICT_RESOLUTION_NONE, CONFLICT_RESOLUTION_NONE_ALLOWABLE, CONFLICT_RESOLUTION_REJECT, CONFLICT_RESOLUTION_REJECT_ALLOWABLE, CONFLICT_RESOLUTION_RENAME, CONFLICT_RESOLUTION_RENAME_ALLOWABLE, CONFLICT_RESOLUTION_REPLACE, CONFLICT_RESOLUTION_REPLACE_ALLOWABLE, 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 Summary
ConstructorsConstructorDescriptionSFTPTransfer(org.apache.nifi.context.PropertyContext propertyContext, org.apache.nifi.logging.ComponentLog logger) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidappendPermission(StringBuilder builder, Set<PosixFilePermission> permissions, PosixFilePermission filePermission, String permString) private static StringbuildFullPath(String path, String filename) voidclose()private static StringconvertFactorySetToString(Set<String> factorySetNames) Converts a set of names into an alphabetically ordered comma separated value list.voiddeleteDirectory(org.apache.nifi.flowfile.FlowFile flowFile, String remoteDirectoryName) voiddeleteFile(org.apache.nifi.flowfile.FlowFile flowFile, String path, String remoteFileName) voidensureDirectoryExists(org.apache.nifi.flowfile.FlowFile flowFile, File directoryName) getHomeDirectory(org.apache.nifi.flowfile.FlowFile flowFile) getListing(boolean applyFilters) protected voidgetListing(String path, int depth, int maxResults, List<FileInfo> listing, boolean applyFilters) org.apache.nifi.flowfile.FlowFilegetRemoteFile(String remoteFileName, org.apache.nifi.flowfile.FlowFile origFlowFile, org.apache.nifi.processor.ProcessSession session) getRemoteFileInfo(org.apache.nifi.flowfile.FlowFile flowFile, String path, String filename) protected org.apache.sshd.sftp.client.SftpClientgetSFTPClient(org.apache.nifi.flowfile.FlowFile flowFile) booleanisClosed()private booleanisIncludedDirectory(org.apache.sshd.sftp.client.SftpClient.DirEntry dirEntry, boolean recursionEnabled, boolean symlinksEnabled) Include remote resources when recursion is enabled or when symbolic links are enabled and the resource is a directory linkprivate booleanisIncludedFile(org.apache.sshd.sftp.client.SftpClient.DirEntry dirEntry, boolean symlinksEnabled) Include remote resources when regular file found or when symbolic links are enabled and the resource is a linkstatic voidmigrateAlgorithmProperties(PropertyConfiguration propertyConfiguration) private FileInfonewFileInfo(String path, String filename, org.apache.sshd.sftp.client.SftpClient.Attributes attributes) protected intnumberPermissions(String perms) put(org.apache.nifi.flowfile.FlowFile flowFile, String path, String filename, InputStream content) voidstatic voidvalidateProxySpec(org.apache.nifi.components.ValidationContext context, Collection<org.apache.nifi.components.ValidationResult> results) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.nifi.processor.util.file.transfer.FileTransfer
getAbsolutePath
-
Field Details
-
CLIENT_PROVIDER
-
DOT_PREFIX
- See Also:
-
RELATIVE_CURRENT_DIRECTORY
- See Also:
-
RELATIVE_PARENT_DIRECTORY
- See Also:
-
DEFAULT_KEY_ALGORITHM_NAMES
-
DEFAULT_CIPHER_NAMES
-
DEFAULT_MESSAGE_AUTHENTICATION_CODE_NAMES
-
DEFAULT_KEY_EXCHANGE_ALGORITHM_NAMES
-
PRIVATE_KEY_PATH
public static final org.apache.nifi.components.PropertyDescriptor PRIVATE_KEY_PATH -
PRIVATE_KEY_PASSPHRASE
public static final org.apache.nifi.components.PropertyDescriptor PRIVATE_KEY_PASSPHRASE -
HOST_KEY_FILE
public static final org.apache.nifi.components.PropertyDescriptor HOST_KEY_FILE -
STRICT_HOST_KEY_CHECKING
public static final org.apache.nifi.components.PropertyDescriptor STRICT_HOST_KEY_CHECKING -
PORT
public static final org.apache.nifi.components.PropertyDescriptor PORT -
USE_KEEPALIVE_ON_TIMEOUT
public static final org.apache.nifi.components.PropertyDescriptor USE_KEEPALIVE_ON_TIMEOUT -
ALGORITHM_CONFIGURATION
public static final org.apache.nifi.components.PropertyDescriptor ALGORITHM_CONFIGURATION -
KEY_ALGORITHMS_ALLOWED
public static final org.apache.nifi.components.PropertyDescriptor KEY_ALGORITHMS_ALLOWED -
CIPHERS_ALLOWED
public static final org.apache.nifi.components.PropertyDescriptor CIPHERS_ALLOWED -
MESSAGE_AUTHENTICATION_CODES_ALLOWED
public static final org.apache.nifi.components.PropertyDescriptor MESSAGE_AUTHENTICATION_CODES_ALLOWED -
KEY_EXCHANGE_ALGORITHMS_ALLOWED
public static final org.apache.nifi.components.PropertyDescriptor KEY_EXCHANGE_ALGORITHMS_ALLOWED -
DISABLE_DIRECTORY_LISTING
public static final org.apache.nifi.components.PropertyDescriptor DISABLE_DIRECTORY_LISTINGProperty which is used to decide if theensureDirectoryExists(FlowFile, File)method should perform a list before calling mkdir. In most cases, the code should call ls before mkdir, but some weird permission setups (chmod 100) on a directory would cause the 'ls' to throw a permission exception. -
PROXY_SPECS
-
PROXY_CONFIGURATION_SERVICE
public static final org.apache.nifi.components.PropertyDescriptor PROXY_CONFIGURATION_SERVICE -
logger
private final org.apache.nifi.logging.ComponentLog logger -
ctx
private final org.apache.nifi.context.PropertyContext ctx -
clientSession
private org.apache.sshd.client.session.ClientSession clientSession -
sftpClient
private org.apache.sshd.sftp.client.SftpClient sftpClient -
closed
private volatile boolean closed -
homeDir
-
activeHostname
-
activePort
-
activeUsername
-
activePassword
-
activePrivateKeyPath
-
activePrivateKeyPassphrase
-
disableDirectoryListing
private final boolean disableDirectoryListing
-
-
Constructor Details
-
SFTPTransfer
public SFTPTransfer(org.apache.nifi.context.PropertyContext propertyContext, org.apache.nifi.logging.ComponentLog logger)
-
-
Method Details
-
convertFactorySetToString
Converts a set of names into an alphabetically ordered comma separated value list.- Parameters:
factorySetNames- The set of names- Returns:
- An alphabetically ordered comma separated value list of names
-
buildFullPath
-
migrateAlgorithmProperties
-
validateProxySpec
public static void validateProxySpec(org.apache.nifi.components.ValidationContext context, Collection<org.apache.nifi.components.ValidationResult> results) -
getProtocolName
- Specified by:
getProtocolNamein interfaceFileTransfer
-
getListing
- Specified by:
getListingin interfaceFileTransfer- Throws:
IOException
-
getListing
protected void getListing(String path, int depth, int maxResults, List<FileInfo> listing, boolean applyFilters) throws IOException - Throws:
IOException
-
isIncludedFile
private boolean isIncludedFile(org.apache.sshd.sftp.client.SftpClient.DirEntry dirEntry, boolean symlinksEnabled) Include remote resources when regular file found or when symbolic links are enabled and the resource is a link- Parameters:
dirEntry- Remote Directory EntrysymlinksEnabled- Follow symbolic links enabled- Returns:
- Included file status
-
isIncludedDirectory
private boolean isIncludedDirectory(org.apache.sshd.sftp.client.SftpClient.DirEntry dirEntry, boolean recursionEnabled, boolean symlinksEnabled) Include remote resources when recursion is enabled or when symbolic links are enabled and the resource is a directory link- Parameters:
dirEntry- Remote Directory EntryrecursionEnabled- Recursion enabled statussymlinksEnabled- Follow symbolic links enabled- Returns:
- Included directory status
-
newFileInfo
-
appendPermission
private void appendPermission(StringBuilder builder, Set<PosixFilePermission> permissions, PosixFilePermission filePermission, String permString) -
getRemoteFile
public org.apache.nifi.flowfile.FlowFile getRemoteFile(String remoteFileName, org.apache.nifi.flowfile.FlowFile origFlowFile, org.apache.nifi.processor.ProcessSession session) throws org.apache.nifi.processor.exception.ProcessException, IOException - Specified by:
getRemoteFilein interfaceFileTransfer- Throws:
org.apache.nifi.processor.exception.ProcessExceptionIOException
-
deleteFile
public void deleteFile(org.apache.nifi.flowfile.FlowFile flowFile, String path, String remoteFileName) throws IOException - Specified by:
deleteFilein interfaceFileTransfer- Throws:
IOException
-
deleteDirectory
public void deleteDirectory(org.apache.nifi.flowfile.FlowFile flowFile, String remoteDirectoryName) throws IOException - Specified by:
deleteDirectoryin interfaceFileTransfer- Throws:
IOException
-
ensureDirectoryExists
public void ensureDirectoryExists(org.apache.nifi.flowfile.FlowFile flowFile, File directoryName) throws IOException - Specified by:
ensureDirectoryExistsin interfaceFileTransfer- Throws:
IOException
-
getSFTPClient
protected org.apache.sshd.sftp.client.SftpClient getSFTPClient(org.apache.nifi.flowfile.FlowFile flowFile) throws IOException - Throws:
IOException
-
getHomeDirectory
- Specified by:
getHomeDirectoryin interfaceFileTransfer- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
isClosed
public boolean isClosed()- Specified by:
isClosedin interfaceFileTransfer
-
getRemoteFileInfo
public FileInfo getRemoteFileInfo(org.apache.nifi.flowfile.FlowFile flowFile, String path, String filename) throws IOException - Specified by:
getRemoteFileInfoin interfaceFileTransfer- Throws:
IOException
-
put
public String put(org.apache.nifi.flowfile.FlowFile flowFile, String path, String filename, InputStream content) throws IOException - Specified by:
putin interfaceFileTransfer- Throws:
IOException
-
rename
public void rename(org.apache.nifi.flowfile.FlowFile flowFile, String source, String target) throws IOException - Specified by:
renamein interfaceFileTransfer- Throws:
IOException
-
numberPermissions
-