@Tags(value={"lookup","cache","enrich","join","csv","reloadable","key","value","record"}) @CapabilityDescription(value="A reloadable CSV file-based lookup service. When the lookup key is found in the CSV file, the columns are returned as a Record. All returned fields will be strings.") public class CSVRecordLookupService extends AbstractControllerService implements RecordLookupService
| Modifier and Type | Field and Description |
|---|---|
private ConcurrentMap<String,Record> |
cache |
private String |
charset |
static PropertyDescriptor |
CHARSET |
static PropertyDescriptor |
CSV_FILE |
(package private) static PropertyDescriptor |
CSV_FORMAT |
private String |
csvFile |
private org.apache.commons.csv.CSVFormat |
csvFormat |
static PropertyDescriptor |
IGNORE_DUPLICATES |
private boolean |
ignoreDuplicates |
private static String |
KEY |
private ReentrantLock |
lock |
static PropertyDescriptor |
LOOKUP_KEY_COLUMN |
private String |
lookupKeyColumn |
private List<PropertyDescriptor> |
properties |
private static Set<String> |
REQUIRED_KEYS |
private SynchronousFileWatcher |
watcher |
| Constructor and Description |
|---|
CSVRecordLookupService() |
| Modifier and Type | Method and Description |
|---|---|
Set<String> |
getRequiredKeys() |
protected List<PropertyDescriptor> |
getSupportedPropertyDescriptors() |
protected void |
init(ControllerServiceInitializationContext context) |
private void |
loadCache() |
Optional<Record> |
lookup(Map<String,Object> coordinates) |
void |
onEnabled(ConfigurationContext context) |
abstractClearConfigContext, abstractStoreConfigContext, disabled, enabled, getConfigurationContext, getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, getProperty, getStateManager, initialize, isEnabledcustomValidate, equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, onPropertyModified, toString, validateclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetValueTypelookupinitializegetIdentifier, getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validateprivate static final String KEY
public static final PropertyDescriptor CSV_FILE
static final PropertyDescriptor CSV_FORMAT
public static final PropertyDescriptor CHARSET
public static final PropertyDescriptor LOOKUP_KEY_COLUMN
public static final PropertyDescriptor IGNORE_DUPLICATES
private List<PropertyDescriptor> properties
private volatile ConcurrentMap<String,Record> cache
private volatile String csvFile
private volatile org.apache.commons.csv.CSVFormat csvFormat
private volatile String charset
private volatile String lookupKeyColumn
private volatile boolean ignoreDuplicates
private volatile SynchronousFileWatcher watcher
private final ReentrantLock lock
private void loadCache()
throws IllegalStateException,
IOException
IllegalStateExceptionIOExceptionprotected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors in class AbstractConfigurableComponentprotected void init(ControllerServiceInitializationContext context) throws InitializationException
init in class AbstractControllerServiceInitializationException@OnEnabled public void onEnabled(ConfigurationContext context) throws InitializationException, IOException
InitializationExceptionIOExceptionpublic Optional<Record> lookup(Map<String,Object> coordinates) throws LookupFailureException
lookup in interface LookupService<Record>LookupFailureExceptionpublic Set<String> getRequiredKeys()
getRequiredKeys in interface LookupService<Record>Copyright © 2020 Apache NiFi Project. All rights reserved.