Search in sources :

Example 1 with QNameModule

use of org.opendaylight.yangtools.yang.common.QNameModule in project controller by opendaylight.

the class RpcUtil method decomposeRpcService.

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.findModule(moduleName).get();
    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;
}
Also used : RpcRoutingStrategy(org.opendaylight.controller.md.sal.dom.broker.spi.rpc.RpcRoutingStrategy) RpcDefinition(org.opendaylight.yangtools.yang.model.api.RpcDefinition) SchemaPath(org.opendaylight.yangtools.yang.model.api.SchemaPath) ArrayList(java.util.ArrayList) QNameModule(org.opendaylight.yangtools.yang.common.QNameModule) Module(org.opendaylight.yangtools.yang.model.api.Module) QNameModule(org.opendaylight.yangtools.yang.common.QNameModule)

Example 2 with QNameModule

use of org.opendaylight.yangtools.yang.common.QNameModule in project controller by opendaylight.

the class BindingToNormalizedNodeCodec method getModuleBlocking.

private Module getModuleBlocking(final Class<?> modeledClass) {
    final QNameModule moduleName = BindingReflections.getQNameModule(modeledClass);
    Module module = runtimeContext().getSchemaContext().findModule(moduleName).orElse(null);
    if (module == null && this.futureSchema.waitForSchema(moduleName)) {
        module = runtimeContext().getSchemaContext().findModule(moduleName).orElse(null);
    }
    Preconditions.checkState(module != null, "Schema for %s is not available.", modeledClass);
    return module;
}
Also used : QNameModule(org.opendaylight.yangtools.yang.common.QNameModule) QNameModule(org.opendaylight.yangtools.yang.common.QNameModule) Module(org.opendaylight.yangtools.yang.model.api.Module)

Aggregations

QNameModule (org.opendaylight.yangtools.yang.common.QNameModule)2 Module (org.opendaylight.yangtools.yang.model.api.Module)2 ArrayList (java.util.ArrayList)1 RpcRoutingStrategy (org.opendaylight.controller.md.sal.dom.broker.spi.rpc.RpcRoutingStrategy)1 RpcDefinition (org.opendaylight.yangtools.yang.model.api.RpcDefinition)1 SchemaPath (org.opendaylight.yangtools.yang.model.api.SchemaPath)1