LibraryLink ToToggle FramesPrintFeedback

OBR Repository Files

A repository defines a set of available resources described by a set of metadata. Bundles explicitly declare their requirements in the metadata in their manifest files (see OSGi Bundle Manifest Files). An OBR repository file is an XML-based representation of bundle metadata. A repository file can be referenced by a URL and can be a static file or generated by a server. The goal is to provide a generic model for describing dependencies among resources. (The term, resource, is used instead of bundle in the OBR repository syntax.)

[Note]Note

You can use Peter Kriens' BIndix tool to generate metadata from a bundle's manifest.

OBR reads a metadata file containing an XML encoding of the bundles' manifest information and uses the metadata to construct dependency information for deploying (installing and updating) bundles.

OSGi RFC 112 provides a detailed description of the OBR metadata format.

The following XML snippet depicts the overall structure of a repository file:

<repository presentationname="..." symbolicname="..." ... >
   <resource>
       <description>...</description>
       <size>...</size>
       <documentation>...</documentation>
       <source>...</source>
       <category id="..."/>
       <capability>...</capability>
       ...
       <requirement>...</requirement>
       ...
   </resource>
   ...
</repository>

An OSGi repository defines a set of available resources (bundles) described by a set of metadata.

A resource provides capabilities and requires capabilities of other resources or the environment. Each resource describes a general resource with properties, categories, requirements, extends, and capabilities. Some resource metadata is for human consumption only.

Each resource description has a list of:

A resource's attributes include the name of the bundle (its Bundle-SymbolicName) and version (its Bundle-Version), the standard OSGi bundle manifest attributes that OBR uses to uniquely identify a bundle. For example, to update a locally installed bundle, OBR uses its symbolic name and version to search the repository metadata for a matching symbolic name. If the matching symbolic name is found, OBR checks to see if there is a newer version than the local copy using the bundle version number. Thus, the symbolic name plus the bundle version form a unique key to match locally installed bundles to remotely available bundles.

The category element facilitates discovery. Multiple categories can be specified. A category's attribute is its ID.

A resource can provide many capabilities. A capability is a named set of typed properties. Capabilities are the properties or characteristics of the bundle or environment. A capability is used to resolve a requirement if the resource is included. A capability has the name attribute and only requirements with the same name can match the capability.

For example, the following is an exported package capability:

<capability name='package'>
   <p n='package' v='org.foo.bar'/>
   <p n='version' t='version' v='1.0.0'/>
</capability> 

This capability is of the package type and exports org.foo.bar at version 1.0.0.

A requirement is a typed LDAP query over a set of capability properties. The syntax is standard OSGi LDAP query syntax in XML form. For example, the following is an imported package requirement:

<require name='package' extend='false'
  multiple='false' optional='false'
  filter='(&(package=org.foo.bar)(version>=1.0.0))'>
  Import package org.foo.bar
</require>

This requirement is of the package type and imports org.foo.bar at versions greater than 1.0.0.

Generally, bundle requirements are resolved by capabilities provided by other bundles, the environment, or other resources. Requirements function as a selection constraint on capabilities. Requirements include Import Package, Require bundle, Fragment Host, and Execution environment. When a bundle is installed, all of its requirements must be met. If its requirements cannot be resolved, the bundle fails to install.

A referral points to another repository file. This creates a federation of repositories that can be accessed by a single repository. A referral's attributes include the depth of referrals the repository acknowledges and the URL to the referred repository.

A resource can act as an extension to another resource. An extends relationship allows a provider to extend another bundle. A bundle requirement is a relationship that the bundle knows about in advance, as opposed to an extension, which the bundle might not know about in advance.

OBR provides mappings from the OSGi bundle manifest sections to the requirement, extend, and capability model, including:

In addition, OBR provides custom mappings for arbitrary capabilities and requirements. For details, see the OSGi Bundle Repository (OBR) RFC-0112 proposed specification.