mirror of https://github.com/apache/nifi.git
NIFI-4694: Make PutSFTP Disable Directory Listing a normal property. This closes #2338.
This commit is contained in:
parent
b8375a681a
commit
57947d64cd
|
@ -54,6 +54,7 @@ public class PutSFTP extends PutFileTransfer<SFTPTransfer> {
|
||||||
properties.add(SFTPTransfer.PRIVATE_KEY_PASSPHRASE);
|
properties.add(SFTPTransfer.PRIVATE_KEY_PASSPHRASE);
|
||||||
properties.add(SFTPTransfer.REMOTE_PATH);
|
properties.add(SFTPTransfer.REMOTE_PATH);
|
||||||
properties.add(SFTPTransfer.CREATE_DIRECTORY);
|
properties.add(SFTPTransfer.CREATE_DIRECTORY);
|
||||||
|
properties.add(SFTPTransfer.DISABLE_DIRECTORY_LISTING);
|
||||||
properties.add(SFTPTransfer.BATCH_SIZE);
|
properties.add(SFTPTransfer.BATCH_SIZE);
|
||||||
properties.add(SFTPTransfer.CONNECTION_TIMEOUT);
|
properties.add(SFTPTransfer.CONNECTION_TIMEOUT);
|
||||||
properties.add(SFTPTransfer.DATA_TIMEOUT);
|
properties.add(SFTPTransfer.DATA_TIMEOUT);
|
||||||
|
@ -77,14 +78,6 @@ public class PutSFTP extends PutFileTransfer<SFTPTransfer> {
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected PropertyDescriptor getSupportedDynamicPropertyDescriptor(String propertyDescriptorName) {
|
|
||||||
if (SFTPTransfer.DISABLE_DIRECTORY_LISTING.getName().equalsIgnoreCase(propertyDescriptorName)) {
|
|
||||||
return SFTPTransfer.DISABLE_DIRECTORY_LISTING;
|
|
||||||
}
|
|
||||||
return super.getSupportedDynamicPropertyDescriptor(propertyDescriptorName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SFTPTransfer getFileTransfer(final ProcessContext context) {
|
protected SFTPTransfer getFileTransfer(final ProcessContext context) {
|
||||||
return new SFTPTransfer(context, getLogger());
|
return new SFTPTransfer(context, getLogger());
|
||||||
|
|
|
@ -96,17 +96,22 @@ public class SFTPTransfer implements FileTransfer {
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dynamic property which is used to decide if the {@link #ensureDirectoryExists(FlowFile, File)} method should perform a {@link ChannelSftp#ls(String)} before calling
|
* Property which is used to decide if the {@link #ensureDirectoryExists(FlowFile, File)} method should perform a {@link ChannelSftp#ls(String)} before calling
|
||||||
* {@link ChannelSftp#mkdir(String)}. 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
|
* {@link ChannelSftp#mkdir(String)}. 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.
|
* exception.
|
||||||
* <p>
|
|
||||||
* This property is dynamic until deemed a worthy inclusion as proper.
|
|
||||||
*/
|
*/
|
||||||
public static final PropertyDescriptor DISABLE_DIRECTORY_LISTING = new PropertyDescriptor.Builder()
|
public static final PropertyDescriptor DISABLE_DIRECTORY_LISTING = new PropertyDescriptor.Builder()
|
||||||
.name("Disable Directory Listing")
|
.name("Disable Directory Listing")
|
||||||
.description("Disables directory listings before operations which might fail, such as configurations which create directory structures.")
|
.description("If set to 'true', directory listing is not performed prior to create missing directories." +
|
||||||
|
" By default, this processor executes a directory listing command" +
|
||||||
|
" to see target directory existence before creating missing directories." +
|
||||||
|
" However, there are situations that you might need to disable the directory listing such as followings." +
|
||||||
|
" Directory listing might fail with some permission setups (e.g. chmod 100) on a directory." +
|
||||||
|
" Also, if any other SFTP client created the directory after this processor performed a listing" +
|
||||||
|
" and before a directory creation request by this processor is finished," +
|
||||||
|
" then an error is returned because the directory already exists.")
|
||||||
.addValidator(StandardValidators.BOOLEAN_VALIDATOR)
|
.addValidator(StandardValidators.BOOLEAN_VALIDATOR)
|
||||||
.dynamic(true)
|
.allowableValues("true", "false")
|
||||||
.defaultValue("false")
|
.defaultValue("false")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue