com.atlassian.crowd.service.cache
Interface BasicCache

All Known Implementing Classes:
CacheImpl

public interface BasicCache

Non-domain-specific methods


Method Summary
 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 -> 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 -> 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.
 SOAPPrincipal getUser(String userName)
          Returns the SOAPPrincipal representing userName, or null if it's not in the cache.
 String getUserName(String username)
          Returns the username in correct case if it exists in the cache, null otherwise.
 SOAPPrincipal getUserWithAttributes(String userName)
          Returns the SOAPPrincipal with Attributes representing userName, or null if it's not in the cache.
 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->user cache to see if the user is a member.
 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 & 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.
 

Method Detail

flush

void flush()
Clears the underlying cache. May clear more than just one cache - assume that all state in all caches is lost when you call this.


getGroup

SOAPGroup getGroup(String groupName)
Returns the group, or null if it's not in the cache.

Parameters:
groupName - the group to retrieve
Returns:
the group or null if it is not in cache

cacheGroup

void cacheGroup(SOAPGroup group)
Adds a group, or if it exists, replaces the old SOAPGroup instance.

Parameters:
group - the group to add/replace in cache

removeGroup

void removeGroup(String groupName)
Removes the group, if it exists

Parameters:
groupName - the group to remove in cache

getAllGroupNames

List getAllGroupNames()
Returns a List of Strings containing all group names, or null if the list is not cached.

Returns:
a List of Strings containing all group names, or null if the list is not cached.

cacheAllGroupNames

void cacheAllGroupNames(List groupNames)
Adds, or if it already exists, replaces the list of all group names.

Parameters:
groupNames - list of group names to add/replace

cacheAncestorsForGroups

void cacheAncestorsForGroups(Map<String,Set<String>> ancestorsByGroup)
Cache a map of group name -> ancestor group names.

Parameters:
ancestorsByGroup - map containing ancestor group names by group name

getAncestorsForGroups

Map<String,Set<String>> getAncestorsForGroups()
Returns a map of group name -> ancestor group names, or null if the map is not cached.

Returns:
map containing ancestor group names by group name

containsGroupRelationships

boolean containsGroupRelationships()
Returns:
true if the cache contains enough information to reliably compute parent group relationships. If not, returns false.

setMembership

void setMembership(String userName,
                   String groupName,
                   Boolean isMember)
Adds or replaces a membership relationship between the user and the group. Updates the list of memberships returned by getAllMemberships() to keep them in sync.

Parameters:
userName - the username associated to the membership to cache
groupName - the group name associated to the membership to cache
isMember - true if the user is a member, false if not.

removeMembership

void removeMembership(String userName,
                      String groupName)
Remove any stored [yes,no] membership relationship for a userName & groupName combination.

Parameters:
userName - the username associated to the membership to cache
groupName - the group name associated to the membership to cache

isMember

Boolean isMember(String userName,
                 String groupName)
Maintains a list of true/false for "is this user a member of this group". Returns null if no information is cached.

Parameters:
userName - the username associated to the membership to update
groupName - the group name associated to the membership to update
Returns:
true if the user is a member of the group, false if not. If there is no information in cache, returns null

getAllMemberships

List getAllMemberships(String userName)
Returns a list of groups that userName belongs to, or null if they don't belong to any.

Parameters:
userName - the user
Returns:
list of groups that the specified user belongs to, or null if they don't belong to any.

cacheAllMemberships

void cacheAllMemberships(String userName,
                         List groupNames)
Cache a list of all groups this user belongs to.

Parameters:
userName - the username associated to the membership to cache
groupNames - list of group names associated to the membership to cache

removeAllMembershipsFromUserMembershipsCache

void removeAllMembershipsFromUserMembershipsCache(String userName)
Removes the list of groups the user belongs to. Used when the user is being deleted.

Parameters:
userName - the username for which the memberships will be removed

getAllMembers

List getAllMembers(String groupName)
Returns a list of users that belong to groupName belongs to, or null if there aren't any.

Parameters:
groupName - the group
Returns:
list of users belonging to the specified group. null if there are no memberships

cacheAllMembers

void cacheAllMembers(String groupName,
                     List userNames)
Cache a list of all users in this group.

Parameters:
groupName - the group name to cache
userNames - the list of usersnames to cache

removeAllMembers

void removeAllMembers(String groupName)
Removes the list of users in the group. Used when the group is being deleted.

Parameters:
groupName - the group name for which the memberships will be removed

isUserOrGroup

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

Parameters:
name - the name to check
Returns:
if there is enough information in the cache true iff the string represents a user or group. null if there is no information in the cache

addIsUserOrGroup

void addIsUserOrGroup(String name,
                      Boolean isValidUserOrGroup)
Updates the cache with information if the specified name is a valid user or group

Parameters:
name - the name to add to cache
isValidUserOrGroup - boolean to signify if the specified name is a valid user or group

cacheUser

void cacheUser(SOAPPrincipal user)
Adds, or if they exist, replaces an existing user.

Parameters:
user - the user to add/replace

removeUser

boolean removeUser(String userName)
Removes the user from the cache.

Parameters:
userName - the user to remove
Returns:
true if the user was cached, false otherwise.

getUser

SOAPPrincipal getUser(String userName)
Returns the SOAPPrincipal representing userName, or null if it's not in the cache.

Parameters:
userName - the user to retrieve
Returns:
SOAPPrincipal representing the user, or null if not in cache

getUserWithAttributes

SOAPPrincipal getUserWithAttributes(String userName)
Returns the SOAPPrincipal with Attributes representing userName, or null if it's not in the cache.

Parameters:
userName - the user to retrieve
Returns:
SOAPPrincipal with Attributes representing the user, or null i fnot in cache

getAllUserNames

List getAllUserNames()
Returns:
a List with all user names, or null if none are cached.

cacheAllUserNames

void cacheAllUserNames(List userNames)
Adds a list of all users, or if one already exists, replaces it.

Parameters:
userNames - the list of usernames to add

isMemberInGroupCache

Boolean isMemberInGroupCache(String userName,
                             String groupName)
Checks the group->user cache to see if the user is a member.

Parameters:
userName - the user to check
groupName - the group to check
Returns:
Boolean.TRUE if the user is a member. Boolean.FALSE if not. null if we don't have enough information to tell.

addGroupToUser

void addGroupToUser(String userName,
                    String groupName)
Adds the group to the user/group membership in cache

Parameters:
userName - the user to update
groupName - the group to add

addUserToGroup

void addUserToGroup(String userName,
                    String groupName)
Adds the user to the user/group membership in cache

Parameters:
userName - the user to add
groupName - the group to update

removeGroupFromUser

void removeGroupFromUser(String userName,
                         String groupName)
Removes the group from the user/group membership in the cache

Parameters:
userName - the user to update
groupName - the group to remove

removeUserFromGroup

void removeUserFromGroup(String userName,
                         String groupName)
Removes the user from the user/group membership in the cache

Parameters:
userName - the user to remove
groupName - the group to update

setMembers

List setMembers(String groupName,
                String[] userNameArray)
Caches the member list for a group called groupName. Since group member information arrives when the group is fetched from the Crowd server, this is also called from CachingGroupManager.getGroup(String).

Parameters:
groupName - the group
userNameArray - the list of user names
Returns:
A List of all members of the group.

removeCachedGroupMembership

void removeCachedGroupMembership(String userName,
                                 String groupName)
Removes all the membership details for this specific userName, groupName pair, when a group is being removed.

Parameters:
userName - the user associated with the membership
groupName - the group associate with the membership

removeCachedGroupMemberships

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.

Parameters:
groupName - the group to clean up

removeFromAllGroupNamesCache

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.

Parameters:
groupName - the group to remove form cache

addToAllGroupNamesCache

void addToAllGroupNamesCache(String groupName)
If we have a list of all groups, when we add one we should update the list.

Parameters:
groupName - the group to add to cache

removeCachedUser

void removeCachedUser(String userName,
                      String groupName)
Removes membership details for the specified user/group

Parameters:
userName - the user to update
groupName - the group to update

removeAllMemberships

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.

Parameters:
userName - the user to cleanup

addToAllUsers

void addToAllUsers(String userName)
Adds userName to the list of all users in the system.

Parameters:
userName - the user to add to cache

removeFromAllUsers

void removeFromAllUsers(String userName)
Removes the user from the cache

Parameters:
userName - the user to remove

getUserName

String getUserName(String username)
Returns the username in correct case if it exists in the cache, null otherwise.

Parameters:
username - the username
Returns:
the username in correct case, null if it doesn't exist in cache

getGroupName

String getGroupName(String groupname)
Returns the groupname in correct case if it exists in the cache, null otherwise.

Parameters:
groupname - the group
Returns:
the group name in correct case, null if it doesn't exist in cache

cacheUserWithAttributes

void cacheUserWithAttributes(SOAPPrincipal user)
Caches the specified user and it's properties

Parameters:
user - SOAPPrincipal to cache


Copyright © 2012 Atlassian. All Rights Reserved.