yang解析器库中的YangInferencePipeline移到了哪个包?

Which package the YangInferencePipeline in yang parser library has moved to?

我将我的 opendaylight yangtools 库升级到 6.0.3,代码因以下错误而中断:

import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline;
The import cannot be resolved

我不确定package/module YangInferencePipeline 移动到了哪个?它在代码中用于构建 schemaContext

CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();

更新库中的 rfc7950 等效调用应该是什么?已经在 https://javadoc.io/doc/org.opendaylight.yangtools/yangtools-docs/latest/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/package-summary.html 查找了 Javadoc,但找不到 class。 提前致谢。

This commit and this commit 消除 org.opendaylight.yangtools.yang.parser.stmt.rfc6020。请改用 DefaultReactors.defaultReactor().newBuild()

以下代码为最新型号7.0.14版本。确保您已更新 pom.xml

pom.xml

<dependency>
   <groupId>org.opendaylight.yangtools</groupId>
   <artifactId>yang-parser-impl</artifactId>
   <version>${opendaylight.yangtools.version}</version>
</dependency>
<dependency>
   <groupId>org.opendaylight.yangtools</groupId>
   <artifactId>yang-model-util</artifactId>
   <version>${opendaylight.yangtools.version}</version>
</dependency>

代码更改

String folderPath - yang file location
List<String> files - yang files retrived list

final CustomCrossSourceStatementReactorBuilder builder = RFC7950Reactors.defaultReactorBuilder();
final BuildAction buildAction = builder.build().newBuild();

for (final String fileName : files) {
    final File file = new File(folderPath.concat("" + File.separatorChar).concat(fileName));
    buildAction.addSource(YangStatementStreamSource.create(YangTextSchemaSource.forFile(file)));
}
final SchemaContext schemaContext = buildAction.buildEffective();
Collection<? extends Module> yangModules = schemaContext.getModules();