public interface BundleData extends BundleReference
BundleData
represents a single bundle that is persistently
stored by a FrameworkAdaptor
. A BundleData
creates
the ClassLoader for a bundle, finds native libraries installed in the
FrameworkAdaptor for the bundle, creates data files for the bundle,
used to access bundle entries, manifest information, and getting and saving
metadata.
Clients may implement this interface.
Modifier and Type | Field and Description |
---|---|
static int |
TYPE_BOOTCLASSPATH_EXTENSION
The BundleData is for a bootclasspath extension bundle
|
static int |
TYPE_COMPOSITEBUNDLE
The BundleData is for a composite bundle
|
static int |
TYPE_EXTCLASSPATH_EXTENSION
The BundleData is for an extension classpath bundle
|
static int |
TYPE_FRAGMENT
The BundleData is for a fragment bundle
|
static int |
TYPE_FRAMEWORK_EXTENSION
The BundleData is for a framework extension bundle
|
static int |
TYPE_SINGLETON
The BundleData is for a singleton bundle
|
static int |
TYPE_SURROGATEBUNDLE
The BundleData is for a composite bundle surrogate
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close all resources for this BundleData
|
BundleClassLoader |
createClassLoader(ClassLoaderDelegate delegate,
BundleProtectionDomain domain,
String[] bundleclasspath)
Creates the ClassLoader for the BundleData.
|
String |
findLibrary(String libname)
Returns the absolute path name of a native library.
|
Enumeration<URL> |
findLocalResources(String path)
Finds local resources by searching the class path of this bundle data.
|
String |
getActivator()
Returns the Bundle-Activator for this BundleData as specified in
the bundle manifest file.
|
long |
getBundleID()
Get the BundleData bundle ID.
|
String[] |
getClassPath()
Returns the Bundle-ClassPath for this BundleData as specified in
the bundle manifest file.
|
File |
getDataFile(String path)
Return the bundle data directory.
|
String |
getDynamicImports()
Returns the DynamicImport-Package for this BundleData as
specified in the bundle manifest file.
|
URL |
getEntry(String path)
Gets a
URL to the bundle entry specified by path. |
Enumeration<String> |
getEntryPaths(String path)
Gets all of the bundle entries that exist under the specified path.
|
String |
getExecutionEnvironment()
Returns the Bundle-RequiredExecutionEnvironment for this BundleData as
specified in the bundle manifest file.
|
long |
getLastModified()
Get the last time this BundleData was modified.
|
String |
getLocation()
Get the BundleData Location.
|
Dictionary<String,String> |
getManifest()
Return the Dictionary of manifest headers for the BundleData.
|
int |
getStartLevel()
Returns the start level metadata for this BundleData.
|
int |
getStatus()
Returns the status metadata for this BundleData.
|
String |
getSymbolicName()
Returns the Bundle-SymbolicName for this BundleData as specified in the bundle
manifest file.
|
int |
getType()
Returns the type of bundle this BundleData is for.
|
Version |
getVersion()
Returns the Bundle-Version for this BundleData as specified in the bundle
manifest file.
|
void |
installNativeCode(String[] nativepaths)
Installs the native code paths for this BundleData.
|
void |
open()
Open the BundleData.
|
void |
save()
Persistently stores all the metadata for this BundleData
|
void |
setBundle(Bundle bundle)
Sets the Bundle object for this BundleData.
|
void |
setStartLevel(int value)
Sets the start level metatdata for this BundleData.
|
void |
setStatus(int value)
Sets the status metadata for this BundleData.
|
getBundle
static final int TYPE_FRAGMENT
static final int TYPE_FRAMEWORK_EXTENSION
static final int TYPE_BOOTCLASSPATH_EXTENSION
static final int TYPE_SINGLETON
static final int TYPE_EXTCLASSPATH_EXTENSION
static final int TYPE_COMPOSITEBUNDLE
static final int TYPE_SURROGATEBUNDLE
BundleClassLoader createClassLoader(ClassLoaderDelegate delegate, BundleProtectionDomain domain, String[] bundleclasspath)
ClassLoaderDelegate
to delegate class, resource
and library loading. The delegate is responsible for finding any resource
or classes imported by the bundle through an imported package or a required
bundle.
The ProtectionDomain
domain must be used by the Classloader when
defining a class.
delegate
- The ClassLoaderDelegate
to delegate to.domain
- The BundleProtectionDomain
to use when defining a class.bundleclasspath
- An array of bundle classpaths to use to create this
classloader. This is specified by the Bundle-ClassPath manifest entry.URL getEntry(String path)
URL
to the bundle entry specified by path.
This method must not use the BundleClassLoader to find the
bundle entry since the ClassLoader will delegate to find the resource.path
- The bundle entry path.Bundle.getEntry(String)
Enumeration<String> getEntryPaths(String path)
getEntryPaths("/META-INF")
This will return all entries from the /META-INF directory of the bundle.
path
- The path to a directory in the bundle.Bundle.getEntryPaths(String path)
String findLibrary(String libname)
libname
- The name of the library to find the absolute path to.void installNativeCode(String[] nativepaths) throws BundleException
nativepaths
- The array of native code paths to install for
the bundle.BundleException
- If any error occurs during install.File getDataFile(String path)
BundleContext.getDataFile(String)
Dictionary<String,String> getManifest() throws BundleException
BundleException
- if an error occurred while reading the
bundle manifest data.long getBundleID()
String getLocation()
long getLastModified()
void close() throws IOException
IOException
- If an error occurs closing.void open() throws IOException
IOException
- If an error occurs opening.void setBundle(Bundle bundle)
bundle
- The Bundle Object for this BundleData.int getStartLevel()
int getStatus()
void setStartLevel(int value)
value
- the start level metadatavoid setStatus(int value)
value
- the status metadata.void save() throws IOException
IOException
String getSymbolicName()
Version getVersion()
int getType()
String[] getClassPath() throws BundleException
BundleException
String getActivator()
String getExecutionEnvironment()
String getDynamicImports()
Enumeration<URL> findLocalResources(String path)
path
- the requested resource name.Copyright © 2007–2018 The Apache Software Foundation. All rights reserved.