org.codehaus.plexus.classworlds.realm
Class ClassRealm
java.lang.Object
java.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
org.codehaus.plexus.classworlds.realm.ClassRealm
public class ClassRealm
- extends java.net.URLClassLoader
The class loading gateway. Each class realm has access to the bootstrap class loader, imports form other other class
loaders, an optional parent class loader and of course its own class path. When queried for a class/resource, a class
realm will always query the bootstrap class loader first before it delegates to a pluggable strategy. The strategy in
turn controls the order in which imported class loaders, the parent class loader and the realm itself are searched.
- Version:
- $Id: ClassRealm.java 8314 2009-08-07 10:47:29Z bentmann $
- Author:
- bob mcwhirter, Jason van Zyl
Constructor Summary |
ClassRealm(ClassWorld world,
java.lang.String id,
java.lang.ClassLoader parentClassLoader)
|
Methods inherited from class java.net.URLClassLoader |
definePackage, getPermissions, getURLs, newInstance, newInstance |
Methods inherited from class java.security.SecureClassLoader |
defineClass, defineClass |
Methods inherited from class java.lang.ClassLoader |
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ClassRealm
public ClassRealm(ClassWorld world,
java.lang.String id,
java.lang.ClassLoader parentClassLoader)
getId
public java.lang.String getId()
getWorld
public ClassWorld getWorld()
importFromParent
public void importFromParent(java.lang.String packageName)
importFrom
public void importFrom(java.lang.String realmId,
java.lang.String packageName)
throws NoSuchRealmException
- Throws:
NoSuchRealmException
importFrom
public void importFrom(java.lang.ClassLoader classLoader,
java.lang.String packageName)
getImportClassLoader
public java.lang.ClassLoader getImportClassLoader(java.lang.String name)
getStrategy
public Strategy getStrategy()
setParentClassLoader
public void setParentClassLoader(java.lang.ClassLoader parentClassLoader)
getParentClassLoader
public java.lang.ClassLoader getParentClassLoader()
setParentRealm
public void setParentRealm(ClassRealm realm)
getParentRealm
public ClassRealm getParentRealm()
createChildRealm
public ClassRealm createChildRealm(java.lang.String id)
throws DuplicateRealmException
- Throws:
DuplicateRealmException
addURL
public void addURL(java.net.URL url)
- Overrides:
addURL
in class java.net.URLClassLoader
loadClass
public java.lang.Class loadClass(java.lang.String name)
throws java.lang.ClassNotFoundException
- Overrides:
loadClass
in class java.lang.ClassLoader
- Throws:
java.lang.ClassNotFoundException
loadClass
protected java.lang.Class loadClass(java.lang.String name,
boolean resolve)
throws java.lang.ClassNotFoundException
- Overrides:
loadClass
in class java.lang.ClassLoader
- Throws:
java.lang.ClassNotFoundException
findClass
protected java.lang.Class findClass(java.lang.String name)
throws java.lang.ClassNotFoundException
- Overrides:
findClass
in class java.net.URLClassLoader
- Throws:
java.lang.ClassNotFoundException
findResource
public java.net.URL findResource(java.lang.String name)
- Overrides:
findResource
in class java.net.URLClassLoader
findResources
public java.util.Enumeration findResources(java.lang.String name)
throws java.io.IOException
- Overrides:
findResources
in class java.net.URLClassLoader
- Throws:
java.io.IOException
display
public void display()
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
loadClassFromImport
public java.lang.Class loadClassFromImport(java.lang.String name)
loadClassFromSelf
public java.lang.Class loadClassFromSelf(java.lang.String name)
loadClassFromParent
public java.lang.Class loadClassFromParent(java.lang.String name)
loadResourceFromImport
public java.net.URL loadResourceFromImport(java.lang.String name)
loadResourceFromSelf
public java.net.URL loadResourceFromSelf(java.lang.String name)
loadResourceFromParent
public java.net.URL loadResourceFromParent(java.lang.String name)
loadResourcesFromImport
public java.util.Enumeration loadResourcesFromImport(java.lang.String name)
loadResourcesFromSelf
public java.util.Enumeration loadResourcesFromSelf(java.lang.String name)
loadResourcesFromParent
public java.util.Enumeration loadResourcesFromParent(java.lang.String name)
Copyright © 2002-2009 Codehaus. All Rights Reserved.