本文整理汇总了Java中org.opendaylight.yangtools.yang.model.api.Module.getName方法的典型用法代码示例。如果您正苦于以下问题:Java Module.getName方法的具体用法?Java Module.getName怎么用?Java Module.getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opendaylight.yangtools.yang.model.api.Module
的用法示例。
在下文中一共展示了Module.getName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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));
}
}
示例2: YangModuleCapability
import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
public YangModuleCapability(final Module module, final String moduleContent) {
super(toCapabilityURI(module));
this.content = moduleContent;
this.moduleName = module.getName();
this.moduleNamespace = module.getNamespace().toString();
this.revision = SimpleDateFormatUtil.getRevisionFormat().format(module.getRevision());
}
示例3: mapModulesByNames
import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
public static Map<String, Module> mapModulesByNames(
Collection<Module> modules) {
Map<String, Module> result = new HashMap<>();
for (Module m : modules) {
String moduleName = m.getName();
Preconditions.checkArgument(
result.containsKey(moduleName) == false,
"Two modules have same name " + moduleName);
result.put(moduleName, m);
}
return result;
}
示例4: findYangModuleName
import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
private String findYangModuleName(final QName qname, final SchemaContext schemaContext)
throws ConfigXMLReaderException {
for (Module m : schemaContext.getModules()) {
if (qname.getModule().equals(m.getQNameModule())) {
return m.getName();
}
}
throw new ConfigXMLReaderException(
String.format("%s: Could not find yang module for QName %s", logName, qname));
}
示例5: toCapabilityURI
import org.opendaylight.yangtools.yang.model.api.Module; //导入方法依赖的package包/类
private static String toCapabilityURI(final Module module) {
return String.valueOf(module.getNamespace()) + "?module="
+ module.getName() + "&revision=" + SimpleDateFormatUtil.getRevisionFormat().format(module.getRevision());
}
示例6: 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);
}
示例7: 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);
}
}
}