Modify spectrum assignment management in PCE
[transportpce.git] / servicehandler / src / main / java / org / opendaylight / transportpce / servicehandler / impl / ServicehandlerProvider.java
index ec1e2f55649c13085795b59eac4dac554a814efa..1b31874f37a50567ab3ea8e37792cdfa1725ecd0 100644 (file)
@@ -9,14 +9,14 @@
 package org.opendaylight.transportpce.servicehandler.impl;
 
 import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.NotificationPublishService;
 import org.opendaylight.mdsal.binding.api.NotificationService;
 import org.opendaylight.mdsal.binding.api.RpcProviderService;
-import org.opendaylight.transportpce.pce.service.PathComputationService;
-import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
+import org.opendaylight.transportpce.servicehandler.listeners.NetworkModelListenerImpl;
 import org.opendaylight.transportpce.servicehandler.listeners.PceListenerImpl;
 import org.opendaylight.transportpce.servicehandler.listeners.RendererListenerImpl;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.TransportpcePceListener;
+import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperations;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkmodel.rev201116.TransportpceNetworkmodelListener;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev210701.TransportpcePceListener;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev201125.TransportpceRendererListener;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.OrgOpenroadmServiceService;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
@@ -37,23 +37,29 @@ public class ServicehandlerProvider {
     private final DataBroker dataBroker;
     private final RpcProviderService rpcService;
     private final NotificationService notificationService;
-    private final NotificationPublishService notificationPublishService;
     private ListenerRegistration<TransportpcePceListener> pcelistenerRegistration;
     private ListenerRegistration<TransportpceRendererListener> rendererlistenerRegistration;
+    private ListenerRegistration<TransportpceNetworkmodelListener> networkmodellistenerRegistration;
     private ObjectRegistration<OrgOpenroadmServiceService> rpcRegistration;
-    private PathComputationService pathComputationService;
-    private RendererServiceOperations rendererServiceOperations;
+    private ServiceDataStoreOperations serviceDataStoreOperations;
+    private PceListenerImpl pceListenerImpl;
+    private RendererListenerImpl rendererListenerImpl;
+    private NetworkModelListenerImpl networkModelListenerImpl;
+    private ServicehandlerImpl servicehandler;
 
     public ServicehandlerProvider(final DataBroker dataBroker, RpcProviderService rpcProviderService,
-            NotificationService notificationService, PathComputationService pathComputationService,
-            RendererServiceOperations rendererServiceOperations,
-            NotificationPublishService notificationPublishService) {
+            NotificationService notificationService, ServiceDataStoreOperations serviceDataStoreOperations,
+            PceListenerImpl pceListenerImpl, RendererListenerImpl rendererListenerImpl,
+            NetworkModelListenerImpl networkModelListenerImpl, ServicehandlerImpl servicehandler) {
         this.dataBroker = dataBroker;
         this.rpcService = rpcProviderService;
         this.notificationService = notificationService;
-        this.pathComputationService = pathComputationService;
-        this.rendererServiceOperations = rendererServiceOperations;
-        this.notificationPublishService = notificationPublishService;
+        this.serviceDataStoreOperations = serviceDataStoreOperations;
+        this.serviceDataStoreOperations.initialize();
+        this.pceListenerImpl = pceListenerImpl;
+        this.rendererListenerImpl = rendererListenerImpl;
+        this.networkModelListenerImpl = networkModelListenerImpl;
+        this.servicehandler = servicehandler;
     }
 
     /**
@@ -61,16 +67,10 @@ public class ServicehandlerProvider {
      */
     public void init() {
         LOG.info("ServicehandlerProvider Session Initiated");
-        final PceListenerImpl pceListenerImpl = new PceListenerImpl(rendererServiceOperations,
-                pathComputationService, notificationPublishService, null);
-        final RendererListenerImpl rendererListenerImpl =
-                new RendererListenerImpl(pathComputationService, notificationPublishService);
         pcelistenerRegistration = notificationService.registerNotificationListener(pceListenerImpl);
         rendererlistenerRegistration = notificationService.registerNotificationListener(rendererListenerImpl);
-        final ServicehandlerImpl servicehandler = new ServicehandlerImpl(dataBroker, pathComputationService,
-                rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl);
-        rpcRegistration =
-            rpcService.registerRpcImplementation(OrgOpenroadmServiceService.class, servicehandler);
+        networkmodellistenerRegistration = notificationService.registerNotificationListener(networkModelListenerImpl);
+        rpcRegistration = rpcService.registerRpcImplementation(OrgOpenroadmServiceService.class, servicehandler);
     }
 
     /**
@@ -80,6 +80,7 @@ public class ServicehandlerProvider {
         LOG.info("ServicehandlerProvider Closed");
         pcelistenerRegistration.close();
         rendererlistenerRegistration.close();
+        networkmodellistenerRegistration.close();
         rpcRegistration.close();
     }