*/
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.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.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 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 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));
+ rpcRegistration = rpcProviderService.registerRpcImplementations(nbiImpl.registerRPCs());
NbiNotificationsListenerImpl nbiNotificationsListener = new NbiNotificationsListenerImpl(
topicManager.getProcessTopicMap(), topicManager.getAlarmTopicMap(), topicManager.getTapiTopicMap());
listenerRegistration = notificationService.registerNotificationListener(nbiNotificationsListener);
for (Publisher<NotificationAlarmService> publisherAlarm : publishersAlarmMap.values()) {
publisherAlarm.close();
}
- rpcRegistrations.forEach(reg -> reg.close());
+ rpcRegistration.close();
listenerRegistration.close();
LOG.info("NbiNotificationsProvider Closed");
}