public class BundleLoader extends Object implements ClassLoaderDelegate
BundleLoaderProxy
Modifier and Type | Field and Description |
---|---|
static org.eclipse.osgi.internal.loader.BundleLoader.ClassContext |
CLASS_CONTEXT |
static String |
DEFAULT_PACKAGE |
static byte |
FLAG_CLOSED |
static byte |
FLAG_HASDYNAMICEIMPORTALL |
static byte |
FLAG_HASDYNAMICIMPORTS |
static byte |
FLAG_IMPORTSINIT |
static byte |
FLAG_LAZYTRIGGER |
static ClassLoader |
FW_CLASSLOADER |
static String |
JAVA_PACKAGE |
Modifier | Constructor and Description |
---|---|
protected |
BundleLoader(BundleHost bundle,
BundleLoaderProxy proxy)
BundleLoader runtime constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addDynamicImportPackage(ManifestElement[] packages)
Adds a list of DynamicImport-Package manifest elements to the dynamic
import tables of this BundleLoader.
|
void |
attachFragment(BundleFragment fragment) |
static void |
closeBundleLoader(BundleLoaderProxy proxy) |
static <E> Enumeration<E> |
compoundEnumerations(Enumeration<E> list1,
Enumeration<E> list2) |
BundleClassLoader |
createClassLoader() |
Class<?> |
findClass(String name)
Finds the class for a bundle.
|
String |
findLibrary(String name)
Returns the absolute path name of a native library.
|
URL |
findResource(String name)
Finds the resource for a bundle.
|
Enumeration<URL> |
findResources(String name)
Finds the resources for a bundle.
|
AbstractBundle |
getBundle() |
KeyedHashSet |
getImportedSources(KeyedHashSet visited) |
BundleLoaderProxy |
getLoaderProxy() |
BundleLoaderProxy |
getLoaderProxy(BundleDescription source) |
static String |
getPackageName(String name)
Returns the package name from the specified class name.
|
PackageSource |
getPackageSource(String pkgName) |
ClassLoader |
getParentClassLoader() |
static String |
getResourcePackageName(String name)
Returns the package name from the specified resource name.
|
Enumeration<URL> |
getResources(String name) |
boolean |
isLazyTriggerSet()
Returns true if the lazy trigger has been set for this
delegate.
|
Collection<String> |
listResources(String path,
String filePattern,
int options)
Returns the names of resources visible to this delegate.
|
Class<?> |
loadClass(String name)
This method loads a class from the bundle.
|
void |
setLazyTrigger()
Sets the lazy trigger for this delegate.
|
String |
toString()
Return a string representation of this loader.
|
public static final String DEFAULT_PACKAGE
public static final String JAVA_PACKAGE
public static final byte FLAG_IMPORTSINIT
public static final byte FLAG_HASDYNAMICIMPORTS
public static final byte FLAG_HASDYNAMICEIMPORTALL
public static final byte FLAG_CLOSED
public static final byte FLAG_LAZYTRIGGER
public static final org.eclipse.osgi.internal.loader.BundleLoader.ClassContext CLASS_CONTEXT
public static final ClassLoader FW_CLASSLOADER
protected BundleLoader(BundleHost bundle, BundleLoaderProxy proxy) throws BundleException
bundle
- Bundle object for this loader.proxy
- the BundleLoaderProxy for this loader.BundleException
public static final String getPackageName(String name)
name
- Name of a class.public static final String getResourcePackageName(String name)
name
- Name of a resource.public KeyedHashSet getImportedSources(KeyedHashSet visited)
public boolean isLazyTriggerSet()
ClassLoaderDelegate
isLazyTriggerSet
in interface ClassLoaderDelegate
public void setLazyTrigger() throws BundleException
ClassLoaderDelegate
setLazyTrigger
in interface ClassLoaderDelegate
BundleException
- if an error occurred while activating the bundleClassLoaderDelegate.isLazyTriggerSet()
public final BundleLoaderProxy getLoaderProxy(BundleDescription source)
public BundleLoaderProxy getLoaderProxy()
public final Class<?> loadClass(String name) throws ClassNotFoundException
name
- the name of the desired Class.ClassNotFoundException
- if the class definition was not found.public final ClassLoader getParentClassLoader()
public final BundleClassLoader createClassLoader()
public Class<?> findClass(String name) throws ClassNotFoundException
findClass
in interface ClassLoaderDelegate
name
- the class to find.ClassNotFoundException
- if the class is not found.public URL findResource(String name)
findResource
in interface ClassLoaderDelegate
name
- the resource to load.public Enumeration<URL> findResources(String name) throws IOException
findResources
in interface ClassLoaderDelegate
name
- the resource to find.IOException
public Collection<String> listResources(String path, String filePattern, int options)
ClassLoaderDelegate
BundleWiring.listResources(String, String, int)
method.
First a search is done on the packages imported by the bundle associated
with this delegate. Next a search is done on the the bundles required by
the bundle associated with this delegate. Finally a local search of
the bundle associated with this delegate is done by calling
BundleClassLoader.listLocalResources(String, String, int)
. Note
that for imported packages the search stops at the source for the import.listResources
in interface ClassLoaderDelegate
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)
public Enumeration<URL> getResources(String name) throws IOException
IOException
public static <E> Enumeration<E> compoundEnumerations(Enumeration<E> list1, Enumeration<E> list2)
public String findLibrary(String name)
findLibrary
in interface ClassLoaderDelegate
name
- the library namepublic final AbstractBundle getBundle()
public final String toString()
public final void addDynamicImportPackage(ManifestElement[] packages)
packages
- the DynamicImport-Package elements to add.public void attachFragment(BundleFragment fragment) throws BundleException
BundleException
public final PackageSource getPackageSource(String pkgName)
public static void closeBundleLoader(BundleLoaderProxy proxy)
Copyright © 2007–2018 The Apache Software Foundation. All rights reserved.