Package org.graylog2.plugin.lookup
Class LookupDataAdapter
java.lang.Object
com.google.common.util.concurrent.AbstractIdleService
org.graylog2.plugin.lookup.LookupDataAdapter
- All Implemented Interfaces:
com.google.common.util.concurrent.Service
- Direct Known Subclasses:
AbuseChRansomAdapter,CSVFileDataAdapter,DnsLookupDataAdapter,DSVHTTPDataAdapter,HTTPJSONPathDataAdapter,MaxmindDataAdapter,OTXDataAdapter,SpamhausEDROPDataAdapter,TorExitNodeDataAdapter,WhoisDataAdapter
public abstract class LookupDataAdapter
extends com.google.common.util.concurrent.AbstractIdleService
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic interfaceLookupDataAdapter.Factory<T extends LookupDataAdapter>static interfaceLookupDataAdapter.Factory2<T extends LookupDataAdapter>Nested classes/interfaces inherited from interface com.google.common.util.concurrent.Service
com.google.common.util.concurrent.Service.Listener, com.google.common.util.concurrent.Service.State -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedLookupDataAdapter(String id, String name, LookupDataAdapterConfiguration config, com.codahale.metrics.MetricRegistry metricRegistry) protectedLookupDataAdapter(DataAdapterDto dto, com.codahale.metrics.MetricRegistry metricRegistry) -
Method Summary
Modifier and TypeMethodDescriptionaddStringList(Object key, List<String> listValue, boolean keepDuplicates) Merge / append all list entries for the given key in a DataAdapter.Update / add a time to live for the given key in a DataAdapter.protected voidvoidClear (remove) the given key from the lookup table.protected abstract LookupResultprotected abstract voiddoRefresh(LookupCachePurge cachePurge) protected abstract voiddoStart()protected abstract voiddoStop()getError()id()name()voidrefresh(LookupCachePurge cachePurge) abstract org.joda.time.DurationReturns the refresh interval for this data adapter.removeStringList(Object key, List<String> listValue) Remove all matching list entries for the given key in a DataAdapter.abstract voidDeprecated.protected voidsetStringList(Object key, List<String> listValue) Update all list entries for the given key in a DataAdapter.setStringListWithTtl(Object key, List<String> listValue, Long ttlSec) Update all list entries for the given key in a DataAdapter and assign a TTL.Update a value for the given key in a DataAdapter.setValueWithTtl(Object key, Object value, Long ttlSec) Update a value for the given key in a DataAdapter and assign a TTL.protected voidshutDown()protected voidstartUp()Methods inherited from class com.google.common.util.concurrent.AbstractIdleService
addListener, awaitRunning, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, awaitTerminated, executor, failureCause, isRunning, serviceName, startAsync, state, stopAsync, toString
-
Constructor Details
-
LookupDataAdapter
-
LookupDataAdapter
protected LookupDataAdapter(String id, String name, LookupDataAdapterConfiguration config, com.codahale.metrics.MetricRegistry metricRegistry)
-
-
Method Details
-
getErrorResult
-
getEmptyResult
-
startUp
- Specified by:
startUpin classcom.google.common.util.concurrent.AbstractIdleService- Throws:
Exception
-
doStart
- Throws:
Exception
-
shutDown
- Specified by:
shutDownin classcom.google.common.util.concurrent.AbstractIdleService- Throws:
Exception
-
doStop
- Throws:
Exception
-
refreshInterval
public abstract org.joda.time.Duration refreshInterval()Returns the refresh interval for this data adapter. UseDuration.ZEROif refresh should be disabled.- Returns:
- the refresh interval
-
refresh
-
doRefresh
- Throws:
Exception
-
clearError
protected void clearError() -
getError
-
setError
-
id
-
name
-
get
-
doGet
-
set
Deprecated. -
setValue
Update a value for the given key in a DataAdapter. This is a method stub that can be implemented in DataAdapters that support this kind of data modification.- Parameters:
key- The key that should be updated.value- The new value.- Returns:
- A LookupResult containing the updated value or an error
-
setValueWithTtl
Update a value for the given key in a DataAdapter and assign a TTL. This is a method stub that can be implemented in DataAdapters that support this kind of data modification.- Parameters:
key- The key that should be updated.value- The new value.ttlSec- The time to live in seconds to assigned to this entry.- Returns:
- A LookupResult containing the updated value or an error
-
setStringList
Update all list entries for the given key in a DataAdapter. This is a method stub that can be implemented in DataAdapters that support this kind of data modification.- Parameters:
key- The key that should be updated.listValue- The new list values.- Returns:
- A LookupResult containing the updated list or an error
-
setStringListWithTtl
Update all list entries for the given key in a DataAdapter and assign a TTL. This is a method stub that can be implemented in DataAdapters that support this kind of data modification.- Parameters:
key- The key that should be updated.listValue- The new list values.ttlSec- The time to live in seconds to assigned to this entry.- Returns:
- A LookupResult containing the updated list or an error
-
addStringList
Merge / append all list entries for the given key in a DataAdapter. This is a method stub that can be implemented in DataAdapters that support this kind of data modification.- Parameters:
key- The key that should be updated.listValue- The list values that should be merged / appended.keepDuplicates- Controls whether duplicated entries should be unified.- Returns:
- A LookupResult containing the updated list or an error
-
removeStringList
Remove all matching list entries for the given key in a DataAdapter. This is a method stub that can be implemented in DataAdapters that support this kind of data modification.- Parameters:
key- The key that should be updated.listValue- The list values that should be removed.- Returns:
- A LookupResult containing the updated list or an error
-
clearKey
Clear (remove) the given key from the lookup table.- Parameters:
key- The key that should be cleared.
-
assignTtl
Update / add a time to live for the given key in a DataAdapter. This is a method stub that can be implemented in DataAdapters that support TTLs.- Parameters:
key- The key that should be updated.ttlSec- The time to live in seconds that should be assigned.- Returns:
- A LookupResult containing the updated value or an error
-
getConfig
-