|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.osgi.baseadaptor.BaseAdaptor
public class BaseAdaptor
A Framework adaptor implementation that allows additional functionality to be
hooked in. Hooks are configured using HookConfigurator
objects. A framework extension may add hook configurators which can be used
to add hooks to the HookRegistry.
HookConfigurator,
HookRegistry,
AdaptorHook| Field Summary |
|---|
| Fields inherited from interface org.eclipse.osgi.framework.adaptor.FrameworkAdaptor |
|---|
FRAMEWORK_SYMBOLICNAME |
| Constructor Summary | |
|---|---|
BaseAdaptor(java.lang.String[] args)
Constructs a BaseAdaptor. |
|
| Method Summary | |
|---|---|
void |
compactStorage()
Compact/cleanup the persistent storage for the adaptor. |
BundleFile |
createBundleFile(java.lang.Object content,
BaseData data)
Creates a bundle file object for the given content and base data. |
BundleData |
createSystemBundleData()
Creates a BundleData object for the System Bundle. |
java.util.Enumeration<java.net.URL> |
findEntries(java.util.List<BundleData> datas,
java.lang.String path,
java.lang.String filePattern,
int options)
Returns resources entries for the specified bundle datas. |
void |
frameworkStart(BundleContext fwContext)
This method calls all the configured adaptor hook AdaptorHook.frameworkStart(BundleContext) methods. |
void |
frameworkStop(BundleContext fwContext)
This method calls all the configured adaptor hook AdaptorHook.frameworkStop(BundleContext) methods. |
void |
frameworkStopping(BundleContext fwContext)
This method calls all the configured adaptor hook AdaptorHook.frameworkStopping(BundleContext) methods. |
Bundle |
getBundle(long id)
Returns the bundle with the specified identifier. |
java.lang.ClassLoader |
getBundleClassLoaderParent()
This method calls all the configured classloading hooks ClassLoadingHook.getBundleClassLoaderParent() methods
until one returns a non-null value. |
BundleWatcher |
getBundleWatcher()
Returns the bundle watcher for this FrameworkAdaptor. |
BundleContext |
getContext()
Returns the system bundle's context |
EventPublisher |
getEventPublisher()
Returns the event publisher for this BaseAdaptor |
FrameworkLog |
getFrameworkLog()
This method calls all configured adaptor hook AdaptorHook.createFrameworkLog() methods
until the first one returns a non-null value. |
HookRegistry |
getHookRegistry()
Returns the HookRegistry object for this adaptor. |
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. |
java.util.Properties |
getProperties()
This method will call all the configured adaptor hook AdaptorHook.addProperties(Properties) methods. |
State |
getState()
Returns the State for this FrameworkAdaptor. |
protected BaseStorage |
getStorage()
|
long |
getTotalFreeSpace()
Returns the total amount of free space available for bundle storage on the device. |
void |
handleRuntimeError(java.lang.Throwable error)
This method calls all the configured adaptor hooks AdaptorHook.handleRuntimeError(Throwable) methods. |
void |
initialize(EventPublisher publisher)
This method will call all configured adaptor hooks AdaptorHook.initialize(BaseAdaptor) method. |
void |
initializeStorage()
Initialize the persistent storage for the adaptor. |
BundleOperation |
installBundle(java.lang.String location,
java.net.URLConnection source)
Prepare to install a bundle from a URLConnection. |
boolean |
isReadOnly()
Returns true if the persistent storage is read-only |
boolean |
isStopping()
Returns true if the frameworkStopping(BundleContext) method has been called |
java.util.List<java.lang.String> |
listEntryPaths(java.util.List<BundleFile> bundleFiles,
java.lang.String path,
java.lang.String filePattern,
int options)
Returns the names of resources available from a list of bundle files. |
java.net.URLConnection |
mapLocationToURLConnection(java.lang.String location)
This method will call each configured adaptor hook AdaptorHook.mapLocationToURLConnection(String) method
until one returns a non-null value. |
void |
setInitialBundleStartLevel(int value)
Sets the initial bundle start level |
BundleOperation |
uninstallBundle(BundleData bundledata)
Prepare to uninstall a bundle. |
BundleOperation |
updateBundle(BundleData bundledata,
java.net.URLConnection source)
Prepare to update a bundle from a URLConnection. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BaseAdaptor(java.lang.String[] args)
args - arguments passed to the adaptor by the framework.| Method Detail |
|---|
public void initialize(EventPublisher publisher)
AdaptorHook.initialize(BaseAdaptor) method.
initialize in interface FrameworkAdaptorpublisher - The EventPublisher used to publish any events to
the framework.FrameworkAdaptor.initialize(EventPublisher)
public void initializeStorage()
throws java.io.IOException
FrameworkAdaptor
initializeStorage in interface FrameworkAdaptorjava.io.IOException - If the adaptor is unable to
initialize the bundle storage.FrameworkAdaptor.initializeStorage()
public void compactStorage()
throws java.io.IOException
FrameworkAdaptor
compactStorage in interface FrameworkAdaptorjava.io.IOExceptionFrameworkAdaptor.compactStorage()public java.util.Properties getProperties()
AdaptorHook.addProperties(Properties) methods.
getProperties in interface FrameworkAdaptorFrameworkAdaptor.getProperties()public BundleData[] getInstalledBundles()
FrameworkAdaptorBundleData. 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.
getInstalledBundles in interface FrameworkAdaptorFrameworkAdaptor.getInstalledBundles()
public java.net.URLConnection mapLocationToURLConnection(java.lang.String location)
throws BundleException
AdaptorHook.mapLocationToURLConnection(String) method
until one returns a non-null value. If none of the adaptor hooks return a non-null value then the
string is used to construct a new URL object to open a new url connection.
mapLocationToURLConnection in interface FrameworkAdaptorlocation - of the bundle.
BundleException - if the mapping fails.FrameworkAdaptor.mapLocationToURLConnection(String)
public BundleOperation installBundle(java.lang.String location,
java.net.URLConnection source)
FrameworkAdaptorTo 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.
installBundle in interface FrameworkAdaptorlocation - 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.
FrameworkAdaptor.installBundle(String, URLConnection)
public BundleOperation updateBundle(BundleData bundledata,
java.net.URLConnection source)
FrameworkAdaptorTo 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.
updateBundle in interface FrameworkAdaptorbundledata - 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.
FrameworkAdaptor.updateBundle(BundleData, URLConnection)public BundleOperation uninstallBundle(BundleData bundledata)
FrameworkAdaptorTo 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.
uninstallBundle in interface FrameworkAdaptorbundledata - BundleData to uninstall.
FrameworkAdaptor.uninstallBundle(BundleData)
public long getTotalFreeSpace()
throws java.io.IOException
FrameworkAdaptor
getTotalFreeSpace in interface FrameworkAdaptorjava.io.IOException - if an I/O error occurs determining the available spaceFrameworkAdaptor.getTotalFreeSpace()
public PermissionStorage getPermissionStorage()
throws java.io.IOException
FrameworkAdaptor
getPermissionStorage in interface FrameworkAdaptorjava.io.IOExceptionFrameworkAdaptor.getPermissionStorage()
public void frameworkStart(BundleContext fwContext)
throws BundleException
AdaptorHook.frameworkStart(BundleContext) methods.
frameworkStart in interface FrameworkAdaptorfwContext - The System Bundle's BundleContext.
BundleException - on any error that may occur.FrameworkAdaptor.frameworkStart(BundleContext)
public void frameworkStop(BundleContext fwContext)
throws BundleException
AdaptorHook.frameworkStop(BundleContext) methods.
frameworkStop in interface FrameworkAdaptorfwContext - The System Bundle's BundleContext.
BundleException - on any error that may occur.FrameworkAdaptor.frameworkStop(BundleContext)public void frameworkStopping(BundleContext fwContext)
AdaptorHook.frameworkStopping(BundleContext) methods.
frameworkStopping in interface FrameworkAdaptorfwContext - The System Bundle's BundleContext.FrameworkAdaptor.frameworkStopping(BundleContext)public int getInitialBundleStartLevel()
FrameworkAdaptor
getInitialBundleStartLevel in interface FrameworkAdaptorFrameworkAdaptor.getInitialBundleStartLevel()public void setInitialBundleStartLevel(int value)
FrameworkAdaptor
setInitialBundleStartLevel in interface FrameworkAdaptorvalue - the initial bundle start levelFrameworkAdaptor.setInitialBundleStartLevel(int)public FrameworkLog getFrameworkLog()
AdaptorHook.createFrameworkLog() methods
until the first one returns a non-null value. If none of the adaptor hooks return a non-null
value then a framework log implementation which does nothing is returned.
getFrameworkLog in interface FrameworkAdaptorFrameworkAdaptor.getFrameworkLog()
public BundleData createSystemBundleData()
throws BundleException
FrameworkAdaptor
createSystemBundleData in interface FrameworkAdaptorBundleException - if any error occurs while creating the
System BundleData.FrameworkAdaptor.createSystemBundleData()public BundleWatcher getBundleWatcher()
FrameworkAdaptor
getBundleWatcher in interface FrameworkAdaptorFrameworkAdaptor.getBundleWatcher()public PlatformAdmin getPlatformAdmin()
FrameworkAdaptor
This method will not be called until after
FrameworkAdaptor.frameworkStart(BundleContext) is called.
getPlatformAdmin in interface FrameworkAdaptorFrameworkAdaptor.getPlatformAdmin()public State getState()
FrameworkAdaptor
This method will not be called until after
FrameworkAdaptor.frameworkStart(BundleContext) is called.
The State returned is used by the framework to resolve bundle
dependencies.
getState in interface FrameworkAdaptorFrameworkAdaptor.getState()public java.lang.ClassLoader getBundleClassLoaderParent()
ClassLoadingHook.getBundleClassLoaderParent() methods
until one returns a non-null value.
getBundleClassLoaderParent in interface FrameworkAdaptorFrameworkAdaptor.getBundleClassLoaderParent()public void handleRuntimeError(java.lang.Throwable error)
AdaptorHook.handleRuntimeError(Throwable) methods.
handleRuntimeError in interface FrameworkAdaptorerror - The Throwable for the runtime error that is to be handled.FrameworkAdaptor.handleRuntimeError(Throwable)public boolean isStopping()
frameworkStopping(BundleContext) method has been called
public EventPublisher getEventPublisher()
public HookRegistry getHookRegistry()
HookRegistry object for this adaptor.
HookRegistry object for this adaptor.public BundleContext getContext()
public Bundle getBundle(long id)
id - The identifier of the bundle to retrieve.
Bundle object or null if the identifier does
not match any installed bundle.
public BundleFile createBundleFile(java.lang.Object content,
BaseData data)
throws java.io.IOException
BundleFileFactoryHook.createBundleFile(Object, BaseData, boolean) method until one
factory returns a non-null value. If no bundle file factory returns a non-null value
then the the default behavior will be performed.
If the specified content is null then the base content of the specified
bundledata must be found before calling any bundle file factories.
After the bundle file has been created each configured bundle file wrapper factory
BundleFileWrapperFactoryHook.wrapBundleFile(BundleFile, Object, BaseData, boolean)
method is called to wrap the bundle file.
content - The object which contains the content of a bundle file. A value of
null indicates that the storage must find the base content for the
specified BaseData.data - The BaseData associated with the content
java.io.IOException - if an error occured while creating the BundleFilepublic boolean isReadOnly()
protected BaseStorage getStorage()
public java.util.Enumeration<java.net.URL> findEntries(java.util.List<BundleData> datas,
java.lang.String path,
java.lang.String filePattern,
int options)
FrameworkAdaptor
findEntries in interface FrameworkAdaptordatas - 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.
FrameworkAdaptor.findEntries(List, String, String, int)
public java.util.List<java.lang.String> listEntryPaths(java.util.List<BundleFile> bundleFiles,
java.lang.String path,
java.lang.String filePattern,
int options)
bundleFiles - the list of bundle files 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.
BundleWiring.listResources(String, String, int)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||