|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.atlassian.crowd.directory.DbCachingRemoteDirectory
public class DbCachingRemoteDirectory
A RemoteDirectory that provides LDAP and Crowd integration plus local storage in an internal directory
for LDAP user and group attributes, and local groups for LDAP and Crowd users with local caching of remote data.
The implementation delegates to an Remote directory for the "source of truth" and an internal directory for caching
and some special local storage.
| Field Summary | |
|---|---|
static java.lang.String |
INTERNAL_USER_PASSWORD
|
| Constructor Summary | |
|---|---|
DbCachingRemoteDirectory(RemoteDirectory remoteDirectory,
InternalRemoteDirectory internalDirectory,
DirectoryCacheFactory directoryCacheFactory)
|
|
| Method Summary | ||
|---|---|---|
Group |
addGroup(GroupTemplate group)
Adds a group to the directory store. |
|
void |
addGroupToGroup(java.lang.String childGroup,
java.lang.String parentGroup)
Adds a group as a member of a parent group. |
|
User |
addUser(UserTemplate user,
PasswordCredential credential)
Adds a user to the directory store. |
|
void |
addUserToGroup(java.lang.String username,
java.lang.String groupName)
Adds a user as a member of a group. |
|
User |
authenticate(java.lang.String name,
PasswordCredential credential)
Authenticates a user with the directory store. |
|
Group |
findGroupByName(java.lang.String name)
Finds the group that matches the supplied name. |
|
GroupWithAttributes |
findGroupWithAttributesByName(java.lang.String name)
Finds the group that matches the supplied name. |
|
User |
findUserByName(java.lang.String name)
Finds the user that matches the supplied name. |
|
UserWithAttributes |
findUserWithAttributesByName(java.lang.String name)
Finds the user that matches the supplied name. |
|
RemoteDirectory |
getAuthoritativeDirectory()
|
|
java.lang.String |
getDescriptiveName()
Returns a descriptive name for the type of directory. |
|
long |
getDirectoryId()
Gets the internal unique directoryId of the directory store. |
|
java.util.Set<java.lang.String> |
getKeys()
Gets all the keys of the attributes. |
|
java.lang.Iterable<Membership> |
getMemberships()
Get an iterable view of the available group memberships. |
|
java.lang.String |
getValue(java.lang.String name)
Returns any value associated with the given key, returns null if there is no value. |
|
java.util.Set<java.lang.String> |
getValues(java.lang.String name)
Get all the values associated with a given key. |
|
boolean |
isEmpty()
|
|
boolean |
isGroupDirectGroupMember(java.lang.String childGroup,
java.lang.String parentGroup)
Determines if a group is a direct member of another group. |
|
boolean |
isRolesDisabled()
Expose whether the directory has roles disabled. |
|
boolean |
isUserDirectGroupMember(java.lang.String username,
java.lang.String groupName)
Determines if a user is a direct member of a group. |
|
void |
removeGroup(java.lang.String name)
Removes the group that matches the supplied name. |
|
void |
removeGroupAttributes(java.lang.String groupName,
java.lang.String attributeName)
Removes all the values for a single attribute key for a group. |
|
void |
removeGroupFromGroup(java.lang.String childGroup,
java.lang.String parentGroup)
Removes a group as a member of a parent group. |
|
void |
removeUser(java.lang.String name)
Removes the user that matches the supplied name. |
|
void |
removeUserAttributes(java.lang.String username,
java.lang.String attributeName)
Removes all the values for a single attribute key for a user. |
|
void |
removeUserFromGroup(java.lang.String username,
java.lang.String groupName)
Removes a user as a member of a group. |
|
Group |
renameGroup(java.lang.String oldName,
java.lang.String newName)
Renames a group. |
|
User |
renameUser(java.lang.String oldName,
java.lang.String newName)
Renames a user. |
|
|
searchGroupRelationships(MembershipQuery<T> query)
Searches for membership information. |
|
|
searchGroups(EntityQuery<T> query)
Searches for groups that match the supplied query criteria. |
|
|
searchUsers(EntityQuery<T> query)
Searches for users that match the supplied query criteria. |
|
void |
setAttributes(java.util.Map<java.lang.String,java.lang.String> attributes)
When a directory store is loaded, the attributes map will be set by the Crowd framework. |
|
void |
setDirectoryId(long directoryId)
When a directory store is loaded, the directoryId will be set by the
crowd framework. |
|
void |
storeGroupAttributes(java.lang.String groupName,
java.util.Map<java.lang.String,java.util.Set<java.lang.String>> attributes)
Adds or updates a group's attributes with the new Map of attribute values in the directory specified by the passed in directoryId. |
|
void |
storeUserAttributes(java.lang.String username,
java.util.Map<java.lang.String,java.util.Set<java.lang.String>> attributes)
Adds or updates a user's attributes with the new Map of attribute values in the directory specified by the passed in directoryId. |
|
boolean |
supportsInactiveAccounts()
This implementation will store the active flag locally in the internal directory if the active flag cannot be persisted on the underlying remote directory. |
|
boolean |
supportsNestedGroups()
Allows us to only display nested-group related UI for directories that support it. |
|
void |
synchroniseCache(SynchronisationMode mode,
SynchronisationStatusManager synchronisationStatusManager)
Requests that this directory should update its cache by synchronising with the remote data. |
|
void |
testConnection()
Test if a connection to the directory server can be established. |
|
Group |
updateGroup(GroupTemplate group)
Updates the group. |
|
User |
updateUser(UserTemplate user)
Updates the user. |
|
void |
updateUserCredential(java.lang.String username,
PasswordCredential credential)
Updates the password for a user. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String INTERNAL_USER_PASSWORD
| Constructor Detail |
|---|
public DbCachingRemoteDirectory(RemoteDirectory remoteDirectory,
InternalRemoteDirectory internalDirectory,
DirectoryCacheFactory directoryCacheFactory)
| Method Detail |
|---|
public long getDirectoryId()
RemoteDirectorydirectoryId of the directory store.
getDirectoryId in interface RemoteDirectorydirectoryId.public void setDirectoryId(long directoryId)
RemoteDirectorydirectoryId will be set by the
crowd framework.
setDirectoryId in interface RemoteDirectorydirectoryId - The unique directoryId of the DirectoryImpl stored in the database.public java.lang.String getDescriptiveName()
RemoteDirectory
getDescriptiveName in interface RemoteDirectorypublic void setAttributes(java.util.Map<java.lang.String,java.lang.String> attributes)
RemoteDirectory
setAttributes in interface RemoteDirectoryattributes - attributes map.
public User findUserByName(java.lang.String name)
throws UserNotFoundException,
OperationFailedException
RemoteDirectoryuser that matches the supplied name.
findUserByName in interface RemoteDirectoryname - the name of the user (username).
UserNotFoundException - a user with the supplied name does not exist.
OperationFailedException - underlying directory implementation failed to execute the operation.
public UserWithAttributes findUserWithAttributesByName(java.lang.String name)
throws UserNotFoundException,
OperationFailedException
RemoteDirectoryuser that matches the supplied name.
findUserWithAttributesByName in interface RemoteDirectoryname - the name of the user (username).
UserNotFoundException - a user with the supplied name does not exist.
OperationFailedException - underlying directory implementation failed to execute the operation.
public User authenticate(java.lang.String name,
PasswordCredential credential)
throws UserNotFoundException,
InactiveAccountException,
InvalidAuthenticationException,
ExpiredCredentialException,
OperationFailedException
RemoteDirectoryuser with the directory store.
authenticate in interface RemoteDirectoryname - The name of the user (username).credential - The supplied credentials (password).
UserNotFoundException - The user wth the supplied name does not exist.
InactiveAccountException - The supplied user is inactive.
InvalidAuthenticationException - Authentication with the provided credentials failed.
ExpiredCredentialException - The user's credentials have expired. The user must change their credentials in order to successfully authenticate.
OperationFailedException - underlying directory implementation failed to execute the operation.
public java.lang.Iterable<Membership> getMemberships()
throws OperationFailedException
RemoteDirectoryGet an iterable view of the available group memberships. This may be implemented as a single remote call or separate calls, depending on the directory.
If there is a failure in the underlying retrieval, the iterator may throw
Membership.MembershipIterationException at runtime.
If the directory does not have a bulk call interface then a typical implementation would be:
return new DirectoryMembershipsIterable(this);
getMemberships in interface RemoteDirectoryOperationFailedException - if the underlying directory implementation failed to execute the operation
public User addUser(UserTemplate user,
PasswordCredential credential)
throws InvalidUserException,
InvalidCredentialException,
UserAlreadyExistsException,
OperationFailedException
RemoteDirectoryuser to the directory store.
addUser in interface RemoteDirectoryuser - template of the user to add.credential - password. May be null, since JIRA creates a user in two steps (user THEN password)
InvalidUserException - The supplied user is invalid.
InvalidCredentialException - The supplied credential is invalid.
UserAlreadyExistsException - The user already exists
OperationFailedException - underlying directory implementation failed to execute the operation.
public User updateUser(UserTemplate user)
throws InvalidUserException,
UserNotFoundException,
OperationFailedException
RemoteDirectoryuser.
updateUser in interface RemoteDirectoryuser - The user to update.
InvalidUserException - the supplied user is invalid.
UserNotFoundException - the user does not exist in the directory store.
OperationFailedException - underlying directory implementation failed to execute the operation.
public void updateUserCredential(java.lang.String username,
PasswordCredential credential)
throws UserNotFoundException,
InvalidCredentialException,
OperationFailedException
RemoteDirectorypassword for a user.
updateUserCredential in interface RemoteDirectoryusername - The name of the user (username).credential - The new credential (password).
UserNotFoundException - The user does not exist.
InvalidCredentialException - The supplied credential is invalid.
OperationFailedException - underlying directory implementation failed to execute the operation.
public User renameUser(java.lang.String oldName,
java.lang.String newName)
throws UserNotFoundException,
InvalidUserException
RemoteDirectoryuser.
renameUser in interface RemoteDirectoryoldName - name of existing user.newName - desired name of user.
UserNotFoundException - if the user with the existing name does not exist.
InvalidUserException - if the new username is invalid.
public void storeUserAttributes(java.lang.String username,
java.util.Map<java.lang.String,java.util.Set<java.lang.String>> attributes)
throws UserNotFoundException,
OperationFailedException
RemoteDirectorydirectoryId.
The attributes map represents new or updated attributes and does not replace existing attributes unless the key of an attribute
matches the key of an existing
Attributes with values of empty sets are not added (these attributes are effectively removed).
storeUserAttributes in interface RemoteDirectoryusername - name of user to update.attributes - new or updated attributes (attributes that don't need changing should not appear in this Map).
UserNotFoundException - user with supplied username does not exist.
OperationFailedException - underlying directory implementation failed to execute the operation.
public void removeUserAttributes(java.lang.String username,
java.lang.String attributeName)
throws UserNotFoundException,
OperationFailedException
RemoteDirectory
removeUserAttributes in interface RemoteDirectoryusername - name of the user to update.attributeName - name of attribute to remove.
UserNotFoundException - user with supplied username does not exist.
OperationFailedException - underlying directory implementation failed to execute the operation.
public void removeUser(java.lang.String name)
throws UserNotFoundException,
OperationFailedException
RemoteDirectoryuser that matches the supplied name.
removeUser in interface RemoteDirectoryname - The name of the user (username).
UserNotFoundException - The user does not exist.
OperationFailedException - underlying directory implementation failed to execute the operation.
public <T> java.util.List<T> searchUsers(EntityQuery<T> query)
throws OperationFailedException
RemoteDirectoryusers that match the supplied query criteria.
searchUsers in interface RemoteDirectoryquery - EntityQuery for Entity.USER.
List<User> or List<String> of users/usernames
matching the search criteria. An empty List will be returned
if no users matching the criteria are found.
OperationFailedException - if the underlying directory implementation failed to execute the operation
public Group findGroupByName(java.lang.String name)
throws GroupNotFoundException,
OperationFailedException
RemoteDirectorygroup that matches the supplied name.
findGroupByName in interface RemoteDirectoryname - the name of the group.
GroupNotFoundException - a group with the supplied name does not exist.
OperationFailedException - underlying directory implementation failed to execute the operation.
public GroupWithAttributes findGroupWithAttributesByName(java.lang.String name)
throws GroupNotFoundException,
OperationFailedException
RemoteDirectorygroup that matches the supplied name.
findGroupWithAttributesByName in interface RemoteDirectoryname - the name of the group.
GroupNotFoundException - a group with the supplied name does not exist.
OperationFailedException - underlying directory implementation failed to execute the operation.
public Group addGroup(GroupTemplate group)
throws InvalidGroupException,
OperationFailedException
RemoteDirectorygroup to the directory store.
addGroup in interface RemoteDirectorygroup - template of the group to add.
InvalidGroupException - The supplied group is invalid.
OperationFailedException - underlying directory implementation failed to execute the operation.
public Group updateGroup(GroupTemplate group)
throws InvalidGroupException,
GroupNotFoundException,
OperationFailedException,
ReadOnlyGroupException
RemoteDirectorygroup.
updateGroup in interface RemoteDirectorygroup - The group to update.
InvalidGroupException - the supplied group is invalid.
GroupNotFoundException - the group does not exist in the directory store.
OperationFailedException - underlying directory implementation failed to execute the operation.
ReadOnlyGroupException - the group is read-only
public Group renameGroup(java.lang.String oldName,
java.lang.String newName)
throws GroupNotFoundException,
InvalidGroupException
RemoteDirectorygroup.
renameGroup in interface RemoteDirectoryoldName - name of existing group.newName - desired name of group.
GroupNotFoundException - if the group with the existing name does not exist.
InvalidGroupException - if the new groupname is invalid or already exists in the directory.
public void storeGroupAttributes(java.lang.String groupName,
java.util.Map<java.lang.String,java.util.Set<java.lang.String>> attributes)
throws GroupNotFoundException,
OperationFailedException
RemoteDirectorydirectoryId.
The attributes map represents new or updated attributes and does not replace existing attributes unless the key of an attribute
matches the key of an existing
Attributes with values of empty sets are not added (these attributes are effectively removed).
storeGroupAttributes in interface RemoteDirectorygroupName - name of group to update.attributes - new or updated attributes (attributes that don't need changing should not appear in this Map).
GroupNotFoundException - group with supplied groupName does not exist.
OperationFailedException - underlying directory implementation failed to execute the operation.
public void removeGroupAttributes(java.lang.String groupName,
java.lang.String attributeName)
throws GroupNotFoundException,
OperationFailedException
RemoteDirectory
removeGroupAttributes in interface RemoteDirectorygroupName - name of the group to update.attributeName - name of attribute to remove.
GroupNotFoundException - group with supplied groupName does not exist.
OperationFailedException - underlying directory implementation failed to execute the operation.
public void removeGroup(java.lang.String name)
throws GroupNotFoundException,
OperationFailedException,
ReadOnlyGroupException
RemoteDirectorygroup that matches the supplied name.
removeGroup in interface RemoteDirectoryname - The name of the group.
GroupNotFoundException - The group does not exist.
OperationFailedException - underlying directory implementation failed to execute the operation.
ReadOnlyGroupException - if the group is read-only and not allowed to be deleted.
public <T> java.util.List<T> searchGroups(EntityQuery<T> query)
throws OperationFailedException
RemoteDirectorygroups that match the supplied query criteria.
searchGroups in interface RemoteDirectoryquery - EntityQuery for Entity.GROUP.
List or List of groups/groupnames
matching the search criteria. An empty List will be returned
if no groups matching the criteria are found.
OperationFailedException - if the underlying directory implementation failed to execute the operation
public boolean isUserDirectGroupMember(java.lang.String username,
java.lang.String groupName)
throws OperationFailedException
RemoteDirectory
isUserDirectGroupMember in interface RemoteDirectoryusername - name of user.groupName - name of group.
true iff the user is a direct member of the group.
OperationFailedException - underlying directory implementation failed to execute the operation.
public boolean isGroupDirectGroupMember(java.lang.String childGroup,
java.lang.String parentGroup)
throws OperationFailedException
RemoteDirectory
isGroupDirectGroupMember in interface RemoteDirectorychildGroup - name of child group.parentGroup - name of parent group.
true iff the childGroup is a direct member of the parentGroup.
OperationFailedException - underlying directory implementation failed to execute the operation.
public void addUserToGroup(java.lang.String username,
java.lang.String groupName)
throws GroupNotFoundException,
UserNotFoundException,
OperationFailedException,
ReadOnlyGroupException
RemoteDirectorychildGroup will
appear as members of parentGroup to querying applications.
addUserToGroup in interface RemoteDirectoryusername - The user that will become a member of groupNamegroupName - The group that will gain a new member.
GroupNotFoundException - If the group cannot be found.
UserNotFoundException - If the user cannot be found.
OperationFailedException - underlying directory implementation failed to execute the operation.
ReadOnlyGroupException - If the group is read-only
public void addGroupToGroup(java.lang.String childGroup,
java.lang.String parentGroup)
throws GroupNotFoundException,
InvalidMembershipException,
OperationFailedException,
ReadOnlyGroupException
RemoteDirectory
addGroupToGroup in interface RemoteDirectorychildGroup - The group that will become a member of parentGroupparentGroup - The group that will gain a new member
GroupNotFoundException - One or both of the groups cannot be found.
InvalidMembershipException - if the childGroup and parentGroup exist but are of different GroupTypes.
OperationFailedException - underlying directory implementation failed to execute the operation.
ReadOnlyGroupException - if either of the groups are read-only
public void removeUserFromGroup(java.lang.String username,
java.lang.String groupName)
throws GroupNotFoundException,
UserNotFoundException,
MembershipNotFoundException,
OperationFailedException,
ReadOnlyGroupException
RemoteDirectory
removeUserFromGroup in interface RemoteDirectoryusername - The user that will be removed from parentGroupgroupName - The group that will lose the member.
GroupNotFoundException - If the group cannot be found.
UserNotFoundException - If the user cannot be found.
MembershipNotFoundException - if the user is not a direct member of the group.
OperationFailedException - underlying directory implementation failed to execute the operation.
ReadOnlyGroupException - if the group is read-only
public void removeGroupFromGroup(java.lang.String childGroup,
java.lang.String parentGroup)
throws GroupNotFoundException,
InvalidMembershipException,
MembershipNotFoundException,
OperationFailedException,
ReadOnlyGroupException
RemoteDirectory
removeGroupFromGroup in interface RemoteDirectorychildGroup - The group that will be removed from parentGroupparentGroup - The group that will lose the member.
GroupNotFoundException - One or both of the groups cannot be found.
InvalidMembershipException - if the childGroup and parentGroup exist but are of different GroupTypes.
MembershipNotFoundException - if the childGroup is not a direct member of the parentGroup.
OperationFailedException - underlying directory implementation failed to execute the operation.
ReadOnlyGroupException - if the groups are read-only
public <T> java.util.List<T> searchGroupRelationships(MembershipQuery<T> query)
throws OperationFailedException
RemoteDirectory
searchGroupRelationships in interface RemoteDirectoryquery - query for memberships.
OperationFailedException - underlying directory implementation failed to execute the operation.
public void testConnection()
throws OperationFailedException
RemoteDirectory
testConnection in interface RemoteDirectoryOperationFailedException - underlying directory implementation failed to execute the operation.public boolean supportsInactiveAccounts()
supportsInactiveAccounts in interface RemoteDirectorypublic boolean supportsNestedGroups()
RemoteDirectory
supportsNestedGroups in interface RemoteDirectorypublic boolean isRolesDisabled()
RemoteDirectory
isRolesDisabled in interface RemoteDirectorypublic java.util.Set<java.lang.String> getValues(java.lang.String name)
Attributes
getValues in interface Attributesname - the key to retrieve the values for
public java.lang.String getValue(java.lang.String name)
Attributesnull if there is no value.
getValue in interface Attributesname - the key to retrieve the value for
null if there is no valuepublic boolean isEmpty()
isEmpty in interface Attributestrue if there are no attributespublic java.util.Set<java.lang.String> getKeys()
Attributes
getKeys in interface Attributes
public void synchroniseCache(SynchronisationMode mode,
SynchronisationStatusManager synchronisationStatusManager)
throws OperationFailedException
SynchronisableDirectory
synchroniseCache in interface SynchronisableDirectorymode - synchronisation modesynchronisationStatusManager - listener for synchronisation status change notifications
OperationFailedException - underlying directory implementation failed to execute the operation.public RemoteDirectory getAuthoritativeDirectory()
getAuthoritativeDirectory in interface RemoteDirectory
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||