import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.common.collect.ImmutableBiMap;
+import com.google.common.collect.ImmutableList;
import java.lang.reflect.Method;
import java.util.Collection;
import java.util.stream.Collectors;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.RpcService;
+import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.ActionDefinition;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
return subtrees.stream().map(this::toDOMDataTreeIdentifier).collect(Collectors.toSet());
}
- @NonNull SchemaPath getActionPath(final @NonNull Class<? extends Action<?, ?, ?>> type) {
+ @NonNull Absolute getActionPath(final @NonNull Class<? extends Action<?, ?, ?>> type) {
+ // FIXME: we really just want a SchemaNodeIdentifier.Absolute here
final ActionDefinition schema = getRuntimeContext().getActionDefinition(type);
checkArgument(schema != null, "Failed to find schema for %s", type);
- return schema.getPath();
+ return Absolute.of(ImmutableList.copyOf(schema.getPath().getPathFromRoot()));
}
// FIXME: This should be probably part of Binding Runtime context
}
// FIXME: This should be probably part of Binding Runtime context
- ImmutableBiMap<Method, SchemaPath> getRpcMethodToSchemaPath(final Class<? extends RpcService> key) {
+ ImmutableBiMap<Method, QName> getRpcMethodToSchemaPath(final Class<? extends RpcService> key) {
final Module module = getModule(key);
- final ImmutableBiMap.Builder<Method, SchemaPath> ret = ImmutableBiMap.builder();
+ final ImmutableBiMap.Builder<Method, QName> ret = ImmutableBiMap.builder();
try {
for (final RpcDefinition rpcDef : module.getRpcs()) {
final Method method = findRpcMethod(key, rpcDef);
- ret.put(method, rpcDef.getPath());
+ ret.put(method,rpcDef.getQName());
}
} catch (final NoSuchMethodException e) {
throw new IllegalStateException("Rpc defined in model does not have representation in generated class.", e);