public class DefaultPartitionManager extends AbstractAttributedTypeManager<Partition> implements PartitionManager
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 attributedType) |
void |
add(Partition partition,
String configurationName)
Adds a new partition with a reference to the given
configurationName . |
protected void |
checkIfExists(Partition partition) |
protected void |
checkUniqueness(Partition attributedType) |
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 . |
protected void |
doAdd(Partition attributedType) |
protected void |
doRemove(Partition attributedType) |
protected void |
doUpdate(Partition attributedType) |
protected void |
fireAttributedTypeAddedEvent(Partition attributedType) |
protected void |
fireAttributedTypeRemovedEvent(Partition attributedType) |
protected void |
fireAttributedTypeUpdatedEvent(Partition attributedType) |
Collection<IdentityConfiguration> |
getConfigurations()
Retrieves the configuration used to build this
PartitionManager . |
IdentityContext |
getIdentityContext() |
<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.
|
addAttributes, createIdentityContext, fireEvent, getConfiguration, getEventBridge, getIdGenerator, getStoreSelector, remove, removeAllAttributes, removeAttributes, update
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
remove, update
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
PartitionManager
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.
createIdentityManager
in interface PartitionManager
IdentityManagementException
- 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
PartitionManager
Creates an IdentityManager
for the specified partition.
createIdentityManager
in interface PartitionManager
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.public PermissionManager createPermissionManager()
PartitionManager
PermissionManager
for the default partition.createPermissionManager
in interface PartitionManager
public PermissionManager createPermissionManager(Partition partition) throws IdentityManagementException
PartitionManager
PermissionManager
for the specified partition.createPermissionManager
in interface PartitionManager
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.public RelationshipManager createRelationshipManager()
PartitionManager
Creates an RelationshipManager
.
createRelationshipManager
in interface PartitionManager
public <T extends Partition> T getPartition(Class<T> partitionClass, String name)
PartitionManager
Return the partition specified by the partition class and name.
getPartition
in interface PartitionManager
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.public <T extends Partition> List<T> getPartitions(Class<T> partitionClass)
PartitionManager
Return all Partition
instances for a given partitionClass
.
getPartitions
in interface PartitionManager
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.public <T extends Partition> T lookupById(Class<T> partitionClass, String id)
PartitionManager
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>
lookupById
in interface PartitionManager
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.AttributedType
is found with the given identifier this method returns null.protected void fireAttributedTypeAddedEvent(Partition attributedType)
fireAttributedTypeAddedEvent
in class AbstractAttributedTypeManager<Partition>
protected void doAdd(Partition attributedType)
doAdd
in class AbstractAttributedTypeManager<Partition>
public void add(Partition attributedType) throws IdentityManagementException
add
in interface AttributedTypeManager<Partition>
add
in class AbstractAttributedTypeManager<Partition>
IdentityManagementException
public void add(Partition partition, String configurationName) throws IdentityManagementException
PartitionManager
Adds a new partition with a reference to the given configurationName
.
add
in interface PartitionManager
IdentityManagementException
- if the configurationName
does not exists or if any error occurs
during the creation.protected void fireAttributedTypeUpdatedEvent(Partition attributedType)
fireAttributedTypeUpdatedEvent
in class AbstractAttributedTypeManager<Partition>
protected void doUpdate(Partition attributedType)
doUpdate
in class AbstractAttributedTypeManager<Partition>
protected void fireAttributedTypeRemovedEvent(Partition attributedType)
fireAttributedTypeRemovedEvent
in class AbstractAttributedTypeManager<Partition>
protected void doRemove(Partition attributedType)
doRemove
in class AbstractAttributedTypeManager<Partition>
protected void checkUniqueness(Partition attributedType) throws IdentityManagementException
checkUniqueness
in class AbstractAttributedTypeManager<Partition>
IdentityManagementException
protected void checkIfExists(Partition partition) throws IdentityManagementException
checkIfExists
in class AbstractAttributedTypeManager<Partition>
IdentityManagementException
public Collection<IdentityConfiguration> getConfigurations()
PartitionManager
Retrieves the configuration used to build this PartitionManager
.
getConfigurations
in interface PartitionManager
public IdentityContext getIdentityContext()
getIdentityContext
in class AbstractAttributedTypeManager<Partition>
Copyright © 2016. All rights reserved.