You main sample didn't through the mailing list, but I wrote some tests as part
of Ivy get it working.
> 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.
nice catch. fixed.
> 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.
I did fix that too while making the tests I just wrote pass.
> 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).
I fixed that too.
It will now always return an organization with an name as an empty String.
> 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?
yeah, there was a lot of mess about figuring out the location of the artifacts.
The current trunk will behave more nicely.
Nicolas