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


Java Module.getNamespace方法代码示例

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


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

示例1: writeModuleToOutputStream

import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
private static void writeModuleToOutputStream(final SchemaContext ctx, final Module module,
        final XMLStreamWriter xmlStreamWriter, final boolean emitInstantiated) {
    final URI moduleNs = module.getNamespace();
    final Map<String, URI> prefixToNs = prefixToNamespace(ctx, module);
    final StatementTextWriter yinWriter = SingleModuleYinStatementWriter.create(xmlStreamWriter, moduleNs,
            prefixToNs);
    SchemaContextEmitter.writeToStatementWriter(module, ctx, yinWriter, emitInstantiated);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:9,代码来源:YinExportUtils.java

示例2: getModuleNamespace

import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
private static URI getModuleNamespace(final SchemaContext ctx, final String moduleName) {
    for (final Module module : ctx.getModules()) {
        if (moduleName.equals(module.getName())) {
            return module.getNamespace();
        }
    }
    throw new IllegalArgumentException("Module " + moduleName + "does not exists in provided schema context");
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:9,代码来源:YinExportUtils.java

示例3: writeModuleToOutputStream

import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
private static void writeModuleToOutputStream(final SchemaContext ctx, final Module module,
        final XMLStreamWriter xmlStreamWriter, final boolean emitInstantiated) {
    final URI moduleNs = module.getNamespace();
    final Map<String, URI> prefixToNs = prefixToNamespace(ctx, module);
    final StatementTextWriter statementWriter = SingleModuleYinStatementWriter.create(xmlStreamWriter, moduleNs,
            prefixToNs);
    final YangModuleWriter yangSchemaWriter = SchemaToStatementWriterAdaptor.from(statementWriter);
    final Map<QName, StatementDefinition> extensions = ExtensionStatement.mapFrom(ctx.getExtensions());
    new EffectiveSchemaContextEmitter(yangSchemaWriter, extensions, module.getYangVersion(), emitInstantiated)
    .emitModule(module);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:12,代码来源:EffectiveSchemaContextEmitterTest.java

示例4: processDependencies

import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
/**
 * Extract module:revision from modules.
 */
private static void processDependencies(final Table<String, Optional<Revision>, ModuleNodeImpl> moduleGraph,
        final Collection<Module> mmbs) {
    final Map<URI, Module> allNS = new HashMap<>();

    // Create edges in graph
    for (final Module module : mmbs) {
        final Map<String, Optional<Revision>> imported = new HashMap<>();
        final String fromName = module.getName();
        final URI ns = module.getNamespace();
        final Optional<Revision> fromRevision = module.getRevision();

        // check for existence of module with same namespace
        final Module prev = allNS.putIfAbsent(ns, module);
        if (prev != null) {
            final String name = prev.getName();
            if (!fromName.equals(name)) {
                LOG.warn("Error while sorting module [{}, {}]: module with same namespace ({}) already loaded:"
                    + " [{}, {}]", fromName, fromRevision, ns, name, prev.getRevision());
            }
        }

        // no need to check if other Type of object, check is performed in process modules
        for (final ModuleImport imprt : module.getImports()) {
            final String toName = imprt.getModuleName();
            final Optional<Revision> toRevision = imprt.getRevision();

            final ModuleNodeImpl from = moduleGraph.get(fromName, fromRevision);
            final ModuleNodeImpl to = getModuleByNameAndRevision(moduleGraph, fromName, fromRevision, toName,
                toRevision);

            /*
             * If it is an yang 1 module, check imports: If module is imported twice with different
             * revisions then throw exception
             */
            if (module.getYangVersion() == YangVersion.VERSION_1) {
                final Optional<Revision> impRevision = imported.get(toName);
                if (impRevision != null && impRevision.isPresent() && !impRevision.equals(toRevision)
                        && toRevision.isPresent()) {
                    throw new IllegalArgumentException(String.format(
                        "Module:%s imported twice with different revisions:%s, %s", toName,
                        formatRevDate(impRevision), formatRevDate(toRevision)));
                }
            }

            imported.put(toName, toRevision);

            from.addEdge(to);
        }
    }
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:54,代码来源:ModuleDependencySort.java


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