@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,
Path inputDirectory) |
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) |
onTriggergetControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTruecustomValidate, equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, onPropertyModified, validateclone, finalize, getClass, notify, notifyAll, wait, wait, waitisStatefulgetPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validatepublic 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 BlockingQueue<File> fileQueue
private final Lock queueLock
private final Lock listingLock
private final AtomicLong queueLastUpdated
protected void init(ProcessorInitializationContext context)
init in class AbstractSessionFactoryProcessorprotected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors in class AbstractConfigurableComponentpublic Set<Relationship> getRelationships()
getRelationships in interface ProcessorgetRelationships in class AbstractSessionFactoryProcessor@OnScheduled public void onScheduled(ProcessContext context)
private FileFilter createFileFilter(ProcessContext context, Path inputDirectory)
private Set<File> performListing(File directory, FileFilter filter, boolean recurseSubdirectories)
public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException
onTrigger in class AbstractProcessorProcessExceptionCopyright © 2023 Apache NiFi Project. All rights reserved.