@EventDriven @SideEffectFree @SupportsBatching @InputRequirement(value=INPUT_REQUIRED) @Tags(value={"attributes","routing","text","regexp","regex","Regular Expression","Expression Language","csv","filter","logs","delimited"}) @CapabilityDescription(value="Routes textual data based on a set of user-defined rules. Each line in an incoming FlowFile is compared against the values specified by user-defined Properties. The mechanism by which the text is compared to these user-defined properties is defined by the \'Matching Strategy\'. The data is then routed according to these rules, routing each line of the text individually.") @DynamicProperty(name="Relationship Name", value="value to match against", description="Routes data that matches the value specified in the Dynamic Property Value to the Relationship specified in the Dynamic Property Key.") @DynamicRelationship(name="Name from Dynamic Property", description="FlowFiles that match the Dynamic Property\'s value") public class RouteText extends AbstractProcessor
Modifier and Type | Class and Description |
---|---|
private static class |
RouteText.Group |
Constructor and Description |
---|
RouteText() |
Modifier and Type | Method and Description |
---|---|
private void |
appendLine(ProcessSession session,
Map<Relationship,Map<RouteText.Group,FlowFile>> flowFileMap,
Relationship relationship,
FlowFile original,
String line,
Charset charset,
RouteText.Group group) |
protected Collection<ValidationResult> |
customValidate(ValidationContext validationContext) |
private RouteText.Group |
getGroup(String line,
Pattern groupPattern) |
Set<Relationship> |
getRelationships() |
protected PropertyDescriptor |
getSupportedDynamicPropertyDescriptor(String propertyDescriptorName) |
protected List<PropertyDescriptor> |
getSupportedPropertyDescriptors() |
protected void |
init(ProcessorInitializationContext context) |
protected static boolean |
lineMatches(String line,
Object comparison,
String matchingStrategy,
boolean ignoreCase,
FlowFile flowFile,
Map<String,String> variables) |
void |
onPropertyModified(PropertyDescriptor descriptor,
String oldValue,
String newValue) |
void |
onScheduled(ProcessContext context)
When this processor is scheduled, update the dynamic properties into the map
for quick access during each onTrigger call
|
void |
onTrigger(ProcessContext context,
ProcessSession session) |
onTrigger
getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrue
equals, getPropertyDescriptor, getPropertyDescriptors, hashCode, validate
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getPropertyDescriptor, getPropertyDescriptors, validate
public static final String ROUTE_ATTRIBUTE_KEY
public static final String GROUP_ATTRIBUTE_KEY
private static final String routeAllMatchValue
private static final String routeAnyMatchValue
private static final String routePropertyNameValue
private static final String startsWithValue
private static final String endsWithValue
private static final String containsValue
private static final String equalsValue
private static final String matchesRegularExpressionValue
private static final String containsRegularExpressionValue
private static final String satisfiesExpression
public static final AllowableValue ROUTE_TO_MATCHING_PROPERTY_NAME
public static final AllowableValue ROUTE_TO_MATCHED_WHEN_ALL_PROPERTIES_MATCH
public static final AllowableValue ROUTE_TO_MATCHED_WHEN_ANY_PROPERTY_MATCHES
public static final AllowableValue STARTS_WITH
public static final AllowableValue ENDS_WITH
public static final AllowableValue CONTAINS
public static final AllowableValue EQUALS
public static final AllowableValue MATCHES_REGULAR_EXPRESSION
public static final AllowableValue CONTAINS_REGULAR_EXPRESSION
public static final AllowableValue SATISFIES_EXPRESSION
public static final PropertyDescriptor ROUTE_STRATEGY
public static final PropertyDescriptor MATCH_STRATEGY
public static final PropertyDescriptor TRIM_WHITESPACE
static final PropertyDescriptor IGNORE_CASE
static final PropertyDescriptor GROUPING_REGEX
public static final PropertyDescriptor CHARACTER_SET
public static final Relationship REL_ORIGINAL
public static final Relationship REL_NO_MATCH
public static final Relationship REL_MATCH
private static RouteText.Group EMPTY_GROUP
private AtomicReference<Set<Relationship>> relationships
private List<PropertyDescriptor> properties
private volatile String configuredRouteStrategy
private volatile Map<Relationship,PropertyValue> propertyMap
onScheduled(ProcessContext)
for quick access in
onTrigger(ProcessContext, ProcessSession)
private volatile Pattern groupingRegex
protected void init(ProcessorInitializationContext context)
init
in class AbstractSessionFactoryProcessor
public Set<Relationship> getRelationships()
getRelationships
in interface Processor
getRelationships
in class AbstractSessionFactoryProcessor
protected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors
in class AbstractConfigurableComponent
protected PropertyDescriptor getSupportedDynamicPropertyDescriptor(String propertyDescriptorName)
getSupportedDynamicPropertyDescriptor
in class AbstractConfigurableComponent
public void onPropertyModified(PropertyDescriptor descriptor, String oldValue, String newValue)
onPropertyModified
in interface ConfigurableComponent
onPropertyModified
in class AbstractConfigurableComponent
@OnScheduled public void onScheduled(ProcessContext context)
context
- ProcessContext used to retrieve dynamic propertiesprotected Collection<ValidationResult> customValidate(ValidationContext validationContext)
customValidate
in class AbstractConfigurableComponent
public void onTrigger(ProcessContext context, ProcessSession session)
onTrigger
in class AbstractProcessor
private RouteText.Group getGroup(String line, Pattern groupPattern)
private void appendLine(ProcessSession session, Map<Relationship,Map<RouteText.Group,FlowFile>> flowFileMap, Relationship relationship, FlowFile original, String line, Charset charset, RouteText.Group group)
Copyright © 2017 Apache NiFi Project. All rights reserved.