Package org.apache.nifi.processors.smb
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 ClassesModifier and TypeClassDescriptionprivate static classprivate static classNested classes/interfaces inherited from class org.apache.nifi.processor.util.list.AbstractListProcessor
org.apache.nifi.processor.util.list.AbstractListProcessor.ListingMode -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorprivate Longstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic 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.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorFields 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 -
Method Summary
Modifier and TypeMethodDescriptionprotected IntegercountUnfilteredListing(org.apache.nifi.processor.ProcessContext context) createAttributes(SmbListableEntity entity, org.apache.nifi.processor.ProcessContext context) private Predicate<SmbListableEntity> createFileFilter(org.apache.nifi.processor.ProcessContext context, Long minTimestampOrNull) protected voidcustomValidate(org.apache.nifi.components.ValidationContext validationContext, Collection<org.apache.nifi.components.ValidationResult> validationResults) private StringformatTimeStamp(long timestamp) private StringgetDirectory(org.apache.nifi.processor.ProcessContext context) private LonggetInitialListingTimestamp(org.apache.nifi.context.PropertyContext context) protected StringgetListingContainerName(org.apache.nifi.processor.ProcessContext context) protected StringgetPath(org.apache.nifi.processor.ProcessContext context) protected RecordSchemaprotected org.apache.nifi.components.state.ScopegetStateScope(org.apache.nifi.context.PropertyContext context) protected List<org.apache.nifi.components.PropertyDescriptor> private booleanisExecutionStopped(org.apache.nifi.processor.util.list.AbstractListProcessor.ListingMode listingMode) protected booleanisListingResetNecessary(org.apache.nifi.components.PropertyDescriptor property) voidonScheduled(org.apache.nifi.processor.ProcessContext context) private Stream<SmbListableEntity> performListing(org.apache.nifi.processor.ProcessContext context) protected List<SmbListableEntity> 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, verifyMethods 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
equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, 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, validateMethods 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
-
initialListingTimestamp
-
-
Constructor Details
-
ListSmb
public ListSmb()
-
-
Method Details
-
getSupportedPropertyDescriptors
- Overrides:
getSupportedPropertyDescriptorsin classorg.apache.nifi.components.AbstractConfigurableComponent
-
customValidate
protected void customValidate(org.apache.nifi.components.ValidationContext validationContext, Collection<org.apache.nifi.components.ValidationResult> validationResults) - Overrides:
customValidatein classorg.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:
createAttributesin classorg.apache.nifi.processor.util.list.AbstractListProcessor<SmbListableEntity>
-
getPath
- Specified by:
getPathin classorg.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:
performListingin classorg.apache.nifi.processor.util.list.AbstractListProcessor<SmbListableEntity>- Throws:
IOException
-
isListingResetNecessary
protected boolean isListingResetNecessary(org.apache.nifi.components.PropertyDescriptor property) - Specified by:
isListingResetNecessaryin classorg.apache.nifi.processor.util.list.AbstractListProcessor<SmbListableEntity>
-
getStateScope
protected org.apache.nifi.components.state.Scope getStateScope(org.apache.nifi.context.PropertyContext context) - Specified by:
getStateScopein classorg.apache.nifi.processor.util.list.AbstractListProcessor<SmbListableEntity>
-
getRecordSchema
- Specified by:
getRecordSchemain classorg.apache.nifi.processor.util.list.AbstractListProcessor<SmbListableEntity>
-
countUnfilteredListing
protected Integer countUnfilteredListing(org.apache.nifi.processor.ProcessContext context) throws IOException - Specified by:
countUnfilteredListingin classorg.apache.nifi.processor.util.list.AbstractListProcessor<SmbListableEntity>- Throws:
IOException
-
getListingContainerName
- Specified by:
getListingContainerNamein classorg.apache.nifi.processor.util.list.AbstractListProcessor<SmbListableEntity>
-
formatTimeStamp
-
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
-
getInitialListingTimestamp
-