- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.opendaylight.yangtools.yang.parser.rfc7950.repo.YangStatementStreamSource
类的一些代码示例,展示了YangStatementStreamSource
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YangStatementStreamSource
类的具体详情如下:
包路径:org.opendaylight.yangtools.yang.parser.rfc7950.repo.YangStatementStreamSource
类名称:YangStatementStreamSource
[英]This class represents implementation of StatementStreamSource in order to emit YANG statements using supplied StatementWriter.
[中]此类表示StatementStreamSource的实现,以便使用提供的StatementWriter发出YANG语句。
代码示例来源:origin: org.opendaylight.yangtools/yang-parser-rfc7950
public static YangStatementStreamSource create(final SourceIdentifier identifier, final StatementContext context,
final String symbolicName) {
return new YangStatementStreamSource(identifier, context, symbolicName);
}
代码示例来源:origin: org.opendaylight.yangtools/yang-parser-rfc7950
@Override
public String toString() {
return MoreObjects.toStringHelper(this).add("identifier", getIdentifier()).toString();
}
}
代码示例来源:origin: org.opendaylight.yangtools/yang-parser-rfc7950
@Override
public void writeFull(final StatementWriter writer, final QNameToStatementDefinition stmtDef,
final PrefixToModule prefixes) {
writeFull(writer, stmtDef, prefixes, YangVersion.VERSION_1);
}
代码示例来源:origin: org.opendaylight.yangtools/yang-parser-rfc7950
/**
* Create a {@link YangStatementStreamSource} for a {@link ASTSchemaSource}.
*
* @param source YangTextSchemaSource, must not be null
* @return A new {@link YangStatementStreamSource}
*/
public static YangStatementStreamSource create(final ASTSchemaSource source) {
final ParserRuleContext ast = source.getAST();
checkArgument(ast instanceof StatementContext,
"Unsupported context class %s for source %s", ast.getClass(), source.getIdentifier());
return create(source.getIdentifier(), (StatementContext) ast, source.getSymbolicName().orElse(null));
}
代码示例来源:origin: org.opendaylight.yangtools/yang-parser-rfc7950
/**
* Extracts {@link YangModelDependencyInfo} from input stream containing a YANG model. This parsing does not
* validate full YANG module, only parses header up to the revisions and imports.
*
* @param refClass Base search class
* @param resourceName resource name, relative to refClass
* @return {@link YangModelDependencyInfo}
* @throws YangSyntaxErrorException If the resource does not pass syntactic analysis
* @throws IOException When the resource cannot be read
* @throws IllegalArgumentException
* If input stream is not valid YANG stream
*/
@VisibleForTesting
public static YangModelDependencyInfo forResource(final Class<?> refClass, final String resourceName)
throws IOException, YangSyntaxErrorException {
final YangStatementStreamSource source = YangStatementStreamSource.create(
YangTextSchemaSource.forResource(refClass, resourceName));
final ParserRuleContext ast = source.getYangAST();
checkArgument(ast instanceof StatementContext);
return parseAST((StatementContext) ast, source.getIdentifier());
}
代码示例来源:origin: org.opendaylight.yangtools/yang-parser-rfc7950
public static ASTSchemaSource transformText(final YangTextSchemaSource text) throws SchemaSourceException,
IOException, YangSyntaxErrorException {
final YangStatementStreamSource src = YangStatementStreamSource.create(text);
final ParserRuleContext ctx = src.getYangAST();
LOG.debug("Model {} parsed successfully", text);
// TODO: missing validation (YangModelBasicValidationListener should be re-implemented to new parser)
return ASTSchemaSource.create(text.getIdentifier(), text.getSymbolicName().orElse(null), ctx);
}
}
代码示例来源:origin: org.opendaylight.yangtools/yang-parser-rfc7950
/**
* Create a {@link YangStatementStreamSource} for a {@link YangTextSchemaSource}.
*
* @param source YangTextSchemaSource, must not be null
* @return A new {@link YangStatementStreamSource}
* @throws IOException When we fail to read the source
* @throws YangSyntaxErrorException If the source fails basic parsing
*/
public static YangStatementStreamSource create(final YangTextSchemaSource source) throws IOException,
YangSyntaxErrorException {
final StatementContext context;
try (InputStream stream = source.openStream()) {
context = parseYangSource(source.getIdentifier(), stream);
}
return new YangStatementStreamSource(source.getIdentifier(), context, source.getSymbolicName().orElse(null));
}
代码示例来源:origin: org.opendaylight.yangtools/yang-parser-rfc7950
@Override
public void writeLinkageAndStatementDefinitions(final StatementWriter writer,
final QNameToStatementDefinition stmtDef, final PrefixToModule prefixes) {
writeLinkageAndStatementDefinitions(writer, stmtDef, prefixes, YangVersion.VERSION_1);
}
代码示例来源:origin: org.opendaylight.yangtools/yang-parser-rfc7950
@Override
public void writeLinkage(final StatementWriter writer, final QNameToStatementDefinition stmtDef,
final PrefixToModule preLinkagePrefixes) {
writeLinkage(writer, stmtDef, preLinkagePrefixes, YangVersion.VERSION_1);
}
代码示例来源:origin: org.onap.ccsdk.sli.plugins/restconf-client-provider
/**
* Returns the schema context of the YANG files present in a directory.
*
* @param di directory path
* @return YANG schema context
* @throws SvcLogicException when YANG file reading fails
*/
static SchemaContext getSchemaCtxFromDir(String di)
throws SvcLogicException {
Path d = Paths.get(di);
File dir = d.toFile();
List<File> yangFiles = new LinkedList<>();
getYangFiles(dir, yangFiles);
final Collection<YangStatementStreamSource> sources =
new ArrayList<>(yangFiles.size());
for (File file : yangFiles) {
try {
sources.add(create(forFile(file)));
} catch (IOException | YangSyntaxErrorException e) {
throw new SvcLogicException(YANG_FILE_ERR + e.getMessage(), e);
}
}
final CrossSourceStatementReactor.BuildAction reactor = defaultReactor()
.newBuild(DEFAULT_MODE).addSources(sources);
try {
return reactor.buildEffective();
} catch (ReactorException e) {
throw new SvcLogicException(YANG_FILE_ERR + e.getMessage(), e);
}
}
代码示例来源:origin: org.opendaylight.yangtools/yang-parser-impl
private static StatementStreamSource sourceToStatementStream(final SchemaSourceRepresentation source)
throws IOException, YangSyntaxErrorException {
requireNonNull(source);
if (source instanceof ASTSchemaSource) {
return YangStatementStreamSource.create((ASTSchemaSource) source);
} else if (source instanceof YangTextSchemaSource) {
return YangStatementStreamSource.create((YangTextSchemaSource) source);
} else if (source instanceof YinDomSchemaSource) {
return YinStatementStreamSource.create((YinDomSchemaSource) source);
} else if (source instanceof YinTextSchemaSource) {
try {
return YinStatementStreamSource.create(YinTextToDomTransformer.transformSource(
(YinTextSchemaSource) source));
} catch (SAXException e) {
throw new YangSyntaxErrorException(source.getIdentifier(), 0, 0, "Failed to parse XML text", e);
}
} else if (source instanceof YinXmlSchemaSource) {
try {
return YinStatementStreamSource.create((YinXmlSchemaSource) source);
} catch (TransformerException e) {
throw new YangSyntaxErrorException(source.getIdentifier(), 0, 0,
"Failed to assemble in-memory representation", e);
}
} else {
throw new IllegalArgumentException("Unsupported source " + source);
}
}
}
代码示例来源:origin: opendaylight/yangtools
private static StatementStreamSource sourceToStatementStream(final SchemaSourceRepresentation source)
throws IOException, YangSyntaxErrorException {
requireNonNull(source);
if (source instanceof ASTSchemaSource) {
return YangStatementStreamSource.create((ASTSchemaSource) source);
} else if (source instanceof YangTextSchemaSource) {
return YangStatementStreamSource.create((YangTextSchemaSource) source);
} else if (source instanceof YinDomSchemaSource) {
return YinStatementStreamSource.create((YinDomSchemaSource) source);
} else if (source instanceof YinTextSchemaSource) {
try {
return YinStatementStreamSource.create(YinTextToDomTransformer.transformSource(
(YinTextSchemaSource) source));
} catch (SAXException e) {
throw new YangSyntaxErrorException(source.getIdentifier(), 0, 0, "Failed to parse XML text", e);
}
} else if (source instanceof YinXmlSchemaSource) {
try {
return YinStatementStreamSource.create((YinXmlSchemaSource) source);
} catch (TransformerException e) {
throw new YangSyntaxErrorException(source.getIdentifier(), 0, 0,
"Failed to assemble in-memory representation", e);
}
} else {
throw new IllegalArgumentException("Unsupported source " + source);
}
}
}
代码示例来源:origin: org.opendaylight.yangtools/yang-parser-impl
parserRuleCtx.getClass(), e.getKey());
reactor.addSource(YangStatementStreamSource.create(e.getKey(), (StatementContext) parserRuleCtx,
ast.getSymbolicName().orElse(null)));
代码示例来源:origin: opendaylight/yangtools
parserRuleCtx.getClass(), e.getKey());
reactor.addSource(YangStatementStreamSource.create(e.getKey(), (StatementContext) parserRuleCtx,
ast.getSymbolicName().orElse(null)));
本文整理了Java中org.opendaylight.yangtools.yang.parser.rfc7950.repo.YangStatementStreamSource.create()方法的一
我是一名优秀的程序员,十分优秀!