UpdateSiteDescriptor repoDescriptor = new UpdateSiteDescriptor(site.getUri(),
ExecutionEnvironmentProfileProvider.getInstance());
Iterator itFeatures = site.getFeatures().iterator();
while (itFeatures.hasNext()) {
EclipseFeature feature = (EclipseFeature) itFeatures.next();
URL url = site.getUri().resolve(feature.getUrl()).toURL();
URLResource res = new URLResource(url);
ArtifactDownloadReport report = repositoryCacheManager.downloadRepositoryResource(res,
feature.getId(), "feature", "jar", options, urlRepository);
if (report.getDownloadStatus() == DownloadStatus.FAILED) {
return null;
}
InputStream in = new FileInputStream(report.getLocalFile());
try {
ZipInputStream zipped = findEntry(in, "feature.xml");
if (zipped == null) {
return null;
}
EclipseFeature f = FeatureParser.parse(zipped);
f.setURL(feature.getUrl());
repoDescriptor.addFeature(f);
} finally {
in.close();
}
}