use of org.apache.ivy.core.report.ArtifactDownloadReport 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;
}
use of org.apache.ivy.core.report.ArtifactDownloadReport in project ant-ivy by apache.
the class ChainResolver method download.
@Override
public ArtifactDownloadReport download(ArtifactOrigin artifact, DownloadOptions options) {
for (DependencyResolver resolver : chain) {
ArtifactDownloadReport adr = resolver.download(artifact, options);
if (adr.getDownloadStatus() != DownloadStatus.FAILED) {
return adr;
}
}
ArtifactDownloadReport adr = new ArtifactDownloadReport(artifact.getArtifact());
adr.setDownloadStatus(DownloadStatus.FAILED);
return adr;
}
use of org.apache.ivy.core.report.ArtifactDownloadReport in project ant-ivy by apache.
the class AbstractResolver method locate.
/**
* Default implementation actually download the artifact Subclasses should overwrite this to
* avoid the download
*
* @param artifact ArtifactOrigin
* @return ArtifactOrigin
*/
public ArtifactOrigin locate(Artifact artifact) {
DownloadReport dr = download(new Artifact[] { artifact }, new DownloadOptions());
if (dr == null) {
/*
* according to IVY-831, it seems that this actually happen sometime, while the
* contract of DependencyResolver says that it should never return null
*/
throw new IllegalStateException("null download report returned by " + getName() + " (" + getClass().getName() + ")" + " when trying to download " + artifact);
}
ArtifactDownloadReport adr = dr.getArtifactReport(artifact);
return adr.getDownloadStatus() == DownloadStatus.FAILED ? null : adr.getArtifactOrigin();
}
use of org.apache.ivy.core.report.ArtifactDownloadReport in project ant-ivy by apache.
the class XmlReportWriter method outputArtifacts.
private void outputArtifacts(ConfigurationResolveReport report, PrintWriter out, IvyNode dep) {
out.println("\t\t\t\t<artifacts>");
for (ArtifactDownloadReport adr : report.getDownloadReports(dep.getResolvedId())) {
out.print("\t\t\t\t\t<artifact name=\"" + XMLHelper.escape(adr.getName()) + "\" type=\"" + XMLHelper.escape(adr.getType()) + "\" ext=\"" + XMLHelper.escape(adr.getExt()) + "\"");
out.print(extraToString(adr.getArtifact().getExtraAttributes(), SEPARATOR));
out.print(" status=\"" + XMLHelper.escape(adr.getDownloadStatus().toString()) + "\"");
out.print(" details=\"" + XMLHelper.escape(adr.getDownloadDetails()) + "\"");
out.print(" size=\"" + adr.getSize() + "\"");
out.print(" time=\"" + adr.getDownloadTimeMillis() + "\"");
if (adr.getLocalFile() != null) {
out.print(" location=\"" + XMLHelper.escape(adr.getLocalFile().getAbsolutePath()) + "\"");
}
if (adr.getUnpackedLocalFile() != null) {
out.print(" unpackedFile=\"" + XMLHelper.escape(adr.getUnpackedLocalFile().getAbsolutePath()) + "\"");
}
ArtifactOrigin origin = adr.getArtifactOrigin();
if (origin != null) {
out.println(">");
out.println("\t\t\t\t\t\t<origin-location is-local=\"" + String.valueOf(origin.isLocal()) + "\"" + " location=\"" + XMLHelper.escape(origin.getLocation()) + "\"/>");
out.println("\t\t\t\t\t</artifact>");
} else {
out.println("/>");
}
}
out.println("\t\t\t\t</artifacts>");
}
Aggregations