public class VFSClassLoader extends SecureClassLoader
The search path can consist of VFS FileObjects referring both to folders and JAR files. Any FileObject of type FileType.FILE is assumed to be a JAR and is opened by creating a layered file system with the "jar" scheme.
TODO - Test this with signed Jars and a SecurityManager.
| Constructor and Description |
|---|
VFSClassLoader(FileObject[] files,
FileSystemManager manager)
Constructors a new VFSClassLoader for the given files.
|
VFSClassLoader(FileObject[] files,
FileSystemManager manager,
ClassLoader parent)
Constructors a new VFSClassLoader for the given FileObjects.
|
VFSClassLoader(FileObject file,
FileSystemManager manager)
Constructors a new VFSClassLoader for the given file.
|
VFSClassLoader(FileObject file,
FileSystemManager manager,
ClassLoader parent)
Constructors a new VFSClassLoader for the given file.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
copyPermissions(PermissionCollection src,
PermissionCollection dest)
Copies the permissions from src to dest.
|
protected Class<?> |
findClass(String name)
Finds and loads the class with the specified name from the search path.
|
protected URL |
findResource(String name)
Finds the resource with the specified name from the search path.
|
protected Enumeration<URL> |
findResources(String name)
Returns an Enumeration of all the resources in the search path with the specified name.
|
FileObject[] |
getFileObjects()
Provide access to the file objects this class loader represents.
|
protected PermissionCollection |
getPermissions(CodeSource cs)
Calls super.getPermissions both for the code source and also adds the permissions granted to the parent layers.
|
defineClass, defineClassclearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSignerspublic VFSClassLoader(FileObject file, FileSystemManager manager) throws FileSystemException
file - the file to load the classes and resources from.manager - the FileManager to use when trying create a layered Jar file system.FileSystemException - if an error occurs.public VFSClassLoader(FileObject file, FileSystemManager manager, ClassLoader parent) throws FileSystemException
file - the file to load the classes and resources from.manager - the FileManager to use when trying create a layered Jar file system.parent - the parent class loader for delegation.FileSystemException - if an error occurs.public VFSClassLoader(FileObject[] files, FileSystemManager manager) throws FileSystemException
files - the files to load the classes and resources from.manager - the FileManager to use when trying create a layered Jar file system.FileSystemException - if an error occurs.public VFSClassLoader(FileObject[] files, FileSystemManager manager, ClassLoader parent) throws FileSystemException
files - the FileObjects to load the classes and resources from.manager - the FileManager to use when trying create a layered Jar file system.parent - the parent class loader for delegation.FileSystemException - if an error occurs.public FileObject[] getFileObjects()
protected Class<?> findClass(String name) throws ClassNotFoundException
findClass in class ClassLoaderClassNotFoundException - if the class is not found.protected PermissionCollection getPermissions(CodeSource cs)
getPermissions in class SecureClassLoadercs - the CodeSource.protected void copyPermissions(PermissionCollection src, PermissionCollection dest)
src - The source PermissionCollection.dest - The destination PermissionCollection.protected URL findResource(String name)
findResource in class ClassLoadername - The resource name.protected Enumeration<URL> findResources(String name) throws IOException
Gets called from ClassLoader.getResources(String) after parent class loader was questioned.
findResources in class ClassLoadername - The resources to find.FileSystemException - if an error occurs.IOExceptionCopyright © 2002–2017 The Apache Software Foundation. All rights reserved.