|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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, 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)
Loads a class from the repository. |
Class |
loadClass(String name,
boolean resolve,
ClassLoader cl)
Load the given class from the repository |
Class |
loadClassBefore(ClassLoader stop,
String className)
Loads a class from the repository, using the classloaders that were registered before the given classloader. |
Class |
loadClassWithout(ClassLoader skipLoader,
String className)
Loads a class from the repository, excluding the given classloader. |
RepositoryClassLoader |
newClassLoader(URL url,
boolean addToRepository)
Create RepositoryClassLoader and optionally add it to the repository |
RepositoryClassLoader |
newClassLoader(URL url,
URL origURL,
boolean addToRepository)
Create RepositoryClassLoader 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 |
compare, getCachedClass, getLoaders, getNativeClassForName, getTranslator, getURLs, reverseCompare, 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
- the class to load
ClassNotFoundException
- when there is no such classpublic Class loadClassWithout(ClassLoader skipLoader, String className) throws ClassNotFoundException
loadClassWithout
in interface ClassLoaderRepository
loadClassWithout
in class LoaderRepository
skipLoader
- the classloader to excludeclassName
- the class to load
ClassNotFoundException
- when there is no such classpublic Class loadClassBefore(ClassLoader stop, String className) throws ClassNotFoundException
loadClassBefore
in interface ClassLoaderRepository
loadClassBefore
in class LoaderRepository
stop
- consult all the classloaders registered before this one
in an attempt to load a classclassName
- name of the class to load
ClassNotFoundException
- if none of the consulted classloaders were
able to load the requested classpublic 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 RepositoryClassLoader 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 CL should be added to
the repository
Exception
public RepositoryClassLoader 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 CL 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 CL 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 |