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


Java Module.getRevision方法代码示例

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


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

示例1: transformIdentities

import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
private static Map<String, Map<Date, IdentityMapping>> transformIdentities(final Set<Module> modules) {
    Map<String, Map<Date, IdentityMapping>> mappedIds = new HashMap<>();
    for (Module module : modules) {
        String namespace = module.getNamespace().toString();
        Map<Date, IdentityMapping> revisionsByNamespace = mappedIds.computeIfAbsent(namespace,
            k -> new HashMap<>());

        Date revision = module.getRevision();

        IdentityMapping identityMapping = revisionsByNamespace.computeIfAbsent(revision,
            k -> new IdentityMapping());

        for (IdentitySchemaNode identitySchemaNode : module.getIdentities()) {
            identityMapping.addIdSchemaNode(identitySchemaNode);
        }

    }

    return mappedIds;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:21,代码来源:ConfigSubsystemFacade.java

示例2: processModules

import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
/**
 * Extract dependencies from modules to fill dependency graph.
 */
private static void processModules(final Table<String, Optional<Revision>, ModuleNodeImpl> moduleGraph,
        final Iterable<Module> modules) {

    // Process nodes
    for (final Module momb : modules) {

        final String name = momb.getName();
        final Optional<Revision> rev = momb.getRevision();
        final Map<Optional<Revision>, ModuleNodeImpl> revs = moduleGraph.row(name);
        if (revs.containsKey(rev)) {
            throw new IllegalArgumentException(String.format("Module:%s with revision:%s declared twice", name,
                formatRevDate(rev)));
        }

        revs.put(rev, new ModuleNodeImpl(name, rev.orElse(null), momb));
    }
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:21,代码来源:ModuleDependencySort.java

示例3: loadDocument

import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
public static Document loadDocument(final String prefix, final Module module) throws IOException, SAXException {
    final Optional<Revision> rev = module.getRevision();
    final String fileName = !rev.isPresent() ? module.getName() : module.getName() + '@' + rev.get().toString();
    return loadDocument(prefix + '/' + fileName + YangConstants.RFC6020_YIN_FILE_EXTENSION);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:6,代码来源:YinExportTestUtils.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.getRevision方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。