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


Java ArtifactDownloadReport.getLocalFile方法代码示例

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


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

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

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

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

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

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

示例6: importModule

import org.apache.ivy.core.report.ArtifactDownloadReport; //导入方法依赖的package包/类
/**
 * Import a module
 * 
 * @param moduleRevisionId
 *            {@link ModuleRevisionId} of main artifact
 * @param report
 *            a resolved report of the module to import
 */
protected void importModule(ModuleRevisionId moduleRevisionId, ResolveReport report) {
    // Check dependency on core
    checkCoreCompliance(report, providedConf);

    Path path = createModulePath(moduleRevisionId.getModuleId());
    File antFile = null;
    for (int j = 0; j < report.getConfigurationReport(mainConf).getAllArtifactsReports().length; j++) {
        ArtifactDownloadReport artifact = report.getConfigurationReport(mainConf).getAllArtifactsReports()[j];
        if ("ant".equals(artifact.getType())) {
            antFile = artifact.getLocalFile();
        } else if (shouldBeAddedToClasspath(artifact)) {
            path.createPathElement().setLocation(artifact.getLocalFile());
        } else {
            handleOtherResourceFile(moduleRevisionId, artifact.getName(), artifact.getExt(),
                    artifact.getLocalFile());
        }
    }
    // effective import should be executed AFTER any other resource files has been handled
    if (antFile != null && antFile.exists()) {
        doEffectiveImport(antFile);
    }
}
 
开发者ID:apache,项目名称:ant-easyant-core,代码行数:31,代码来源:AbstractImport.java

示例7: of

import org.apache.ivy.core.report.ArtifactDownloadReport; //导入方法依赖的package包/类
static IvyArtifactContainer of(ArtifactDownloadReport[] artifactDownloadReports) {
    IvyArtifactContainer result = new IvyArtifactContainer();
    for (ArtifactDownloadReport report : artifactDownloadReports) {
        if (report.getLocalFile() == null) {
            throw new IllegalStateException("File for " + report.getArtifact() + " hasn't been downloaded.");
        }
        result.put(report.getArtifact().getModuleRevisionId(), report.getLocalFile().toPath());
    }
    return result;
}
 
开发者ID:jerkar,项目名称:jerkar,代码行数:11,代码来源:IvyArtifactContainer.java

示例8: writeCacheLocationIfPresent

import org.apache.ivy.core.report.ArtifactDownloadReport; //导入方法依赖的package包/类
private void writeCacheLocationIfPresent(RepositoryCacheManager cache,
        TransformerHandler saxHandler, ArtifactDownloadReport artifact) throws SAXException {
    File archiveInCache = artifact.getLocalFile();

    if (archiveInCache != null) {
        saxHandler.startElement(null, "cache-location", "cache-location", new AttributesImpl());
        char[] archiveInCacheAsChars = archiveInCache.getPath().replace('\\', '/')
                .toCharArray();
        saxHandler.characters(archiveInCacheAsChars, 0, archiveInCacheAsChars.length);
        saxHandler.endElement(null, "cache-location", "cache-location");
    }
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:13,代码来源:IvyArtifactReport.java

示例9: doExecute

import org.apache.ivy.core.report.ArtifactDownloadReport; //导入方法依赖的package包/类
public void doExecute() throws BuildException {
    prepareAndCheck();
    if (setid == null) {
        throw new BuildException("setid is required in ivy cachefileset");
    }
    try {
        final List<ArtifactDownloadReport> artifactDownloadReports = getArtifactReports();
        if (artifactDownloadReports.isEmpty()) {
            // generate an empty fileset
            final FileSet emptyFileSet = new EmptyFileSet();
            emptyFileSet.setProject(getProject());
            getProject().addReference(setid, emptyFileSet);
            return;
        }
        // find a common base dir of the resolved artifacts
        final File baseDir = this.requireCommonBaseDir(artifactDownloadReports);
        final FileSet fileset = new FileSet();
        fileset.setDir(baseDir);
        fileset.setProject(getProject());
        // enroll each of the artifact files into the fileset
        for (final ArtifactDownloadReport artifactDownloadReport : artifactDownloadReports) {
            if (artifactDownloadReport.getLocalFile() == null) {
                continue;
            }
            final NameEntry ne = fileset.createInclude();
            ne.setName(getPath(baseDir, artifactDownloadReport.getLocalFile()));
        }
        getProject().addReference(setid, fileset);
    } catch (Exception ex) {
        throw new BuildException("impossible to build ivy cache fileset: " + ex, ex);
    }
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:33,代码来源:IvyCacheFileset.java

示例10: requireCommonBaseDir

import org.apache.ivy.core.report.ArtifactDownloadReport; //导入方法依赖的package包/类
/**
 * Returns a common base directory, determined from the
 * {@link ArtifactDownloadReport#getLocalFile() local files} of the passed
 * <code>artifactDownloadReports</code>. If no common base directory can be determined, this
 * method throws a {@link BuildException}
 *
 * @param artifactDownloadReports The artifact download reports for which the common base
 *                                directory of the artifacts has to be determined
 * @return File
 */
File requireCommonBaseDir(final List<ArtifactDownloadReport> artifactDownloadReports) {
    File base = null;
    for (final ArtifactDownloadReport artifactDownloadReport : artifactDownloadReports) {
        if (artifactDownloadReport.getLocalFile() == null) {
            continue;
        }
        if (base == null) {
            // use the parent dir of the artifact as the base
            base = artifactDownloadReport.getLocalFile().getParentFile().getAbsoluteFile();
        } else {
            // try and find a common base directory between the current base
            // directory and the artifact's file
            base = getBaseDir(base, artifactDownloadReport.getLocalFile());
            if (base == null) {
                // fail fast - we couldn't determine a common base directory, throw an error
                throw new BuildException("Cannot find a common base directory, from resolved "
                        + "artifacts, for generating a cache fileset");
            }
        }
    }
    if (base == null) {
        // finally, we couldn't determine a common base directory, throw an error
        throw new BuildException("Cannot find a common base directory, from resolved "
                + "artifacts, for generating a cache fileset");
    }
    return base;
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:38,代码来源:IvyCacheFileset.java

示例11: outputCachePath

import org.apache.ivy.core.report.ArtifactDownloadReport; //导入方法依赖的package包/类
private static void outputCachePath(Ivy ivy, File cache, ModuleDescriptor md, String[] confs,
        String outFile) {
    try {
        StringBuilder buf = new StringBuilder();
        Collection<ArtifactDownloadReport> all = new LinkedHashSet<>();
        ResolutionCacheManager cacheMgr = ivy.getResolutionCacheManager();
        XmlReportParser parser = new XmlReportParser();
        for (String conf : confs) {
            String resolveId = ResolveOptions.getDefaultResolveId(md);
            File report = cacheMgr.getConfigurationResolveReportInCache(resolveId, conf);
            parser.parse(report);

            all.addAll(Arrays.asList(parser.getArtifactReports()));
        }
        for (ArtifactDownloadReport artifact : all) {
            if (artifact.getLocalFile() != null) {
                buf.append(artifact.getLocalFile().getCanonicalPath());
                buf.append(File.pathSeparator);
            }
        }

        PrintWriter writer = new PrintWriter(new FileOutputStream(outFile));
        if (buf.length() > 0) {
            buf.setLength(buf.length() - File.pathSeparator.length());
            writer.println(buf);
        }
        writer.close();
        System.out.println("cachepath output to " + outFile);

    } catch (Exception ex) {
        throw new RuntimeException("impossible to build ivy cache path: " + ex.getMessage(), ex);
    }
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:34,代码来源:Main.java

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

示例13: downloadMirrorList

import org.apache.ivy.core.report.ArtifactDownloadReport; //导入方法依赖的package包/类
private File downloadMirrorList() {
    final URLRepository urlRepository = new URLRepository(this.getTimeoutConstraint());
    if (getEventManager() != null) {
        urlRepository.addTransferListener(getEventManager());
    }
    final URLResource mirrorResource = new URLResource(mirrorListUrl, this.getTimeoutConstraint());
    CacheResourceOptions options = new CacheResourceOptions();
    ArtifactDownloadReport report = getRepositoryCacheManager().downloadRepositoryResource(
        mirrorResource, "mirrorlist", "text", "txt", options, urlRepository);
    return report.getLocalFile();
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:12,代码来源:MirroredURLResolver.java

示例14: importModule

import org.apache.ivy.core.report.ArtifactDownloadReport; //导入方法依赖的package包/类
protected void importModule(ModuleId moduleId, ResolveReport report) {
    // Check dependency on core
    checkCoreCompliance(report, getProvidedConf());
    ConfigurationResolveReport confReport = report.getConfigurationReport(getMainConf());
    for (Object o : confReport.getModuleRevisionIds()) {
        ModuleRevisionId mrid = (ModuleRevisionId) o;
        if (mrid.getModuleId().equals(moduleId)) {
            ArtifactDownloadReport[] artifactsReports = confReport.getDownloadReports(mrid);

            // Fill classpath with whole set of dependencies
            Path path = createModulePath(moduleId);
            for (int i = 0; i < confReport.getAllArtifactsReports().length; i++) {
                ArtifactDownloadReport artifactReport = confReport.getAllArtifactsReports()[i];
                if (shouldBeAddedToClasspath(artifactReport)) {
                    path.createPathElement().setLocation(artifactReport.getLocalFile());
                }
            }

            File antFile = null;
            for (ArtifactDownloadReport artifact : artifactsReports) {
                if ("ant".equals(artifact.getType())) {
                    antFile = artifact.getLocalFile();
                } else {
                    handleOtherResourceFile(artifact.getArtifact().getModuleRevisionId(), artifact.getName(),
                            artifact.getExt(), artifact.getLocalFile());
                }
            }

            // effective import should be executed AFTER any other resource files has been handled
            if (antFile != null && antFile.exists()) {
                doEffectiveImport(antFile);
            }

        }
    }
    // loop on dependencies
}
 
开发者ID:apache,项目名称:ant-easyant-core,代码行数:38,代码来源:ImportDeferred.java

示例15: makePath

import org.apache.ivy.core.report.ArtifactDownloadReport; //导入方法依赖的package包/类
/**
 * Make an array of artifacts a path and save it in the ant references
 */
private Path makePath(String pathId, List<ArtifactDownloadReport> artifacts) {
    log("Path '" + pathId + "' computed with " + artifacts.size() + " files", Project.MSG_VERBOSE);
    Path path = new Path(getProject());
    for (ArtifactDownloadReport artifact : artifacts) {
        if (artifact.getLocalFile() != null) {
            PathElement pe = path.createPathElement();
            pe.setLocation(artifact.getLocalFile());
            log("Adding to path '" + pathId + "': " + artifact.getLocalFile(), Project.MSG_DEBUG);
        }
    }

    getProject().addReference(pathId, path);
    return path;
}
 
开发者ID:apache,项目名称:ant-easyant-core,代码行数:18,代码来源:ImportAntscripts.java


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