Hi Nicolas,
two minor fixes:
org.apache.ivy.osgi.p2.P2MetadataParser.UnitHandler.handleAttributes(Attributes):
boolean singleton = Boolean.getBoolean(atts.getValue(SINGLETON));
--> changed to
boolean singleton = Boolean.parseBoolean(atts.getValue(SINGLETON));
Despite that this information is not used, calling Boolean.getBoolean seems to
be wrong.
in org.apache.ivy.osgi.updatesite.UpdateSiteResolver.init()
loader.load(u);
--> changed to:
RepoDescriptor repoDescriptor = loader.load(u);
setRepoDescriptor(repoDescriptor);
otherwise, repoDescriptor gets never initialized.
However, I couldn't make downloading and installing work due to other problems.
I tried to follow your advice to iterate over all organisations and from there
over all modules. This is the resulting code:
String resolverName = url.toExternalForm();
UpdateSiteResolver resolver = new UpdateSiteResolver();
resolver.setName(resolverName);
resolver.setUrl(url.toExternalForm());
for (final OrganisationEntry organisation : resolver.listOrganisations()) {
for (final ModuleEntry entry : resolver.listModules(organisation)) {
System.out.println(entry);
}
}
resolver.listOganizations returns an empty list (which is not that amazing
since there is no organization attribute).
thus, I tried to use the RepoDescriptor directly :
RepoDescriptor repo = opt.get();
for (final ModuleDescriptor module : (Set<ModuleDescriptor>)
repo.getModules()) {
ModuleRevisionId moduleRevisionId =
module.getModuleRevisionId();
ivy.install(moduleRevisionId, resolverName, "local-disk", new InstallOptions()
setTransitive(true).setValidate(true).setOverwrite(true));
}
}
This approach fails because Ivy cannot download the Artifacts because there is
no URL associated with the artifact.
Any ideas?
Thanks,
Marcel