public abstract class ServerContext extends Object implements EventContext
Modifier and Type | Field and Description |
---|---|
protected Control[] |
connectControls
Connection level controls associated with the session
|
static String |
DELETE_OLD_RDN_PROP
property key used for deleting the old Rdn on a rename
|
protected static Control[] |
EMPTY_CONTROLS
Empty array of controls for use in dealing with them
|
protected org.apache.directory.api.ldap.model.schema.AttributeType |
objectClassAT
A reference to the ObjectClass AT
|
protected Control[] |
requestControls
The request controls to set on operations before performing them
|
protected Control[] |
responseControls
The response controls to set after performing operations
|
protected org.apache.directory.api.ldap.model.schema.SchemaManager |
schemaManager
The SchemManager instance
|
OBJECT_SCOPE, ONELEVEL_SCOPE, SUBTREE_SCOPE
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
Modifier | Constructor and Description |
---|---|
|
ServerContext(DirectoryService service,
CoreSession session,
Name name) |
protected |
ServerContext(DirectoryService service,
Hashtable<String,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,
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(Name name,
int scope,
NamingListener namingListener) |
void |
addNamingListener(String name,
int scope,
NamingListener namingListener) |
Object |
addToEnvironment(String propName,
Object propVal) |
void |
bind(Name name,
Object obj) |
void |
bind(String name,
Object obj) |
void |
close() |
Name |
composeName(Name name,
Name prefix) |
String |
composeName(String name,
String prefix) |
Context |
createSubcontext(Name name) |
Context |
createSubcontext(String name) |
void |
destroySubcontext(Name name) |
void |
destroySubcontext(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,
String saslMechanism,
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)
Fetch the rootDSE entry
|
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,
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,
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 delOldRdn)
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,
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.
|
Hashtable<String,Object> |
getEnvironment() |
protected Map<NamingListener,DirectoryListener> |
getListeners()
Allows subclasses to register and unregister listeners.
|
String |
getNameInNamespace() |
NameParser |
getNameParser(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.
|
NameParser |
getNameParser(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() |
protected void |
injectReferralControl(OperationContext opCtx)
Set the referral handling flag into the operation context using
the JNDI value stored into the environment.
|
NamingEnumeration |
list(Name name) |
NamingEnumeration |
list(String name) |
NamingEnumeration |
listBindings(Name name) |
NamingEnumeration |
listBindings(String name) |
Object |
lookup(Name name) |
Object |
lookup(String name) |
Object |
lookupLink(Name name) |
Object |
lookupLink(String name) |
void |
rebind(Name name,
Object obj) |
void |
rebind(String name,
Object obj) |
Object |
removeFromEnvironment(String propName) |
void |
removeNamingListener(NamingListener namingListener) |
void |
rename(Name oldName,
Name newName) |
void |
rename(String oldName,
String newName) |
boolean |
targetMustExist() |
void |
unbind(Name name) |
void |
unbind(String name) |
public static final String DELETE_OLD_RDN_PROP
protected static final Control[] EMPTY_CONTROLS
protected org.apache.directory.api.ldap.model.schema.SchemaManager schemaManager
protected org.apache.directory.api.ldap.model.schema.AttributeType objectClassAT
protected Control[] requestControls
protected Control[] responseControls
protected Control[] connectControls
protected ServerContext(DirectoryService service, Hashtable<String,Object> env) throws 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.NamingException
- if the environment parameters are not set
correctly.Exception
public ServerContext(DirectoryService service, LdapPrincipal principal, Name name) throws Exception
service
- the directory service coreprincipal
- the directory user principal that is propagatedname
- the distinguished name of this contextNamingException
- if there is a problem creating the new contextException
public ServerContext(DirectoryService service, CoreSession session, Name name) throws Exception
Exception
protected void injectReferralControl(OperationContext opCtx)
opCtx
- The operation contextprotected void doAddOperation(org.apache.directory.api.ldap.model.name.Dn target, org.apache.directory.api.ldap.model.entry.Entry entry) throws Exception
target
- The entry's Dn to addentry
- The entry to addException
- If the add failedprotected void doDeleteOperation(org.apache.directory.api.ldap.model.name.Dn target) throws Exception
target
- The entry's Dn we want to deleteException
- If we can't delete the entryprotected 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, SearchControls searchControls) throws Exception
dn
- The base search DnaliasDerefMode
- The AliasDeref modefilter
- The search filtersearchControls
- The controlsException
- If the search failedprotected EntryFilteringCursor doListOperation(org.apache.directory.api.ldap.model.name.Dn target) throws Exception
target
- The search DnException
- If we can't process the searchprotected org.apache.directory.api.ldap.model.entry.Entry doGetRootDseOperation(org.apache.directory.api.ldap.model.name.Dn target) throws Exception
target
- Should be emptyException
- If we can't fetch the RootDSE entryprotected org.apache.directory.api.ldap.model.entry.Entry doLookupOperation(org.apache.directory.api.ldap.model.name.Dn target) throws Exception
target
- The Dn we are looking forException
- If the lookup failedprotected org.apache.directory.api.ldap.model.entry.Entry doLookupOperation(org.apache.directory.api.ldap.model.name.Dn target, String[] attrIds) throws Exception
target
- The Dn we are looking forattrIds
- The attributes to returnException
- If the lookup failedprotected BindOperationContext doBindOperation(org.apache.directory.api.ldap.model.name.Dn bindDn, byte[] credentials, String saslMechanism, String saslAuthId) throws Exception
bindDn
- The user's Dncredentials
- The credentialssaslMechanism
- The SASL mechanism to usesaslAuthId
- The SASL authorization IDException
- If the Bind failedprotected 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 delOldRdn) throws Exception
oldDn
- The old Dnparent
- The new parentnewRdn
- The new RdndelOldRdn
- If we shoud delete the old RdnException
- If the move and rename failedprotected void doModifyOperation(org.apache.directory.api.ldap.model.name.Dn dn, List<org.apache.directory.api.ldap.model.entry.Modification> modifications) throws Exception
dn
- The modified entry's dnmodifications
- The list of modifications to applyException
- If the modify failedprotected void doMove(org.apache.directory.api.ldap.model.name.Dn oldDn, org.apache.directory.api.ldap.model.name.Dn target) throws Exception
oldDn
- The old Dntarget
- The targetException
- If the move failedprotected void doRename(org.apache.directory.api.ldap.model.name.Dn oldDn, org.apache.directory.api.ldap.model.name.Rdn newRdn, boolean delOldRdn) throws Exception
oldDn
- The old DnnewRdn
- The new RdndelOldRdn
- If we should delete the old RdnException
- If the rename failedpublic CoreSession getSession()
public DirectoryService getDirectoryService()
public abstract ServerContext getRootContext() throws NamingException
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 NamingException
close
in interface Context
NamingException
Context.close()
public String getNameInNamespace() throws NamingException
getNameInNamespace
in interface Context
NamingException
Context.getNameInNamespace()
public Hashtable<String,Object> getEnvironment()
getEnvironment
in interface Context
Context.getEnvironment()
public Object addToEnvironment(String propName, Object propVal) throws NamingException
addToEnvironment
in interface Context
NamingException
Context.addToEnvironment(java.lang.String,
java.lang.Object)
public Object removeFromEnvironment(String propName) throws NamingException
removeFromEnvironment
in interface Context
NamingException
Context.removeFromEnvironment(java.lang.String)
public Context createSubcontext(String name) throws NamingException
createSubcontext
in interface Context
NamingException
Context.createSubcontext(java.lang.String)
public Context createSubcontext(Name name) throws NamingException
createSubcontext
in interface Context
NamingException
Context.createSubcontext(javax.naming.Name)
public void destroySubcontext(String name) throws NamingException
destroySubcontext
in interface Context
NamingException
Context.destroySubcontext(java.lang.String)
public void destroySubcontext(Name name) throws NamingException
destroySubcontext
in interface Context
NamingException
Context.destroySubcontext(javax.naming.Name)
public void bind(String name, Object obj) throws NamingException
bind
in interface Context
NamingException
Context.bind(java.lang.String, java.lang.Object)
public void bind(Name name, Object obj) throws NamingException
bind
in interface Context
NamingException
Context.bind(javax.naming.Name, java.lang.Object)
public void rename(String oldName, String newName) throws NamingException
rename
in interface Context
NamingException
Context.rename(java.lang.String, java.lang.String)
public void rename(Name oldName, Name newName) throws NamingException
rename
in interface Context
NamingException
Context.rename(javax.naming.Name, javax.naming.Name)
public void rebind(String name, Object obj) throws NamingException
rebind
in interface Context
NamingException
Context.rebind(java.lang.String, java.lang.Object)
public void rebind(Name name, Object obj) throws NamingException
rebind
in interface Context
NamingException
Context.rebind(javax.naming.Name, java.lang.Object)
public void unbind(String name) throws NamingException
unbind
in interface Context
NamingException
Context.unbind(java.lang.String)
public void unbind(Name name) throws NamingException
unbind
in interface Context
NamingException
Context.unbind(javax.naming.Name)
public Object lookup(String name) throws NamingException
lookup
in interface Context
NamingException
Context.lookup(java.lang.String)
public Object lookup(Name name) throws NamingException
lookup
in interface Context
NamingException
Context.lookup(javax.naming.Name)
public Object lookupLink(String name) throws NamingException
lookupLink
in interface Context
NamingException
Context.lookupLink(java.lang.String)
public Object lookupLink(Name name) throws NamingException
lookupLink
in interface Context
NamingException
Context.lookupLink(javax.naming.Name)
public NameParser getNameParser(String name) throws NamingException
getNameParser
in interface Context
NamingException
Context.getNameParser(java.lang.String)
public NameParser getNameParser(Name name) throws NamingException
getNameParser
in interface Context
NamingException
Context.getNameParser(javax.naming.Name)
public NamingEnumeration list(String name) throws NamingException
list
in interface Context
NamingException
Context.list(java.lang.String)
public NamingEnumeration list(Name name) throws NamingException
list
in interface Context
NamingException
Context.list(javax.naming.Name)
public NamingEnumeration listBindings(String name) throws NamingException
listBindings
in interface Context
NamingException
Context.listBindings(java.lang.String)
public NamingEnumeration listBindings(Name name) throws NamingException
listBindings
in interface Context
NamingException
Context.listBindings(javax.naming.Name)
public String composeName(String name, String prefix) throws NamingException
composeName
in interface Context
NamingException
Context.composeName(java.lang.String, java.lang.String)
public Name composeName(Name name, Name prefix) throws NamingException
composeName
in interface Context
NamingException
Context.composeName(javax.naming.Name,
javax.naming.Name)
public void addNamingListener(Name name, int scope, NamingListener namingListener) throws NamingException
addNamingListener
in interface EventContext
NamingException
public void addNamingListener(String name, int scope, NamingListener namingListener) throws NamingException
addNamingListener
in interface EventContext
NamingException
public void removeNamingListener(NamingListener namingListener) throws NamingException
removeNamingListener
in interface EventContext
NamingException
public boolean targetMustExist() throws NamingException
targetMustExist
in interface EventContext
NamingException
protected Map<NamingListener,DirectoryListener> getListeners()
Copyright © 2003–2020 The Apache Software Foundation. All rights reserved.