|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.user.impl.cache.CachingGroupManager
Uses a generic caching strategy to provide caching for any implementation of
GroupManager
.
Field Summary | |
protected CacheManager |
cacheManager
|
protected EntityRepositoryCache |
entityRepositoryCache
|
protected GroupCache |
groupCache
|
protected GroupsForUserCache |
groupsForUserCache
|
protected MembershipCache |
membershipCache
|
protected GroupManager |
underlyingGroupManager
|
Constructor Summary | |
CachingGroupManager(GroupManager underlyingGroupManager,
CacheManager cacheManager)
|
Method Summary | |
void |
addMembership(Group group,
User user)
Adds the user to the specified group. |
Group |
createGroup(java.lang.String groupName)
Create a new group with the specified name. |
Pager |
getExternalMemberNames(Group group)
Retrieves the names of those members of the specified group which are stored in another repository. |
Group |
getGroup(java.lang.String groupName)
Retrieves the group with the given name. |
Pager |
getGroups()
Retrieves all groups in this repository. |
Pager |
getGroups(User user)
Caches the list of groups retrieved for a particular user. |
RepositoryIdentifier |
getIdentifier()
|
Pager |
getLocalMemberNames(Group group)
Retrieves the names of those members of the specified group which are also stored in this repository. |
Pager |
getMemberNames(Group group)
Retrieves the names of all members of the specified group. |
RepositoryIdentifier |
getRepository(Entity entity)
|
boolean |
hasMembership(Group group,
User user)
Returns true if the user is a member of the specified group. |
boolean |
isCreative()
Used to detemine whether an entity can be created (eg, can call UserManager.createUser(String) or
GroupManager.createGroup(String) . |
boolean |
isReadOnly(Group group)
Returns true if the specified group and membership of the
specified group cannot be modified in the repository. |
void |
removeGroup(Group group)
Remove the group specified, if it exists in this repository. |
void |
removeMembership(Group group,
User user)
Removes the user from the specified group. |
boolean |
supportsExternalMembership()
Returns true if the repository supports users in other
repositories being members of groups in this repository. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected final GroupManager underlyingGroupManager
protected final CacheManager cacheManager
protected GroupCache groupCache
protected MembershipCache membershipCache
protected GroupsForUserCache groupsForUserCache
protected EntityRepositoryCache entityRepositoryCache
Constructor Detail |
public CachingGroupManager(GroupManager underlyingGroupManager, CacheManager cacheManager)
Method Detail |
public Pager getGroups(User user) throws EntityException
Group
objects in the Pager, they are retrieved using getGroup(String)
. This
should be relatively fast for subsequent lookups because this method also uses a cache.
getGroups
in interface GroupManager
user
- the user whose groups will be retrieved. Must not be null.
Group
type used by the underlying manager.
Returns an empty pager if no such groups exist.
EntityException
- if there is an error retrieving the groups.public Group getGroup(java.lang.String groupName) throws EntityException
GroupManager
null
if the
group does not exist in this repository.
getGroup
in interface GroupManager
Group
or null if the group does not exist.
EntityException
public Group createGroup(java.lang.String groupName) throws EntityException
GroupManager
createGroup
in interface GroupManager
EntityException
- if the Group
could not be created.public void removeGroup(Group group) throws EntityException
GroupManager
IllegalArgumentException
will be thrown.
If required to maintain the consistency of the repository, the group manager
should remove users from the group before removing the group itself.
removeGroup
in interface GroupManager
EntityException
- if the Group
could not be removed.public void addMembership(Group group, User user) throws EntityException
GroupManager
GroupManager.supportsExternalMembership()
returns true
, the user will be added as an external user.
addMembership
in interface GroupManager
EntityException
public boolean hasMembership(Group group, User user) throws EntityException
GroupManager
GroupManager.supportsExternalMembership()
returns true
, external members will be checked as well.
hasMembership
in interface GroupManager
EntityException
public void removeMembership(Group group, User user) throws EntityException
GroupManager
removeMembership
in interface GroupManager
EntityException
- if the membership could not be removed.public RepositoryIdentifier getRepository(Entity entity) throws EntityException
getRepository
in interface EntityManager
RepositoryIdentifier
of the repository in which the entity is stored, or null
if the entity cannot be found.
EntityException
- if the entity cannot be found, or trying to retrieve it results in an errorpublic Pager getGroups() throws EntityException
GroupManager
getGroups
in interface GroupManager
Pager
containing a Group
for each group managed
by the repository. An empty pager will be returned if the repository does
not contain any groups.
EntityException
public Pager getMemberNames(Group group) throws EntityException
GroupManager
getMemberNames
in interface GroupManager
Pager
containing a String
with the name of each
member of the group. An empty pager will be returned if the group has no
members.
EntityException
public Pager getLocalMemberNames(Group group) throws EntityException
GroupManager
GroupManager.supportsExternalMembership()
returns false
, this
call is equivalent to GroupManager.getMemberNames(Group)
.
getLocalMemberNames
in interface GroupManager
Pager
containing a String
with the name of each
member of the group which is stored in the same repository. An empty pager
will be returned if the group has no local members.
EntityException
public Pager getExternalMemberNames(Group group) throws EntityException
GroupManager
GroupManager.supportsExternalMembership()
returns false
, this
method throws UnsupportedOperationException
.
getExternalMemberNames
in interface GroupManager
Pager
containing a String
with the name of each
member of the group which is stored in a different repository. An empty pager
will be returned if the group has no external members.
EntityException
public boolean supportsExternalMembership() throws EntityException
GroupManager
true
if the repository supports users in other
repositories being members of groups in this repository.
Typically this is true of an application-specific Hibernate repository, but
not of a company's LDAP server. It is designed to allow the LDAP users to
be members of the application's groups for flexible application-level
security.
supportsExternalMembership
in interface GroupManager
EntityException
public boolean isReadOnly(Group group) throws EntityException
GroupManager
true
if the specified group and membership of the
specified group cannot be modified in the repository.
If this returns true
, invoking methods which attempt to
modify the group or membership of the group will fail with
UnsupportedOperationException
.
isReadOnly
in interface GroupManager
EntityException
public RepositoryIdentifier getIdentifier()
getIdentifier
in interface EntityManager
RepositoryIdentifier
for the repository which is managed by this instance.public boolean isCreative()
EntityManager
UserManager.createUser(String)
or
GroupManager.createGroup(String)
.
isCreative
in interface EntityManager
Entity
objects can be created by this manager, or false to indicate
not.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |