Interface DirectoryCache
- All Known Implementing Classes:
DirectoryCacheImplUsingChangeOperations
,MockDirectoryCache
public interface DirectoryCache
A cache of users, groups and memberships for an external Directory.
The
CacheRefresher
passes the updated data to this interface for caching.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addGroupMembersForGroup
(Group parentGroup, Set<String> groups) void
addGroupToGroup
(String childGroup, String parentGroup) void
addOrUpdateCachedGroup
(Group group) void
addOrUpdateCachedGroups
(Collection<? extends Group> groups, Date syncStartDate) void
addOrUpdateCachedUser
(User user) addOrUpdateCachedUsers
(Collection<? extends User> users, Date syncStartDate) Synchronises a list of Users from an external directory in the local cache.void
addUserMembersForGroup
(Group parentGroup, Set<String> remoteUsers) void
addUserToGroup
(String username, String groupName) void
applySyncingGroupAttributes
(String groupName, Set<String> deletedAttributes, Map<String, Set<String>> storedAttributes) Removes any syncing group attributes listed in deletedAttributes, and store any that are listed in storedAttributes If any non-syncing attributes are included, they will be ignoredvoid
applySyncingUserAttributes
(String userName, Set<String> deletedAttributes, Map<String, Set<String>> storedAttributes) Removes any syncing user attributes listed in deletedAttributes, and store any that are listed in storedAttributes If any non-syncing attributes are included, they will be ignoredvoid
deleteCachedGroup
(String groupName) void
deleteCachedGroups
(Set<String> groupnames) void
deleteCachedGroupsByGuids
(Set<String> guids) void
deleteCachedGroupsNotIn
(GroupType groupType, List<? extends Group> remoteGroups, Date syncStartDate) void
deleteCachedGroupsNotInByExternalId
(Collection<? extends Group> remoteGroups, Date syncStartDate) void
deleteCachedUser
(String username) void
deleteCachedUsersByGuid
(Set<String> guids) void
deleteCachedUsersNotIn
(Collection<? extends User> users, Date syncStartDate) void
deleteGroupMembersForGroup
(Group parentGroup, Set<String> groups) void
deleteUserMembersForGroup
(Group parentGroup, Set<String> remoteUsers) findGroupsByExternalIds
(Set<String> externalIds) Searches the specified directory for group names of groups with the specified external idsfindGroupsExternalIdsByNames
(Set<String> groupNames) Searches the specified directory for externalIds of groups with the specified namesfindUsersByExternalIds
(Set<String> externalIds) Searches the specified directory for user names of users with the specified external ids, returns a map from external id to usernameReturns a set of all group guids present in the cache excluding null values.Returns a set of all local group names.Returns a set of all user guids present in the cache excluding null values.long
Counts external cached groups in the directory cachelong
Counts groups in directory cache.long
Counts users in directory cache.void
removeGroupFromGroup
(String childGroup, String parentGroup) void
removeUserFromGroup
(String username, String groupName) void
syncGroupMembersForGroup
(Group parentGroup, Collection<String> groups) void
syncGroupMembershipsAndMembersForGroup
(String groupName, Set<String> parentGroupNames, Set<String> childGroupNames) void
syncGroupMembershipsForUser
(String childUsername, Set<String> parentGroupNames) void
syncUserMembersForGroup
(Group parentGroup, Collection<String> remoteUsers)
-
Method Details
-
addOrUpdateCachedUsers
AddUpdateSets<UserTemplateWithCredentialAndAttributes,UserTemplate> addOrUpdateCachedUsers(Collection<? extends User> users, Date syncStartDate) throws OperationFailedException Synchronises a list of Users from an external directory in the local cache.If the syncStartDate is not null, then it is used to ensure we don't re-introduce stale data if a User is updated locally after we did our search. Some callers may intentionally choose to pass null - eg when
com.atlassian.crowd.directory.ldap.cache.UsnChangedCacheRefresher
does a partial synchronise.- Parameters:
users
- A list of Users from the external directory.syncStartDate
- The date that the synchronise started (can be null).- Throws:
OperationFailedException
- If the Internal Directory throws a OperationFailedException - which seems unlikely.
-
deleteCachedUsersNotIn
void deleteCachedUsersNotIn(Collection<? extends User> users, Date syncStartDate) throws OperationFailedException - Throws:
OperationFailedException
-
deleteCachedUsersByGuid
- Throws:
OperationFailedException
-
addOrUpdateCachedGroups
void addOrUpdateCachedGroups(Collection<? extends Group> groups, Date syncStartDate) throws OperationFailedException - Throws:
OperationFailedException
-
deleteCachedGroupsNotIn
void deleteCachedGroupsNotIn(GroupType groupType, List<? extends Group> remoteGroups, Date syncStartDate) throws OperationFailedException - Throws:
OperationFailedException
-
deleteCachedGroupsNotInByExternalId
void deleteCachedGroupsNotInByExternalId(Collection<? extends Group> remoteGroups, Date syncStartDate) throws OperationFailedException - Throws:
OperationFailedException
-
deleteCachedGroups
- Throws:
OperationFailedException
-
deleteCachedGroupsByGuids
- Throws:
OperationFailedException
-
syncUserMembersForGroup
void syncUserMembersForGroup(Group parentGroup, Collection<String> remoteUsers) throws OperationFailedException - Throws:
OperationFailedException
-
addUserMembersForGroup
void addUserMembersForGroup(Group parentGroup, Set<String> remoteUsers) throws OperationFailedException - Throws:
OperationFailedException
-
deleteUserMembersForGroup
void deleteUserMembersForGroup(Group parentGroup, Set<String> remoteUsers) throws OperationFailedException - Throws:
OperationFailedException
-
syncGroupMembersForGroup
void syncGroupMembersForGroup(Group parentGroup, Collection<String> groups) throws OperationFailedException - Throws:
OperationFailedException
-
addGroupMembersForGroup
- Throws:
OperationFailedException
-
deleteGroupMembersForGroup
void deleteGroupMembersForGroup(Group parentGroup, Set<String> groups) throws OperationFailedException - Throws:
OperationFailedException
-
addOrUpdateCachedUser
- Throws:
OperationFailedException
-
deleteCachedUser
- Throws:
OperationFailedException
-
addOrUpdateCachedGroup
- Throws:
OperationFailedException
-
deleteCachedGroup
- Throws:
OperationFailedException
-
addUserToGroup
- Throws:
OperationFailedException
-
removeUserFromGroup
- Throws:
OperationFailedException
-
addGroupToGroup
- Throws:
OperationFailedException
-
removeGroupFromGroup
- Throws:
OperationFailedException
-
syncGroupMembershipsForUser
void syncGroupMembershipsForUser(String childUsername, Set<String> parentGroupNames) throws OperationFailedException - Throws:
OperationFailedException
-
syncGroupMembershipsAndMembersForGroup
void syncGroupMembershipsAndMembersForGroup(String groupName, Set<String> parentGroupNames, Set<String> childGroupNames) throws OperationFailedException - Throws:
OperationFailedException
-
getAllUserGuids
Returns a set of all user guids present in the cache excluding null values.- Returns:
- set of all user guids present in the cache
- Throws:
OperationFailedException
- if the internal directory throes a OperationFailedException
-
getUserCount
Counts users in directory cache.- Returns:
- user count
- Throws:
OperationFailedException
-
findUserWithAttributesByName
UserWithAttributes findUserWithAttributesByName(String name) throws UserNotFoundException, OperationFailedException -
findUsersByExternalIds
Searches the specified directory for user names of users with the specified external ids, returns a map from external id to username- Parameters:
externalIds
- the external ids of the users to search for
-
getAllGroupGuids
Returns a set of all group guids present in the cache excluding null values.- Returns:
- set of all group guids present in the cache
- Throws:
OperationFailedException
- if the internal directory throes a OperationFailedException
-
getAllLocalGroupNames
Returns a set of all local group names.- Returns:
- set of all local group names.
- Throws:
OperationFailedException
- if the internal directory throes a OperationFailedException
-
getGroupCount
Counts groups in directory cache.- Returns:
- group count
- Throws:
OperationFailedException
-
getExternalCachedGroupCount
Counts external cached groups in the directory cache- Returns:
- external cached group count
- Throws:
OperationFailedException
- if the internal directory throws a OperationFailedException
-
findGroupsByExternalIds
Searches the specified directory for group names of groups with the specified external ids- Parameters:
externalIds
- external ids of the groups to find- Returns:
- a map from external ids to group names
- Throws:
OperationFailedException
-
findGroupsExternalIdsByNames
Map<String,String> findGroupsExternalIdsByNames(Set<String> groupNames) throws OperationFailedException Searches the specified directory for externalIds of groups with the specified names- Parameters:
groupNames
- names of the groups to find- Returns:
- a map from group names to external ids
- Throws:
OperationFailedException
-
findGroupWithAttributesByName
GroupWithAttributes findGroupWithAttributesByName(String name) throws GroupNotFoundException, OperationFailedException -
applySyncingUserAttributes
void applySyncingUserAttributes(String userName, Set<String> deletedAttributes, Map<String, Set<String>> storedAttributes) throws UserNotFoundException, OperationFailedExceptionRemoves any syncing user attributes listed in deletedAttributes, and store any that are listed in storedAttributes If any non-syncing attributes are included, they will be ignored- Parameters:
userName
- user to apply attributes todeletedAttributes
- attribute keys that need to be deletedstoredAttributes
- attributes and values that need to be saved (will overwrite any existing attributes with the same keys)- Throws:
UserNotFoundException
OperationFailedException
-
applySyncingGroupAttributes
void applySyncingGroupAttributes(String groupName, Set<String> deletedAttributes, Map<String, Set<String>> storedAttributes) throws GroupNotFoundException, OperationFailedExceptionRemoves any syncing group attributes listed in deletedAttributes, and store any that are listed in storedAttributes If any non-syncing attributes are included, they will be ignored- Parameters:
groupName
- group to apply attributes todeletedAttributes
- attribute keys that need to be deletedstoredAttributes
- attributes and values that need to be saved (will overwrite any existing attributes with the same keys)- Throws:
GroupNotFoundException
OperationFailedException
-