*/
package org.opendaylight.transportpce.nbinotifications.impl;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.opendaylight.mdsal.binding.dom.codec.spi.BindingDOMCodecServices;
import org.opendaylight.transportpce.common.converter.JsonStringConverter;
import org.opendaylight.transportpce.common.network.NetworkTransactionService;
-import org.opendaylight.transportpce.nbinotifications.listener.NbiNotificationsListenerImpl;
+import org.opendaylight.transportpce.nbinotifications.listener.NbiNotificationsHandler;
import org.opendaylight.transportpce.nbinotifications.producer.Publisher;
import org.opendaylight.transportpce.nbinotifications.utils.TopicManager;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NbiNotificationsListener;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NbiNotificationsService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService;
-import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationTapiService;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.TapiNotificationService;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.concepts.ObjectRegistration;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationAlarmService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationProcessService;
+import org.opendaylight.yang.gen.v1.nbi.notifications.rev230726.NotificationTapiService;
+import org.opendaylight.yangtools.concepts.Registration;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Deactivate;
private static final Logger LOG = LoggerFactory.getLogger(NbiNotificationsProvider.class);
private static Map<String, Publisher<NotificationProcessService>> publishersServiceMap = new HashMap<>();
private static Map<String, Publisher<NotificationAlarmService>> publishersAlarmMap = new HashMap<>();
- private ListenerRegistration<NbiNotificationsListener> listenerRegistration;
- private List<ObjectRegistration<NbiNotificationsImpl>> rpcRegistrations = new ArrayList<>();
+ private Registration listenerRegistration;
+ private Registration rpcRegistration;
@Activate
public NbiNotificationsProvider(@Reference RpcProviderService rpcProviderService,
NbiNotificationsImpl nbiImpl = new NbiNotificationsImpl(converterService, converterAlarmService,
converterTapiService, subscriberServer, networkTransactionService, topicManager);
- rpcRegistrations.add(rpcProviderService.registerRpcImplementation(NbiNotificationsService.class, nbiImpl));
- rpcRegistrations.add(rpcProviderService.registerRpcImplementation(TapiNotificationService.class, nbiImpl));
- NbiNotificationsListenerImpl nbiNotificationsListener = new NbiNotificationsListenerImpl(
- topicManager.getProcessTopicMap(), topicManager.getAlarmTopicMap(), topicManager.getTapiTopicMap());
- listenerRegistration = notificationService.registerNotificationListener(nbiNotificationsListener);
- topicManager.setNbiNotificationsListener(nbiNotificationsListener);
+ rpcRegistration = rpcProviderService.registerRpcImplementations(nbiImpl.registerRPCs());
+ NbiNotificationsHandler notificationsListener = new NbiNotificationsHandler(
+ topicManager.getProcessTopicMap(), topicManager.getAlarmTopicMap(), topicManager.getTapiTopicMap());
+ listenerRegistration = notificationService.registerCompositeListener(
+ notificationsListener.getCompositeListener());
+ topicManager.setNbiNotificationsListener(notificationsListener);
LOG.info("NbiNotificationsProvider Session Initiated");
}
for (Publisher<NotificationAlarmService> publisherAlarm : publishersAlarmMap.values()) {
publisherAlarm.close();
}
- rpcRegistrations.forEach(reg -> reg.close());
+ rpcRegistration.close();
listenerRegistration.close();
LOG.info("NbiNotificationsProvider Closed");
}