com.netscape.jndi.ldap
Class LdapService

java.lang.Object
  extended bycom.netscape.jndi.ldap.LdapService

class LdapService
extends java.lang.Object

Ldap Service encapsulates a Ldap connection and Ldap operations over the connection. The connection is established in a lazy manner, first time a Ldap operation is initiated. A Ldap Service object is shared by multiple contexts. The object maintains a reference counter which is incremented when a context is cloned, and decremeneted when a context is closed. The associated Ldap Connection is relased when the reference counter reaches zero. LDAPsearchConstraints are always read from a context, because ldap service is a shared object and each context may request different search constraints.


Field Summary
static java.lang.String DEFAULT_FILTER
           
static java.lang.String DEFAULT_HOST
           
static int DEFAULT_PORT
           
static int DEFAULT_SCOPE
           
static int DEFAULT_SSL_PORT
           
 
Constructor Summary
LdapService()
           
 
Method Summary
(package private)  LdapContextImpl addEntry(LdapContextImpl ctx, java.lang.String name, LDAPAttributeSet attrs)
          Create a new LDAP entry
(package private)  void changeRDN(LdapContextImpl ctx, java.lang.String name, java.lang.String newRDN)
          Chanage RDN for a LDAP entry
(package private)  void connect(LdapContextImpl ctx)
          Connect to the server and send bind request to authenticate the user
(package private)  void delEntry(LdapContextImpl ctx, java.lang.String name)
          Delete a LDAP entry
(package private)  void disconnect()
          Physically disconect only if the client count is zero
protected  void finalize()
           
(package private)  LDAPConnection getConnection()
           
(package private)  EventService getEventService(LdapContextImpl ctx)
          Return the event service
(package private)  javax.naming.directory.DirContext getSchema(LdapContextImpl ctx, java.lang.String name)
          Schema Operations
(package private)  void incrementClientCount()
          Increment client count
(package private)  boolean isConnected()
           
(package private)  javax.naming.NamingEnumeration listEntries(LdapContextImpl ctx, java.lang.String name, boolean returnBindings)
          List child entries using LDAP lookup operation
(package private)  java.lang.Object lookup(LdapContextImpl ctx, java.lang.String name)
          Lookup an entry using LDAP search operation
(package private)  void modifyEntry(LdapContextImpl ctx, java.lang.String name, LDAPModificationSet mods)
          Modify LDAP entry attributes
(package private)  javax.naming.directory.Attributes readAttrs(LdapContextImpl ctx, java.lang.String name, java.lang.String[] attrs)
          Read LDAP entry attributes
(package private)  javax.naming.NamingEnumeration search(LdapContextImpl ctx, java.lang.String name, java.lang.String filter, java.lang.String[] attrs, javax.naming.directory.SearchControls jndiCtrls)
          LDAP search operation
(package private)  void setTraceOutput(java.lang.Object out)
          Enable/Disable ldap message trace.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_FILTER

public static final java.lang.String DEFAULT_FILTER
See Also:
Constant Field Values

DEFAULT_SCOPE

public static final int DEFAULT_SCOPE
See Also:
Constant Field Values

DEFAULT_HOST

public static final java.lang.String DEFAULT_HOST
See Also:
Constant Field Values

DEFAULT_PORT

public static final int DEFAULT_PORT
See Also:
Constant Field Values

DEFAULT_SSL_PORT

public static final int DEFAULT_SSL_PORT
See Also:
Constant Field Values
Constructor Detail

LdapService

public LdapService()
Method Detail

getConnection

LDAPConnection getConnection()

connect

void connect(LdapContextImpl ctx)
       throws javax.naming.NamingException
Connect to the server and send bind request to authenticate the user

Throws:
javax.naming.NamingException

finalize

protected void finalize()

isConnected

boolean isConnected()

disconnect

void disconnect()
Physically disconect only if the client count is zero


incrementClientCount

void incrementClientCount()
Increment client count


search

javax.naming.NamingEnumeration search(LdapContextImpl ctx,
                                      java.lang.String name,
                                      java.lang.String filter,
                                      java.lang.String[] attrs,
                                      javax.naming.directory.SearchControls jndiCtrls)
                                throws javax.naming.NamingException
LDAP search operation

Throws:
javax.naming.NamingException

listEntries

javax.naming.NamingEnumeration listEntries(LdapContextImpl ctx,
                                           java.lang.String name,
                                           boolean returnBindings)
                                     throws javax.naming.NamingException
List child entries using LDAP lookup operation

Throws:
javax.naming.NamingException

lookup

java.lang.Object lookup(LdapContextImpl ctx,
                        java.lang.String name)
                  throws javax.naming.NamingException
Lookup an entry using LDAP search operation

Throws:
javax.naming.NamingException

readAttrs

javax.naming.directory.Attributes readAttrs(LdapContextImpl ctx,
                                            java.lang.String name,
                                            java.lang.String[] attrs)
                                      throws javax.naming.NamingException
Read LDAP entry attributes

Throws:
javax.naming.NamingException

modifyEntry

void modifyEntry(LdapContextImpl ctx,
                 java.lang.String name,
                 LDAPModificationSet mods)
           throws javax.naming.NamingException
Modify LDAP entry attributes

Throws:
javax.naming.NamingException

addEntry

LdapContextImpl addEntry(LdapContextImpl ctx,
                         java.lang.String name,
                         LDAPAttributeSet attrs)
                   throws javax.naming.NamingException
Create a new LDAP entry

Throws:
javax.naming.NamingException

delEntry

void delEntry(LdapContextImpl ctx,
              java.lang.String name)
        throws javax.naming.NamingException
Delete a LDAP entry

Throws:
javax.naming.NamingException

changeRDN

void changeRDN(LdapContextImpl ctx,
               java.lang.String name,
               java.lang.String newRDN)
         throws javax.naming.NamingException
Chanage RDN for a LDAP entry

Throws:
javax.naming.NamingException

getSchema

javax.naming.directory.DirContext getSchema(LdapContextImpl ctx,
                                            java.lang.String name)
                                      throws javax.naming.NamingException
Schema Operations

Throws:
javax.naming.NamingException

getEventService

EventService getEventService(LdapContextImpl ctx)
                       throws javax.naming.NamingException
Return the event service

Throws:
javax.naming.NamingException

setTraceOutput

void setTraceOutput(java.lang.Object out)
              throws javax.naming.NamingException
Enable/Disable ldap message trace.

Parameters:
out - Trace output or null (disable trace). Output can be specified as a file name or a java OutputStream. If an empty string is specified, the output is sent to System.err. A file name prefixed with a '+' will open the file in append mode.
Throws:
javax.naming.NamingException