use of org.apache.ivy.osgi.updatesite.xml.UpdateSite in project ant-ivy by apache.
the class UpdateSiteLoader method load.
public RepoDescriptor load(URI repoUri) throws IOException, ParseException, SAXException {
if (!repoUri.toString().endsWith("/")) {
try {
repoUri = new URI(repoUri.toString() + "/");
} catch (URISyntaxException e) {
throw new RuntimeException("Cannot make an uri for the repo");
}
}
Message.info("Loading the update site " + repoUri);
// first look for a p2 repository
RepoDescriptor repo = loadP2(repoUri);
if (repo != null) {
return repo;
}
Message.verbose("\tNo P2 artifacts, falling back on the old fashioned updatesite");
// then try the old update site
UpdateSite site = loadSite(repoUri);
if (site == null) {
return null;
}
repo = loadFromDigest(site);
if (repo != null) {
return repo;
}
return loadFromSite(site);
}
use of org.apache.ivy.osgi.updatesite.xml.UpdateSite in project ant-ivy by apache.
the class UpdateSiteLoader method loadSite.
private UpdateSite loadSite(URI repoUri) throws IOException, SAXException {
URI siteUri = normalizeSiteUri(repoUri, null);
URL u = siteUri.resolve("site.xml").toURL();
final URLResource res = new URLResource(u, this.timeoutConstraint);
ArtifactDownloadReport report = repositoryCacheManager.downloadRepositoryResource(res, "site", "updatesite", "xml", options, urlRepository);
if (report.getDownloadStatus() == DownloadStatus.FAILED) {
return null;
}
try (InputStream in = new FileInputStream(report.getLocalFile())) {
UpdateSite site = EclipseUpdateSiteParser.parse(in);
site.setUri(normalizeSiteUri(site.getUri(), siteUri));
return site;
}
}
Aggregations