org.knopflerfish.framework.Framework Class Reference

List of all members.


Detailed Description

This class contains references to all common data structures inside the framework.

Author:
Jan Stein, Erik Wistrand, Philippe Laporte, Mats-Ola Persson

Definition at line 58 of file Framework.java.


Public Member Functions

 Framework (Object m) throws Exception
 Contruct a framework.
void launch (long startBundle) throws BundleException
 Start this Framework.
void shutdown ()
 Stop this Framework, suspending all started contexts.
long installBundle (String location, InputStream in) throws BundleException
 Install a bundle from the given location.
void startBundle (long id) throws BundleException
 Start a bundle.
void stopBundle (long id) throws BundleException
 Stop a bundle.
void uninstallBundle (long id) throws BundleException
 Uninstall a bundle.
void updateBundle (long id) throws BundleException
 Update a bundle.
String getBundleLocation (long id)
 Retrieve location of the bundle that has the given unique identifier.
long getBundleId (String location)
 Retrieve bundle id of the bundle that has the given unique location.
FileTree getDataStorage (long id)
 Get private bundle data storage file handle.
BundleContext getSystemBundleContext ()
 Get the bundle context used by the system bundle.

Static Public Member Functions

static String getProperty (String key)
 Retrieve the value of the named framework property.

Public Attributes

Bundles bundles
 All bundle in this framework.

Package Functions

boolean isValidEE (String ee)
 Check if an execution environment string is accepted.

Package Attributes

boolean active
 Boolean indicating that framework is running.
boolean shuttingdown
 Set during shutdown process.
Listeners listeners
 All listeners in this framework.
Packages packages
 All exported and imported packages in this framework.
Services services
 All registered services in this framework.
PermissionOps perm
 PermissionOps handle.
SystemBundle systemBundle
 System bundle.
BundleStorage storage
 Bundle Storage.
FileTree dataStorage
 Private Bundle Data Storage.
Object mainHandle
 Main handle so that main doesn't get GCed.
StartLevelImpl startLevelService
 The start level service.
ServiceURLStreamHandlerFactory urlStreamHandlerFactory
 Factory for handling service-based URLs.
ServiceContentHandlerFactory contentHandlerFactory
 Factory for handling service-based URL contents.

Static Package Attributes

static final String SPEC_VERSION = "1.3"
 Specification version for this framework.
static final String TRUE = "true"
 Property constants for the framework.
static boolean SUPPORTS_EXTENSION_BUNDLES
 Whether the framework supports extension bundles or not.

Member Function Documentation

void org.knopflerfish.framework.Framework.launch ( long  startBundle  )  throws BundleException

Start this Framework.

This method starts all the bundles that were started at the time of the last shutdown.

If the Framework is already started, this method does nothing. If the Framework is not started, this method will:

  1. Enable event handling. At this point, events can be delivered to listeners.
  2. Attempt to start all bundles marked for starting as described in the Bundle#start method. Reports any exceptions that occur during startup using FrameworkErrorEvents.
  3. Set the state of the Framework to active.
  4. Broadcasting a FrameworkEvent through the FrameworkListener.frameworkStarted method.

If this Framework is not launched, it can still install, uninstall, start and stop bundles. (It does these tasks without broadcasting events, however.) Using Framework without launching it allows for off-line debugging of the Framework.

Parameters:
startBundle If it is specified with a value larger than 0, then the bundle with that id is started. Otherwise start all suspended bundles.

Definition at line 354 of file Framework.java.

References org.knopflerfish.framework.Framework.active, org.knopflerfish.framework.Framework.bundles, org.knopflerfish.framework.Listeners.frameworkError(), org.knopflerfish.framework.Listeners.frameworkEvent(), org.knopflerfish.framework.Bundles.getBundle(), org.knopflerfish.framework.BundleStorage.getStartOnLaunchBundles(), org.knopflerfish.framework.Framework.listeners, org.knopflerfish.framework.StartLevelImpl.open(), org.osgi.framework.Bundle.start(), org.knopflerfish.framework.Framework.startBundle(), org.knopflerfish.framework.Framework.startLevelService, org.knopflerfish.framework.Framework.storage, org.knopflerfish.framework.SystemBundle.systemActive(), and org.knopflerfish.framework.Framework.systemBundle.

Referenced by org.knopflerfish.framework.Main.restart().

void org.knopflerfish.framework.Framework.shutdown (  ) 

Stop this Framework, suspending all started contexts.

This method suspends all started contexts so that they can be automatically restarted when this Framework is next launched.

If the framework is not started, this method does nothing. If the framework is started, this method will:

  1. Set the state of the Framework to inactive.
  2. Suspended all started bundles as described in the Bundle#stop method except that the persistent state of the bundle will continue to be started. Reports any exceptions that occur during stopping using FrameworkErrorEvents.
  3. Disable event handling.

Definition at line 400 of file Framework.java.

References org.knopflerfish.framework.Framework.active, org.knopflerfish.framework.BundleImpl.archive, org.knopflerfish.framework.Framework.bundles, org.knopflerfish.framework.Listeners.frameworkEvent(), org.knopflerfish.framework.Bundles.getBundle(), org.knopflerfish.framework.Bundles.getBundles(), org.knopflerfish.framework.Bundles.getFragmentBundles(), org.knopflerfish.framework.BundleArchive.getJarLocation(), org.knopflerfish.framework.BundleStorage.getStartOnLaunchBundles(), org.osgi.framework.Bundle.getState(), org.knopflerfish.framework.BundleImpl.isBootClassPathExtension(), org.knopflerfish.framework.Framework.listeners, org.knopflerfish.framework.StartLevelImpl.shutdown(), org.knopflerfish.framework.Framework.shuttingdown, org.knopflerfish.framework.Framework.startLevelService, org.osgi.framework.Bundle.stop(), org.knopflerfish.framework.Framework.storage, org.knopflerfish.framework.Framework.systemBundle, and org.knopflerfish.framework.SystemBundle.systemShuttingdown().

Referenced by org.knopflerfish.framework.Main.restart(), and org.knopflerfish.framework.Main.shutdown().

long org.knopflerfish.framework.Framework.installBundle ( String  location,
InputStream  in 
) throws BundleException

Install a bundle from the given location.

Parameters:
location The location identifier of the bundle to install.
in The InputStream from which the bundle will be read.
Returns:
The BundleImpl object of the installed bundle.
Exceptions:
BundleException If the install failed.

Definition at line 487 of file Framework.java.

References org.knopflerfish.framework.Framework.bundles, org.knopflerfish.framework.BundleImpl.id, and org.knopflerfish.framework.Bundles.install().

void org.knopflerfish.framework.Framework.startBundle ( long  id  )  throws BundleException

Start a bundle.

Parameters:
id Id of bundle to start.
Exceptions:
BundleException If start failed.

Definition at line 498 of file Framework.java.

References org.knopflerfish.framework.Framework.bundles, org.knopflerfish.framework.Bundles.getBundle(), and org.osgi.framework.Bundle.start().

Referenced by org.knopflerfish.framework.Framework.launch().

void org.knopflerfish.framework.Framework.stopBundle ( long  id  )  throws BundleException

Stop a bundle.

Parameters:
id Id of bundle to stop.
Exceptions:
BundleException If stop failed.

Definition at line 514 of file Framework.java.

References org.knopflerfish.framework.Framework.bundles, org.knopflerfish.framework.Bundles.getBundle(), and org.osgi.framework.Bundle.stop().

Referenced by org.knopflerfish.framework.Main.restart(), and org.knopflerfish.framework.Main.shutdown().

void org.knopflerfish.framework.Framework.uninstallBundle ( long  id  )  throws BundleException

Uninstall a bundle.

Parameters:
id Id of bundle to stop.
Exceptions:
BundleException If uninstall failed.

Definition at line 530 of file Framework.java.

References org.knopflerfish.framework.Framework.bundles, org.knopflerfish.framework.Bundles.getBundle(), and org.osgi.framework.Bundle.uninstall().

void org.knopflerfish.framework.Framework.updateBundle ( long  id  )  throws BundleException

Update a bundle.

Parameters:
id Id of bundle to update.
Exceptions:
BundleException If update failed.

Definition at line 546 of file Framework.java.

References org.knopflerfish.framework.Framework.bundles, org.knopflerfish.framework.Bundles.getBundle(), and org.osgi.framework.Bundle.update().

String org.knopflerfish.framework.Framework.getBundleLocation ( long  id  ) 

Retrieve location of the bundle that has the given unique identifier.

Parameters:
id The identifier of the bundle to retrieve.
Returns:
A location as a string, or null if the identifier doesn't match any installed bundle.

Definition at line 564 of file Framework.java.

References org.knopflerfish.framework.Framework.bundles, org.knopflerfish.framework.Bundles.getBundle(), and org.osgi.framework.Bundle.getLocation().

long org.knopflerfish.framework.Framework.getBundleId ( String  location  ) 

Retrieve bundle id of the bundle that has the given unique location.

Parameters:
location The location of the bundle to retrieve.
Returns:
The unique identifier of the bundle, or -1 if the location doesn't match any installed bundle.

Definition at line 581 of file Framework.java.

References org.knopflerfish.framework.Framework.bundles, org.knopflerfish.framework.Bundles.getBundle(), and org.osgi.framework.Bundle.getBundleId().


Member Data Documentation

boolean org.knopflerfish.framework.Framework.SUPPORTS_EXTENSION_BUNDLES [static, package]

Whether the framework supports extension bundles or not.

This will be false if bIsMemoryStorage is false.

Definition at line 188 of file Framework.java.

Referenced by org.knopflerfish.framework.Framework.Framework(), and org.knopflerfish.framework.Framework.getProperty().


The documentation for this class was generated from the following file:
Generated on Mon Jan 11 21:19:19 2010 for OpenMobileIS by  doxygen 1.5.4