edu.internet2.middleware.ldappc.synchronize
Class GroupEntrySynchronizer

java.lang.Object
  extended by edu.internet2.middleware.ldappc.synchronize.GroupEntrySynchronizer

public class GroupEntrySynchronizer
extends Object

This synchronizes groups stored in the directory as entries.


Constructor Summary
GroupEntrySynchronizer(Ldappc ldappc, boolean provisionMemberDns)
          Constructs a GroupEntrySynchronizer.
 
Method Summary
protected  void addGroupEntry(Name groupDn, edu.internet2.middleware.grouper.Group group, Set<edu.internet2.middleware.grouper.Group> groups)
          This creates a new Group ldap entry.
protected  Name buildGroupDn(edu.internet2.middleware.grouper.Group group)
          This builds the DN of the given group.
protected  void buildStemOuEntries(edu.internet2.middleware.grouper.Group group)
          This builds the group's parent OU DN.
 String calculateLdif(edu.internet2.middleware.grouper.Group group, Set<edu.internet2.middleware.grouper.Group> groups)
          Create an LDIF representation of the given group.
protected  void clearRoot()
          This deletes any entries under the root entry are neither organizationalUnits nor have the same object class as a group entry.
protected  void commit()
          This commits any changes not already committed to the directory.
protected  String getErrorData(edu.internet2.middleware.grouper.Group group)
          Builds an error data string based on the objects provided.
protected  String getErrorData(edu.internet2.middleware.grouper.Member member)
          Builds an error data string based on the objects provided.
protected  String getErrorData(edu.internet2.middleware.subject.Subject subject)
          Builds an error data string based on the objects provided.
protected  void initGroupData(Name groupDn)
          This populates the instance variables with the current values from the group's LDAP entry.
protected  void initialize()
          Perform any initialization prior to processing the set of groups.
protected  void initializeInclude(edu.internet2.middleware.grouper.Group group)
          Initializes the attributes needed for holding data for the given group.
protected  void performInclude(edu.internet2.middleware.grouper.Group group, int status, Set<edu.internet2.middleware.grouper.Group> groups)
          This identifies the underlying group as one that must remain or, if need be, must be added to the subject's LDAP entry.
protected  void populate()
          This populates this object with the current values from the root's LDAP entry that are either organizational units or have a object class type of the group entry.
protected  void populateDns(Set<Name> dns, String filter, SearchControls searchControls)
          This populates the given Set with the DNs of any child entries of the root DN matching the given filter.
protected  void storeGroupData(edu.internet2.middleware.grouper.Group group, Set<edu.internet2.middleware.grouper.Group> groups)
          This stores the given Group's data in the AttributeModifiers.
protected  void storeObjectClassData()
          This stores the object class data from the configuration in the associated AttributeModifier.
 void synchronize(Set<edu.internet2.middleware.grouper.Group> groups)
          Synchronizes the group set with that in the directory.
protected  void updateGroupEntry(Name groupDn, edu.internet2.middleware.grouper.Group group, Set<edu.internet2.middleware.grouper.Group> groups)
          This updates the group's ldap entry with the current data.
protected  void updateProcessedOus(Name groupDn)
          This updates the list of processed OUs with those identified from the group's DN.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroupEntrySynchronizer

public GroupEntrySynchronizer(Ldappc ldappc,
                              boolean provisionMemberDns)
                       throws NamingException,
                              ConfigurationException
Constructs a GroupEntrySynchronizer.

Parameters:
ctx - Ldap context to be used for synchronizing
root - DN of the root element
configuration - Grouper provisioning configuration
options - Grouper provisioning options
subjectCache - Subject cache to speed subject retrieval
provisionMemberDns - will provision member DNs if true
Throws:
NamingException - Thrown when a naming exception occurs.
ConfigurationException - Thrown if the configuration file is not correct.
Method Detail

synchronize

public void synchronize(Set<edu.internet2.middleware.grouper.Group> groups)
                 throws NamingException,
                        LdappcException
Synchronizes the group set with that in the directory.

Parameters:
groups - Set of Groups
Throws:
NamingException - thrown if a Naming error occurs
MultiErrorException - thrown if one or more exceptions occurred that did not need to stop all processing
LdappcException - thrown if an error occurs

calculateLdif

public String calculateLdif(edu.internet2.middleware.grouper.Group group,
                            Set<edu.internet2.middleware.grouper.Group> groups)
                     throws LdappcException,
                            NamingException
Create an LDIF representation of the given group.

Parameters:
group -
Returns:
the LDIF
Throws:
LdappcException
NamingException

performInclude

protected void performInclude(edu.internet2.middleware.grouper.Group group,
                              int status,
                              Set<edu.internet2.middleware.grouper.Group> groups)
                       throws NamingException,
                              LdappcException
This identifies the underlying group as one that must remain or, if need be, must be added to the subject's LDAP entry. If the group has already been provisioned to the entry, it will remain within the subject's LDAP entry.

Parameters:
group - Group to be included
status - Either #STATUS_NEW, #STATUS_MODIFIED, #STATUS_UNCHANGED or #STATUS_UNKNOWN.
Throws:
NamingException - thrown if a Naming error occurs
LdappcException - thrown if an error occurs

updateGroupEntry

protected void updateGroupEntry(Name groupDn,
                                edu.internet2.middleware.grouper.Group group,
                                Set<edu.internet2.middleware.grouper.Group> groups)
                         throws NamingException
This updates the group's ldap entry with the current data.

Parameters:
groupDn - DN of the group entry
group - Group associated with the group entry
Throws:
NamingException - thrown if a Naming exception occurs

initGroupData

protected void initGroupData(Name groupDn)
                      throws NamingException
This populates the instance variables with the current values from the group's LDAP entry.

Parameters:
groupDn - DN of the group entry
Throws:
NamingException - thrown if a Naming error occurs

storeGroupData

protected void storeGroupData(edu.internet2.middleware.grouper.Group group,
                              Set<edu.internet2.middleware.grouper.Group> groups)
                       throws NamingException,
                              LdappcException
This stores the given Group's data in the AttributeModifiers. This stores both the object class data from the configuration and the Group data in the associated attribute modifiers.

Parameters:
group - Group
Throws:
NamingException - thrown if a naming error occurs
LdappcException

storeObjectClassData

protected void storeObjectClassData()
                             throws NamingException
This stores the object class data from the configuration in the associated AttributeModifier.

Throws:
NamingException - thrown if a naming exception occurs

addGroupEntry

protected void addGroupEntry(Name groupDn,
                             edu.internet2.middleware.grouper.Group group,
                             Set<edu.internet2.middleware.grouper.Group> groups)
                      throws NamingException
This creates a new Group ldap entry. The new entry is identified by groupDn and is populated from group.

Parameters:
groupDn - DN of the new entry
group - Group holding the data for the new entry
Throws:
NamingException - Thrown if a naming exception occurs.

buildGroupDn

protected Name buildGroupDn(edu.internet2.middleware.grouper.Group group)
                     throws NamingException,
                            LdappcException
This builds the DN of the given group. Also this populates the AttributeModifier with the Group's RDN value. In the event that the Group naming structure is bushy, this calls buildStemOuEntries(Group) to build the necessary organizationalUnit entries.

Parameters:
group - Group
Returns:
DN for the associated LDAP entry
Throws:
NamingException - thrown if a Naming error occurs.
LdappcException - thrown if the RDN attribute is not defined for the group.

buildStemOuEntries

protected void buildStemOuEntries(edu.internet2.middleware.grouper.Group group)
                           throws NamingException
This builds the group's parent OU DN. Also, if necessary, this builds any missing OU entries in the directory for the group's stem. The DNs of any newly created OUs are placed into the list of OUs to be deleted. They should be removed from the delete list and placed into the list of processed OUs when the group entry is successfully created.

Parameters:
group - Group
Throws:
NamingException - thrown if a Naming exception occured.
See Also:
updateProcessedOus(Name)

updateProcessedOus

protected void updateProcessedOus(Name groupDn)
This updates the list of processed OUs with those identified from the group's DN. Any of the OU DNs found in the list of OUs to be deleted are removed from deletion list as well. This assumes that any parent DN between the root DN and the group DN identifies an OU associated with the group's parent stem.

Parameters:
groupDn - DN of the group entry

initialize

protected void initialize()
                   throws NamingException,
                          LdappcException
Perform any initialization prior to processing the set of groups.

Throws:
NamingException - thrown if a Naming error occurs
LdappcException - thrown if an error occurs

clearRoot

protected void clearRoot()
                  throws NamingException
This deletes any entries under the root entry are neither organizationalUnits nor have the same object class as a group entry.

Throws:
NamingException - Thrown if a naming exception occurs.

populate

protected void populate()
                 throws NamingException
This populates this object with the current values from the root's LDAP entry that are either organizational units or have a object class type of the group entry.

Throws:
NamingException - thrown if a Naming error occurs

populateDns

protected void populateDns(Set<Name> dns,
                           String filter,
                           SearchControls searchControls)
                    throws NamingException
This populates the given Set with the DNs of any child entries of the root DN matching the given filter.

Parameters:
dns - Set to hold the DNs
filter - LDAP Filter
searchControls - Search controls
Throws:
NamingException - thrown if a Naming error occurs.

initializeInclude

protected void initializeInclude(edu.internet2.middleware.grouper.Group group)
                          throws NamingException
Initializes the attributes needed for holding data for the given group.

Parameters:
group - Group
Throws:
NamingException

commit

protected void commit()
               throws NamingException,
                      LdappcException
This commits any changes not already committed to the directory.

Throws:
NamingException - thrown if a Naming error occurs
LdappcException - thrown if an error occurs
See Also:
edu.internet2.middleware.ldappc.synchronize.MembershipSynchronizer#commit()

getErrorData

protected String getErrorData(edu.internet2.middleware.subject.Subject subject)
Builds an error data string based on the objects provided.

Parameters:
subject - Subject
Returns:
data string for error message

getErrorData

protected String getErrorData(edu.internet2.middleware.grouper.Group group)
Builds an error data string based on the objects provided.

Parameters:
group - Group
Returns:
data string for error message

getErrorData

protected String getErrorData(edu.internet2.middleware.grouper.Member member)
Builds an error data string based on the objects provided.

Parameters:
member - Member
Returns:
member data string


Copyright © 2011 Internet2. All Rights Reserved.