Liferay 6.2-ce-ga5

com.liferay.portal.kernel.util
Class ClassLoaderPool

java.lang.Object
  extended by com.liferay.portal.kernel.util.ClassLoaderPool

public class ClassLoaderPool
extends Object

Maps servlet context names to/from the servlet context's class loader.


Constructor Summary
ClassLoaderPool()
           
 
Method Summary
static ClassLoader getClassLoader(String contextName)
          Returns the class loader associated with the context name.
static String getContextName(ClassLoader classLoader)
          Returns the context name associated with the class loader.
static void register(String contextName, ClassLoader classLoader)
           
static void unregister(ClassLoader classLoader)
           
static void unregister(String contextName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassLoaderPool

public ClassLoaderPool()
Method Detail

getClassLoader

public static ClassLoader getClassLoader(String contextName)
Returns the class loader associated with the context name.

If no class loader is found for the context name, this method checks for an initialized portal class loader to return. In cases where this method is invoked from outside of a running portal, such as from a unit test or from an external tool, no portal class loader will be found. If no portal class loader is found, the thread's context class loader is returned as a fallback.

Parameters:
contextName - the servlet context's name
Returns:
the class loader associated with the context name

getContextName

public static String getContextName(ClassLoader classLoader)
Returns the context name associated with the class loader.

If the class loader is null or if no context name is associated with the class loader, StringPool.BLANK is returned.

Parameters:
classLoader - the class loader
Returns:
the context name associated with the class loader

register

public static void register(String contextName,
                            ClassLoader classLoader)

unregister

public static void unregister(ClassLoader classLoader)

unregister

public static void unregister(String contextName)

Liferay 6.2-ce-ga5