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


Java IvyPatternHelper.substitute方法代码示例

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


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

示例1: getOutputPattern

import org.apache.ivy.core.IvyPatternHelper; //导入方法依赖的package包/类
private String getOutputPattern(String conf, String ext) {
    if (mRevId == null) {
        ResolutionCacheManager cacheMgr = getIvyInstance().getResolutionCacheManager();

        XmlReportParser parser = new XmlReportParser();
        File reportFile = cacheMgr.getConfigurationResolveReportInCache(resolveId, conf);

        try {
            parser.parse(reportFile);
        } catch (ParseException e) {
            throw new BuildException("Error occurred while parsing reportfile '"
                    + reportFile.getAbsolutePath() + "'", e);
        }

        // get the resolve module
        mRevId = parser.getResolvedModule();
    }

    return IvyPatternHelper.substitute(outputpattern, mRevId.getOrganisation(),
        mRevId.getName(), mRevId.getRevision(), "", "", ext, conf,
        mRevId.getQualifiedExtraAttributes(), null);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:23,代码来源:IvyReport.java

示例2: doExecute

import org.apache.ivy.core.IvyPatternHelper; //导入方法依赖的package包/类
public void doExecute() throws BuildException {
    prepareAndCheck();

    try {
        ResolutionCacheManager cacheMgr = getIvyInstance().getResolutionCacheManager();
        String resolveId = getResolveId();
        if (resolveId == null) {
            resolveId = ResolveOptions.getDefaultResolveId(getResolvedModuleId());
        }
        XmlReportParser parser = new XmlReportParser();
        for (String conf : splitToArray(getConf())) {
            File report = cacheMgr.getConfigurationResolveReportInCache(resolveId, conf);
            parser.parse(report);

            for (Artifact artifact : parser.getArtifacts()) {
                String name = IvyPatternHelper.substitute(getSettings().substitute(getName()),
                        artifact, conf);
                String value = IvyPatternHelper.substitute(
                        getSettings().substitute(getValue()), artifact, conf);
                setProperty(name, value);
            }
        }
    } catch (Exception ex) {
        throw new BuildException("impossible to add artifact properties: " + ex, ex);
    }
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:27,代码来源:IvyArtifactProperty.java

示例3: analyse

import org.apache.ivy.core.IvyPatternHelper; //导入方法依赖的package包/类
public void analyse(String pattern, DependencyAnalyser depAnalyser) {
    JarModuleFinder finder = new JarModuleFinder(pattern);
    ModuleDescriptor[] mds = depAnalyser.analyze(finder.findJarModules());
    Message.info("found " + mds.length + " modules");
    for (ModuleDescriptor md : mds) {
        File ivyFile = new File(IvyPatternHelper.substitute(
                pattern,
                DefaultArtifact.newIvyArtifact(md.getModuleRevisionId(),
                        md.getPublicationDate())));
        try {
            Message.info("generating " + ivyFile);
            XmlModuleDescriptorWriter.write(md, ivyFile);
        } catch (IOException e) {
            Message.debug(e);
        }
    }
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:18,代码来源:RepositoryAnalyser.java

示例4: findJarModules

import org.apache.ivy.core.IvyPatternHelper; //导入方法依赖的package包/类
public JarModule[] findJarModules() {
    List<JarModule> ret = new ArrayList<>();
    URLLister lister = new FileURLLister();
    try {
        for (String org : ResolverHelper.listTokenValues(lister, pattern, "organisation")) {
            String orgPattern = IvyPatternHelper.substituteToken(pattern,
                    IvyPatternHelper.ORGANISATION_KEY, org);
            for (String module : ResolverHelper.listTokenValues(lister, orgPattern, "module")) {
                String modPattern = IvyPatternHelper.substituteToken(orgPattern,
                        IvyPatternHelper.MODULE_KEY, module);
                for (String rev : ResolverHelper.listTokenValues(lister, modPattern, "revision")) {
                    File jar = new File(IvyPatternHelper.substitute(filePattern, org,
                            module, rev, module, "jar", "jar"));
                    if (jar.exists()) {
                        ret.add(new JarModule(ModuleRevisionId.newInstance(org, module, rev), jar));
                    }
                }
            }
        }

    } catch (Exception e) {
        Message.debug(e);
        // TODO: handle exception
    }
    return ret.toArray(new JarModule[ret.size()]);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:27,代码来源:JarModuleFinder.java

示例5: getCachedDataFile

import org.apache.ivy.core.IvyPatternHelper; //导入方法依赖的package包/类
/**
 * A resolver-specific ivydata file, only used for caching dynamic revisions, e.g.
 * integration-repo.
 */
private PropertiesFile getCachedDataFile(String resolverName, ModuleRevisionId mRevId) {
    // we append ".${resolverName} onto the end of the regular ivydata location
    return new PropertiesFile(new File(getRepositoryCacheRoot(),
            IvyPatternHelper.substitute(getDataFilePattern(), mRevId) + "." + resolverName),
            "ivy cached data file for " + mRevId);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:11,代码来源:DefaultRepositoryCacheManager.java

示例6: getDestination

import org.apache.ivy.core.IvyPatternHelper; //导入方法依赖的package包/类
@Override
protected String getDestination(String pattern, Artifact artifact, ModuleRevisionId mrid) {
    if (supportTransaction() && isTransactionStarted()) {

        String destPattern = fullTransactionPatterns.get(pattern);
        if (destPattern == null) {
            throw new IllegalArgumentException(
                    "unsupported pattern for publish destination pattern: " + pattern
                            + ". supported patterns: " + fullTransactionPatterns.keySet());
        }
        return IvyPatternHelper.substitute(destPattern, mrid, artifact);
    } else {
        return super.getDestination(pattern, artifact, mrid);
    }
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:16,代码来源:FileSystemResolver.java

示例7: getResourceURL

import org.apache.ivy.core.IvyPatternHelper; //导入方法依赖的package包/类
private String getResourceURL() {
    String baseURL = IvyPatternHelper.substitute(resourceURL, mr.getOrganisation(),
        mr.getName(), mr.getRevision(), null, null, null, null,
        mr.getQualifiedExtraAttributes(), null);
    int slash = baseURL.lastIndexOf('/');
    if (slash != -1) {
        baseURL = baseURL.substring(0, slash + 1);
    }
    return baseURL;
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:11,代码来源:PackagerCacheEntry.java

示例8: getResolvedIvyFileInCache

import org.apache.ivy.core.IvyPatternHelper; //导入方法依赖的package包/类
public File getResolvedIvyFileInCache(ModuleRevisionId mrid) {
    String file = IvyPatternHelper.substitute(getResolvedIvyPattern(), mrid.getOrganisation(),
        mrid.getName(), mrid.getRevision(), "ivy", "ivy", "xml");
    return new File(getResolutionCacheRoot(), file);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:6,代码来源:DefaultResolutionCacheManager.java

示例9: getResolvedIvyPropertiesInCache

import org.apache.ivy.core.IvyPatternHelper; //导入方法依赖的package包/类
public File getResolvedIvyPropertiesInCache(ModuleRevisionId mrid) {
    String file = IvyPatternHelper.substitute(getResolvedIvyPropertiesPattern(),
        mrid.getOrganisation(), mrid.getName(), mrid.getRevision(), "ivy", "ivy", "xml");
    return new File(getResolutionCacheRoot(), file);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:6,代码来源:DefaultResolutionCacheManager.java

示例10: getIvyFileInCache

import org.apache.ivy.core.IvyPatternHelper; //导入方法依赖的package包/类
public File getIvyFileInCache(ModuleRevisionId mrid) {
    String file = IvyPatternHelper.substitute(getIvyPattern(),
        DefaultArtifact.newIvyArtifact(mrid, null));
    return new File(getRepositoryCacheRoot(), file);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:6,代码来源:DefaultRepositoryCacheManager.java

示例11: getArchivePathInCache

import org.apache.ivy.core.IvyPatternHelper; //导入方法依赖的package包/类
public String getArchivePathInCache(Artifact artifact) {
    return IvyPatternHelper.substitute(getArtifactPattern(), artifact);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:4,代码来源:DefaultRepositoryCacheManager.java

示例12: findTimestampedSnapshotVersion

import org.apache.ivy.core.IvyPatternHelper; //导入方法依赖的package包/类
private String findTimestampedSnapshotVersion(final ModuleRevisionId mrid) {
    if (!isM2compatible()) {
        return null;
    }
    if (!shouldUseMavenMetadata(getWholePattern())) {
        return null;
    }
    try {
        final String metadataLocation = IvyPatternHelper.substitute(root
                + "[organisation]/[module]/[revision]/maven-metadata.xml", mrid);
        final Resource metadata = getRepository().getResource(metadataLocation);
        if (!metadata.exists()) {
            Message.verbose("\tmaven-metadata not available for: " + mrid);
            return null;
        }
        try (final InputStream metadataStream = metadata.openStream()) {
            final StringBuilder timestamp = new StringBuilder();
            final StringBuilder buildNumber = new StringBuilder();
            XMLHelper.parse(metadataStream, null, new ContextualSAXHandler() {
                @Override
                public void endElement(String uri, String localName, String qName)
                        throws SAXException {
                    if ("metadata/versioning/snapshot/timestamp".equals(getContext())) {
                        timestamp.append(getText());
                    }
                    if ("metadata/versioning/snapshot/buildNumber".equals(getContext())) {
                        buildNumber.append(getText());
                    }
                    super.endElement(uri, localName, qName);
                }
            }, null);
            if (timestamp.length() > 0) {
                // we have found a timestamp, so this is a snapshot unique version
                String rev = mrid.getRevision();
                rev = rev.substring(0, rev.length() - "SNAPSHOT".length());
                rev += timestamp.toString() + "-" + buildNumber.toString();

                return rev;
            }
        }
    } catch (IOException | SAXException | ParserConfigurationException e) {
        Message.debug("impossible to access maven metadata file, ignored", e);
    }
    return null;
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:46,代码来源:IBiblioResolver.java

示例13: listResources

import org.apache.ivy.core.IvyPatternHelper; //导入方法依赖的package包/类
@Override
protected ResolvedResource[] listResources(Repository repository, ModuleRevisionId mrid,
                                           String pattern, Artifact artifact) {
    if (shouldUseMavenMetadata(pattern)) {
        List<String> revs = listRevisionsWithMavenMetadata(repository, mrid.getModuleId()
                .getAttributes());
        if (revs != null) {
            Message.debug("\tfound revs: " + revs);
            List<ResolvedResource> rres = new ArrayList<>();
            for (String rev : revs) {
                ModuleRevisionId historicalMrid = ModuleRevisionId.newInstance(mrid, rev);

                String patternForRev = pattern;
                if (rev.endsWith("SNAPSHOT")) {
                    String snapshotVersion = findTimestampedSnapshotVersion(historicalMrid);
                    if (snapshotVersion != null) {
                        patternForRev = pattern.replaceFirst("\\-\\[revision\\]", "-"
                                + snapshotVersion);
                    }
                }
                String resolvedPattern = IvyPatternHelper.substitute(patternForRev,
                        historicalMrid, artifact);
                try {
                    Resource res = repository.getResource(resolvedPattern);
                    if (res != null) {
                        // we do not test if the resource actually exist here, it would cause
                        // a lot of checks which are not always necessary depending on the usage
                        // which is done of the returned ResolvedResource array
                        rres.add(new ResolvedResource(res, rev));
                    }
                } catch (IOException e) {
                    Message.warn(
                            "impossible to get resource from name listed by maven-metadata.xml:"
                                    + rres, e);
                }
            }
            return rres.toArray(new ResolvedResource[rres.size()]);
        } else {
            // maven metadata not available or something went wrong,
            // use default listing capability
            return super.listResources(repository, mrid, pattern, artifact);
        }
    } else {
        return super.listResources(repository, mrid, pattern, artifact);
    }
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:47,代码来源:IBiblioResolver.java

示例14: BuiltFileResource

import org.apache.ivy.core.IvyPatternHelper; //导入方法依赖的package包/类
public BuiltFileResource(File dir, Artifact artifact) {
    this(new File(dir, IvyPatternHelper.substitute(BUILT_ARTIFACT_PATTERN, artifact)));
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:4,代码来源:BuiltFileResource.java

示例15: findResourceUsingPattern

import org.apache.ivy.core.IvyPatternHelper; //导入方法依赖的package包/类
@Override
protected ResolvedResource findResourceUsingPattern(ModuleRevisionId mrid, String pattern,
        Artifact artifact, ResourceMDParser rmdparser, Date date) {
    String name = getName();
    VersionMatcher versionMatcher = getSettings().getVersionMatcher();
    try {
        if (!versionMatcher.isDynamic(mrid) || isAlwaysCheckExactRevision()) {
            String resourceName = IvyPatternHelper.substitute(pattern, mrid, artifact);
            Message.debug("\t trying " + resourceName);
            logAttempt(resourceName);
            Resource res = repository.getResource(resourceName);
            boolean reachable = res.exists();
            if (reachable) {
                String revision;
                if (pattern.contains(IvyPatternHelper.REVISION_KEY)) {
                    revision = mrid.getRevision();
                } else {
                    if ("ivy".equals(artifact.getType()) || "pom".equals(artifact.getType())) {
                        // we can't determine the revision from the pattern, get it
                        // from the module descriptor itself
                        File temp = File.createTempFile("ivy", artifact.getExt());
                        temp.deleteOnExit();
                        repository.get(res.getName(), temp);
                        ModuleDescriptorParser parser = ModuleDescriptorParserRegistry
                                .getInstance().getParser(res);
                        ModuleDescriptor md = parser.parseDescriptor(getParserSettings(), temp
                                .toURI().toURL(), res, false);
                        revision = md.getRevision();
                        if (isNullOrEmpty(revision)) {
                            revision = "[email protected]" + name;
                        }
                    } else {
                        revision = "[email protected]" + name;
                    }
                }
                return new ResolvedResource(res, revision);
            } else if (versionMatcher.isDynamic(mrid)) {
                return findDynamicResourceUsingPattern(rmdparser, mrid, pattern, artifact, date);
            } else {
                Message.debug("\t" + name + ": resource not reachable for " + mrid + ": res="
                        + res);
                return null;
            }
        } else {
            return findDynamicResourceUsingPattern(rmdparser, mrid, pattern, artifact, date);
        }
    } catch (IOException | ParseException ex) {
        throw new RuntimeException(name + ": unable to get resource for " + mrid + ": res="
                + IvyPatternHelper.substitute(pattern, mrid, artifact) + ": " + ex, ex);
    }
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:52,代码来源:RepositoryResolver.java


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