Package org.ow2.clif.util
Class ClifClassLoader
- java.lang.Object
-
- java.lang.ClassLoader
-
- org.ow2.clif.util.ClifClassLoader
-
public class ClifClassLoader extends java.lang.ClassLoaderSpecial classloader bound to the CodeServer utility, enabling network download of classes and resources. Regardless this download facility, it also provides classes prefetching utilities.- Author:
- Bruno Dillenseger
- See Also:
CodeServer
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidclear()flushes the class cache and renews the CLIF class loader singletonstatic java.util.List<java.lang.Class<?>>fetchClassDependencies(java.lang.Class<?> clazz)Loads all dependencies of a class, i.e.static voidfetchClassDependencies(java.util.List<java.lang.Class<?>> classes)Loads all dependencies of a provided list of classes, i.e.protected java.lang.Class<?>findClass(java.lang.String name)java.net.URLfindResource(java.lang.String name)java.util.Enumeration<java.net.URL>findResources(java.lang.String name)byte[]getBytes(java.lang.String name)static ClifClassLoadergetClassLoader()Get the CLIF class loader singleton.-
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
-
-
-
Method Detail
-
getClassLoader
public static ClifClassLoader getClassLoader()
Get the CLIF class loader singleton. Caution: the singleton changes when calling static method clear().- Returns:
- the CLIF class loader singleton
- See Also:
clear()
-
clear
public static void clear()
flushes the class cache and renews the CLIF class loader singleton
-
fetchClassDependencies
public static java.util.List<java.lang.Class<?>> fetchClassDependencies(java.lang.Class<?> clazz)
Loads all dependencies of a class, i.e. classes involved in its superclass, attributes, methods and constructors, in a recursive manner. Important note: does not use the CLIF class loader but the default context class loader (i.e. the class loader that loaded the ClifClassLoader class).- Parameters:
clazz- the class to look for dependencies- Returns:
- the list of preloaded classes clazz depends on. The caller may keep a reference to this list to avoid garbage collection of preloaded classes.
-
fetchClassDependencies
public static void fetchClassDependencies(java.util.List<java.lang.Class<?>> classes)
Loads all dependencies of a provided list of classes, i.e. classes involved in their superclasses, attributes, methods and constructors, in a recursive manner. Important note: does not use the CLIF class loader but the default context class loader (i.e. the class loader that loaded the ClifClassLoader class).- Parameters:
classes- the initial list of classes, that will be extended with all dependent, preloaded classes
-
getBytes
public byte[] getBytes(java.lang.String name) throws java.io.IOException- Throws:
java.io.IOException
-
findClass
protected java.lang.Class<?> findClass(java.lang.String name) throws java.lang.ClassNotFoundException- Overrides:
findClassin classjava.lang.ClassLoader- Throws:
java.lang.ClassNotFoundException
-
findResource
public java.net.URL findResource(java.lang.String name)
- Overrides:
findResourcein classjava.lang.ClassLoader
-
findResources
public java.util.Enumeration<java.net.URL> findResources(java.lang.String name)
- Overrides:
findResourcesin classjava.lang.ClassLoader- Parameters:
name- the resource's name- Returns:
- an empty or single-value URL enumeration for the named resource
- See Also:
findResource(String)
-
-