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

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

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

Module.getSource介绍

暂无

代码示例

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

private static Optional<YangModuleCapability> moduleToCapability(final Module module) {
  final String source = module.getSource();
  if(source !=null) {
    return Optional.of(new YangModuleCapability(module, source));
  } else {
    LOG.warn("Missing source for module {}. This module will not be available from netconf server",
        module);
  }
  return Optional.absent();
}

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

@Override
  public Capability apply(final Module module) {
    return new YangModuleCapability(module, module.getSource());
  }
};

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

@Override
  public void writeTo(final SchemaExportContext t, final Class<?> type, final Type genericType,
      final Annotation[] annotations, final MediaType mediaType,
      final MultivaluedMap<String, Object> httpHeaders, final OutputStream entityStream) throws IOException,
      WebApplicationException {
    final PrintWriter writer = new PrintWriter(entityStream);
    writer.write(t.getModule().getSource());

  }
}

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

@Override
public String getModuleSource(final org.opendaylight.yangtools.yang.model.api.ModuleIdentifier moduleIdentifier) {
  final Optional<String> moduleSource = schemaContext.getModuleSource(moduleIdentifier);
  if(moduleSource.isPresent()) {
    return moduleSource.get();
  } else {
    try {
      return Iterables.find(getModules(), new Predicate<Module>() {
        @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();
    } catch (final NoSuchElementException e) {
      throw new IllegalArgumentException("Source for yang module " + moduleIdentifier + " not found", e);
    }
  }
}

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

@Override
  public Uri apply(final Module input) {
    return new Uri(new YangModuleCapability(input, input.getSource()).getCapabilityUri());
  }
};

相关文章