gpt4 book ai didi

org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource.delegateForByteSource()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-16 08:08:40 25 4
gpt4 key购买 nike

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

YangTextSchemaSource.delegateForByteSource介绍

[英]Create a new YangTextSchemaSource with SourceIdentifier derived from a supplied filename and backed by ByteSource, which provides the actual InputStreams.
[中]创建一个新的YangTextSchemaSource,其SourceIdentifier源自提供的文件名,并由ByteSource支持,后者提供实际的InputStreams。

代码示例

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

private static YangTextSchemaSource toYangTextSource(final SourceIdentifier identifier,
    final YangModuleInfo moduleInfo) {
  return YangTextSchemaSource.delegateForByteSource(identifier, moduleInfo.getYangTextByteSource());
}

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

@Override
  Collection<YangTextSchemaSource> sources() throws IOException {
    final Collection<YangTextSchemaSource> result = new ArrayList<>(entryNames.size());
    try (ZipFile zip = new ZipFile(file())) {
      for (String entryName : entryNames) {
        final ZipEntry entry = requireNonNull(zip.getEntry(entryName));
        result.add(YangTextSchemaSource.delegateForByteSource(
          entryName.substring(entryName.lastIndexOf('/') + 1),
          ByteSource.wrap(ByteStreams.toByteArray(zip.getInputStream(entry)))));
      }
    }
    return result;
  }
}

代码示例来源:origin: org.opendaylight.controller/sal-clustering-commons

public YangTextSchemaSource getRepresentation() {
    return YangTextSchemaSource.delegateForByteSource(RevisionSourceIdentifier.create(name, Optional.of(revision)),
      ByteSource.wrap(schemaSource));
  }
}

代码示例来源:origin: org.opendaylight.mdsal/mdsal-binding2-runtime

@Override
public ListenableFuture<? extends YangTextSchemaSource> getSource(
  final SourceIdentifier sourceIdentifier) {
  final YangModuleInfo yangModuleInfo = sourceIdentifierToModuleInfo.get(sourceIdentifier);
  if (yangModuleInfo == null) {
    LOG.debug("Unknown schema source requested: {}, available sources: {}", sourceIdentifier,
      sourceIdentifierToModuleInfo.keySet());
    return Futures.immediateFailedFuture(new SchemaSourceException("Unknown schema source: "
      + sourceIdentifier));
  }
  return Futures.immediateFuture(YangTextSchemaSource.delegateForByteSource(sourceIdentifier, new ByteSource() {
    @Override
    public InputStream openStream() throws IOException {
      return yangModuleInfo.getModuleSourceStream();
    }
  }));
}

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

@Override
public ListenableFuture<? extends YangTextSchemaSource> getSource(
  final SourceIdentifier sourceIdentifier) {
  final YangModuleInfo yangModuleInfo = sourceIdentifierToModuleInfo.get(sourceIdentifier);
  if (yangModuleInfo == null) {
    LOG.debug("Unknown schema source requested: {}, available sources: {}", sourceIdentifier,
      sourceIdentifierToModuleInfo.keySet());
    return Futures.immediateFailedFuture(new SchemaSourceException(
      "Unknown schema source: " + sourceIdentifier));
  }
  return Futures.immediateFuture(YangTextSchemaSource.delegateForByteSource(sourceIdentifier,
    yangModuleInfo.getYangTextByteSource()));
}

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

public YangTextSchemaSource getRepresentation() {
    return YangTextSchemaSource.delegateForByteSource(
        RevisionSourceIdentifier.create(name, revision), ByteSource.wrap(schemaSource));
  }
}

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

sourcesInProject.add(YangTextSchemaSource.delegateForByteSource(astSource.getIdentifier(),
    textSource));
} else {

代码示例来源:origin: org.opendaylight.yangtools/yang-parser-impl

text = YangTextSchemaSource.delegateForByteSource(parsedId, source);
} else {
  text = source;

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

text = YangTextSchemaSource.delegateForByteSource(parsedId, source);
} else {
  text = source;

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

@Before
public void setUp() {
  String source = "Test source.";
  schemaSource = YangTextSchemaSource.delegateForByteSource(
      RevisionSourceIdentifier.create("test", Revision.of("2015-10-30")),
      ByteSource.wrap(source.getBytes(StandardCharsets.UTF_8)));
}

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

@Test
public void getExistingYangTextSchemaSource() throws IOException, SchemaSourceException {
  String source = "Test";
  YangTextSchemaSource schemaSource = YangTextSchemaSource.delegateForByteSource(
      ID, ByteSource.wrap(source.getBytes()));
  YangTextSchemaSourceSerializationProxy sourceProxy = new YangTextSchemaSourceSerializationProxy(schemaSource);
  Mockito.when(mockedRemoteSchemaRepository.getYangTextSchemaSource(ID))
    .thenReturn(Futures.successful(sourceProxy));
  YangTextSchemaSource providedSource = remoteSchemaProvider.getSource(ID).checkedGet();
  assertEquals(providedSource.getIdentifier(), ID);
  assertArrayEquals(providedSource.read(), schemaSource.read());
}

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

@Test
public void testGetExistingYangTextSchemaSource() throws Exception {
  String source = "Test source.";
  YangTextSchemaSource schemaSource = YangTextSchemaSource.delegateForByteSource(
      ID, ByteSource.wrap(source.getBytes()));
  Mockito.when(mockedLocalRepository.getSchemaSource(ID, YangTextSchemaSource.class)).thenReturn(
      Futures.immediateCheckedFuture(schemaSource));
  Future<YangTextSchemaSourceSerializationProxy> retrievedSourceFuture =
      remoteRepository.getYangTextSchemaSource(ID);
  assertTrue(retrievedSourceFuture.isCompleted());
  YangTextSchemaSource resultSchemaSource = Await.result(retrievedSourceFuture,
      FiniteDuration.Zero()).getRepresentation();
  assertEquals(resultSchemaSource.getIdentifier(), schemaSource.getIdentifier());
  assertArrayEquals(resultSchemaSource.read(), schemaSource.read());
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com