public abstract class ServerContext
extends java.lang.Object
implements javax.naming.event.EventContext
| Modifier and Type | Field and Description |
|---|---|
private static java.util.Map<java.lang.String,ControlEnum> |
ADS_CONTROLS |
protected javax.naming.ldap.Control[] |
connectControls
Connection level controls associated with the session
|
static java.lang.String |
DELETE_OLD_RDN_PROP
property key used for deleting the old Rdn on a rename
|
private org.apache.directory.api.ldap.model.name.Dn |
dn
The distinguished name of this Context
|
protected static javax.naming.ldap.Control[] |
EMPTY_CONTROLS
Empty array of controls for use in dealing with them
|
private java.util.Hashtable<java.lang.String,java.lang.Object> |
env
The cloned environment used by this Context
|
private java.util.Map<javax.naming.event.NamingListener,DirectoryListener> |
listeners
The set of registered NamingListeners
|
protected org.apache.directory.api.ldap.model.schema.AttributeType |
objectClassAT
A reference to the ObjectClass AT
|
protected javax.naming.ldap.Control[] |
requestControls
The request controls to set on operations before performing them
|
protected javax.naming.ldap.Control[] |
responseControls
The response controls to set after performing operations
|
protected org.apache.directory.api.ldap.model.schema.SchemaManager |
schemaManager
The SchemManager instance
|
private DirectoryService |
service
The directory service which owns this context
|
private CoreSession |
session
The session
|
| Modifier | Constructor and Description |
|---|---|
|
ServerContext(DirectoryService service,
CoreSession session,
javax.naming.Name name) |
protected |
ServerContext(DirectoryService service,
java.util.Hashtable<java.lang.String,java.lang.Object> env)
Must be called by all subclasses to initialize the nexus proxy and the
environment settings to be used by this Context implementation.
|
|
ServerContext(DirectoryService service,
LdapPrincipal principal,
javax.naming.Name name)
Must be called by all subclasses to initialize the nexus proxy and the
environment settings to be used by this Context implementation.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addNamingListener(javax.naming.Name name,
int scope,
javax.naming.event.NamingListener namingListener) |
void |
addNamingListener(java.lang.String name,
int scope,
javax.naming.event.NamingListener namingListener) |
java.lang.Object |
addToEnvironment(java.lang.String propName,
java.lang.Object propVal) |
void |
bind(javax.naming.Name name,
java.lang.Object obj) |
void |
bind(java.lang.String name,
java.lang.Object obj) |
(package private) org.apache.directory.api.ldap.model.name.Dn |
buildTarget(org.apache.directory.api.ldap.model.name.Dn relativeName)
Clones this context's Dn and adds the components of the name relative to
this context to the left hand side of this context's cloned Dn.
|
void |
close() |
javax.naming.Name |
composeName(javax.naming.Name name,
javax.naming.Name prefix) |
java.lang.String |
composeName(java.lang.String name,
java.lang.String prefix) |
private org.apache.directory.api.ldap.model.message.Control |
convertControl(boolean isRequest,
javax.naming.ldap.Control jndiControl) |
private org.apache.directory.api.ldap.model.message.Control[] |
convertControls(boolean isRequest,
javax.naming.ldap.Control[] jndiControls)
Convert the JNDI controls to ADS controls
TODO convertControls.
|
javax.naming.Context |
createSubcontext(javax.naming.Name name) |
javax.naming.Context |
createSubcontext(java.lang.String name) |
void |
destroySubcontext(javax.naming.Name name) |
void |
destroySubcontext(java.lang.String name) |
protected void |
doAddOperation(org.apache.directory.api.ldap.model.name.Dn target,
org.apache.directory.api.ldap.model.entry.Entry entry)
Used to encapsulate [de]marshalling of controls before and after add operations.
|
protected BindOperationContext |
doBindOperation(org.apache.directory.api.ldap.model.name.Dn bindDn,
byte[] credentials,
java.lang.String saslMechanism,
java.lang.String saslAuthId)
Used to encapsulate [de]marshalling of controls before and after bind operations.
|
protected void |
doDeleteOperation(org.apache.directory.api.ldap.model.name.Dn target)
Used to encapsulate [de]marshalling of controls before and after delete operations.
|
protected org.apache.directory.api.ldap.model.entry.Entry |
doGetRootDseOperation(org.apache.directory.api.ldap.model.name.Dn target) |
protected EntryFilteringCursor |
doListOperation(org.apache.directory.api.ldap.model.name.Dn target)
Used to encapsulate [de]marshalling of controls before and after list operations.
|
protected org.apache.directory.api.ldap.model.entry.Entry |
doLookupOperation(org.apache.directory.api.ldap.model.name.Dn target)
Used to encapsulate [de]marshalling of controls before and after lookup operations.
|
protected org.apache.directory.api.ldap.model.entry.Entry |
doLookupOperation(org.apache.directory.api.ldap.model.name.Dn target,
java.lang.String[] attrIds)
Used to encapsulate [de]marshalling of controls before and after lookup operations.
|
protected void |
doModifyOperation(org.apache.directory.api.ldap.model.name.Dn dn,
java.util.List<org.apache.directory.api.ldap.model.entry.Modification> modifications)
Used to encapsulate [de]marshalling of controls before and after modify operations.
|
protected void |
doMove(org.apache.directory.api.ldap.model.name.Dn oldDn,
org.apache.directory.api.ldap.model.name.Dn target)
Used to encapsulate [de]marshalling of controls before and after moveAndRename operations.
|
protected void |
doMoveAndRenameOperation(org.apache.directory.api.ldap.model.name.Dn oldDn,
org.apache.directory.api.ldap.model.name.Dn parent,
org.apache.directory.api.ldap.model.name.Rdn newRdn,
boolean delOldDn)
Used to encapsulate [de]marshalling of controls before and after moveAndRename operations.
|
protected void |
doRename(org.apache.directory.api.ldap.model.name.Dn oldDn,
org.apache.directory.api.ldap.model.name.Rdn newRdn,
boolean delOldRdn)
Used to encapsulate [de]marshalling of controls before and after rename operations.
|
protected EntryFilteringCursor |
doSearchOperation(org.apache.directory.api.ldap.model.name.Dn dn,
org.apache.directory.api.ldap.model.message.AliasDerefMode aliasDerefMode,
org.apache.directory.api.ldap.model.filter.ExprNode filter,
javax.naming.directory.SearchControls searchControls)
Used to encapsulate [de]marshalling of controls before and after list operations.
|
DirectoryService |
getDirectoryService() |
protected org.apache.directory.api.ldap.model.name.Dn |
getDn()
Gets the distinguished name of the entry associated with this Context.
|
java.util.Hashtable<java.lang.String,java.lang.Object> |
getEnvironment() |
protected java.util.Map<javax.naming.event.NamingListener,DirectoryListener> |
getListeners()
Allows subclasses to register and unregister listeners.
|
java.lang.String |
getNameInNamespace() |
javax.naming.NameParser |
getNameParser(javax.naming.Name name)
Non-federated implementation presuming the name argument is not a
composite name spanning multiple namespaces but a compound name in
the same LDAP namespace.
|
javax.naming.NameParser |
getNameParser(java.lang.String name)
Non-federated implementation presuming the name argument is not a
composite name spanning multiple namespaces but a compound name in
the same LDAP namespace.
|
abstract ServerContext |
getRootContext()
Gets a handle on the root context of the DIT.
|
DirectoryService |
getService()
Gets the
DirectoryService associated with this context. |
CoreSession |
getSession() |
private void |
injectRdnAttributeValues(org.apache.directory.api.ldap.model.name.Dn target,
org.apache.directory.api.ldap.model.entry.Entry serverEntry) |
protected void |
injectReferralControl(OperationContext opCtx)
Set the referral handling flag into the operation context using
the JNDI value stored into the environment.
|
javax.naming.NamingEnumeration |
list(javax.naming.Name name) |
javax.naming.NamingEnumeration |
list(java.lang.String name) |
javax.naming.NamingEnumeration |
listBindings(javax.naming.Name name) |
javax.naming.NamingEnumeration |
listBindings(java.lang.String name) |
java.lang.Object |
lookup(javax.naming.Name name) |
java.lang.Object |
lookup(java.lang.String name) |
java.lang.Object |
lookupLink(javax.naming.Name name) |
java.lang.Object |
lookupLink(java.lang.String name) |
void |
rebind(javax.naming.Name name,
java.lang.Object obj) |
void |
rebind(java.lang.String name,
java.lang.Object obj) |
java.lang.Object |
removeFromEnvironment(java.lang.String propName) |
void |
removeNamingListener(javax.naming.event.NamingListener namingListener) |
void |
rename(javax.naming.Name oldName,
javax.naming.Name newName) |
void |
rename(java.lang.String oldName,
java.lang.String newName) |
boolean |
targetMustExist() |
void |
unbind(javax.naming.Name name) |
void |
unbind(java.lang.String name) |
public static final java.lang.String DELETE_OLD_RDN_PROP
protected static final javax.naming.ldap.Control[] EMPTY_CONTROLS
private final DirectoryService service
protected org.apache.directory.api.ldap.model.schema.SchemaManager schemaManager
protected org.apache.directory.api.ldap.model.schema.AttributeType objectClassAT
private final java.util.Hashtable<java.lang.String,java.lang.Object> env
private final org.apache.directory.api.ldap.model.name.Dn dn
private final java.util.Map<javax.naming.event.NamingListener,DirectoryListener> listeners
protected javax.naming.ldap.Control[] requestControls
protected javax.naming.ldap.Control[] responseControls
protected javax.naming.ldap.Control[] connectControls
private final CoreSession session
private static final java.util.Map<java.lang.String,ControlEnum> ADS_CONTROLS
protected ServerContext(DirectoryService service, java.util.Hashtable<java.lang.String,java.lang.Object> env) throws java.lang.Exception
Context.PROVIDER_URL key and value to determine the distinguished name
of the newly created context. It also checks to make sure the
referenced name actually exists within the system. This constructor
is used for all InitialContext requests.service - the parent service that manages this contextenv - the environment properties used by this context.javax.naming.NamingException - if the environment parameters are not set
correctly.java.lang.Exceptionpublic ServerContext(DirectoryService service, LdapPrincipal principal, javax.naming.Name name) throws java.lang.Exception
service - the directory service coreprincipal - the directory user principal that is propagatedname - the distinguished name of this contextjavax.naming.NamingException - if there is a problem creating the new contextjava.lang.Exceptionpublic ServerContext(DirectoryService service, CoreSession session, javax.naming.Name name) throws java.lang.Exception
java.lang.Exceptionprotected void injectReferralControl(OperationContext opCtx)
protected void doAddOperation(org.apache.directory.api.ldap.model.name.Dn target,
org.apache.directory.api.ldap.model.entry.Entry entry)
throws java.lang.Exception
entry - target - java.lang.Exceptionprotected void doDeleteOperation(org.apache.directory.api.ldap.model.name.Dn target)
throws java.lang.Exception
target - java.lang.Exceptionprivate org.apache.directory.api.ldap.model.message.Control convertControl(boolean isRequest,
javax.naming.ldap.Control jndiControl)
throws org.apache.directory.api.asn1.DecoderException
org.apache.directory.api.asn1.DecoderExceptionprivate org.apache.directory.api.ldap.model.message.Control[] convertControls(boolean isRequest,
javax.naming.ldap.Control[] jndiControls)
throws org.apache.directory.api.asn1.DecoderException
org.apache.directory.api.asn1.DecoderExceptionprotected EntryFilteringCursor doSearchOperation(org.apache.directory.api.ldap.model.name.Dn dn, org.apache.directory.api.ldap.model.message.AliasDerefMode aliasDerefMode, org.apache.directory.api.ldap.model.filter.ExprNode filter, javax.naming.directory.SearchControls searchControls) throws java.lang.Exception
dn - aliasDerefMode - filter - searchControls - java.lang.Exceptionprotected EntryFilteringCursor doListOperation(org.apache.directory.api.ldap.model.name.Dn target) throws java.lang.Exception
java.lang.Exceptionprotected org.apache.directory.api.ldap.model.entry.Entry doGetRootDseOperation(org.apache.directory.api.ldap.model.name.Dn target)
throws java.lang.Exception
java.lang.Exceptionprotected org.apache.directory.api.ldap.model.entry.Entry doLookupOperation(org.apache.directory.api.ldap.model.name.Dn target)
throws java.lang.Exception
java.lang.Exceptionprotected org.apache.directory.api.ldap.model.entry.Entry doLookupOperation(org.apache.directory.api.ldap.model.name.Dn target,
java.lang.String[] attrIds)
throws java.lang.Exception
java.lang.Exceptionprotected BindOperationContext doBindOperation(org.apache.directory.api.ldap.model.name.Dn bindDn, byte[] credentials, java.lang.String saslMechanism, java.lang.String saslAuthId) throws java.lang.Exception
java.lang.Exceptionprotected void doMoveAndRenameOperation(org.apache.directory.api.ldap.model.name.Dn oldDn,
org.apache.directory.api.ldap.model.name.Dn parent,
org.apache.directory.api.ldap.model.name.Rdn newRdn,
boolean delOldDn)
throws java.lang.Exception
java.lang.Exceptionprotected void doModifyOperation(org.apache.directory.api.ldap.model.name.Dn dn,
java.util.List<org.apache.directory.api.ldap.model.entry.Modification> modifications)
throws java.lang.Exception
java.lang.Exceptionprotected void doMove(org.apache.directory.api.ldap.model.name.Dn oldDn,
org.apache.directory.api.ldap.model.name.Dn target)
throws java.lang.Exception
java.lang.Exceptionprotected void doRename(org.apache.directory.api.ldap.model.name.Dn oldDn,
org.apache.directory.api.ldap.model.name.Rdn newRdn,
boolean delOldRdn)
throws java.lang.Exception
java.lang.Exceptionpublic CoreSession getSession()
public DirectoryService getDirectoryService()
public abstract ServerContext getRootContext() throws javax.naming.NamingException
javax.naming.NamingException - if this failspublic DirectoryService getService()
DirectoryService associated with this context.protected org.apache.directory.api.ldap.model.name.Dn getDn()
public void close()
throws javax.naming.NamingException
close in interface javax.naming.Contextjavax.naming.NamingExceptionContext.close()public java.lang.String getNameInNamespace()
throws javax.naming.NamingException
getNameInNamespace in interface javax.naming.Contextjavax.naming.NamingExceptionContext.getNameInNamespace()public java.util.Hashtable<java.lang.String,java.lang.Object> getEnvironment()
getEnvironment in interface javax.naming.ContextContext.getEnvironment()public java.lang.Object addToEnvironment(java.lang.String propName,
java.lang.Object propVal)
throws javax.naming.NamingException
addToEnvironment in interface javax.naming.Contextjavax.naming.NamingExceptionContext.addToEnvironment(java.lang.String,
java.lang.Object)public java.lang.Object removeFromEnvironment(java.lang.String propName)
throws javax.naming.NamingException
removeFromEnvironment in interface javax.naming.Contextjavax.naming.NamingExceptionContext.removeFromEnvironment(java.lang.String)public javax.naming.Context createSubcontext(java.lang.String name)
throws javax.naming.NamingException
createSubcontext in interface javax.naming.Contextjavax.naming.NamingExceptionContext.createSubcontext(java.lang.String)public javax.naming.Context createSubcontext(javax.naming.Name name)
throws javax.naming.NamingException
createSubcontext in interface javax.naming.Contextjavax.naming.NamingExceptionContext.createSubcontext(javax.naming.Name)public void destroySubcontext(java.lang.String name)
throws javax.naming.NamingException
destroySubcontext in interface javax.naming.Contextjavax.naming.NamingExceptionContext.destroySubcontext(java.lang.String)public void destroySubcontext(javax.naming.Name name)
throws javax.naming.NamingException
destroySubcontext in interface javax.naming.Contextjavax.naming.NamingExceptionContext.destroySubcontext(javax.naming.Name)public void bind(java.lang.String name,
java.lang.Object obj)
throws javax.naming.NamingException
bind in interface javax.naming.Contextjavax.naming.NamingExceptionContext.bind(java.lang.String, java.lang.Object)private void injectRdnAttributeValues(org.apache.directory.api.ldap.model.name.Dn target,
org.apache.directory.api.ldap.model.entry.Entry serverEntry)
throws javax.naming.NamingException
javax.naming.NamingExceptionpublic void bind(javax.naming.Name name,
java.lang.Object obj)
throws javax.naming.NamingException
bind in interface javax.naming.Contextjavax.naming.NamingExceptionContext.bind(javax.naming.Name, java.lang.Object)public void rename(java.lang.String oldName,
java.lang.String newName)
throws javax.naming.NamingException
rename in interface javax.naming.Contextjavax.naming.NamingExceptionContext.rename(java.lang.String, java.lang.String)public void rename(javax.naming.Name oldName,
javax.naming.Name newName)
throws javax.naming.NamingException
rename in interface javax.naming.Contextjavax.naming.NamingExceptionContext.rename(javax.naming.Name, javax.naming.Name)public void rebind(java.lang.String name,
java.lang.Object obj)
throws javax.naming.NamingException
rebind in interface javax.naming.Contextjavax.naming.NamingExceptionContext.rebind(java.lang.String, java.lang.Object)public void rebind(javax.naming.Name name,
java.lang.Object obj)
throws javax.naming.NamingException
rebind in interface javax.naming.Contextjavax.naming.NamingExceptionContext.rebind(javax.naming.Name, java.lang.Object)public void unbind(java.lang.String name)
throws javax.naming.NamingException
unbind in interface javax.naming.Contextjavax.naming.NamingExceptionContext.unbind(java.lang.String)public void unbind(javax.naming.Name name)
throws javax.naming.NamingException
unbind in interface javax.naming.Contextjavax.naming.NamingExceptionContext.unbind(javax.naming.Name)public java.lang.Object lookup(java.lang.String name)
throws javax.naming.NamingException
lookup in interface javax.naming.Contextjavax.naming.NamingExceptionContext.lookup(java.lang.String)public java.lang.Object lookup(javax.naming.Name name)
throws javax.naming.NamingException
lookup in interface javax.naming.Contextjavax.naming.NamingExceptionContext.lookup(javax.naming.Name)public java.lang.Object lookupLink(java.lang.String name)
throws javax.naming.NamingException
lookupLink in interface javax.naming.Contextjavax.naming.NamingExceptionContext.lookupLink(java.lang.String)public java.lang.Object lookupLink(javax.naming.Name name)
throws javax.naming.NamingException
lookupLink in interface javax.naming.Contextjavax.naming.NamingExceptionContext.lookupLink(javax.naming.Name)public javax.naming.NameParser getNameParser(java.lang.String name)
throws javax.naming.NamingException
getNameParser in interface javax.naming.Contextjavax.naming.NamingExceptionContext.getNameParser(java.lang.String)public javax.naming.NameParser getNameParser(javax.naming.Name name)
throws javax.naming.NamingException
getNameParser in interface javax.naming.Contextjavax.naming.NamingExceptionContext.getNameParser(javax.naming.Name)public javax.naming.NamingEnumeration list(java.lang.String name)
throws javax.naming.NamingException
list in interface javax.naming.Contextjavax.naming.NamingExceptionContext.list(java.lang.String)public javax.naming.NamingEnumeration list(javax.naming.Name name)
throws javax.naming.NamingException
list in interface javax.naming.Contextjavax.naming.NamingExceptionContext.list(javax.naming.Name)public javax.naming.NamingEnumeration listBindings(java.lang.String name)
throws javax.naming.NamingException
listBindings in interface javax.naming.Contextjavax.naming.NamingExceptionContext.listBindings(java.lang.String)public javax.naming.NamingEnumeration listBindings(javax.naming.Name name)
throws javax.naming.NamingException
listBindings in interface javax.naming.Contextjavax.naming.NamingExceptionContext.listBindings(javax.naming.Name)public java.lang.String composeName(java.lang.String name,
java.lang.String prefix)
throws javax.naming.NamingException
composeName in interface javax.naming.Contextjavax.naming.NamingExceptionContext.composeName(java.lang.String, java.lang.String)public javax.naming.Name composeName(javax.naming.Name name,
javax.naming.Name prefix)
throws javax.naming.NamingException
composeName in interface javax.naming.Contextjavax.naming.NamingExceptionContext.composeName(javax.naming.Name,
javax.naming.Name)public void addNamingListener(javax.naming.Name name,
int scope,
javax.naming.event.NamingListener namingListener)
throws javax.naming.NamingException
addNamingListener in interface javax.naming.event.EventContextjavax.naming.NamingExceptionpublic void addNamingListener(java.lang.String name,
int scope,
javax.naming.event.NamingListener namingListener)
throws javax.naming.NamingException
addNamingListener in interface javax.naming.event.EventContextjavax.naming.NamingExceptionpublic void removeNamingListener(javax.naming.event.NamingListener namingListener)
throws javax.naming.NamingException
removeNamingListener in interface javax.naming.event.EventContextjavax.naming.NamingExceptionpublic boolean targetMustExist()
throws javax.naming.NamingException
targetMustExist in interface javax.naming.event.EventContextjavax.naming.NamingExceptionprotected java.util.Map<javax.naming.event.NamingListener,DirectoryListener> getListeners()
org.apache.directory.api.ldap.model.name.Dn buildTarget(org.apache.directory.api.ldap.model.name.Dn relativeName)
throws javax.naming.NamingException
relativeName - a name relative to this context.javax.naming.InvalidNameException - if relativeName is not a valid name in
the LDAP namespace.javax.naming.NamingException