Skip to content
This repository has been archived by the owner on Nov 19, 2020. It is now read-only.

Latest commit

 

History

History
130 lines (96 loc) · 6.25 KB

chapter-obr.asciidoc

File metadata and controls

130 lines (96 loc) · 6.25 KB

OSGi Bundle Repositories

{inrmonly}

Introduction

{nxrm} supports the OSGi Bundle Repository format. The OSGi Bundle format is defined by the OSGi RFC 112 "Bundle Repository." It is a format for the distribution of OSGi 'bundles' which includes any components that are described by the OSGi standards set forth in RFC 112. An OBR repository has a single XML file that completely describes the contents of the entire repository. {nxrm} can read this OBR repository XML and create proxy repositories that can download OSGi bundles from remote OBR repositories. {nxrm} can also act as a hosting platform for OSGi bundles. You can configure your builds to publish OSGi bundles to {nxrm}, and then expose these bundle repositories to internal or external developers using {nxrm} as a publishing and distribution platform.

{nxrm} can also act as a bridge between Maven repositories and OSGi bundle repositories. When you configure a virtual OBR repository that uses a Maven 2 repository as a source repository, {nxrm} will expose components with the appropriate metadata from the Maven repository as OSGi bundles. In this way, you can unify your OSGi and non-OSGi development efforts and publish components with the appropriate OSGi metadata to {nxrm}. Non-OSGi clients can retrieve software components from a Maven repository, and OSGi-aware clients can retrieve OSGi bundles from a virtual OBR repository.

The following sections detail the procedures for creating and managing OBR repositories.

{pro} has OBR support installed by default. Prior to any usage in {oss} the Nexus OBR Plugin needs to be installed. You can download the -bundle.zip file for your specific version from the Central Repository:

Extract the file into sonatype-work/nexus/plugin-repository and restart the repository manager. Ensure to repeat the step for any upgrades.

Proxy OSGi Bundle Repositories

{nxrm} can proxy an OSGi Bundle Repository using the OBR repository XML as the remote storage location. To create a new proxy OBR repository access the 'Repositories' view from the 'Views/Repositories' submenu and click the 'Add..' button above the list of repositories and choose 'Proxy Repository' from the drop-down of repository types.

In the 'New Proxy Repository' configuration tab, supply a 'Repository ID' and a 'Repository Name' and select 'OBR' as the 'Provider'.

Then enter the URL to the remote repository OBR XML as the 'Remote Storage Location' and click 'Save'.

Creating an OSGi Bundle Proxy Repository provides a sample configuration used to create a proxy of the Apache Felix OBR repository.

obr create proxy
Figure 1. Creating an OSGi Bundle Proxy Repository

To verify that the OBR proxy repository has been properly configured, you can then load the OBR XML from {nxrm}. If {nxrm} is properly configured, you will be able load the obr.xml by navigating to the .meta directory:

$curl http://localhost:8081/nexus/content/repositories/felix-proxy/.meta/obr.xml
<?xml version='1.0' encoding='utf-8'?>
<?xml-stylesheet type='text/xsl' href='http://www2.osgi.org/www/obr2html.xsl'?>
<repository name='Felix OBR Repository' lastmodified='1247493075615'>
    <resource id='org.apache.felix.javax.servlet/1.0.0'
              presentationname='Servlet 2.1 API'
              symbolicname='org.apache.felix.javax.servlet'
    uri='../bundles/org.apache.felix.javax.servlet-1.0.0.jar'
              version='1.0.0'>
        <description>
            Servlet 2.1 API
        </description>
        <documentation>
            http://www.apache.org/
        </documentation>
        <license>
            http://www.apache.org/licenses/LICENSE-2.0.txt
        </license>
        ...

Hosted OSGi Bundle Repositories

{nxrm} can host an OSGi Bundle Repository, providing you with a way to publish your own OBR bundles. To create a hosted OBR repository access the 'Repositories' view from the 'Views/Repositories' submenu and click the 'Add..' button above the list of repositories and choose 'Hosted Repository' from the drop-down of repository types.

In the 'New Hosted Repository' configuration tab, supply a 'Repository ID' and a 'Repository Name' and select 'OBR' as the 'Provider'.

Then enter the URL to the remote repository OBR XML as the 'Remote Storage Location' and click 'Save'.

Creating a Hosted OSGi Bundle Repository provides some sample configuration used to create a hosted OBR repository.

obr create hosted
Figure 2. Creating a Hosted OSGi Bundle Repository

Virtual OSGi Bundle Repositories

{nxrm} can be configured to convert a traditional Maven repository into an OSGi Bundle repository using a virtual OBR repository. To configure a virtual OBR repository, create a new 'Virtual Repository' in the 'Repositories' administration area providing a 'Repository ID' and 'Repository Name' as well as the 'Source Nexus Repository ID' setting the repository you want to expose as OBR. Finally set the 'Provider' to 'OBR' and click 'Save'.

Creating a Virtual OSGi Bundle Repository from a Maven Repository provides a sample configuration used to create a virtual OBR repository that transforms the proxy repository for 'Maven Central' into an OBR repository.

obr create virtual
Figure 3. Creating a Virtual OSGi Bundle Repository from a Maven Repository

Grouping OSGi Bundle Repositories

Just like the repository manager can group Maven repositories, Eclipse update sites, and P2 repositories, it can also be configured to group OSGi Bundle Repositories. To group OSGi bundle repositories, create a new 'Repository Group' and set the 'Provider' to 'OBR' and select the repositories you want to group after providing a 'Group ID' and a 'Group Name'.

Creating a New OSGi Bundle Repository Group shows an example of the a new repository group that contains a hosted OSGi Bundle repository, a virtual OSGi Bundle repository, and a OSGi Bundle proxy repository.

obr create group
Figure 4. Creating a New OSGi Bundle Repository Group