public class CompositeClassLoader extends ClassLoader implements BaseClassLoader
Constructor and Description |
---|
CompositeClassLoader(ClassLoader parent,
ClassLoaderDelegate delegate,
ClassLoaderDelegate companionDelegate,
BaseData data) |
Modifier and Type | Method and Description |
---|---|
void |
attachFragment(BundleData bundledata,
ProtectionDomain domain,
String[] classpath)
Attaches the BundleData for a fragment to this BundleClassLoader.
|
void |
close()
Closes this class loader.
|
ClasspathEntry |
createClassPathEntry(BundleFile bundlefile,
ProtectionDomain cpDomain)
Creates a classpath entry with the given bundle file and domain
|
Class |
defineClass(String name,
byte[] classbytes,
ClasspathEntry classpathEntry,
BundleEntry entry)
Defines a Class.
|
List<URL> |
findEntries(String path,
String filePattern,
int options)
Returns resource entries for the bundle associated with this class loader.
|
Class |
findLocalClass(String classname)
Finds a local class in the BundleClassLoader without
consulting the delegate.
|
URL |
findLocalResource(String resource)
Finds a local resource in the BundleClassLoader without
consulting the delegate.
|
Enumeration |
findLocalResources(String resource)
Finds all local resources in the BundleClassLoader with the specified
path without consulting the delegate.
|
Bundle |
getBundle()
Returns the
Bundle object associated with this
BundleReference . |
ClasspathManager |
getClasspathManager()
Returns the ClasspathManager for this BaseClassLoader
|
ClassLoaderDelegate |
getDelegate()
Returns the ClassLoaderDelegate used by this BundleClassLoader
|
ProtectionDomain |
getDomain()
Returns the domain for the host bundle of this class loader
|
URL |
getResource(String name)
This method will first search the parent class loader for the resource;
That failing, this method will invoke
ClassLoaderDelegate.findResource(String) to find the resource. |
void |
initialize()
Initializes the ClassLoader.
|
Collection<String> |
listLocalResources(String path,
String filePattern,
int options)
Returns the names of local resources visible to this bundle class loader.
|
Collection<String> |
listResources(String path,
String filePattern,
int options)
Returns the names of resources visible to this bundle class loader.
|
Class |
loadClass(String name)
This method will first search the parent class loader for the class;
That failing, this method will invoke
ClassLoaderDelegate.findClass(String) to find the resource. |
Object |
publicDefinePackage(String name,
String specTitle,
String specVersion,
String specVendor,
String implTitle,
String implVersion,
String implVendor,
URL sealBase)
A public version of the ClassLoader#definePackage(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.net.URL) method.
|
Class |
publicFindLoaded(String classname)
A public version of the ClassLoader.findLoadedClass(java.lang.String) method.
|
Object |
publicGetPackage(String pkgname)
A public version of the ClassLoader#getPackage(java.lang.String) method.
|
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getParent, getResources
public CompositeClassLoader(ClassLoader parent, ClassLoaderDelegate delegate, ClassLoaderDelegate companionDelegate, BaseData data)
public ClasspathEntry createClassPathEntry(BundleFile bundlefile, ProtectionDomain cpDomain)
BaseClassLoader
createClassPathEntry
in interface BaseClassLoader
bundlefile
- the source bundle file for a classpath entrycpDomain
- the source domain for a classpath entrypublic Class defineClass(String name, byte[] classbytes, ClasspathEntry classpathEntry, BundleEntry entry)
BaseClassLoader
defineClass
in interface BaseClassLoader
name
- the name of the class to defineclassbytes
- the bytes of the class to defineclasspathEntry
- the classpath entry used to load the class bytesentry
- the bundle entry used to load the class bytespublic ClasspathManager getClasspathManager()
BaseClassLoader
getClasspathManager
in interface BaseClassLoader
public ProtectionDomain getDomain()
BaseClassLoader
getDomain
in interface BaseClassLoader
public Object publicDefinePackage(String name, String specTitle, String specVersion, String specVendor, String implTitle, String implVersion, String implVendor, URL sealBase)
BaseClassLoader
publicDefinePackage
in interface BaseClassLoader
public Class publicFindLoaded(String classname)
BaseClassLoader
publicFindLoaded
in interface BaseClassLoader
classname
- the class name to find.public Object publicGetPackage(String pkgname)
BaseClassLoader
publicGetPackage
in interface BaseClassLoader
pkgname
- the package name to get.public void attachFragment(BundleData bundledata, ProtectionDomain domain, String[] classpath)
BundleClassLoader
attachFragment
in interface BundleClassLoader
bundledata
- The BundleData of the fragment.domain
- The ProtectionDomain of the resources of the fragment.
Any classes loaded from the fragment's BundleData must belong to this
ProtectionDomain.classpath
- An array of Bundle-ClassPath entries to
use for loading classes and resources. This is specified by the
Bundle-ClassPath manifest entry of the fragment.public void close()
BundleClassLoader
close
in interface BundleClassLoader
public Class findLocalClass(String classname) throws ClassNotFoundException
BundleClassLoader
findLocalClass
in interface BundleClassLoader
classname
- the classname to find.ClassNotFoundException
- if the classname does not exist locally.public URL findLocalResource(String resource)
BundleClassLoader
findLocalResource
in interface BundleClassLoader
resource
- the resource path to find.public Enumeration findLocalResources(String resource)
BundleClassLoader
findLocalResources
in interface BundleClassLoader
resource
- the resource path to find.public ClassLoaderDelegate getDelegate()
BundleClassLoader
getDelegate
in interface BundleClassLoader
public URL getResource(String name)
BundleClassLoader
ClassLoaderDelegate.findResource(String)
to find the resource.getResource
in interface BundleClassLoader
getResource
in class ClassLoader
name
- the resource path to get.null
if the resource is not found.public void initialize()
BundleClassLoader
initialize
in interface BundleClassLoader
public Class loadClass(String name) throws ClassNotFoundException
BundleClassLoader
ClassLoaderDelegate.findClass(String)
to find the resource.loadClass
in interface BundleClassLoader
loadClass
in class ClassLoader
name
- the class name to load.ClassNotFoundException
public Bundle getBundle()
BundleReference
Bundle
object associated with this
BundleReference
.getBundle
in interface BundleReference
Bundle
object associated with this
BundleReference
.public List<URL> findEntries(String path, String filePattern, int options)
BundleClassLoader
BundleWiring.findEntries(String, String, int)
method.findEntries
in interface BundleClassLoader
path
- The path name in which to look.filePattern
- The file name pattern for selecting resource names in
the specified path.options
- The options for listing resource names.BundleWiring#findEntries(String, String, int)}
public Collection<String> listResources(String path, String filePattern, int options)
BundleClassLoader
BundleWiring.listResources(String, String, int)
method.
This method should simply return the result of calling
ClassLoaderDelegate.listResources(String, String, int)
listResources
in interface BundleClassLoader
path
- The path name in which to look.filePattern
- The file name pattern for selecting resource names in
the specified path.options
- The options for listing resource names.BundleWiring#listResources(String, String, int)}
,
ClassLoaderDelegate#listResources(String, String, int)}
public Collection<String> listLocalResources(String path, String filePattern, int options)
BundleClassLoader
listLocalResources
in interface BundleClassLoader
path
- The path name in which to look.filePattern
- The file name pattern for selecting resource names in
the specified path.options
- The options for listing resource names.ClassLoaderDelegate#listResources(String, String, int)}
Copyright © 2007–2018 The Apache Software Foundation. All rights reserved.