Nitido Inc.

com.nitido.directory.jndi
Class DirectoryImpl

java.lang.Object
  extended by com.nitido.directory.jndi.DirectoryImpl
All Implemented Interfaces:
Directory

public class DirectoryImpl
extends java.lang.Object
implements Directory

The DirectoryImpl class implements the Directory interface by using the Sun JNDI Directory extension. This class can be configured to use different type of JNDI implementation


Field Summary
static java.lang.String CONF_KEY_CONNECT_POOL
          Configuration key for enabling the connection pool.
static java.lang.String CONF_KEY_INITIAL_CONTEXT_FACTORY
          Configuration key for the initial context factory.
static java.lang.String CONF_KEY_REFERRAL
          Configuration key for determining how the JNDI library handles referrals.
static int SCOPE_BASE
           
static int SCOPE_ONE
           
static int SCOPE_SUB
           
 
Method Summary
 void addAttributeValue(java.lang.String entryDN, java.lang.String name, java.io.Serializable value)
          Add Serializable attribute.
 void addAttributeValues(java.lang.String entryDN, java.lang.String name, java.util.Vector values)
          Add attribute (for multi value attributes).
 void addEntry(Entry entry)
          Add a new entry.
 void bind()
          Rebinding to the directory service with the same username and password.
 void bind(java.lang.String username, java.lang.String password)
          Rebinding to the directory service with new username and password.
 void connect(java.lang.String username, java.lang.String password)
          Create the connection to the directory server.
 void disconnect()
          Disconnect the connection to the directory server.
 java.lang.String getBase()
          Get Base DN.
 Entry getEntry(java.lang.String entryDN, java.lang.String[] attrIDs)
          Get an Entry with the specified attributes.
 java.util.Enumeration getRoots()
          Get the roots.
 int getScope()
          Get Scope.
 int getScopeBASE()
          Get value of constant BASE.
 int getScopeONE()
          Get value of constant ONE.
 int getScopeSUB()
          Get value of constant SUB.
 java.lang.String getUserName()
          Get User Name.
 boolean isConnected()
          Check whether the connection is connected.
 void modifyAttributeValue(java.lang.String entryDN, java.lang.String name, java.io.Serializable value)
          Modify Serializable attribute.
 void modifyAttributeValues(java.lang.String entryDN, java.lang.String name, java.util.Vector values)
          Modify attribute (for multi value attributes).
 void modifyEntry(java.lang.String entryDN, DirModifier[] modifiers)
          Modify a specific entry with multiple changes to the attributes.
 void removeAttributeValue(java.lang.String entryDN, java.lang.String attribute, java.io.Serializable value)
          Remove a Serializable attribute value.
 void removeAttributeValues(java.lang.String entryDN, java.lang.String attribute)
          Remove all attribute value under the attribute name.
 void removeEntry(java.lang.String entryDN)
          Remove an entry.
 java.util.Vector search(java.lang.String filter)
          Search with the specific filter.
 java.util.Vector search(java.lang.String filter, java.lang.String[] attrs)
          Search with the specific filter and return the specific attributes.
 java.util.Vector search(java.lang.String base, java.lang.String filter, java.lang.String[] attrs)
          Search with the specific filter and return the specific attributes.
 void setBase(java.lang.String base)
          Set the base DN for the directory access.
 void setScope(int scope)
          Set the scope.
 void terminate()
          This method not only disconnect the underlying connection, but also removing the connection from any potential connection pool completely.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONF_KEY_INITIAL_CONTEXT_FACTORY

public static final java.lang.String CONF_KEY_INITIAL_CONTEXT_FACTORY
Configuration key for the initial context factory. The actual key is "com.nitido.directory.jndi.initialcontextfactory". The valid configuration must be an initial context factory that can generate javax.naming.directory.DirContext.

See Also:
Constant Field Values

CONF_KEY_REFERRAL

public static final java.lang.String CONF_KEY_REFERRAL
Configuration key for determining how the JNDI library handles referrals. The actual key is "com.nitido.directory.jndi.referral". The valid configurations are:

See Also:
Constant Field Values

CONF_KEY_CONNECT_POOL

public static final java.lang.String CONF_KEY_CONNECT_POOL
Configuration key for enabling the connection pool. The actual key is "com.nitido.directory.jndi.connectpool". The valid configurations are: Note: the connection pool size is set to the System property directly. Please refer to Sun's JNDI LDAP connection pool tutorial for more details (http://java.sun.com/products/jndi/tutorial/ldap/connect/pool.html).

See Also:
Constant Field Values

SCOPE_SUB

public static final int SCOPE_SUB
See Also:
Constant Field Values

SCOPE_ONE

public static final int SCOPE_ONE
See Also:
Constant Field Values

SCOPE_BASE

public static final int SCOPE_BASE
See Also:
Constant Field Values
Method Detail

connect

public void connect(java.lang.String username,
                    java.lang.String password)
             throws java.lang.IllegalArgumentException,
                    DirAuthenticationFailedException,
                    java.lang.IllegalStateException,
                    DirReferralException,
                    DirectoryException
Description copied from interface: Directory
Create the connection to the directory server. This method is also responsible for binding the user to the system.

The package description contains the exception handling guide.

Specified by:
connect in interface Directory
Parameters:
username - The username to authenticate with to the directory.
password - The password to authenticate with to the directory.
Throws:
java.lang.IllegalArgumentException - This runtime exception is thrown if the parameters (username and password) or the underlying settings (host and port) are illegal or invalid.

DirAuthenticationFailedException - This exception is thrown if the authorization fails. This problem may be caused by invalid username/password/base/scope. Since this exception inherit from DirectoryException, you don't need to catch it explicitly. However, if you want to catch it, you should catch it before catching DirectoryException.

java.lang.IllegalStateException - This runtime exception is thrown if this object is in illegal state. (For example, the directory has been connected already)

DirReferralException - The exception for LDAP referrals.

DirectoryException - The exception for general system error, including network failures, protocol errors and naming problems.

See Also:
com.nitido.directory

isConnected

public boolean isConnected()
Description copied from interface: Directory
Check whether the connection is connected.

Specified by:
isConnected in interface Directory
Returns:
true if the backend connection has been established.

disconnect

public void disconnect()
                throws DirReferralException,
                       DirectoryException
Description copied from interface: Directory
Disconnect the connection to the directory server. Once this method has been completed successfully, no more LDAP operation is allowed. The caller must invoke connect() again if it needs to perform additional operations.

If the directory has already been disconnected, this method would not throw any exception (i.e. just return without doing anything). This method will never throw IllegalArgumentException or IllegalStateException.

The package description contains the exception handling guide.

Specified by:
disconnect in interface Directory
Throws:
DirReferralException - The exception for LDAP referrals.

DirectoryException - The exception for general system error.

See Also:
com.nitido.directory

terminate

public void terminate()
               throws DirReferralException,
                      DirectoryException
Description copied from interface: Directory
This method not only disconnect the underlying connection, but also removing the connection from any potential connection pool completely. If you call disconnect() method, the underlying connection may still be reused if the connection pool is used. However, with terminate() method, the physical connection will be terminated and discarded.

This method is mainly used to help releasing connection that the application noticed there is some problem. It is also good for handling errors from the backend server that fails to reset the connection after a major error (or the backend server drops a connection when they don't really need to).

Once this method has been completed successfully, no more LDAP operation is allowed. The caller must invoke connect() again if it needs to perform additional operations.

If the directory has already been disconnected, this method would not throw any exception (i.e. just return without doing anything). This method will never throw IllegalArgumentException or IllegalStateException.

The package description contains the exception handling guide.

Specified by:
terminate in interface Directory
Throws:
DirReferralException - The exception for LDAP referrals.

DirectoryException - The exception for general system error.

See Also:
com.nitido.directory

bind

public void bind()
          throws java.lang.IllegalArgumentException,
                 DirAuthenticationFailedException,
                 java.lang.IllegalStateException,
                 DirReferralException,
                 DirectoryException
Description copied from interface: Directory
Rebinding to the directory service with the same username and password. This methods actually calls disconnect() and then connect() with the original username and password.

The package description contains the exception handling guide.

Specified by:
bind in interface Directory
Throws:
java.lang.IllegalArgumentException - This runtime exception is thrown if the parameters (username and password) or the underlying settings (host and port) are illegal or invalid.

DirAuthenticationFailedException - This exception is thrown if the authorization fails. This problem may be caused by invalid username/password/base/scope. Since this exception inherit from DirectoryException, you don't need to catch it explicitly. However, if you want to catch it, you should catch it before catching DirectoryException.

java.lang.IllegalStateException - This runtime exception is thrown if this object is in illegal state.

DirReferralException - The exception for LDAP referrals.

DirectoryException - The exception for general system error, including network failures, protocol errors and naming problems.

See Also:
com.nitido.directory

bind

public void bind(java.lang.String username,
                 java.lang.String password)
          throws java.lang.IllegalArgumentException,
                 DirAuthenticationFailedException,
                 java.lang.IllegalStateException,
                 DirReferralException,
                 DirectoryException
Description copied from interface: Directory
Rebinding to the directory service with new username and password. This methods actually calls disconnect() and then connect() with the new username and password.

The package description contains the exception handling guide.

Specified by:
bind in interface Directory
Parameters:
username - The new username
password - The new password
Throws:
java.lang.IllegalArgumentException - This runtime exception is thrown if the parameters (username and password) or the underlying settings (host and port) are illegal or invalid.

DirAuthenticationFailedException - This exception is thrown if the authorization fails. This problem may be caused by invalid username/password/base/scope. Since this exception inherit from DirectoryException, you don't need to catch it explicitly. However, if you want to catch it, you should catch it before catching DirectoryException.

java.lang.IllegalStateException - This runtime exception is thrown if this object is in illegal state.

DirReferralException - The exception for LDAP referrals.

DirectoryException - The exception for general system error, including network failures, protocol errors and naming problems.

See Also:
com.nitido.directory

search

public java.util.Vector search(java.lang.String filter)
                        throws IllegalSearchFilterException,
                               java.lang.IllegalArgumentException,
                               java.lang.IllegalStateException,
                               DirReferralException,
                               DirectoryException
Description copied from interface: Directory
Search with the specific filter. The list of attributes of the result will depend on the directory service setting. (For most cases, it returns all attributes.)

The developer should have invoked the setBase() method before invoking this method. If this is not the case, this method will throw an IllegalStateException. The developer should invoke the other search() methods that takes the base DN as the parameter.

The package description contains the exception handling guide.

Specified by:
search in interface Directory
Parameters:
filter - the filter string, e.g. "(name=*)".
Returns:
a vector of Entry objects.
Throws:
IllegalSearchFilterException - This runtime exception is thrown if the search filter is invalid or illegal. (e.g. the filter doesn't have the closing bracket.) Note: This exception inherits from java.lang.IllegalArgumentException.

java.lang.IllegalArgumentException - This runtime exception is thrown if this object has an invalid or illegal base (which can be changed by the method setScope( String ) ).

java.lang.IllegalStateException - This runtime exception is thrown if this object is in illegal state. (i.e. it has not been connected.)

DirReferralException - The exception for LDAP referrals.

DirectoryException - The exception for general system error, including network failures, protocol errors and naming problems.

See Also:
com.nitido.directory

search

public java.util.Vector search(java.lang.String filter,
                               java.lang.String[] attrs)
                        throws IllegalSearchFilterException,
                               java.lang.IllegalArgumentException,
                               java.lang.IllegalStateException,
                               DirReferralException,
                               DirectoryException
Description copied from interface: Directory
Search with the specific filter and return the specific attributes. Before the search, one should call the setScope to correctly set the scope of the search.

Even if the attribute list contains invalid attribute names, this method will not throw any exception. Those bad attribute names are simply ignored.

The developer should have invoked the setBase() method before invoking this method. If this is not the case, this method will throw an IllegalStateException. The developer should invoke the other search() methods that takes the base DN as the parameter.

The package description contains the exception handling guide.

Specified by:
search in interface Directory
Parameters:
filter - the filter string, e.g. "name=*".
attrs - The names of the attributes you want to fetch.
Returns:
a vector of Entry objects.
Throws:
IllegalSearchFilterException - This runtime exception is thrown if the search filter is invalid or illegal. (e.g. the filter doesn't have the closing bracket.) Note: This exception inherits from java.lang.IllegalArgumentException.

java.lang.IllegalArgumentException - This runtime exception is thrown if this object has an invalid or illegal base (which can be changed by the method setScope( String ) ).

java.lang.IllegalStateException - This runtime exception is thrown if this object is in illegal state. (i.e. it has not been connected.)

DirReferralException - The exception for LDAP referrals.

DirectoryException - The exception for general system error, including network failures, protocol errors and naming problems.

See Also:
com.nitido.directory

search

public java.util.Vector search(java.lang.String base,
                               java.lang.String filter,
                               java.lang.String[] attrs)
                        throws IllegalSearchFilterException,
                               java.lang.IllegalArgumentException,
                               java.lang.IllegalStateException,
                               DirReferralException,
                               DirectoryException
Description copied from interface: Directory
Search with the specific filter and return the specific attributes. Before the search, one should call the setScope to correctly set the scope of the search.

Even if the attribute list contains invalid attribute names, this method will not throw any exception. Those bad attribute names are simply ignored.

The package description contains the exception handling guide.

Specified by:
search in interface Directory
Parameters:
base - the base DN for the search.
filter - the filter string, e.g. "name=*".
attrs - The names of the attributes you want to fetch.
Returns:
a vector of Entry objects.
Throws:
IllegalSearchFilterException - This runtime exception is thrown if the search filter is invalid or illegal. (e.g. the filter doesn't have the closing bracket.) Note: This exception inherits from java.lang.IllegalArgumentException.

java.lang.IllegalArgumentException - This runtime exception is thrown if the parameter "base" is invalid.

java.lang.IllegalStateException - This runtime exception is thrown if this object is in illegal state. (i.e. it has not been connected.)

DirReferralException - The exception for LDAP referrals.

DirectoryException - The exception for general system error, including network failures, protocol errors and naming problems.

See Also:
com.nitido.directory

getEntry

public Entry getEntry(java.lang.String entryDN,
                      java.lang.String[] attrIDs)
               throws IllegalEntryDNException,
                      java.lang.IllegalStateException,
                      DirReferralException,
                      DirectoryException
Description copied from interface: Directory
Get an Entry with the specified attributes.

Even if the attribute list contains invalid attribute names, this method will not throw any exception. Those bad attribute names are simply ignored.

The package description contains the exception handling guide.

Specified by:
getEntry in interface Directory
Parameters:
entryDN - The target entry's DN.
attrIDs - The names of the attributes you want to fetch. If it is null, it returns all attributes of the entry.
Returns:
An entry object that contains the requested attributes.
Throws:
IllegalEntryDNException - This runtime exception is thrown if the specified entryDN is illegal. (e.g. null, parent/node doesn't exists or has syntax error.) Note: This exception inherits from java.lang.IllegalArgumentException.

java.lang.IllegalStateException - This runtime exception is thrown if this object is in illegal state. (i.e. it has not been connected.)

DirReferralException - The exception for LDAP referrals.

DirectoryException - The exception for general system error, including network failures, protocol errors and naming problems.

See Also:
com.nitido.directory

addEntry

public void addEntry(Entry entry)
              throws DirEntryAlreadyExistsException,
                     IllegalEntryDNException,
                     DirSchemaViolationException,
                     java.lang.IllegalStateException,
                     DirReferralException,
                     DirectoryException
Description copied from interface: Directory
Add a new entry.

The package description contains the exception handling guide.

Specified by:
addEntry in interface Directory
Parameters:
entry - The new entry being added to the directory.
Throws:
DirEntryAlreadyExistsException - This exception is thrown if the new entry already exists in the backend directory.

IllegalEntryDNException - This runtime exception is thrown if the specified entryDN is illegal. (e.g. null, parent doesn't exists or has syntax error) Note: This exception inherits from java.lang.IllegalArgumentException.

DirSchemaViolationException - This exception is thrown if the modification violates the schema, such as missing required attribute, incorrect attribute value type, or failed to satisfy the attribute value constraint (e.g. adding multi-values to a single-value attribute).

java.lang.IllegalStateException - This runtime exception is thrown if this object is in illegal state. (i.e. it has not been connected.)

DirReferralException - The exception for LDAP referrals.

DirectoryException - The exception for general system error, including network failures, protocol errors and naming problems.

See Also:
com.nitido.directory

removeEntry

public void removeEntry(java.lang.String entryDN)
                 throws IllegalEntryDNException,
                        java.lang.IllegalStateException,
                        DirReferralException,
                        DirectoryException
Description copied from interface: Directory
Remove an entry.

The package description contains the exception handling guide.

Specified by:
removeEntry in interface Directory
Parameters:
entryDN - The target entry's DN.
Throws:
IllegalEntryDNException - This runtime exception is thrown if the specified entryDN is illegal. (e.g. null, parent doesn't exists or has syntax error) Note: This exception inherits from java.lang.IllegalArgumentException

java.lang.IllegalStateException - This runtime exception is thrown if this object is in illegal state. (i.e. it has not been connected.)

DirReferralException - The exception for LDAP referrals.

DirectoryException - The exception for general system error, including network failures, protocol errors and naming problems. This exception can be also thrown if the server cannot remove the entry due to schema or LDAP constraint (e.g. can't remove a non-leaf node).

See Also:
com.nitido.directory

removeAttributeValue

public void removeAttributeValue(java.lang.String entryDN,
                                 java.lang.String attribute,
                                 java.io.Serializable value)
                          throws IllegalEntryDNException,
                                 DirSchemaViolationException,
                                 java.lang.IllegalStateException,
                                 DirReferralException,
                                 DirectoryException
Description copied from interface: Directory
Remove a Serializable attribute value.

The package description contains the exception handling guide.

Specified by:
removeAttributeValue in interface Directory
Parameters:
entryDN - The target entry's DN.
attribute - The name of the attribute.
value - The value of the attribute to be removed. This parameter is mainly used by multi-valued attribute and thus, it is optional. If the caller pass null and the attribute is multivalued, all values of the attribute will be removed.
Throws:
IllegalEntryDNException - This runtime exception is thrown if the specified entryDN is illegal. (e.g. null, parent doesn't exists or has syntax error) Note: This exception inherits from java.lang.IllegalArgumentException.

DirSchemaViolationException - This exception is thrown if the modification violates the schema, such as removing a required attribute.

java.lang.IllegalStateException - This runtime exception is thrown if this object is in illegal state. (i.e. it has not been connected.)

DirReferralException - The exception for LDAP referrals.

DirectoryException - The exception for general system error, including network failures, protocol errors and naming problems.

See Also:
com.nitido.directory

modifyAttributeValue

public void modifyAttributeValue(java.lang.String entryDN,
                                 java.lang.String name,
                                 java.io.Serializable value)
                          throws IllegalEntryDNException,
                                 DirSchemaViolationException,
                                 java.lang.IllegalStateException,
                                 DirReferralException,
                                 DirectoryException
Description copied from interface: Directory
Modify Serializable attribute.

The package description contains the exception handling guide.

Specified by:
modifyAttributeValue in interface Directory
Parameters:
entryDN - The target entry's DN.
name - The name of the attribute.
value - the attribute value to be compared.
Throws:
IllegalEntryDNException - This runtime exception is thrown if the specified entryDN is illegal. (e.g. null, parent doesn't exists or has syntax error) Note: This exception inherits from java.lang.IllegalArgumentException.

DirSchemaViolationException - This exception is thrown if the modification violates the schema, such as missing required attribute, incorrect attribute value type, or failed to satisfy the attribute value constraint.

java.lang.IllegalStateException - This runtime exception is thrown if this object is in illegal state. (i.e. it has not been connected.)

DirReferralException - The exception for LDAP referrals.

DirectoryException - The exception for general system error, including network failures, protocol errors and naming problems.

See Also:
com.nitido.directory

addAttributeValue

public void addAttributeValue(java.lang.String entryDN,
                              java.lang.String name,
                              java.io.Serializable value)
                       throws IllegalEntryDNException,
                              DirSchemaViolationException,
                              java.lang.IllegalStateException,
                              DirReferralException,
                              DirectoryException
Description copied from interface: Directory
Add Serializable attribute.

The package description contains the exception handling guide.

Specified by:
addAttributeValue in interface Directory
Parameters:
entryDN - The target entry's DN.
name - The name of the attribute.
value - the attribute value to be compared.
Throws:
IllegalEntryDNException - This runtime exception is thrown if the specified entryDN is illegal. (e.g. null, parent doesn't exists or has syntax error) Note: This exception inherits from java.lang.IllegalArgumentException.

DirSchemaViolationException - This exception is thrown if the modification violates the schema, such as missing required attribute, incorrect attribute value type, or failed to satisfy the attribute value constraint (e.g. adding multi-values to a single-value attribute).

java.lang.IllegalStateException - This runtime exception is thrown if this object is in illegal state. (i.e. it has not been connected.)

DirReferralException - The exception for LDAP referrals.

DirectoryException - The exception for general system error, including network failures, protocol errors and naming problems.

See Also:
com.nitido.directory

removeAttributeValues

public void removeAttributeValues(java.lang.String entryDN,
                                  java.lang.String attribute)
                           throws IllegalEntryDNException,
                                  DirSchemaViolationException,
                                  java.lang.IllegalStateException,
                                  DirReferralException,
                                  DirectoryException
Description copied from interface: Directory
Remove all attribute value under the attribute name. (i.e. remove the whole attribute)

The package description contains the exception handling guide.

Specified by:
removeAttributeValues in interface Directory
Parameters:
entryDN - The target entry's DN.
attribute - The name of the attribute.
Throws:
IllegalEntryDNException - This runtime exception is thrown if the specified entryDN is illegal. (e.g. null, parent doesn't exists or has syntax error) Note: This exception inherits from java.lang.IllegalArgumentException.

DirSchemaViolationException - This exception is thrown if the modification violates the schema, such as removing a required attribute.

java.lang.IllegalStateException - This runtime exception is thrown if this object is in illegal state. (i.e. it has not been connected.)

DirReferralException - The exception for LDAP referrals.

DirectoryException - The exception for general system error, including network failures, protocol errors and naming problems.

See Also:
com.nitido.directory

modifyAttributeValues

public void modifyAttributeValues(java.lang.String entryDN,
                                  java.lang.String name,
                                  java.util.Vector values)
                           throws IllegalEntryDNException,
                                  DirSchemaViolationException,
                                  java.lang.IllegalStateException,
                                  DirReferralException,
                                  DirectoryException
Description copied from interface: Directory
Modify attribute (for multi value attributes).

The package description contains the exception handling guide.

Specified by:
modifyAttributeValues in interface Directory
Parameters:
entryDN - The target entry's DN.
name - The name of the attribute.
values - the attribute values to be modify. It can be either a vector of string or a vector of serializable. (It determines the vector type by the first element of the vector.)
Throws:
IllegalEntryDNException - This runtime exception is thrown if the specified entryDN is illegal. (e.g. null, parent doesn't exists or has syntax error) Note: This exception inherits from java.lang.IllegalArgumentException.

DirSchemaViolationException - This exception is thrown if the modification violates the schema, such as missing required attribute, incorrect attribute value type, or failed to satisfy the attribute value constraint (e.g. adding multi-values to a single-value attribute).

java.lang.IllegalStateException - This runtime exception is thrown if this object is in illegal state. (i.e. it has not been connected.)

DirReferralException - The exception for LDAP referrals.

DirectoryException - The exception for general system error, including network failures, protocol errors and naming problems.

See Also:
com.nitido.directory

addAttributeValues

public void addAttributeValues(java.lang.String entryDN,
                               java.lang.String name,
                               java.util.Vector values)
                        throws IllegalEntryDNException,
                               DirSchemaViolationException,
                               java.lang.IllegalStateException,
                               DirReferralException,
                               DirectoryException
Description copied from interface: Directory
Add attribute (for multi value attributes).

The package description contains the exception handling guide.

Specified by:
addAttributeValues in interface Directory
Parameters:
entryDN - The target entry's DN.
name - The name of the attribute.
values - the attribute values to be add. It can be either a vector of string or a vector of serializable. (It determines the vector type by the first element of the vector.)
Throws:
IllegalEntryDNException - This runtime exception is thrown if the specified entryDN is illegal. (e.g. null, parent doesn't exists or has syntax error.) Note: This exception inherits from java.lang.IllegalArgumentException.

DirSchemaViolationException - This exception is thrown if the modification violates the schema, such as missing required attribute, incorrect attribute value type, or failed to satisfy the attribute value constraint (e.g. adding multi-values to a single-value attribute).

java.lang.IllegalStateException - This runtime exception is thrown if this object is in illegal state. (i.e. it has not been connected.)

DirReferralException - The exception for LDAP referrals.

DirectoryException - The exception for general system error, including network failures, protocol errors and naming problems.

See Also:
com.nitido.directory

modifyEntry

public void modifyEntry(java.lang.String entryDN,
                        DirModifier[] modifiers)
                 throws IllegalEntryDNException,
                        DirSchemaViolationException,
                        java.lang.IllegalStateException,
                        DirReferralException,
                        DirectoryException
Description copied from interface: Directory
Modify a specific entry with multiple changes to the attributes.

Unlike the other attribute modification methods, this method is responsible for updating multiple attributes of the same entry at the same time (instead of one-by-one). This method should be used whenever you need to modify more than one attribute in order to improve the performance.

The package description contains the exception handling guide.

Specified by:
modifyEntry in interface Directory
Parameters:
entryDN - The target entry's DN.
modifiers - An array of DirModifier that describes the actions and the attributes to be modified.
Throws:
IllegalEntryDNException
DirSchemaViolationException
java.lang.IllegalStateException
DirReferralException
DirectoryException

setBase

public void setBase(java.lang.String base)
             throws java.lang.IllegalArgumentException
Description copied from interface: Directory
Set the base DN for the directory access. This method does not involves any binding or immediate LDAP access. It only changes default base DN for subsequent searches. It can be invoked at any state of this object.

Specified by:
setBase in interface Directory
Parameters:
base - the new base DN.
Throws:
java.lang.IllegalArgumentException - This exception is thrown if the parameter is null.

setScope

public void setScope(int scope)
              throws java.lang.IllegalArgumentException
Description copied from interface: Directory
Set the scope. This method does not involves any binding or immediate LDAP access. It only changes default base DN for subsequent searches. It can be invoked at any state of this object.

Specified by:
setScope in interface Directory
Parameters:
scope - The new scope for search.
Throws:
java.lang.IllegalArgumentException - This exception is thrown if the parameter is not supported.

getScopeSUB

public int getScopeSUB()
Description copied from interface: Directory
Get value of constant SUB. This allow the application to set the scope constant value without worrying about which implementation is actually used.

Specified by:
getScopeSUB in interface Directory
Returns:
the int scope for SUB.

getScopeBASE

public int getScopeBASE()
Description copied from interface: Directory
Get value of constant BASE. This allow the application to set the scope constant value without worrying about which implementation is actually used.

Specified by:
getScopeBASE in interface Directory
Returns:
the int scope for BASE.

getScopeONE

public int getScopeONE()
Description copied from interface: Directory
Get value of constant ONE. This allow the application to set the scope constant value without worrying about which implementation is actually used.

Specified by:
getScopeONE in interface Directory
Returns:
the int scope for BASE.

getBase

public java.lang.String getBase()
Description copied from interface: Directory
Get Base DN.

Specified by:
getBase in interface Directory
Returns:
the base DN string.

getUserName

public java.lang.String getUserName()
Description copied from interface: Directory
Get User Name.

Specified by:
getUserName in interface Directory
Returns:
the user name.

getScope

public int getScope()
Description copied from interface: Directory
Get Scope.

Specified by:
getScope in interface Directory
Returns:
scope string.

getRoots

public java.util.Enumeration getRoots()
                               throws DirectoryException
Description copied from interface: Directory
Get the roots. This method may need to talk to the backend directory server to get the strings for the roots.

The package description contains the exception handling guide.

Specified by:
getRoots in interface Directory
Returns:
an enumeration of string that represents the roots.
Throws:
DirReferralException - The exception for LDAP referrals.

DirectoryException - The exception for general system error, including network failures, protocol errors and naming problems.

See Also:
com.nitido.directory

Nitido NiM 2.5 Java API

These JavaDoc pages are generated for release/nim_2_5-2.5.44

Copyright © 1999-2009 Nitido Inc.    Proprietary and Confidential.    All Rights Reserved.