@EventDriven @SideEffectFree @SupportsBatching @Tags(value={"json","split","jsonpath"}) @InputRequirement(value=INPUT_REQUIRED) @CapabilityDescription(value="Splits a JSON File into multiple, separate FlowFiles for an array element specified by a JsonPath expression. Each generated FlowFile is comprised of an element of the specified array and transferred to relationship \'split,\' with the original file transferred to the \'original\' relationship. If the specified JsonPath is not found or does not evaluate to an array element, the original file is routed to \'failure\' and no files are generated.") @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") public class SplitJson extends AbstractJsonPathProcessor
Modifier and Type | Field and Description |
---|---|
static PropertyDescriptor |
ARRAY_JSON_PATH_EXPRESSION |
static Relationship |
REL_FAILURE |
static Relationship |
REL_ORIGINAL |
static Relationship |
REL_SPLIT |
NULL_VALUE_DEFAULT_REPRESENTATION
Constructor and Description |
---|
SplitJson() |
Modifier and Type | Method and Description |
---|---|
protected java.util.Collection<ValidationResult> |
customValidate(ValidationContext validationContext)
Allows subclasses to perform their own validation on the already set
properties.
|
java.util.Set<Relationship> |
getRelationships() |
protected java.util.List<PropertyDescriptor> |
getSupportedPropertyDescriptors()
Allows subclasses to register which property descriptor objects are
supported.
|
protected void |
init(ProcessorInitializationContext context)
Provides subclasses the ability to perform initialization logic
|
void |
onPropertyModified(PropertyDescriptor descriptor,
java.lang.String oldValue,
java.lang.String newValue)
Hook method allowing subclasses to eagerly react to a configuration
change for the given property descriptor.
|
void |
onScheduled(ProcessContext processContext) |
void |
onTrigger(ProcessContext processContext,
ProcessSession processSession) |
onTrigger
getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrue
equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, validate
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getPropertyDescriptor, getPropertyDescriptors, validate
public static final PropertyDescriptor ARRAY_JSON_PATH_EXPRESSION
public static final Relationship REL_ORIGINAL
public static final Relationship REL_SPLIT
public static final Relationship REL_FAILURE
protected void init(ProcessorInitializationContext context)
AbstractSessionFactoryProcessor
init
in class AbstractSessionFactoryProcessor
context
- in which to perform initializationpublic java.util.Set<Relationship> getRelationships()
getRelationships
in interface Processor
getRelationships
in class AbstractSessionFactoryProcessor
protected java.util.List<PropertyDescriptor> getSupportedPropertyDescriptors()
AbstractConfigurableComponent
getSupportedPropertyDescriptors
in class AbstractConfigurableComponent
public void onPropertyModified(PropertyDescriptor descriptor, java.lang.String oldValue, java.lang.String newValue)
AbstractConfigurableComponent
onPropertyModified
in interface ConfigurableComponent
onPropertyModified
in class AbstractConfigurableComponent
descriptor
- of the modified propertyoldValue
- non-null property value (previous)newValue
- the new property value or if null indicates the property
was removedprotected java.util.Collection<ValidationResult> customValidate(ValidationContext validationContext)
AbstractConfigurableComponent
customValidate
in class AbstractConfigurableComponent
validationContext
- provides a mechanism for obtaining externally
managed values, such as property values and supplies convenience methods
for operating on those values@OnScheduled public void onScheduled(ProcessContext processContext)
public void onTrigger(ProcessContext processContext, ProcessSession processSession)
onTrigger
in class AbstractProcessor