Fixed class-cast when Netconf registered RPC implementations. 32/9032/1
authorTony Tkacik <ttkacik@cisco.com>
Tue, 15 Jul 2014 16:43:02 +0000 (18:43 +0200)
committerTony Tkacik <ttkacik@cisco.com>
Tue, 15 Jul 2014 16:43:02 +0000 (18:43 +0200)
Change-Id: I0803f7ec0d23bcf195c2fbac49e916c4f30110e1
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/DomToBindingRpcForwarder.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/DomToBindingRpcForwardingManager.java

index 620290c..ffcab59 100644 (file)
@@ -3,11 +3,6 @@ package org.opendaylight.controller.sal.binding.impl.connect.dom;
 import static com.google.common.base.Preconditions.checkArgument;
 import static com.google.common.base.Preconditions.checkState;
 
-import com.google.common.base.Function;
-import com.google.common.collect.FluentIterable;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
 import java.lang.ref.WeakReference;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
@@ -17,6 +12,7 @@ import java.util.Map;
 import java.util.Set;
 import java.util.WeakHashMap;
 import java.util.concurrent.Callable;
+
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
 import org.opendaylight.controller.sal.binding.api.rpc.RpcRouter;
 import org.opendaylight.controller.sal.binding.impl.RpcProviderRegistryImpl;
@@ -25,14 +21,13 @@ import org.opendaylight.controller.sal.core.api.RpcImplementation;
 import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry;
 import org.opendaylight.yangtools.concepts.CompositeObjectRegistration;
 import org.opendaylight.yangtools.concepts.ObjectRegistration;
-
 import org.opendaylight.yangtools.yang.binding.BaseIdentity;
+import org.opendaylight.yangtools.yang.binding.BindingMapping;
 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.binding.util.BindingReflections;
 import org.opendaylight.yangtools.yang.binding.util.ClassLoaderUtils;
-import org.opendaylight.yangtools.yang.binding.BindingMapping;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
@@ -40,6 +35,12 @@ import org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMapping
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.base.Function;
+import com.google.common.collect.FluentIterable;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+
 class DomToBindingRpcForwarder implements RpcImplementation, InvocationHandler {
 
     private final Logger LOG = LoggerFactory.getLogger(DomToBindingRpcForwarder.class);
@@ -70,7 +71,7 @@ class DomToBindingRpcForwarder implements RpcImplementation, InvocationHandler {
     }
 
     public DomToBindingRpcForwarder(final Class<? extends RpcService> service, final BindingIndependentMappingService mappingService,
-        final RpcProvisionRegistry biRpcRegistry, final RpcProviderRegistry baRpcRegistry) {
+        final RpcProvisionRegistry biRpcRegistry, final RpcProviderRegistry baRpcRegistry, final RpcProviderRegistryImpl registryImpl) {
         this.rpcServiceType = new WeakReference<Class<? extends RpcService>>(service);
         this.supportedRpcs = mappingService.getRpcQNamesFor(service);
 
@@ -84,7 +85,7 @@ class DomToBindingRpcForwarder implements RpcImplementation, InvocationHandler {
 
         this.biRpcRegistry = biRpcRegistry;
         this.baRpcRegistry = baRpcRegistry;
-        baRpcRegistryImpl = (RpcProviderRegistryImpl) baRpcRegistry;
+        this.baRpcRegistryImpl = registryImpl;
 
         Class<?> cls = rpcServiceType.get();
         ClassLoader clsLoader = cls.getClassLoader();
@@ -97,11 +98,12 @@ class DomToBindingRpcForwarder implements RpcImplementation, InvocationHandler {
      *
      * @param service
      * @param context
+     * @param registryImpl
      */
     public DomToBindingRpcForwarder(final Class<? extends RpcService> service,
         final Class<? extends BaseIdentity> context, final BindingIndependentMappingService mappingService,
-        final RpcProvisionRegistry biRpcRegistry, final RpcProviderRegistry baRpcRegistry) {
-        this(service, mappingService, biRpcRegistry, baRpcRegistry);
+        final RpcProvisionRegistry biRpcRegistry, final RpcProviderRegistry baRpcRegistry, final RpcProviderRegistryImpl registryImpl) {
+        this(service, mappingService, biRpcRegistry, baRpcRegistry,registryImpl);
 
         final ImmutableSet.Builder<Broker.RoutedRpcRegistration> registrationsBuilder = ImmutableSet.builder();
         try {
index 04495f7..63d4b71 100644 (file)
@@ -1,9 +1,9 @@
 package org.opendaylight.controller.sal.binding.impl.connect.dom;
 
-import com.google.common.base.Optional;
 import java.util.Map;
 import java.util.Set;
 import java.util.WeakHashMap;
+
 import org.opendaylight.controller.md.sal.common.api.routing.RouteChange;
 import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
@@ -18,6 +18,8 @@ import org.opendaylight.yangtools.yang.binding.RpcService;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMappingService;
 
+import com.google.common.base.Optional;
+
 /**
  * Manager responsible for instantiating forwarders responsible for
  * forwarding of RPC invocations from DOM Broker to Binding Aware Broker
@@ -87,9 +89,9 @@ class DomToBindingRpcForwardingManager implements
             return potential;
         }
         if (context == null) {
-            potential = new DomToBindingRpcForwarder(service, mappingService, biRpcRegistry, baRpcRegistry);
+            potential = new DomToBindingRpcForwarder(service, mappingService, biRpcRegistry, baRpcRegistry,registryImpl);
         } else {
-            potential = new DomToBindingRpcForwarder(service, context, mappingService, biRpcRegistry, baRpcRegistry);
+            potential = new DomToBindingRpcForwarder(service, context, mappingService, biRpcRegistry, baRpcRegistry,registryImpl);
         }
 
         forwarders.put(service, potential);

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.