@EventDriven @SideEffectFree @SupportsBatching @Tags(value={"content","split","binary"}) @InputRequirement(value=INPUT_REQUIRED) @CapabilityDescription(value="Splits incoming FlowFiles by a specified byte sequence") @WritesAttribute(attribute="fragment.identifier",description="All split FlowFiles produced from the same parent FlowFile will have the same randomly generated UUID added for this attribute") @WritesAttribute(attribute="fragment.index",description="A one-up number that indicates the ordering of the split FlowFiles that were created from a single parent FlowFile") @WritesAttribute(attribute="fragment.count",description="The number of split FlowFiles generated from the parent FlowFile") @WritesAttribute(attribute="segment.original.filename ",description="The filename of the parent FlowFile") @SeeAlso(value=MergeContent.class) @SystemResourceConsideration(resource=MEMORY, description="The FlowFile with its attributes is stored in memory, not the content of the FlowFile. If many splits are generated due to the size of the content, or how the content is configured to be split, a two-phase approach may be necessary to avoid excessive use of memory.") public class SplitContent extends AbstractProcessor
Modifier and Type | Class and Description |
---|---|
(package private) static class |
SplitContent.HexStringPropertyValidator |
Modifier and Type | Field and Description |
---|---|
static PropertyDescriptor |
BYTE_SEQUENCE |
static PropertyDescriptor |
BYTE_SEQUENCE_LOCATION |
private AtomicReference<byte[]> |
byteSequence |
static PropertyDescriptor |
FORMAT |
static String |
FRAGMENT_COUNT |
static String |
FRAGMENT_ID |
static String |
FRAGMENT_INDEX |
(package private) static AllowableValue |
HEX_FORMAT |
static PropertyDescriptor |
KEEP_SEQUENCE |
(package private) static AllowableValue |
LEADING_POSITION |
private List<PropertyDescriptor> |
properties |
static Relationship |
REL_ORIGINAL |
static Relationship |
REL_SPLITS |
private Set<Relationship> |
relationships |
static String |
SEGMENT_ORIGINAL_FILENAME |
(package private) static AllowableValue |
TRAILING_POSITION |
(package private) static AllowableValue |
UTF8_FORMAT |
Constructor and Description |
---|
SplitContent() |
Modifier and Type | Method and Description |
---|---|
protected Collection<ValidationResult> |
customValidate(ValidationContext validationContext) |
private String |
finishFragmentAttributes(ProcessSession session,
FlowFile source,
List<FlowFile> splits)
Apply split index, count and other attributes.
|
Set<Relationship> |
getRelationships() |
protected List<PropertyDescriptor> |
getSupportedPropertyDescriptors() |
protected void |
init(ProcessorInitializationContext context) |
void |
initializeByteSequence(ProcessContext context) |
void |
onTrigger(ProcessContext context,
ProcessSession session) |
onTrigger
getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrue
equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, onPropertyModified, validate
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validate
public static final String FRAGMENT_ID
public static final String FRAGMENT_INDEX
public static final String FRAGMENT_COUNT
public static final String SEGMENT_ORIGINAL_FILENAME
static final AllowableValue HEX_FORMAT
static final AllowableValue UTF8_FORMAT
static final AllowableValue TRAILING_POSITION
static final AllowableValue LEADING_POSITION
public static final PropertyDescriptor FORMAT
public static final PropertyDescriptor BYTE_SEQUENCE
public static final PropertyDescriptor KEEP_SEQUENCE
public static final PropertyDescriptor BYTE_SEQUENCE_LOCATION
public static final Relationship REL_SPLITS
public static final Relationship REL_ORIGINAL
private Set<Relationship> relationships
private List<PropertyDescriptor> properties
private final AtomicReference<byte[]> byteSequence
protected void init(ProcessorInitializationContext context)
init
in class AbstractSessionFactoryProcessor
public Set<Relationship> getRelationships()
getRelationships
in interface Processor
getRelationships
in class AbstractSessionFactoryProcessor
protected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors
in class AbstractConfigurableComponent
protected Collection<ValidationResult> customValidate(ValidationContext validationContext)
customValidate
in class AbstractConfigurableComponent
@OnScheduled public void initializeByteSequence(ProcessContext context) throws org.apache.commons.codec.DecoderException
org.apache.commons.codec.DecoderException
public void onTrigger(ProcessContext context, ProcessSession session)
onTrigger
in class AbstractProcessor
private String finishFragmentAttributes(ProcessSession session, FlowFile source, List<FlowFile> splits)
session
- sessionsource
- sourcesplits
- splitsCopyright © 2021 Apache NiFi Project. All rights reserved.