Package org.graylog2.cluster
Class ClusterConfigServiceImpl
java.lang.Object
org.graylog2.cluster.ClusterConfigServiceImpl
- All Implemented Interfaces:
ClusterConfigService
-
Constructor Summary
ConstructorsConstructorDescriptionClusterConfigServiceImpl(MongoJackObjectMapperProvider mapperProvider, MongoConnection mongoConnection, NodeId nodeId, RestrictedChainingClassLoader chainingClassLoader, ClusterEventBus clusterEventBus) ClusterConfigServiceImpl(MongoJackObjectMapperProvider mapperProvider, MongoConnection mongoConnection, NodeId nodeId, ChainingClassLoader chainingClassLoader, ClusterEventBus clusterEventBus) Deprecated. -
Method Summary
Modifier and TypeMethodDescription<T> TextractPayload(Object payload, Class<T> type) <T> TRetrieve Java class of a certain type from the cluster configuration.<T> TRetrieve Java class of a certain type for the given key from the cluster configuration.<T> TgetOrDefault(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.Retrieve raw persisted Java class.list()List all classes of configuration beans in the database.<T> intRemove a configuration bean from the cluster configuration.<T> voidWrite a configuration bean to the cluster configuration with the specified key.<T> voidwrite(T payload) Write a configuration bean to the cluster configuration.
-
Constructor Details
-
ClusterConfigServiceImpl
@Inject public ClusterConfigServiceImpl(MongoJackObjectMapperProvider mapperProvider, MongoConnection mongoConnection, NodeId nodeId, RestrictedChainingClassLoader chainingClassLoader, ClusterEventBus clusterEventBus)
-
-
Method Details
-
extractPayload
- Specified by:
extractPayloadin interfaceClusterConfigService
-
get
Description copied from interface:ClusterConfigServiceRetrieve Java class of a certain type for the given key from the cluster configuration.- Specified by:
getin interfaceClusterConfigService- Type Parameters:
T- The type of the Java configuration bean.- Parameters:
key- The key that is used to find the cluster config object in the database.type- TheClassof the Java configuration bean to retrieve.- Returns:
- An instance of the requested type or
nullif it couldn't be retrieved.
-
get
Description copied from interface:ClusterConfigServiceRetrieve Java class of a certain type from the cluster configuration.- Specified by:
getin interfaceClusterConfigService- Type Parameters:
T- The type of the Java configuration bean.- Parameters:
type- TheClassof the Java configuration bean to retrieve.- Returns:
- An instance of the requested type or
nullif it couldn't be retrieved.
-
getRaw
Description copied from interface:ClusterConfigServiceRetrieve raw persisted Java class.- Specified by:
getRawin interfaceClusterConfigService- Parameters:
type- The key/type that is used to find the cluster config object in the database.- Returns:
- An instance of the raw persisted Java class or
nullif it couldn't be retrieved.
-
getOrDefault
Description copied from interface:ClusterConfigServiceRetrieve Java class of a certain type from the cluster configuration or return a default value in case that failed.- Specified by:
getOrDefaultin interfaceClusterConfigService- Type Parameters:
T- The type of the Java configuration bean.- Parameters:
type- TheClassof the Java configuration bean to retrieve.defaultValue- An instance ofTwhich is returned as default value.- Returns:
- An instance of the requested type.
-
write
public <T> void write(T payload) Description copied from interface:ClusterConfigServiceWrite a configuration bean to the cluster configuration.- Specified by:
writein interfaceClusterConfigService- Type Parameters:
T- The type of the Java configuration bean.- Parameters:
payload- The object to write to the cluster configuration. Must be serializable by Jackson!
-
write
Description copied from interface:ClusterConfigServiceWrite a configuration bean to the cluster configuration with the specified key.- Specified by:
writein interfaceClusterConfigService- Type Parameters:
T- The type of the Java configuration bean.- Parameters:
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!
-
remove
Description copied from interface:ClusterConfigServiceRemove a configuration bean from the cluster configuration.- Specified by:
removein interfaceClusterConfigService- Parameters:
type- TheClassof the Java configuration bean to remove.- Returns:
- The number of removed entries from the cluster configuration.
-
list
Description copied from interface:ClusterConfigServiceList all classes of configuration beans in the database.- Specified by:
listin interfaceClusterConfigService- Returns:
- The list of Java classes being used in the database.
-