com.infoengine.au
Class DirectoryService

java.lang.Object
  extended by com.infoengine.au.DirectoryService

public class DirectoryService
extends java.lang.Object

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

Version:
1.0 7/7/2000

Constructor Summary
DirectoryService()
          Constructs an instance that provides access to the directory service via the JNDI adapter of Info*Engine.
 
Method Summary
 int createObjects(java.lang.String url, Group objects)
          Creates new objects in the directory service.
static java.lang.String decodeUrl(java.lang.String encoded)
          Decodes a URL-encoded string.
 int deleteObject(java.lang.String url)
          Deletes a directory entry.
static java.lang.String normalizeDN(java.lang.String dn)
          Normalizes a distinguished name such that unneeded whitespace is removed.
 Group queryObjects(java.lang.String url)
          Queries the directory service for objects matching the criteria specified by an LDAP URL.
 int updateObjects(java.lang.String url, Group objects, java.lang.String modification)
          Updates objects in the directory service.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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(java.lang.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(java.lang.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(java.lang.String url,
                         Group objects,
                         java.lang.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(java.lang.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 java.lang.String normalizeDN(java.lang.String dn)
Normalizes a distinguished name such that unneeded whitespace is removed.

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

decodeUrl

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

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