public class CacheImpl extends Object implements BasicCache
Constructor and Description |
---|
CacheImpl(net.sf.ehcache.CacheManager ehCacheManager) |
CacheImpl(URL configLocation) |
Modifier and Type | Method and Description |
---|---|
void |
addGroupToUser(String userName,
String groupName)
Adds the group to the user/group membership in cache
|
void |
addIsUserOrGroup(String name,
Boolean isValidUserOrGroup)
Updates the cache with information if the specified name is a valid user or group
|
void |
addToAllGroupNamesCache(String groupName)
If we have a list of all groups, when we add one we should update the list.
|
void |
addToAllUsers(String userName)
Adds
userName to the list of all users in the system. |
void |
addUserToGroup(String userName,
String groupName)
Adds the user to the user/group membership in cache
|
void |
cacheAllGroupNames(List groupNames)
Adds, or if it already exists, replaces the list of all group names.
|
void |
cacheAllMembers(String groupName,
List userNames)
Cache a list of all users in this group.
|
void |
cacheAllMemberships(String userName,
List groupNames)
Cache a list of all groups this user belongs to.
|
void |
cacheAllUserNames(List userNames)
Adds a list of all users, or if one already exists, replaces it.
|
void |
cacheAncestorsForGroups(Map<String,Set<String>> ancestorsByGroup)
Cache a map of group name to ancestor group names.
|
void |
cacheGroup(SOAPGroup group)
Adds a group, or if it exists, replaces the old
SOAPGroup instance. |
void |
cacheUser(SOAPPrincipal user)
Adds, or if they exist, replaces an existing user.
|
void |
cacheUserWithAttributes(SOAPPrincipal user)
Caches the specified user and it's properties
|
boolean |
containsGroupRelationships() |
void |
flush()
Clears the underlying cache.
|
List |
getAllGroupNames()
Returns a List of Strings containing all group names, or null if the list is not cached.
|
List |
getAllMembers(String groupName)
Returns a list of users that belong to
groupName belongs to, or null if there aren't any. |
List |
getAllMemberships(String userName)
Returns a list of groups that
userName belongs to, or null if they don't belong to any. |
List |
getAllUserNames() |
Map<String,Set<String>> |
getAncestorsForGroups()
Returns a map of group name to ancestor group names, or null if the map is not cached.
|
SOAPGroup |
getGroup(String groupName)
Returns the group, or null if it's not in the cache.
|
String |
getGroupName(String groupname)
Returns the groupname in correct case if it exists in the cache, null otherwise.
|
protected String |
getKey(String name)
Return a version of the name
appropriate for use as a cache
key.
|
protected List<String> |
getKeys(List<String> names)
Applies getKey over a collection.
|
SOAPPrincipal |
getUser(String userName)
|
String |
getUserName(String username)
Returns the username in correct case if it exists in the cache, null otherwise.
|
SOAPPrincipal |
getUserWithAttributes(String userName)
|
Boolean |
isMember(String userName,
String groupName)
Maintains a list of true/false for "is this user a member of this group".
|
Boolean |
isMemberInGroupCache(String userName,
String groupName)
Checks the group to user cache to see if the user is a member.
|
protected boolean |
isUserDirty(SOAPPrincipal latestSoapPrincipal,
SOAPPrincipal cachedSoapPrincipal) |
Boolean |
isUserOrGroup(String name)
Will return true if there is enough information in the cache to determine if the string represents a user or group
|
void |
removeAllMembers(String groupName)
Removes the list of users in the group.
|
void |
removeAllMemberships(String userName)
Called by
CachingUserManager.removeUser(String) to ensure the users details are removed from any and
all user->groups and (user+group)->[yes,no] caches. |
void |
removeAllMembershipsFromUserMembershipsCache(String userName)
Removes the list of groups the user belongs to.
|
void |
removeCachedGroupMembership(String userName,
String groupName)
Removes all the membership details for this specific userName, groupName pair, when a group is being removed.
|
void |
removeCachedGroupMemberships(String groupName)
Called by
CachingGroupManager.removeGroup(String) to ensure the group details are removed from any and
all user->groups and (user+group)->[yes,no] caches. |
void |
removeCachedUser(String userName,
String groupName)
Removes membership details for the specified user/group
|
void |
removeFromAllGroupNamesCache(String groupName)
When we remove a group, if we have already cached the list of all available groups, we need to remove this group.
|
void |
removeFromAllUsers(String userName)
Removes the user from the cache
|
void |
removeGroup(String groupName)
Removes the group, if it exists
|
void |
removeGroupFromUser(String userName,
String groupName)
Removes the group from the user/group membership in the cache
|
void |
removeMembership(String userName,
String groupName)
Remove any stored [yes,no] membership relationship for a userName and groupName combination.
|
boolean |
removeUser(String userName)
Removes the user from the cache.
|
void |
removeUserFromGroup(String userName,
String groupName)
Removes the user from the user/group membership in the cache
|
List |
setMembers(String groupName,
String[] userNameArray)
Caches the member list for a group called
groupName . |
void |
setMembership(String userName,
String groupName,
Boolean isMember)
Adds or replaces a membership relationship between the user and the group.
|
public CacheImpl(URL configLocation)
public CacheImpl(net.sf.ehcache.CacheManager ehCacheManager)
protected String getKey(String name)
The default implementation toLowers the name to produce a case-insensitive cache.
name
- key.protected List<String> getKeys(List<String> names)
names
- set of names.public void flush()
BasicCache
flush
in interface BasicCache
public void cacheUser(SOAPPrincipal user)
BasicCache
cacheUser
in interface BasicCache
user
- the user to add/replaceprotected boolean isUserDirty(SOAPPrincipal latestSoapPrincipal, SOAPPrincipal cachedSoapPrincipal)
public void cacheUserWithAttributes(SOAPPrincipal user)
BasicCache
cacheUserWithAttributes
in interface BasicCache
user
- SOAPPrincipal to cachepublic boolean removeUser(String userName)
BasicCache
removeUser
in interface BasicCache
userName
- the user to removepublic SOAPPrincipal getUser(String userName)
BasicCache
getUser
in interface BasicCache
userName
- the user to retrievepublic SOAPPrincipal getUserWithAttributes(String userName)
BasicCache
getUserWithAttributes
in interface BasicCache
userName
- the user to retrievepublic List getAllUserNames()
getAllUserNames
in interface BasicCache
public void cacheAllUserNames(List userNames)
BasicCache
cacheAllUserNames
in interface BasicCache
userNames
- the list of usernames to addpublic SOAPGroup getGroup(String groupName)
BasicCache
getGroup
in interface BasicCache
groupName
- the group to retrievepublic void cacheGroup(SOAPGroup group)
BasicCache
SOAPGroup
instance.cacheGroup
in interface BasicCache
group
- the group to add/replace in cachepublic void removeGroup(String groupName)
BasicCache
removeGroup
in interface BasicCache
groupName
- the group to remove in cachepublic List getAllGroupNames()
BasicCache
getAllGroupNames
in interface BasicCache
public void cacheAllGroupNames(List groupNames)
BasicCache
cacheAllGroupNames
in interface BasicCache
groupNames
- list of group names to add/replacepublic void cacheAncestorsForGroups(Map<String,Set<String>> ancestorsByGroup)
BasicCache
cacheAncestorsForGroups
in interface BasicCache
ancestorsByGroup
- map containing ancestor group names by group namepublic Map<String,Set<String>> getAncestorsForGroups()
BasicCache
getAncestorsForGroups
in interface BasicCache
public boolean containsGroupRelationships()
containsGroupRelationships
in interface BasicCache
public Boolean isMemberInGroupCache(String userName, String groupName)
BasicCache
isMemberInGroupCache
in interface BasicCache
userName
- the user to checkgroupName
- the group to checkBoolean.TRUE
if the user is a member. Boolean.FALSE
if not. null if we don't
have enough information to tell.public void addGroupToUser(String userName, String groupName)
BasicCache
addGroupToUser
in interface BasicCache
userName
- the user to updategroupName
- the group to addpublic void addUserToGroup(String userName, String groupName)
BasicCache
addUserToGroup
in interface BasicCache
userName
- the user to addgroupName
- the group to updatepublic void removeGroupFromUser(String userName, String groupName)
BasicCache
removeGroupFromUser
in interface BasicCache
userName
- the user to updategroupName
- the group to removepublic void removeUserFromGroup(String userName, String groupName)
BasicCache
removeUserFromGroup
in interface BasicCache
userName
- the user to removegroupName
- the group to updatepublic List setMembers(String groupName, String[] userNameArray)
BasicCache
groupName
. Since group member information arrives when
the group is fetched from the Crowd server, this is also called from CachingGroupManager.getGroup(String)
.setMembers
in interface BasicCache
groupName
- the groupuserNameArray
- the list of user namesList<String>
of all members of the group.public void removeCachedGroupMembership(String userName, String groupName)
BasicCache
removeCachedGroupMembership
in interface BasicCache
userName
- the user associated with the membershipgroupName
- the group associate with the membershippublic void removeCachedGroupMemberships(String groupName)
BasicCache
CachingGroupManager.removeGroup(String)
to ensure the group details are removed from any and
all user->groups and (user+group)->[yes,no] caches.removeCachedGroupMemberships
in interface BasicCache
groupName
- the group to clean uppublic void removeFromAllGroupNamesCache(String groupName)
BasicCache
removeFromAllGroupNamesCache
in interface BasicCache
groupName
- the group to remove form cachepublic void addToAllGroupNamesCache(String groupName)
BasicCache
addToAllGroupNamesCache
in interface BasicCache
groupName
- MUST be in the case returned by the underlying system (ie. not forced
to lower-case).public void removeCachedUser(String userName, String groupName)
BasicCache
removeCachedUser
in interface BasicCache
userName
- the user to updategroupName
- the group to updatepublic void removeAllMemberships(String userName)
BasicCache
CachingUserManager.removeUser(String)
to ensure the users details are removed from any and
all user->groups and (user+group)->[yes,no] caches.removeAllMemberships
in interface BasicCache
userName
- the user to cleanuppublic void setMembership(String userName, String groupName, Boolean isMember)
BasicCache
getAllMemberships()
to keep them in sync.setMembership
in interface BasicCache
userName
- the username associated to the membership to cachegroupName
- the group name associated to the membership to cacheisMember
- true if the user is a member, false if not.public void removeMembership(String userName, String groupName)
BasicCache
removeMembership
in interface BasicCache
userName
- the username associated to the membership to cachegroupName
- the group name associated to the membership to cachepublic Boolean isMember(String userName, String groupName)
BasicCache
isMember
in interface BasicCache
userName
- the username associated to the membership to updategroupName
- the group name associated to the membership to updatepublic List getAllMemberships(String userName)
BasicCache
userName
belongs to, or null if they don't belong to any.getAllMemberships
in interface BasicCache
userName
- the userpublic void cacheAllMemberships(String userName, List groupNames)
BasicCache
cacheAllMemberships
in interface BasicCache
userName
- the username associated to the membership to cachegroupNames
- list of group names associated to the membership to cachepublic void removeAllMembershipsFromUserMembershipsCache(String userName)
BasicCache
removeAllMembershipsFromUserMembershipsCache
in interface BasicCache
userName
- the username for which the memberships will be removedpublic List getAllMembers(String groupName)
BasicCache
groupName
belongs to, or null if there aren't any.getAllMembers
in interface BasicCache
groupName
- the grouppublic void cacheAllMembers(String groupName, List userNames)
BasicCache
cacheAllMembers
in interface BasicCache
groupName
- the group name to cacheuserNames
- the list of usersnames to cachepublic void removeAllMembers(String groupName)
BasicCache
removeAllMembers
in interface BasicCache
groupName
- the group name for which the memberships will be removedpublic Boolean isUserOrGroup(String name)
BasicCache
isUserOrGroup
in interface BasicCache
name
- the name to checkpublic void addIsUserOrGroup(String name, Boolean isValidUserOrGroup)
BasicCache
addIsUserOrGroup
in interface BasicCache
name
- the name to add to cacheisValidUserOrGroup
- boolean to signify if the specified name is a valid user or grouppublic void addToAllUsers(String userName)
BasicCache
userName
to the list of all users in the system.addToAllUsers
in interface BasicCache
userName
- MUST be in the case returned by the underlying system (ie. not forced to lower-case).public void removeFromAllUsers(String userName)
BasicCache
removeFromAllUsers
in interface BasicCache
userName
- can be in a case different to that stored in the underlying system.public String getUserName(String username)
BasicCache
getUserName
in interface BasicCache
username
- the usernamepublic String getGroupName(String groupname)
BasicCache
getGroupName
in interface BasicCache
groupname
- the groupCopyright © 2021 Atlassian. All rights reserved.