本文整理汇总了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);
}
示例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");
}
示例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);
}
示例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);
}
}
}