• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ModuleDescriptorParser类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: deployEffectivePom

import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入依赖的package包/类
private void deployEffectivePom( ModuleRevisionId moduleRevisionId, Path artifactPath )
    throws IOException
{
    try
    {
        File pomFile = artifactPath.resolveSibling( artifactPath.getName( artifactPath.getNameCount() - 1 )
            + "-xmvn.pom" ).toFile();
        ModuleDescriptorParser parser = XmlModuleDescriptorParser.getInstance();
        ModuleDescriptor module =
            parser.parseDescriptor( getSettings(), artifactPath.toFile().toURI().toURL(), false );
        PomModuleDescriptorWriter.write( module, pomFile, new PomWriterOptions() );

        org.fedoraproject.xmvn.artifact.Artifact artifact = ivy2aether( moduleRevisionId, "pom" );
        deploy( artifact, null, artifactPath );
    }
    catch ( ParseException e )
    {
        throw new IOException( e );
    }
}
 
开发者ID:fedora-java,项目名称:xmvn,代码行数:21,代码来源:IvyResolver.java


示例2: resolve

import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入依赖的package包/类
/**
 * Resolve dependencies of a module described by an ivy file.
 *
 * @param ivySource URL
 * @param options ResolveOptions
 * @return ResolveReport
 * @throws ParseException if something goes wrong
 * @throws IOException if something goes wrong
 */
public ResolveReport resolve(URL ivySource, ResolveOptions options) throws ParseException,
        IOException {
    URLResource res = new URLResource(ivySource);
    ModuleDescriptorParser parser = ModuleDescriptorParserRegistry.getInstance().getParser(res);
    Message.verbose("using " + parser + " to parse " + ivySource);
    ModuleDescriptor md = parser.parseDescriptor(settings, ivySource, options.isValidate());
    String revision = options.getRevision();
    if (revision == null && md.getResolvedModuleRevisionId().getRevision() == null) {
        revision = Ivy.getWorkingRevision();
    }
    if (revision != null) {
        md.setResolvedModuleRevisionId(ModuleRevisionId.newInstance(md.getModuleRevisionId(),
            revision));
    }

    return resolve(md, options);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:27,代码来源:ResolveEngine.java


示例3: parseParentModuleOnFilesystem

import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入依赖的package包/类
/**
 * Returns the parent module using the location attribute (for dev purpose).
 * 
 * @param location
 *            a given location
 * @throws IOException
 * @throws ParseException
 */
private ModuleDescriptor parseParentModuleOnFilesystem(String location) throws IOException, ParseException {
    if (!"file".equals(getDescriptorURL().getProtocol())) {
        return null;
    }

    File file = new File(location);
    if (!file.isAbsolute()) {
        URL url = getSettings().getRelativeUrlResolver().getURL(getDescriptorURL(), location);
        try {
            file = new File(new URI(url.toExternalForm()));
        } catch (URISyntaxException e) {
            file = new File(url.getPath());
        }
    }

    file = FileUtil.normalize(file.getAbsolutePath());
    if (!file.exists()) {
        Message.verbose("Parent module doesn't exist on the filesystem: " + file.getAbsolutePath());
        return null;
    }

    FileResource res = new FileResource(null, file);
    ModuleDescriptorParser parser = ModuleDescriptorParserRegistry.getInstance().getParser(res);
    return parser.parseDescriptor(getSettings(), file.toURI().toURL(), res, isValidate());
}
 
开发者ID:apache,项目名称:ant-easyant-core,代码行数:34,代码来源:DefaultEasyAntXmlModuleDescriptorParser.java


示例4: readIvyModuleDescriptorFromPom

import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入依赖的package包/类
private ModuleDescriptor readIvyModuleDescriptorFromPom( DependencyDescriptor depDescriptor )
    throws IOException, ParseException
{
    ModuleRevisionId depId = depDescriptor.getDependencyRevisionId();

    ResolutionRequest request = new ResolutionRequest();
    request.setArtifact( ivy2aether( depId, "pom" ) );
    ResolutionResult result = getResolver().resolve( request );
    Path pomPath = result.getArtifactPath();

    String version;
    ModuleDescriptor module;
    if ( pomPath != null )
    {
        ModuleDescriptorParser parser = PomModuleDescriptorParser.getInstance();
        module = parser.parseDescriptor( getSettings(), pomPath.toFile().toURI().toURL(), false );
        version = resolvedVersion( result );
    }
    else
    {
        module = DefaultModuleDescriptor.newDefaultInstance( depId, depDescriptor.getAllDependencyArtifacts() );
        version = resolveModuleVersion( module );
        if ( version == null )
            return null;
    }

    module.setResolvedModuleRevisionId( ModuleRevisionId.newInstance( depId, version ) );
    return module;
}
 
开发者ID:fedora-java,项目名称:xmvn,代码行数:30,代码来源:IvyResolver.java


示例5: parseModuleDescriptor

import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入依赖的package包/类
protected ModuleDescriptor parseModuleDescriptor(DependencyResolver resolver, Artifact moduleArtifact, CacheMetadataOptions options, File artifactFile, Resource resource) throws ParseException {
    ModuleRevisionId moduleRevisionId = moduleArtifact.getId().getModuleRevisionId();
    try {
        IvySettings ivySettings = IvyContextualiser.getIvyContext().getSettings();
        ParserSettings parserSettings = new LegacyResolverParserSettings(ivySettings, resolver, moduleRevisionId);
        ModuleDescriptorParser parser = ModuleDescriptorParserRegistry.getInstance().getParser(resource);
        return parser.parseDescriptor(parserSettings, new URL(artifactFile.toURI().toASCIIString()), resource, options.isValidate());
    } catch (IOException e) {
        throw UncheckedException.throwAsUncheckedException(e);
    }
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:12,代码来源:AbstractRepositoryCacheManager.java


示例6: getStaledMd

import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入依赖的package包/类
private ModuleDescriptor getStaledMd(ModuleDescriptorParser mdParser,
        CacheMetadataOptions options, File ivyFile, ParserSettings parserSettings)
        throws ParseException, IOException {
    ModuleDescriptorMemoryCache cache = getMemoryCache();
    ModuleDescriptorProvider mdProvider = new MyModuleDescriptorProvider(mdParser,
            parserSettings);
    return cache.getStale(ivyFile, settings, options.isValidate(), mdProvider);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:9,代码来源:DefaultRepositoryCacheManager.java


示例7: PomModuleDescriptorBuilder

import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入依赖的package包/类
public PomModuleDescriptorBuilder(ModuleDescriptorParser parser, Resource res,
        ParserSettings ivySettings) {
    ivyModuleDescriptor = new PomModuleDescriptor(parser, res);
    ivyModuleDescriptor.setResolvedPublicationDate(new Date(res.getLastModified()));
    for (Configuration m2conf : MAVEN2_CONFIGURATIONS) {
        ivyModuleDescriptor.addConfiguration(m2conf);
    }
    ivyModuleDescriptor.setMappingOverride(true);
    ivyModuleDescriptor.addExtraAttributeNamespace("m", Ivy.getIvyHomeURL() + "maven");
    parserSettings = ivySettings;
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:12,代码来源:PomModuleDescriptorBuilder.java


示例8: parseParentModuleOnFilesystem

import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入依赖的package包/类
/**
 * Returns the parent module using the location attribute (for dev purpose).
 *
 * @param location
 *            a given location
 * @throws IOException if something goes wrong
 * @throws ParseException if something goes wrong
 */
private ModuleDescriptor parseParentModuleOnFilesystem(String location) throws IOException,
        ParseException {
    if (!"file".equals(descriptorURL.getProtocol())) {
        return null;
    }

    File file = new File(location);
    if (!file.isAbsolute()) {
        URL url = settings.getRelativeUrlResolver().getURL(descriptorURL, location);
        try {
            file = new File(new URI(url.toExternalForm()));
        } catch (URISyntaxException e) {
            file = new File(url.getPath());
        }
    }

    file = FileUtil.normalize(file.getAbsolutePath());
    if (!file.exists()) {
        Message.verbose("Parent module doesn't exist on the filesystem: "
                + file.getAbsolutePath());
        return null;
    }

    FileResource res = new FileResource(null, file);
    ModuleDescriptorParser parser = ModuleDescriptorParserRegistry.getInstance().getParser(
        res);
    return parser.parseDescriptor(getSettings(), file.toURI().toURL(), res, isValidate());
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:37,代码来源:XmlModuleDescriptorParser.java


示例9: cacheModuleDescriptor

import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入依赖的package包/类
private void cacheModuleDescriptor(ModuleDescriptor systemMd, ModuleRevisionId systemMrid,
        ResolvedResource ivyRef, ResolvedModuleRevision rmr) {
    RepositoryCacheManager cacheManager = getRepositoryCacheManager();

    final ModuleDescriptorParser parser = systemMd.getParser();

    // the metadata artifact which was used to cache the original metadata file
    Artifact requestedMetadataArtifact = (ivyRef == null) ? systemMd.getMetadataArtifact()
            : parser.getMetadataArtifact(
                    ModuleRevisionId.newInstance(systemMrid, systemMd.getRevision()),
            ivyRef.getResource());

    cacheManager.originalToCachedModuleDescriptor(this, ivyRef, requestedMetadataArtifact, rmr,
        new ModuleDescriptorWriter() {
            public void write(ResolvedResource originalMdResource, ModuleDescriptor md,
                    File src, File dest) throws IOException, ParseException {
                if (originalMdResource == null) {
                    // a basic ivy file is written containing default data
                    XmlModuleDescriptorWriter.write(md, dest);
                } else {
                    // copy and update ivy file from source to cache
                    parser.toIvyFile(new FileInputStream(src),
                        originalMdResource.getResource(), dest, md);
                    long repLastModified = originalMdResource.getLastModified();
                    if (repLastModified > 0) {
                        dest.setLastModified(repLastModified);
                    }
                }
            }
        });
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:32,代码来源:BasicResolver.java


示例10: getModuleDescriptorParser

import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入依赖的package包/类
@Override
protected ModuleDescriptorParser getModuleDescriptorParser(File moduleDescriptorFile) {
    try {
        return ModuleDescriptorParserRegistry.getInstance().getParser(
                new URLResource(moduleDescriptorFile.toURI().toURL()));
    } catch (MalformedURLException e) {
        throw new RuntimeException("Can't access to " + moduleDescriptorFile.getAbsolutePath(), e);
    }
}
 
开发者ID:apache,项目名称:ant-easyant-core,代码行数:10,代码来源:EasyantResolutionCacheManager.java


示例11: toModuleDescriptor

import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入依赖的package包/类
public static DefaultModuleDescriptor toModuleDescriptor(ModuleDescriptorParser parser,
        URI baseUri, BundleInfo bundle, ExecutionEnvironmentProfileProvider profileProvider) {
    return toModuleDescriptor(parser, baseUri, bundle, null, profileProvider);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:5,代码来源:BundleInfoAdapter.java


示例12: getParser

import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入依赖的package包/类
public ModuleDescriptorParser getParser() {
    return parser;
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:4,代码来源:DefaultModuleDescriptor.java


示例13: DefaultWorkspaceModuleDescriptor

import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入依赖的package包/类
public DefaultWorkspaceModuleDescriptor(ModuleDescriptorParser parser, Resource res) {
    super(parser, res);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:4,代码来源:DefaultWorkspaceModuleDescriptor.java


示例14: MyModuleDescriptorProvider

import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入依赖的package包/类
public MyModuleDescriptorProvider(ModuleDescriptorParser mdParser, ParserSettings settings) {
    this.mdParser = mdParser;
    this.settings = settings;
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:5,代码来源:DefaultRepositoryCacheManager.java


示例15: getMdFromCache

import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入依赖的package包/类
private ModuleDescriptor getMdFromCache(ModuleDescriptorParser mdParser,
        CacheMetadataOptions options, File ivyFile) throws ParseException, IOException {
    ModuleDescriptorMemoryCache cache = getMemoryCache();
    ModuleDescriptorProvider mdProvider = new MyModuleDescriptorProvider(mdParser, settings);
    return cache.get(ivyFile, settings, options.isValidate(), mdProvider);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:7,代码来源:DefaultRepositoryCacheManager.java


示例16: addConfigured

import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入依赖的package包/类
public synchronized void addConfigured(ModuleDescriptorParser parser) {
    ModuleDescriptorParserRegistry.getInstance().addParser(parser);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:4,代码来源:IvySettings.java


示例17: PomModuleDescriptor

import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入依赖的package包/类
public PomModuleDescriptor(ModuleDescriptorParser parser, Resource res) {
    super(parser, res);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:4,代码来源:PomModuleDescriptorBuilder.java


示例18: Parser

import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入依赖的package包/类
public Parser(ModuleDescriptorParser parser, ParserSettings ivySettings) {
    super(parser);
    settings = ivySettings;
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:5,代码来源:XmlModuleDescriptorParser.java


示例19: parse

import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入依赖的package包/类
public ResolvedModuleRevision parse(final ResolvedResource mdRef, DependencyDescriptor dd,
        ResolveData data) throws ParseException {

    DependencyDescriptor nsDd = dd;
    dd = toSystem(nsDd);

    ModuleRevisionId mrid = dd.getDependencyRevisionId();
    ModuleDescriptorParser parser = ModuleDescriptorParserRegistry.getInstance().getParser(
        mdRef.getResource());
    if (parser == null) {
        Message.warn("no module descriptor parser available for " + mdRef.getResource());
        return null;
    }
    Message.verbose("\t" + getName() + ": found md file for " + mrid);
    Message.verbose("\t\t=> " + mdRef);
    Message.debug("\tparser = " + parser);

    ModuleRevisionId resolvedMrid = mrid;

    // first check if this dependency has not yet been resolved
    if (getSettings().getVersionMatcher().isDynamic(mrid)) {
        resolvedMrid = ModuleRevisionId.newInstance(mrid, mdRef.getRevision());
        IvyNode node = data.getNode(resolvedMrid);
        if (node != null && node.getModuleRevision() != null) {
            // this revision has already be resolved : return it
            if (node.getDescriptor() == null || !node.getDescriptor().isDefault()) {
                Message.verbose("\t" + getName() + ": revision already resolved: "
                        + resolvedMrid);
                node.getModuleRevision().getReport().setSearched(true);
                return node.getModuleRevision();
            }
            Message.verbose("\t" + getName() + ": found already resolved revision: "
                    + resolvedMrid
                    + ": but it's a default one, maybe we can find a better one");
        }
    }

    Artifact moduleArtifact = parser.getMetadataArtifact(resolvedMrid, mdRef.getResource());
    return getRepositoryCacheManager().cacheModuleDescriptor(this, mdRef, dd, moduleArtifact,
        downloader, getCacheOptions(data));
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:42,代码来源:BasicResolver.java


示例20: findResourceUsingPattern

import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入依赖的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.plugins.parser.ModuleDescriptorParser类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ClusteredSessionStore类代码示例发布时间:2022-05-22
下一篇:
Java CloseEvent类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap