|
SAP NetWeaver '04 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.lang.ClassLoader
|
+--com.sapportals.wcm.crt.CrtClassLoaderRegistry
Provides a registry for class loaders.
getClassLoader provides a class loader that
aggregates all registered class loaders to find and load classes and
resources.
Registered class loaders are chained creating one virtual class loader. From the perspective of the JDK, it's all one classloader. Internally, the class loader chain searches like a classpath.
The following code shows an example how to use this registry:
// add your personal class loader (this should be done only once)
CrtClassLoaderRegistry.addClassLoader( MyPrettyCoolClass.class.getClassLoader() );
...
// load another class with this class loader
MyOtherClass myOtherInstance = null;
try {
Class myOtherClass = CrtClassLoaderRegistry.forName( "com.company.prg.MyOtherClass" );
myOtherInstance = (MyOtherClass)myOtherClass.newInstance();
}
catch( .... x ) {
....
}
Copyright (c) SAP AG 2001-2002
| Method Summary | |
static void |
addClassLoader(java.lang.ClassLoader newLoader)
Register a class loader to the component runtime. |
static void |
addClassLoader(java.lang.String id,
java.lang.ClassLoader newLoader)
Register a class loader with an optional id to the component runtime. |
static void |
addClassLoader(java.lang.String id,
java.lang.ClassLoader newLoader,
java.util.Set hints)
Register a class loader with an optional id to the component runtime. |
static void |
addClassLoaderRegistryListener(IClassLoaderRegistryListener l)
|
protected java.lang.Class |
findClass(java.lang.String name)
|
protected java.net.URL |
findResource(java.lang.String name)
|
protected java.util.Enumeration |
findResources(java.lang.String name)
|
static java.lang.Class |
forName(java.lang.String className)
Returns the Class object associated with the class or
interface with the given string name, using this registry. |
static java.lang.ClassLoader |
getClassLoader()
Returns the component runtime default class loader. |
static void |
removeClassLoaderRegistryListener(IClassLoaderRegistryListener l)
|
| Methods inherited from class java.lang.ClassLoader |
defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, resolveClass, setSigners |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
protected java.lang.Class findClass(java.lang.String name)
throws java.lang.ClassNotFoundException
findClass in class java.lang.ClassLoader
protected java.util.Enumeration findResources(java.lang.String name)
throws java.io.IOException
findResources in class java.lang.ClassLoaderprotected java.net.URL findResource(java.lang.String name)
findResource in class java.lang.ClassLoaderpublic static void addClassLoader(java.lang.ClassLoader newLoader)
newLoader - The new class loader instance to be added.
public static void addClassLoader(java.lang.String id,
java.lang.ClassLoader newLoader)
newLoader .
If newLoader is null the class loader with
id is removed.
If id is null the class loader is added anonymous
and cannot be removed.
id - The optional id of this class loadernewLoader - The new class loader instance to be added.
public static void addClassLoader(java.lang.String id,
java.lang.ClassLoader newLoader,
java.util.Set hints)
newLoader .
This method is meant as a hook for improved class loading speed. Each class
loader newLoader registered comes bundled with a set of Java
package names that are in this loaders scope.
id - The id of this class loadernewLoader - The new class loader instance to be addedhints - A set of package names in the loader's scopepublic static java.lang.ClassLoader getClassLoader()
public static java.lang.Class forName(java.lang.String className)
throws java.lang.ClassNotFoundException
Class object associated with the class or
interface with the given string name, using this registry.className - java.lang.ClassNotFoundException - public static void addClassLoaderRegistryListener(IClassLoaderRegistryListener l)
public static void removeClassLoaderRegistryListener(IClassLoaderRegistryListener l)
|
SAP NetWeaver '04 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||