mirror of https://github.com/apache/nifi.git
NIFI-673: Added sftp.listing.user attribute to FlowFiles created by ListSFTP; ensure that FetchSFTP indicates that the username supports Expression Language
This commit is contained in:
parent
b0322d9ffe
commit
4e38288062
|
@ -77,6 +77,13 @@ public abstract class FetchFileTransfer extends AbstractProcessor {
|
|||
.expressionLanguageSupported(true)
|
||||
.required(true)
|
||||
.build();
|
||||
public static final PropertyDescriptor USERNAME = new PropertyDescriptor.Builder()
|
||||
.name("Username")
|
||||
.description("Username")
|
||||
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
|
||||
.expressionLanguageSupported(true)
|
||||
.required(true)
|
||||
.build();
|
||||
public static final PropertyDescriptor REMOTE_FILENAME = new PropertyDescriptor.Builder()
|
||||
.name("Remote File")
|
||||
.description("The fully qualified filename on the remote system")
|
||||
|
|
|
@ -53,7 +53,7 @@ public class FetchSFTP extends FetchFileTransfer {
|
|||
final List<PropertyDescriptor> properties = new ArrayList<>();
|
||||
properties.add(HOSTNAME);
|
||||
properties.add(port);
|
||||
properties.add(SFTPTransfer.USERNAME);
|
||||
properties.add(USERNAME);
|
||||
properties.add(SFTPTransfer.PASSWORD);
|
||||
properties.add(SFTPTransfer.PRIVATE_KEY_PATH);
|
||||
properties.add(SFTPTransfer.PRIVATE_KEY_PASSPHRASE);
|
||||
|
|
|
@ -45,6 +45,13 @@ public abstract class ListFileTransfer extends AbstractListProcessor<FileInfo> {
|
|||
.expressionLanguageSupported(true)
|
||||
.required(true)
|
||||
.build();
|
||||
public static final PropertyDescriptor USERNAME = new PropertyDescriptor.Builder()
|
||||
.name("Username")
|
||||
.description("Username")
|
||||
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
|
||||
.expressionLanguageSupported(true)
|
||||
.required(true)
|
||||
.build();
|
||||
public static final PropertyDescriptor REMOTE_PATH = new PropertyDescriptor.Builder()
|
||||
.name("Remote Path")
|
||||
.description("The path on the remote system from which to pull or push files")
|
||||
|
@ -64,6 +71,7 @@ public abstract class ListFileTransfer extends AbstractListProcessor<FileInfo> {
|
|||
attributes.put("file.group", fileInfo.getGroup());
|
||||
attributes.put("file.permissions", fileInfo.getPermissions());
|
||||
attributes.put(CoreAttributes.FILENAME.key(), fileInfo.getFileName());
|
||||
attributes.put(getProtocolName() + ".listing.user", context.getProperty(USERNAME).evaluateAttributeExpressions().getValue());
|
||||
|
||||
final String fullPath = fileInfo.getFullPathFileName();
|
||||
if (fullPath != null) {
|
||||
|
|
|
@ -39,6 +39,7 @@ import org.apache.nifi.processors.standard.util.SFTPTransfer;
|
|||
@WritesAttributes({
|
||||
@WritesAttribute(attribute = "sftp.remote.host", description = "The hostname of the SFTP Server"),
|
||||
@WritesAttribute(attribute = "sftp.remote.port", description = "The port that was connected to on the SFTP Server"),
|
||||
@WritesAttribute(attribute = "sftp.listing.user", description = "The username of the user that performed the SFTP Listing"),
|
||||
@WritesAttribute(attribute = "file.owner", description = "The numeric owner id of the source file"),
|
||||
@WritesAttribute(attribute = "file.group", description = "The numeric group id of the source file"),
|
||||
@WritesAttribute(attribute = "file.permissions", description = "The read/write/execute permissions of the source file"),
|
||||
|
@ -54,7 +55,7 @@ public class ListSFTP extends ListFileTransfer {
|
|||
final List<PropertyDescriptor> properties = new ArrayList<>();
|
||||
properties.add(HOSTNAME);
|
||||
properties.add(port);
|
||||
properties.add(SFTPTransfer.USERNAME);
|
||||
properties.add(USERNAME);
|
||||
properties.add(SFTPTransfer.PASSWORD);
|
||||
properties.add(SFTPTransfer.PRIVATE_KEY_PATH);
|
||||
properties.add(SFTPTransfer.PRIVATE_KEY_PASSPHRASE);
|
||||
|
|
Loading…
Reference in New Issue