|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.ClassLoader
java.security.SecureClassLoader
org.arakhne.vmutil.DynamicURLClassLoader
public class DynamicURLClassLoader
This class loader permits to load classes from a set of classpaths.
| Nested Class Summary | |
|---|---|
protected static class |
DynamicURLClassLoader.FactoryDynamicURLClassLoader
|
| Field Summary | |
|---|---|
protected AccessControlContext |
_acc
The context to be used when loading classes and resources |
protected sun.misc.URLClassPath |
_ucp
The search path for classes and resources. |
| Constructor Summary | |
|---|---|
protected |
DynamicURLClassLoader(ClassLoader parent,
AccessControlContext acc,
URL... urls)
Constructs a new ClassPathClassLoader for the given URLs. |
| Method Summary | |
|---|---|
void |
addURL(URL url)
Appends the specified URL to the list of URLs to search for classes and resources. |
void |
addURLs(URL... urls)
Appends the specified URL to the list of URLs to search for classes and resources. |
protected Class<?> |
defineClass(String name,
sun.misc.Resource res)
Defines a Class using the class bytes obtained from the specified Resource. |
protected Package |
definePackage(String name,
Manifest man,
URL url)
Defines a new package by name in this ClassLoader. |
protected Class<?> |
findClass(String name)
Finds and loads the class with the specified name from the URL search path. |
URL |
findResource(String name)
Finds the resource with the specified name on the URL search path. |
Enumeration<URL> |
findResources(String name)
Returns an Enumeration of URLs representing all of the resources on the URL search path having the specified name. |
protected PermissionCollection |
getPermissions(CodeSource codesource)
Returns the permissions for the given codesource object. |
URL[] |
getURLs()
Returns the search path of URLs for loading classes and resources. |
static DynamicURLClassLoader |
newInstance(ClassLoader parent,
URL... urls)
Creates a new instance of DynamicURLClassLoader for the specified URLs and parent class loader. |
void |
removeURL(URL url)
Appends the specified URL to the list of URLs to search for classes and resources. |
void |
removeURLs(URL... urls)
Appends the specified URL to the list of URLs to search for classes and resources. |
| 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 |
|---|
protected sun.misc.URLClassPath _ucp
protected AccessControlContext _acc
| Constructor Detail |
|---|
protected DynamicURLClassLoader(ClassLoader parent,
AccessControlContext acc,
URL... urls)
If there is a security manager, this method first
calls the security manager's checkCreateClassLoader method
to ensure creation of a class loader is allowed.
parent - the parent class loader for delegationacc - is the current access contexturls - the URLs from which to load classes and resources
SecurityException - if a security manager exists and its
checkCreateClassLoader method doesn't allow
creation of a class loader.SecurityManager.checkCreateClassLoader()| Method Detail |
|---|
public void addURL(URL url)
url - the URL to be added to the search path of URLspublic void addURLs(URL... urls)
urls - the URLs to be added to the search path of URLspublic void removeURLs(URL... urls)
urls - the URL to be added to the search path of URLspublic void removeURL(URL url)
url - the URL to be added to the search path of URLspublic URL[] getURLs()
protected Class<?> findClass(String name)
throws ClassNotFoundException
findClass in class ClassLoadername - the name of the class
ClassNotFoundException - if the class could not be found
protected Class<?> defineClass(String name,
sun.misc.Resource res)
throws IOException
name - is the name of the class to defineres - is the resource from which the class byte-code could be obtained
IOException - in case the byte-code was unavailable.
protected Package definePackage(String name,
Manifest man,
URL url)
throws IllegalArgumentException
name - the package nameman - the Manifest containing package version and sealing
informationurl - the code source url for the package, or null if none
IllegalArgumentException - if the package name duplicates
an existing package either in this class loader or one
of its ancestorspublic URL findResource(String name)
findResource in class ClassLoadername - the name of the resource
URL for the resource, or null
if the resource could not be found.
public Enumeration<URL> findResources(String name)
throws IOException
findResources in class ClassLoadername - the resource name
Enumeration of URLs
IOException - if an I/O exception occursprotected PermissionCollection getPermissions(CodeSource codesource)
If the protocol is "file" and the path specifies a file, then permission to read that file is granted. If protocol is "file" and the path is a directory, permission is granted to read all files and (recursively) all files and subdirectories contained in that directory.
If the protocol is not "file", then to connect to and accept connections from the URL's host is granted.
getPermissions in class SecureClassLoadercodesource - the codesource
public static DynamicURLClassLoader newInstance(ClassLoader parent,
URL... urls)
loadClass method of the URLClassLoader
returned by this method will invoke the
SecurityManager.checkPackageAccess method before
loading the class.
parent - the parent class loader for delegationurls - the URLs to search for classes and resources
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||