Open Services Gateway Initiative

Open Services Gateway Initiative (OSGi) is a framework for the packaging and dynamic deployment of Java software services to networked devices. The OSGi specification defines a component-based architecture splitting packages and services into components known as bundles. Each bundle is effectively a modified jar file. A bundle has a Manifest, which describes the services or packages that the bundle either requires or exports. A service is simply an interface that the bundle implements. Therefore, Interacting bundles are only loosely coupled to each other via these service definitions or by Java package declaration.

OSGi can effectively be split between the client runtime and the bundle server or repository that provides the required bundle. The runtime provides the following functionality:

WebSphere MQ Everyplace supplies an example bundle, the MQeBundle.jar, that OSGi developers can use to provide messaging functionality within a gateway or client runtime. The MQeBundle.jar is an OSGi bundle containing the core functionality for a queue manager running as client or server. The following sections describe how to install and run the bundle within the IBM Service Management Framework (SMF) OSGi implementation.

Installing bundles onto an SMF bundle server

You can Install bundles onto the server can either through the web interface or using the IDE incorporated into Websphere Studio Device Developer (WSDD). In both cases, the bundle server needs to be started. This is simply done by invoking the script iveserver found in WSDDHOME/wsdd5.0/technologies/smf/server. The default is port 8080, this may conflict with applications currently residing on your server, for example, Apache. To change the port, alter the org.osgi.service.http.Port=8080 property in the smf.properties file, which resides in the runtime directory.

Using the Web Interface

Once the bundle server is running, administer bundles by opening a web browser with the following URL http://hostname:port/smf, where typically, the hostname is "localhost"and the port is 8080.

Bundle installation is carried out in two stages:

  1. Submission by a developer (Bundle Submission link)
  2. Release by an administrator (Bundle Management->Release Management link)

Only released bundles are available to client runtimes and users configured on the server need to have the correct privileges in order to carry out either or both stages. For more information on the options available for bundle submission, see the smf documentation in WSDDHOME/wsdd5.0/technologies/smf/client/docs.

Using WSDD IDE

There are two ways to update the bundle server depending on whether you are developing your own bundle or installing an existing one

  1. When developing a new bundle, turn your java project into a bundle by selecting File-->New-->Other from the Main menu and then selecting the Bundle Folder option. This creates all the necessary files required for the bundle, notably the Manifest.mf file. When the bundle is ready, right click on the project and on the popup menu select SMF-->Submit Bundle. The dialog provides options to submit either a jar or jxe and the bundle server or directory that you want to submit the bundle to.
  2. To submit an existing bundle, select the SMF Bundle Servers view. Right click on the desired server and select "Import Bundles" from the popup menu. Options enable you to either specify a directory where the bundle resides or retrieve bundles from another bundle server.

Using the SMF Runtime

Once all the required bundles have been installed onto the server you can then use a runtime. You can control runtimes using either the WSDD IDE or the command prompt. If using the IDE, each runtime you use needs to be configured to use a separate port. Configure the runtime by editing the smf.bat file that starts the IDE. There is a limit of one runtime per IDE, even if you are connecting to a remote runtime.

Using the command prompt

Running the smf.bat script starts the appropriate runtime. For more information on how to tailor the runtime and the additional console commands available, see the relevant smf documentation. However, to install the required bundle simply type

smf > install <URL>

The url can be the specific file location on the machine, for example file:/fully qualified file path, or a remote location, http://remote location of file. There is also an smf specific protocol smfdb:/bundle name which uses the Safe Bundle Install method to install this bundle and all the bundles prerequisites. To get a summarized list of the all installed bundles, their locations, and state, simply type

smf ss

Next, to start and stop the bundle, type

smf > start <bundle_id>
smf > stop <bundle id>

Via WSDD

To run the runtime within WSDD, the user needs to define a new runtime using the dialog found when selecting run ->run from the main menu.

Once the runtime is configured and then started, the runtimes properties and bundle information is shown within the SMF Runtime view. To install the required bundle, select the bundle on the bundle servers list, right click the bundle, and on the popup menu select install. Once installed, the bundle should be visible within the SMF Runtime view. Right clicking one of the list of bundles enables the user to uninstall, start, or stop the relevant bundle.

Current limitations

When using the WebSphere MQ Everyplace bundle:

  1. Only one WebSphere MQ Everyplace queue manager can run in a JVM, which means that only one queue manager can run within an OSGI Runtime.
  2. For OSGI Version 2.0 or below User-defined WebSphere MQ Everyplace rules and adapters must use their own MQeLoader.
    Note:
    SMF Version 3.1 or above does not require this

For more details on running the example application bundles provided see the Application Programming Guide.



© IBM Corporation 2002. All Rights Reserved