Class SplitJson
java.lang.Object
org.apache.nifi.components.AbstractConfigurableComponent
org.apache.nifi.processor.AbstractSessionFactoryProcessor
org.apache.nifi.processor.AbstractProcessor
org.apache.nifi.processors.standard.AbstractJsonPathProcessor
org.apache.nifi.processors.standard.SplitJson
- All Implemented Interfaces:
org.apache.nifi.components.ConfigurableComponent,org.apache.nifi.processor.Processor
@SideEffectFree
@SupportsBatching
@Tags({"json","split","jsonpath"})
@InputRequirement(INPUT_REQUIRED)
@CapabilityDescription("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")
@SystemResourceConsideration(resource=MEMORY,
description="The entirety of the FlowFile\'s content (as a JsonNode object) is read into memory, in addition to all of the generated FlowFiles representing the split JSON. If many splits are generated due to the size of the JSON, or how the JSON is configured to be split, a two-phase approach may be necessary to avoid excessive use of memory.")
public class SplitJson
extends AbstractJsonPathProcessor
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.nifi.processors.standard.AbstractJsonPathProcessor
AbstractJsonPathProcessor.JsonPathValidator -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.apache.nifi.components.PropertyDescriptorprivate final AtomicReference<com.jayway.jsonpath.JsonPath> private com.jayway.jsonpath.Configurationprivate Stringprivate 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> Fields inherited from class org.apache.nifi.processors.standard.AbstractJsonPathProcessor
EMPTY_STRING_OPTION, MAX_STRING_LENGTH, NULL_REPRESENTATION_MAP, NULL_STRING_OPTION, NULL_VALUE_DEFAULT_REPRESENTATION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Collection<org.apache.nifi.components.ValidationResult> customValidate(org.apache.nifi.components.ValidationContext validationContext) Set<org.apache.nifi.processor.Relationship> protected List<org.apache.nifi.components.PropertyDescriptor> voidonPropertyModified(org.apache.nifi.components.PropertyDescriptor descriptor, String oldValue, String newValue) voidonScheduled(org.apache.nifi.processor.ProcessContext processContext) voidonTrigger(org.apache.nifi.processor.ProcessContext processContext, org.apache.nifi.processor.ProcessSession processSession) Methods inherited from class org.apache.nifi.processors.standard.AbstractJsonPathProcessor
createConfiguration, getResultRepresentation, isJsonScalar, validateAndEstablishJsonContextMethods 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, 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, migrateProperties, migrateRelationships
-
Field Details
-
ARRAY_JSON_PATH_EXPRESSION
public static final org.apache.nifi.components.PropertyDescriptor ARRAY_JSON_PATH_EXPRESSION -
PROPERTY_DESCRIPTORS
-
REL_ORIGINAL
public static final org.apache.nifi.processor.Relationship REL_ORIGINAL -
REL_SPLIT
public static final org.apache.nifi.processor.Relationship REL_SPLIT -
REL_FAILURE
public static final org.apache.nifi.processor.Relationship REL_FAILURE -
RELATIONSHIPS
-
JSON_PATH_REF
-
nullDefaultValue
-
jsonPathConfiguration
private volatile com.jayway.jsonpath.Configuration jsonPathConfiguration
-
-
Constructor Details
-
SplitJson
public SplitJson()
-
-
Method Details
-
getRelationships
- Specified by:
getRelationshipsin interfaceorg.apache.nifi.processor.Processor- Overrides:
getRelationshipsin classorg.apache.nifi.processor.AbstractSessionFactoryProcessor
-
getSupportedPropertyDescriptors
- Overrides:
getSupportedPropertyDescriptorsin classorg.apache.nifi.components.AbstractConfigurableComponent
-
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
-
customValidate
protected Collection<org.apache.nifi.components.ValidationResult> customValidate(org.apache.nifi.components.ValidationContext validationContext) - Overrides:
customValidatein classorg.apache.nifi.components.AbstractConfigurableComponent
-
onScheduled
@OnScheduled public void onScheduled(org.apache.nifi.processor.ProcessContext processContext) -
onTrigger
public void onTrigger(org.apache.nifi.processor.ProcessContext processContext, org.apache.nifi.processor.ProcessSession processSession) - Specified by:
onTriggerin classorg.apache.nifi.processor.AbstractProcessor
-