我有2个OSGi Bundle存储库。我想使用API来检查捆绑包是否存在任何依赖性问题,前提是2 obr。如何调用api来做到这一点? 似乎我可以使用以下代码与Felix API来做到这一点。但是如何获取RepositoryAdmin对象?
RepositoryAdmin repoAdmin = ...
repoAdmin.addRepository(new File("/home/chandler/ws/reliability/testParent/test.eba/target/localobr/repository.xml").toURI().toURL());
repoAdmin.addRepository(new File("/home/chandler/geronimo3/var/obr.xml").toURI().toURL());
List<Repository> repos = new ArrayList<Repository>();
for(Repository repo : repoAdmin.listRepositories()) {
repos.add(repo);
}
repos.add(repoAdmin.getSystemRepository());
repos.add(getLocalRepository(repoAdmin));
Resolver resolver = repoAdmin.resolver(repos.toArray(new Repository[0]));
Resource resources[] = repoAdmin.discoverResources("(&(presentationname=*)(symbolicname=com.chandler.app.osgi.test))");
resolver.add(resources[0]);
boolean resolved = resolver.resolve();
答案 0 :(得分:0)
org.apache.felix.bundlerepository-x.y.z.jar。您可以从BundleContext实例获取RepositoryAdmin服务。