本文整理汇总了Java中org.opendaylight.yangtools.yang.model.api.SchemaContext.findModuleByNamespaceAndRevision方法的典型用法代码示例。如果您正苦于以下问题:Java SchemaContext.findModuleByNamespaceAndRevision方法的具体用法?Java SchemaContext.findModuleByNamespaceAndRevision怎么用?Java SchemaContext.findModuleByNamespaceAndRevision使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opendaylight.yangtools.yang.model.api.SchemaContext
的用法示例。
在下文中一共展示了SchemaContext.findModuleByNamespaceAndRevision方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDefaultInstance
import org.opendaylight.yangtools.yang.model.api.SchemaContext; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public T createDefaultInstance(final FallbackConfigProvider fallback) throws ConfigXMLReaderException,
URISyntaxException, ParserConfigurationException, XMLStreamException, SAXException, IOException {
YangInstanceIdentifier yangPath = bindingSerializer.toYangInstanceIdentifier(bindingContext.appConfigPath);
LOG.debug("{}: Creating app config instance from path {}, Qname: {}", logName, yangPath,
bindingContext.bindingQName);
checkNotNull(schemaService, "%s: Could not obtain the SchemaService OSGi service", logName);
SchemaContext schemaContext = schemaService.getGlobalContext();
Module module = schemaContext.findModuleByNamespaceAndRevision(bindingContext.bindingQName.getNamespace(),
bindingContext.bindingQName.getRevision());
checkNotNull(module, "%s: Could not obtain the module schema for namespace %s, revision %s",
logName, bindingContext.bindingQName.getNamespace(), bindingContext.bindingQName.getRevision());
DataSchemaNode dataSchema = module.getDataChildByName(bindingContext.bindingQName);
checkNotNull(dataSchema, "%s: Could not obtain the schema for %s", logName, bindingContext.bindingQName);
checkCondition(bindingContext.schemaType.isAssignableFrom(dataSchema.getClass()),
"%s: Expected schema type %s for %s but actual type is %s", logName,
bindingContext.schemaType, bindingContext.bindingQName, dataSchema.getClass());
NormalizedNode<?, ?> dataNode = parsePossibleDefaultAppConfigXMLFile(schemaContext, dataSchema);
if (dataNode == null) {
dataNode = fallback.get(schemaService.getGlobalContext(), dataSchema);
}
DataObject appConfig = bindingSerializer.fromNormalizedNode(yangPath, dataNode).getValue();
// This shouldn't happen but need to handle it in case...
checkNotNull(appConfig, "%s: Could not create instance for app config binding %s", logName,
bindingContext.appConfigBindingClass);
return (T) appConfig;
}
示例2: decomposeRpcService
import org.opendaylight.yangtools.yang.model.api.SchemaContext; //导入方法依赖的package包/类
static Collection<SchemaPath> decomposeRpcService(final Class<RpcService> service,
final SchemaContext schemaContext, final Predicate<RpcRoutingStrategy> filter) {
final QNameModule moduleName = BindingReflections.getQNameModule(service);
final Module module = schemaContext.findModuleByNamespaceAndRevision(moduleName.getNamespace(),
moduleName.getRevision());
LOG.debug("Resolved service {} to module {}", service, module);
final Collection<RpcDefinition> rpcs = module.getRpcs();
final Collection<SchemaPath> ret = new ArrayList<>(rpcs.size());
for (RpcDefinition rpc : rpcs) {
final RpcRoutingStrategy strategy = RpcRoutingStrategy.from(rpc);
if (filter.test(strategy)) {
ret.add(rpc.getPath());
}
}
return ret;
}
示例3: findRpcDefinition
import org.opendaylight.yangtools.yang.model.api.SchemaContext; //导入方法依赖的package包/类
private static RpcDefinition findRpcDefinition(final SchemaContext context, final SchemaPath schemaPath) {
if (context != null) {
final QName qname = schemaPath.getPathFromRoot().iterator().next();
final Module module = context.findModuleByNamespaceAndRevision(qname.getNamespace(), qname.getRevision());
if (module != null && module.getRpcs() != null) {
for (RpcDefinition rpc : module.getRpcs()) {
if (qname.equals(rpc.getQName())) {
return rpc;
}
}
}
}
return null;
}