|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.mx.loading.LoaderRepository
org.jboss.mx.loading.BasicLoaderRepository
Implements a simple classloader repository for the MBean server. The basic loader repository uses an unordered list of classloaders to try and load the required class. There is no attempt made to resolve conflicts between classes loaded by different classloaders.
A thread's context class loader is always searched first. Context class loader is not required to be registered to the repository.
LoaderRepository
Field Summary |
Fields inherited from class org.jboss.mx.loading.LoaderRepository |
instance, loaders, nativeClassBySignature, translator |
Constructor Summary | |
BasicLoaderRepository()
|
Method Summary | |
void |
addClassLoader(ClassLoader cl)
Add a class loader to the repository |
boolean |
addClassLoaderURL(ClassLoader cl,
URL url)
Update the set of URLs known to be associated with a previously added class loader. |
URL |
getResource(String name,
ClassLoader cl)
Find a resource URL for the given name |
void |
getResources(String name,
ClassLoader cl,
List urls)
Find all resource URLs for the given name. |
Class |
loadClass(String className)
Attempts to load a class using the first found instance of a ClassLoader with a given class description. |
Class |
loadClass(String name,
boolean resolve,
ClassLoader cl)
Load the given class from the repository |
Class |
loadClassWithout(ClassLoader skipLoader,
String className)
Attempts to load a class using the first found instance of a ClassLoader with a given class description. |
UnifiedClassLoader |
newClassLoader(URL url,
boolean addToRepository)
Create UnifiedClassLoader and optionally add it to the repository |
UnifiedClassLoader |
newClassLoader(URL url,
URL origURL,
boolean addToRepository)
Create UnifiedClassLoader and optionally add it to the repository |
void |
removeClassLoader(ClassLoader cl)
Remove a cladd loader from the repository. |
Methods inherited from class org.jboss.mx.loading.LoaderRepository |
getCachedClass, getDefaultLoaderRepository, getLoaders, getNativeClassForName, getTranslator, getURLs, loadClassBefore, setTranslator |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public BasicLoaderRepository()
Method Detail |
public Class loadClass(String className) throws ClassNotFoundException
loadClass
in interface ClassLoaderRepository
loadClass
in class LoaderRepository
className
- fully qualified name of the class to load
ClassNotFoundException
- if the class was not found by any of the
registered class loaderspublic Class loadClassWithout(ClassLoader skipLoader, String className) throws ClassNotFoundException
loadClassWithout
in interface ClassLoaderRepository
loadClassWithout
in class LoaderRepository
skipLoader
- this class loader instance will be skipped when attempting
to load the given class.className
- fully qualified name of the class to load
ClassNotFoundException
- if the class was not found by any of the
registered class loaderspublic void addClassLoader(ClassLoader cl)
LoaderRepository
addClassLoader
in class LoaderRepository
public boolean addClassLoaderURL(ClassLoader cl, URL url)
LoaderRepository
addClassLoaderURL
in class LoaderRepository
cl
- url
- public void removeClassLoader(ClassLoader cl)
LoaderRepository
removeClassLoader
in class LoaderRepository
cl
- public UnifiedClassLoader newClassLoader(URL url, boolean addToRepository) throws Exception
LoaderRepository
newClassLoader
in class LoaderRepository
url
- the URL to use for class loadingaddToRepository
- a flag indicating if the UCL should be added to
the repository
Exception
public UnifiedClassLoader newClassLoader(URL url, URL origURL, boolean addToRepository) throws Exception
LoaderRepository
newClassLoader
in class LoaderRepository
url
- the URL to use for class loadingorigURL
- an orignal URL to use as the URL for the UCL CodeSource.
This is useful when the url is a local copy that is difficult to use for
security policy writing.addToRepository
- a flag indicating if the UCL should be added to
the repository
Exception
public Class loadClass(String name, boolean resolve, ClassLoader cl) throws ClassNotFoundException
LoaderRepository
loadClass
in class LoaderRepository
name
- resolve
- cl
-
ClassNotFoundException
public URL getResource(String name, ClassLoader cl)
LoaderRepository
getResource
in class LoaderRepository
name
- the resource namecl
- the requesting class loader
public void getResources(String name, ClassLoader cl, List urls)
LoaderRepository
getResources
in class LoaderRepository
name
- the resource namecl
- the requesting class loaderurls
- a list into which the located resource URLs will be placed
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |