// prepare the repository resolver
DummyBundleContext bc = new DummyBundleContext(this.ctx.getBundleContext());
bc.setProperty(RepositoryAdminImpl.REPOSITORY_URL_PROP,
repoFile.toURI().toURL().toExternalForm());
RepositoryAdmin ra = new RepositoryAdminImpl(bc);
Set resources = new HashSet();
// add the servlet container bundles first
for (int i = 0; i < REQUIRED_BUNDLES.length; i++) {
String filter = "(symbolicName=" + REQUIRED_BUNDLES[i]
+ ")";
this.resolveResource(ra, filter, resources);
}
// find all resources in the repository
for (int i=0; i < bundleNames.length; i++) {
Resource res = this.repository.getResource(bundleNames[i]);
if (res != null) {
VersionRange vr = new VersionRange(res.getVersion());
String filter = "(&(symbolicName=" + res.getSymbolicName()
+ ")" + vr.getFilter() + ")";
this.resolveResource(ra, filter, resources);
}
}
// prepare the resolver
Resolver resolver = ra.resolver();
for (Iterator ri=resources.iterator(); ri.hasNext(); ) {
resolver.add((org.osgi.service.obr.Resource) ri.next());
}
// resolve the resources