ServiceHandler update for new PCE compatibility
[transportpce.git] / servicehandler / src / main / java / org / opendaylight / transportpce / servicehandler / impl / ServicehandlerProvider.java
index 29e838d16d1047921735fc94e1e7f1c50d94d967..250c5ee83abf9239d61d6bda2844d46508810d94 100644 (file)
@@ -9,13 +9,14 @@
 package org.opendaylight.transportpce.servicehandler.impl;
 
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
 import org.opendaylight.controller.md.sal.binding.api.NotificationService;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev161014.ServicehandlerService;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.StubpceListener;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.StubrendererListener;
+import org.opendaylight.transportpce.pce.service.PathComputationService;
+import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
+import org.opendaylight.transportpce.servicehandler.listeners.PceListenerImpl;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev170426.PceListener;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.OrgOpenroadmServiceService;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -33,22 +34,19 @@ public class ServicehandlerProvider {
     private final DataBroker dataBroker;
     private final RpcProviderRegistry rpcRegistry;
     private final NotificationService notificationService;
-    private final NotificationPublishService notificationPublishService;
-
-    //private ListenerRegistration<ServicehandlerListener> ServicehandlerlistenerRegistration;
-    /* Listener register for StubPce Notification. */
-    private ListenerRegistration<StubpceListener> stubPcelistenerRegistration;
-    /* Listener register for StubRender Notification. */
-    private ListenerRegistration<StubrendererListener> stubRendererlistenerRegistration;
-    private RpcRegistration<ServicehandlerService> rpcRegistration;
-
+    private ListenerRegistration<PceListener> pcelistenerRegistration;
+    private RpcRegistration<OrgOpenroadmServiceService> rpcRegistration;
+    private PathComputationService pathComputationService;
+    private RendererServiceOperations rendererServiceOperations;
 
     public ServicehandlerProvider(final DataBroker dataBroker, RpcProviderRegistry rpcProviderRegistry,
-            NotificationService notificationService, NotificationPublishService notificationPublishService) {
+            NotificationService notificationService, PathComputationService pathComputationService,
+            RendererServiceOperations rendererServiceOperations) {
         this.dataBroker = dataBroker;
         this.rpcRegistry = rpcProviderRegistry;
         this.notificationService = notificationService;
-        this.notificationPublishService = notificationPublishService;
+        this.pathComputationService = pathComputationService;
+        this.rendererServiceOperations = rendererServiceOperations;
     }
 
     /**
@@ -56,10 +54,11 @@ public class ServicehandlerProvider {
      */
     public void init() {
         LOG.info("ServicehandlerProvider Session Initiated");
-        final ServicehandlerImpl consumer = new ServicehandlerImpl(dataBroker, rpcRegistry, notificationPublishService);
-        stubPcelistenerRegistration = notificationService.registerNotificationListener(consumer);
-        stubRendererlistenerRegistration = notificationService.registerNotificationListener(consumer);
-        rpcRegistration = rpcRegistry.addRpcImplementation(ServicehandlerService.class, consumer);
+        final ServicehandlerImpl servicehandler = new ServicehandlerImpl(dataBroker, pathComputationService,
+                rendererServiceOperations);
+        final PceListenerImpl pceListener = new PceListenerImpl();
+        pcelistenerRegistration = notificationService.registerNotificationListener(pceListener);
+        rpcRegistration = rpcRegistry.addRpcImplementation(OrgOpenroadmServiceService.class, servicehandler);
     }
 
     /**
@@ -67,8 +66,8 @@ public class ServicehandlerProvider {
      */
     public void close() {
         LOG.info("ServicehandlerProvider Closed");
-        stubPcelistenerRegistration.close();
-        stubRendererlistenerRegistration.close();
+        pcelistenerRegistration.close();
         rpcRegistration.close();
     }
+
 }