X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-dom-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fdom%2Fbroker%2Fimpl%2FRoutedRpcSelector.java;h=c8e3c0b6e0ca535e4e10ab464c47c2f00c8f220a;hp=a22aed7ab16aeea03fb5967f8b08572956ea9326;hb=33c9769f6dd0dadd68e460c8f6d76a06b43bf146;hpb=6500c7a216b78417e65cdf882d2b78de27736a97 diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/RoutedRpcSelector.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/RoutedRpcSelector.java index a22aed7ab1..c8e3c0b6e0 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/RoutedRpcSelector.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/RoutedRpcSelector.java @@ -8,7 +8,9 @@ package org.opendaylight.controller.sal.dom.broker.impl; import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkState; + +import com.google.common.collect.ImmutableSet; +import com.google.common.util.concurrent.ListenableFuture; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; @@ -22,18 +24,15 @@ import org.opendaylight.yangtools.concepts.Identifiable; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.RpcResult; import org.opendaylight.yangtools.yang.data.api.CompositeNode; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.SimpleNode; - -import com.google.common.collect.ImmutableSet; -import com.google.common.util.concurrent.ListenableFuture; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; class RoutedRpcSelector implements RpcImplementation, AutoCloseable, Identifiable { private final RpcRoutingStrategy strategy; private final Set supportedRpcs; private final RpcRoutingContext identifier; - final ConcurrentMap implementations = new ConcurrentHashMap<>(); + final ConcurrentMap implementations = new ConcurrentHashMap<>(); private final SchemaAwareRpcBroker router; public RoutedRpcSelector(final RpcRoutingStrategy strategy, final SchemaAwareRpcBroker router) { @@ -70,7 +69,7 @@ class RoutedRpcSelector implements RpcImplementation, AutoCloseable, Identifiabl SimpleNode routeContainer = inputContainer.getFirstSimpleByName(strategy.getLeaf()); checkArgument(routeContainer != null, "Leaf %s must be set with value", strategy.getLeaf()); Object route = routeContainer.getValue(); - checkArgument(route instanceof InstanceIdentifier, + checkArgument(route instanceof YangInstanceIdentifier, "The routed node %s is not an instance identifier", route); RpcImplementation potential = null; if (route != null) { @@ -80,13 +79,13 @@ class RoutedRpcSelector implements RpcImplementation, AutoCloseable, Identifiabl } } if (potential == null) { - return router.invokeRpc(rpc, (InstanceIdentifier) route, input); + return router.invokeRpc(rpc, (YangInstanceIdentifier) route, input); + } else { + return potential.invokeRpc(rpc, input); } - checkState(potential != null, "No implementation is available for rpc:%s path:%s", rpc, route); - return potential.invokeRpc(rpc, input); } - public void addPath(final QName context, final InstanceIdentifier path, final RoutedRpcRegImpl routedRpcRegImpl) { + public void addPath(final QName context, final YangInstanceIdentifier path, final RoutedRpcRegImpl routedRpcRegImpl) { //checkArgument(strategy.getContext().equals(context),"Supplied context is not supported."); RoutedRpcRegImpl previous = implementations.put(path, routedRpcRegImpl); if (previous == null) { @@ -95,7 +94,7 @@ class RoutedRpcSelector implements RpcImplementation, AutoCloseable, Identifiabl } - public void removePath(final QName context, final InstanceIdentifier path, final RoutedRpcRegImpl routedRpcRegImpl) { + public void removePath(final QName context, final YangInstanceIdentifier path, final RoutedRpcRegImpl routedRpcRegImpl) { boolean removed = implementations.remove(path, routedRpcRegImpl); if (removed) { router.notifyPathWithdrawal(context, strategy.getIdentifier(), path);