com.atlassian.crowd.manager.directory
Interface DirectoryManager

All Known Implementing Classes:
DirectoryManagerGeneric, MockDirectoryManager

public interface DirectoryManager


Method Summary
 BulkAddResult<RemoteGroup> addAllGroups(long directoryID, java.util.Collection<RemoteGroup> groups, boolean overwrite)
          Will add a collection of RemoteGroup to the directory specified by the passed in directoryId param.
 BulkAddResult<RemotePrincipal> addAllPrincipals(long directoryID, java.util.Collection<RemotePrincipal> principals, boolean overwrite)
          Will add a collection of RemotePrincipal to the directory specified by the passed in directoryId param.
 BulkAddResult<java.lang.String> addAllPrincipalsToGroup(long directoryID, java.util.Collection<java.lang.String> principalNames, java.lang.String groupName)
          A bulk version of addPrincipalToGroup.
 BulkAddResult<java.lang.String> addAllPrincipalsToRole(long directoryID, java.util.Collection<java.lang.String> principalNames, java.lang.String roleName)
          A bulk version of addPrincipalToRole.
 BulkAddResult<RemoteRole> addAllRoles(long directoryID, java.util.Collection<RemoteRole> roles, boolean overwrite)
          Will add a collection of RemoteRole to the directory specified by the passed in directoryId param.
 Directory addDirectory(Directory directory)
          Will add the given directory
 RemoteGroup addGroup(long directoryID, RemoteGroup group)
          Will add a RemoteGroup to the directory specified by the passed in directoryId param.
 RemotePrincipal addPrincipal(long directoryID, RemotePrincipal principal)
          Will add a RemotePrincipal to the directory specified by the passed in directoryId param.
 void addPrincipalAttribute(long directoryID, RemotePrincipal principal, java.lang.String attribute, AttributeValues values)
          Will add a given attribute and its values to a given principal, in the specified directory.
 void addPrincipalToGroup(long directoryID, java.lang.String name, java.lang.String groupName)
           
 void addPrincipalToRole(long directoryID, java.lang.String name, java.lang.String unsubscribedRole)
           
 RemoteRole addRole(long directoryID, RemoteRole role)
          Will add a RemoteRole to the given directory
 void expireToken(java.lang.String key)
           
 Directory findDirectoryByID(long directoryID)
          Will return a Directory based on the passed in directoryId
 Directory findDirectoryByName(java.lang.String name)
          Will find a directory given the supplied name
 RemoteGroup findGroupByName(long directoryID, java.lang.String name)
          Will return a RemoteGroup, with all members populated.
 RemoteGroup findGroupByName(long directoryID, java.lang.String name, boolean onlyFetchDirectMembers)
          Will return a RemoteGroup with members populated.
 java.util.List<RemoteGroup> findGroupMemberships(long directoryID, java.lang.String principal)
          Finds all of the group memberships for a given principal.
 RemotePrincipal findPrincipalByName(long directoryID, java.lang.String username)
           
 RemotePrincipal findPrincipalByToken(java.lang.String key)
          Will find a principal via the passed in token key
 RemoteRole findRoleByName(long directoryID, java.lang.String name)
           
 java.util.List<RemoteRole> findRoleMemberships(long directoryID, java.lang.String principal)
          Finds all of the role memberships for a given principal.
 void invalidateToken(java.lang.String token)
          Will attempt to invalidate a Token based on the passed in Token key
 boolean isGroupMember(long directoryID, java.lang.String group, java.lang.String username)
           
 boolean isRoleMember(long directoryID, java.lang.String role, java.lang.String username)
           
 void removeDirectory(Directory directory)
          Will remove a given directory and all its associated entities, groups, roles, principals and mappings
 void removeExpiredTokens()
           
 void removeGroup(long directoryID, java.lang.String name)
           
 void removePrincipal(long directoryID, java.lang.String name)
           
 void removePrincipalAttribute(long directoryID, RemotePrincipal principal, java.lang.String attribute)
          Will remove the given attribute from the given RemotePrincipal, in the specified directory
 void removePrincipalFromGroup(long directoryID, java.lang.String name, java.lang.String unsubscribedGroup)
           
 void removePrincipalFromRole(long directoryID, java.lang.String name, java.lang.String removeRole)
           
 void removeRole(long directoryID, java.lang.String name)
           
 void resetPassword(long directoryID, java.lang.String name)
           
 java.util.List<Directory> searchDirectories(SearchContext searchContext)
          Will return a List of Directories for the given SearchContext
 java.util.List<RemoteGroup> searchGroups(SearchContext searchContext)
           
 java.util.List<RemotePrincipal> searchPrincipals(SearchContext searchContext)
           
 java.util.List<RemoteRole> searchRoles(SearchContext searchContext)
           
 java.util.List<Token> searchTokens(SearchContext searchContext)
           
 Directory updateDirectory(Directory directory)
          Will update the passed in directory
 RemoteGroup updateGroup(long directoryID, RemoteGroup group)
           
 RemotePrincipal updatePrincipal(long directoryID, RemotePrincipal principal)
           
 void updatePrincipalCredential(long directoryID, java.lang.String principal, PasswordCredential credential)
          This will update the Principals credentials in the given directory
 RemoteRole updateRole(long directoryID, RemoteRole role)
           
 

Method Detail

addDirectory

Directory addDirectory(Directory directory)
                       throws java.rmi.RemoteException
Will add the given directory

Parameters:
directory - the Directory to add
Returns:
the added Directory
Throws:
java.rmi.RemoteException - if there was an error instantiating the directory

addPrincipal

RemotePrincipal addPrincipal(long directoryID,
                             RemotePrincipal principal)
                             throws InvalidCredentialException,
                                    InvalidPrincipalException,
                                    java.rmi.RemoteException,
                                    DirectoryPermissionException,
                                    ObjectNotFoundException
Will add a RemotePrincipal to the directory specified by the passed in directoryId param.

Parameters:
directoryID - the directory to add the RemotePrincipal too.
principal - the RemotePrincipal to add.
Returns:
the RemotePrincipal that was added.
Throws:
InvalidCredentialException - if the Principal's credential does not meet the validation requirements for the given directory
InvalidPrincipalException - if the Principal already exists in the given Directory
java.rmi.RemoteException - if there was an error adding the RemotePrincipal or instantiating the Directory
DirectoryPermissionException - if there is no ADD_PRINCIPAL permission for the given directory
ObjectNotFoundException - if the directory with the given directoryId cannot be found

addGroup

RemoteGroup addGroup(long directoryID,
                     RemoteGroup group)
                     throws InvalidGroupException,
                            java.rmi.RemoteException,
                            DirectoryPermissionException,
                            ObjectNotFoundException
Will add a RemoteGroup to the directory specified by the passed in directoryId param.

Parameters:
directoryID - the directory to add the RemoteGroup too.
group - the RemoteGroup to add.
Returns:
the RemoteGroup that was added
Throws:
InvalidGroupException - if the group with the given name already exists.
java.rmi.RemoteException - if there was an error adding the RemoteGroup or instantiating the Directory
DirectoryPermissionException - if there is no ADD_GROUP permission for the given directory
ObjectNotFoundException - if the directory with the given id cannot be found.

findDirectoryByID

Directory findDirectoryByID(long directoryID)
                            throws ObjectNotFoundException
Will return a Directory based on the passed in directoryId

Parameters:
directoryID - the id of the directory to find
Returns:
the directory
Throws:
ObjectNotFoundException - is thrown if the Directory cannot be found.

invalidateToken

void invalidateToken(java.lang.String token)
Will attempt to invalidate a Token based on the passed in Token key

Parameters:
token - the token key to invalidate

searchDirectories

java.util.List<Directory> searchDirectories(SearchContext searchContext)
Will return a List of Directories for the given SearchContext

Parameters:
searchContext - the context to search on
Returns:
a List of directories, or an Empty List of none are found

findDirectoryByName

Directory findDirectoryByName(java.lang.String name)
                              throws ObjectNotFoundException
Will find a directory given the supplied name

Parameters:
name - the name of the directory
Returns:
the directory with the given name
Throws:
ObjectNotFoundException - if no Directory is found

updateDirectory

Directory updateDirectory(Directory directory)
                          throws ObjectNotFoundException
Will update the passed in directory

Parameters:
directory - the directory with updated attrbutes
Returns:
the updated directory
Throws:
ObjectNotFoundException - if no Directory is found

removeDirectory

void removeDirectory(Directory directory)
                     throws DirectoryManagerException,
                            ObjectNotFoundException
Will remove a given directory and all its associated entities, groups, roles, principals and mappings

Parameters:
directory - the directory to remove
Throws:
DirectoryManagerException - if there was a generic error removing the directory
ObjectNotFoundException - if the directory cannot be found

searchGroups

java.util.List<RemoteGroup> searchGroups(SearchContext searchContext)
                                         throws DirectoryManagerException,
                                                java.rmi.RemoteException
Throws:
DirectoryManagerException
java.rmi.RemoteException

searchRoles

java.util.List<RemoteRole> searchRoles(SearchContext searchContext)
                                       throws DirectoryManagerException,
                                              java.rmi.RemoteException
Throws:
DirectoryManagerException
java.rmi.RemoteException

searchPrincipals

java.util.List<RemotePrincipal> searchPrincipals(SearchContext searchContext)
                                                 throws DirectoryManagerException,
                                                        java.rmi.RemoteException
Throws:
DirectoryManagerException
java.rmi.RemoteException

findGroupByName

RemoteGroup findGroupByName(long directoryID,
                            java.lang.String name)
                            throws ObjectNotFoundException,
                                   java.rmi.RemoteException
Will return a RemoteGroup, with all members populated. If there are nested groups (ie, groups that are a member of this group), those groups will be recursively searched and a distinct list of all members will be obtained.

Parameters:
directoryID - The ID of the directory to search
name - The name of the group whose details we're after
Returns:
A populated RemoteGroup containing details and members.
Throws:
ObjectNotFoundException
java.rmi.RemoteException

findGroupByName

RemoteGroup findGroupByName(long directoryID,
                            java.lang.String name,
                            boolean onlyFetchDirectMembers)
                            throws ObjectNotFoundException,
                                   java.rmi.RemoteException
Will return a RemoteGroup with members populated. If onlyFetchDirectMembers is true, the members will be those objects that are direct members of the group. This means that you could see RemoteGroups in the response. If onlyFetchDirectMembers is false, it behaves identically to its overloaded cousin.

Parameters:
directoryID -
name -
onlyFetchDirectMembers -
Returns:
Throws:
ObjectNotFoundException
java.rmi.RemoteException

findRoleByName

RemoteRole findRoleByName(long directoryID,
                          java.lang.String name)
                          throws ObjectNotFoundException,
                                 java.rmi.RemoteException
Throws:
ObjectNotFoundException
java.rmi.RemoteException

updateGroup

RemoteGroup updateGroup(long directoryID,
                        RemoteGroup group)
                        throws ObjectNotFoundException,
                               java.rmi.RemoteException,
                               DirectoryPermissionException
Throws:
ObjectNotFoundException
java.rmi.RemoteException
DirectoryPermissionException

addRole

RemoteRole addRole(long directoryID,
                   RemoteRole role)
                   throws InvalidRoleException,
                          java.rmi.RemoteException,
                          DirectoryPermissionException,
                          ObjectNotFoundException
Will add a RemoteRole to the given directory

Parameters:
directoryID - the directory to add the role too.
role - the RemoteRole to add
Returns:
the added RemoteRole
Throws:
InvalidRoleException - thrown if the role already exists
java.rmi.RemoteException - if there is an error instansiating the directory or adding the RemoteRole
DirectoryPermissionException - if there is no ADD_ROLE permission for the given directory
ObjectNotFoundException - if the diretory with the given id cannot be found.

updateRole

RemoteRole updateRole(long directoryID,
                      RemoteRole role)
                      throws ObjectNotFoundException,
                             java.rmi.RemoteException,
                             DirectoryPermissionException
Throws:
ObjectNotFoundException
java.rmi.RemoteException
DirectoryPermissionException

removeGroup

void removeGroup(long directoryID,
                 java.lang.String name)
                 throws ObjectNotFoundException,
                        DirectoryPermissionException,
                        java.rmi.RemoteException
Throws:
ObjectNotFoundException
DirectoryPermissionException
java.rmi.RemoteException

removeRole

void removeRole(long directoryID,
                java.lang.String name)
                throws ObjectNotFoundException,
                       DirectoryPermissionException,
                       java.rmi.RemoteException
Throws:
ObjectNotFoundException
DirectoryPermissionException
java.rmi.RemoteException

removePrincipalFromGroup

void removePrincipalFromGroup(long directoryID,
                              java.lang.String name,
                              java.lang.String unsubscribedGroup)
                              throws ObjectNotFoundException,
                                     java.rmi.RemoteException,
                                     DirectoryPermissionException
Throws:
ObjectNotFoundException
java.rmi.RemoteException
DirectoryPermissionException

removePrincipalFromRole

void removePrincipalFromRole(long directoryID,
                             java.lang.String name,
                             java.lang.String removeRole)
                             throws ObjectNotFoundException,
                                    java.rmi.RemoteException,
                                    DirectoryPermissionException
Throws:
ObjectNotFoundException
java.rmi.RemoteException
DirectoryPermissionException

removePrincipal

void removePrincipal(long directoryID,
                     java.lang.String name)
                     throws ObjectNotFoundException,
                            DirectoryPermissionException,
                            java.rmi.RemoteException
Throws:
ObjectNotFoundException
DirectoryPermissionException
java.rmi.RemoteException

findPrincipalByName

RemotePrincipal findPrincipalByName(long directoryID,
                                    java.lang.String username)
                                    throws ObjectNotFoundException,
                                           java.rmi.RemoteException
Throws:
ObjectNotFoundException
java.rmi.RemoteException

updatePrincipal

RemotePrincipal updatePrincipal(long directoryID,
                                RemotePrincipal principal)
                                throws ObjectNotFoundException,
                                       java.rmi.RemoteException,
                                       DirectoryPermissionException
Throws:
ObjectNotFoundException
java.rmi.RemoteException
DirectoryPermissionException

addPrincipalToGroup

void addPrincipalToGroup(long directoryID,
                         java.lang.String name,
                         java.lang.String groupName)
                         throws ObjectNotFoundException,
                                java.rmi.RemoteException,
                                DirectoryPermissionException
Throws:
ObjectNotFoundException
java.rmi.RemoteException
DirectoryPermissionException

addPrincipalToRole

void addPrincipalToRole(long directoryID,
                        java.lang.String name,
                        java.lang.String unsubscribedRole)
                        throws ObjectNotFoundException,
                               java.rmi.RemoteException,
                               DirectoryPermissionException
Throws:
ObjectNotFoundException
java.rmi.RemoteException
DirectoryPermissionException

searchTokens

java.util.List<Token> searchTokens(SearchContext searchContext)
                                   throws DirectoryManagerException
Throws:
DirectoryManagerException

expireToken

void expireToken(java.lang.String key)
                 throws ObjectNotFoundException,
                        DirectoryManagerException
Throws:
ObjectNotFoundException
DirectoryManagerException

removeExpiredTokens

void removeExpiredTokens()
                         throws DirectoryManagerException
Throws:
DirectoryManagerException

resetPassword

void resetPassword(long directoryID,
                   java.lang.String name)
                   throws ObjectNotFoundException,
                          java.rmi.RemoteException,
                          InvalidEmailAddressException,
                          DirectoryPermissionException,
                          InvalidCredentialException
Throws:
ObjectNotFoundException
java.rmi.RemoteException
InvalidEmailAddressException
DirectoryPermissionException
InvalidCredentialException

isRoleMember

boolean isRoleMember(long directoryID,
                     java.lang.String role,
                     java.lang.String username)
                     throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException

isGroupMember

boolean isGroupMember(long directoryID,
                      java.lang.String group,
                      java.lang.String username)
                      throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException

findPrincipalByToken

RemotePrincipal findPrincipalByToken(java.lang.String key)
                                     throws InvalidTokenException,
                                            java.rmi.RemoteException
Will find a principal via the passed in token key

Parameters:
key - the token key
Returns:
the RemotePrincipal associated to the given token key
Throws:
InvalidTokenException - if the RemotePrincipal or Directory cannot be found that relates to the given token, or the token is associated to an Application and not a RemotePrincipal
java.rmi.RemoteException - if there was an issue accessing the underlying directory

updatePrincipalCredential

void updatePrincipalCredential(long directoryID,
                               java.lang.String principal,
                               PasswordCredential credential)
                               throws java.rmi.RemoteException,
                                      DirectoryPermissionException,
                                      InvalidCredentialException,
                                      ObjectNotFoundException
This will update the Principals credentials in the given directory

Parameters:
directoryID - the directory the principal belongs too
principal - the principals username
credential - the updated password credential for the principal
Throws:
java.rmi.RemoteException - if there was an error instansiating or accessing the underlying directory
DirectoryPermissionException - if there is no MODIFY_PRINCIPAL permission for the given directory
InvalidCredentialException - if the Principal's credential does not meet the validation requirements for the given directory
ObjectNotFoundException - if the directory of principal cannot be found

findGroupMemberships

java.util.List<RemoteGroup> findGroupMemberships(long directoryID,
                                                 java.lang.String principal)
                                                 throws ObjectNotFoundException,
                                                        java.rmi.RemoteException
Finds all of the group memberships for a given principal.

Parameters:
directoryID - The directory to search.
principal - The principal name.
Returns:
A list of groups the principal is a member of.
Throws:
ObjectNotFoundException - Unable to find the principal in the specified diretory.
java.rmi.RemoteException - generic exception on the remote directory.

findRoleMemberships

java.util.List<RemoteRole> findRoleMemberships(long directoryID,
                                               java.lang.String principal)
                                               throws ObjectNotFoundException,
                                                      java.rmi.RemoteException
Finds all of the role memberships for a given principal.

Parameters:
directoryID - The directory to search.
principal - The principal name.
Returns:
A list of roles the principal is a member of.
Throws:
ObjectNotFoundException - Unable to find the principal in the specified diretory.
java.rmi.RemoteException - generic exception on the remote directory.

addPrincipalAttribute

void addPrincipalAttribute(long directoryID,
                           RemotePrincipal principal,
                           java.lang.String attribute,
                           AttributeValues values)
                           throws java.rmi.RemoteException,
                                  DirectoryPermissionException,
                                  ObjectNotFoundException
Will add a given attribute and its values to a given principal, in the specified directory.

Parameters:
directoryID - the directory id that the principal should belong too
principal - the RemotePrincipal to associate the attribute and its values too.
attribute - the attribute that you are adding
values - the values of the given attribute
Throws:
java.rmi.RemoteException - if there was an error instansitating the directory or updating the principal
DirectoryPermissionException - if the directory doesn't have the PermissionType.MODIFY_PRINCIPAL permission
ObjectNotFoundException - if the directory or RemotePrincipal cannot be found

removePrincipalAttribute

void removePrincipalAttribute(long directoryID,
                              RemotePrincipal principal,
                              java.lang.String attribute)
                              throws java.rmi.RemoteException,
                                     DirectoryPermissionException,
                                     ObjectNotFoundException
Will remove the given attribute from the given RemotePrincipal, in the specified directory

Parameters:
directoryID - the directory id that the principal should belong too
principal - the RemotePrincipal to remote the attribute from
attribute - the attribute to remove
Throws:
java.rmi.RemoteException - if there was an error instansitating the directory or updating the principal
DirectoryPermissionException - if the directory doesn't have the PermissionType.MODIFY_PRINCIPAL permission
ObjectNotFoundException - if the directory or RemotePrincipal cannot be found

addAllPrincipals

BulkAddResult<RemotePrincipal> addAllPrincipals(long directoryID,
                                                java.util.Collection<RemotePrincipal> principals,
                                                boolean overwrite)
                                                throws DirectoryPermissionException,
                                                       java.rmi.RemoteException,
                                                       ObjectNotFoundException
Will add a collection of RemotePrincipal to the directory specified by the passed in directoryId param. If adding a principal fails then this principal will be skipped and the error will be reported in the logs.

Parameters:
directoryID - the directory to add the RemotePrincipal too.
principals - the RemotePrincipals to add.
overwrite - true if you want to remove any existing principal matching a username in the principals to add prior to adding the user. false if you want to skip over principals that already exist (same username exists).
Returns:
results for bulk add process.
Throws:
java.rmi.RemoteException - if there was an error adding the RemotePrincipal or instantiating the Directory
DirectoryPermissionException - if there is no ADD_PRINCIPAL permission for the given directory
ObjectNotFoundException - if the directory with the given directoryId cannot be found

addAllGroups

BulkAddResult<RemoteGroup> addAllGroups(long directoryID,
                                        java.util.Collection<RemoteGroup> groups,
                                        boolean overwrite)
                                        throws DirectoryPermissionException,
                                               java.rmi.RemoteException,
                                               ObjectNotFoundException
Will add a collection of RemoteGroup to the directory specified by the passed in directoryId param. If adding a group fails then this principal will be skipped and the error will be reported in the logs.

Parameters:
directoryID - the directory to add the RemoteGroup too.
groups - the RemoteGroups to add.
overwrite - true if you want to remove any existing group matching a username in the groups to add prior to adding the group. false if you want to skip over groups that already exist (same group name exists).
Returns:
results for bulk add process.
Throws:
java.rmi.RemoteException - if there was an error adding the RemoteGroup or instantiating the Directory
DirectoryPermissionException - if there is no ADD_GROUP permission for the given directory
ObjectNotFoundException - if the directory with the given directoryId cannot be found

addAllRoles

BulkAddResult<RemoteRole> addAllRoles(long directoryID,
                                      java.util.Collection<RemoteRole> roles,
                                      boolean overwrite)
                                      throws DirectoryPermissionException,
                                             java.rmi.RemoteException,
                                             ObjectNotFoundException
Will add a collection of RemoteRole to the directory specified by the passed in directoryId param. If adding a role fails then this principal will be skipped and the error will be reported in the logs.

Parameters:
directoryID - the directory to add the RemoteRole too.
roles - the RemoteRoles to add.
overwrite - true if you want to remove any existing role matching a username in the roles to add prior to adding the role. false if you want to skip over roles that already exist (same role name exists).
Returns:
results for bulk add process.
Throws:
java.rmi.RemoteException - if there was an error adding the RemoteRole or instantiating the Directory
DirectoryPermissionException - if there is no ADD_ROLE permission for the given directory
ObjectNotFoundException - if the directory with the given directoryId cannot be found

addAllPrincipalsToGroup

BulkAddResult<java.lang.String> addAllPrincipalsToGroup(long directoryID,
                                                        java.util.Collection<java.lang.String> principalNames,
                                                        java.lang.String groupName)
                                                        throws DirectoryPermissionException,
                                                               java.rmi.RemoteException,
                                                               ObjectNotFoundException
A bulk version of addPrincipalToGroup. If creating a particular membership fails, it will be skipped and the error will be reported in the logs.

Parameters:
directoryID - the directory to add the membership to.
principalNames - usernames of users to add membership to.
groupName - name of group to add users to.
Returns:
results for bulk add process consisting of the names of the principals which could not be added to the group.
Throws:
java.rmi.RemoteException - if there was an error adding the RemoteRole or instantiating the Directory
DirectoryPermissionException - if there is no ADD_ROLE permission for the given directory
ObjectNotFoundException - if the directory with the given directoryId cannot be found

addAllPrincipalsToRole

BulkAddResult<java.lang.String> addAllPrincipalsToRole(long directoryID,
                                                       java.util.Collection<java.lang.String> principalNames,
                                                       java.lang.String roleName)
                                                       throws DirectoryPermissionException,
                                                              java.rmi.RemoteException,
                                                              ObjectNotFoundException
A bulk version of addPrincipalToRole. If creating a particular membership fails, it will be skipped and the error will be reported in the logs.

Parameters:
directoryID - the directory to add the membership to.
principalNames - usernames of users to add membership to.
roleName - name of role to add users to.
Returns:
results for bulk add process.
Throws:
java.rmi.RemoteException - if there was an error adding the RemoteRole or instantiating the Directory
DirectoryPermissionException - if there is no ADD_ROLE permission for the given directory
ObjectNotFoundException - if the directory with the given directoryId cannot be found


Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.