Class JsonContentValidator

java.lang.Object
org.apache.nifi.components.AbstractConfigurableComponent
org.apache.nifi.controller.AbstractControllerService
org.qubership.nifi.service.validation.JsonContentValidator
All Implemented Interfaces:
org.apache.nifi.components.ConfigurableComponent, org.apache.nifi.controller.ControllerService, ContentValidator

@CapabilityDescription("Provides validate method to check the JSON against a given schema.") public class JsonContentValidator extends org.apache.nifi.controller.AbstractControllerService implements ContentValidator
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final org.apache.nifi.components.PropertyDescriptor
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected List<org.apache.nifi.components.PropertyDescriptor>
    Gets a list of supported properties.
    void
    onConfigured(org.apache.nifi.controller.ConfigurationContext context)
    Configures controller service before use.
    boolean
    validate(String value, Map<String,String> attributes)
    Validates JSON against JSON Schema.

    Methods inherited from class org.apache.nifi.controller.AbstractControllerService

    abstractClearConfigContext, abstractStoreConfigContext, disabled, enabled, getConfigurationContext, getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, getProperty, getStateManager, init, initialize, isEnabled

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

    customValidate, equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, onPropertyModified, toString, 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

    getIdentifier, getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validate

    Methods inherited from interface org.apache.nifi.controller.ControllerService

    initialize, isStateful
  • Field Details

    • SCHEMA

      public static final org.apache.nifi.components.PropertyDescriptor SCHEMA
  • Constructor Details

    • JsonContentValidator

      public JsonContentValidator()
  • Method Details

    • getSupportedPropertyDescriptors

      protected List<org.apache.nifi.components.PropertyDescriptor> getSupportedPropertyDescriptors()
      Gets a list of supported properties.
      Overrides:
      getSupportedPropertyDescriptors in class org.apache.nifi.components.AbstractConfigurableComponent
      Returns:
      list of supported property descriptors
    • onConfigured

      @OnEnabled public void onConfigured(org.apache.nifi.controller.ConfigurationContext context) throws org.apache.nifi.reporting.InitializationException
      Configures controller service before use. This method is invoked when the controller service is enabled.
      Parameters:
      context - configuration context to use
      Throws:
      org.apache.nifi.reporting.InitializationException
    • validate

      public boolean validate(String value, Map<String,String> attributes) throws IOException
      Validates JSON against JSON Schema.
      Specified by:
      validate in interface ContentValidator
      Parameters:
      value - input JSON
      attributes - map with FlowFile attributes
      Returns:
      true, if valid. false, otherwise.
      Throws:
      IOException