org.red5.classloading
Class ClassLoaderBuilder

java.lang.Object
  extended by org.red5.classloading.ClassLoaderBuilder

public final class ClassLoaderBuilder
extends Object

Class used to get the Servlet Class loader. The class loader returned is a child first class loader.
This class is based on original code from the XINS project, by Anthony Goubard ([email protected])

Author:
Paul Gregoire ([email protected])

Nested Class Summary
static class ClassLoaderBuilder.JarFileFilter
          Filters jar files
 
Field Summary
static int USE_CLASSPATH_LIB
          Load the Servlet code from the WAR file and use the current classpath for the libraries.
static int USE_RED5_LIB
          Load the servlet code from the WAR file and try to find the libraries in the common red5 lib directory.
static int USE_WAR_LIB
          Load the servlet code and the libraries from the WAR file.
 
Constructor Summary
ClassLoaderBuilder()
           
 
Method Summary
static ClassLoader build()
          Default build uses Red5 common lib without a parent classloader.
static ClassLoader build(File path, int mode, ClassLoader parent)
          Gets a class loader based on mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USE_CLASSPATH_LIB

public static final int USE_CLASSPATH_LIB
Load the Servlet code from the WAR file and use the current classpath for the libraries.

See Also:
Constant Field Values

USE_RED5_LIB

public static final int USE_RED5_LIB
Load the servlet code from the WAR file and try to find the libraries in the common red5 lib directory.

See Also:
Constant Field Values

USE_WAR_LIB

public static final int USE_WAR_LIB
Load the servlet code and the libraries from the WAR file. This may take some time as the libraries need to be extracted from the WAR file.

See Also:
Constant Field Values
Constructor Detail

ClassLoaderBuilder

public ClassLoaderBuilder()
Method Detail

build

public static ClassLoader build()
Default build uses Red5 common lib without a parent classloader.

Returns:
the class loader

build

public static ClassLoader build(File path,
                                int mode,
                                ClassLoader parent)
Gets a class loader based on mode.

Parameters:
path - the directory or file containing classes
mode - the mode in which the servlet should be loaded. The possible values are USE_CURRENT_CLASSPATH, USE_CLASSPATH_LIB, USE_XINS_LIB, USE_WAR_LIB.
parent - the parent class loader or null if you want the current threads class loader
Returns:
the Class loader to use to load the required class(es).


Copyright © 2006-2012 The Red5 Project