com.atlassian.crowd.directory
Class CachingDirectory

java.lang.Object
  extended by com.atlassian.crowd.directory.AbstractInternalDirectory
      extended by com.atlassian.crowd.directory.CachingDirectory
All Implemented Interfaces:
InternalRemoteDirectory, RemoteDirectory, Attributes

public class CachingDirectory
extends AbstractInternalDirectory

This InternalDirectory is used for locally caching Users and Groups from an external Directory.

See Also:
InternalDirectory

Field Summary
 
Fields inherited from class com.atlassian.crowd.directory.AbstractInternalDirectory
ATTRIBUTE_PASSWORD_HISTORY_COUNT, ATTRIBUTE_PASSWORD_MAX_ATTEMPTS, ATTRIBUTE_PASSWORD_MAX_CHANGE_TIME, ATTRIBUTE_PASSWORD_REGEX, ATTRIBUTE_USER_ENCRYPTION_METHOD, attributes, DESCRIPTIVE_NAME, directoryDao, directoryId, groupDao, internalDirectoryUtils, membershipDao, passwordEncoderFactory, userDao
 
Constructor Summary
CachingDirectory(InternalDirectoryUtils internalDirectoryUtils, PasswordEncoderFactory passwordEncoderFactory, DirectoryDao directoryDao, UserDao userDao, GroupDao groupDao, MembershipDao membershipDao)
           
 
Method Summary
 java.util.Collection<Group> addAllGroups(java.util.Set<GroupTemplate> groups)
          Adds a collection of groups to the directory.
 java.util.Collection<User> addAllUsers(java.util.Set<UserTemplateWithCredentialAndAttributes> users)
          Adds a collection of users to the directory.
 java.util.Collection<java.lang.String> addAllUsersToGroup(java.util.Set<java.lang.String> userNames, java.lang.String groupName)
          Adds a collection of users to a group.
 Group addLocalGroup(GroupTemplate group)
          Adds a "local" group to the directory.
 User addUser(UserTemplate user, PasswordCredential credential)
          Adds a user with no special added logic.
 User updateUser(UserTemplate user)
          Updates the user.
 
Methods inherited from class com.atlassian.crowd.directory.AbstractInternalDirectory
addGroup, addGroupToGroup, addUserToGroup, authenticate, currentPrincipalInvalidPasswordAttempts, encryptCredential, findGroupByName, findGroupWithAttributesByName, findUserByName, findUserWithAttributesByName, getDescriptiveName, getDirectoryId, getEncoder, getKeys, getValue, getValues, isEmpty, isGroupDirectGroupMember, isRolesDisabled, isUserDirectGroupMember, removeAllGroups, removeAllUsers, removeGroup, removeGroupAttributes, removeGroupFromGroup, removeUser, removeUserAttributes, removeUserFromGroup, renameGroup, renameUser, requiresPasswordChange, searchGroupRelationships, searchGroups, searchUsers, setAttributes, setDirectoryId, storeGroupAttributes, storeUserAttributes, supportsInactiveAccounts, supportsNestedGroups, testConnection, updateGroup, updateUserCredential
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachingDirectory

public CachingDirectory(InternalDirectoryUtils internalDirectoryUtils,
                        PasswordEncoderFactory passwordEncoderFactory,
                        DirectoryDao directoryDao,
                        UserDao userDao,
                        GroupDao groupDao,
                        MembershipDao membershipDao)
Method Detail

addUser

public User addUser(UserTemplate user,
                    PasswordCredential credential)
             throws InvalidCredentialException,
                    InvalidUserException,
                    UserAlreadyExistsException,
                    OperationFailedException
Adds a user with no special added logic.

Specified by:
addUser in interface RemoteDirectory
Specified by:
addUser in class AbstractInternalDirectory
Parameters:
user - template of the user to add.
credential - password. May be null, since JIRA creates a user in two steps
Returns:
added user.
Throws:
InvalidCredentialException - the password does not match the regular expression standard defined by the directory.
InvalidUserException - The supplied user is invalid.
UserAlreadyExistsException - The user already exists
OperationFailedException - underlying directory implementation failed to execute the operation.

addLocalGroup

public Group addLocalGroup(GroupTemplate group)
                    throws InvalidGroupException,
                           OperationFailedException
Description copied from interface: InternalRemoteDirectory
Adds a "local" group to the directory. This method can be used to store groups that aren't clones of "external" groups. For example, if an LDAP directory is cloned in an internal directory, it's possible to define "local" groups that exist internally but not in LDAP. This functionality was added to meet the functionality that Confluence provided.

Specified by:
addLocalGroup in interface InternalRemoteDirectory
Specified by:
addLocalGroup in class AbstractInternalDirectory
Parameters:
group - template of the group to add.
Returns:
the added group retrieved from the underlying store.
Throws:
InvalidGroupException - The supplied group is invalid.
OperationFailedException - underlying directory implementation failed to execute the operation.

addAllUsers

public java.util.Collection<User> addAllUsers(java.util.Set<UserTemplateWithCredentialAndAttributes> users)
Description copied from interface: InternalRemoteDirectory
Adds a collection of users to the directory. The bulk adding of users may be significantly faster than adding users one-by-one for large collections. Caller must ensure that the users don't already exist.

Parameters:
users - templates of users to add.
Returns:
collection of users that failed to be added.

addAllGroups

public java.util.Collection<Group> addAllGroups(java.util.Set<GroupTemplate> groups)
Description copied from interface: InternalRemoteDirectory
Adds a collection of groups to the directory. The bulk adding of groups may be significantly faster than adding groups one-by-one for large collections. Caller must ensure that the users don't already exist.

Parameters:
groups - templates of groups to add.
Returns:
collection of groups that failed to be added.

addAllUsersToGroup

public java.util.Collection<java.lang.String> addAllUsersToGroup(java.util.Set<java.lang.String> userNames,
                                                                 java.lang.String groupName)
                                                          throws GroupNotFoundException
Description copied from interface: InternalRemoteDirectory
Adds a collection of users to a group. Caller must ensure that the memberships don't already exist.

Parameters:
userNames - names of users to add to group.
groupName - name of group to add users to.
Returns:
collection of usernames that were not added to the group.
Throws:
GroupNotFoundException - group with supplied groupName does not exist.

updateUser

public User updateUser(UserTemplate user)
                throws InvalidUserException,
                       UserNotFoundException
Description copied from interface: RemoteDirectory
Updates the user.

Specified by:
updateUser in interface RemoteDirectory
Overrides:
updateUser in class AbstractInternalDirectory
Parameters:
user - The user to update.
Returns:
the updated user retrieved from the underlying store.
Throws:
InvalidUserException - the supplied user is invalid.
UserNotFoundException - the user does not exist in the directory store.


Copyright © 2010 Atlassian. All Rights Reserved.