本文整理汇总了Java中org.apache.ivy.core.report.ArtifactDownloadReport.setSize方法的典型用法代码示例。如果您正苦于以下问题:Java ArtifactDownloadReport.setSize方法的具体用法?Java ArtifactDownloadReport.setSize怎么用?Java ArtifactDownloadReport.setSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ivy.core.report.ArtifactDownloadReport
的用法示例。
在下文中一共展示了ArtifactDownloadReport.setSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: download
import org.apache.ivy.core.report.ArtifactDownloadReport; //导入方法依赖的package包/类
public DownloadReport download(Artifact[] artifacts, DownloadOptions options) {
// Not much to do here - downloads are not required for workspace projects.
DownloadReport dr = new DownloadReport();
for (Artifact artifact : artifacts) {
ArtifactDownloadReport adr = new ArtifactDownloadReport(artifact);
dr.addArtifactReport(adr);
URL url = artifact.getUrl();
if (url == null || !url.getProtocol().equals("file")) {
// this is not an artifact managed by this resolver
adr.setDownloadStatus(DownloadStatus.FAILED);
return dr;
}
File f;
try {
f = new File(url.toURI());
} catch (URISyntaxException e) {
f = new File(url.getPath());
}
adr.setLocalFile(f);
adr.setDownloadStatus(DownloadStatus.NO);
adr.setSize(0);
Message.verbose("\t[IN WORKSPACE] " + artifact);
}
return dr;
}
示例2: download
import org.apache.ivy.core.report.ArtifactDownloadReport; //导入方法依赖的package包/类
@Override
public DownloadReport download(Artifact[] artifacts, DownloadOptions options) {
ensureConfigured();
clearArtifactAttempts();
DownloadReport dr = new DownloadReport();
for (Artifact artifact : artifacts) {
final ArtifactDownloadReport adr = new ArtifactDownloadReport(artifact);
dr.addArtifactReport(adr);
ResolvedResource artifactRef = getArtifactRef(artifact, null);
if (artifactRef != null) {
Message.verbose("\t[NOT REQUIRED] " + artifact);
ArtifactOrigin origin = new ArtifactOrigin(artifact, true, artifactRef
.getResource().getName());
File archiveFile = ((FileResource) artifactRef.getResource()).getFile();
adr.setDownloadStatus(DownloadStatus.NO);
adr.setSize(archiveFile.length());
adr.setArtifactOrigin(origin);
adr.setLocalFile(archiveFile);
} else {
adr.setDownloadStatus(DownloadStatus.FAILED);
}
}
return dr;
}
示例3: download
import org.apache.ivy.core.report.ArtifactDownloadReport; //导入方法依赖的package包/类
public DownloadReport download(Artifact[] artifacts, DownloadOptions options) {
IvyContext context = IvyContext.getContext();
Map<Artifact, Artifact> workspaceArtifacts = context.get(IVYDE_WORKSPACE_ARTIFACTS);
Map<Artifact, ArtifactDownloadReport> workspaceReports = null;
if (workspaceArtifacts != null) {
workspaceReports = new HashMap<>();
context.set(IVYDE_WORKSPACE_ARTIFACT_REPORTS, workspaceReports);
}
// Not much to do here - downloads are not required for workspace projects.
DownloadReport dr = new DownloadReport();
for (Artifact artifact : artifacts) {
ArtifactDownloadReport adr = new ArtifactDownloadReport(artifact);
dr.addArtifactReport(adr);
// Only report java projects as downloaded
if (artifact.getType().equals(ECLIPSE_PROJECT_TYPE)) {
adr.setDownloadStatus(DownloadStatus.NO);
adr.setSize(0);
Message.verbose("\t[IN WORKSPACE] " + artifact);
} else if (workspaceArtifacts != null && workspaceArtifacts.containsKey(artifact)) {
adr.setDownloadStatus(DownloadStatus.NO);
adr.setSize(0);
// there is some 'forced' artifact by the dependency descriptor
Artifact eclipseArtifact = workspaceArtifacts.get(artifact);
ArtifactDownloadReport eclipseAdr = new ArtifactDownloadReport(eclipseArtifact);
eclipseAdr.setDownloadStatus(DownloadStatus.NO);
eclipseAdr.setSize(0);
workspaceReports.put(artifact, eclipseAdr);
Message.verbose("\t[IN WORKSPACE] " + eclipseArtifact);
} else {
adr.setDownloadStatus(DownloadStatus.FAILED);
Message.verbose("\t[Eclipse Workspace resolver] "
+ "cannot download non-project artifact: " + artifact);
}
}
return dr;
}