org.jasig.portal.groups.ldap
Class LDAPGroupStore

java.lang.Object
  extended by org.jasig.portal.groups.ldap.LDAPGroupStore
All Implemented Interfaces:
IEntityGroupStore, IEntitySearcher, IEntityStore, IGroupConstants

public class LDAPGroupStore
extends java.lang.Object
implements IEntityGroupStore, IEntityStore, IEntitySearcher

LDAPGroupStore.

Version:
$Revision: 1.20 $
Author:
Alex Vidgor

Nested Class Summary
protected  class LDAPGroupStore.EntitySet
           
protected  class LDAPGroupStore.GroupShadow
           
 
Field Summary
protected  SmartCache contexts
           
protected static short ELEMENT_NODE
           
protected static java.lang.Class group
           
protected  java.util.HashMap groups
           
protected static java.lang.Class iperson
           
protected  java.lang.String keyfield
           
private static org.apache.commons.logging.Log log
           
protected  java.lang.String logonid
           
protected  java.lang.String logonpassword
           
protected  java.lang.String namefield
           
protected  SmartCache personkeys
           
protected  java.lang.String url
           
protected  java.lang.String usercontext
           
 
Fields inherited from interface org.jasig.portal.groups.IGroupConstants
CHANNEL_CATEGORIES, CONTAINS, ENDS_WITH, EVERYONE, IS, NODE_SEPARATOR, PORTAL_ADMINISTRATORS, STARTS_WITH
 
Constructor Summary
LDAPGroupStore()
           
LDAPGroupStore(org.w3c.dom.Document config)
           
 
Method Summary
 boolean contains(IEntityGroup group, IGroupMember member)
          Answers if group contains member.
 boolean containsGroupNamed(IEntityGroup group, java.lang.String name)
          Answers if group contains a member group named name.
 void delete(IEntityGroup group)
          Delete this IEntityGroup from the data store.
 IEntityGroup find(java.lang.String key)
          Returns an instance of the IEntityGroup from the data store.
 java.util.Iterator findContainingGroups(IGroupMember gm)
          Returns an Iterator over the Collection of IEntityGroups that the IGroupMember belongs to.
 java.util.Iterator findEntitiesForGroup(IEntityGroup group)
          Returns an Iterator over the Collection of IEntities that are members of this IEntityGroup.
 ILockableEntityGroup findLockable(java.lang.String key)
          Returns an instance of the ILockableEntityGroup from the data store.
 java.lang.String[] findMemberGroupKeys(IEntityGroup group)
          Returns a String[] containing the keys of IEntityGroups that are members of this IEntityGroup.
 java.util.Iterator findMemberGroups(IEntityGroup group)
          Returns an Iterator over the Collection of IEntityGroups that are members of this IEntityGroup.
protected  javax.naming.directory.DirContext getConnection()
           
protected  LDAPGroupStore.GroupShadow[] getGroupShadows()
           
protected  java.lang.String[] getPersonKeys(java.lang.String groupKey)
           
protected  LDAPGroupStore.GroupShadow getShadow(IEntityGroup group)
           
protected  void init(org.w3c.dom.Document config)
           
protected  IEntityGroup makeGroup(LDAPGroupStore.GroupShadow shadow)
           
 IEntityGroup newInstance(java.lang.Class entityType)
           
 IEntity newInstance(java.lang.String key)
           
 IEntity newInstance(java.lang.String key, java.lang.Class type)
           
protected  void processLdapResults(javax.naming.NamingEnumeration results, java.util.ArrayList keys)
           
protected  LDAPGroupStore.GroupShadow processXmlGroupRecursive(org.w3c.dom.Element groupElem)
           
 EntityIdentifier[] searchForEntities(java.lang.String query, int method, java.lang.Class type)
          Find EntityIdentifiers for entities whose name matches the query string according to the specified method and is of the specified type
 EntityIdentifier[] searchForGroups(java.lang.String query, int method, java.lang.Class leaftype)
          Find EntityIdentifiers for groups whose name matches the query string according to the specified method and matches the provided leaf type
 void update(IEntityGroup group)
          Adds or updates the IEntityGroup AND ITS MEMBERSHIPS to the data store, as appropriate.
 void updateMembers(IEntityGroup group)
          Commits the group memberships of the IEntityGroup to the data store.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final org.apache.commons.logging.Log log

url

protected java.lang.String url

logonid

protected java.lang.String logonid

logonpassword

protected java.lang.String logonpassword

keyfield

protected java.lang.String keyfield

namefield

protected java.lang.String namefield

usercontext

protected java.lang.String usercontext

groups

protected java.util.HashMap groups

contexts

protected SmartCache contexts

personkeys

protected SmartCache personkeys

iperson

protected static java.lang.Class iperson

group

protected static java.lang.Class group

ELEMENT_NODE

protected static short ELEMENT_NODE
Constructor Detail

LDAPGroupStore

public LDAPGroupStore()

LDAPGroupStore

public LDAPGroupStore(org.w3c.dom.Document config)
Method Detail

init

protected void init(org.w3c.dom.Document config)

getPersonKeys

protected java.lang.String[] getPersonKeys(java.lang.String groupKey)

processXmlGroupRecursive

protected LDAPGroupStore.GroupShadow processXmlGroupRecursive(org.w3c.dom.Element groupElem)

processLdapResults

protected void processLdapResults(javax.naming.NamingEnumeration results,
                                  java.util.ArrayList keys)

getConnection

protected javax.naming.directory.DirContext getConnection()

makeGroup

protected IEntityGroup makeGroup(LDAPGroupStore.GroupShadow shadow)
                          throws GroupsException
Throws:
GroupsException

getShadow

protected LDAPGroupStore.GroupShadow getShadow(IEntityGroup group)

delete

public void delete(IEntityGroup group)
            throws GroupsException
Description copied from interface: IEntityGroupStore
Delete this IEntityGroup from the data store.

Specified by:
delete in interface IEntityGroupStore
Parameters:
group - org.jasig.portal.groups.IEntityGroup
Throws:
GroupsException

find

public IEntityGroup find(java.lang.String key)
                  throws GroupsException
Description copied from interface: IEntityGroupStore
Returns an instance of the IEntityGroup from the data store.

Specified by:
find in interface IEntityGroupStore
Parameters:
key - java.lang.String
Returns:
org.jasig.portal.groups.IEntityGroup
Throws:
GroupsException

findContainingGroups

public java.util.Iterator findContainingGroups(IGroupMember gm)
                                        throws GroupsException
Description copied from interface: IEntityGroupStore
Returns an Iterator over the Collection of IEntityGroups that the IGroupMember belongs to.

Specified by:
findContainingGroups in interface IEntityGroupStore
Parameters:
gm - org.jasig.portal.groups.IEntityGroup
Returns:
java.util.Iterator
Throws:
GroupsException

findMemberGroupKeys

public java.lang.String[] findMemberGroupKeys(IEntityGroup group)
                                       throws GroupsException
Description copied from interface: IEntityGroupStore
Returns a String[] containing the keys of IEntityGroups that are members of this IEntityGroup. In a composite group system, a group may contain a member group from a different service. This is called a foreign membership, and is only possible in an internally-managed service. A group store in such a service can return the key of a foreign member group, but not the group itself, which can only be returned by its local store.

Specified by:
findMemberGroupKeys in interface IEntityGroupStore
Parameters:
group - org.jasig.portal.groups.IEntityGroup
Returns:
String[]
Throws:
GroupsException

findMemberGroups

public java.util.Iterator findMemberGroups(IEntityGroup group)
                                    throws GroupsException
Description copied from interface: IEntityGroupStore
Returns an Iterator over the Collection of IEntityGroups that are members of this IEntityGroup.

Specified by:
findMemberGroups in interface IEntityGroupStore
Parameters:
group - org.jasig.portal.groups.IEntityGroup
Returns:
java.util.Iterator
Throws:
GroupsException

newInstance

public IEntityGroup newInstance(java.lang.Class entityType)
                         throws GroupsException
Specified by:
newInstance in interface IEntityGroupStore
Returns:
org.jasig.portal.groups.IEntityGroup
Throws:
GroupsException

update

public void update(IEntityGroup group)
            throws GroupsException
Description copied from interface: IEntityGroupStore
Adds or updates the IEntityGroup AND ITS MEMBERSHIPS to the data store, as appropriate.

Specified by:
update in interface IEntityGroupStore
Parameters:
group - org.jasig.portal.groups.IEntityGroup
Throws:
GroupsException

updateMembers

public void updateMembers(IEntityGroup group)
                   throws GroupsException
Description copied from interface: IEntityGroupStore
Commits the group memberships of the IEntityGroup to the data store.

Specified by:
updateMembers in interface IEntityGroupStore
Parameters:
group - org.jasig.portal.groups.IEntityGroup
Throws:
GroupsException

findLockable

public ILockableEntityGroup findLockable(java.lang.String key)
                                  throws GroupsException
Description copied from interface: IEntityGroupStore
Returns an instance of the ILockableEntityGroup from the data store.

Specified by:
findLockable in interface IEntityGroupStore
Parameters:
key - java.lang.String
Returns:
org.jasig.portal.groups.IEntityGroup
Throws:
GroupsException

getGroupShadows

protected LDAPGroupStore.GroupShadow[] getGroupShadows()

searchForGroups

public EntityIdentifier[] searchForGroups(java.lang.String query,
                                          int method,
                                          java.lang.Class leaftype)
                                   throws GroupsException
Description copied from interface: IEntityGroupStore
Find EntityIdentifiers for groups whose name matches the query string according to the specified method and matches the provided leaf type

Specified by:
searchForGroups in interface IEntityGroupStore
Throws:
GroupsException

findEntitiesForGroup

public java.util.Iterator findEntitiesForGroup(IEntityGroup group)
                                        throws GroupsException
Description copied from interface: IEntityGroupStore
Returns an Iterator over the Collection of IEntities that are members of this IEntityGroup.

Specified by:
findEntitiesForGroup in interface IEntityGroupStore
Parameters:
group - org.jasig.portal.groups.IEntityGroup
Returns:
java.util.Iterator
Throws:
GroupsException

newInstance

public IEntity newInstance(java.lang.String key)
                    throws GroupsException
Specified by:
newInstance in interface IEntityStore
Parameters:
key - java.lang.String
Returns:
org.jasig.portal.groups.IEntity
Throws:
GroupsException

newInstance

public IEntity newInstance(java.lang.String key,
                           java.lang.Class type)
                    throws GroupsException
Specified by:
newInstance in interface IEntityStore
Parameters:
key - java.lang.String - the entity's key
type - java.lang.Class - the entity's Type
Returns:
org.jasig.portal.groups.IEntity
Throws:
GroupsException

searchForEntities

public EntityIdentifier[] searchForEntities(java.lang.String query,
                                            int method,
                                            java.lang.Class type)
                                     throws GroupsException
Description copied from interface: IEntitySearcher
Find EntityIdentifiers for entities whose name matches the query string according to the specified method and is of the specified type

Specified by:
searchForEntities in interface IEntitySearcher
Throws:
GroupsException

contains

public boolean contains(IEntityGroup group,
                        IGroupMember member)
                 throws GroupsException
Answers if group contains member.

Specified by:
contains in interface IEntityGroupStore
Parameters:
group - org.jasig.portal.groups.IEntityGroup
member - org.jasig.portal.groups.IGroupMember
Returns:
boolean
Throws:
GroupsException

containsGroupNamed

public boolean containsGroupNamed(IEntityGroup group,
                                  java.lang.String name)
                           throws GroupsException
Answers if group contains a member group named name.

Parameters:
group - org.jasig.portal.groups.IEntityGroup
name - java.lang.String
Returns:
boolean
Throws:
GroupsException