Class FetchFileTransfer
java.lang.Object
org.apache.nifi.components.AbstractConfigurableComponent
org.apache.nifi.processor.AbstractSessionFactoryProcessor
org.apache.nifi.processor.AbstractProcessor
org.apache.nifi.processor.util.file.transfer.FetchFileTransfer
- All Implemented Interfaces:
org.apache.nifi.components.ConfigurableComponent,org.apache.nifi.processor.Processor
public abstract class FetchFileTransfer
extends org.apache.nifi.processor.AbstractProcessor
A base class for FetchSFTP, FetchFTP processors.
Note that implementations of this class should never use the @SupportsBatching annotation! Doing so
could result in data loss!
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classWrapper around a FileTransfer object that is used to know when the FileTransfer was last used, so that we have the ability to close connections that are "idle," or unused for some period of time. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.apache.nifi.components.AllowableValuestatic final org.apache.nifi.components.AllowableValuestatic final org.apache.nifi.components.AllowableValuestatic final org.apache.nifi.components.PropertyDescriptorstatic final Stringstatic final org.apache.nifi.components.PropertyDescriptorprivate final Map<Tuple<String, Integer>, BlockingQueue<FetchFileTransfer.FileTransferIdleWrapper>> static final org.apache.nifi.components.PropertyDescriptorprivate final longprivate longprivate org.apache.nifi.logging.LogLevelstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorprivate static final List<org.apache.nifi.components.PropertyDescriptor> static final org.apache.nifi.processor.Relationshipstatic final org.apache.nifi.processor.Relationshipstatic final org.apache.nifi.processor.Relationshipstatic final org.apache.nifi.processor.Relationshipprivate static final Set<org.apache.nifi.processor.Relationship> static final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanup()private voidcleanupTransfer(FileTransfer transfer, boolean closeConnection, BlockingQueue<FetchFileTransfer.FileTransferIdleWrapper> transferQueue, String host, int port) private voidcloseConnections(boolean closeNonIdleConnections) Close connections that are idle or optionally close all connections.protected abstract FileTransfercreateFileTransfer(org.apache.nifi.processor.ProcessContext context) Creates a new instance of a FileTransfer that can be used to pull files from a remote system.Set<org.apache.nifi.processor.Relationship> protected List<org.apache.nifi.components.PropertyDescriptor> voidonScheduled(org.apache.nifi.processor.ProcessContext context) voidonTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session) private voidperformCompletionStrategy(FileTransfer transfer, org.apache.nifi.processor.ProcessContext context, org.apache.nifi.flowfile.FlowFile flowFile, String filename, String host, int port) Methods inherited from class org.apache.nifi.processor.AbstractProcessor
onTriggerMethods inherited from class org.apache.nifi.processor.AbstractSessionFactoryProcessor
getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, init, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrueMethods inherited from class org.apache.nifi.components.AbstractConfigurableComponent
customValidate, equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, onPropertyModified, validateMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.nifi.components.ConfigurableComponent
getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validateMethods inherited from interface org.apache.nifi.processor.Processor
isStateful, migrateProperties, migrateRelationships
-
Field Details
-
COMPLETION_NONE
public static final org.apache.nifi.components.AllowableValue COMPLETION_NONE -
COMPLETION_MOVE
public static final org.apache.nifi.components.AllowableValue COMPLETION_MOVE -
COMPLETION_DELETE
public static final org.apache.nifi.components.AllowableValue COMPLETION_DELETE -
FAILURE_REASON_ATTRIBUTE
- See Also:
-
HOSTNAME
public static final org.apache.nifi.components.PropertyDescriptor HOSTNAME -
UNDEFAULTED_PORT
public static final org.apache.nifi.components.PropertyDescriptor UNDEFAULTED_PORT -
USERNAME
public static final org.apache.nifi.components.PropertyDescriptor USERNAME -
REMOTE_FILENAME
public static final org.apache.nifi.components.PropertyDescriptor REMOTE_FILENAME -
COMPLETION_STRATEGY
public static final org.apache.nifi.components.PropertyDescriptor COMPLETION_STRATEGY -
MOVE_CREATE_DIRECTORY
public static final org.apache.nifi.components.PropertyDescriptor MOVE_CREATE_DIRECTORY -
MOVE_DESTINATION_DIR
public static final org.apache.nifi.components.PropertyDescriptor MOVE_DESTINATION_DIR -
FILE_NOT_FOUND_LOG_LEVEL
public static final org.apache.nifi.components.PropertyDescriptor FILE_NOT_FOUND_LOG_LEVEL -
REL_SUCCESS
public static final org.apache.nifi.processor.Relationship REL_SUCCESS -
REL_COMMS_FAILURE
public static final org.apache.nifi.processor.Relationship REL_COMMS_FAILURE -
REL_NOT_FOUND
public static final org.apache.nifi.processor.Relationship REL_NOT_FOUND -
REL_PERMISSION_DENIED
public static final org.apache.nifi.processor.Relationship REL_PERMISSION_DENIED -
PROPERTY_DESCRIPTORS
-
RELATIONSHIPS
-
fileTransferMap
private final Map<Tuple<String,Integer>, fileTransferMapBlockingQueue<FetchFileTransfer.FileTransferIdleWrapper>> -
IDLE_CONNECTION_MILLIS
private final long IDLE_CONNECTION_MILLIS -
lastClearTime
private volatile long lastClearTime -
levelFileNotFound
private org.apache.nifi.logging.LogLevel levelFileNotFound
-
-
Constructor Details
-
FetchFileTransfer
public FetchFileTransfer()
-
-
Method Details
-
getRelationships
- Specified by:
getRelationshipsin interfaceorg.apache.nifi.processor.Processor- Overrides:
getRelationshipsin classorg.apache.nifi.processor.AbstractSessionFactoryProcessor
-
onScheduled
@OnScheduled public void onScheduled(org.apache.nifi.processor.ProcessContext context) -
closeConnections
private void closeConnections(boolean closeNonIdleConnections) Close connections that are idle or optionally close all connections. Connections are considered "idle" if they have not been used in 10 seconds.- Parameters:
closeNonIdleConnections- iftruewill close all connection; iffalsewill close only idle connections
-
cleanup
@OnStopped public void cleanup() -
getSupportedPropertyDescriptors
- Overrides:
getSupportedPropertyDescriptorsin classorg.apache.nifi.components.AbstractConfigurableComponent
-
onTrigger
public void onTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session) throws org.apache.nifi.processor.exception.ProcessException - Specified by:
onTriggerin classorg.apache.nifi.processor.AbstractProcessor- Throws:
org.apache.nifi.processor.exception.ProcessException
-
cleanupTransfer
private void cleanupTransfer(FileTransfer transfer, boolean closeConnection, BlockingQueue<FetchFileTransfer.FileTransferIdleWrapper> transferQueue, String host, int port) -
performCompletionStrategy
private void performCompletionStrategy(FileTransfer transfer, org.apache.nifi.processor.ProcessContext context, org.apache.nifi.flowfile.FlowFile flowFile, String filename, String host, int port) -
createFileTransfer
protected abstract FileTransfer createFileTransfer(org.apache.nifi.processor.ProcessContext context) Creates a new instance of a FileTransfer that can be used to pull files from a remote system.- Parameters:
context- the ProcessContext to use in order to obtain configured properties- Returns:
- a FileTransfer that can be used to pull files from a remote system
-