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 Classes
    Modifier and Type
    Class
    Description
    (package private) static enum 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static String
     
    static final org.apache.nifi.components.PropertyDescriptor
     
    private static final com.fasterxml.jackson.databind.ObjectMapper
     
    static final org.apache.nifi.components.PropertyDescriptor
     
    private static final List<org.apache.nifi.components.PropertyDescriptor>
     
    static final org.apache.nifi.processor.Relationship
     
    static final org.apache.nifi.processor.Relationship
     
    private static final Set<org.apache.nifi.processor.Relationship>
     
    static final org.apache.nifi.components.PropertyDescriptor
     
    static final org.apache.nifi.components.PropertyDescriptor
     
    static final org.apache.nifi.components.PropertyDescriptor
     
    private com.github.benmanes.caffeine.cache.Cache<String,com.schibsted.spt.data.jslt.Expression>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected Collection<org.apache.nifi.components.ValidationResult>
    customValidate(org.apache.nifi.components.ValidationContext validationContext)
     
    private com.fasterxml.jackson.databind.JsonNode
    getJsonNode(com.fasterxml.jackson.core.JsonParser jsonParser)
     
    private com.schibsted.spt.data.jslt.Expression
    getJstlExpression(String transform, String jsltFilter)
     
    protected com.fasterxml.jackson.databind.JsonNode
    getNextJsonNode(JSLTTransformJSON.TransformationStrategy transformationStrategy, com.fasterxml.jackson.core.JsonParser jsonParser)
     
    Set<org.apache.nifi.processor.Relationship>
     
    final List<org.apache.nifi.components.PropertyDescriptor>
     
    void
    onScheduled(org.apache.nifi.processor.ProcessContext context)
     
    void
     
    void
    onTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session)
     
    private com.fasterxml.jackson.databind.JsonNode
     
    private String
    readTransform(org.apache.nifi.components.PropertyValue propertyValue)
     
    private String
    readTransform(org.apache.nifi.components.PropertyValue propertyValue, org.apache.nifi.flowfile.FlowFile flowFile)
     
    private org.apache.nifi.components.ValidationResult
    validateJSLT(org.apache.nifi.components.PropertyDescriptor property, org.apache.nifi.components.PropertyValue value)
     

    Methods inherited from class org.apache.nifi.processor.AbstractProcessor

    onTrigger

    Methods inherited from class org.apache.nifi.processor.AbstractSessionFactoryProcessor

    getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, init, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrue

    Methods inherited from class org.apache.nifi.components.AbstractConfigurableComponent

    equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, onPropertyModified, validate

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.apache.nifi.components.ConfigurableComponent

    getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validate

    Methods inherited from interface org.apache.nifi.processor.Processor

    isStateful, migrateProperties, migrateRelationships
  • Field Details

    • JSLT_FILTER_DEFAULT

      public static String 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

      private static final List<org.apache.nifi.components.PropertyDescriptor> PROPERTY_DESCRIPTORS
    • RELATIONSHIPS

      private static final Set<org.apache.nifi.processor.Relationship> 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

      public Set<org.apache.nifi.processor.Relationship> getRelationships()
      Specified by:
      getRelationships in interface org.apache.nifi.processor.Processor
      Overrides:
      getRelationships in class org.apache.nifi.processor.AbstractSessionFactoryProcessor
    • getSupportedPropertyDescriptors

      public final List<org.apache.nifi.components.PropertyDescriptor> getSupportedPropertyDescriptors()
      Overrides:
      getSupportedPropertyDescriptors in class org.apache.nifi.components.AbstractConfigurableComponent
    • customValidate

      protected Collection<org.apache.nifi.components.ValidationResult> customValidate(org.apache.nifi.components.ValidationContext validationContext)
      Overrides:
      customValidate in class org.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:
      onTrigger in class org.apache.nifi.processor.AbstractProcessor
      Throws:
      org.apache.nifi.processor.exception.ProcessException
    • onStopped

      @OnStopped @OnShutdown public void onStopped()
    • getJstlExpression

      private com.schibsted.spt.data.jslt.Expression getJstlExpression(String transform, String jsltFilter)
    • readJson

      private com.fasterxml.jackson.databind.JsonNode readJson(InputStream in) throws IOException
      Throws:
      IOException
    • readTransform

      private String readTransform(org.apache.nifi.components.PropertyValue propertyValue, org.apache.nifi.flowfile.FlowFile flowFile)
    • readTransform

      private String readTransform(org.apache.nifi.components.PropertyValue propertyValue)
    • 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