Remove pce-blueprint.xml file
[transportpce.git] / pce / src / main / java / org / opendaylight / transportpce / pce / impl / PceProvider.java
old mode 100755 (executable)
new mode 100644 (file)
index c3d27b3..bab1554
@@ -7,10 +7,14 @@
  */
 package org.opendaylight.transportpce.pce.impl;
 
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
-import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.mdsal.binding.api.RpcProviderService;
 import org.opendaylight.transportpce.pce.service.PathComputationService;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev171017.TransportpcePceService;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.TransportpcePceService;
+import org.opendaylight.yangtools.concepts.ObjectRegistration;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+import org.osgi.service.component.annotations.Reference;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -18,34 +22,29 @@ import org.slf4j.LoggerFactory;
  * Class to register
  * Pce Service & Notification.
  */
+@Component
 public class PceProvider {
 
     private static final Logger LOG = LoggerFactory.getLogger(PceProvider.class);
 
-    private final RpcProviderRegistry rpcRegistry;
-    private final PathComputationService pathComputationService;
-    private BindingAwareBroker.RpcRegistration<TransportpcePceService> rpcRegistration;
+    private final RpcProviderService rpcService;
+    private ObjectRegistration<PceServiceRPCImpl> rpcRegistration;
 
-    public PceProvider(RpcProviderRegistry rpcProviderRegistry, PathComputationService pathComputationService) {
-        this.rpcRegistry = rpcProviderRegistry;
-        this.pathComputationService = pathComputationService;
-    }
-
-    /*
-     * Method called when the blueprint container is created.
-     */
-    public void init() {
+    @Activate
+    public PceProvider(@Reference RpcProviderService rpcProviderService,
+            @Reference PathComputationService pathComputationService) {
+        this.rpcService = rpcProviderService;
         LOG.info("PceProvider Session Initiated");
         final PceServiceRPCImpl consumer = new PceServiceRPCImpl(pathComputationService);
-        rpcRegistration = rpcRegistry.addRpcImplementation(TransportpcePceService.class, consumer);
+        rpcRegistration = rpcService.registerRpcImplementation(TransportpcePceService.class, consumer);
     }
 
     /*
      * Method called when the blueprint container is destroyed.
      */
+    @Deactivate
     public void close() {
         LOG.info("PceProvider Closed");
         rpcRegistration.close();
     }
-
 }