Skip to end of metadata
Go to start of metadata

The JBoss OSGi Framework in JBoss AS 7 can be controlled via the AS 7 Command Line Interface (CLI).

The CLI supports an interactive mode as well as a scripted mode, for more information on using and launching the CLI, see the Command Line Interface documentation.

Supported operations:

Framework Configuration

Framework configuration is stored in the AS 7 XML configuration file (e.g. standalone.xml). The CLI provides a management interface to this configuration.

Setting the Subsystem Activation Mode

The activation mode of the OSGi subsystem within AS 7 is specified in the activation attribute. It specifies whether the OSGi subsystem is activated on startup of the Application Server (eager) or only once the first bundle is deployed (lazy). By default the activation mode is set to lazy.

To read the current activation mode:

To change the activation mode to eager

Framework Properties

Framework properties are stored as resources in the /subsystem=osgi/property location. Note that any changes to OSGi framework properties require a framework restart in order to become effective.

Adding a property: the following command adds the org.osgi.framework.system.packages.extra framework property with value org.foo.bar;version=1.2.

To list the framework properties use the ls command:

To read the value of an individual framework property:

To remove a framework property:

Capabilities

The capability name is an abstract identifier for some functional capability. We currently support module identifiers (i.e. a pointer to some bundle or module available in the AS 7 product repository) and maven coordinates (i.e. a maven artifact identifier availbale in the public jboss nexus repository). Capabilities are automatically loaded when the OSGi framework is launched. In the case of bundle capabilities, these can also be started as part of this process. The modules repository can be found in the modules/ subdirectory of the AS 7 installation, while the bundles repository can be found in the bundles/ subdirectory.

The example command below adds a bundle capability org.projectodd.stilts. The system will look for capabilities at startup in the modules/ and bundles/ directories. In this example the org.projectodd.stilts module/bundle jar is searched in the modules/org/projectodd/stilts/main/ and bundles/org/projectodd/stilts/main/ locations.

Note that only bundles can be started, so specifying the startlevel as is done in this example does not apply to modules.

To list configured capabilities use the ls command:

To inspect a capability, use the read-resource command:

Removing a capability can be done with the remove command:

Framework Management

Framework management refers to the monitoring and manipulating the OSGi Framework runtime state.

Activate the framework

The framework can be activated using the activate command.

Manage the Start Level

The current framework start level can be in found in the startlevel attribute in the osgi subsystem. For example:

To change the start level, write the desired new value to the startlevel attribute:

Bundle Management

The CLI can be used to deploy, undeploy, start and stop bundles and to inspect the current bundle state.

Deploying and Un-deploying

Deployment and un-deployment of bundles is done through the regular deployment channels in AS 7. To deploy a bundle:

Undeploying is done with the undeploy command:

Note that deploying a bundle will place it in the INSTALLED state, to become functional OSGi bundles need to be started.

Starting, Stopping and Inspecting Bundles

To start the test-osgi-bundle.jar as deployed above, use the following command:

To inspect the bundle state:

To stop the bundle, issue one of the following commands:

Listing Bundles

Bundles can be listed by bundle ID using the ls command:

or in more detail using the read-children-resources command:

Configuration Admin

OSGi Configuration Admin support is provided through the configadmin subsystem. By default the JBoss OSGi runtime in AS 7 provides the Configuration Admin Service. For more information on the OSGi Configuration Admin Service see chapter 104 in the OSGi Compendium Specification.

Configuration Admin is a dynamic system that supports re-configuration during operation, therefore all the related management operations take effect immediately and value changes will be propagated to the relevant configuration consumers without the need for a restart.

Adding Configuration

Configuration Admin configurations objects are identified by a Persistent Identified (PID) and carry an associated map of configuration values. Create a configuration using the add command:

Listing Configurations

List all the available configurations with the ls command:

Inspecting Configuration

Read the configuration data with the read-resource command:

Removing Configuration

Configuration objects can be removed by issuing the remove command on the configuration pid resource:

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.