Class FetchFile

java.lang.Object
org.apache.nifi.components.AbstractConfigurableComponent
org.apache.nifi.processor.AbstractSessionFactoryProcessor
org.apache.nifi.processor.AbstractProcessor
org.apache.nifi.processors.standard.FetchFile
All Implemented Interfaces:
org.apache.nifi.components.ConfigurableComponent, org.apache.nifi.processor.Processor

@InputRequirement(INPUT_REQUIRED) @Tags({"local","files","filesystem","ingest","ingress","get","source","input","fetch"}) @CapabilityDescription("Reads the contents of a file from disk and streams it into the contents of an incoming FlowFile. Once this is done, the file is optionally moved elsewhere or deleted to help keep the file system organized.") @SeeAlso({GetFile.class,PutFile.class,ListFile.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.") @MultiProcessorUseCase(description="Ingest all files from a directory into NiFi",keywords={"local","files","filesystem","ingest","ingress","get","source","input","fetch"},configurations={@ProcessorConfiguration(processorClass=ListFile.class,configuration="Configure the \"Input Directory\" property to point to the directory that you want to ingest files from.\nSet the \"Input Directory Location\" property to \"Local\"\nOptionally, set \"Minimum File Age\" to a small value such as \"1 min\" to avoid ingesting files that are still being written to.\n\nConnect the \'success\' Relationship to the FetchFile processor.\n"),@ProcessorConfiguration(processorClass=FetchFile.class,configuration="Set the \"File to Fetch\" property to `${absolute.path}/${filename}`\nSet the \"Completion Strategy\" property to `None`\n")}) @MultiProcessorUseCase(description="Ingest specific files from a directory into NiFi, filtering on filename",keywords={"local","files","filesystem","ingest","ingress","get","source","input","fetch","filter"},configurations={@ProcessorConfiguration(processorClass=ListFile.class,configuration="Configure the \"Input Directory\" property to point to the directory that you want to ingest files from.\nSet the \"Input Directory Location\" property to \"Local\"\nSet the \"File Filter\" property to a Regular Expression that matches the filename (without path) of the files that you want to ingest. For example, to ingest all .jpg files, set the value to `.*\\.jpg`\nOptionally, set \"Minimum File Age\" to a small value such as \"1 min\" to avoid ingesting files that are still being written to.\n\nConnect the \'success\' Relationship to the FetchFile processor.\n"),@ProcessorConfiguration(processorClass=FetchFile.class,configuration="Set the \"File to Fetch\" property to `${absolute.path}/${filename}`\nSet the \"Completion Strategy\" property to `None`\n")}) public class FetchFile extends org.apache.nifi.processor.AbstractProcessor
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) static final org.apache.nifi.components.AllowableValue
     
    (package private) static final org.apache.nifi.components.AllowableValue
     
    (package private) static final org.apache.nifi.components.AllowableValue
     
    (package private) static final org.apache.nifi.components.PropertyDescriptor
     
    (package private) static final org.apache.nifi.components.AllowableValue
     
    (package private) static final org.apache.nifi.components.AllowableValue
     
    (package private) static final org.apache.nifi.components.AllowableValue
     
    (package private) static final org.apache.nifi.components.AllowableValue
     
    (package private) static final org.apache.nifi.components.PropertyDescriptor
     
    (package private) static final org.apache.nifi.components.PropertyDescriptor
     
    (package private) static final org.apache.nifi.components.PropertyDescriptor
     
    (package private) static final org.apache.nifi.components.PropertyDescriptor
     
    (package private) static final org.apache.nifi.components.PropertyDescriptor
     
    private static final List<org.apache.nifi.components.PropertyDescriptor>
     
    (package private) static final org.apache.nifi.processor.Relationship
     
    (package private) static final org.apache.nifi.processor.Relationship
     
    (package private) static final org.apache.nifi.processor.Relationship
     
    (package private) static final org.apache.nifi.processor.Relationship
     
    private static final Set<org.apache.nifi.processor.Relationship>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected Collection<org.apache.nifi.components.ValidationResult>
    customValidate(org.apache.nifi.components.ValidationContext validationContext)
     
    protected void
    delete(File file)
     
    Set<org.apache.nifi.processor.Relationship>
     
    protected List<org.apache.nifi.components.PropertyDescriptor>
     
    protected boolean
     
    protected boolean
     
    protected boolean
     
    protected void
    move(File source, File target, boolean overwrite)
     
    void
    onTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session)
     
    private void
    performCompletionAction(String completionStrategy, File file, String targetDirectoryName, org.apache.nifi.flowfile.FlowFile flowFile, org.apache.nifi.processor.ProcessContext context)
     

    Methods inherited from class org.apache.nifi.processor.AbstractProcessor

    onTrigger

    Methods inherited from class org.apache.nifi.processor.AbstractSessionFactoryProcessor

    getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, init, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrue

    Methods inherited from class org.apache.nifi.components.AbstractConfigurableComponent

    equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, onPropertyModified, validate

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.apache.nifi.components.ConfigurableComponent

    getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validate

    Methods inherited from interface org.apache.nifi.processor.Processor

    isStateful, migrateProperties, migrateRelationships
  • Field Details

    • COMPLETION_NONE

      static final org.apache.nifi.components.AllowableValue COMPLETION_NONE
    • COMPLETION_MOVE

      static final org.apache.nifi.components.AllowableValue COMPLETION_MOVE
    • COMPLETION_DELETE

      static final org.apache.nifi.components.AllowableValue COMPLETION_DELETE
    • CONFLICT_REPLACE

      static final org.apache.nifi.components.AllowableValue CONFLICT_REPLACE
    • CONFLICT_KEEP_INTACT

      static final org.apache.nifi.components.AllowableValue CONFLICT_KEEP_INTACT
    • CONFLICT_FAIL

      static final org.apache.nifi.components.AllowableValue CONFLICT_FAIL
    • CONFLICT_RENAME

      static final org.apache.nifi.components.AllowableValue CONFLICT_RENAME
    • FILENAME

      static final org.apache.nifi.components.PropertyDescriptor FILENAME
    • COMPLETION_STRATEGY

      static final org.apache.nifi.components.PropertyDescriptor COMPLETION_STRATEGY
    • MOVE_DESTINATION_DIR

      static final org.apache.nifi.components.PropertyDescriptor MOVE_DESTINATION_DIR
    • CONFLICT_STRATEGY

      static final org.apache.nifi.components.PropertyDescriptor CONFLICT_STRATEGY
    • FILE_NOT_FOUND_LOG_LEVEL

      static final org.apache.nifi.components.PropertyDescriptor FILE_NOT_FOUND_LOG_LEVEL
    • PERM_DENIED_LOG_LEVEL

      static final org.apache.nifi.components.PropertyDescriptor PERM_DENIED_LOG_LEVEL
    • PROPERTIES

      private static final List<org.apache.nifi.components.PropertyDescriptor> PROPERTIES
    • REL_SUCCESS

      static final org.apache.nifi.processor.Relationship REL_SUCCESS
    • REL_NOT_FOUND

      static final org.apache.nifi.processor.Relationship REL_NOT_FOUND
    • REL_PERMISSION_DENIED

      static final org.apache.nifi.processor.Relationship REL_PERMISSION_DENIED
    • REL_FAILURE

      static final org.apache.nifi.processor.Relationship REL_FAILURE
    • RELATIONSHIPS

      private static final Set<org.apache.nifi.processor.Relationship> RELATIONSHIPS
  • Constructor Details

    • FetchFile

      public FetchFile()
  • Method Details

    • getSupportedPropertyDescriptors

      protected List<org.apache.nifi.components.PropertyDescriptor> getSupportedPropertyDescriptors()
      Overrides:
      getSupportedPropertyDescriptors in class org.apache.nifi.components.AbstractConfigurableComponent
    • getRelationships

      public Set<org.apache.nifi.processor.Relationship> getRelationships()
      Specified by:
      getRelationships in interface org.apache.nifi.processor.Processor
      Overrides:
      getRelationships in class org.apache.nifi.processor.AbstractSessionFactoryProcessor
    • customValidate

      protected Collection<org.apache.nifi.components.ValidationResult> customValidate(org.apache.nifi.components.ValidationContext validationContext)
      Overrides:
      customValidate in class org.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:
      onTrigger in class org.apache.nifi.processor.AbstractProcessor
      Throws:
      org.apache.nifi.processor.exception.ProcessException
    • performCompletionAction

      private void performCompletionAction(String completionStrategy, File file, String targetDirectoryName, org.apache.nifi.flowfile.FlowFile flowFile, org.apache.nifi.processor.ProcessContext context)
    • move

      protected void move(File source, File target, boolean overwrite) throws IOException
      Throws:
      IOException
    • delete

      protected void delete(File file) throws IOException
      Throws:
      IOException
    • isReadable

      protected boolean isReadable(File file)
    • isWritable

      protected boolean isWritable(File file)
    • isDirectory

      protected boolean isDirectory(File file)