org.ow2.jonas.lib.naming
Class SingletonNamingManager

java.lang.Object
  extended by org.ow2.jonas.lib.naming.SingletonNamingManager
All Implemented Interfaces:
JNamingManager

public class SingletonNamingManager
extends Object
implements JNamingManager

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

Author:
Philippe Durieux, Philippe Coq : Monolog, Florent Benoit & Ludovic Bert : Context for web container

Method Summary
 Context getComponentContext()
          Get the Context associated with the current thread or to a class loader.
 Context getComponentContext(ClassLoader cl)
          Return the ComponentContext associated with the given classloader.
 Hashtable<?,?> getEnv()
          Return the environment for JNDI This is used only for handles today.
 InitialContext getInitialContext()
          Get the initialContext used in this jonas server.
static JNamingManager getInstance()
          Return the unique instance of a NamingManager.
 Context getServerContext()
          Get the server component context.
 void resetComponentContext(Context ctx)
          Set back the context with the given value.
 void setClientContainerComponentContext(Context ctx)
          Set the context used by client container (per JVM instead of per thread).
 Context setComponentContext(Context ctx)
          Associate this ComponentContext with the current thread.
 void setComponentContext(Context ctx, ClassLoader cl)
          Associate the specified ComponentContext with the given classloader.
 void setJComponentContextFactory(JComponentContextFactory factory)
          Set the unique instance of the JComponentContextFactory.
 void unSetComponentContext(ClassLoader cl)
          Remove the ComponentContext 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 JNamingManager getInstance()
                                  throws NamingException
Return the unique instance of a NamingManager.

Returns:
NamingManager the unique instance.
Throws:
NamingException - if it failed.

setJComponentContextFactory

public void setJComponentContextFactory(JComponentContextFactory factory)
Set the unique instance of the JComponentContextFactory.

Specified by:
setJComponentContextFactory in interface JNamingManager
Parameters:
factory - the component context factory

getInitialContext

public InitialContext getInitialContext()
Get the initialContext used in this jonas server.

Specified by:
getInitialContext in interface JNamingManager
Returns:
InitialContext the initial context.

getComponentContext

public Context getComponentContext()
                            throws NamingException
Get the Context associated with the current thread or to a class loader.

Specified by:
getComponentContext in interface JNamingManager
Returns:
Context the component context.
Throws:
NamingException - When operation is not allowed

setComponentContext

public Context setComponentContext(Context ctx)
Associate this ComponentContext with the current thread. This method should be called in preinvoke/postinvoke and when we build the bean environment or web environment.

Specified by:
setComponentContext in interface JNamingManager
Parameters:
ctx - the context to associate to the current thread.
Returns:
Context the context of the thread

resetComponentContext

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

Specified by:
resetComponentContext in interface JNamingManager
Parameters:
ctx - the context to associate to the current thread.

setComponentContext

public void setComponentContext(Context ctx,
                                ClassLoader cl)
Associate the specified ComponentContext with the given classloader.

Specified by:
setComponentContext in interface JNamingManager
Parameters:
ctx - the context to associate to the classloader.
cl - the classloader which is bind to the context.

setClientContainerComponentContext

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

Specified by:
setClientContainerComponentContext in interface JNamingManager
Parameters:
ctx - the context to set

getComponentContext

public Context getComponentContext(ClassLoader cl)
Return the ComponentContext associated with the given classloader.

Specified by:
getComponentContext in interface JNamingManager
Parameters:
cl - the classloader which is bind to the context.
Returns:
the ComponentContext associated with the given classloader.

unSetComponentContext

public void unSetComponentContext(ClassLoader cl)
Remove the ComponentContext associated with the given classloader.

Specified by:
unSetComponentContext in interface JNamingManager
Parameters:
cl - the classloader which is bind to the context.

getEnv

public Hashtable<?,?> getEnv()
Return the environment for JNDI This is used only for handles today.

Specified by:
getEnv in interface JNamingManager
Returns:
Hashtable the environment.

getServerContext

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

Returns:
Context the server component context.


Copyright © 2010 OW2 Consortium. All Rights Reserved.