Class ExtractText

java.lang.Object
org.apache.nifi.components.AbstractConfigurableComponent
org.apache.nifi.processor.AbstractSessionFactoryProcessor
org.apache.nifi.processor.AbstractProcessor
org.apache.nifi.processors.standard.ExtractText
All Implemented Interfaces:
org.apache.nifi.components.ConfigurableComponent, org.apache.nifi.processor.Processor

@SideEffectFree @SupportsBatching @InputRequirement(INPUT_REQUIRED) @Tags({"evaluate","extract","Text","Regular Expression","regex"}) @CapabilityDescription("Evaluates one or more Regular Expressions against the content of a FlowFile. The results of those Regular Expressions are assigned to FlowFile Attributes. Regular Expressions are entered by adding user-defined properties; the name of the property maps to the Attribute Name into which the result will be placed. The attributes are generated differently based on the enabling of named capture groups. If named capture groups are not enabled: The first capture group, if any found, will be placed into that attribute name.But all capture groups, including the matching string sequence itself will also be provided at that attribute name with an index value provided, with the exception of a capturing group that is optional and does not match - for example, given the attribute name \"regex\" and expression \"abc(def)?(g)\" we would add an attribute \"regex.1\" with a value of \"def\" if the \"def\" matched. If the \"def\" did not match, no attribute named \"regex.1\" would be added but an attribute named \"regex.2\" with a value of \"g\" will be added regardless.If named capture groups are enabled: Each named capture group, if found will be placed into the attributes name with the name provided. If enabled the matching string sequence itself will be placed into the attribute name. If multiple matches are enabled, and index will be applied after the first set of matches. The exception is a capturing group that is optional and does not match For example, given the attribute name \"regex\" and expression \"abc(?<NAMED>def)?(?<NAMED-TWO>g)\" we would add an attribute \"regex.NAMED\" with the value of \"def\" if the \"def\" matched. We would add an attribute \"regex.NAMED-TWO\" with the value of \"g\" if the \"g\" matched regardless. The value of the property must be a valid Regular Expressions with one or more capturing groups. If named capture groups are enabled, all capture groups must be named. If they are not, then the processor configuration will fail validation. If the Regular Expression matches more than once, only the first match will be used unless the property enabling repeating capture group is set to true. If any provided Regular Expression matches, the FlowFile(s) will be routed to \'matched\'. If no provided Regular Expression matches, the FlowFile will be routed to \'unmatched\' and no attributes will be applied to the FlowFile.") @DynamicProperty(name="A FlowFile attribute", value="A Regular Expression with one or more capturing group", description="The first capture group, if any found, will be placed into that attribute name.But all capture groups, including the matching string sequence itself will also be provided at that attribute name with an index value provided.") public class ExtractText extends org.apache.nifi.processor.AbstractProcessor
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final BlockingQueue<byte[]>
     
    static final org.apache.nifi.components.PropertyDescriptor
     
    static final org.apache.nifi.components.PropertyDescriptor
     
    static final org.apache.nifi.components.PropertyDescriptor
     
    static final org.apache.nifi.components.PropertyDescriptor
     
     
    static final org.apache.nifi.components.PropertyDescriptor
     
    static final org.apache.nifi.components.PropertyDescriptor
     
    static final org.apache.nifi.components.PropertyDescriptor
     
    static final org.apache.nifi.components.PropertyDescriptor
     
    static final org.apache.nifi.components.PropertyDescriptor
     
    static final org.apache.nifi.components.PropertyDescriptor
     
    static final org.apache.nifi.components.PropertyDescriptor
     
    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
     
  • 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)
     
    (package private) int
    getCompileFlags(org.apache.nifi.processor.ProcessContext context)
     
    Set<org.apache.nifi.processor.Relationship>
     
    protected org.apache.nifi.components.PropertyDescriptor
     
    protected List<org.apache.nifi.components.PropertyDescriptor>
     
    void
     
    final void
    onScheduled(org.apache.nifi.processor.ProcessContext context)
     
    void
     
    void
    onTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session)
     

    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, 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, migrateRelationships
  • Field Details

    • CHARACTER_SET

      public static final org.apache.nifi.components.PropertyDescriptor CHARACTER_SET
    • MAX_BUFFER_SIZE

      public static final org.apache.nifi.components.PropertyDescriptor MAX_BUFFER_SIZE
    • MAX_CAPTURE_GROUP_LENGTH

      public static final org.apache.nifi.components.PropertyDescriptor MAX_CAPTURE_GROUP_LENGTH
    • CANON_EQ

      public static final org.apache.nifi.components.PropertyDescriptor CANON_EQ
    • CASE_INSENSITIVE

      public static final org.apache.nifi.components.PropertyDescriptor CASE_INSENSITIVE
    • COMMENTS

      public static final org.apache.nifi.components.PropertyDescriptor COMMENTS
    • DOTALL

      public static final org.apache.nifi.components.PropertyDescriptor DOTALL
    • LITERAL

      public static final org.apache.nifi.components.PropertyDescriptor LITERAL
    • MULTILINE

      public static final org.apache.nifi.components.PropertyDescriptor MULTILINE
    • UNICODE_CASE

      public static final org.apache.nifi.components.PropertyDescriptor UNICODE_CASE
    • UNICODE_CHARACTER_CLASS

      public static final org.apache.nifi.components.PropertyDescriptor UNICODE_CHARACTER_CLASS
    • UNIX_LINES

      public static final org.apache.nifi.components.PropertyDescriptor UNIX_LINES
    • INCLUDE_CAPTURE_GROUP_ZERO

      public static final org.apache.nifi.components.PropertyDescriptor INCLUDE_CAPTURE_GROUP_ZERO
    • ENABLE_REPEATING_CAPTURE_GROUP

      public static final org.apache.nifi.components.PropertyDescriptor ENABLE_REPEATING_CAPTURE_GROUP
    • ENABLE_NAMED_GROUPS

      public static final org.apache.nifi.components.PropertyDescriptor ENABLE_NAMED_GROUPS
    • PROPERTY_DESCRIPTORS

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

      public static final org.apache.nifi.processor.Relationship REL_MATCH
    • REL_NO_MATCH

      public static final org.apache.nifi.processor.Relationship REL_NO_MATCH
    • RELATIONSHIPS

      private static final Set<org.apache.nifi.processor.Relationship> RELATIONSHIPS
    • bufferQueue

      private final BlockingQueue<byte[]> bufferQueue
    • compiledPattersMapRef

      private final AtomicReference<Map<String,Pattern>> compiledPattersMapRef
  • Constructor Details

    • ExtractText

      public ExtractText()
  • 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

      protected List<org.apache.nifi.components.PropertyDescriptor> getSupportedPropertyDescriptors()
      Overrides:
      getSupportedPropertyDescriptors in class org.apache.nifi.components.AbstractConfigurableComponent
    • migrateProperties

      public void migrateProperties(PropertyConfiguration config)
    • getSupportedDynamicPropertyDescriptor

      protected org.apache.nifi.components.PropertyDescriptor getSupportedDynamicPropertyDescriptor(String propertyDescriptorName)
      Overrides:
      getSupportedDynamicPropertyDescriptor 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
    • onScheduled

      @OnScheduled public final void onScheduled(org.apache.nifi.processor.ProcessContext context) throws IOException
      Throws:
      IOException
    • onStopped

      @OnStopped public void onStopped()
    • onTrigger

      public void onTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session)
      Specified by:
      onTrigger in class org.apache.nifi.processor.AbstractProcessor
    • getCompileFlags

      int getCompileFlags(org.apache.nifi.processor.ProcessContext context)