Class SplitText
- All Implemented Interfaces:
org.apache.nifi.components.ConfigurableComponent,org.apache.nifi.processor.Processor
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classContainer for hosting meta-information pertaining to the split so it can be used later to createFlowFilerepresenting the split. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final org.apache.nifi.components.PropertyDescriptorstatic final Stringstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorprivate intprivate Stringstatic final org.apache.nifi.components.PropertyDescriptorprivate intprivate longprivate static final List<org.apache.nifi.components.PropertyDescriptor> static final org.apache.nifi.processor.Relationshipstatic 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 booleanstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate SplitText.SplitInfocomputeHeader(TextLineDemarcator demarcator, long startOffset, long splitMaxLineCount, byte[] startsWithFilter, SplitText.SplitInfo previousSplitInfo) Will generateSplitText.SplitInfofor the next fragment that represents the header of the future split.private org.apache.nifi.flowfile.FlowFileconcatenateContents(org.apache.nifi.flowfile.FlowFile sourceFlowFile, org.apache.nifi.processor.ProcessSession session, org.apache.nifi.flowfile.FlowFile... flowFiles) Will concatenate the contents of the provided array ofFlowFiles into a singleFlowFile.protected Collection<org.apache.nifi.components.ValidationResult> customValidate(org.apache.nifi.components.ValidationContext validationContext) private List<org.apache.nifi.flowfile.FlowFile> generateSplitFlowFiles(String fragmentId, org.apache.nifi.flowfile.FlowFile sourceFlowFile, SplitText.SplitInfo splitInfo, List<SplitText.SplitInfo> computedSplitsInfo, org.apache.nifi.processor.ProcessSession processSession) Generates the list ofFlowFiles representing splits.Set<org.apache.nifi.processor.Relationship> protected List<org.apache.nifi.components.PropertyDescriptor> private SplitText.SplitInfonextSplit(TextLineDemarcator demarcator, long startOffset, long splitMaxLineCount, SplitText.SplitInfo remainderSplitInfo, long startingLength) Will generateSplitText.SplitInfofor the next split.voidonSchedule(org.apache.nifi.processor.ProcessContext context) voidonTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession processSession) Will split the incoming stream releasing all splits as FlowFile at once.private org.apache.nifi.flowfile.FlowFileupdateAttributes(org.apache.nifi.processor.ProcessSession processSession, org.apache.nifi.flowfile.FlowFile splitFlowFile, long splitLineCount, long splitFlowFileSize, String splitId, int splitIndex, String origFileName) 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
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
-
SPLIT_LINE_COUNT
- See Also:
-
FRAGMENT_SIZE
-
FRAGMENT_ID
-
FRAGMENT_INDEX
-
FRAGMENT_COUNT
-
SEGMENT_ORIGINAL_FILENAME
-
LINE_SPLIT_COUNT
public static final org.apache.nifi.components.PropertyDescriptor LINE_SPLIT_COUNT -
FRAGMENT_MAX_SIZE
public static final org.apache.nifi.components.PropertyDescriptor FRAGMENT_MAX_SIZE -
HEADER_LINE_COUNT
public static final org.apache.nifi.components.PropertyDescriptor HEADER_LINE_COUNT -
HEADER_MARKER
public static final org.apache.nifi.components.PropertyDescriptor HEADER_MARKER -
REMOVE_TRAILING_NEWLINES
public static final org.apache.nifi.components.PropertyDescriptor REMOVE_TRAILING_NEWLINES -
PROPERTY_DESCRIPTORS
-
REL_ORIGINAL
public static final org.apache.nifi.processor.Relationship REL_ORIGINAL -
REL_SPLITS
public static final org.apache.nifi.processor.Relationship REL_SPLITS -
REL_FAILURE
public static final org.apache.nifi.processor.Relationship REL_FAILURE -
RELATIONSHIPS
-
removeTrailingNewLines
private volatile boolean removeTrailingNewLines -
maxSplitSize
private volatile long maxSplitSize -
lineCount
private volatile int lineCount -
headerLineCount
private volatile int headerLineCount -
headerMarker
-
-
Constructor Details
-
SplitText
public SplitText()
-
-
Method Details
-
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 split the incoming stream releasing all splits as FlowFile at once.- Specified by:
onTriggerin classorg.apache.nifi.processor.AbstractProcessor- Throws:
org.apache.nifi.processor.exception.ProcessException
-
customValidate
protected Collection<org.apache.nifi.components.ValidationResult> customValidate(org.apache.nifi.components.ValidationContext validationContext) - Overrides:
customValidatein classorg.apache.nifi.components.AbstractConfigurableComponent
-
getSupportedPropertyDescriptors
- Overrides:
getSupportedPropertyDescriptorsin classorg.apache.nifi.components.AbstractConfigurableComponent
-
generateSplitFlowFiles
private List<org.apache.nifi.flowfile.FlowFile> generateSplitFlowFiles(String fragmentId, org.apache.nifi.flowfile.FlowFile sourceFlowFile, SplitText.SplitInfo splitInfo, List<SplitText.SplitInfo> computedSplitsInfo, org.apache.nifi.processor.ProcessSession processSession) Generates the list ofFlowFiles representing splits. IfSplitText.SplitInfoprovided as an argument to this operation is not null it signifies the header information and its contents will be included in each and every computed split. -
concatenateContents
private org.apache.nifi.flowfile.FlowFile concatenateContents(org.apache.nifi.flowfile.FlowFile sourceFlowFile, org.apache.nifi.processor.ProcessSession session, org.apache.nifi.flowfile.FlowFile... flowFiles) Will concatenate the contents of the provided array ofFlowFiles into a singleFlowFile. While this operation is as general as it is described in the previous sentence, in the context of this processor there can only be twoFlowFiles with the firstFlowFilerepresenting the header content of the split and the secondFlowFilerepresents the split itself. -
updateAttributes
-
computeHeader
private SplitText.SplitInfo computeHeader(TextLineDemarcator demarcator, long startOffset, long splitMaxLineCount, byte[] startsWithFilter, SplitText.SplitInfo previousSplitInfo) throws IOException Will generateSplitText.SplitInfofor the next fragment that represents the header of the future split.If split size is controlled by the amount of lines in the split then the resulting
SplitText.SplitInfoline count will always be invalid input: '<'= 'splitMaxLineCount'. It can only be less IF it reaches the EOF. If split size is controlled by themaxSplitSize, then the resultingSplitText.SplitInfoline count will vary but the length of the split will never be >maxSplitSizeandIllegalStateExceptionwill be thrown. This method also allows one to provide 'startsWithFilter' to allow headers to be determined via such filter (seeHEADER_MARKER.- Throws:
IOException
-
nextSplit
private SplitText.SplitInfo nextSplit(TextLineDemarcator demarcator, long startOffset, long splitMaxLineCount, SplitText.SplitInfo remainderSplitInfo, long startingLength) throws IOException Will generateSplitText.SplitInfofor the next split.If split size is controlled by the amount of lines in the split then the resulting
SplitText.SplitInfoline count will always be invalid input: '<'= 'splitMaxLineCount'. If split size is controlled by themaxSplitSize, then the resultingSplitText.SplitInfoline count will vary but the length of the split will never be >maxSplitSize.- Throws:
IOException
-