|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface DirectoryCache
Event-driven cache of directory entities and relationships.
ALL DirectoryCache implementations must have a constructor
that matches the following type signature:
(long directoryID, net.sf.ehcache.CacheManager ehcacheManager, int maxElementsInMemoryPerSubCache)
This is so that the Cache can be constructed via reflection.
Implementations are required to be threadsafe.
Method Summary | |
---|---|
void |
clear()
Clear the contents of the entire cache. |
void |
close()
Close the cache and render it unuseable. |
List<String> |
getAllGroupNames()
Retrieves the complete collection of all group names for the cached directory or null if the
complete list is not cached. |
List<String> |
getAllUserNames()
Retrieves the complete collection of all user names for the cached directory or null if the
complete list is not cached. |
Group |
getGroup(String groupName)
Returns the cached Group matching the directoryID and groupName. |
List<String> |
getGroupMembershipsOfGroup(String groupName)
Returns a list of group membership names for a particular group. |
List<String> |
getGroupMembershipsOfUser(String username)
Returns a list of group membership names for a particular user. |
List<String> |
getGroupMembersOfGroup(String groupName)
Returns a list of child group member names for a particular group. |
DirectoryCacheStatistics |
getStatistics()
Provides access to some statistics for the cache. |
User |
getUser(String username)
Returns the cached User matching the directoryID and username. |
List<String> |
getUserMembersOfGroup(String groupName)
Returns a list of user member names for a particular group. |
Boolean |
isGroupGroupMember(String childGroup,
String parentGroup)
Determines if a childGroup is a direct member of a parentGroup. |
Boolean |
isUserGroupMember(String username,
String groupName)
Determines if a user is a direct member of a group. |
void |
removeGroup(String groupName)
Removes a group (if it exists in the cache), along with any existing relationships of the group to users or groups. |
void |
removeGroupAsGroupMember(String childGroup,
String parentGroup)
Stores the fact that the childGroup is not a direct member of a parentGroup. |
void |
removeUser(String username)
Removes a user (if it exists in the cache), along with any existing relationships of the user to groups or roles. |
void |
removeUserAsGroupMember(String username,
String groupName)
Stores the fact that the user is not a direct member of a group. |
void |
setGroupAsGroupMember(String childGroup,
String parentGroup)
Stores the fact that the childGroup is a direct member of a parentGroup. |
void |
setUserAsGroupMember(String username,
String groupName)
Stores the fact that the user is a direct member of a group. |
void |
storeAllGroupNames(List<String> groupNames)
Store a complete list of all group names for the cached directory. |
void |
storeAllUserNames(List<String> usernames)
Store a complete list of all user names for the cached directory. |
void |
storeGroup(Group group)
Stores a clone of the supplied group object in the cache. |
void |
storeGroupMembershipsOfGroup(String groupName,
Collection<String> parentGroupNames)
Stores a list of direct group membership names for a particular group. |
void |
storeGroupMembershipsOfUser(String username,
Collection<String> groupNames)
Stores a list of direct group membership names for a particular user. |
void |
storeGroupMembersOfGroup(String groupName,
Collection<String> childGroupNames,
boolean complete)
Stores a list of group member names for a particular group. |
void |
storeUser(User user)
Stores a clone of the supplied user object in the cache. |
void |
storeUserMembersOfGroup(String groupName,
Collection<String> usernames,
boolean complete)
Stores a list of user member names for a particular group. |
Methods inherited from interface com.atlassian.event.EventListener |
---|
getHandledEventClasses, handleEvent |
Method Detail |
---|
User getUser(String username) throws ObjectNotFoundException
null
is returned.
This signifies we do not know whether the user exists or not.
If it is known that the user does not exist, an
ObjectNotFoundException
is thrown. For example,
if a user is removed, a subsequent getUser call attempting
to find the removed user will throw this exception.
The returning user is a clone of user object in the
cache. Callers are free to mutate the clone however they want.
username
- name of user to find.
null
.
ObjectNotFoundException
- if the object does not exist.List<String> getAllUserNames()
null
if the
complete list is not cached.
null
if the complete list is not cached.void storeAllUserNames(List<String> usernames)
usernames
- complete list of all user names.void storeUser(User user)
user
- user to cache.void removeUser(String username)
username
- name of user to remove from cache.Group getGroup(String groupName) throws ObjectNotFoundException
null
is returned.
This signifies we do not know whether the group exists or not.
If it is known that the group does not exist, an
ObjectNotFoundException
is thrown. For example,
if a group is removed, a subsequent getGroup call attempting
to find the removed group will throw this exception.
The returning group is a clone of group object in the
cache. Callers are free to mutate the clone however they want.
groupName
- name of group to find.
null
.
ObjectNotFoundException
- if the object does not exist.List<String> getAllGroupNames()
null
if the
complete list is not cached.
null
if the complete list is not cached.void storeAllGroupNames(List<String> groupNames)
groupNames
- complete list of all group names.void storeGroup(Group group)
group
- group to cache.void removeGroup(String groupName)
groupName
- name of group to remove from cache.List<String> getUserMembersOfGroup(String groupName)
groupName
- name of group to lookup.
void storeUserMembersOfGroup(String groupName, Collection<String> usernames, boolean complete)
complete
parameter is set to
true
, the collection of user names is assumed
to be the complete collection of direct user members
of the group.
The usernames is allowed to be incomplete ONLY IF the missing usernames are
not stored in the cache at all (ie. the entities are not stored / the entities membership
information is not stored). Therefore the usernames ALWAYS represents the
COMPLETE list of members the cache knows about (regardless of the "complete" flag).
The "complete" flag denotes that the collection is the complete list of usernames in the entire directory
for the group.
groupName
- name of the group.usernames
- collection of direct user members of the group.complete
- true
if and only if the collection of direct
user member names reflects the complete set of direct user members.List<String> getGroupMembershipsOfUser(String username)
username
- name of user to lookup.
void storeGroupMembershipsOfUser(String username, Collection<String> groupNames)
username
- name of the user.groupNames
- collection of direct group memberships of the user.
group membership names reflects the complete set of direct group memberships.Boolean isUserGroupMember(String username, String groupName)
username
- name of user.groupName
- name of group.
true
iff the user is a direct member of the group,
false
iff the user is not a direct member of the group,
null
iff there is insufficient information in the cache to
determine whether the user is a direct member of the group or not.void setUserAsGroupMember(String username, String groupName)
username
- name of user.groupName
- name of group.void removeUserAsGroupMember(String username, String groupName)
username
- name of user.groupName
- name of group.List<String> getGroupMembersOfGroup(String groupName)
groupName
- name of parent group to lookup.
void storeGroupMembersOfGroup(String groupName, Collection<String> childGroupNames, boolean complete)
complete
parameter is set to
true
, the collection of group names is assumed
to be the complete collection of direct group members
of the group.
The childGroupNames is allowed to be incomplete ONLY IF the missing childGroupNames are
not stored in the cache at all (ie. the entities are not stored / the entities membership
information is not stored). Therefore the childGroupNames ALWAYS represents the
COMPLETE list of members the cache knows about (regardless of the "complete" flag).
The "complete" flag denotes that the collection is the complete list of childGroupNames in the entire directory
for the group.
groupName
- name of the group.childGroupNames
- collection of direct group members of the group.complete
- true
if and only if the collection of direct
group member names reflects the complete set of direct group members.List<String> getGroupMembershipsOfGroup(String groupName)
groupName
- name of group to lookup.
void storeGroupMembershipsOfGroup(String groupName, Collection<String> parentGroupNames)
groupName
- name of the child group.parentGroupNames
- collection of direct group memberships of the child group.
group membership names reflects the complete set of direct group memberships.Boolean isGroupGroupMember(String childGroup, String parentGroup)
childGroup
- name of child group.parentGroup
- name of parent group.
true
iff the childGroup is a direct member of the parentGroup,
false
iff the childGroup is not a direct member of the parentGroup,
null
iff there is insufficient information in the cache to
determine whether the childGroup is a direct member of the parentGroup or not.void setGroupAsGroupMember(String childGroup, String parentGroup)
childGroup
- name of child group.parentGroup
- name of parent group.void removeGroupAsGroupMember(String childGroup, String parentGroup)
childGroup
- name of child group.parentGroup
- name of parent group.void clear()
void close()
DirectoryCacheStatistics getStatistics()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |