本文整理了Java中org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource.forFile()
方法的一些代码示例,展示了YangTextSchemaSource.forFile()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YangTextSchemaSource.forFile()
方法的具体详情如下:
包路径:org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource
类名称:YangTextSchemaSource
方法名:forFile
[英]Create a new YangTextSchemaSource backed by a File with SourceIdentifier derived from the file name.
[中]创建一个新的YangTextSchemaSource,该源由一个从文件名派生的SourceIdentifier文件支持。
代码示例来源:origin: opendaylight/yangtools
@Override
Collection<YangTextSchemaSource> sources() {
return ImmutableList.of(YangTextSchemaSource.forFile(file()));
}
}
代码示例来源:origin: opendaylight/yangtools
static SchemaContext parseYangSources(final Set<QName> supportedFeatures, final List<File> testFiles,
final List<File> libFiles) throws IOException, YangParserException {
checkArgument(!testFiles.isEmpty(), "No yang sources");
final YangParser parser = PARSER_FACTORY.createParser();
if (supportedFeatures != null) {
parser.setSupportedFeatures(supportedFeatures);
}
for (File file : testFiles) {
parser.addSource(YangTextSchemaSource.forFile(file));
}
for (File file : libFiles) {
parser.addLibSource(YangTextSchemaSource.forFile(file));
}
return parser.buildSchemaContext();
}
代码示例来源:origin: opendaylight/yangtools
final List<YangTextSchemaSource> sourcesInProject = new ArrayList<>(yangFilesInProject.size());
for (final File f : yangFilesInProject) {
final YangTextSchemaSource textSource = YangTextSchemaSource.forFile(f);
final ASTSchemaSource astSource = TextToASTTransformer.transformText(textSource);
代码示例来源: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);
}
}
内容来源于网络,如有侵权,请联系作者删除!