Class ListHDFS
java.lang.Object
org.apache.nifi.components.AbstractConfigurableComponent
org.apache.nifi.processor.AbstractSessionFactoryProcessor
org.apache.nifi.processor.AbstractProcessor
org.apache.nifi.processors.hadoop.AbstractHadoopProcessor
org.apache.nifi.processors.hadoop.ListHDFS
- All Implemented Interfaces:
org.apache.nifi.components.ClassloaderIsolationKeyProvider,org.apache.nifi.components.ConfigurableComponent,org.apache.nifi.processor.Processor
@PrimaryNodeOnly
@TriggerSerially
@TriggerWhenEmpty
@InputRequirement(INPUT_FORBIDDEN)
@Tags({"hadoop","HCFS","HDFS","get","list","ingest","source","filesystem"})
@SeeAlso({GetHDFS.class,FetchHDFS.class,PutHDFS.class})
@CapabilityDescription("Retrieves a listing of files from HDFS. For each file that is listed in HDFS, this processor creates a FlowFile that represents the HDFS file to be fetched in conjunction with FetchHDFS. 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. Unlike GetHDFS, this Processor does not delete any data from HDFS.")
@WritesAttribute(attribute="filename",description="The name of the file that was read from HDFS.") @WritesAttribute(attribute="path",description="The path is set to the absolute path of the file\'s directory on HDFS. For example, if the Directory property is set to /tmp, then 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 \"/tmp/abc/1/2/3\".") @WritesAttribute(attribute="hdfs.owner",description="The user that owns the file in HDFS") @WritesAttribute(attribute="hdfs.group",description="The group that owns the file in HDFS") @WritesAttribute(attribute="hdfs.lastModified",description="The timestamp of when the file in HDFS was last modified, as milliseconds since midnight Jan 1, 1970 UTC") @WritesAttribute(attribute="hdfs.length",description="The number of bytes in the file in HDFS") @WritesAttribute(attribute="hdfs.replication",description="The number of HDFS replicas for hte file") @WritesAttribute(attribute="hdfs.permissions",description="The permissions for the file in HDFS. This is formatted as 3 characters for the owner, 3 for the group, and 3 for other users. For example rw-rw-r--")
@Stateful(scopes=CLUSTER,
description="After performing a listing of HDFS files, the latest timestamp of all the files listed is stored. This allows the Processor to list only files that have been added or modified after this date the next time that the Processor is run, without having to store all of the actual filenames/paths which could lead to performance problems. State is stored across the cluster so that this Processor can be run on Primary Node only and if a new Primary Node is selected, the new node can pick up where the previous node left off, without duplicating the data.")
@DefaultSchedule(strategy=TIMER_DRIVEN,
period="1 min")
public class ListHDFS
extends AbstractHadoopProcessor
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.nifi.processors.hadoop.AbstractHadoopProcessor
AbstractHadoopProcessor.ValidationResources -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorprivate Patternprivate static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorprivate static final Stringprivate 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.processor.Relationshipprivate static final Set<org.apache.nifi.processor.Relationship> private booleanFields inherited from class org.apache.nifi.processors.hadoop.AbstractHadoopProcessor
ABSOLUTE_HDFS_PATH_ATTRIBUTE, ADDITIONAL_CLASSPATH_RESOURCES, COMPRESSION_CODEC, DIRECTORY, HADOOP_CONFIGURATION_RESOURCES, HADOOP_FILE_URL_ATTRIBUTE, hdfsResources, KERBEROS_USER_SERVICE, TARGET_HDFS_DIR_CREATED_ATTRIBUTE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate org.apache.hadoop.fs.PathFiltercreatePathFilter(org.apache.nifi.processor.ProcessContext context) protected Collection<org.apache.nifi.components.ValidationResult> customValidate(org.apache.nifi.components.ValidationContext context) protected Stringprivate intgetPathSegmentsToSkip(boolean recursive) Set<org.apache.nifi.processor.Relationship> protected org.apache.nifi.processor.Relationshipprotected List<org.apache.nifi.components.PropertyDescriptor> voidonPropertyModified(org.apache.nifi.components.PropertyDescriptor descriptor, String oldValue, String newValue) voidonTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session) protected voidpreProcessConfiguration(org.apache.hadoop.conf.Configuration config, org.apache.nifi.processor.ProcessContext context) voidresetStateIfNecessary(org.apache.nifi.processor.ProcessContext context) private voidupdateState(org.apache.nifi.processor.ProcessSession session, Map<String, String> newState) Methods inherited from class org.apache.nifi.processors.hadoop.AbstractHadoopProcessor
abstractOnScheduled, abstractOnStopped, checkHdfsUriForTimeout, findCause, getClassloaderIsolationKey, getCommonPropertyDescriptors, getCompressionCodec, getConfigLocations, getConfiguration, getFileSystem, getFileSystem, getFileSystemAsUser, getHadoopConfigurationForValidation, getNormalizedPath, getNormalizedPath, getNormalizedPath, getPathDifference, getUserGroupInformation, handleAuthErrors, init, isFileSystemAccessDenied, isLocalFileSystemAccessDenied, migrateProperties, resetHDFSResources, validateFileSystemMethods inherited from class org.apache.nifi.processor.AbstractProcessor
onTriggerMethods inherited from class org.apache.nifi.processor.AbstractSessionFactoryProcessor
getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, 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
-
NON_HIDDEN_FILES_REGEX
- See Also:
-
HDFS_ATTRIBUTE_PREFIX
- See Also:
-
RECURSE_SUBDIRS
public static final org.apache.nifi.components.PropertyDescriptor RECURSE_SUBDIRS -
RECORD_WRITER
public static final org.apache.nifi.components.PropertyDescriptor RECORD_WRITER -
FILE_FILTER
public static final org.apache.nifi.components.PropertyDescriptor FILE_FILTER -
FILE_FILTER_MODE
public static final org.apache.nifi.components.PropertyDescriptor FILE_FILTER_MODE -
MINIMUM_FILE_AGE
public static final org.apache.nifi.components.PropertyDescriptor MINIMUM_FILE_AGE -
MAXIMUM_FILE_AGE
public static final org.apache.nifi.components.PropertyDescriptor MAXIMUM_FILE_AGE -
REL_SUCCESS
public static final org.apache.nifi.processor.Relationship REL_SUCCESS -
LEGACY_EMITTED_TIMESTAMP_KEY
- See Also:
-
LEGACY_LISTING_TIMESTAMP_KEY
- See Also:
-
LATEST_TIMESTAMP_KEY
- See Also:
-
LATEST_FILES_KEY
- See Also:
-
PROPERTY_DESCRIPTORS
-
RELATIONSHIPS
-
fileFilterRegexPattern
-
resetState
private volatile boolean resetState
-
-
Constructor Details
-
ListHDFS
public ListHDFS()
-
-
Method Details
-
preProcessConfiguration
protected void preProcessConfiguration(org.apache.hadoop.conf.Configuration config, org.apache.nifi.processor.ProcessContext context) - Overrides:
preProcessConfigurationin classAbstractHadoopProcessor
-
getSupportedPropertyDescriptors
- Overrides:
getSupportedPropertyDescriptorsin classAbstractHadoopProcessor
-
getRelationships
- Specified by:
getRelationshipsin interfaceorg.apache.nifi.processor.Processor- Overrides:
getRelationshipsin classorg.apache.nifi.processor.AbstractSessionFactoryProcessor
-
customValidate
protected Collection<org.apache.nifi.components.ValidationResult> customValidate(org.apache.nifi.components.ValidationContext context) - Overrides:
customValidatein classAbstractHadoopProcessor
-
onPropertyModified
public void onPropertyModified(org.apache.nifi.components.PropertyDescriptor descriptor, String oldValue, String newValue) - Specified by:
onPropertyModifiedin interfaceorg.apache.nifi.components.ConfigurableComponent- Overrides:
onPropertyModifiedin classorg.apache.nifi.components.AbstractConfigurableComponent
-
resetStateIfNecessary
@OnScheduled public void resetStateIfNecessary(org.apache.nifi.processor.ProcessContext context) throws IOException - Throws:
IOException
-
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:
onTriggerin classorg.apache.nifi.processor.AbstractProcessor- Throws:
org.apache.nifi.processor.exception.ProcessException
-
createPathFilter
private org.apache.hadoop.fs.PathFilter createPathFilter(org.apache.nifi.processor.ProcessContext context) -
getPathSegmentsToSkip
private int getPathSegmentsToSkip(boolean recursive) -
updateState
-
getSuccessRelationship
protected org.apache.nifi.processor.Relationship getSuccessRelationship() -
getAttributePrefix
-