public class ClusterConfigServiceImpl extends Object implements ClusterConfigService
| Constructor and Description |
|---|
ClusterConfigServiceImpl(MongoJackObjectMapperProvider mapperProvider,
MongoConnection mongoConnection,
NodeId nodeId,
ChainingClassLoader chainingClassLoader,
ClusterEventBus clusterEventBus) |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
get(Class<T> type)
Retrieve Java class of a certain type from the cluster configuration.
|
<T> T |
get(String key,
Class<T> type)
Retrieve Java class of a certain type for the given key from the cluster configuration.
|
<T> T |
getOrDefault(Class<T> type,
T defaultValue)
Retrieve Java class of a certain type from the cluster configuration or return a default value
in case that failed.
|
Set<Class<?>> |
list()
List all classes of configuration beans in the database.
|
<T> int |
remove(Class<T> type)
Remove a configuration bean from the cluster configuration.
|
<T> void |
write(String key,
T payload)
Write a configuration bean to the cluster configuration with the specified key.
|
<T> void |
write(T payload)
Write a configuration bean to the cluster configuration.
|
@Inject public ClusterConfigServiceImpl(MongoJackObjectMapperProvider mapperProvider, MongoConnection mongoConnection, NodeId nodeId, ChainingClassLoader chainingClassLoader, ClusterEventBus clusterEventBus)
public <T> T get(String key, Class<T> type)
ClusterConfigServiceget in interface ClusterConfigServiceT - The type of the Java configuration bean.key - The key that is used to find the cluster config object in the database.type - The Class of the Java configuration bean to retrieve.null if it couldn't be retrieved.public <T> T get(Class<T> type)
ClusterConfigServiceget in interface ClusterConfigServiceT - The type of the Java configuration bean.type - The Class of the Java configuration bean to retrieve.null if it couldn't be retrieved.public <T> T getOrDefault(Class<T> type, T defaultValue)
ClusterConfigServicegetOrDefault in interface ClusterConfigServiceT - The type of the Java configuration bean.type - The Class of the Java configuration bean to retrieve.defaultValue - An instance of T which is returned as default value.public <T> void write(T payload)
ClusterConfigServicewrite in interface ClusterConfigServiceT - The type of the Java configuration bean.payload - The object to write to the cluster configuration. Must be serializable by Jackson!public <T> void write(String key, T payload)
ClusterConfigServicewrite in interface ClusterConfigServiceT - The type of the Java configuration bean.key - The key that is used to write the cluster config object to the database.payload - The object to write to the cluster configuration. Must be serializable by Jackson!public <T> int remove(Class<T> type)
ClusterConfigServiceremove in interface ClusterConfigServicetype - The Class of the Java configuration bean to remove.public Set<Class<?>> list()
ClusterConfigServicelist in interface ClusterConfigServiceCopyright © 2012–2021 Graylog, Inc.. All rights reserved.