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


Java ArtifactDownloadReport类代码示例

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


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

示例1: performTest

import org.apache.ivy.core.report.ArtifactDownloadReport; //导入依赖的package包/类
private void performTest( String module )
    throws Exception
{
    replay( resolver, deployer, visitor );

    ResolveReport report = ivy.resolve( getResource( module + ".ivy" ).toFile() );

    for ( ArtifactDownloadReport artifactReport : report.getAllArtifactsReports() )
    {
        Artifact artifact = IvyResolver.ivy2aether( artifactReport.getArtifact() );
        Path artifactPath = artifactReport.getLocalFile().toPath().toAbsolutePath();
        artifact = artifact.setPath( artifactPath );
        visitor.visitArtifact( artifact );
    }

    verify( resolver, deployer, visitor );
}
 
开发者ID:fedora-java,项目名称:xmvn,代码行数:18,代码来源:Bug1127804Test.java

示例2: resolveArtifact

import org.apache.ivy.core.report.ArtifactDownloadReport; //导入依赖的package包/类
public void resolveArtifact(ComponentArtifactMetaData artifact, ModuleSource moduleSource, BuildableArtifactResolveResult result) {
    Artifact ivyArtifact = ((ModuleVersionArtifactMetaData) artifact).toIvyArtifact();
    ArtifactDownloadReport artifactDownloadReport = resolver.download(new Artifact[]{ivyArtifact}, downloadOptions).getArtifactReport(ivyArtifact);
    if (downloadFailed(artifactDownloadReport)) {
        if (artifactDownloadReport instanceof EnhancedArtifactDownloadReport) {
            EnhancedArtifactDownloadReport enhancedReport = (EnhancedArtifactDownloadReport) artifactDownloadReport;
            result.failed(new ArtifactResolveException(artifact.getId(), enhancedReport.getFailure()));
        } else {
            result.failed(new ArtifactResolveException(artifact.getId(), artifactDownloadReport.getDownloadDetails()));
        }
        return;
    }

    File localFile = artifactDownloadReport.getLocalFile();
    if (localFile != null) {
        result.resolved(localFile);
    } else {
        result.notFound(artifact.getId());
    }
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:21,代码来源:IvyDependencyResolverAdapter.java

示例3: 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

示例4: doExecute

import org.apache.ivy.core.report.ArtifactDownloadReport; //导入依赖的package包/类
public void doExecute() throws BuildException {
    prepareAndCheck();
    if (pathid == null) {
        if (id == null) {
            throw new BuildException("pathid is required in ivy classpath");
        }
        pathid = id;
        log("ID IS DEPRECATED, PLEASE USE PATHID INSTEAD", Project.MSG_WARN);
    }
    try {
        Path path = new Path(getProject());
        getProject().addReference(pathid, path);
        for (ArtifactDownloadReport adr : getArtifactReports()) {
            File f = adr.getLocalFile();
            if (adr.getUnpackedLocalFile() != null) {
                f = adr.getUnpackedLocalFile();
            }
            addToPath(path, f);
        }
    } catch (Exception ex) {
        throw new BuildException("impossible to build ivy path: " + ex, ex);
    }

}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:25,代码来源:IvyCachePath.java

示例5: 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

示例6: loadSite

import org.apache.ivy.core.report.ArtifactDownloadReport; //导入依赖的package包/类
private UpdateSite loadSite(URI repoUri) throws IOException, SAXException {
    URI siteUri = normalizeSiteUri(repoUri, null);
    URL u = siteUri.resolve("site.xml").toURL();

    final URLResource res = new URLResource(u, this.timeoutConstraint);
    ArtifactDownloadReport report = repositoryCacheManager.downloadRepositoryResource(res,
        "site", "updatesite", "xml", options, urlRepository);
    if (report.getDownloadStatus() == DownloadStatus.FAILED) {
        return null;
    }
    try (InputStream in = new FileInputStream(report.getLocalFile())) {
        UpdateSite site = EclipseUpdateSiteParser.parse(in);
        site.setUri(normalizeSiteUri(site.getUri(), siteUri));
        return site;
    }
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:17,代码来源:UpdateSiteLoader.java

示例7: loadFromDigest

import org.apache.ivy.core.report.ArtifactDownloadReport; //导入依赖的package包/类
private UpdateSiteDescriptor loadFromDigest(UpdateSite site) throws IOException,
        SAXException {
    URI digestBaseUri = site.getDigestUri();
    if (digestBaseUri == null) {
        digestBaseUri = site.getUri();
    } else if (!digestBaseUri.isAbsolute()) {
        digestBaseUri = site.getUri().resolve(digestBaseUri);
    }
    URL digest = digestBaseUri.resolve("digest.zip").toURL();
    Message.verbose("\tReading " + digest);

    final URLResource res = new URLResource(digest, this.timeoutConstraint);
    ArtifactDownloadReport report = repositoryCacheManager.downloadRepositoryResource(res,
        "digest", "digest", "zip", options, urlRepository);
    if (report.getDownloadStatus() == DownloadStatus.FAILED) {
        return null;
    }
    try (InputStream in = new FileInputStream(report.getLocalFile())) {
        ZipInputStream zipped = findEntry(in, "digest.xml");
        if (zipped == null) {
            return null;
        }
        return UpdateSiteDigestParser.parse(zipped, site);
    }
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:26,代码来源:UpdateSiteLoader.java

示例8: loadFromSite

import org.apache.ivy.core.report.ArtifactDownloadReport; //导入依赖的package包/类
private UpdateSiteDescriptor loadFromSite(UpdateSite site) throws IOException, SAXException {
    UpdateSiteDescriptor repoDescriptor = new UpdateSiteDescriptor(site.getUri(),
            ExecutionEnvironmentProfileProvider.getInstance());

    for (EclipseFeature feature : site.getFeatures()) {
        URL url = site.getUri().resolve(feature.getUrl()).toURL();

        final URLResource res = new URLResource(url, this.timeoutConstraint);
        ArtifactDownloadReport report = repositoryCacheManager.downloadRepositoryResource(res,
            feature.getId(), "feature", "jar", options, urlRepository);
        if (report.getDownloadStatus() == DownloadStatus.FAILED) {
            return null;
        }
        try (InputStream in = new FileInputStream(report.getLocalFile())) {
            ZipInputStream zipped = findEntry(in, "feature.xml");
            if (zipped == null) {
                return null;
            }
            EclipseFeature f = FeatureParser.parse(zipped);
            f.setURL(feature.getUrl());
            repoDescriptor.addFeature(f);
        }
    }

    return repoDescriptor;
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:27,代码来源:UpdateSiteLoader.java

示例9: getConflictResolvingPolicy

import org.apache.ivy.core.report.ArtifactDownloadReport; //导入依赖的package包/类
/**
 * The returned comparator should consider greater the artifact which gains the conflict battle.
 * This is used only during retrieve... prefer resolve conflict manager to resolve conflicts.
 *
 * @return Comparator<ArtifactDownloadReport>
 */
private Comparator<ArtifactDownloadReport> getConflictResolvingPolicy() {
    return new Comparator<ArtifactDownloadReport>() {
        // younger conflict resolving policy
        public int compare(ArtifactDownloadReport o1, ArtifactDownloadReport o2) {
            Artifact a1 = o1.getArtifact();
            Artifact a2 = o2.getArtifact();
            if (a1.getPublicationDate().after(a2.getPublicationDate())) {
                // a1 is after a2 <=> a1 is younger than a2 <=> a1 wins the conflict battle
                return +1;
            } else if (a1.getPublicationDate().before(a2.getPublicationDate())) {
                // a1 is before a2 <=> a2 is younger than a1 <=> a2 wins the conflict battle
                return -1;
            } else {
                return 0;
            }
        }
    };
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:25,代码来源:RetrieveEngine.java

示例10: unpackArtifact

import org.apache.ivy.core.report.ArtifactDownloadReport; //导入依赖的package包/类
private void unpackArtifact(Artifact artifact, ArtifactDownloadReport adr,
        CacheDownloadOptions options) {
    Artifact unpacked = packagingManager.getUnpackedArtifact(artifact);
    if (unpacked == null) {
        // nothing to unpack
        return;
    }

    File archiveFile = getArchiveFileInCache(unpacked, null, false);
    if (archiveFile.exists() && !options.isForce()) {
        adr.setUnpackedLocalFile(archiveFile);
        adr.setUnpackedArtifact(unpacked);
    } else {
        Message.info("\tUnpacking " + artifact.getId());
        try {
            final Artifact unpackedArtifact = packagingManager.unpackArtifact(artifact, adr.getLocalFile(), archiveFile);
            adr.setUnpackedLocalFile(archiveFile);
            adr.setUnpackedArtifact(unpackedArtifact);
        } catch (Exception e) {
            Message.debug(e);
            adr.setDownloadStatus(DownloadStatus.FAILED);
            adr.setDownloadDetails("The packed artifact " + artifact.getId()
                    + " could not be unpacked (" + e.getMessage() + ")");
        }
    }
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:27,代码来源:DefaultRepositoryCacheManager.java

示例11: 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

示例12: 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

示例13: download

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

示例14: testResolveWithConflictManagerDefinedInModule

import org.apache.ivy.core.report.ArtifactDownloadReport; //导入依赖的package包/类
/**
 * Test case for IVY-465.
 *
 * @throws Exception if something goes wrong
 * @see <a href="https://issues.apache.org/jira/browse/IVY-465">IVY-465</a>
 */
@Test
public void testResolveWithConflictManagerDefinedInModule() throws Exception {
    // #M1;1.0 -> #M2;1.0
    // #M2;1.0 -> {org1#mod1.2;1.1 org1#mod1.2;2.0} with
    // <conflict org="org1" module="mod1.2" rev="1.1,2.0" />

    ResolveReport report = ivy.resolve(new File(
            "test/repositories/1/IVY-465/M1/ivys/ivy-1.0.xml"),
        getResolveOptions(new String[] {"*"}));
    assertFalse(report.hasError());

    ArtifactDownloadReport[] adrs = report.getConfigurationReport("default")
            .getDownloadedArtifactsReports();
    assertEquals(2, adrs.length);
    assertEquals("1.1", adrs[0].getArtifact().getId().getRevision());
    assertEquals("2.0", adrs[1].getArtifact().getId().getRevision());
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:24,代码来源:ResolveTest.java

示例15: testUnpack

import org.apache.ivy.core.report.ArtifactDownloadReport; //导入依赖的package包/类
@Test
public void testUnpack() throws Exception {
    ResolveOptions options = getResolveOptions(new String[] {"*"});

    URL url = new File("test/repositories/1/packaging/module1/ivys/ivy-1.0.xml").toURI()
            .toURL();

    // normal resolve, the file goes in the cache
    ResolveReport report = ivy.resolve(url, options);
    assertFalse(report.hasError());

    ArtifactDownloadReport adr = report.getAllArtifactsReports()[0];
    File cacheDir = ivy.getSettings().getDefaultRepositoryCacheBasedir();
    assertEquals(new File(cacheDir, "packaging/module2/jars/module2-1.0.jar"),
        adr.getLocalFile());
    assertEquals(new File(cacheDir, "packaging/module2/jar_unpackeds/module2-1.0"),
        adr.getUnpackedLocalFile());

    File[] jarContents = adr.getUnpackedLocalFile().listFiles();
    Arrays.sort(jarContents);
    assertEquals(new File(adr.getUnpackedLocalFile(), "META-INF"), jarContents[0]);
    assertEquals(new File(adr.getUnpackedLocalFile(), "test.txt"), jarContents[1]);
    assertEquals(new File(adr.getUnpackedLocalFile(), "META-INF/MANIFEST.MF"),
        jarContents[0].listFiles()[0]);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:26,代码来源:ResolveTest.java


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