public interface PartitionManager extends 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)
Adds a partition to the default configuration.
|
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 for the specified partition. |
<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.
|
void |
remove(Partition partition)
Removes the specified partition.
|
void |
update(Partition partition)
Updates the attributes of the specified partition.
|
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.
The returned IdentityManager instance is not thread-safe.
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
The given partition must exists before calling this method, otherwise an exception will be thrown.
The returned IdentityManager instance is not thread-safe.
partition - 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.IdentityManagementExceptionPermissionManager createPermissionManager(Partition partition) throws IdentityManagementException
PermissionManager for the specified partition.partition - IdentityManagementExceptionRelationshipManager createRelationshipManager() throws IdentityManagementException
Creates an RelationshipManager for the specified partition.
The returned RelationshipManager instance is not thread-safe.
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.
The partitionClass can be any sub-type of Partition. In this case only partitions of a
specific sub-type will be considered.
If partitionClass equals the Partition type this method may return any of its
sub-types with the given name.
partitionClass - name - 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.
The partitionClass can be any sub-type of Partition. In this case only partitions of a
specific sub-type will be considered.
If partitionClass equals the Partition type this method may return any of its
sub-types.
partitionClass - 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.
The partitionClass can be any sub-type of Partition. In this case only partitions of a
specific sub-type will be considered.
If partitionClass equals the Partition type this method may return any of its
sub-types with the given id.
partitionClass - id - IdentityManagementException - if any error occurs during the retrieval.void add(Partition partition) throws IdentityManagementException, OperationNotSupportedException
Adds a partition to the default configuration.
Only a single configuration may support partition. In this case the partition will be always created with a reference to this configuration.
partition - IdentityManagementException - if any error occurs during the creation.OperationNotSupportedException - if partition management is not enabled/supported.void add(Partition partition, String configurationName) throws IdentityManagementException, OperationNotSupportedException
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.OperationNotSupportedException - if partition management is not enabled/supported.void update(Partition partition) throws IdentityManagementException, OperationNotSupportedException
Updates the attributes of the specified partition.
Before calling this method make sure the partition references a valid instance that points
to a partition already stored with its identifier.
partition - IdentityManagementException - if no partition exists with the id of the given partition or
if any error occurs during the update.OperationNotSupportedException - if partition management is not enabled/supported.void remove(Partition partition) throws IdentityManagementException, OperationNotSupportedException
Removes the specified partition.
Before calling this method make sure the partition references a valid instance that points
to a partition already stored with its identifier.
partition - IdentityManagementException - if no partition exists with the id of the given partition or
if any error occurs during the update.OperationNotSupportedException - if partition management is not enabled/supported.Copyright © 2013. All Rights Reserved.