Propagate EffectiveModelContext in blueprint
[controller.git] / opendaylight / blueprint / src / main / java / org / opendaylight / controller / blueprint / ext / RpcImplementationBean.java
index 3144328c99566fa1da6fe158d841a8aef0f060a7..94d5b3b22f33ad2175823b2326aaaf6130b8a189 100644 (file)
@@ -11,8 +11,8 @@ import com.google.common.base.Strings;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
-import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.mdsal.binding.api.RpcProviderService;
+import org.opendaylight.yangtools.concepts.ObjectRegistration;
 import org.opendaylight.yangtools.yang.binding.RpcService;
 import org.osgi.framework.Bundle;
 import org.osgi.service.blueprint.container.ComponentDefinitionException;
@@ -29,25 +29,25 @@ public class RpcImplementationBean {
     private static final Logger LOG = LoggerFactory.getLogger(RpcImplementationBean.class);
     static final String RPC_IMPLEMENTATION = "rpc-implementation";
 
-    private RpcProviderRegistry rpcRegistry;
+    private RpcProviderService rpcProvider;
     private Bundle bundle;
     private String interfaceName;
     private RpcService implementation;
-    private final List<RpcRegistration<RpcService>> rpcRegistrations = new ArrayList<>();
+    private final List<ObjectRegistration<RpcService>> rpcRegistrations = new ArrayList<>();
 
-    public void setRpcRegistry(RpcProviderRegistry rpcRegistry) {
-        this.rpcRegistry = rpcRegistry;
+    public void setRpcProvider(final RpcProviderService rpcProvider) {
+        this.rpcProvider = rpcProvider;
     }
 
-    public void setBundle(Bundle bundle) {
+    public void setBundle(final Bundle bundle) {
         this.bundle = bundle;
     }
 
-    public void setInterfaceName(String interfaceName) {
+    public void setInterfaceName(final String interfaceName) {
         this.interfaceName = interfaceName;
     }
 
-    public void setImplementation(RpcService implementation) {
+    public void setImplementation(final RpcService implementation) {
         this.implementation = implementation;
     }
 
@@ -61,25 +61,26 @@ public class RpcImplementationBean {
                     implementation, rpcInterfaces);
 
             for (Class<RpcService> rpcInterface : rpcInterfaces) {
-                rpcRegistrations.add(rpcRegistry.addRpcImplementation(rpcInterface, implementation));
+                rpcRegistrations.add(rpcProvider.registerRpcImplementation(rpcInterface, implementation));
             }
-        } catch (ComponentDefinitionException e) {
+        } catch (final ComponentDefinitionException e) {
             throw e;
-        } catch (Exception e) {
+        } catch (final Exception e) {
             throw new ComponentDefinitionException(String.format(
                     "Error processing \"%s\" for %s", RPC_IMPLEMENTATION, implementation.getClass()), e);
         }
     }
 
     public void destroy() {
-        for (RpcRegistration<RpcService> reg: rpcRegistrations) {
+        for (ObjectRegistration<RpcService> reg: rpcRegistrations) {
             reg.close();
         }
     }
 
     @SuppressWarnings("unchecked")
-    static List<Class<RpcService>> getImplementedRpcServiceInterfaces(String interfaceName,
-            Class<?> implementationClass, Bundle bundle, String logName) throws ClassNotFoundException {
+    static List<Class<RpcService>> getImplementedRpcServiceInterfaces(final String interfaceName,
+            final Class<?> implementationClass, final Bundle bundle, final String logName)
+            throws ClassNotFoundException {
         if (!Strings.isNullOrEmpty(interfaceName)) {
             Class<?> rpcInterface = bundle.loadClass(interfaceName);