org.apache.directory.server.core.jndi
Class ServerLdapContext

java.lang.Object
  extended by org.apache.directory.server.core.jndi.ServerContext
      extended by org.apache.directory.server.core.jndi.ServerDirContext
          extended by org.apache.directory.server.core.jndi.ServerLdapContext
All Implemented Interfaces:
javax.naming.Context, javax.naming.directory.DirContext, javax.naming.event.EventContext, javax.naming.event.EventDirContext, javax.naming.ldap.LdapContext

public class ServerLdapContext
extends ServerDirContext
implements javax.naming.ldap.LdapContext

An implementation of a JNDI LdapContext.

Version:
$Rev: 680867 $
Author:
Apache Directory Project

Field Summary
 
Fields inherited from class org.apache.directory.server.core.jndi.ServerContext
connectControls, DELETE_OLD_RDN_PROP, EMPTY_CONTROLS, requestControls, responseControls
 
Fields inherited from interface javax.naming.ldap.LdapContext
CONTROL_FACTORIES
 
Fields inherited from interface javax.naming.directory.DirContext
ADD_ATTRIBUTE, REMOVE_ATTRIBUTE, REPLACE_ATTRIBUTE
 
Fields 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.event.EventContext
OBJECT_SCOPE, ONELEVEL_SCOPE, SUBTREE_SCOPE
 
Constructor Summary
ServerLdapContext(DirectoryService service, CoreSession session, org.apache.directory.shared.ldap.name.LdapDN bindDn)
           
ServerLdapContext(DirectoryService service, java.util.Hashtable<java.lang.String,java.lang.Object> env)
          Creates an instance of an ServerLdapContext.
ServerLdapContext(DirectoryService service, LdapPrincipal principal, org.apache.directory.shared.ldap.name.LdapDN dn)
          Creates a new ServerDirContext with a distinguished name which is used to set the PROVIDER_URL to the distinguished name for this context.
 
Method Summary
 boolean compare(org.apache.directory.shared.ldap.name.LdapDN name, java.lang.String oid, java.lang.Object value)
          Explicitly exposes an LDAP compare operation which JNDI does not directly provide.
 javax.naming.ldap.ExtendedResponse extendedOperation(javax.naming.ldap.ExtendedRequest request)
           
 javax.naming.ldap.Control[] getConnectControls()
           
 javax.naming.ldap.Control[] getRequestControls()
           
 javax.naming.ldap.Control[] getResponseControls()
           
 ServerContext getRootContext()
          Gets a handle on the root context of the DIT.
 void ldapUnbind()
          Calling this method tunnels an unbind call down into the partition holding the bindDn.
 javax.naming.ldap.LdapContext newInstance(javax.naming.ldap.Control[] requestControls)
           
 void reconnect(javax.naming.ldap.Control[] connCtls)
           
 void setRequestControls(javax.naming.ldap.Control[] requestControls)
           
 
Methods inherited from class org.apache.directory.server.core.jndi.ServerDirContext
addNamingListener, addNamingListener, addNamingListener, addNamingListener, bind, bind, createSubcontext, createSubcontext, getAttributes, getAttributes, getAttributes, getAttributes, getSchema, getSchema, getSchemaClassDefinition, getSchemaClassDefinition, modifyAttributes, modifyAttributes, modifyAttributes, modifyAttributes, modifyAttributes, rebind, rebind, search, search, search, search, search, search, search, search, search
 
Methods inherited from class org.apache.directory.server.core.jndi.ServerContext
addNamingListener, addNamingListener, addToEnvironment, bind, bind, close, composeName, composeName, createSubcontext, createSubcontext, destroySubcontext, destroySubcontext, doAddOperation, doBindOperation, doDeleteOperation, doGetRootDSEOperation, doListOperation, doLookupOperation, doLookupOperation, doModifyOperation, doMove, doMoveAndRenameOperation, doRename, doSearchOperation, getDirectoryService, getDn, getEnvironment, getListeners, getNameInNamespace, getNameParser, getNameParser, getService, getSession, list, list, listBindings, listBindings, lookup, lookup, lookupLink, lookupLink, rebind, rebind, removeFromEnvironment, removeNamingListener, rename, rename, targetMustExist, unbind, unbind
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.naming.directory.DirContext
bind, bind, createSubcontext, createSubcontext, getAttributes, getAttributes, getAttributes, getAttributes, getSchema, getSchema, getSchemaClassDefinition, getSchemaClassDefinition, modifyAttributes, modifyAttributes, modifyAttributes, modifyAttributes, rebind, rebind, search, search, search, search, search, search, search, search
 
Methods inherited from interface javax.naming.Context
addToEnvironment, bind, bind, close, composeName, composeName, createSubcontext, createSubcontext, destroySubcontext, destroySubcontext, getEnvironment, getNameInNamespace, getNameParser, getNameParser, list, list, listBindings, listBindings, lookup, lookup, lookupLink, lookupLink, rebind, rebind, removeFromEnvironment, rename, rename, unbind, unbind
 
Methods inherited from interface javax.naming.event.EventContext
addNamingListener, addNamingListener, removeNamingListener, targetMustExist
 

Constructor Detail

ServerLdapContext

public ServerLdapContext(DirectoryService service,
                         java.util.Hashtable<java.lang.String,java.lang.Object> env)
                  throws java.lang.Exception
Creates an instance of an ServerLdapContext.

Parameters:
service - the parent service that manages this context
env - the JNDI environment parameters
Throws:
javax.naming.NamingException - the context cannot be created
java.lang.Exception

ServerLdapContext

public ServerLdapContext(DirectoryService service,
                         LdapPrincipal principal,
                         org.apache.directory.shared.ldap.name.LdapDN dn)
                  throws java.lang.Exception
Creates a new ServerDirContext with a distinguished name which is used to set the PROVIDER_URL to the distinguished name for this context.

Parameters:
principal - the directory user principal that is propagated
dn - the distinguished name of this context
service - the directory service core
Throws:
javax.naming.NamingException - if there are problems instantiating
java.lang.Exception

ServerLdapContext

public ServerLdapContext(DirectoryService service,
                         CoreSession session,
                         org.apache.directory.shared.ldap.name.LdapDN bindDn)
                  throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

extendedOperation

public javax.naming.ldap.ExtendedResponse extendedOperation(javax.naming.ldap.ExtendedRequest request)
Specified by:
extendedOperation in interface javax.naming.ldap.LdapContext
See Also:
LdapContext.extendedOperation( javax.naming.ldap.ExtendedRequest)

newInstance

public javax.naming.ldap.LdapContext newInstance(javax.naming.ldap.Control[] requestControls)
                                          throws javax.naming.NamingException
Specified by:
newInstance in interface javax.naming.ldap.LdapContext
Throws:
javax.naming.NamingException
See Also:
LdapContext.newInstance( javax.naming.ldap.Control[])

reconnect

public void reconnect(javax.naming.ldap.Control[] connCtls)
               throws javax.naming.NamingException
Specified by:
reconnect in interface javax.naming.ldap.LdapContext
Throws:
javax.naming.NamingException
See Also:
LdapContext.reconnect(javax.naming.ldap.Control[])

getConnectControls

public javax.naming.ldap.Control[] getConnectControls()
                                               throws javax.naming.NamingException
Specified by:
getConnectControls in interface javax.naming.ldap.LdapContext
Throws:
javax.naming.NamingException
See Also:
LdapContext.getConnectControls()

setRequestControls

public void setRequestControls(javax.naming.ldap.Control[] requestControls)
                        throws javax.naming.NamingException
Specified by:
setRequestControls in interface javax.naming.ldap.LdapContext
Throws:
javax.naming.NamingException
See Also:
LdapContext.setRequestControls( javax.naming.ldap.Control[])

getRequestControls

public javax.naming.ldap.Control[] getRequestControls()
                                               throws javax.naming.NamingException
Specified by:
getRequestControls in interface javax.naming.ldap.LdapContext
Throws:
javax.naming.NamingException
See Also:
LdapContext.getRequestControls()

getResponseControls

public javax.naming.ldap.Control[] getResponseControls()
                                                throws javax.naming.NamingException
Specified by:
getResponseControls in interface javax.naming.ldap.LdapContext
Throws:
javax.naming.NamingException
See Also:
LdapContext.getResponseControls()

compare

public boolean compare(org.apache.directory.shared.ldap.name.LdapDN name,
                       java.lang.String oid,
                       java.lang.Object value)
                throws javax.naming.NamingException
Explicitly exposes an LDAP compare operation which JNDI does not directly provide. All normalization and schema checking etcetera is handled by this call.

Parameters:
name - the name of the entri
oid - the name or object identifier for the attribute to compare
value - the value to compare the attribute to
Returns:
true if the entry has the value for the attribute, false otherwise
Throws:
javax.naming.NamingException - if the backing store cannot be accessed, or permission is not allowed for this operation or the oid is not recognized, or the attribute is not present in the entry ... you get the picture.

ldapUnbind

public void ldapUnbind()
                throws javax.naming.NamingException
Calling this method tunnels an unbind call down into the partition holding the bindDn. The bind() counter part is not exposed because it is automatically called when you create a new initial context for a new connection (on wire) or (programatic) caller.

Throws:
javax.naming.NamingException - if there are failures encountered while unbinding

getRootContext

public ServerContext getRootContext()
                             throws javax.naming.NamingException
Description copied from class: ServerContext
Gets a handle on the root context of the DIT. The RootDSE as the present user.

Specified by:
getRootContext in class ServerContext
Returns:
the rootDSE context
Throws:
javax.naming.NamingException - if this fails


Copyright © 2003-2009 Apache Software Foundation. All Rights Reserved.