org.objectweb.jonas_lib.naming
Interface ContainerNaming

All Known Implementing Classes:
NamingManager

public interface ContainerNaming

Provide naming services for Web and EJB containers. Containers use this interface for binding the environment entries, remote object references, resource factories and for managing the naming context of the current thread.

Author:
Lutris

Method Summary
 javax.naming.Context createEnvironmentContext(java.lang.String namespace)
          Create context for application and component environments.
 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.Context getComponentContext(java.lang.ClassLoader cl)
          Return the CompNamingContext associated with the given classloader.
 java.util.Hashtable getEnv()
           
 javax.naming.InitialContext getInitialContext()
          Gets the initial context
 void resetComponentContext(javax.naming.Context ctx)
          Set back the context with the given value.
 void setClientContainerComponentContext(javax.naming.Context ctx)
          Set the context used by client container (per JVM instead of per thread)
 javax.naming.Context setComponentContext(javax.naming.Context ctx)
          Aassociate this Context with the current thread.
 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.
 

Method Detail

createEnvironmentContext

javax.naming.Context createEnvironmentContext(java.lang.String namespace)
                                              throws javax.naming.NamingException
Create 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.

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.

createImmutableEnvironmentContext

javax.naming.Context createImmutableEnvironmentContext(java.lang.String namespace)
                                                       throws javax.naming.NamingException
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.

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.

getComponentContext

javax.naming.Context getComponentContext()
                                         throws javax.naming.NamingException
Return the Context associated with the current thread.

Returns:
Context for current thread.
Throws:
javax.naming.NamingException - If context namespace does not exist.

setComponentContext

javax.naming.Context setComponentContext(javax.naming.Context ctx)
Aassociate this Context with the current thread. This method should be called in preinvoke/postinvoke and when we build the bean environment.

Parameters:
ctx - Context to associate with the current thread.
Returns:
Previous context setting for current thread.

resetComponentContext

void resetComponentContext(javax.naming.Context ctx)
Set back the context with the given value. Don't return the previous context, use setComponentContext() method for this.

Parameters:
ctx - the context to associate to the current thread.

setComponentContext

void setComponentContext(javax.naming.Context ctx,
                         java.lang.ClassLoader cl)
Associate the specified CompNamingContext with the given classloader.

Parameters:
ctx - the context to associate to the classloader.
cl - the classloader which is bind to the context.

setClientContainerComponentContext

void setClientContainerComponentContext(javax.naming.Context ctx)
Set the context used by client container (per JVM instead of per thread)

Parameters:
ctx - the context to set

getComponentContext

javax.naming.Context getComponentContext(java.lang.ClassLoader cl)
Return the CompNamingContext associated with the given classloader.

Parameters:
cl - the classloader which is bind to the context.
Returns:
the CompNamingContext associated with the given classloader.

unSetComponentContext

void unSetComponentContext(java.lang.ClassLoader cl)
Remove the CompNamingContext associated with the given classloader.

Parameters:
cl - the classloader which is bind to the context.

getInitialContext

javax.naming.InitialContext getInitialContext()
Gets the initial context

Returns:
the initial context

getEnv

java.util.Hashtable getEnv()
Returns:
the environment associated to this initial context