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


Java ArtifactDownloadReport.getArtifactOrigin方法代码示例

本文整理汇总了Java中org.apache.ivy.core.report.ArtifactDownloadReport.getArtifactOrigin方法的典型用法代码示例。如果您正苦于以下问题:Java ArtifactDownloadReport.getArtifactOrigin方法的具体用法?Java ArtifactDownloadReport.getArtifactOrigin怎么用?Java ArtifactDownloadReport.getArtifactOrigin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.ivy.core.report.ArtifactDownloadReport的用法示例。


在下文中一共展示了ArtifactDownloadReport.getArtifactOrigin方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeOriginLocationIfPresent

import org.apache.ivy.core.report.ArtifactDownloadReport; //导入方法依赖的package包/类
private void writeOriginLocationIfPresent(RepositoryCacheManager cache,
        TransformerHandler saxHandler, ArtifactDownloadReport artifact) throws SAXException {
    ArtifactOrigin origin = artifact.getArtifactOrigin();
    if (!ArtifactOrigin.isUnknown(origin)) {
        String originName = origin.getLocation();
        boolean isOriginLocal = origin.isLocal();

        String originLocation;
        AttributesImpl originLocationAttrs = new AttributesImpl();
        if (isOriginLocal) {
            originLocationAttrs.addAttribute(null, "is-local", "is-local", "CDATA", "true");
            originLocation = originName.replace('\\', '/');
        } else {
            originLocationAttrs.addAttribute(null, "is-local", "is-local", "CDATA", "false");
            originLocation = originName;
        }
        saxHandler
                .startElement(null, "origin-location", "origin-location", originLocationAttrs);
        char[] originLocationAsChars = originLocation.toCharArray();
        saxHandler.characters(originLocationAsChars, 0, originLocationAsChars.length);
        saxHandler.endElement(null, "origin-location", "origin-location");
    }
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:24,代码来源:IvyArtifactReport.java

示例2: EndArtifactDownloadEvent

import org.apache.ivy.core.report.ArtifactDownloadReport; //导入方法依赖的package包/类
public EndArtifactDownloadEvent(DependencyResolver resolver, Artifact artifact,
        ArtifactDownloadReport report, File dest) {
    super(NAME, artifact);
    this.resolver = resolver;
    this.report = report;
    addAttribute("resolver", this.resolver.getName());
    addAttribute("status", this.report.getDownloadStatus().toString());
    addAttribute("details", this.report.getDownloadDetails());
    addAttribute("size", String.valueOf(this.report.getSize()));
    addAttribute("file", dest.getAbsolutePath());
    addAttribute("duration", String.valueOf(this.report.getDownloadTimeMillis()));
    ArtifactOrigin origin = report.getArtifactOrigin();
    if (!ArtifactOrigin.isUnknown(origin)) {
        addAttribute("origin", origin.getLocation());
        addAttribute("local", String.valueOf(origin.isLocal()));
    } else {
        addAttribute("origin", "");
        addAttribute("local", "");
    }
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:21,代码来源:EndArtifactDownloadEvent.java

示例3: outputArtifacts

import org.apache.ivy.core.report.ArtifactDownloadReport; //导入方法依赖的package包/类
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>");
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:34,代码来源:XmlReportWriter.java

示例4: locate

import org.apache.ivy.core.report.ArtifactDownloadReport; //导入方法依赖的package包/类
/**
 * 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();
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:21,代码来源:AbstractResolver.java

示例5: outputArtifacts

import org.apache.ivy.core.report.ArtifactDownloadReport; //导入方法依赖的package包/类
private void outputArtifacts(ConfigurationResolveReport report, PrintWriter out, IvyNode dep) {
    Map<?, ?> extraAttributes;
    ArtifactDownloadReport[] adr = report.getDownloadReports(dep.getResolvedId());
    out.println("\t\t\t\t<artifacts>");
    for (ArtifactDownloadReport anAdr : adr) {
        out.print("\t\t\t\t\t<artifact name=\"" + XMLHelper.escape(anAdr.getName()) + "\" type=\""
                + XMLHelper.escape(anAdr.getType()) + "\" ext=\"" + XMLHelper.escape(anAdr.getExt()) + "\"");
        extraAttributes = anAdr.getArtifact().getExtraAttributes();
        for (Entry<?, ?> entry : extraAttributes.entrySet()) {
            out.print(" extra-" + entry.getKey() + "=\"" + XMLHelper.escape(entry.getValue().toString()) + "\"");
        }
        out.print(" status=\"" + XMLHelper.escape(anAdr.getDownloadStatus().toString()) + "\"");
        out.print(" details=\"" + XMLHelper.escape(anAdr.getDownloadDetails()) + "\"");
        out.print(" size=\"" + anAdr.getSize() + "\"");
        out.print(" time=\"" + anAdr.getDownloadTimeMillis() + "\"");
        if (anAdr.getLocalFile() != null) {
            out.print(" location=\"" + XMLHelper.escape(anAdr.getLocalFile().getAbsolutePath()) + "\"");
        }

        ArtifactOrigin origin = anAdr.getArtifactOrigin();
        if (origin != null) {
            out.println(">");
            out.println("\t\t\t\t\t\t<origin-location is-local=\"" + 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>");
}
 
开发者ID:apache,项目名称:ant-easyant-core,代码行数:32,代码来源:XMLEasyAntReportWriter.java


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