@EventDriven @SideEffectFree @SupportsBatching @InputRequirement(value=INPUT_REQUIRED) @Tags(value={"aho-corasick","scan","content","byte sequence","search","find","dictionary"}) @CapabilityDescription(value="Scans the content of FlowFiles for terms that are found in a user-supplied dictionary. If a term is matched, the UTF-8 encoded version of the term will be added to the FlowFile using the \'matching.term\' attribute") @WritesAttribute(attribute="matching.term", description="The term that caused the Processor to route the FlowFile to the \'matched\' relationship; if FlowFile is routed to the \'unmatched\' relationship, this attribute is not added") public class ScanContent extends AbstractProcessor
Modifier and Type | Class and Description |
---|---|
private static class |
ScanContent.BinaryTermLoader |
private static interface |
ScanContent.TermLoader |
private static class |
ScanContent.TextualTermLoader |
Modifier and Type | Field and Description |
---|---|
static String |
BINARY_ENCODING |
static PropertyDescriptor |
DICTIONARY |
static PropertyDescriptor |
DICTIONARY_ENCODING |
private ReentrantLock |
dictionaryUpdateLock |
private AtomicReference<SynchronousFileWatcher> |
fileWatcherRef |
static String |
MATCH_ATTRIBUTE_KEY |
private List<PropertyDescriptor> |
properties |
static Relationship |
REL_MATCH |
static Relationship |
REL_NO_MATCH |
private Set<Relationship> |
relationships |
private AtomicReference<Search<byte[]>> |
searchRef |
static String |
TEXT_ENCODING |
static Charset |
UTF8 |
Constructor and Description |
---|
ScanContent() |
Modifier and Type | Method and Description |
---|---|
Set<Relationship> |
getRelationships() |
protected List<PropertyDescriptor> |
getSupportedPropertyDescriptors() |
protected void |
init(ProcessorInitializationContext context) |
void |
onPropertyModified(PropertyDescriptor descriptor,
String oldValue,
String newValue) |
void |
onTrigger(ProcessContext context,
ProcessSession session) |
private boolean |
reloadDictionary(ProcessContext context,
boolean force,
ComponentLog logger) |
onTrigger
getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrue
customValidate, equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, validate
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getPropertyDescriptor, getPropertyDescriptors, validate
public static final String TEXT_ENCODING
public static final String BINARY_ENCODING
public static final String MATCH_ATTRIBUTE_KEY
public static final PropertyDescriptor DICTIONARY
public static final PropertyDescriptor DICTIONARY_ENCODING
public static final Relationship REL_MATCH
public static final Relationship REL_NO_MATCH
public static final Charset UTF8
private final AtomicReference<SynchronousFileWatcher> fileWatcherRef
private final AtomicReference<Search<byte[]>> searchRef
private final ReentrantLock dictionaryUpdateLock
private List<PropertyDescriptor> properties
private Set<Relationship> relationships
protected void init(ProcessorInitializationContext context)
init
in class AbstractSessionFactoryProcessor
protected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors
in class AbstractConfigurableComponent
public Set<Relationship> getRelationships()
getRelationships
in interface Processor
getRelationships
in class AbstractSessionFactoryProcessor
public void onPropertyModified(PropertyDescriptor descriptor, String oldValue, String newValue)
onPropertyModified
in interface ConfigurableComponent
onPropertyModified
in class AbstractConfigurableComponent
private boolean reloadDictionary(ProcessContext context, boolean force, ComponentLog logger) throws IOException
IOException
public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException
onTrigger
in class AbstractProcessor
ProcessException
Copyright © 2020 Apache NiFi Project. All rights reserved.