public static final class RoleManager.Implementation extends Object implements RoleManager
RoleManager
default implementation that uses a shared synchronization lock and a
LockedMap
implementation to allow locking-supervised access to the registry entries.RoleManager.Implementation
Modifier and Type | Method and Description |
---|---|
Object |
lockRoleRegistry()
Returns the lock instance that is internally used by this registry instance.
|
Role |
role(String roleName)
Returns the
Role instance identified by the passed role name. |
Map<String,Role> |
roles()
Provides access to the internal registry to be used in a safe way according to the internal
logic.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
New, New, New, New
New, New, New
public Map<String,Role> roles()
LockedMap
.
Rationale for this approach: The obvious (and naive) concept would be to implement a registerRole() method. But as a consequence, that would also require a removeRole() method, then a roleSize() and iterateRoles() method and then it becomes clear that managing roles (in an efficient, comfortable way) requires a complete collection logic. So instead of reimplementing a complete collection in every managing type, the managing type might as well provide access to its internal collection, however in a safe way (e.g. wrapped in mutex logic and/or via a relay instance with hooked-in logic).
roles
in interface RoleManager
roles
in interface RoleRegistry
public Role role(String roleName)
Role
instance identified by the passed role name.role
in interface RoleRegistry
roleName
- the name identifying the desired Role
instance.Role
instance identified by the passed name.public Object lockRoleRegistry()
lockRoleRegistry
in interface RoleRegistry