aicas logo Jamaica 3.4 release 8

com.sun.jndi.toolkit.dir
Class HierMemDirCtx

java.lang.Object
  extended by com.sun.jndi.toolkit.dir.HierMemDirCtx
All Implemented Interfaces:
Context, DirContext

public class HierMemDirCtx
extends Object
implements DirContext

A sample service provider that implements a hierarchical directory in memory. Every operation begins by doing a lookup on the name passed to it and then calls a corresponding "do" on the result of the lookup. The "do" does the work without any further resolution (it assumes that it is the target context).


Nested Class Summary
 class HierMemDirCtx.HierContextEnumerator
           
 
Field Summary
protected  Attributes attrs
           
protected  Hashtable bindings
           
protected  boolean ignoreCase
           
protected  Hashtable myEnv
           
protected  NameParser myParser
           
protected  NamingException readOnlyEx
           
 
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
 
Constructor Summary
  HierMemDirCtx()
           
  HierMemDirCtx(boolean ignoreCase)
           
  HierMemDirCtx(Hashtable environment, boolean ignoreCase)
           
protected HierMemDirCtx(Hashtable environment, boolean ignoreCase, boolean useFac)
           
 
Method Summary
 Object addToEnvironment(String propName, Object propVal)
           
protected static Attributes applyMods(ModificationItem[] mods, Attributes orig)
           
 void bind(Name name, Object obj)
           
 void bind(Name name, Object obj, Attributes attrs)
           
 void bind(String name, Object obj)
           
 void bind(String name, Object obj, Attributes attrs)
           
protected  Name canonizeName(Name name)
           
 void close()
           
 Name composeName(Name name, Name prefix)
           
 String composeName(String name, String prefix)
           
protected  HierMemDirCtx createNewCtx()
           
 Context createSubcontext(Name name)
           
 DirContext createSubcontext(Name name, Attributes attrs)
           
 Context createSubcontext(String name)
           
 DirContext createSubcontext(String name, Attributes attrs)
           
 void destroySubcontext(Name name)
           
 void destroySubcontext(String name)
           
protected  void doBind(Name name, Object obj, Attributes attrs, boolean useFactory)
           
protected  void doBindAux(Name name, Object obj)
           
protected  DirContext doCreateSubcontext(Name name, Attributes attrs)
           
protected  void doDestroySubcontext(Name name)
           
protected  Attributes doGetAttributes()
           
protected  Attributes doGetAttributes(String[] attrIds)
           
protected  NamingEnumeration doList()
           
protected  NamingEnumeration doListBindings(boolean useFactory)
           
 Object doLookup(Name name, boolean useFactory)
           
protected  void doModifyAttributes(ModificationItem[] mods)
           
protected  void doRebind(Name name, Object obj, Attributes attrs, boolean useFactory)
           
protected  void doRebindAux(Name name, Object obj)
           
protected  void doRename(Name oldname, Name newname)
           
protected  void doUnbind(Name name)
           
 Attributes getAttributes(Name name)
           
 Attributes getAttributes(Name name, String[] attrIds)
           
 Attributes getAttributes(String name)
           
 Attributes getAttributes(String name, String[] attrIds)
           
 Hashtable getEnvironment()
           
protected  Name getInternalName(Name name)
           
protected  Name getLeafName(Name name)
           
 String getNameInNamespace()
           
 NameParser getNameParser(Name name)
           
 NameParser getNameParser(String name)
           
 DirContext getSchema(Name name)
           
 DirContext getSchema(String name)
           
 DirContext getSchemaClassDefinition(Name name)
           
 DirContext getSchemaClassDefinition(String name)
           
 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 modifyAttributes(Name name, int mod_op, Attributes attrs)
           
 void modifyAttributes(Name name, ModificationItem[] mods)
           
 void modifyAttributes(String name, int mod_op, Attributes attrs)
           
 void modifyAttributes(String name, ModificationItem[] mods)
           
 void rebind(Name name, Object obj)
           
 void rebind(Name name, Object obj, Attributes attrs)
           
 void rebind(String name, Object obj)
           
 void rebind(String name, Object obj, Attributes attrs)
           
 Object removeFromEnvironment(String propName)
           
 void rename(Name oldname, Name newname)
           
 void rename(String oldname, String newname)
           
 NamingEnumeration search(Name name, Attributes matchingAttributes)
           
 NamingEnumeration search(Name name, Attributes matchingAttributes, String[] attributesToReturn)
           
 NamingEnumeration search(Name name, String filterExpr, Object[] filterArgs, SearchControls cons)
           
 NamingEnumeration search(Name name, String filter, SearchControls cons)
           
 NamingEnumeration search(String name, Attributes matchingAttributes)
           
 NamingEnumeration search(String name, Attributes matchingAttributes, String[] attributesToReturn)
           
 NamingEnumeration search(String name, String filterExpr, Object[] filterArgs, SearchControls cons)
           
 NamingEnumeration search(String name, String filter, SearchControls cons)
           
 void setIgnoreCase(boolean ignoreCase)
           
 void setNameParser(NameParser parser)
           
 void setReadOnly(NamingException e)
           
 void unbind(Name name)
           
 void unbind(String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myEnv

protected Hashtable myEnv

bindings

protected Hashtable bindings

attrs

protected Attributes attrs

ignoreCase

protected boolean ignoreCase

readOnlyEx

protected NamingException readOnlyEx

myParser

protected NameParser myParser
Constructor Detail

HierMemDirCtx

public HierMemDirCtx()

HierMemDirCtx

public HierMemDirCtx(boolean ignoreCase)

HierMemDirCtx

public HierMemDirCtx(Hashtable environment,
                     boolean ignoreCase)

HierMemDirCtx

protected HierMemDirCtx(Hashtable environment,
                        boolean ignoreCase,
                        boolean useFac)
Method Detail

close

public void close()
           throws NamingException
Specified by:
close in interface Context
Throws:
NamingException

getNameInNamespace

public String getNameInNamespace()
                          throws NamingException
Specified by:
getNameInNamespace in interface Context
Throws:
NamingException

lookup

public Object lookup(String name)
              throws NamingException
Specified by:
lookup in interface Context
Throws:
NamingException

lookup

public Object lookup(Name name)
              throws NamingException
Specified by:
lookup in interface Context
Throws:
NamingException

doLookup

public Object doLookup(Name name,
                       boolean useFactory)
                throws NamingException
Throws:
NamingException

bind

public void bind(String name,
                 Object obj)
          throws NamingException
Specified by:
bind in interface Context
Throws:
NamingException

bind

public void bind(Name name,
                 Object obj)
          throws NamingException
Specified by:
bind in interface Context
Throws:
NamingException

bind

public void bind(String name,
                 Object obj,
                 Attributes attrs)
          throws NamingException
Specified by:
bind in interface DirContext
Throws:
NamingException

bind

public void bind(Name name,
                 Object obj,
                 Attributes attrs)
          throws NamingException
Specified by:
bind in interface DirContext
Throws:
NamingException

doBind

protected void doBind(Name name,
                      Object obj,
                      Attributes attrs,
                      boolean useFactory)
               throws NamingException
Throws:
NamingException

doBindAux

protected void doBindAux(Name name,
                         Object obj)
                  throws NamingException
Throws:
NamingException

rebind

public void rebind(String name,
                   Object obj)
            throws NamingException
Specified by:
rebind in interface Context
Throws:
NamingException

rebind

public void rebind(Name name,
                   Object obj)
            throws NamingException
Specified by:
rebind in interface Context
Throws:
NamingException

rebind

public void rebind(String name,
                   Object obj,
                   Attributes attrs)
            throws NamingException
Specified by:
rebind in interface DirContext
Throws:
NamingException

rebind

public void rebind(Name name,
                   Object obj,
                   Attributes attrs)
            throws NamingException
Specified by:
rebind in interface DirContext
Throws:
NamingException

doRebind

protected void doRebind(Name name,
                        Object obj,
                        Attributes attrs,
                        boolean useFactory)
                 throws NamingException
Throws:
NamingException

doRebindAux

protected void doRebindAux(Name name,
                           Object obj)
                    throws NamingException
Throws:
NamingException

unbind

public void unbind(String name)
            throws NamingException
Specified by:
unbind in interface Context
Throws:
NamingException

unbind

public void unbind(Name name)
            throws NamingException
Specified by:
unbind in interface Context
Throws:
NamingException

doUnbind

protected void doUnbind(Name name)
                 throws NamingException
Throws:
NamingException

rename

public void rename(String oldname,
                   String newname)
            throws NamingException
Specified by:
rename in interface Context
Throws:
NamingException

rename

public void rename(Name oldname,
                   Name newname)
            throws NamingException
Specified by:
rename in interface Context
Throws:
NamingException

doRename

protected void doRename(Name oldname,
                        Name newname)
                 throws NamingException
Throws:
NamingException

list

public NamingEnumeration list(String name)
                       throws NamingException
Specified by:
list in interface Context
Throws:
NamingException

list

public NamingEnumeration list(Name name)
                       throws NamingException
Specified by:
list in interface Context
Throws:
NamingException

doList

protected NamingEnumeration doList()
                            throws NamingException
Throws:
NamingException

listBindings

public NamingEnumeration listBindings(String name)
                               throws NamingException
Specified by:
listBindings in interface Context
Throws:
NamingException

listBindings

public NamingEnumeration listBindings(Name name)
                               throws NamingException
Specified by:
listBindings in interface Context
Throws:
NamingException

doListBindings

protected NamingEnumeration doListBindings(boolean useFactory)
                                    throws NamingException
Throws:
NamingException

destroySubcontext

public void destroySubcontext(String name)
                       throws NamingException
Specified by:
destroySubcontext in interface Context
Throws:
NamingException

destroySubcontext

public void destroySubcontext(Name name)
                       throws NamingException
Specified by:
destroySubcontext in interface Context
Throws:
NamingException

doDestroySubcontext

protected void doDestroySubcontext(Name name)
                            throws NamingException
Throws:
NamingException

createSubcontext

public Context createSubcontext(String name)
                         throws NamingException
Specified by:
createSubcontext in interface Context
Throws:
NamingException

createSubcontext

public Context createSubcontext(Name name)
                         throws NamingException
Specified by:
createSubcontext in interface Context
Throws:
NamingException

createSubcontext

public DirContext createSubcontext(String name,
                                   Attributes attrs)
                            throws NamingException
Specified by:
createSubcontext in interface DirContext
Throws:
NamingException

createSubcontext

public DirContext createSubcontext(Name name,
                                   Attributes attrs)
                            throws NamingException
Specified by:
createSubcontext in interface DirContext
Throws:
NamingException

doCreateSubcontext

protected DirContext doCreateSubcontext(Name name,
                                        Attributes attrs)
                                 throws NamingException
Throws:
NamingException

lookupLink

public Object lookupLink(String name)
                  throws NamingException
Specified by:
lookupLink in interface Context
Throws:
NamingException

lookupLink

public Object lookupLink(Name name)
                  throws NamingException
Specified by:
lookupLink in interface Context
Throws:
NamingException

getNameParser

public NameParser getNameParser(String name)
                         throws NamingException
Specified by:
getNameParser in interface Context
Throws:
NamingException

getNameParser

public NameParser getNameParser(Name name)
                         throws NamingException
Specified by:
getNameParser in interface Context
Throws:
NamingException

composeName

public String composeName(String name,
                          String prefix)
                   throws NamingException
Specified by:
composeName in interface Context
Throws:
NamingException

composeName

public Name composeName(Name name,
                        Name prefix)
                 throws NamingException
Specified by:
composeName in interface Context
Throws:
NamingException

addToEnvironment

public Object addToEnvironment(String propName,
                               Object propVal)
                        throws NamingException
Specified by:
addToEnvironment in interface Context
Throws:
NamingException

removeFromEnvironment

public Object removeFromEnvironment(String propName)
                             throws NamingException
Specified by:
removeFromEnvironment in interface Context
Throws:
NamingException

getEnvironment

public Hashtable getEnvironment()
                         throws NamingException
Specified by:
getEnvironment in interface Context
Throws:
NamingException

getAttributes

public Attributes getAttributes(String name)
                         throws NamingException
Specified by:
getAttributes in interface DirContext
Throws:
NamingException

getAttributes

public Attributes getAttributes(Name name)
                         throws NamingException
Specified by:
getAttributes in interface DirContext
Throws:
NamingException

doGetAttributes

protected Attributes doGetAttributes()
                              throws NamingException
Throws:
NamingException

getAttributes

public Attributes getAttributes(String name,
                                String[] attrIds)
                         throws NamingException
Specified by:
getAttributes in interface DirContext
Throws:
NamingException

getAttributes

public Attributes getAttributes(Name name,
                                String[] attrIds)
                         throws NamingException
Specified by:
getAttributes in interface DirContext
Throws:
NamingException

doGetAttributes

protected Attributes doGetAttributes(String[] attrIds)
                              throws NamingException
Throws:
NamingException

modifyAttributes

public void modifyAttributes(String name,
                             int mod_op,
                             Attributes attrs)
                      throws NamingException
Specified by:
modifyAttributes in interface DirContext
Throws:
NamingException

modifyAttributes

public void modifyAttributes(Name name,
                             int mod_op,
                             Attributes attrs)
                      throws NamingException
Specified by:
modifyAttributes in interface DirContext
Throws:
NamingException

modifyAttributes

public void modifyAttributes(String name,
                             ModificationItem[] mods)
                      throws NamingException
Specified by:
modifyAttributes in interface DirContext
Throws:
NamingException

modifyAttributes

public void modifyAttributes(Name name,
                             ModificationItem[] mods)
                      throws NamingException
Specified by:
modifyAttributes in interface DirContext
Throws:
NamingException

doModifyAttributes

protected void doModifyAttributes(ModificationItem[] mods)
                           throws NamingException
Throws:
NamingException

applyMods

protected static Attributes applyMods(ModificationItem[] mods,
                                      Attributes orig)
                               throws NamingException
Throws:
NamingException

search

public NamingEnumeration search(String name,
                                Attributes matchingAttributes)
                         throws NamingException
Specified by:
search in interface DirContext
Throws:
NamingException

search

public NamingEnumeration search(Name name,
                                Attributes matchingAttributes)
                         throws NamingException
Specified by:
search in interface DirContext
Throws:
NamingException

search

public NamingEnumeration search(String name,
                                Attributes matchingAttributes,
                                String[] attributesToReturn)
                         throws NamingException
Specified by:
search in interface DirContext
Throws:
NamingException

search

public NamingEnumeration search(Name name,
                                Attributes matchingAttributes,
                                String[] attributesToReturn)
                         throws NamingException
Specified by:
search in interface DirContext
Throws:
NamingException

search

public NamingEnumeration search(Name name,
                                String filter,
                                SearchControls cons)
                         throws NamingException
Specified by:
search in interface DirContext
Throws:
NamingException

search

public NamingEnumeration search(Name name,
                                String filterExpr,
                                Object[] filterArgs,
                                SearchControls cons)
                         throws NamingException
Specified by:
search in interface DirContext
Throws:
NamingException

search

public NamingEnumeration search(String name,
                                String filter,
                                SearchControls cons)
                         throws NamingException
Specified by:
search in interface DirContext
Throws:
NamingException

search

public NamingEnumeration search(String name,
                                String filterExpr,
                                Object[] filterArgs,
                                SearchControls cons)
                         throws NamingException
Specified by:
search in interface DirContext
Throws:
NamingException

createNewCtx

protected HierMemDirCtx createNewCtx()
                              throws NamingException
Throws:
NamingException

canonizeName

protected Name canonizeName(Name name)
                     throws NamingException
Throws:
NamingException

getInternalName

protected Name getInternalName(Name name)
                        throws NamingException
Throws:
NamingException

getLeafName

protected Name getLeafName(Name name)
                    throws NamingException
Throws:
NamingException

getSchema

public DirContext getSchema(String name)
                     throws NamingException
Specified by:
getSchema in interface DirContext
Throws:
NamingException

getSchema

public DirContext getSchema(Name name)
                     throws NamingException
Specified by:
getSchema in interface DirContext
Throws:
NamingException

getSchemaClassDefinition

public DirContext getSchemaClassDefinition(String name)
                                    throws NamingException
Specified by:
getSchemaClassDefinition in interface DirContext
Throws:
NamingException

getSchemaClassDefinition

public DirContext getSchemaClassDefinition(Name name)
                                    throws NamingException
Specified by:
getSchemaClassDefinition in interface DirContext
Throws:
NamingException

setReadOnly

public void setReadOnly(NamingException e)

setIgnoreCase

public void setIgnoreCase(boolean ignoreCase)

setNameParser

public void setNameParser(NameParser parser)

aicas logo Jamaica 3.4 release 8

aicas GmbH, Karlsruhe - Germany    www.aicas.com
Copyright 2001-2009 aicas GmbH. All Rights Reserved.