org.opends.server.admin.client.ldap
Class LDAPConnection

java.lang.Object
  extended by org.opends.server.admin.client.ldap.LDAPConnection
Direct Known Subclasses:
JNDIDirContextAdaptor

public abstract class LDAPConnection
extends java.lang.Object

An LDAP connection adaptor interface which is used to perform LDAP client operations.

This interface is provided in order to make it easier to keep track of which JNDI DirContext methods we require and also to facilitate implementation of mock JNDI contexts for unit-testing.


Constructor Summary
protected LDAPConnection()
          Create a new LDAP connection.
 
Method Summary
abstract  void createEntry(javax.naming.ldap.LdapName dn, javax.naming.directory.Attributes attributes)
          Creates a new entry with the specified set of attributes.
abstract  void deleteSubtree(javax.naming.ldap.LdapName dn)
          Deletes the named subtree.
abstract  boolean entryExists(javax.naming.ldap.LdapName dn)
          Determines whether or not the named entry exists.
abstract  java.util.Collection<javax.naming.ldap.LdapName> listEntries(javax.naming.ldap.LdapName dn, java.lang.String filter)
          Lists the children of the named entry.
abstract  void modifyEntry(javax.naming.ldap.LdapName dn, javax.naming.directory.Attributes mods)
          Modifies the attributes of the named entry.
abstract  javax.naming.directory.Attributes readEntry(javax.naming.ldap.LdapName dn, java.util.Collection<java.lang.String> attrIds)
          Reads the attributes of the named entry.
abstract  void unbind()
          Closes the LDAP connection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LDAPConnection

protected LDAPConnection()
Create a new LDAP connection.

Method Detail

createEntry

public abstract void createEntry(javax.naming.ldap.LdapName dn,
                                 javax.naming.directory.Attributes attributes)
                          throws javax.naming.NamingException
Creates a new entry with the specified set of attributes.

Parameters:
dn - The name of the entry to be created.
attributes - The set of attributes.
Throws:
javax.naming.NamingException - If an error occurred whilst creating the entry.

deleteSubtree

public abstract void deleteSubtree(javax.naming.ldap.LdapName dn)
                            throws javax.naming.NamingException
Deletes the named subtree.

Parameters:
dn - The name of the subtree to be deleted.
Throws:
javax.naming.NamingException - If an error occurred whilst deleting the subtree.

entryExists

public abstract boolean entryExists(javax.naming.ldap.LdapName dn)
                             throws javax.naming.NamingException
Determines whether or not the named entry exists.

Parameters:
dn - The name of the entry.
Returns:
Returns true if the entry exists.
Throws:
javax.naming.NamingException - If an error occurred whilst making the determination.

listEntries

public abstract java.util.Collection<javax.naming.ldap.LdapName> listEntries(javax.naming.ldap.LdapName dn,
                                                                             java.lang.String filter)
                                                                      throws javax.naming.NamingException
Lists the children of the named entry.

Parameters:
dn - The name of the entry to list.
filter - An LDAP filter string, or null indicating the default filter of (objectclass=*).
Returns:
Returns the names of the children.
Throws:
javax.naming.NamingException - If an error occurred whilst listing the children.

modifyEntry

public abstract void modifyEntry(javax.naming.ldap.LdapName dn,
                                 javax.naming.directory.Attributes mods)
                          throws javax.naming.NamingException
Modifies the attributes of the named entry.

Parameters:
dn - The name of the entry to be modified.
mods - The list of attributes which need replacing.
Throws:
javax.naming.NamingException - If an error occurred whilst applying the modifications.

readEntry

public abstract javax.naming.directory.Attributes readEntry(javax.naming.ldap.LdapName dn,
                                                            java.util.Collection<java.lang.String> attrIds)
                                                     throws javax.naming.NamingException
Reads the attributes of the named entry.

Parameters:
dn - The name of the entry to be read.
attrIds - The list of attributes to be retrievd.
Returns:
Returns the attributes of the requested entry.
Throws:
javax.naming.NamingException - If an error occurred whilst reading the entry.

unbind

public abstract void unbind()
Closes the LDAP connection.