Apache Felix OSGi Bundle Repository (OBR)
Motivation
The goal of the Apache Felix OSGi Bundle Repository (OBR) is two-fold:
...
Note: OBR provides access to the Felix' default bundle repository, but you can also use it to deploy your own bundles by creating a bundle repository meta-data file for your local bundles; see the obr list-url
, obr add-url
, and obr remove-url
commands for more details.
Overview
For the most part, OBR is quite simple. An OBR "repository server" is not necessary, since all functionality may reside on the client side. OBR is able to provide its functionality by reading an XML-based meta-data file that describes the bundles available to it. The meta-data file essentially contains an XML encoding of the bundles' manifest information. From the meta-data, OBR is able to construct dependency information for deploying (i.e., installing and updating) bundles.
...
Anchor |
---|
| repository-file |
---|
| repository-file |
---|
|
OBR Repository File
The OBR repository file is an XML-based representation of bundle meta-data. The goal is provide a generic model for describing dependencies among resources; as such, the term resource is used instead of bundle in the OBR repository syntax; a detailed description of the OBR meta-data format is available in the OSGi RFC 112 document; this document is not completely in sync with the implementation, but the concepts are still correct. The following XML snippet depicts the overall structure of a repository file:
...
OBR Service API
Typically, OBR service clients only need to interact with the Repository Admin service, which provides the mechanisms necessary to discover available resources. The Repository Admin interface is defined as follows:
...
Anchor |
---|
| shell-command |
---|
| shell-command |
---|
|
OBR Shell Command
Besides providing a service API, OBR implements a Felix shell command for accessing its functionality. For the end user, the OBR shell command is accessed using the text-based or GUI-based user interfaces for Felix' shell service. This section describes the syntax for the OBR shell command.
obr help
Syntax:
No Format |
---|
obr help [add-url | remove-url | list-url | list | info | deploy | start | source | javadoc]
|
...
obr list-url
Syntax:
...
obr add-url
Syntax:
No Format |
---|
obr add-url [<repository-file-url> ...]
|
...
Anchor |
---|
| obr-remove-url |
---|
| obr-remove-url |
---|
|
obr remove-url
Syntax:
No Format |
---|
obr remove-url [<repository-file-url> ...]
|
This command removes a repository file to the set of repository files for which the Repository Admin service provides access. The repository file is represented as a URL.
obr list
Syntax:
No Format |
---|
obr list [<string> ...]
|
This command lists bundles available in the bundle repository. If no arguments are specified, then all available bundles are listed, otherwise any arguments are concatenated with spaces and used as a substring filter on the bundle names.
obr info
Syntax:
No Format |
---|
obr info <bundle-name>[;<version>] ...
|
...
obr deploy
Syntax:
No Format |
---|
obr deploy <bundle-name>[;<version>] ... | <bundle-id> ...
|
...
For the above example, if version "1.0.0" of "Bundle Repository" is already installed locally, then the command will attempt to update it and all of its dependencies; otherwise, the command will install it and all of its dependencies.
obr start
Syntax:
No Format |
---|
obr start [-nodeps] <bundle-name>[;<version>] ...
|
...
obr source
Syntax:
No Format |
---|
obr source [-x] <local-dir> <bundle-name>[;<version>] ...
|
...
The above example retrieves the source archive of version "1.0.0" of the bundle named "Bundle Repository" and saves it to the specified local directory.
obr javadoc
Syntax:
No Format |
---|
obr javadoc [-x] <local-dir> <bundle-name>[;<version>] ...
|
...
The above example retrieves the javadoc archive of version "1.0.0" of the bundle named "Bundle Repository" and saves it to the specified local directory.
Using OBR with a Proxy
If you use a proxy for Web access, then OBR will not work for you in its default configuration; certain system properties must be set to enable OBR to work with a proxy. These properties are:
...
Anchor |
---|
| source-packaging |
---|
| source-packaging |
---|
|
Bundle Source Packaging
Coming soon...
Note on OSGi R3 Bundles
In contrast to OSGi R4 the previous specifications, most notably R3, allowed bundles without the Bundle-SymbolicName
header. The Felix OSGi Bundle Repository implementation heavily relies on the symbolic name being defined in bundles. As a consequence bundles without a symbolic name are not fully supported by the Bundle Repository:
- Bundles installed in the framework are used by the Bundle Repository implementation to resolve dependencies regardless of whether they have a
Bundle-SymbolicName
header or not. Resolution of dependencies against the installed bundles takes place based on the Export-Package
headers. - Bundles installed in the framework without a
Bundle-SymbolicName
header cannot be updated by the Bundle Repository implementation because updates from the bundle repository cannot be correlated to such "anonymous" bundles.
Feedback
Subscribe to the Felix users mailing list by sending a message to users-subscribe@felix.apache.org; after subscribing, email questions or feedback to users@felix.apache.org.