Hello all,
I'm a newbie using Felix and I'm wondering how to use the OBR (
http://felix.apache.org/site/apache-felix-osgi-bundle-repository-obr.html).
In the application I'm working on, I want to be able to add my own
repositories. So far I've registered the Apache Felix Bundle Repository as a
bundle, but I don't know how to use it. The following code (from the Felix
OBR site) does exactly what I want:
> RepositoryAdmin repoAdmin = ... // Get repo admin service
> Resolver resolver = repoAdmin.resolver();
> Resource resource = repoAdmin.discoverResources(filterStr);
> resolver.add(resource);
> if (resolver.resolve())
> {
> resolver.deploy(true);
> }
> else
> {
> Requirement[] reqs = resolver.getUnsatisfiedRequirements();
> for (int i = 0; i < reqs.length; i++)
> {
> System.out.println("Unable to resolve: " + reqs[i]);
> }
> }
The only problem is how to get the repo admin service? The only coding stuff
I've done with Felix are the tutorials. I read a lot of doc, but I'm
struggling with the coding. The only thing I've done so far
is installing/activating the Apache Felix Bundle Repository bundle. That's
pretty much it. I want to use the repo admin service in another bundle. Do I
need to import the packages in that bundle? When I do it, I get conflicts
saying some classes are loaded twice. For example, if I use the class
Repository, it says the classloader already loaded the same class
already (The Apache Felix Bundle Repository is installed as a bundle, and I
also inculded the .jar file in the classpath. Maybe that could be the
problem? But if I don't add it to the classpath, how to I access the
classes?)
As you can see I got some basic problems with it. I would really appreciate
if you could help me. Also if you have some interesting sites/doc about
Felix OBR, send them out please.
Thank you very much!
Sincerely,
Mathieu