Java Reference
In-Depth Information
One reason the filter D looks somewhat more complicated than necessary is that ver-
sion ranges aren't directly supported by the filter syntax and must be expressed as the
lower and upper bound.
If your bundle had a Require-Bundle , Fragment-Host , or Bundle-Execution-
Environment header, it would be mapped to requirements. Even though the map-
pings are straightforward, it's still nice to have a tool like BIndex doing this for you.
You can even integrate BIndex into in your build cycle so your repository is updated
whenever your bundles change.
The repository XML is all well and good, but you're probably wondering how you
can use repositories in your management agent. You don't need to know anything
about the XML format to use OBR . All you need to do is grab the service implemented
by OBR and use it. Let's take a closer look at this.
BROWSING OBR REPOSITORIES
The best way to familiarize you with how to use repositories is to give an example and
explain what it does along the way. Let's use the shell example again and extend it
with a new command to add/remove/list repositories and browse the bundles inside
them. The programmatic entry point to the OBR specification is the RepositoryAdmin
service, which is represented by the following interface:
public interface RepositoryAdmin {
Resource[] discoverResources(String filterExpr);
Resolver resolver();
Repository addRepository(URL repository) throws Exception;
boolean removeRepository(URL repository);
Repository[] listRepositories();
Resource getResource(String respositoryId);
}
This RepositoryAdmin service provides centralized access to the federated repository.
An OBR implementation implements this interface as well as the other types refer-
enced by it. Figure 10.3 shows the relationships among the involved entities.
The code in the following listing shows the code for the new obr-repo command.
It uses RepositoryAdmin to add, remove, and list repositories as well as to discover
resources.
Resolves with
Repository
client impl
Capability
provider impl
0..n
Uses
1
Repository
Admin
Capability
provider
Resolver
0..n
Implements
Figure 10.3 UML diagram of the Repository-
Admin service. An external repository client uses
the RepositoryAdmin and Resolver inter-
faces to download and install bundles and their
transitive dependencies.
0..n
Resolver
Impl
Repository
AdminImpl
1
Adds capabilities
Search WWH ::




Custom Search