-
Notifications
You must be signed in to change notification settings - Fork 0
GridRepository
A node’s repository contains locally stored bundles. In order for other nodes to install and run these bundles, other nodes have to have a way to download them.
To download bundles there has to be a way for other nodes to find out what bundles are available from a particular repository.
And there needs to be some transport mechanism in place.
In the community there has already been a lot of discussion about OSGi Bundle Repositories (OBR). At this point there are a couple of different implementations of what eventually will emerge as the official org.osgi.service.obr
API and specification and an official repository.xml
format.
What seems clear at this point, is that a file called repository.xml
describes what’s in the repository – it describes available resources/bundles including their location, version and dependencies. This file itself is accessible through a URL. And it’s usually generated by a tool called BIndex.
It makes sense to take advantage of one of the existing implementations, as it greatly simplifies dependency resolving, which needs to be done by the GridCarrier. In other words, the Grid Repository should also serve a repository.xml
file. Therefore we copy all bundles that we get a hold of into our own repository directory and let BIndex generate a repository.xml
file for it whenever there is a change. Other bundles like the GridCarrier can use the exposed install
method to install bundles into our local repository.
We are using a BundleListener
on the BundleContext
to fid out what bundles are installed, get their URLs and copy them to our own repository, if we can resolve the URL. Sometimes, that’s not possible (e.g. location = “System Bundle”).
As transport protocol HTTP makes sense, since running a simple HTTP server is very well supported in OSGi R4 and its implementation is almost trivial.
Therefore the Grid Repository serves bundles using HTTP and can be described by a simple URL, which points to its repository.xml
file. This URL needs to be published to the GridRegistry.
Note, that the port for the built-in HTTP server is specified through the system property org.osgi.service.http.port
.
The IP address for the URL that is registered with the Registry defaults to the local address (not localhost), but can also be set manually through org.bundlebee.repository.localaddress
.