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
,GreyNoiseCommunityIpLookupAdapter
,GreyNoiseQuickIPDataAdapter
,HTTPJSONPathDataAdapter
,MaxmindDataAdapter
,OTXDataAdapter
,SpamhausEDROPDataAdapter
,TorExitNodeDataAdapter
,WhoisDataAdapter
public abstract class LookupDataAdapter
extends com.google.common.util.concurrent.AbstractIdleService
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static interface
LookupDataAdapter.Factory<T extends LookupDataAdapter>
static interface
LookupDataAdapter.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
ModifierConstructorDescriptionprotected
LookupDataAdapter
(String id, String name, LookupDataAdapterConfiguration config, com.codahale.metrics.MetricRegistry metricRegistry) protected
LookupDataAdapter
(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 void
void
Clear (remove) the given key from the lookup table.protected abstract LookupResult
protected abstract void
doRefresh
(LookupCachePurge cachePurge) protected abstract void
doStart()
protected abstract void
doStop()
getError()
id()
name()
void
refresh
(LookupCachePurge cachePurge) abstract org.joda.time.Duration
Returns 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 void
Deprecated.protected void
setStringList
(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 void
shutDown()
protected void
startUp()
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:
startUp
in classcom.google.common.util.concurrent.AbstractIdleService
- Throws:
Exception
-
doStart
- Throws:
Exception
-
shutDown
- Specified by:
shutDown
in 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.ZERO
if 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
-