@TriggerWhenEmpty @InputRequirement(value=INPUT_FORBIDDEN) @Tags(value={"local","files","filesystem","ingest","ingress","get","source","input"}) @CapabilityDescription(value="Creates FlowFiles from files in a directory. NiFi will ignore files it doesn\'t have at least read permissions for.") @WritesAttribute(attribute="filename",description="The filename is set to the name of the file on disk") @WritesAttribute(attribute="path",description="The path is set to the relative path of the file\'s directory on disk. For example, if the <Input Directory> property is set to /tmp, files picked up from /tmp will have the path attribute set to ./. If the <Recurse Subdirectories> property is set to true and a file is picked up from /tmp/abc/1/2/3, then the path attribute will be set to abc/1/2/3") @WritesAttribute(attribute="file.creationTime",description="The date and time that the file was created. May not work on all file systems") @WritesAttribute(attribute="file.lastModifiedTime",description="The date and time that the file was last modified. May not work on all file systems") @WritesAttribute(attribute="file.lastAccessTime",description="The date and time that the file was last accessed. May not work on all file systems") @WritesAttribute(attribute="file.owner",description="The owner of the file. May not work on all file systems") @WritesAttribute(attribute="file.group",description="The group owner of the file. May not work on all file systems") @WritesAttribute(attribute="file.permissions",description="The read/write/execute permissions of the file. May not work on all file systems") @WritesAttribute(attribute="absolute.path",description="The full/absolute path from where a file was picked up. The current \'path\' attribute is still populated, but may be a relative path") @SeeAlso(value={PutFile.class,FetchFile.class}) @Restriction(requiredPermission=READ_FILESYSTEM,explanation="Provides operator the ability to read from any file that NiFi has access to.") @Restriction(requiredPermission=WRITE_FILESYSTEM,explanation="Provides operator the ability to delete any file that NiFi has access to.") public class GetFile extends AbstractProcessor
Constructor and Description |
---|
GetFile() |
Modifier and Type | Method and Description |
---|---|
private FileFilter |
createFileFilter(ProcessContext context) |
protected Map<String,String> |
getAttributesFromFile(Path file) |
Set<Relationship> |
getRelationships() |
protected List<PropertyDescriptor> |
getSupportedPropertyDescriptors() |
protected void |
init(ProcessorInitializationContext context) |
void |
onScheduled(ProcessContext context) |
void |
onTrigger(ProcessContext context,
ProcessSession session) |
private Set<File> |
performListing(File directory,
FileFilter filter,
boolean recurseSubdirectories) |
onTrigger
getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrue
customValidate, equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, onPropertyModified, validate
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validate
public static final PropertyDescriptor DIRECTORY
public static final PropertyDescriptor RECURSE
public static final PropertyDescriptor KEEP_SOURCE_FILE
public static final PropertyDescriptor FILE_FILTER
public static final PropertyDescriptor PATH_FILTER
public static final PropertyDescriptor MIN_AGE
public static final PropertyDescriptor MAX_AGE
public static final PropertyDescriptor MIN_SIZE
public static final PropertyDescriptor MAX_SIZE
public static final PropertyDescriptor IGNORE_HIDDEN_FILES
public static final PropertyDescriptor POLLING_INTERVAL
public static final PropertyDescriptor BATCH_SIZE
public static final String FILE_CREATION_TIME_ATTRIBUTE
public static final String FILE_LAST_MODIFY_TIME_ATTRIBUTE
public static final String FILE_LAST_ACCESS_TIME_ATTRIBUTE
public static final String FILE_OWNER_ATTRIBUTE
public static final String FILE_GROUP_ATTRIBUTE
public static final String FILE_PERMISSIONS_ATTRIBUTE
public static final String FILE_MODIFY_DATE_ATTR_FORMAT
public static final Relationship REL_SUCCESS
private List<PropertyDescriptor> properties
private Set<Relationship> relationships
private final AtomicReference<FileFilter> fileFilterRef
private final BlockingQueue<File> fileQueue
private final Lock queueLock
private final Lock listingLock
private final AtomicLong queueLastUpdated
protected void init(ProcessorInitializationContext context)
init
in class AbstractSessionFactoryProcessor
protected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors
in class AbstractConfigurableComponent
public Set<Relationship> getRelationships()
getRelationships
in interface Processor
getRelationships
in class AbstractSessionFactoryProcessor
@OnScheduled public void onScheduled(ProcessContext context)
private FileFilter createFileFilter(ProcessContext context)
private Set<File> performListing(File directory, FileFilter filter, boolean recurseSubdirectories)
public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException
onTrigger
in class AbstractProcessor
ProcessException
Copyright © 2020 Apache NiFi Project. All rights reserved.