|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.ClassLoader java.security.SecureClassLoader java.net.URLClassLoader net.sf.farrago.plugin.FarragoPluginClassLoader
public class FarragoPluginClassLoader
FarragoPluginClassLoader allows plugin jars to be added to the ClassLoader dynamically.
Field Summary | |
---|---|
static String |
LIBRARY_CLASS_PREFIX1
Prefix used to indicate that a wrapper library is loaded directly from a class rather than a jar. |
static String |
LIBRARY_CLASS_PREFIX2
New alternative to LIBRARY_CLASS_PREFIX1. |
static String |
PLUGIN_FACTORY_CLASS_ATTRIBUTE
Attribute name used in jar manifest for identifying the class to be used as a plugin factory. |
static String |
PLUGIN_MODEL_ATTRIBUTE
Attribute name used in jar manifest for identifying the XMI file to be used as a model extension. |
private static Logger |
tracer
|
private Set |
urlSet
|
Constructor Summary | |
---|---|
FarragoPluginClassLoader()
|
|
FarragoPluginClassLoader(ClassLoader parentClassLoader)
|
Method Summary | |
---|---|
void |
addPluginUrl(URL url)
Adds a URL from which plugins can be loaded. |
protected Class<?> |
findClass(String name)
|
static String |
getLibraryClassReference(String libraryName)
From a library name which references a Java class directly, obtains the class reference (possibly with trailing context such as a method name). |
static boolean |
isLibraryClass(String libraryName)
Tests whether a library name references a Java class directly rather than a jar. |
Class |
loadClassFromJarUrl(String jarUrl,
String className)
Loads a Java class from a jar URL. |
Class |
loadClassFromJarUrlManifest(String jarUrl,
String jarAttributeName)
Loads a Java class from a jar URL, using the manifest to determine the classname. |
Class |
loadClassFromLibraryManifest(String libraryName,
String jarAttributeName)
Loads a Java class from a library (either a jarfile using a manifest to get the classname, or else a named class from the classpath). |
Object |
newPluginInstance(Class pluginClass)
Constructs a new object instance of a plugin class, making sure the thread's context ClassLoader is set to this for the duration
of the construction. |
Methods inherited from class java.net.URLClassLoader |
---|
addURL, definePackage, findResource, findResources, getPermissions, getURLs, newInstance, newInstance |
Methods inherited from class java.security.SecureClassLoader |
---|
defineClass, defineClass |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final Logger tracer
public static final String LIBRARY_CLASS_PREFIX1
public static final String LIBRARY_CLASS_PREFIX2
public static final String PLUGIN_FACTORY_CLASS_ATTRIBUTE
public static final String PLUGIN_MODEL_ATTRIBUTE
private final Set urlSet
Constructor Detail |
---|
public FarragoPluginClassLoader()
public FarragoPluginClassLoader(ClassLoader parentClassLoader)
Method Detail |
---|
public void addPluginUrl(URL url)
url
- URL to addpublic Class loadClassFromLibraryManifest(String libraryName, String jarAttributeName)
libraryName
- filename of jar containing plugin implementationjarAttributeName
- name of jar attribute to use to determine class
name
protected Class<?> findClass(String name) throws ClassNotFoundException
findClass
in class URLClassLoader
ClassNotFoundException
public Class loadClassFromJarUrlManifest(String jarUrl, String jarAttributeName)
jarUrl
- URL of jar containing plugin implementationjarAttributeName
- name of jar attribute to use to determine class
name
public Class loadClassFromJarUrl(String jarUrl, String className)
jarUrl
- URL for jar containing class implementationclassName
- name of class to load
public Object newPluginInstance(Class pluginClass) throws InstantiationException, IllegalAccessException
this
for the duration
of the construction.
pluginClass
- class to instantiate
InstantiationException
IllegalAccessException
public static boolean isLibraryClass(String libraryName)
libraryName
- library name to be tested
public static String getLibraryClassReference(String libraryName)
libraryName
- library name to be parsed
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |