org.mule.config.spring.jndi
Class DefaultSpringJndiContext

java.lang.Object
  extended by org.mule.config.spring.jndi.DefaultSpringJndiContext
All Implemented Interfaces:
Serializable, Context

public class DefaultSpringJndiContext
extends Object
implements Context, Serializable

A simple spring based JNDI context which is mutable

Borrowed from the XBean (xbean.codehaus.org) project. Thanks guys!

See Also:
Serialized Form

Field Summary
protected  Map bindings
           
protected  Hashtable environment
           
protected static NameParser nameParser
           
static String SEPARATOR
           
protected  Map treeBindings
           
 
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
  DefaultSpringJndiContext()
           
protected DefaultSpringJndiContext(DefaultSpringJndiContext clone, Hashtable env)
           
protected DefaultSpringJndiContext(DefaultSpringJndiContext clone, Hashtable env, String nameInNamespace)
           
  DefaultSpringJndiContext(Hashtable env)
           
  DefaultSpringJndiContext(Hashtable environment, Map bindings)
           
  DefaultSpringJndiContext(Hashtable environment, Map bindings, String nameInNamespace)
           
 
Method Summary
 Object addToEnvironment(String propName, Object propVal)
           
 void bind(Name name, Object value)
           
 void bind(String name, Object value)
           
protected  void checkFrozen()
           
 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)
           
 Map getEntries()
           
 Hashtable getEnvironment()
           
 String getNameInNamespace()
           
 NameParser getNameParser(Name name)
           
 NameParser getNameParser(String name)
           
protected  Map internalBind(String name, Object value)
          internalBind is intended for use only during setup or possibly by suitably synchronized superclasses.
protected  Map internalBind(String name, Object value, boolean allowRebind)
           
 boolean isFreeze()
           
 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)
           
protected  DefaultSpringJndiContext newContext()
           
 void rebind(Name name, Object value)
           
 void rebind(String name, Object value)
           
 Object removeFromEnvironment(String propName)
           
 void rename(Name oldName, Name newName)
           
 void rename(String oldName, String newName)
           
 void setEntries(Map entries)
           
 void setFreeze(boolean freeze)
           
 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

nameParser

protected static final NameParser nameParser

environment

protected final Hashtable environment

bindings

protected final Map bindings

treeBindings

protected final Map treeBindings

SEPARATOR

public static final String SEPARATOR
See Also:
Constant Field Values
Constructor Detail

DefaultSpringJndiContext

public DefaultSpringJndiContext()

DefaultSpringJndiContext

public DefaultSpringJndiContext(Hashtable env)

DefaultSpringJndiContext

public DefaultSpringJndiContext(Hashtable environment,
                                Map bindings)

DefaultSpringJndiContext

public DefaultSpringJndiContext(Hashtable environment,
                                Map bindings,
                                String nameInNamespace)

DefaultSpringJndiContext

protected DefaultSpringJndiContext(DefaultSpringJndiContext clone,
                                   Hashtable env)

DefaultSpringJndiContext

protected DefaultSpringJndiContext(DefaultSpringJndiContext clone,
                                   Hashtable env,
                                   String nameInNamespace)
Method Detail

addToEnvironment

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

getEnvironment

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

removeFromEnvironment

public Object removeFromEnvironment(String propName)
                             throws NamingException
Specified by:
removeFromEnvironment 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

lookupLink

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

composeName

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

composeName

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

list

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

listBindings

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

lookupLink

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

list

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

listBindings

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

bind

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

bind

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

close

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

createSubcontext

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

createSubcontext

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

destroySubcontext

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

destroySubcontext

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

getNameInNamespace

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

getNameParser

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

getNameParser

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

rebind

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

rebind

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

rename

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

rename

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

unbind

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

unbind

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

getEntries

public Map getEntries()

setEntries

public void setEntries(Map entries)
                throws NamingException
Throws:
NamingException

isFreeze

public boolean isFreeze()

setFreeze

public void setFreeze(boolean freeze)

internalBind

protected Map internalBind(String name,
                           Object value)
                    throws NamingException
internalBind is intended for use only during setup or possibly by suitably synchronized superclasses. It binds every possible lookup into a map in each context. To do this, each context strips off one name segment and if necessary creates a new context for it. Then it asks that context to bind the remaining name. It returns a map containing all the bindings from the next context, plus the context it just created (if it in fact created it). (the names are suitably extended by the segment originally lopped off).

Parameters:
name -
value -
Throws:
NamingException

internalBind

protected Map internalBind(String name,
                           Object value,
                           boolean allowRebind)
                    throws NamingException
Throws:
NamingException

checkFrozen

protected void checkFrozen()
                    throws OperationNotSupportedException
Throws:
OperationNotSupportedException

newContext

protected DefaultSpringJndiContext newContext()


Copyright © 2003-2012 MuleSoft, Inc.. All Rights Reserved.