@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 |
|---|---|
private ScanContent.TermLoader |
createTermLoader(ProcessContext context,
InputStream in) |
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) |
onTriggergetControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTruecustomValidate, equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, validateclone, finalize, getClass, notify, notifyAll, wait, wait, waitisStatefulgetPropertyDescriptor, getPropertyDescriptors, validatepublic 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 AbstractSessionFactoryProcessorprotected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors in class AbstractConfigurableComponentpublic Set<Relationship> getRelationships()
getRelationships in interface ProcessorgetRelationships in class AbstractSessionFactoryProcessorpublic void onPropertyModified(PropertyDescriptor descriptor, String oldValue, String newValue)
onPropertyModified in interface ConfigurableComponentonPropertyModified in class AbstractConfigurableComponentprivate boolean reloadDictionary(ProcessContext context, boolean force, ComponentLog logger) throws IOException
IOExceptionprivate ScanContent.TermLoader createTermLoader(ProcessContext context, InputStream in)
public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException
onTrigger in class AbstractProcessorProcessExceptionCopyright © 2023 Apache NiFi Project. All rights reserved.