com.infoengine.au
Class DirectoryService

java.lang.Object
  extended bycom.infoengine.au.DirectoryService

public class DirectoryService
extends Object

This class provides a convenient way to access a directory service and query objects within it.


Field Summary
private  IeProcessor adapter
           
private  Class adapterClass
           
private  String adapterClassName
           
private  String attributes
           
private  String dn
           
private  String filter
           
private static IeProcessor multithreadedAdapter
           
private  String principal
           
private  String providerUrl
           
private  String scope
           
private  String secret
           
private static String sync
           
 
Constructor Summary
DirectoryService()
          Constructs an instance that provides access to the directory service via the JNDI adapter of Info*Engine.
 
Method Summary
 int createObjects(String url, Group objects)
          Creates new objects in the directory service.
static String decodeUrl(String encoded)
          Decodes a URL-encoded string.
 int deleteObject(String url)
          Deletes a directory entry.
static String normalizeDN(String dn)
          Normalizes a distinguished name such that unneeded whitespace is removed.
private  void parseUrl(String url)
          Parses an LDAP URL into its constituent parts for use in making requests of the Info*Engine JNDI adapter.
 Group queryObjects(String url)
          Queries the directory service for objects matching the criteria specified by an LDAP URL.
 int updateObjects(String url, Group objects, String modification)
          Updates objects in the directory service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

adapterClassName

private final String adapterClassName
See Also:
Constant Field Values

adapter

private IeProcessor adapter

adapterClass

private Class adapterClass

attributes

private String attributes

dn

private String dn

filter

private String filter

principal

private String principal

providerUrl

private String providerUrl

scope

private String scope

secret

private String secret

multithreadedAdapter

private static IeProcessor multithreadedAdapter

sync

private static String sync
Constructor Detail

DirectoryService

public DirectoryService()
                 throws IEException
Constructs an instance that provides access to the directory service via the JNDI adapter of Info*Engine.

Throws:
IEException - if the JNDI adapter can not be loaded or initialized successfully
Method Detail

queryObjects

public Group queryObjects(String url)
                   throws IEException
Queries the directory service for objects matching the criteria specified by an LDAP URL.

Parameters:
url - The LDAP URL specifying the object(s) to be queried.
Returns:
An Info*Engine group containing the query results.
Throws:
IEException - if the query fails

createObjects

public int createObjects(String url,
                         Group objects)
                  throws IEException
Creates new objects in the directory service.

Parameters:
url - The LDAP URL specifying the directory provider URL
objects - An Info*Engine group specifying the objects to be created. Each element of the group must have an attribute named "dn" and an attribute named "objectClass", at a minimum. These specify the distinguished name of the object to be created, and the directory object class, respectively. Other attributes specify additional attributes of the directory entry to be created.
Returns:
The number of objects created.
Throws:
IEException - if creation fails

updateObjects

public int updateObjects(String url,
                         Group objects,
                         String modification)
                  throws IEException
Updates objects in the directory service.

Parameters:
url - The LDAP URL specifying the directory provider URL
objects - An Info*Engine group specifying the objects to be updated. Each element of the group must have an attribute named "dn". This specifies the distinguished name of the object to be updated. Other attributes specify the entry attributes to be added, replaced, or deleted.
modification - One of "add" (add attributes to each entry), "replace" (replace attributes in each entry), or "delete" (delete attributes from each entry).
Returns:
The number of objects updated.
Throws:
IEException - if update fails

deleteObject

public int deleteObject(String url)
                 throws IEException
Deletes a directory entry.

Parameters:
url - The LDAP URL specifying the object to be deleted.
Returns:
0 if entry deleted successfully, nonzero otherwise
Throws:
IEException - if deletion fails

normalizeDN

public static String normalizeDN(String dn)
Normalizes a distinguished name such that unneeded whitespace is removed.

Parameters:
dn - The distinguished name to be normalized.
Returns:
The normalized result.

parseUrl

private void parseUrl(String url)
Parses an LDAP URL into its constituent parts for use in making requests of the Info*Engine JNDI adapter.

Parameters:
url - The LDAP URL to be parsed.

decodeUrl

public static String decodeUrl(String encoded)
Decodes a URL-encoded string.

Parameters:
encoded - URL-encoded string
Returns:
The decoded result