org.objectweb.jonas.naming
Class NamingManager

java.lang.Object
  |
  +--org.objectweb.jonas.naming.NamingManager
All Implemented Interfaces:
ContainerNaming

public class NamingManager
extends java.lang.Object
implements ContainerNaming

Naming Manager for an EJB Server. this singleton class must exist in each jonas server.

Author:
Philippe Durieux Contributor(s): Philippe Coq Monolog Florent Benoit & Ludovic Bert : Context for web container

Method Summary
 javax.naming.Context createEnvironmentContext(java.lang.String namespace)
          Create Context for application and component environments. (formally known as createComponentContext)
 javax.naming.Context createImmutableEnvironmentContext(java.lang.String namespace)
          Create immutable context for application and component environments.
 javax.naming.Context getComponentContext()
          return the Context associated with the current thread.
 javax.naming.InitialContext getCorbaInitialContext()
          return the initialContext used to bind CORBA objects
 java.util.Hashtable getEnv()
          Return the environment for JNDI This is used only for handles today.
 javax.naming.InitialContext getInitialContext()
          return the initialContext used in this jonas server
static NamingManager getInstance()
           
 javax.naming.Context getServerContext()
          gets the server component context This is used only internally in the jonas NamingManager.
 javax.naming.Context setComponentContext(javax.naming.Context ctx)
          associate this CompNamingContext with the current thread. this method should be called in preinvoke/postinvoke and when we build the bean environment.
 void setComponentContext(javax.naming.Context ctx, java.lang.ClassLoader cl)
          Associate the specified CompNamingContext with the given classloader.
 void unSetComponentContext(java.lang.ClassLoader cl)
          Remove the CompNamingContext associated with the given classloader.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static NamingManager getInstance()
                                 throws javax.naming.NamingException

getInitialContext

public javax.naming.InitialContext getInitialContext()
return the initialContext used in this jonas server
Specified by:
getInitialContext in interface ContainerNaming

getCorbaInitialContext

public javax.naming.InitialContext getCorbaInitialContext()
return the initialContext used to bind CORBA objects

createEnvironmentContext

public javax.naming.Context createEnvironmentContext(java.lang.String namespace)
                                              throws javax.naming.NamingException
Create Context for application and component environments. (formally known as createComponentContext)
Specified by:
createEnvironmentContext in interface ContainerNaming
Following copied from interface: org.objectweb.jonas_lib.naming.ContainerNaming
Parameters:
namespace - Subcontext name(s) to create under Server Root. Usually consists of application name + component name.
 Examples:
 "App1/WebWar1" for Web Application
 "App1/EJBJar1/EJBName" for ejb in Enterprise Application.
 
Returns:
Naming context for component environment
Throws:
javax.naming.NamingException - If exception encountered creating namespace.

getComponentContext

public javax.naming.Context getComponentContext()
return the Context associated with the current thread.
Specified by:
getComponentContext in interface ContainerNaming
Following copied from interface: org.objectweb.jonas_lib.naming.ContainerNaming
Returns:
Context for current thread.

setComponentContext

public javax.naming.Context setComponentContext(javax.naming.Context ctx)
associate this CompNamingContext with the current thread. this method should be called in preinvoke/postinvoke and when we build the bean environment.
Specified by:
setComponentContext in interface ContainerNaming
Following copied from interface: org.objectweb.jonas_lib.naming.ContainerNaming
Parameters:
ctx - Context to associate with the current thread.
Returns:
Previous context setting for current thread.

setComponentContext

public void setComponentContext(javax.naming.Context ctx,
                                java.lang.ClassLoader cl)
Associate the specified CompNamingContext with the given classloader.
Specified by:
setComponentContext in interface ContainerNaming
Parameters:
ctx - the context to associate to the classloader.
cl - the classloader which is bind to the context.

unSetComponentContext

public void unSetComponentContext(java.lang.ClassLoader cl)
Remove the CompNamingContext associated with the given classloader.
Specified by:
unSetComponentContext in interface ContainerNaming
Parameters:
cl - the classloader which is bind to the context.

getEnv

public java.util.Hashtable getEnv()
Return the environment for JNDI This is used only for handles today.
Specified by:
getEnv in interface ContainerNaming

createImmutableEnvironmentContext

public javax.naming.Context createImmutableEnvironmentContext(java.lang.String namespace)
                                                       throws javax.naming.NamingException
Description copied from interface: ContainerNaming
Create immutable context for application and component environments. Called by Web Container for each Web Application (as defined in web.xml). Called by EJB Container for each ejb component (as defined in ejb-jar.xml). The returned context provides an independent namespace for each components environment values, and resources. This context must exist in the underlying name service. It must be previously created by an earlier deployment.
Specified by:
createImmutableEnvironmentContext in interface ContainerNaming
Following copied from interface: org.objectweb.jonas_lib.naming.ContainerNaming
Parameters:
namespace - Subcontext name(s) to create under Server Root. Usually consists of application name + component name.
 Examples:
 "App1/WebWar1" for Web Application
 "App1/EJBJar1/EJBName" for ejb in Enterprise Application.
 
Returns:
Naming context for component environment
Throws:
javax.naming.NamingException - If context namespace does not exist.

getServerContext

public javax.naming.Context getServerContext()
gets the server component context This is used only internally in the jonas NamingManager.