Class CountText
java.lang.Object
org.apache.nifi.components.AbstractConfigurableComponent
org.apache.nifi.processor.AbstractSessionFactoryProcessor
org.apache.nifi.processor.AbstractProcessor
org.apache.nifi.processors.standard.CountText
- All Implemented Interfaces:
org.apache.nifi.components.ConfigurableComponent,org.apache.nifi.processor.Processor
@SideEffectFree
@SupportsBatching
@Tags({"count","text","line","word","character"})
@InputRequirement(INPUT_REQUIRED)
@CapabilityDescription("Counts various metrics on incoming text. The requested results will be recorded as attributes. The resulting flowfile will not have its content modified.")
@WritesAttribute(attribute="text.line.count",description="The number of lines of text present in the FlowFile content") @WritesAttribute(attribute="text.line.nonempty.count",description="The number of lines of text (with at least one non-whitespace character) present in the original FlowFile") @WritesAttribute(attribute="text.word.count",description="The number of words present in the original FlowFile") @WritesAttribute(attribute="text.character.count",description="The number of characters (given the specified character encoding) present in the original FlowFile")
@SeeAlso(SplitText.class)
public class CountText
extends org.apache.nifi.processor.AbstractProcessor
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.apache.nifi.components.PropertyDescriptorprivate booleanstatic final org.apache.nifi.components.PropertyDescriptorprivate Stringprivate booleanprivate booleanprivate booleanprivate booleanprivate static final List<org.apache.nifi.components.PropertyDescriptor> static final org.apache.nifi.processor.Relationshipstatic final org.apache.nifi.processor.Relationshipprivate static final Set<org.apache.nifi.processor.Relationship> static final org.apache.nifi.components.PropertyDescriptorprivate booleanprivate static final Patternstatic final Stringstatic final org.apache.nifi.components.PropertyDescriptorstatic final Stringstatic final org.apache.nifi.components.PropertyDescriptorstatic final Stringstatic final org.apache.nifi.components.PropertyDescriptorstatic final Stringstatic final org.apache.nifi.components.PropertyDescriptorprivate static final Pattern -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) intcountWordsInLine(String line, boolean splitWordsOnSymbols) private StringgenerateMetricsMessage(int lineCount, int lineNonEmptyCount, int wordCount, int characterCount) Set<org.apache.nifi.processor.Relationship> protected List<org.apache.nifi.components.PropertyDescriptor> voidonSchedule(org.apache.nifi.processor.ProcessContext context) voidonTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession processSession) Will count text attributes of the incoming stream.Methods 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
customValidate, equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, onPropertyModified, 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, onPropertyModified, validateMethods inherited from interface org.apache.nifi.processor.Processor
isStateful, migrateProperties, migrateRelationships
-
Field Details
-
STANDARD_CHARSETS
-
SYMBOL_PATTERN
-
WHITESPACE_ONLY_PATTERN
-
TEXT_LINE_COUNT
- See Also:
-
TEXT_LINE_NONEMPTY_COUNT
- See Also:
-
TEXT_WORD_COUNT
- See Also:
-
TEXT_CHARACTER_COUNT
- See Also:
-
TEXT_LINE_COUNT_PD
public static final org.apache.nifi.components.PropertyDescriptor TEXT_LINE_COUNT_PD -
TEXT_LINE_NONEMPTY_COUNT_PD
public static final org.apache.nifi.components.PropertyDescriptor TEXT_LINE_NONEMPTY_COUNT_PD -
TEXT_WORD_COUNT_PD
public static final org.apache.nifi.components.PropertyDescriptor TEXT_WORD_COUNT_PD -
TEXT_CHARACTER_COUNT_PD
public static final org.apache.nifi.components.PropertyDescriptor TEXT_CHARACTER_COUNT_PD -
SPLIT_WORDS_ON_SYMBOLS_PD
public static final org.apache.nifi.components.PropertyDescriptor SPLIT_WORDS_ON_SYMBOLS_PD -
CHARACTER_ENCODING_PD
public static final org.apache.nifi.components.PropertyDescriptor CHARACTER_ENCODING_PD -
ADJUST_IMMEDIATELY
public static final org.apache.nifi.components.PropertyDescriptor ADJUST_IMMEDIATELY -
PROPERTY_DESCRIPTORS
-
REL_SUCCESS
public static final org.apache.nifi.processor.Relationship REL_SUCCESS -
REL_FAILURE
public static final org.apache.nifi.processor.Relationship REL_FAILURE -
RELATIONSHIPS
-
countLines
private volatile boolean countLines -
countLinesNonEmpty
private volatile boolean countLinesNonEmpty -
countWords
private volatile boolean countWords -
countCharacters
private volatile boolean countCharacters -
splitWordsOnSymbols
private volatile boolean splitWordsOnSymbols -
adjustImmediately
private volatile boolean adjustImmediately -
characterEncoding
-
-
Constructor Details
-
CountText
public CountText()
-
-
Method Details
-
getStandardCharsetNames
-
getRelationships
- Specified by:
getRelationshipsin interfaceorg.apache.nifi.processor.Processor- Overrides:
getRelationshipsin classorg.apache.nifi.processor.AbstractSessionFactoryProcessor
-
onSchedule
@OnScheduled public void onSchedule(org.apache.nifi.processor.ProcessContext context) -
onTrigger
public void onTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession processSession) throws org.apache.nifi.processor.exception.ProcessException Will count text attributes of the incoming stream.- Specified by:
onTriggerin classorg.apache.nifi.processor.AbstractProcessor- Throws:
org.apache.nifi.processor.exception.ProcessException
-
generateMetricsMessage
private String generateMetricsMessage(int lineCount, int lineNonEmptyCount, int wordCount, int characterCount) -
countWordsInLine
- Throws:
IOException
-
getSupportedPropertyDescriptors
- Overrides:
getSupportedPropertyDescriptorsin classorg.apache.nifi.components.AbstractConfigurableComponent
-