Class ListSmb

java.lang.Object
org.apache.nifi.components.AbstractConfigurableComponent
org.apache.nifi.processor.AbstractSessionFactoryProcessor
org.apache.nifi.processor.AbstractProcessor
org.apache.nifi.processor.util.list.AbstractListProcessor<SmbListableEntity>
org.apache.nifi.processors.smb.ListSmb
All Implemented Interfaces:
org.apache.nifi.components.ConfigurableComponent, org.apache.nifi.processor.Processor, org.apache.nifi.processor.VerifiableProcessor

@PrimaryNodeOnly @TriggerSerially @Tags({"samba, smb, cifs, files","list"}) @SeeAlso({PutSmbFile.class,GetSmbFile.class,FetchSmb.class}) @CapabilityDescription("Lists concrete files shared via SMB protocol. Each listed file may result in one FlowFile, the metadata being written as FlowFile attributes. Or - in case the \'Record Writer\' property is set - the entire result is written as records to a single FlowFile. This Processor is designed to run on Primary Node only in a cluster. If the primary node changes, the new Primary Node will pick up where the previous node left off without duplicating all of the data.") @InputRequirement(INPUT_FORBIDDEN) @WritesAttribute(attribute="filename",description="The name of the file that was read from filesystem.") @WritesAttribute(attribute="shortName",description="The short name of the file that was read from filesystem.") @WritesAttribute(attribute="path",description="The path is set to the relative path of the file\'s directory on the remote filesystem compared to the Share root directory. For example, for a given remote locationsmb://HOSTNAME:PORT/SHARE/DIRECTORY, and a file is being listed from smb://HOSTNAME:PORT/SHARE/DIRECTORY/sub/folder/file then the path attribute will be set to \"DIRECTORY/sub/folder\".") @WritesAttribute(attribute="serviceLocation",description="The SMB URL of the share.") @WritesAttribute(attribute="lastModifiedTime",description="The timestamp of when the file\'s content changed in the filesystem as \'yyyy-MM-dd\'T\'HH:mm:ss\'.") @WritesAttribute(attribute="creationTime",description="The timestamp of when the file was created in the filesystem as \'yyyy-MM-dd\'T\'HH:mm:ss\'.") @WritesAttribute(attribute="lastAccessTime",description="The timestamp of when the file was accessed in the filesystem as \'yyyy-MM-dd\'T\'HH:mm:ss\'.") @WritesAttribute(attribute="changeTime",description="The timestamp of when the file\'s attributes was changed in the filesystem as \'yyyy-MM-dd\'T\'HH:mm:ss\'.") @WritesAttribute(attribute="size",description="The size of the file in bytes.") @WritesAttribute(attribute="allocationSize",description="The number of bytes allocated for the file on the server.") @Stateful(scopes=CLUSTER, description="After performing a listing of files, the state of the previous listing can be stored in order to list files continuously without duplication.") @DefaultSchedule(strategy=TIMER_DRIVEN, period="1 min") public class ListSmb extends org.apache.nifi.processor.util.list.AbstractListProcessor<SmbListableEntity>
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    private static class 
     
    private static class 
     

    Nested classes/interfaces inherited from class org.apache.nifi.processor.util.list.AbstractListProcessor

    org.apache.nifi.processor.util.list.AbstractListProcessor.ListingMode
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final org.apache.nifi.components.PropertyDescriptor
     
    static final org.apache.nifi.components.PropertyDescriptor
     
    static final org.apache.nifi.components.PropertyDescriptor
     
    static final org.apache.nifi.components.PropertyDescriptor
     
    static final org.apache.nifi.components.PropertyDescriptor
     
    static final org.apache.nifi.components.PropertyDescriptor
     
    private Long
     
    static final org.apache.nifi.components.PropertyDescriptor
     
    static final org.apache.nifi.components.PropertyDescriptor
     
    static final org.apache.nifi.components.PropertyDescriptor
     
    static final org.apache.nifi.components.PropertyDescriptor
     
    static final org.apache.nifi.components.PropertyDescriptor
     
    private static final List<org.apache.nifi.components.PropertyDescriptor>
     
    static final org.apache.nifi.components.PropertyDescriptor
     
    static final org.apache.nifi.components.PropertyDescriptor
     
    static final org.apache.nifi.components.PropertyDescriptor
     
    static final org.apache.nifi.components.PropertyDescriptor
     

    Fields inherited from class org.apache.nifi.processor.util.list.AbstractListProcessor

    BY_ENTITIES, BY_TIME_WINDOW, BY_TIMESTAMPS, LISTING_LAG_MILLIS, LISTING_STRATEGY, NO_TRACKING, PRECISION_AUTO_DETECT, PRECISION_MILLIS, PRECISION_MINUTES, PRECISION_SECONDS, RECORD_WRITER, REL_SUCCESS, TARGET_SYSTEM_TIMESTAMP_PRECISION
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected Integer
    countUnfilteredListing(org.apache.nifi.processor.ProcessContext context)
     
    protected Map<String,String>
    createAttributes(SmbListableEntity entity, org.apache.nifi.processor.ProcessContext context)
     
    createFileFilter(org.apache.nifi.processor.ProcessContext context, Long minTimestampOrNull)
     
    protected void
    customValidate(org.apache.nifi.components.ValidationContext validationContext, Collection<org.apache.nifi.components.ValidationResult> validationResults)
     
    private String
    formatTimeStamp(long timestamp)
     
    private String
    getDirectory(org.apache.nifi.processor.ProcessContext context)
     
    private Long
    getInitialListingTimestamp(org.apache.nifi.context.PropertyContext context)
     
    protected String
    getListingContainerName(org.apache.nifi.processor.ProcessContext context)
     
    protected String
    getPath(org.apache.nifi.processor.ProcessContext context)
     
    protected RecordSchema
     
    protected org.apache.nifi.components.state.Scope
    getStateScope(org.apache.nifi.context.PropertyContext context)
     
    protected List<org.apache.nifi.components.PropertyDescriptor>
     
    private boolean
    isExecutionStopped(org.apache.nifi.processor.util.list.AbstractListProcessor.ListingMode listingMode)
     
    protected boolean
    isListingResetNecessary(org.apache.nifi.components.PropertyDescriptor property)
     
    void
    onScheduled(org.apache.nifi.processor.ProcessContext context)
     
    performListing(org.apache.nifi.processor.ProcessContext context)
     
    performListing(org.apache.nifi.processor.ProcessContext context, Long minimumTimestampOrNull, org.apache.nifi.processor.util.list.AbstractListProcessor.ListingMode listingMode)
     

    Methods inherited from class org.apache.nifi.processor.util.list.AbstractListProcessor

    createListedEntityTracker, customValidate, getCurrentNanoTime, getCurrentTime, getDefaultTimePrecision, getKey, getRelationships, initListedEntityTracker, listByNoTracking, listByTimeWindow, listByTrackingTimestamps, migrateProperties, onPrimaryNodeChange, onPropertyModified, onTrigger, updateState, verify

    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, 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, validate

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

    isStateful, migrateRelationships
  • Field Details

    • DIRECTORY

      public static final org.apache.nifi.components.PropertyDescriptor DIRECTORY
    • MINIMUM_AGE

      public static final org.apache.nifi.components.PropertyDescriptor MINIMUM_AGE
    • MAXIMUM_AGE

      public static final org.apache.nifi.components.PropertyDescriptor MAXIMUM_AGE
    • MINIMUM_SIZE

      public static final org.apache.nifi.components.PropertyDescriptor MINIMUM_SIZE
    • MAXIMUM_SIZE

      public static final org.apache.nifi.components.PropertyDescriptor MAXIMUM_SIZE
    • SMB_LISTING_STRATEGY

      public static final org.apache.nifi.components.PropertyDescriptor SMB_LISTING_STRATEGY
    • INITIAL_LISTING_STRATEGY

      public static final org.apache.nifi.components.PropertyDescriptor INITIAL_LISTING_STRATEGY
    • INITIAL_LISTING_TIMESTAMP

      public static final org.apache.nifi.components.PropertyDescriptor INITIAL_LISTING_TIMESTAMP
    • SMB_CLIENT_PROVIDER_SERVICE

      public static final org.apache.nifi.components.PropertyDescriptor SMB_CLIENT_PROVIDER_SERVICE
    • FILE_FILTER

      public static final org.apache.nifi.components.PropertyDescriptor FILE_FILTER
    • PATH_FILTER

      public static final org.apache.nifi.components.PropertyDescriptor PATH_FILTER
    • IGNORE_FILES_WITH_SUFFIX

      public static final org.apache.nifi.components.PropertyDescriptor IGNORE_FILES_WITH_SUFFIX
    • TRACKING_STATE_CACHE

      public static final org.apache.nifi.components.PropertyDescriptor TRACKING_STATE_CACHE
    • TRACKING_TIME_WINDOW

      public static final org.apache.nifi.components.PropertyDescriptor TRACKING_TIME_WINDOW
    • INITIAL_LISTING_TARGET

      public static final org.apache.nifi.components.PropertyDescriptor INITIAL_LISTING_TARGET
    • PROPERTY_DESCRIPTORS

      private static final List<org.apache.nifi.components.PropertyDescriptor> PROPERTY_DESCRIPTORS
    • initialListingTimestamp

      private volatile Long initialListingTimestamp
  • Constructor Details

    • ListSmb

      public ListSmb()
  • Method Details

    • getSupportedPropertyDescriptors

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

      protected void customValidate(org.apache.nifi.components.ValidationContext validationContext, Collection<org.apache.nifi.components.ValidationResult> validationResults)
      Overrides:
      customValidate in class org.apache.nifi.processor.util.list.AbstractListProcessor<SmbListableEntity>
    • onScheduled

      @OnScheduled public void onScheduled(org.apache.nifi.processor.ProcessContext context) throws IOException
      Throws:
      IOException
    • createAttributes

      protected Map<String,String> createAttributes(SmbListableEntity entity, org.apache.nifi.processor.ProcessContext context)
      Specified by:
      createAttributes in class org.apache.nifi.processor.util.list.AbstractListProcessor<SmbListableEntity>
    • getPath

      protected String getPath(org.apache.nifi.processor.ProcessContext context)
      Specified by:
      getPath in class org.apache.nifi.processor.util.list.AbstractListProcessor<SmbListableEntity>
    • performListing

      protected List<SmbListableEntity> performListing(org.apache.nifi.processor.ProcessContext context, Long minimumTimestampOrNull, org.apache.nifi.processor.util.list.AbstractListProcessor.ListingMode listingMode) throws IOException
      Specified by:
      performListing in class org.apache.nifi.processor.util.list.AbstractListProcessor<SmbListableEntity>
      Throws:
      IOException
    • isListingResetNecessary

      protected boolean isListingResetNecessary(org.apache.nifi.components.PropertyDescriptor property)
      Specified by:
      isListingResetNecessary in class org.apache.nifi.processor.util.list.AbstractListProcessor<SmbListableEntity>
    • getStateScope

      protected org.apache.nifi.components.state.Scope getStateScope(org.apache.nifi.context.PropertyContext context)
      Specified by:
      getStateScope in class org.apache.nifi.processor.util.list.AbstractListProcessor<SmbListableEntity>
    • getRecordSchema

      protected RecordSchema getRecordSchema()
      Specified by:
      getRecordSchema in class org.apache.nifi.processor.util.list.AbstractListProcessor<SmbListableEntity>
    • countUnfilteredListing

      protected Integer countUnfilteredListing(org.apache.nifi.processor.ProcessContext context) throws IOException
      Specified by:
      countUnfilteredListing in class org.apache.nifi.processor.util.list.AbstractListProcessor<SmbListableEntity>
      Throws:
      IOException
    • getListingContainerName

      protected String getListingContainerName(org.apache.nifi.processor.ProcessContext context)
      Specified by:
      getListingContainerName in class org.apache.nifi.processor.util.list.AbstractListProcessor<SmbListableEntity>
    • formatTimeStamp

      private String formatTimeStamp(long timestamp)
    • isExecutionStopped

      private boolean isExecutionStopped(org.apache.nifi.processor.util.list.AbstractListProcessor.ListingMode listingMode)
    • createFileFilter

      private Predicate<SmbListableEntity> createFileFilter(org.apache.nifi.processor.ProcessContext context, Long minTimestampOrNull)
    • performListing

      private Stream<SmbListableEntity> performListing(org.apache.nifi.processor.ProcessContext context) throws IOException
      Throws:
      IOException
    • getDirectory

      private String getDirectory(org.apache.nifi.processor.ProcessContext context)
    • getInitialListingTimestamp

      private Long getInitialListingTimestamp(org.apache.nifi.context.PropertyContext context)