public class DefaultPartitionManager extends Object implements PartitionManager, StoreSelector
Provides partition management functionality, and partition-specific IdentityManager instances.
Before using this factory you need a valid IdentityConfiguration, usually created using the
IdentityConfigurationBuilder.
This class is thread safe, and is intended to be used as an application-scoped component.
| Constructor and Description |
|---|
DefaultPartitionManager(Collection<IdentityConfiguration> configurations) |
DefaultPartitionManager(Collection<IdentityConfiguration> configurations,
EventBridge eventBridge,
Collection<PermissionHandler> permissionHandlers) |
DefaultPartitionManager(Collection<IdentityConfiguration> configurations,
EventBridge eventBridge,
Collection<PermissionHandler> permissionHandlers,
IdGenerator idGenerator) |
DefaultPartitionManager(IdentityConfiguration configuration) |
| 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. |
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 AttributeStore<?>> |
getStoreForAttributeOperation(IdentityContext context)
Returns the AttributeStore that manages attributes.
|
<T extends CredentialStore<?>> |
getStoreForCredentialOperation(IdentityContext context,
Class<?> credentialClass) |
<T extends IdentityStore<?>> |
getStoreForIdentityOperation(IdentityContext context,
Class<T> storeType,
Class<? extends AttributedType> type,
IdentityStoreConfiguration.IdentityOperation operation) |
<T extends PartitionStore<?>> |
getStoreForPartitionOperation(IdentityContext context,
Class<? extends Partition> partitionClass)
Returns the PartitionStore that manages partitions.
|
PermissionStore |
getStoreForPermissionOperation(IdentityContext context)
Returns a PermissionStore instance
|
IdentityStore<?> |
getStoreForRelationshipOperation(IdentityContext context,
Class<? extends Relationship> relationshipClass,
Relationship relationship,
IdentityStoreConfiguration.IdentityOperation operation)
Returns the IdentityStore that manages relationships of the specified type, for the specified partition/s.
|
Set<CredentialStore<?>> |
getStoresForCredentialStorage(IdentityContext context,
Class<? extends CredentialStorage> storageClass)
Returns all available
CredentialStore instances that support the given CredentialStorage
type. |
Set<IdentityStore<?>> |
getStoresForIdentityQuery(IdentityContext context,
Class<? extends IdentityType> identityType)
Returns all available
IdentityStore instances that support the given IdentityType. |
Set<IdentityStore<?>> |
getStoresForRelationshipQuery(IdentityContext context,
Class<? extends Relationship> relationshipClass,
Set<Partition> partitions)
Returns all available
IdentityStore instances that support the given IdentityType. |
<T extends Partition> |
lookupById(Class<T> partitionClass,
String id)
Return the partition specified by the partition class and identifier.
|
<T extends IdentityStore<?>> |
lookupStore(IdentityContext context,
IdentityConfiguration configuration,
Class<? extends AttributedType> type,
IdentityStoreConfiguration.IdentityOperation operation) |
void |
remove(Partition partition)
Removes the specified partition.
|
void |
update(Partition partition)
Updates the attributes of the specified partition.
|
public DefaultPartitionManager(IdentityConfiguration configuration)
public DefaultPartitionManager(Collection<IdentityConfiguration> configurations)
public DefaultPartitionManager(Collection<IdentityConfiguration> configurations, EventBridge eventBridge, Collection<PermissionHandler> permissionHandlers)
public DefaultPartitionManager(Collection<IdentityConfiguration> configurations, EventBridge eventBridge, Collection<PermissionHandler> permissionHandlers, IdGenerator idGenerator)
public IdentityManager createIdentityManager() throws IdentityManagementException
PartitionManagerCreates 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.
createIdentityManager in interface PartitionManagerIdentityManagementException - if the default partition does not exists or any error occurs during the
creation of the IdentityManager instance.public IdentityManager createIdentityManager(Partition partition) throws IdentityManagementException
PartitionManagerCreates an IdentityManager for the specified partition.
createIdentityManager in interface PartitionManagerpartition - 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.public PermissionManager createPermissionManager()
PartitionManagerPermissionManager for the default partition.createPermissionManager in interface PartitionManagerpublic PermissionManager createPermissionManager(Partition partition) throws IdentityManagementException
PartitionManagerPermissionManager for the specified partition.createPermissionManager in interface PartitionManagerpartition - 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.public RelationshipManager createRelationshipManager()
PartitionManagerCreates an RelationshipManager.
createRelationshipManager in interface PartitionManagerpublic <T extends Partition> T getPartition(Class<T> partitionClass, String name)
PartitionManagerReturn the partition specified by the partition class and name.
getPartition in interface PartitionManagerpartitionClass - 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.public <T extends Partition> List<T> getPartitions(Class<T> partitionClass)
PartitionManagerReturn all Partition instances for a given partitionClass.
getPartitions in interface PartitionManagerpartitionClass - 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.public <T extends Partition> T lookupById(Class<T> partitionClass, String id)
PartitionManagerReturn 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 PartitionManagerpartitionClass - 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.public void add(Partition partition) throws IdentityManagementException
PartitionManagerAdds 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.
add in interface PartitionManagerIdentityManagementException - if any error occurs during the creation.public void add(Partition partition, String configurationName) throws IdentityManagementException
PartitionManagerAdds a new partition with a reference to the given configurationName.
add in interface PartitionManagerIdentityManagementException - if the configurationName does not exists or if any error occurs
during the creation.public void update(Partition partition) throws IdentityManagementException
PartitionManagerUpdates the attributes of the specified partition.
update in interface PartitionManagerpartition - The given partition must exists before calling this method, otherwise an exception
will be
thrown.IdentityManagementException - if no partition exists or if any error occurs during the update.public void remove(Partition partition) throws IdentityManagementException
PartitionManagerRemoves 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.
remove in interface PartitionManagerpartition - The given partition must exists before calling this method, otherwise an exception
will be
thrown.IdentityManagementException - if no partition exists or if any error occurs during the update.public Collection<IdentityConfiguration> getConfigurations()
PartitionManagerRetrieves the configuration used to build this PartitionManager.
getConfigurations in interface PartitionManagerpublic <T extends IdentityStore<?>> T getStoreForIdentityOperation(IdentityContext context, Class<T> storeType, Class<? extends AttributedType> type, IdentityStoreConfiguration.IdentityOperation operation)
getStoreForIdentityOperation in interface StoreSelectorpublic Set<IdentityStore<?>> getStoresForIdentityQuery(IdentityContext context, Class<? extends IdentityType> identityType)
StoreSelectorReturns all available IdentityStore instances that support the given IdentityType.
getStoresForIdentityQuery in interface StoreSelectorcontext - The current context.identityType - The type used to restrict which stores should be selected and returned. If
the value is IdentityType all stores that support any subtype of this interface
will be returned.public <T extends IdentityStore<?>> T lookupStore(IdentityContext context, IdentityConfiguration configuration, Class<? extends AttributedType> type, IdentityStoreConfiguration.IdentityOperation operation)
public <T extends CredentialStore<?>> T getStoreForCredentialOperation(IdentityContext context, Class<?> credentialClass)
getStoreForCredentialOperation in interface StoreSelectorpublic IdentityStore<?> getStoreForRelationshipOperation(IdentityContext context, Class<? extends Relationship> relationshipClass, Relationship relationship, IdentityStoreConfiguration.IdentityOperation operation)
StoreSelectorgetStoreForRelationshipOperation in interface StoreSelectorpublic Set<IdentityStore<?>> getStoresForRelationshipQuery(IdentityContext context, Class<? extends Relationship> relationshipClass, Set<Partition> partitions)
StoreSelectorReturns all available IdentityStore instances that support the given IdentityType.
getStoresForRelationshipQuery in interface StoreSelectorcontext - The current context.relationshipClass - The type used to restrict which stores should be selected and returned. If
the value is IdentityType all stores that support any subtype of this interface
will be returned.partitions - A set with the partitions that should be used to restrict which stores should be selected. If empty
only the type will be considered.public <T extends PartitionStore<?>> T getStoreForPartitionOperation(IdentityContext context, Class<? extends Partition> partitionClass)
StoreSelectorgetStoreForPartitionOperation in interface StoreSelectorpublic <T extends AttributeStore<?>> T getStoreForAttributeOperation(IdentityContext context)
StoreSelectorgetStoreForAttributeOperation in interface StoreSelectorpublic Set<CredentialStore<?>> getStoresForCredentialStorage(IdentityContext context, Class<? extends CredentialStorage> storageClass)
StoreSelectorReturns all available CredentialStore instances that support the given CredentialStorage
type.
getStoresForCredentialStorage in interface StoreSelectorpublic PermissionStore getStoreForPermissionOperation(IdentityContext context)
StoreSelectorgetStoreForPermissionOperation in interface StoreSelectorCopyright © 2018 JBoss by Red Hat. All rights reserved.