public interface PartitionManager extends AttributedTypeManager<Partition>, Serializable
Provides partition management operations and serves as a start point for managing identity data (eg.: users,
roles, credentials, etc) by providing factory methods for creating IdentityManager
and RelationshipManager
instances, respectively.
Partition management is only enabled if one of the provided configurations supports the Partition
type or any of its sub-types. Otherwise, all operations will behave in the context of the default partition.
Only a single configuration can support partitions.
Each partition is linked to a single configuration name, what means that all operations on that partition will be done using the stores for this specific configuration.
Eg.: Partition A is using a file-store configuration and Partition B is using a jpa-store configuration. See the Configuration API for more details about providing multiple configurations.
Implementations of this interface should be thread-safe.
Modifier and Type | Method and Description |
---|---|
void |
add(Partition partition,
String configurationName)
Adds a new partition with a reference to the given
configurationName . |
IdentityManager |
createIdentityManager()
Creates an
IdentityManager instance for the default partition. |
IdentityManager |
createIdentityManager(Partition partition)
Creates an
IdentityManager for the specified partition. |
PermissionManager |
createPermissionManager()
Creates a
PermissionManager for the default partition. |
PermissionManager |
createPermissionManager(Partition partition)
Creates a
PermissionManager for the specified partition. |
RelationshipManager |
createRelationshipManager()
Creates an
RelationshipManager . |
Collection<IdentityConfiguration> |
getConfigurations()
Retrieves the configuration used to build this
PartitionManager . |
<T extends Partition> |
getPartition(Class<T> partitionClass,
String name)
Return the partition specified by the partition class and name.
|
<T extends Partition> |
getPartitions(Class<T> partitionClass)
Return all
Partition instances for a given partitionClass . |
<T extends Partition> |
lookupById(Class<T> partitionClass,
String id)
Return the partition specified by the partition class and identifier.
|
add, remove, update
IdentityManager createIdentityManager() throws IdentityManagementException
Creates an IdentityManager
instance for the default partition.
The default partition is always a Realm
type with name
Realm.DEFAULT_REALM
. This partition must exists before calling this method,
otherwise an exception will be thrown.
IdentityManagementException
- if the default partition does not exists or any error occurs during the
creation of the IdentityManager
instance.IdentityManager createIdentityManager(Partition partition) throws IdentityManagementException
Creates an IdentityManager
for the specified partition.
partition
- The partition instance where identity management operations will be scoped. The given
partition
must exists before calling this method, otherwise an exception will be
thrown.IdentityManagementException
- if the default partition does not exists or any error occurs during the
creation of the instance.PermissionManager createPermissionManager() throws IdentityManagementException
PermissionManager
for the default partition.IdentityManagementException
- If any error occurs during the creation of the instance.PermissionManager createPermissionManager(Partition partition) throws IdentityManagementException
PermissionManager
for the specified partition.partition
- The partition instance where permission operations will be scoped. The given
partition
must exists before calling this method, otherwise an exception will be
thrown.IdentityManagementException
- if the default partition does not exists or any error occurs during the
creation of the instance.RelationshipManager createRelationshipManager() throws IdentityManagementException
Creates an RelationshipManager
.
IdentityManagementException
- if any error occurs during the creation of the instance.<T extends Partition> T getPartition(Class<T> partitionClass, String name) throws IdentityManagementException
Return the partition specified by the partition class and name.
partitionClass
- It can be any sub-type of Partition. In this case only partitions of a specific sub-type
will be considered. If it equals the Partition type this method may return any of its sub-types.name
- The name of the partition. It can not me null.IdentityManagementException
- if any error occurs during the retrieval.<T extends Partition> List<T> getPartitions(Class<T> partitionClass) throws IdentityManagementException
Return all Partition
instances for a given partitionClass
.
partitionClass
- It can be any sub-type of Partition. In this case only partitions of a specific sub-type
will be considered. If it equals the Partition type this method may return any of its sub-types.IdentityManagementException
- if any error occurs during the retrieval.<T extends Partition> T lookupById(Class<T> partitionClass, String id) throws IdentityManagementException
Return the partition specified by the partition class and identifier.
If partitionClass
equals the Partition
type this method may return any of its
sub-types with the given id
.
lookupById
in interface AttributedTypeManager<Partition>
partitionClass
- It can be any sub-type of Partition. In this case only partitions of a specific sub-type
will be considered. If it equals the Partition type this method may return any of its sub-types.id
- The identifier of the partition. It can not be null.IdentityManagementException
- if any error occurs during the retrieval.void add(Partition partition, String configurationName) throws IdentityManagementException
Adds a new partition with a reference to the given configurationName
.
partition
- configurationName
- IdentityManagementException
- if the configurationName
does not exists or if any error occurs
during the creation.Collection<IdentityConfiguration> getConfigurations()
Retrieves the configuration used to build this PartitionManager
.
Copyright © 2019. All rights reserved.