当前位置: 首页>>代码示例>>Java>>正文


Java ArtifactDownloadReport.setSize方法代码示例

本文整理汇总了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;
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:26,代码来源:AntWorkspaceResolver.java

示例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;
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:25,代码来源:CacheResolver.java

示例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;
}
 
开发者ID:apache,项目名称:ant-ivyde,代码行数:38,代码来源:WorkspaceResolver.java


注:本文中的org.apache.ivy.core.report.ArtifactDownloadReport.setSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。