use of org.apache.nifi.util.file.monitor.LastModifiedMonitor in project nifi by apache.
the class ScanAttribute method onScheduled.
@OnScheduled
public void onScheduled(final ProcessContext context) throws IOException {
final String filterRegex = context.getProperty(DICTIONARY_FILTER).getValue();
this.dictionaryFilterPattern = (filterRegex == null) ? null : Pattern.compile(filterRegex);
final String attributeRegex = context.getProperty(ATTRIBUTE_PATTERN).getValue();
this.attributePattern = (attributeRegex.equals(".*")) ? null : Pattern.compile(attributeRegex);
this.dictionaryTerms = createDictionary(context);
this.fileWatcher = new SynchronousFileWatcher(Paths.get(context.getProperty(DICTIONARY_FILE).getValue()), new LastModifiedMonitor(), 1000L);
}
use of org.apache.nifi.util.file.monitor.LastModifiedMonitor in project nifi by apache.
the class CSVRecordLookupService method onEnabled.
@OnEnabled
public void onEnabled(final ConfigurationContext context) throws InitializationException, IOException {
this.csvFile = context.getProperty(CSV_FILE).getValue();
this.csvFormat = CSVFormat.Predefined.valueOf(context.getProperty(CSV_FORMAT).getValue()).getFormat();
this.lookupKeyColumn = context.getProperty(LOOKUP_KEY_COLUMN).getValue();
this.ignoreDuplicates = context.getProperty(IGNORE_DUPLICATES).asBoolean();
this.watcher = new SynchronousFileWatcher(Paths.get(csvFile), new LastModifiedMonitor(), 30000L);
try {
loadCache();
} catch (final IllegalStateException e) {
throw new InitializationException(e.getMessage(), e);
}
}
use of org.apache.nifi.util.file.monitor.LastModifiedMonitor in project nifi by apache.
the class SimpleCsvFileLookupService method onEnabled.
@OnEnabled
public void onEnabled(final ConfigurationContext context) throws InitializationException, IOException, FileNotFoundException {
this.csvFile = context.getProperty(CSV_FILE).getValue();
this.csvFormat = CSVFormat.Predefined.valueOf(context.getProperty(CSV_FORMAT).getValue()).getFormat();
this.lookupKeyColumn = context.getProperty(LOOKUP_KEY_COLUMN).getValue();
this.lookupValueColumn = context.getProperty(LOOKUP_VALUE_COLUMN).getValue();
this.ignoreDuplicates = context.getProperty(IGNORE_DUPLICATES).asBoolean();
this.watcher = new SynchronousFileWatcher(Paths.get(csvFile), new LastModifiedMonitor(), 30000L);
try {
loadCache();
} catch (final IllegalStateException e) {
throw new InitializationException(e.getMessage(), e);
}
}
Aggregations