|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.ClassLoader | +--org.merlotxml.merlot.plugin.PluginClassLoader
This classloader loads plugin classes and resources from merlot plugin jar files or plugin development directories.
When loading a class or a resource from a jar file, it first looks in the jar directly (as the normal class loader does), then it checks the classes directory, and lastly, it checks for embedded jar files located in a lib directory within the plugin jar file.
To load classes and resource from embedded jar files, the PluginClassLoader must write out jars in the lib directory to a temporary location to be used by ZipFile.
Field Summary | |
protected java.util.Hashtable |
_classes
Classes we've already loaded |
protected java.util.List |
_embeddedZipFiles
A list of zip files that were embedded in the main plugin zip file |
protected java.io.File |
_sourcedir
This class loader originated from a source directory |
protected java.util.zip.ZipFile |
_sourcezip
This class loader originated from a zip/jar file |
protected static java.lang.String |
CLASSEXT
|
protected static java.lang.String |
DIR_CLASSES
|
protected static java.lang.String |
DIR_LIB
|
protected static char |
FILESEP
|
protected static java.lang.String |
FILESEPSTR
|
Constructor Summary | |
PluginClassLoader(java.io.File sourcedir)
Constructor from a source directory or zipfile |
Method Summary | |
protected void |
copyEmbeddedZipFiles(java.util.zip.ZipFile zip)
Writes out embedded zips to temp files |
protected java.io.InputStream |
findResourceInLib(java.lang.Object dirzip,
java.lang.String name)
Finds resources in lib/zip files |
protected java.io.InputStream |
findResourceInZip(java.util.zip.ZipFile zip,
java.lang.String name)
This finds a resource and returns a stream of it from a zip file |
java.io.InputStream |
getResourceAsStream(java.lang.String name)
|
java.lang.Class |
loadClass(java.lang.String className)
This is a simple version for external clients since they will always want the class resolved before it is returned to them. |
protected java.lang.Class |
loadClass(java.lang.String className,
boolean resolveIt)
This is the required version of loadClass which is called both from loadClass above and from the internal function FindClassFromClass. |
Methods inherited from class java.lang.ClassLoader |
defineClass,
defineClass,
defineClass,
definePackage,
findClass,
findLibrary,
findLoadedClass,
findResource,
findResources,
findSystemClass,
getPackage,
getPackages,
getParent,
getResource,
getResources,
getSystemClassLoader,
getSystemResource,
getSystemResourceAsStream,
getSystemResources,
resolveClass,
setSigners |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected static final java.lang.String DIR_CLASSES
protected static final java.lang.String DIR_LIB
protected static char FILESEP
protected static java.lang.String FILESEPSTR
protected static final java.lang.String CLASSEXT
protected java.util.List _embeddedZipFiles
protected java.util.Hashtable _classes
protected java.io.File _sourcedir
protected java.util.zip.ZipFile _sourcezip
Constructor Detail |
public PluginClassLoader(java.io.File sourcedir)
Method Detail |
public java.lang.Class loadClass(java.lang.String className) throws java.lang.ClassNotFoundException
protected java.lang.Class loadClass(java.lang.String className, boolean resolveIt) throws java.lang.ClassNotFoundException
public java.io.InputStream getResourceAsStream(java.lang.String name)
protected java.io.InputStream findResourceInZip(java.util.zip.ZipFile zip, java.lang.String name)
protected void copyEmbeddedZipFiles(java.util.zip.ZipFile zip)
protected java.io.InputStream findResourceInLib(java.lang.Object dirzip, java.lang.String name)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |