This domain is a resource-base representation of OSGi entities, including framework, bundles, packages, services, configurations, log entries and deployment packages.

Entity Index:

Requirements

everest OSGi domain needs an OSGi r4.3 compliant framework to represent its entities as resources. Additionally, it depends on:

  • Apache Felix iPOJO, version 1.10.1 or above
  • everest-core, version ${everest.core.version}

everest OSGi has optional dependencies on following OSGi services:

  • org.osgi.service.log, version 1.3 or above (OSGi Log Service)
  • org.osgi.service.cm, version 1.4 or above (OSGi Configuration Admin Service)
  • org.osgi.service.deploymentadmin, version 1.1 or above (OSGi Deployment Package Admin)

Installation

For a quick start, here is a minimal OSGi framework that will let you test everest and everest OSGi domain.

g! 
g! lb
START LEVEL 1
   ID|State      |Level|Name
    0|Active     |    0|System Bundle (4.2.1)
    1|Active     |    1|Java Servlet API (2.5.0)
    2|Active     |    1|Commons IO (2.4.0)
    3|Active     |    1|everest-core (1.0.0.SNAPSHOT)
    4|Active     |    1|everest-osgi (1.0.0.SNAPSHOT)
    5|Active     |    1|everest-servlet (1.0.0.SNAPSHOT)
    6|Active     |    1|Apache Felix Gogo Command (0.12.0)
    7|Active     |    1|Apache Felix Gogo Runtime (0.10.0)
    8|Active     |    1|Apache Felix Gogo Shell (0.10.0)
    9|Active     |    1|Apache Felix Http Jetty (2.2.0)
   10|Active     |    1|Apache Felix iPOJO (1.10.1)
   11|Active     |    1|osgi.cmpn (4.3.1.201210102024)
g! 

Usage

Considering that you have the framework mentioned above, running on localhost and listening on 8080 port, you can test the OSGi domain by entering the following URL on your browser

http://localhost:8080/everest/osgi

With the help of a little formatting, you should have a result, similar to this:

{
    name: "osgi"
    description: "This root represents osgi framework and its subresources"
    org.osgi.framework.version: "1.5"
    org.osgi.framework.vendor: "Apache Software Foundation"
    ...
    startlevel.bundle: 1
    startlevel: 1
    __relations: {
        everest:bundles: {
        href: "http://localhost:8080/everest/osgi/bundles"
        action: "READ"
        name: "everest:bundles"
        description: "Get bundles"
    ...
}

We recommend using a REST client browser extension for easily “browsing” the resources of in your platform.

Of course, you can always access the resources represented by the everest OSGi domain programmatically on your OSGi framework. For this you need to acquire the EverestService and make requests on /osgi resource, such as:

 // This is how you can get the Everest service.
 // Beware that the EverestService may not be present (i.e. ref == null)
 ServiceReference<EverestService> ref = bundleContext.getServiceReference(EverestService.class);
 EverestService everest = bc.getService(ref);
 
 // This is how you can access the everest OSGi domain.
 // The process() method throws a ResourceNotFoundException exception
 // if the OSGi domain is not active.
 Resource osgiRootResource = everest.process(new DefaultRequest(Action.READ, Path.from("/osgi"), null));

You can continue with OSGi Root Resource and start discovering the resources on everest OSGi domain.
Or, you can head out to Tutorials and find out how to manipulate OSGi resources in a RESTful way.


OSGi Root Resource

Root resource is the starting point for OSGi domain and represents the OSGi Framework.

Path

/osgi

Observable

This resource is observable. It delivers events for the following:

  • UPDATED: Startlevel changed.
  • UPDATED: Packages refreshed.
  • UPDATED: One of the dynamic sub-resources arrived/disappeared.

Operations

  • UPDATE “update”: Update initial bundle startlevel, framework startlevel.
    • Parameter (“startlevel.bundle”): Type: Integer, Optional: true
    • Parameter (“startlevel”): Type: Integer, Optional: true
  • UPDATE “restart”: Restart the framework.
    • Parameter (“restart”), Type: Boolean, Optional: true
  • DELETE “stop”: Stops the OSGi framework.

Metadata

  • startlevel.bundle (int): Initial bundle start level
  • startlevel (int): Framework start level
  • org.osgi.framework.version (string): Framework version
  • Other framework properties provided by the framework

Sub-resources

Adaptations

  • org.osgi.framework.Bundle: Framework bundle
  • org.osgi.framework.wiring.FrameworkWiring: Framework Wiring object
  • org.osgi.framework.startlevel.FrameworkStartLevel: Framework StartLevel object

Scroll To Top ↑


Bundles

Root of all bundles

Path

/osgi/bundles

Observable

This resource is not observable.

Operations

  • CREATE “install”: Install new bundle.
    • Parameter (“location”): Type: String, Optional: false
    • Parameter (“input”): Type: ByteArrayInputStream, Optional: true
  • UPDATE “update”: Update state of bundles.
    • Parameter (“refresh”): Type: List<, Optional: true
    • Parameter (“resolve”): Type: List, Optional: true

Sub-resources

Scroll To Top ↑


Bundle

Bundle resources represent an OSGi bundle.

Path

/osgi/bundles/[bundle-id]

Observable

This resource is observable. It deliveres events for the following:

  • CREATED : Arrival of a new bundle
  • UPDATED : Update on bundle state
  • DELETED : Departure of a bundle

Operations

  • READ: Get the current state of the bundle
  • UPDATE “update”: Update initial bundle startlevel, framework startlevel.
    • Parameter (“newState”): Type: String, Optional: true
    • Parameter (“startlevel”): Type: Integer, Optional: true
    • Parameter (“update”): Type: Boolean, Optional: true
    • Parameter (“refresh”): Type: Boolean, Optional: true
    • Parameter (“input”): Type: ByteArrayInputStream, Optional: true
  • DELETE “stop”: Stops the OSGi framework.

Note: CREATE operation on bundles (which basically installs a bundle) is done in Bundles resource.

Metadata

  • bundle-id (long): Bundle id
  • bundle-state (string): Bundle state as string {“ACTIVE”,…}
  • bundle-symbolic-name (string): Bundle Symbolic Name
  • bundle-version (Version): Bundle Version
  • bundle-location (string): Bundle Location
  • bundle-last-modified (long): Bundle Last Modified
  • bundle-fragment (boolean): is this bundle a fragment

Sub-resources

  • /headers: Bundle Headers of this OSGi bundle
  • /capabilities: Bundle Capabilities of this OSGi bundle
  • /requirements: Bundle Requirement of this OSGi bundle
  • /wires: Bundle Wires of this OSGi bundle
  • /services: Services that can be linked to this OSGi bundle

Adaptations

  • org.osgi.framework.Bundle: Bundle object
  • org.ow2.chameleon.everest.osgi.bundle.BundleResource: BundleResource class that is used to represent this bundle

Scroll To Top ↑


Bundle Headers

Bundle headers resources represent header information of a specific OSGi bundle.

Path

/osgi/bundles/[bundle-id]/headers

Observable

This resource is not observable.

Operations

  • READ: Get headers of this OSGi Bundle

Metadata

All the metadata information available on the Bundle

Sub-resources

  • /export-package: Package export headers
  • /import-package: Import package headers
  • /dynamicimport-package: Dynamic import package headers
  • /require-bundle: Require bundle headers

Scroll To Top ↑


Bundle Capability

Bundle Capability resources represent bundle capability of a specific OSGi bundle.

Path

/osgi/bundles/[bundle-id]/capabilities/[unique-capability-id]

Observable

This resource is not observable

Operations

  • READ: Get current state of this bundle capability

Metadata

All capability attributes and directives

Relations

  • /package: Link to the package resource if this capability is a package
  • /export-package: Link to the bundle header if this capability is a package
  • /[unique-wire-id]: Links to the wires connected to this capability

Adaptations

  • org.osgi.wiring.framework.BundleCapability: BundleCapability object
  • org.ow2.chameleon.everest.osgi.bundle.BundleCapabilityResource: BundleCapabilityResource class used to represent this capability

Scroll To Top ↑


Bundle Requirement

Bundle Requirement resources represent bundle requirement of a specific OSGi bundle.

Path

/osgi/bundles/[bundle-id]/requirements/[unique-requirement-id]

Observable

This resource is not observable.

Operations

  • READ: Get current state of the bundle requirement

Metadata

All requirement attributes and directives

Relations

Adaptations

  • org.osgi.wiring.framework.BundleRequirement: BundleRequirement object
  • org.ow2.chameleon.everest.osgi.bundle.BundleRequirementResource: BundleRequirementResource class used to represent this requirement

Scroll To Top ↑


Bundle Wire

Bundle wire resources represent a bundle wire between a capability and a requirement.

Path

/osgi/bundles/[bundle-id]/wires/[unique-wire-id]

Observable

This resource is not observable.

Operations

  • READ: Get current state of bundle wire

Metadata

  • requirement (string): [unique-requirement-id] of linked Bundle Requirement
  • capability (string): [unique-capability-id] of linked Bundle Capability

Relations

Adaptations

  • org.osgi.wiring.framework.BundleWire: BundleWire object

Scroll To Top ↑


Bundle Services

Services that can be linked to an OSGi bundle

Path

/osgi/bundles/[bundle-id]/services

Observable

This resource is not observable.

Operations

  • READ: get current state of the bundle services

Sub-resources

  • /registered: Services registered by this OSGi bundle
  • /uses: Services used by this OSGi bundle

Scroll To Top ↑


Package

Package resource represents a package provided by an OSGi bundle.

Path

/osgi/packages/[unique-capability-id]

Observable:

This resource is observable. It delivers events for the following:

  • CREATED: Package available
  • DELETED: Package unavailable

Operations

  • READ: Get current state of the package

Metadata

  • osgi.wiring.package (string): Package Name
  • version (Version): Package Version
  • bundle-symbolic-name (string): Symbolic name of the provider bundle
  • bundle-version (Version): Version of the provider bundle
  • in-use (boolean): Is this packages is used by anyone?

Relations

Sub-resources

  • /importer-bundles: A collection of relations to OSGi bundles that import this package.

Adaptations

  • org.osgi.wiring.framework.BundleCapability: BundleCapability object
  • org.ow2.chameleon.everest.osgi.package.PackageResource: PackageResource class used to represent this package

Scroll To Top ↑


Service

Service resource represents an OSGi service published in the service registry.

Path

/osgi/services/[service.id]

Observable

This resource is observable. It delivers events for the following:

  • CREATED: Service registered
  • UPDATED: Service modified
  • DELETED: Service unregistered

Operations

  • READ: Get current state of the service

Metadata

All service properties

Sub-resources

Adaptations

  • org.osgi.framework.ServiceReference: ServiceReference object of this service
  • org.ow2.chameleon.everest.osgi.service.ServiceResource: ServiceResource class used to represent this service

Scroll To Top ↑


Configurations

Root of all configurations

Path

/osgi/configurations

Observable

This resource is not observable.

Operations

  • CREATE: Create a new configuration

Sub-resources

Relations

  • (CREATE) “create”: Create a new configuration
    • Parameter (“location”): Type: String, Optional: false
    • Parameter (“pid”): Type: String, Optional: true
    • Parameter (“factoryPid”): Type: String, Optional: true

Scroll To Top ↑


Configuration

Configuration resource represents a Config Admin configuration.

Path

/osgi/configurations/[configuration-pid]

Observable

This resource is observable. It deliveres events for the following:

  • CREATED: A new configuration created.
  • UPDATED: Configuration reconfigured.
  • DELETED: Configuration deleted.

Operations

  • READ: Get current state of the configuration
  • UPDATE “update”: update properties of this configuration
    • Parameter (“properties”): Type: Dictionary, Optional: true
    • Parameter (“location”): Type: String, Optional: true
  • DELETE “delete”: delete this configuration

Note: CREATE operation for configurations (which creates a new configuration) is done in Configurations resource.

Metadata

  • service.pid (string): Configuration pid
  • location (string): Bundle location attributed by this configuration
  • serviceFactory.pid (string): Factory configuration pid
  • All proprties of this configuration

Adaptations

  • org.osgi.service.cm.Configuration: Configuration object
  • org.ow2.chameleon.everest.osgi.config.ConfigurationResource: ConfigurationResource class used to represent this resource

Scroll To Top ↑


Log Entry

Log Entry resource represents a Log Entry of OSGi Log Service.

Path

/osgi/logs/[log-time]

Observable

This resource is not observable.

Operations

  • READ: Get the current state of this log entry

Metadata

  • log level (string): log level as string
  • time (long): log time
  • message (string): message of this log
  • bundle (long): bundle id that sent this log
  • service (long): service id that sent this log
  • exception (StackTraceElement): stack trace of the exception associated by this log

Relations

  • /bundle: Link to the OSGi bundle that sent this log
  • /service: Link to the OSGi service that sent this log

Adaptations

  • org.osgi.service.log.LogEntry: LogEntry object
  • org.ow2.chameleon.everest.osgi.log.LogEntryResource: LogEntryResource class used to represent this resource

Scroll To Top ↑


Deployment Packages

Root of all deployment packages

Path

/osgi/deployments

Observable

This resource is not observable.

Operations

  • CREATE “install”: Install new deployment package
    • Parameter (“input”): Type: InputStream, Optional: false

Sub-resources

Scroll To Top ↑


Deployment Package

Deployment Package resource represents a Deployment Package deployed by the OSGi Deployment Package Admin

Path

/osgi/deployments/[deployment-package-name]

Observable

This resource is not observable.

Operations

  • READ: Get the current state of this deployment package
  • DELETE “uninstall”: Uninstall this deployment package

Note: CREATE opearation for Deployment Packages is done in Deployment Packages resource.

Metadata

  • Name (string): Name of this deployment package
  • DisplayName (string): display name of this deployment package
  • Version (Version): version of this deployment package
  • isStale (boolean): is this deployment package stale?

Sub-resources

  • /bundles : A collection of links to the OSGi bundles deployed with this deployment package

Adaptations

  • org.osgi.service.deploymentadmin.DeploymentPackage: DeploymentPackage object

Scroll To Top ↑


Tutorials

Here you will find some tutorials on how to change some of the resource states on OSGi domain.

Installing a bundle

Changing the state of a bundle

Working with Config Admin

Installing/Uninstalling Deployment Packages

Scroll To Top ↑

Back to top

Version: 1.0-SNAPSHOT. Last Published: 2014-03-23.