org.opendaylight.yangtools.yang.model.api.Module.getNamespace()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(84)

本文整理了Java中org.opendaylight.yangtools.yang.model.api.Module.getNamespace()方法的一些代码示例,展示了Module.getNamespace()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Module.getNamespace()方法的具体详情如下:
包路径:org.opendaylight.yangtools.yang.model.api.Module
类名称:Module
方法名:getNamespace

Module.getNamespace介绍

[英]Returns the namespace of the module which is specified as argument of YANG Modulekeyword. If you need both namespace and revision, please consider using #getQNameModule().
[中]返回模块的名称空间,该名称空间被指定为Modulekeyword的参数。如果您需要两个命名空间和修订版,请考虑使用y.GETQNAMEMODULE()。

代码示例

代码示例来源:origin: org.opendaylight.controller/sal-rest-connector

public URI findNamespaceByModuleName(final String moduleName) {
  final Module module = this.findModuleByName(moduleName);
  return module == null ? null : module.getNamespace();
}

代码示例来源:origin: org.opendaylight.controller/sal-rest-connector

public URI findNamespaceByModuleName(final DOMMountPoint mountPoint, final String moduleName) {
  final Module module = this.findModuleByName(mountPoint, moduleName);
  return module == null ? null : module.getNamespace();
}

代码示例来源:origin: org.opendaylight.yangtools/yang-model-export

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");
}

代码示例来源:origin: opendaylight/yangtools

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");
}

代码示例来源:origin: org.opendaylight.yangtools/yang-model-api

/**
 * Returns module instance (from the context) with concrete namespace. Returned Set is required to have its
 * iteration order guarantee that the latest revision is encountered first.
 *
 * @param namespace
 *            URI instance with specified namespace
 * @return module instance which has namespace equal to the
 *         <code>namespace</code> or <code>null</code> in other cases
 */
default Set<Module> findModules(final URI namespace) {
  return Sets.filter(getModules(), m -> namespace.equals(m.getNamespace()));
}

代码示例来源:origin: opendaylight/yangtools

/**
 * Returns module instance (from the context) with concrete namespace. Returned Set is required to have its
 * iteration order guarantee that the latest revision is encountered first.
 *
 * @param namespace
 *            URI instance with specified namespace
 * @return module instance which has namespace equal to the
 *         <code>namespace</code> or <code>null</code> in other cases
 */
default Set<Module> findModules(final URI namespace) {
  return Sets.filter(getModules(), m -> namespace.equals(m.getNamespace()));
}

代码示例来源:origin: org.opendaylight.controller/yang-jmx-generator

public static QName getQName(final Module currentModule) {
    return QName.create(currentModule.getNamespace(), currentModule.getRevision(), currentModule.getName());
  }
}

代码示例来源:origin: org.opendaylight.yangtools/binding-generator-impl

public static String writeIdentityNs(final IdentitySchemaNode identity) {
 boolean _equals = Objects.equal(YangTemplate.module, null);
 if (_equals) {
  return "";
 }
 QName _qName = identity.getQName();
 final URI identityNs = _qName.getNamespace();
 URI _namespace = YangTemplate.module.getNamespace();
 boolean _equals_1 = _namespace.equals(identityNs);
 boolean _not = (!_equals_1);
 if (_not) {
  return (identityNs + ":");
 }
 return "";
}

代码示例来源:origin: org.opendaylight.controller/config-util

private static String toCapabilityURI(final Module module) {
  return String.valueOf(module.getNamespace()) + "?module="
      + module.getName() + "&revision=" + SimpleDateFormatUtil.getRevisionFormat().format(module.getRevision());
}

代码示例来源:origin: org.opendaylight.controller/sal-rest-connector

@Override
public QName deserialize(final IdentityValuesDTO data) {
  final IdentityValue valueWithNamespace = data.getValuesWithNamespaces().get(0);
  final Module module = getModuleByNamespace(valueWithNamespace.getNamespace(), mountPoint);
  if (module == null) {
    logger.info("Module was not found for namespace {}", valueWithNamespace.getNamespace());
    logger.info("Idenetityref will be translated as NULL for data - {}", String.valueOf(valueWithNamespace));
    return null;
  }
  return QName.create(module.getNamespace(), module.getRevision(), valueWithNamespace.getValue());
}

代码示例来源:origin: org.opendaylight.controller/netconf-util

private static String toCapabilityURI(final Module module) {
  return String.valueOf(module.getNamespace()) + "?module="
      + module.getName() + "&revision=" + SimpleDateFormatUtil.getRevisionFormat().format(module.getRevision());
}

代码示例来源:origin: org.opendaylight.controller/config-netconf-connector

@Override
  public boolean apply(final Module input) {
    final ModuleIdentifierImpl id = new ModuleIdentifierImpl(input.getName(), Optional.fromNullable(input.getNamespace()), Optional.fromNullable(input.getRevision()));
    return id.equals(moduleIdentifier);
  }
}).getSource();

代码示例来源:origin: org.opendaylight.yangtools/yang-model-export

private static Map<String, URI> prefixToNamespace(final SchemaContext ctx, final Module module) {
  final BiMap<String, URI> prefixMap = HashBiMap.create(module.getImports().size() + 1);
  prefixMap.put(module.getPrefix(), module.getNamespace());
  for (final ModuleImport imp : module.getImports()) {
    final String prefix = imp.getPrefix();
    final URI namespace = getModuleNamespace(ctx, imp.getModuleName());
    prefixMap.put(prefix, namespace);
  }
  return prefixMap;
}

代码示例来源:origin: org.opendaylight.controller/config-util

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());
}

代码示例来源:origin: org.opendaylight.controller/netconf-util

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());
}

代码示例来源:origin: opendaylight/yangtools

private static Map<String, URI> prefixToNamespace(final SchemaContext ctx, final Module module) {
  final BiMap<String, URI> prefixMap = HashBiMap.create(module.getImports().size() + 1);
  prefixMap.put(module.getPrefix(), module.getNamespace());
  for (final ModuleImport imp : module.getImports()) {
    final String prefix = imp.getPrefix();
    final URI namespace = getModuleNamespace(ctx, imp.getModuleName());
    prefixMap.put(prefix, namespace);
  }
  return prefixMap;
}

代码示例来源:origin: org.opendaylight.yangtools/yang-model-export

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);
}

代码示例来源:origin: org.opendaylight.yangtools/yang-model-export

private void emitModuleHeader(final Module input) {
  emitYangVersionNode(input.getYangVersion());
  emitNamespace(input.getNamespace());
  emitPrefixNode(input.getPrefix());
}

代码示例来源:origin: org.opendaylight.netconf/mdsal-netconf-yang-library

private org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev160409.module.list.Module createModuleEntryFromModule(final Module module) {
  final ModuleBuilder moduleBuilder = new ModuleBuilder();
  // TODO Conformance type is always set to Implement value, but it should it really be like this?
  // TODO Add also deviations and features lists to module entries
  moduleBuilder.setName(new YangIdentifier(module.getName()))
      .setRevision(new OptionalRevision(SimpleDateFormatUtil.getRevisionFormat().format(module.getRevision())))
      .setNamespace(new Uri(module.getNamespace().toString()))
      .setConformanceType(ConformanceType.Implement)
      .setSubmodules(createSubmodulesForModule(module));
  return moduleBuilder.build();
}

代码示例来源:origin: org.onap.ccsdk.sli.plugins/restconf-client-provider

private RootNode createRootNode(String lastNodeName, String rootUri) {
  Module m = SchemaContextUtil.findParentModule(schemaCtx(), curSchema);
  Namespace ns = new Namespace(m.getName(), m.getNamespace(),
                 getRevision(m.getRevision()));
  return new RootNode(lastNodeName, ns, schemaNode(), rootUri);
}

相关文章