edu.internet2.middleware.ldappc
Class Ldappc

java.lang.Object
  extended by java.util.TimerTask
      extended by edu.internet2.middleware.ldappc.Ldappc
All Implemented Interfaces:
Runnable

public final class Ldappc
extends TimerTask

Initiates provisioning.


Field Summary
protected  Name rootDn
          The root DN used when calculating DNs.
static int STATUS_MODIFIED
          Indicates the group has been modified since the last modification date.
static int STATUS_NEW
          Indicates the group is new since the last modification date.
static int STATUS_UNCHANGED
          Indicates the group has not been modified since the last modification date.
static int STATUS_UNKNOWN
          Indicates a last modification date was not provided so the group's status is unknown.
 
Constructor Summary
Ldappc(LdappcOptions options)
           
Ldappc(LdappcOptions options, LdappcConfig configuration, edu.vt.middleware.ldap.Ldap ldap)
           
 
Method Summary
protected  Set<edu.internet2.middleware.grouper.Group> buildGroupSet()
          This builds the set of Groups to be provisioned.
 File calculate()
          Calculate provisioning and write to a file.
 Name calculateGroupDn(edu.internet2.middleware.grouper.Group group)
          This calculates the DN of the given group.
 BasicAttributes calculateStemAttributes(Name stemDn)
          Calculate a stem's attributes, essentially ou = stem name.
 Name calculateStemDn(edu.internet2.middleware.grouper.Group group)
          Calculates the group's parent OU DN.
 List<Name> calculateStemDns(edu.internet2.middleware.grouper.Group group)
          Calculates all parent OU DNs for the given group.
 int determineStatus(edu.internet2.middleware.grouper.Group group)
          Determines the status of the group based on the lastModifyTime provided in the GrouperOptions.
 File dryRun()
          Write changes that would be made during provisioning to a file.
 edu.internet2.middleware.shibboleth.common.attribute.AttributeAuthority getAttributeAuthority()
          Returns the AttributeAuthority if configured to use the attribute-resolver-mapping, otherwise null.
 edu.internet2.middleware.shibboleth.common.attribute.resolver.provider.ShibbolethAttributeResolver getAttributeResolver()
          Returns the ShibbolethAttributeResolver if configured to do so, otherwise null.
 LdappcConfig getConfig()
          Get the Grouper provisioner configuration.
 edu.vt.middleware.ldap.Ldap getContext()
          Get the Ldap context.
static String getGroupData(edu.internet2.middleware.grouper.Group group)
          Returns group data string.
protected  edu.internet2.middleware.grouper.GrouperSession getGrouperSession()
          Get a Grouper session.
static String getMemberData(edu.internet2.middleware.grouper.Member member)
          Returns member data string.
 LdappcOptions getOptions()
          Get the Grouper provisioner options.
 Name getRootDn()
           
 SubjectCache getSubjectCache()
          Gets the subject cache.
 BufferedWriter getWriter()
          Get the private writer.
 void initialize()
          Load configuration, connect to ldap, instantiate the subject cache, and start Grouper.
static void main(String[] args)
           
 void provision()
          Provision Grouper data to a directory.
 void run()
           
protected  void schedule()
          Schedule ldappc as a time task.
 
Methods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rootDn

protected Name rootDn
The root DN used when calculating DNs.


STATUS_NEW

public static final int STATUS_NEW
Indicates the group is new since the last modification date.

See Also:
Constant Field Values

STATUS_MODIFIED

public static final int STATUS_MODIFIED
Indicates the group has been modified since the last modification date.

See Also:
Constant Field Values

STATUS_UNCHANGED

public static final int STATUS_UNCHANGED
Indicates the group has not been modified since the last modification date.

See Also:
Constant Field Values

STATUS_UNKNOWN

public static final int STATUS_UNKNOWN
Indicates a last modification date was not provided so the group's status is unknown.

See Also:
Constant Field Values
Constructor Detail

Ldappc

public Ldappc(LdappcOptions options)

Ldappc

public Ldappc(LdappcOptions options,
              LdappcConfig configuration,
              edu.vt.middleware.ldap.Ldap ldap)
Method Detail

main

public static void main(String[] args)

run

public void run()
Specified by:
run in interface Runnable
Specified by:
run in class TimerTask

initialize

public void initialize()
Load configuration, connect to ldap, instantiate the subject cache, and start Grouper.


provision

public void provision()
               throws LdappcException,
                      NamingException,
                      IOException
Provision Grouper data to a directory.

Throws:
NamingException
LdappcException
IOException

dryRun

public File dryRun()
            throws LdappcException,
                   NamingException,
                   IOException
Write changes that would be made during provisioning to a file.

Returns:
Throws:
LdappcException
NamingException
IOException

calculate

public File calculate()
               throws IOException,
                      ConfigurationException,
                      NamingException
Calculate provisioning and write to a file. No changes are made to the target directory.

Returns:
File the ldif file
Throws:
IOException
ConfigurationException
NamingException

buildGroupSet

protected Set<edu.internet2.middleware.grouper.Group> buildGroupSet()
This builds the set of Groups to be provisioned.

Returns:
Set of Groups, possibly empty, to be provisioned.

getMemberData

public static String getMemberData(edu.internet2.middleware.grouper.Member member)
Returns member data string.

Parameters:
member - Member
Returns:
member data string

getGroupData

public static String getGroupData(edu.internet2.middleware.grouper.Group group)
Returns group data string.

Parameters:
group - Group
Returns:
group data string

getSubjectCache

public SubjectCache getSubjectCache()
Gets the subject cache.

Returns:
the subject cache

getContext

public edu.vt.middleware.ldap.Ldap getContext()
Get the Ldap context. Will create a new instance if necessary, otherwise will re-use existing connection.

Returns:
the LDAP context.

getConfig

public LdappcConfig getConfig()
Get the Grouper provisioner configuration.

Returns:
Grouper provisioner configuration

getOptions

public LdappcOptions getOptions()
Get the Grouper provisioner options.

Returns:
Grouper provisioner options

determineStatus

public int determineStatus(edu.internet2.middleware.grouper.Group group)
Determines the status of the group based on the lastModifyTime provided in the GrouperOptions.

Parameters:
group - Group
Returns:
Status of the group, either STATUS_NEW, STATUS_MODIFIED, STATUS_UNCHANGED or STATUS_UNKNOWN.

getRootDn

public Name getRootDn()

calculateGroupDn

public Name calculateGroupDn(edu.internet2.middleware.grouper.Group group)
                      throws NamingException,
                             LdappcException
This calculates the DN of the given group.

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.

calculateStemDn

public Name calculateStemDn(edu.internet2.middleware.grouper.Group group)
                     throws NamingException
Calculates the group's parent OU DN.

Parameters:
group - Group
Returns:
OU DN under which the group entry must be created.
Throws:
NamingException - thrown if a Naming exception occured.

calculateStemDns

public List<Name> calculateStemDns(edu.internet2.middleware.grouper.Group group)
                            throws NamingException
Calculates all parent OU DNs for the given group.

Parameters:
group -
Returns:
a List of OU DNs
Throws:
NamingException

calculateStemAttributes

public BasicAttributes calculateStemAttributes(Name stemDn)
                                        throws InvalidNameException
Calculate a stem's attributes, essentially ou = stem name.

Parameters:
stemDn - the DN of the stem
Returns:
the stem's attributes
Throws:
InvalidNameException

getWriter

public BufferedWriter getWriter()
Get the private writer.

Returns:

getGrouperSession

protected edu.internet2.middleware.grouper.GrouperSession getGrouperSession()
Get a Grouper session. Will create a new instance if necessary, otherwise will re-use existing session.

Returns:

schedule

protected void schedule()
Schedule ldappc as a time task.


getAttributeAuthority

public edu.internet2.middleware.shibboleth.common.attribute.AttributeAuthority getAttributeAuthority()
Returns the AttributeAuthority if configured to use the attribute-resolver-mapping, otherwise null.

Returns:
the attribute authority or null.

getAttributeResolver

public edu.internet2.middleware.shibboleth.common.attribute.resolver.provider.ShibbolethAttributeResolver getAttributeResolver()
Returns the ShibbolethAttributeResolver if configured to do so, otherwise null.

Returns:
the attribute resolver or null.


Copyright © 2011 Internet2. All Rights Reserved.