Don't use NotificationListener (ServiceHandler)
[transportpce.git] / networkmodel / src / main / java / org / opendaylight / transportpce / networkmodel / listeners / ServiceHandlerListener.java
index 2c2bd09588b9436f7fde91c214da7b11a3ddd5cb..1f5c6b0f66f9aa622fa511aeac9f80cccd3f0ae9 100644 (file)
@@ -8,24 +8,30 @@
 
 package org.opendaylight.transportpce.networkmodel.listeners;
 
+import java.util.Set;
+import org.opendaylight.mdsal.binding.api.NotificationService.CompositeListener;
 import org.opendaylight.transportpce.networkmodel.service.FrequenciesService;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev201125.ServiceRpcResultSh;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev201125.TransportpceServicehandlerListener;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.ServiceNotificationTypes;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.RpcStatusEx;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class ServiceHandlerListener implements TransportpceServicehandlerListener {
+public class ServiceHandlerListener {
     private static final Logger LOG = LoggerFactory.getLogger(ServiceHandlerListener.class);
     private final FrequenciesService service;
 
+
     public ServiceHandlerListener(FrequenciesService service) {
         LOG.info("Init service handler listener for network");
         this.service = service;
     }
 
-    @Override
+    public CompositeListener getCompositeListener() {
+        return new CompositeListener(Set.of(
+            new CompositeListener.Component<>(ServiceRpcResultSh.class, this::onServiceRpcResultSh)));
+    }
+
     public void onServiceRpcResultSh(ServiceRpcResultSh notification) {
         if (notification.getStatus() != RpcStatusEx.Successful) {
             LOG.info("RpcStatusEx of notification not equals successful. Nothing to do for notification {}",