Package com.netscape.jndi.ldap
Class LdapService
java.lang.Object
com.netscape.jndi.ldap.LdapService
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
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final int
static final int
static final int
private int
The number of contexts that are currently sharing this LdapService.private EventService
private LDAPConnection
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) LdapContextImpl
addEntry
(LdapContextImpl ctx, String name, LDAPAttributeSet attrs) Create a new LDAP entry(package private) void
changeRDN
(LdapContextImpl ctx, String name, 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, String name) Delete a LDAP entry(package private) void
Physically disconect only if the client count is zeroprotected void
finalize()
(package private) LDAPConnection
(package private) EventService
Return the event service(package private) DirContext
getSchema
(LdapContextImpl ctx, String name) Schema Operations(package private) void
Increment client count(package private) boolean
(package private) NamingEnumeration<NameClassPair>
list
(LdapContextImpl ctx, String name) List child entries using LDAP lookup operation(package private) NamingEnumeration<Binding>
listBindings
(LdapContextImpl ctx, String name) List child bindings using LDAP lookup operation(package private) Object
lookup
(LdapContextImpl ctx, String name) Lookup an entry using LDAP search operation(package private) void
modifyEntry
(LdapContextImpl ctx, String name, LDAPModificationSet mods) Modify LDAP entry attributes(package private) Attributes
readAttrs
(LdapContextImpl ctx, String name, String[] attrs) Read LDAP entry attributes(package private) NamingEnumeration<SearchResult>
search
(LdapContextImpl ctx, String name, String filter, String[] attrs, SearchControls jndiCtrls) LDAP search operation(package private) void
setTraceOutput
(Object out) Enable/Disable ldap message trace.
-
Field Details
-
DEFAULT_FILTER
- See Also:
-
DEFAULT_SCOPE
public static final int DEFAULT_SCOPE- See Also:
-
DEFAULT_HOST
- See Also:
-
DEFAULT_PORT
public static final int DEFAULT_PORT- See Also:
-
DEFAULT_SSL_PORT
public static final int DEFAULT_SSL_PORT- See Also:
-
m_ld
-
m_eventSvc
-
m_clientCount
private int m_clientCountThe number of contexts that are currently sharing this LdapService. Essentially, a reference counter. Incremented in the LdapContextImpl copy constructor. Decremented in the LdapService.disconnect(). When the count reaches zero, the LDAPConnection is released.
-
-
Constructor Details
-
LdapService
public LdapService()
-
-
Method Details
-
getConnection
LDAPConnection getConnection() -
connect
Connect to the server and send bind request to authenticate the user- Throws:
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
NamingEnumeration<SearchResult> search(LdapContextImpl ctx, String name, String filter, String[] attrs, SearchControls jndiCtrls) throws NamingException LDAP search operation- Throws:
NamingException
-
list
List child entries using LDAP lookup operation- Throws:
NamingException
-
listBindings
List child bindings using LDAP lookup operation- Throws:
NamingException
-
lookup
Lookup an entry using LDAP search operation- Throws:
NamingException
-
readAttrs
Read LDAP entry attributes- Throws:
NamingException
-
modifyEntry
Modify LDAP entry attributes- Throws:
NamingException
-
addEntry
LdapContextImpl addEntry(LdapContextImpl ctx, String name, LDAPAttributeSet attrs) throws NamingException Create a new LDAP entry- Throws:
NamingException
-
delEntry
Delete a LDAP entry- Throws:
NamingException
-
changeRDN
Chanage RDN for a LDAP entry- Throws:
NamingException
-
getSchema
Schema Operations- Throws:
NamingException
-
getEventService
Return the event service- Throws:
NamingException
-
setTraceOutput
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:
NamingException
-