Interface GroupConfigurationProvider
public interface GroupConfigurationProvider
The main api which allows read and write access to group configurations. This provider directly represents the holder
of the configurations as well, therefore every lookup made through this class should not require a cluster wide
lookup.
- Since:
- 4.0
-
Method Summary
Modifier and TypeMethodDescriptionbooleanaddGroupConfiguration(@NonNull GroupConfiguration groupConfiguration) Adds a new group configuration by caching the given object, creating the group file and syncing the change to all other nodes which are currently connected in the cluster.addGroupConfigurationAsync(@NonNull GroupConfiguration groupConfiguration) Adds a new group configuration by caching the given object, creating the group file and syncing the change to all other nodes which are currently connected in the cluster.groupConfiguration(@NonNull String name) Get a group configuration which has the given name and is registered within the cluster.Get a group configuration which has the given name and is registered within the cluster.Get all group configurations which are registered within the cluster.Get all group configurations which are registered within the cluster.voidreload()Reloads this provider by clearing the backing group cache and re-reading all group configurations in the associated directory.Reloads this provider by clearing the backing group cache and re-reading all group configurations in the associated directory.voidremoveGroupConfiguration(@NonNull GroupConfiguration groupConfiguration) Deletes the group configuration with the given name on the local node and all other nodes in the cluster by removing it from the backing collection and deleting the associated file.removeGroupConfigurationAsync(@NonNull GroupConfiguration groupConfiguration) Deletes the group configuration with the given name on the local node and all other nodes in the cluster by removing it from the backing collection and deleting the associated file.voidDeletes the group configuration with the given name on the local node and all other nodes in the cluster by removing it from the backing collection and deleting the associated file.Deletes the group configuration with the given name on the local node and all other nodes in the cluster by removing it from the backing collection and deleting the associated file.
-
Method Details
-
reload
void reload()Reloads this provider by clearing the backing group cache and re-reading all group configurations in the associated directory. Note that this method will not trigger a cluster re-sync of the group configurations. -
groupConfigurations
Get all group configurations which are registered within the cluster. The backing collection will be updated if a group configuration was added via the api endpoint of any node in the cluster. Additions and removals to the returned collection are not possible and will not have any effect.- Returns:
- all registered group configurations within the cluster.
-
groupConfiguration
Get a group configuration which has the given name and is registered within the cluster. This method returns null if no group with the given name is registered.- Parameters:
name- the name of the group to get.- Returns:
- the group configuration which has the given name or null if no group with the given name is registered.
- Throws:
NullPointerException- if the given name is null.
-
addGroupConfiguration
Adds a new group configuration by caching the given object, creating the group file and syncing the change to all other nodes which are currently connected in the cluster. This method either creates the group or updates it if it already exists. There are no checks made if there is a diff before updating the configuration.- Parameters:
groupConfiguration- the group configuration to create or update.- Returns:
- true if the group configuration was registered or updated, false otherwise.
- Throws:
NullPointerException- if the given group configuration is null.
-
removeGroupConfigurationByName
Deletes the group configuration with the given name on the local node and all other nodes in the cluster by removing it from the backing collection and deleting the associated file.This method does nothing if no group configuration with the given name exists.
- Parameters:
name- the name of the group configuration to remove.- Throws:
NullPointerException- if the given group name is null.
-
removeGroupConfiguration
Deletes the group configuration with the given name on the local node and all other nodes in the cluster by removing it from the backing collection and deleting the associated file.This method does nothing if no group configuration with the given name exists.
- Parameters:
groupConfiguration- the group configuration to remove.- Throws:
NullPointerException- if the given group configuration is null.
-
reloadAsync
Reloads this provider by clearing the backing group cache and re-reading all group configurations in the associated directory. Note that this method will not trigger a cluster re-sync of the group configurations.- Returns:
- a task completed if the group configurations were reloaded.
-
groupConfigurationsAsync
Get all group configurations which are registered within the cluster. The backing collection will be updated if a group configuration was added via the api endpoint of any node in the cluster. Additions and removals to the returned collection are not possible and will not have any effect.- Returns:
- a task completed with all registered group configurations within the cluster.
-
groupConfigurationAsync
@NonNull @NonNull CompletableFuture<GroupConfiguration> groupConfigurationAsync(@NonNull @NonNull String name) Get a group configuration which has the given name and is registered within the cluster. This method returns null if no group with the given name is registered.- Parameters:
name- the name of the group to get.- Returns:
- a task completed with the group which has the given name or null if no such group with is registered.
- Throws:
NullPointerException- if the given name is null.
-
addGroupConfigurationAsync
@NonNull @NonNull CompletableFuture<Boolean> addGroupConfigurationAsync(@NonNull @NonNull GroupConfiguration groupConfiguration) Adds a new group configuration by caching the given object, creating the group file and syncing the change to all other nodes which are currently connected in the cluster. This method either creates the group or updates it if it already exists. There are no checks made if there is a diff before updating the configuration.- Parameters:
groupConfiguration- the group configuration to create or update.- Returns:
- a task completed with true if the group configuration was added or updated, false otherwise.
- Throws:
NullPointerException- if the given group configuration is null.
-
removeGroupConfigurationByNameAsync
@NonNull @NonNull CompletableFuture<Void> removeGroupConfigurationByNameAsync(@NonNull @NonNull String name) Deletes the group configuration with the given name on the local node and all other nodes in the cluster by removing it from the backing collection and deleting the associated file.This method does nothing if no group configuration with the given name exists.
- Parameters:
name- the name of the group configuration to remove.- Returns:
- a task completed when the group configuration with the given name was removed.
- Throws:
NullPointerException- if the given group name is null.
-
removeGroupConfigurationAsync
@NonNull @NonNull CompletableFuture<Void> removeGroupConfigurationAsync(@NonNull @NonNull GroupConfiguration groupConfiguration) Deletes the group configuration with the given name on the local node and all other nodes in the cluster by removing it from the backing collection and deleting the associated file.This method does nothing if no group configuration with the given name exists.
- Parameters:
groupConfiguration- the group configuration to remove.- Returns:
- a task completed when the given group configuration was removed.
- Throws:
NullPointerException- if the given group configuration is null.
-