public interface FrameworkAdaptor
The OSGi framework will call this class to perform platform specific functions. Classes that implement FrameworkAdaptor MUST provide a constructor that takes as a parameter an array of Strings. This array will contain arguments to be handled by the FrameworkAdaptor. The FrameworkAdaptor implementation may define the format and content of its arguments. The constructor should parse the arguments passed to it and remember them. The initialize method should perform the actual processing of the adaptor arguments.
Clients may implement this interface.
Modifier and Type | Field and Description |
---|---|
static String |
FRAMEWORK_SYMBOLICNAME |
Modifier and Type | Method and Description |
---|---|
void |
compactStorage()
Compact/cleanup the persistent storage for the adaptor.
|
BundleData |
createSystemBundleData()
Creates a BundleData object for the System Bundle.
|
Enumeration<URL> |
findEntries(List<BundleData> datas,
String path,
String filePattern,
int options)
Returns resources entries for the specified bundle datas.
|
void |
frameworkStart(BundleContext context)
The framework will call this method after the
System BundleActivator.start(BundleContext) has been called.
|
void |
frameworkStop(BundleContext context)
The framework will call this method before the
System BundleActivator.stop(BundleContext) has been called.
|
void |
frameworkStopping(BundleContext context)
The framework will call this method before the process of framework
shutdown is started.
|
ClassLoader |
getBundleClassLoaderParent()
Returns the parent ClassLoader all BundleClassLoaders created.
|
BundleWatcher |
getBundleWatcher()
Returns the bundle watcher for this FrameworkAdaptor.
|
FrameworkLog |
getFrameworkLog()
Returns the FrameworkLog for the FrameworkAdaptor.
|
int |
getInitialBundleStartLevel()
Returns the initial bundle start level as maintained by this adaptor
|
BundleData[] |
getInstalledBundles()
Return a list of the installed bundles.
|
PermissionStorage |
getPermissionStorage()
Returns the PermissionStorage object which will be used to
to manage the permission data.
|
PlatformAdmin |
getPlatformAdmin()
Returns the PlatformAdmin for this FrameworkAdaptor.
|
Properties |
getProperties()
Return the properties object for the adaptor.
|
State |
getState()
Returns the State for this FrameworkAdaptor.
|
long |
getTotalFreeSpace()
Returns the total amount of free space available for bundle storage on the device.
|
void |
handleRuntimeError(Throwable error)
Handles a RuntimeException or Error that was caught by the Framework and
there is not a suitable caller to propagate the Throwable to.
|
void |
initialize(EventPublisher eventPublisher)
Initialize the FrameworkAdaptor object so that it is ready to be
called by the framework.
|
void |
initializeStorage()
Initialize the persistent storage for the adaptor.
|
BundleOperation |
installBundle(String location,
URLConnection source)
Prepare to install a bundle from a URLConnection.
|
URLConnection |
mapLocationToURLConnection(String location)
Map a location to a URLConnection.
|
void |
setInitialBundleStartLevel(int value)
Sets the initial bundle start level
|
BundleOperation |
uninstallBundle(BundleData bundledata)
Prepare to uninstall a bundle.
|
BundleOperation |
updateBundle(BundleData bundledata,
URLConnection source)
Prepare to update a bundle from a URLConnection.
|
static final String FRAMEWORK_SYMBOLICNAME
void initialize(EventPublisher eventPublisher)
eventPublisher
- The EventPublisher used to publish any events to
the framework.void initializeStorage() throws IOException
IOException
- If the adaptor is unable to
initialize the bundle storage.void compactStorage() throws IOException
IOException
- If the adaptor is unable to
compact the bundle storage.Properties getProperties()
BundleData[] getInstalledBundles()
BundleData
. Each BundleData
corresponds to one bundle that is persistently stored.
This method must construct BundleData
objects for all
installed bundles and return an array containing the objects.
The returned array becomes the property of the framework.URLConnection mapLocationToURLConnection(String location) throws BundleException
location
- of the bundle.BundleException
- if the mapping fails.BundleOperation installBundle(String location, URLConnection source)
To complete the install,
begin and then commit
must be called on the returned BundleOperation
object.
If either of these methods throw a BundleException
or some other error occurs,
then undo must be called on the BundleOperation
object
to undo the change to persistent storage.
location
- Bundle location.source
- URLConnection from which the bundle may be read.
Any InputStreams returned from the source
(URLConnections.getInputStream) must be closed by the
BundleOperation
object.BundleOperation updateBundle(BundleData bundledata, URLConnection source)
To complete the update
begin and then commit
must be called on the returned BundleOperation
object.
If either of these methods throw a BundleException
or some other error occurs,
then undo must be called on the BundleOperation
object
to undo the change to persistent storage.
bundledata
- BundleData to update.source
- URLConnection from which the updated bundle may be read.
Any InputStreams returned from the source
(URLConnections.getInputStream) must be closed by the
BundleOperation
object.BundleOperation uninstallBundle(BundleData bundledata)
To complete the uninstall,
begin and then commit
must be called on the returned BundleOperation
object.
If either of these methods throw a BundleException
or some other error occurs,
then undo must be called on the BundleOperation
object
to undo the change to persistent storage.
bundledata
- BundleData to uninstall.long getTotalFreeSpace() throws IOException
IOException
- if an I/O error occurs determining the available spacePermissionStorage getPermissionStorage() throws IOException
IOException
void frameworkStart(BundleContext context) throws BundleException
context
- The System Bundle's BundleContext.BundleException
- on any error that may occur.void frameworkStop(BundleContext context) throws BundleException
context
- The System Bundle's BundleContext.BundleException
- on any error that may occur.void frameworkStopping(BundleContext context)
frameworkStop(BundleContext)
method.context
- The System Bundle's BundleContext.int getInitialBundleStartLevel()
void setInitialBundleStartLevel(int value)
value
- the initial bundle start levelFrameworkLog getFrameworkLog()
BundleData createSystemBundleData() throws BundleException
BundleException
- if any error occurs while creating the
System BundleData.BundleWatcher getBundleWatcher()
PlatformAdmin getPlatformAdmin()
This method will not be called until after
frameworkStart(BundleContext)
is called.
State getState()
This method will not be called until after
frameworkStart(BundleContext)
is called.
The State returned is used by the framework to resolve bundle
dependencies.
ClassLoader getBundleClassLoaderParent()
void handleRuntimeError(Throwable error)
error
- The Throwable for the runtime error that is to be handled.Enumeration<URL> findEntries(List<BundleData> datas, String path, String filePattern, int options)
datas
- the list of bundle datas to search inpath
- 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.BundleClassLoader.findEntries(String, String, int)
,
Bundle.findEntries(String, String, boolean)
Copyright © 2007–2018 The Apache Software Foundation. All rights reserved.