Package org.apache.nifi.processors.jslt
Class JSLTTransformJSON
java.lang.Object
org.apache.nifi.components.AbstractConfigurableComponent
org.apache.nifi.processor.AbstractSessionFactoryProcessor
org.apache.nifi.processor.AbstractProcessor
org.apache.nifi.processors.jslt.JSLTTransformJSON
- All Implemented Interfaces:
org.apache.nifi.components.ConfigurableComponent,org.apache.nifi.processor.Processor
@SideEffectFree
@SupportsBatching
@Tags({"json","jslt","transform"})
@InputRequirement(INPUT_REQUIRED)
@SystemResourceConsideration(resource=MEMORY)
@WritesAttribute(attribute="mime.type",
description="Always set to application/json")
@CapabilityDescription("Applies a JSLT transformation to the FlowFile JSON payload. A new FlowFile is created with transformed content and is routed to the \'success\' relationship. If the JSLT transform fails, the original FlowFile is routed to the \'failure\' relationship.")
public class JSLTTransformJSON
extends org.apache.nifi.processor.AbstractProcessor
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static enum -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic Stringstatic final org.apache.nifi.components.PropertyDescriptorprivate static final com.fasterxml.jackson.databind.ObjectMapperstatic final org.apache.nifi.components.PropertyDescriptorprivate 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.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorstatic final org.apache.nifi.components.PropertyDescriptorprivate com.github.benmanes.caffeine.cache.Cache<String, com.schibsted.spt.data.jslt.Expression> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Collection<org.apache.nifi.components.ValidationResult> customValidate(org.apache.nifi.components.ValidationContext validationContext) private com.fasterxml.jackson.databind.JsonNodegetJsonNode(com.fasterxml.jackson.core.JsonParser jsonParser) private com.schibsted.spt.data.jslt.ExpressiongetJstlExpression(String transform, String jsltFilter) protected com.fasterxml.jackson.databind.JsonNodegetNextJsonNode(JSLTTransformJSON.TransformationStrategy transformationStrategy, com.fasterxml.jackson.core.JsonParser jsonParser) Set<org.apache.nifi.processor.Relationship> final List<org.apache.nifi.components.PropertyDescriptor> voidonScheduled(org.apache.nifi.processor.ProcessContext context) voidvoidonTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session) private com.fasterxml.jackson.databind.JsonNodereadJson(InputStream in) private StringreadTransform(org.apache.nifi.components.PropertyValue propertyValue) private StringreadTransform(org.apache.nifi.components.PropertyValue propertyValue, org.apache.nifi.flowfile.FlowFile flowFile) private org.apache.nifi.components.ValidationResultvalidateJSLT(org.apache.nifi.components.PropertyDescriptor property, org.apache.nifi.components.PropertyValue value) 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
-
JSLT_FILTER_DEFAULT
-
JSLT_TRANSFORM
public static final org.apache.nifi.components.PropertyDescriptor JSLT_TRANSFORM -
TRANSFORMATION_STRATEGY
public static final org.apache.nifi.components.PropertyDescriptor TRANSFORMATION_STRATEGY -
PRETTY_PRINT
public static final org.apache.nifi.components.PropertyDescriptor PRETTY_PRINT -
TRANSFORM_CACHE_SIZE
public static final org.apache.nifi.components.PropertyDescriptor TRANSFORM_CACHE_SIZE -
RESULT_FILTER
public static final org.apache.nifi.components.PropertyDescriptor RESULT_FILTER -
REL_SUCCESS
public static final org.apache.nifi.processor.Relationship REL_SUCCESS -
REL_FAILURE
public static final org.apache.nifi.processor.Relationship REL_FAILURE -
PROPERTY_DESCRIPTORS
-
RELATIONSHIPS
-
JSON_OBJECT_MAPPER
private static final com.fasterxml.jackson.databind.ObjectMapper JSON_OBJECT_MAPPER -
transformCache
private com.github.benmanes.caffeine.cache.Cache<String,com.schibsted.spt.data.jslt.Expression> transformCache
-
-
Constructor Details
-
JSLTTransformJSON
public JSLTTransformJSON()
-
-
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
-
customValidate
protected Collection<org.apache.nifi.components.ValidationResult> customValidate(org.apache.nifi.components.ValidationContext validationContext) - Overrides:
customValidatein classorg.apache.nifi.components.AbstractConfigurableComponent
-
validateJSLT
private org.apache.nifi.components.ValidationResult validateJSLT(org.apache.nifi.components.PropertyDescriptor property, org.apache.nifi.components.PropertyValue value) -
onScheduled
@OnScheduled public void onScheduled(org.apache.nifi.processor.ProcessContext context) -
onTrigger
public void onTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session) throws org.apache.nifi.processor.exception.ProcessException - Specified by:
onTriggerin classorg.apache.nifi.processor.AbstractProcessor- Throws:
org.apache.nifi.processor.exception.ProcessException
-
onStopped
@OnStopped @OnShutdown public void onStopped() -
getJstlExpression
-
readJson
- Throws:
IOException
-
readTransform
private String readTransform(org.apache.nifi.components.PropertyValue propertyValue, org.apache.nifi.flowfile.FlowFile flowFile) -
readTransform
-
getNextJsonNode
protected com.fasterxml.jackson.databind.JsonNode getNextJsonNode(JSLTTransformJSON.TransformationStrategy transformationStrategy, com.fasterxml.jackson.core.JsonParser jsonParser) throws IOException - Throws:
IOException
-
getJsonNode
private com.fasterxml.jackson.databind.JsonNode getJsonNode(com.fasterxml.jackson.core.JsonParser jsonParser) throws IOException - Throws:
IOException
-