use of org.apache.ivy.core.cache.RepositoryCacheManager in project ant-ivy by apache.
the class IvyArtifactReport method generateXml.
private void generateXml(IvyNode[] dependencies, Map<ModuleRevisionId, Set<ArtifactDownloadReport>> moduleRevToArtifactsMap, Map<ArtifactDownloadReport, Set<String>> artifactsToCopy) {
try {
try (FileOutputStream fileOutputStream = new FileOutputStream(tofile)) {
TransformerHandler saxHandler = createTransformerHandler(fileOutputStream);
saxHandler.startDocument();
saxHandler.startElement(null, "modules", "modules", new AttributesImpl());
for (IvyNode dependency : dependencies) {
if (dependency.getModuleRevision() == null || dependency.isCompletelyEvicted()) {
continue;
}
startModule(saxHandler, dependency);
Set<ArtifactDownloadReport> artifactsOfModuleRev = moduleRevToArtifactsMap.get(dependency.getModuleRevision().getId());
if (artifactsOfModuleRev != null) {
for (ArtifactDownloadReport artifact : artifactsOfModuleRev) {
RepositoryCacheManager cache = dependency.getModuleRevision().getArtifactResolver().getRepositoryCacheManager();
startArtifact(saxHandler, artifact.getArtifact());
writeOriginLocationIfPresent(cache, saxHandler, artifact);
writeCacheLocationIfPresent(cache, saxHandler, artifact);
for (String artifactDestPath : artifactsToCopy.get(artifact)) {
writeRetrieveLocation(saxHandler, artifactDestPath);
}
saxHandler.endElement(null, "artifact", "artifact");
}
}
saxHandler.endElement(null, "module", "module");
}
saxHandler.endElement(null, "modules", "modules");
saxHandler.endDocument();
}
} catch (SAXException | IOException | TransformerConfigurationException e) {
throw new BuildException("impossible to generate report", e);
}
}
use of org.apache.ivy.core.cache.RepositoryCacheManager in project ant-ivy by apache.
the class BasicResolver method download.
public DownloadReport download(Artifact[] artifacts, DownloadOptions options) {
RepositoryCacheManager cacheManager = getRepositoryCacheManager();
clearArtifactAttempts();
DownloadReport dr = new DownloadReport();
for (Artifact artifact : artifacts) {
ArtifactDownloadReport adr = cacheManager.download(artifact, artifactResourceResolver, downloader, getCacheDownloadOptions(options));
if (DownloadStatus.FAILED == adr.getDownloadStatus()) {
if (!ArtifactDownloadReport.MISSING_ARTIFACT.equals(adr.getDownloadDetails())) {
Message.warn("\t" + adr);
}
} else if (DownloadStatus.NO == adr.getDownloadStatus()) {
Message.verbose("\t" + adr);
} else if (LogOptions.LOG_QUIET.equals(options.getLog())) {
Message.verbose("\t" + adr);
} else {
Message.info("\t" + adr);
}
dr.addArtifactReport(adr);
checkInterrupted();
}
return dr;
}
Aggregations