Package com.netscape.jndi.ldap
Class LdapContextImpl
java.lang.Object
com.netscape.jndi.ldap.LdapContextImpl
- All Implemented Interfaces:
Context
,DirContext
,EventContext
,EventDirContext
,LdapContext
Implementation for the DirContext. The context also supports controls
through the implementation of LdapContext interface and events through
the implementaion of EventDirContext.
Semantically, the LdapContextImpl corresponds to a directory entry.
Thus a context is associated with a DN (m_ctxDN). Multiple contexts share
the same LDAPConnection which is wrapped into a LdapService object
(m_ldapSvc). Each context also maintains a set of environment properties
(m_ctxEnv). A context environment is shared among mutiple contexts using a
variation of copy-on-write algorithm (see common.ShareableEnv class).
Each context also maintains a set of LDAPSearchConstraints, as search
constrainsts like e.g. server controls, or max number of returned search
search results, are context specific. The LdapService reads the
LDAPSearchConstraints from a context that makes a service request.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String
DN associated with this context The default value is the root DSE ("")protected ContextEnv
Context environment settingprotected LdapService
Ldap Connection/Serviceprotected LDAPSearchConstraints
Ldap Connection Search ConstraintsFields inherited from interface javax.naming.Context
APPLET, AUTHORITATIVE, BATCHSIZE, DNS_URL, INITIAL_CONTEXT_FACTORY, LANGUAGE, OBJECT_FACTORIES, PROVIDER_URL, REFERRAL, SECURITY_AUTHENTICATION, SECURITY_CREDENTIALS, SECURITY_PRINCIPAL, SECURITY_PROTOCOL, STATE_FACTORIES, URL_PKG_PREFIXES
Fields inherited from interface javax.naming.directory.DirContext
ADD_ATTRIBUTE, REMOVE_ATTRIBUTE, REPLACE_ATTRIBUTE
Fields inherited from interface javax.naming.event.EventContext
OBJECT_SCOPE, ONELEVEL_SCOPE, SUBTREE_SCOPE
Fields inherited from interface javax.naming.ldap.LdapContext
CONTROL_FACTORIES
-
Constructor Summary
ConstructorsConstructorDescriptionLdapContextImpl
(String ctxDN, LdapContextImpl cloneCtx) Copy ConstructorLdapContextImpl
(Hashtable<Object, Object> env) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoid
addNamingListener
(String target, int scope, NamingListener l) Naming Event methods javax.naming.event.EventDirContext interface)void
addNamingListener
(String target, String filterExpr, Object[] filterArgs, SearchControls ctls, NamingListener l) void
addNamingListener
(String target, String filter, SearchControls ctls, NamingListener l) void
addNamingListener
(Name target, int scope, NamingListener l) void
addNamingListener
(Name target, String filterExpr, Object[] filterArgs, SearchControls ctls, NamingListener l) void
addNamingListener
(Name target, String filter, SearchControls ctls, NamingListener l) addToEnvironment
(String propName, Object propValue) void
Naming Bind/Rename operations (javax.naming.Context, javax.naming.DirContext interface)void
bind
(String name, Object obj, Attributes attrs) void
void
bind
(Name name, Object obj, Attributes attrs) (package private) String
checkLdapUrlAsName
(String name) Check if LdapURL is passed as the name paremetr to a method If that's the case, craete environment for the ldap urlvoid
close()
Disconnect the Ldap Connection if close is requested LDAP operations can not be performed any more ones the context is closedcomposeName
(String name, String prefix) Name operations (javax.naming.Context interface)composeName
(Name name, Name prefix) createSubcontext
(String name) Ldap entry operations (javax.naming.DirContext interface)createSubcontext
(String name, Attributes attrs) createSubcontext
(Name name) createSubcontext
(Name name, Attributes attrs) void
destroySubcontext
(String name) void
destroySubcontext
(Name name) LdapContext methods (javax.naming.ldap.LdapContext interface)protected void
finalize()
Close the context when finalizedgetAttributes
(String name) Attribute Operations (javax.naming.DirContext interface)getAttributes
(String name, String[] attrIds) getAttributes
(Name name) getAttributes
(Name name, String[] attrIds) Control[]
(package private) String
getDN()
Return DN for this context(package private) ContextEnv
getEnv()
Return reference to the context environmentEnvironment operatins (javax.naming.Context interface)getNameParser
(String name) getNameParser
(Name name) Control[]
Control[]
Schema Operations (javax.naming.DirContext interface)getSchemaClassDefinition
(Name name) (package private) LDAPSearchConstraints
Return LdapJdk search constraints for this contextList Operations (javax.naming.Context interface)listBindings
(String name) listBindings
(Name name) Lookup Operations (javax.naming.Context interface)lookupLink
(String name) lookupLink
(Name name) void
modifyAttributes
(String name, int mod_op, Attributes attrs) void
modifyAttributes
(String name, ModificationItem[] mods) void
modifyAttributes
(Name name, int mod_op, Attributes attrs) void
modifyAttributes
(Name name, ModificationItem[] mods) newInstance
(Control[] reqCtls) void
void
rebind
(String name, Object obj, Attributes attrs) void
void
rebind
(Name name, Object obj, Attributes attrs) void
removeFromEnvironment
(String propName) void
void
void
search
(String name, String filterExpr, Object[] filterArgs, SearchControls cons) search
(String name, String filter, SearchControls cons) Search operations (javax.naming.DirContext interface)search
(String name, Attributes matchingAttributes) search
(String name, Attributes matchingAttributes, String[] attributesToReturn) search
(Name name, String filterExpr, Object[] filterArgs, SearchControls cons) search
(Name name, String filter, SearchControls cons) search
(Name name, Attributes attrs) search
(Name name, Attributes matchingAttributes, String[] attributesToReturn) void
setRequestControls
(Control[] reqCtls) boolean
toString()
Conver object to Stringvoid
void
-
Field Details
-
m_ctxEnv
Context environment setting -
m_ctxDN
DN associated with this context The default value is the root DSE ("") -
m_ldapSvc
Ldap Connection/Service -
m_searchCons
Ldap Connection Search Constraints
-
-
Constructor Details
-
LdapContextImpl
Constructor- Throws:
NamingException
-
LdapContextImpl
Copy Constructor- Throws:
NamingException
-
-
Method Details
-
finalize
protected void finalize()Close the context when finalized -
close
Disconnect the Ldap Connection if close is requested LDAP operations can not be performed any more ones the context is closed- Specified by:
close
in interfaceContext
- Throws:
NamingException
-
getSearchConstraints
Return LdapJdk search constraints for this context- Throws:
NamingException
-
getDN
Return DN for this context- Throws:
NamingException
-
getEnv
ContextEnv getEnv()Return reference to the context environment -
toString
Conver object to String -
checkLdapUrlAsName
Check if LdapURL is passed as the name paremetr to a method If that's the case, craete environment for the ldap url- Throws:
NamingException
-
getEnvironment
Environment operatins (javax.naming.Context interface)- Specified by:
getEnvironment
in interfaceContext
- Throws:
NamingException
-
addToEnvironment
- Specified by:
addToEnvironment
in interfaceContext
- Throws:
NamingException
-
removeFromEnvironment
- Specified by:
removeFromEnvironment
in interfaceContext
- Throws:
NamingException
-
composeName
Name operations (javax.naming.Context interface)- Specified by:
composeName
in interfaceContext
- Throws:
NamingException
-
composeName
- Specified by:
composeName
in interfaceContext
- Throws:
NamingException
-
getNameInNamespace
- Specified by:
getNameInNamespace
in interfaceContext
- Throws:
NamingException
-
getNameParser
- Specified by:
getNameParser
in interfaceContext
- Throws:
NamingException
-
getNameParser
- Specified by:
getNameParser
in interfaceContext
- Throws:
NamingException
-
search
public NamingEnumeration<SearchResult> search(String name, String filter, SearchControls cons) throws NamingException Search operations (javax.naming.DirContext interface)- Specified by:
search
in interfaceDirContext
- Throws:
NamingException
-
search
public NamingEnumeration<SearchResult> search(String name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException - Specified by:
search
in interfaceDirContext
- Throws:
NamingException
-
search
public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes) throws NamingException - Specified by:
search
in interfaceDirContext
- Throws:
NamingException
-
search
public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException - Specified by:
search
in interfaceDirContext
- Throws:
NamingException
-
search
public NamingEnumeration<SearchResult> search(Name name, String filter, SearchControls cons) throws NamingException - Specified by:
search
in interfaceDirContext
- Throws:
NamingException
-
search
public NamingEnumeration<SearchResult> search(Name name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException - Specified by:
search
in interfaceDirContext
- Throws:
NamingException
-
search
- Specified by:
search
in interfaceDirContext
- Throws:
NamingException
-
search
public NamingEnumeration<SearchResult> search(Name name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException - Specified by:
search
in interfaceDirContext
- Throws:
NamingException
-
getAttributes
Attribute Operations (javax.naming.DirContext interface)- Specified by:
getAttributes
in interfaceDirContext
- Throws:
NamingException
-
getAttributes
- Specified by:
getAttributes
in interfaceDirContext
- Throws:
NamingException
-
getAttributes
- Specified by:
getAttributes
in interfaceDirContext
- Throws:
NamingException
-
getAttributes
- Specified by:
getAttributes
in interfaceDirContext
- Throws:
NamingException
-
modifyAttributes
- Specified by:
modifyAttributes
in interfaceDirContext
- Throws:
NamingException
-
modifyAttributes
- Specified by:
modifyAttributes
in interfaceDirContext
- Throws:
NamingException
-
modifyAttributes
- Specified by:
modifyAttributes
in interfaceDirContext
- Throws:
NamingException
-
modifyAttributes
- Specified by:
modifyAttributes
in interfaceDirContext
- Throws:
NamingException
-
createSubcontext
Ldap entry operations (javax.naming.DirContext interface)- Specified by:
createSubcontext
in interfaceContext
- Throws:
NamingException
-
createSubcontext
- Specified by:
createSubcontext
in interfaceContext
- Throws:
NamingException
-
createSubcontext
- Specified by:
createSubcontext
in interfaceDirContext
- Throws:
NamingException
-
createSubcontext
- Specified by:
createSubcontext
in interfaceDirContext
- Throws:
NamingException
-
destroySubcontext
- Specified by:
destroySubcontext
in interfaceContext
- Throws:
NamingException
-
destroySubcontext
- Specified by:
destroySubcontext
in interfaceContext
- Throws:
NamingException
-
bind
Naming Bind/Rename operations (javax.naming.Context, javax.naming.DirContext interface)- Specified by:
bind
in interfaceContext
- Throws:
NamingException
-
bind
- Specified by:
bind
in interfaceContext
- Throws:
NamingException
-
bind
- Specified by:
bind
in interfaceDirContext
- Throws:
NamingException
-
bind
- Specified by:
bind
in interfaceDirContext
- Throws:
NamingException
-
rebind
- Specified by:
rebind
in interfaceContext
- Throws:
NamingException
-
rebind
- Specified by:
rebind
in interfaceContext
- Throws:
NamingException
-
rebind
- Specified by:
rebind
in interfaceDirContext
- Throws:
NamingException
-
rebind
- Specified by:
rebind
in interfaceDirContext
- Throws:
NamingException
-
rename
- Specified by:
rename
in interfaceContext
- Throws:
NamingException
-
rename
- Specified by:
rename
in interfaceContext
- Throws:
NamingException
-
unbind
- Specified by:
unbind
in interfaceContext
- Throws:
NamingException
-
unbind
- Specified by:
unbind
in interfaceContext
- Throws:
NamingException
-
list
List Operations (javax.naming.Context interface)- Specified by:
list
in interfaceContext
- Throws:
NamingException
-
list
- Specified by:
list
in interfaceContext
- Throws:
NamingException
-
listBindings
- Specified by:
listBindings
in interfaceContext
- Throws:
NamingException
-
listBindings
- Specified by:
listBindings
in interfaceContext
- Throws:
NamingException
-
lookup
Lookup Operations (javax.naming.Context interface)- Specified by:
lookup
in interfaceContext
- Throws:
NamingException
-
lookup
- Specified by:
lookup
in interfaceContext
- Throws:
NamingException
-
lookupLink
- Specified by:
lookupLink
in interfaceContext
- Throws:
NamingException
-
lookupLink
- Specified by:
lookupLink
in interfaceContext
- Throws:
NamingException
-
getSchema
Schema Operations (javax.naming.DirContext interface)- Specified by:
getSchema
in interfaceDirContext
- Throws:
NamingException
-
getSchema
- Specified by:
getSchema
in interfaceDirContext
- Throws:
NamingException
-
getSchemaClassDefinition
- Specified by:
getSchemaClassDefinition
in interfaceDirContext
- Throws:
NamingException
-
getSchemaClassDefinition
- Specified by:
getSchemaClassDefinition
in interfaceDirContext
- Throws:
NamingException
-
addNamingListener
Naming Event methods javax.naming.event.EventDirContext interface)- Specified by:
addNamingListener
in interfaceEventContext
- Throws:
NamingException
-
addNamingListener
- Specified by:
addNamingListener
in interfaceEventContext
- Throws:
NamingException
-
addNamingListener
public void addNamingListener(String target, String filter, SearchControls ctls, NamingListener l) throws NamingException - Specified by:
addNamingListener
in interfaceEventDirContext
- Throws:
NamingException
-
addNamingListener
public void addNamingListener(Name target, String filter, SearchControls ctls, NamingListener l) throws NamingException - Specified by:
addNamingListener
in interfaceEventDirContext
- Throws:
NamingException
-
addNamingListener
public void addNamingListener(String target, String filterExpr, Object[] filterArgs, SearchControls ctls, NamingListener l) throws NamingException - Specified by:
addNamingListener
in interfaceEventDirContext
- Throws:
NamingException
-
addNamingListener
public void addNamingListener(Name target, String filterExpr, Object[] filterArgs, SearchControls ctls, NamingListener l) throws NamingException - Specified by:
addNamingListener
in interfaceEventDirContext
- Throws:
NamingException
-
removeNamingListener
- Specified by:
removeNamingListener
in interfaceEventContext
- Throws:
NamingException
-
targetMustExist
public boolean targetMustExist()- Specified by:
targetMustExist
in interfaceEventContext
-
extendedOperation
LdapContext methods (javax.naming.ldap.LdapContext interface)- Specified by:
extendedOperation
in interfaceLdapContext
- Throws:
NamingException
-
getRequestControls
- Specified by:
getRequestControls
in interfaceLdapContext
- Throws:
NamingException
-
setRequestControls
- Specified by:
setRequestControls
in interfaceLdapContext
- Throws:
NamingException
-
getResponseControls
- Specified by:
getResponseControls
in interfaceLdapContext
- Throws:
NamingException
-
newInstance
- Specified by:
newInstance
in interfaceLdapContext
- Throws:
NamingException
-
reconnect
- Specified by:
reconnect
in interfaceLdapContext
- Throws:
NamingException
-
getConnectControls
- Specified by:
getConnectControls
in interfaceLdapContext
-