|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
com.waveset.util.LHClassLoader
Lighthouse custom class loader (in effect) sets its own CLASSPATH.
This classloader is used for two purposes:
LHClassLoader
extends the environment
by dynamically adding archives to the effective classpath.
This allows us to get around problems setting the CLASSPATH
environment variable due to Windows command line length limits).
This also allows Lighthouse to automatically pick up JAR or ZIP files
needed for site-specific policies or custom resource adapters.
LHClassLoader
overrides the environment
by constructing a parentless class loader.
This creates a separate name space for classes,
which allows Lighthouse to support JCE 1.2.1 even when the JRE does not
(e.g., when the default classloader does not perform
the secure class loading that JCE 1.2.1 requires).
This also allows Lighthouse to avoid conflicts with pluggable extensions
(such as JCE providers or JDBC drivers) placed in the CLASSPATH
or bundled with an application server.
When an object of this class is initialized, it determines which directory it will search for classes, and which directory it will search for archives (i.e., files with the extension ".zip" or ".jar"). Whenever it is asked to find a class or a resource, the LHClassLoader will first search the directory specified by "waveset.lib", and then search every archive it found in that directory.
The LHClassLoader normally works off the value of system property "waveset.home". It confirms that the value of waveset.home is the path to a valid directory, and then looks for a "WEB-INF/classes" and a "WEB-INF/lib" directory directly beneath the directory specified by "waveset.home". The LHClassLoader then searches the "lib" directory for archives.
If Java system property "waveset.lib" has been defined, the LHClassLoader confirms that the value of waveset.lib is the path to a valid directory. The LHClassLoader then searches the specified directory for archives. In this case, "waveset.lib" is both the "classes" and the "lib" directory.
The LHClassLoader requires a minimal set of archives. Specifically, initialization fails if it cannot find "idm.jar" and "j2ee.jar". The LHClassLoader then imposes minimal ordering of the listed archives, placing the required jars (in the order they were specified as required) at the beginning of the search sequence.
Whenever it is asked to find a class or a resource, the LHClassLoader first searches the "classes" directory, and then searches every archive it found in the "lib" directory.
NOTE: The LHClassLoader is often initialized with a null parent, which means that the classpath specified the CLASSPATH environment variable is ignored. This prevents problems that can occur when two jars contain conflicting entries. For example, suppose you want to use Oracle's JDBC driver, but the appserver (whose jar is in the system classpath) bundles its own driver for Oracle.
Field Summary | |
static java.lang.String |
code_id
|
static java.lang.String |
WAVESET_LIB
|
Method Summary | |
protected java.lang.Class |
findClass(java.lang.String name)
|
java.net.URL |
findResource(java.lang.String name)
|
static java.lang.ClassLoader |
getClassLoader(java.lang.ClassLoader parent)
Java system property waveset.home
or waveset.lib must already have been set
in order for the class loader to find the right jars. |
static java.util.List |
getJarFiles(java.net.URL wavesetHomeUrl)
|
boolean |
getVerbose()
|
java.lang.Class |
loadClass(java.lang.String name)
Overridden to load selfishly (altering the normal delegation) so that LHClassLoader can extend the effective classpath. |
java.lang.Class |
loadClass(java.lang.String name,
boolean resolve)
Overridden to load selfishly (altering the normal delegation) so that LHClassLoader can extend the effective classpath. |
protected static void |
println(java.lang.Object o)
|
void |
setVerbose(boolean verbose)
|
Methods inherited from class java.net.URLClassLoader |
addURL, definePackage, findResources, getPermissions, getURLs, newInstance, newInstance |
Methods inherited from class java.security.SecureClassLoader |
defineClass |
Methods inherited from class java.lang.ClassLoader |
clearAssertionStatus, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String code_id
public static final java.lang.String WAVESET_LIB
Method Detail |
public boolean getVerbose()
public void setVerbose(boolean verbose)
public static java.lang.ClassLoader getClassLoader(java.lang.ClassLoader parent) throws java.lang.Exception
waveset.home
or waveset.lib
must already have been set
in order for the class loader to find the right jars.
java.lang.Exception
protected static void println(java.lang.Object o)
public static java.util.List getJarFiles(java.net.URL wavesetHomeUrl) throws java.io.IOException, InvalidArgument, InternalError
wavesetHomeUrl
-
java.io.IOException
InvalidArgument
InternalError
public java.lang.Class loadClass(java.lang.String name) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
public java.lang.Class loadClass(java.lang.String name, boolean resolve) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
protected java.lang.Class findClass(java.lang.String name) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
public java.net.URL findResource(java.lang.String name)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |