com.atlassian.crowd.integration.directory.internal
Class InternalDirectory

java.lang.Object
  extended by com.atlassian.crowd.integration.model.DirectoryEntity
      extended by com.atlassian.crowd.integration.directory.internal.InternalDirectory
All Implemented Interfaces:
RemoteDirectory, Serializable

public class InternalDirectory
extends DirectoryEntity
implements RemoteDirectory

Internal directory connector. Stores all entity information to the database used by the crowd server.

Version:
1.0
Author:
Justen Stepka
See Also:
Serialized Form

Field Summary
static String ATTRIBUTE_PASSWORD_HISTORY_COUNT
           
static String ATTRIBUTE_PASSWORD_MAX_ATTEMPTS
           
static String ATTRIBUTE_PASSWORD_MAX_CHANGE_TIME
           
static String ATTRIBUTE_PASSWORD_REGEX
           
static String EMAIL_REGEX
           
static String NAME
           
 
Fields inherited from class com.atlassian.crowd.integration.model.DirectoryEntity
active, attributes, conception, description, directoryID, ID, lastModified, name
 
Fields inherited from interface com.atlassian.crowd.integration.directory.RemoteDirectory
DIRECTORY_TYPE
 
Constructor Summary
InternalDirectory()
           
 
Method Summary
 RemoteGroup addGroup(RemoteGroup group)
          Adds a group to the directory store.
 RemotePrincipal addPrincipal(RemotePrincipal principal)
          Adds a principal to the directory store.
 void addPrincipalToGroup(String name, String unsubscribedGroup)
          Adds a principal to a group.
 void addPrincipalToRole(String name, String unsubscribedRole)
          Adds a principal to a role.
 RemoteRole addRole(RemoteRole role)
          Adds a role to the directory store.
 RemotePrincipal authenticate(String name, PasswordCredential[] credentials)
          Authenticates a principal verses the directory store.
 RemoteGroup findGroupByName(String name)
          Finds the group that matches the supplied name.
 List findGroupMemberships(String principalName)
          Returns a list of group names that a principal is a member of.
 RemotePrincipal findPrincipalByName(String username)
          Finds the principal that matches the supplied name.
 RemoteRole findRoleByName(String name)
          Finds the role that matches the supplied name.
 List findRoleMemberships(String principalName)
          Returns a list of role names that a principal is a member of.
 long getDirectoryID()
          Sets the internal directory of the entity is mapped too.
 String getDirectoryType()
          Returns the DIRECTORY_TYPE name of the implementation.
 boolean isGroupMember(String group, String principal)
          Checks if a principal is a member of a group.
 boolean isRoleMember(String role, String username)
          Checks if a principal is a member of a role.
 void processAuthentication(PasswordCredential[] credentials, RemotePrincipal principal)
           
 void removeGroup(String name)
          Removes the role that matches the supplied name.
 void removePrincipal(String name)
          Removes the principal that matches the supplied name.
 void removePrincipalFromGroup(String name, String unsubscribedGroup)
          Removes a principal from a group.
 void removePrincipalFromRole(String name, String removeRole)
          Removes a principal from a role.
 void removeRole(String name)
          Removes the group that matches the supplied name.
 List searchGroups(SearchContext searchContext)
          Searches for all principals who match the supplied search criteria.
 List searchPrincipals(SearchContext searchContext)
          Search for all principals who match the supplied search criteria.
 List searchRoles(SearchContext searchContext)
          Search for all roles who match the supplied search criteria.
 void setDirectoryDAO(DirectoryDAO directoryDAO)
           
 void setDirectoryID(long directoryID)
          Gets the internal directory of the entity is mapped too.
 void setGroupDAO(GroupDAO groupDAO)
           
 void setPasswordHelper(PasswordHelper passwordHelper)
           
 void setPrincipalDAO(PrincipalDAO principalDAO)
           
 void setRoleDAO(RoleDAO roleDAO)
           
 void testConnection()
          Test if a connection to the directory server can be established.
 RemoteGroup updateGroup(RemoteGroup group)
          Updates the group by the name attribute.
 RemotePrincipal updatePrincipal(RemotePrincipal principal)
          Updates the principal by the name attribute.
 void updatePrincipalCredential(String name, PasswordCredential credential)
          Updates the password credential for a principal.
 RemoteRole updateRole(RemoteRole role)
          Updates the role by the name attribute.
 
Methods inherited from class com.atlassian.crowd.integration.model.DirectoryEntity
equals, getAttribute, getAttributes, getConception, getDescription, getID, getLastModified, getName, hashCode, isActive, setActive, setAttribute, setAttribute, setAttributes, setConception, setDescription, setID, setLastModified, setName, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.atlassian.crowd.integration.directory.RemoteDirectory
getAttributes, getID, setAttributes, setID
 

Field Detail

NAME

public static final String NAME
See Also:
Constant Field Values

EMAIL_REGEX

public static final String EMAIL_REGEX
See Also:
Constant Field Values

ATTRIBUTE_PASSWORD_REGEX

public static final String ATTRIBUTE_PASSWORD_REGEX
See Also:
Constant Field Values

ATTRIBUTE_PASSWORD_MAX_ATTEMPTS

public static final String ATTRIBUTE_PASSWORD_MAX_ATTEMPTS
See Also:
Constant Field Values

ATTRIBUTE_PASSWORD_HISTORY_COUNT

public static final String ATTRIBUTE_PASSWORD_HISTORY_COUNT
See Also:
Constant Field Values

ATTRIBUTE_PASSWORD_MAX_CHANGE_TIME

public static final String ATTRIBUTE_PASSWORD_MAX_CHANGE_TIME
See Also:
Constant Field Values
Constructor Detail

InternalDirectory

public InternalDirectory()
Method Detail

getDirectoryID

public long getDirectoryID()
Description copied from class: DirectoryEntity
Sets the internal directory of the entity is mapped too.

Overrides:
getDirectoryID in class DirectoryEntity
Returns:
The directory ID.

setDirectoryID

public void setDirectoryID(long directoryID)
Description copied from class: DirectoryEntity
Gets the internal directory of the entity is mapped too.

Overrides:
setDirectoryID in class DirectoryEntity
Parameters:
directoryID - The directory ID.

getDirectoryType

public String getDirectoryType()
Description copied from interface: RemoteDirectory
Returns the DIRECTORY_TYPE name of the implementation.

Specified by:
getDirectoryType in interface RemoteDirectory
Returns:
The name of the implementation.

addPrincipal

public RemotePrincipal addPrincipal(RemotePrincipal principal)
                             throws InvalidPrincipalException,
                                    RemoteException,
                                    InvalidCredentialException
Description copied from interface: RemoteDirectory
Adds a principal to the directory store.

Specified by:
addPrincipal in interface RemoteDirectory
Parameters:
principal - The principal to add.
Returns:
The principal with any updated attributes.
Throws:
InvalidPrincipalException - The supplied principal is invalid.
RemoteException - An unknown remote exception occured.
InvalidCredentialException - The supplied credential(s) are invalid.

addGroup

public RemoteGroup addGroup(RemoteGroup group)
                     throws InvalidGroupException,
                            RemoteException
Description copied from interface: RemoteDirectory
Adds a group to the directory store.

Specified by:
addGroup in interface RemoteDirectory
Parameters:
group - The group to add.
Returns:
The group with any updated attributes.
Throws:
InvalidGroupException - The supplied group is invalid.
RemoteException - An unknown remote exception occured.

authenticate

public RemotePrincipal authenticate(String name,
                                    PasswordCredential[] credentials)
                             throws RemoteException,
                                    InvalidPrincipalException,
                                    InactiveAccountException,
                                    InvalidAuthenticationException
Description copied from interface: RemoteDirectory
Authenticates a principal verses the directory store.

Specified by:
authenticate in interface RemoteDirectory
Parameters:
name - The name of the principal.
credentials - The supplied credentials.
Returns:
The populated principal if the authentication is valid.
Throws:
RemoteException - An unknown remote exception occured.
InvalidPrincipalException - The supplied principal is invalid.
InactiveAccountException - The supplied principal is inactive.
InvalidAuthenticationException - The supplied authentication is invalid.

isGroupMember

public boolean isGroupMember(String group,
                             String principal)
                      throws RemoteException
Description copied from interface: RemoteDirectory
Checks if a principal is a member of a group.

Specified by:
isGroupMember in interface RemoteDirectory
Parameters:
group - The group name.
principal - The principal name.
Returns:
true if and only if the principal is a member of the group, otherwise false.
Throws:
RemoteException - An unknown remote exception occured.

isRoleMember

public boolean isRoleMember(String role,
                            String username)
                     throws RemoteException
Description copied from interface: RemoteDirectory
Checks if a principal is a member of a role.

Specified by:
isRoleMember in interface RemoteDirectory
Parameters:
role - The group name.
username - The principal name.
Returns:
true if and only if the principal is a member of the role, otherwise false.
Throws:
RemoteException - An unknown remote exception occured.

findGroupMemberships

public List findGroupMemberships(String principalName)
                          throws RemoteException,
                                 ObjectNotFoundException
Description copied from interface: RemoteDirectory
Returns a list of group names that a principal is a member of.

Specified by:
findGroupMemberships in interface RemoteDirectory
Returns:
List of group names.
Throws:
RemoteException - An unknown and remote exception occured.
ObjectNotFoundException

findRoleMemberships

public List findRoleMemberships(String principalName)
                         throws RemoteException,
                                ObjectNotFoundException
Description copied from interface: RemoteDirectory
Returns a list of role names that a principal is a member of.

Specified by:
findRoleMemberships in interface RemoteDirectory
Returns:
List of group names.
Throws:
RemoteException - An unknown and remote exception occured.
ObjectNotFoundException

searchGroups

public List searchGroups(SearchContext searchContext)
                  throws RemoteException
Description copied from interface: RemoteDirectory
Searches for all principals who match the supplied search criteria.

Specified by:
searchGroups in interface RemoteDirectory
Parameters:
searchContext - The search criteria.
Returns:
The search results.
Throws:
RemoteException - An unknown remote exception occured.

findGroupByName

public RemoteGroup findGroupByName(String name)
                            throws RemoteException,
                                   ObjectNotFoundException
Description copied from interface: RemoteDirectory
Finds the group that matches the supplied name.

Specified by:
findGroupByName in interface RemoteDirectory
Parameters:
name - The name of the group.
Returns:
The populated group.
Throws:
RemoteException - An unknown remote exception occured.
ObjectNotFoundException - The group does not exist.

updateGroup

public RemoteGroup updateGroup(RemoteGroup group)
                        throws RemoteException
Description copied from interface: RemoteDirectory
Updates the group by the name attribute.

Specified by:
updateGroup in interface RemoteDirectory
Parameters:
group - The group to update.
Returns:
The populated group.
Throws:
RemoteException - An unknown remote exception occured.

searchRoles

public List searchRoles(SearchContext searchContext)
                 throws RemoteException
Description copied from interface: RemoteDirectory
Search for all roles who match the supplied search criteria.

Specified by:
searchRoles in interface RemoteDirectory
Parameters:
searchContext - The search criteria.
Returns:
The search results.
Throws:
RemoteException - an unknown remote exception occured.

findRoleByName

public RemoteRole findRoleByName(String name)
                          throws RemoteException,
                                 ObjectNotFoundException
Description copied from interface: RemoteDirectory
Finds the role that matches the supplied name.

Specified by:
findRoleByName in interface RemoteDirectory
Parameters:
name - The name of the role.
Returns:
The populated role.
Throws:
RemoteException - An unknown remote exception occured.
ObjectNotFoundException - The role does not exist.

addRole

public RemoteRole addRole(RemoteRole role)
                   throws InvalidRoleException,
                          RemoteException
Description copied from interface: RemoteDirectory
Adds a role to the directory store.

Specified by:
addRole in interface RemoteDirectory
Parameters:
role - The role to add.
Returns:
The role with any updated attributes.
Throws:
InvalidRoleException - The supplied role is invalid.
RemoteException - An unknown remote exception occured.

updateRole

public RemoteRole updateRole(RemoteRole role)
                      throws RemoteException
Description copied from interface: RemoteDirectory
Updates the role by the name attribute.

Specified by:
updateRole in interface RemoteDirectory
Parameters:
role - The role to update.
Returns:
The populated role.
Throws:
RemoteException - An unknown remote exception occured.

removeGroup

public void removeGroup(String name)
                 throws RemoteException,
                        ObjectNotFoundException
Description copied from interface: RemoteDirectory
Removes the role that matches the supplied name.

Specified by:
removeGroup in interface RemoteDirectory
Parameters:
name - The name of the role.
Throws:
RemoteException - An unknown remote exception occured.
ObjectNotFoundException - The role does not exist.

removeRole

public void removeRole(String name)
                throws RemoteException,
                       ObjectNotFoundException
Description copied from interface: RemoteDirectory
Removes the group that matches the supplied name.

Specified by:
removeRole in interface RemoteDirectory
Parameters:
name - The name of the group.
Throws:
RemoteException - An unknown remote exception occured.
ObjectNotFoundException - The role does not exist.

searchPrincipals

public List searchPrincipals(SearchContext searchContext)
                      throws RemoteException
Description copied from interface: RemoteDirectory
Search for all principals who match the supplied search criteria.

Specified by:
searchPrincipals in interface RemoteDirectory
Parameters:
searchContext - The search criteria.
Returns:
The search results.
Throws:
RemoteException - an unknown remote exception occured.

findPrincipalByName

public RemotePrincipal findPrincipalByName(String username)
                                    throws RemoteException,
                                           ObjectNotFoundException
Description copied from interface: RemoteDirectory
Finds the principal that matches the supplied name.

Specified by:
findPrincipalByName in interface RemoteDirectory
Parameters:
username - The name of the principal.
Returns:
The populated principal.
Throws:
RemoteException - An unknown remote exception occured.
ObjectNotFoundException - The principal does not exist.

updatePrincipal

public RemotePrincipal updatePrincipal(RemotePrincipal principal)
                                throws RemoteException
Description copied from interface: RemoteDirectory
Updates the principal by the name attribute.

Specified by:
updatePrincipal in interface RemoteDirectory
Parameters:
principal - The principal to update.
Returns:
The populated principal.
Throws:
RemoteException - An unknown remote exception occured.

addPrincipalToGroup

public void addPrincipalToGroup(String name,
                                String unsubscribedGroup)
                         throws RemoteException
Description copied from interface: RemoteDirectory
Adds a principal to a group.

Specified by:
addPrincipalToGroup in interface RemoteDirectory
Parameters:
name - The name of the principal.
unsubscribedGroup - The name of the group.
Throws:
RemoteException - An unknown wire exception occured.

removePrincipalFromGroup

public void removePrincipalFromGroup(String name,
                                     String unsubscribedGroup)
                              throws RemoteException
Description copied from interface: RemoteDirectory
Removes a principal from a group.

Specified by:
removePrincipalFromGroup in interface RemoteDirectory
Parameters:
name - The name of the principal.
unsubscribedGroup - The name of the group.
Throws:
RemoteException - An unknown wire exception occured.

addPrincipalToRole

public void addPrincipalToRole(String name,
                               String unsubscribedRole)
                        throws RemoteException
Description copied from interface: RemoteDirectory
Adds a principal to a role.

Specified by:
addPrincipalToRole in interface RemoteDirectory
Parameters:
name - The name of the principal.
unsubscribedRole - The name of the role.
Throws:
RemoteException - An unknown wire exception occured.

removePrincipalFromRole

public void removePrincipalFromRole(String name,
                                    String removeRole)
                             throws RemoteException
Description copied from interface: RemoteDirectory
Removes a principal from a role.

Specified by:
removePrincipalFromRole in interface RemoteDirectory
Parameters:
name - The name of the principal.
removeRole - The name of the role.
Throws:
RemoteException - An unknown wire exception occured.

removePrincipal

public void removePrincipal(String name)
                     throws RemoteException,
                            ObjectNotFoundException
Description copied from interface: RemoteDirectory
Removes the principal that matches the supplied name.

Specified by:
removePrincipal in interface RemoteDirectory
Parameters:
name - The name of the principal.
Throws:
RemoteException - An unknown remote exception occured.
ObjectNotFoundException - The principal does not exist.

updatePrincipalCredential

public void updatePrincipalCredential(String name,
                                      PasswordCredential credential)
                               throws RemoteException,
                                      ObjectNotFoundException,
                                      InvalidCredentialException
Description copied from interface: RemoteDirectory
Updates the password credential for a principal.

Specified by:
updatePrincipalCredential in interface RemoteDirectory
Parameters:
name - The name of the principal.
credential - The new credential.
Throws:
RemoteException - An unknown remote exception occured.
ObjectNotFoundException - The principal does not exist.
InvalidCredentialException - The supplied credential is invalid.

testConnection

public void testConnection()
                    throws RemoteException
Description copied from interface: RemoteDirectory
Test if a connection to the directory server can be established.

Specified by:
testConnection in interface RemoteDirectory
Throws:
RemoteException - An unknown wire exception occured.

processAuthentication

public void processAuthentication(PasswordCredential[] credentials,
                                  RemotePrincipal principal)
                           throws InvalidAuthenticationException
Throws:
InvalidAuthenticationException

setPasswordHelper

public void setPasswordHelper(PasswordHelper passwordHelper)

setDirectoryDAO

public void setDirectoryDAO(DirectoryDAO directoryDAO)

setPrincipalDAO

public void setPrincipalDAO(PrincipalDAO principalDAO)

setRoleDAO

public void setRoleDAO(RoleDAO roleDAO)

setGroupDAO

public void setGroupDAO(GroupDAO groupDAO)


Copyright © 2006 Atlassian Software Systems. All Rights Reserved.