Don't use NotificationListener in classes used by NodeRegistration.
This is a part of NotificationListener to Listener<?> migration.
JIRA: TRNSPRTPCE-756
Change-Id: Ic527adce8e535c2c7e5bd694afd7219b4e1a5613
Signed-off-by: Matej Sramcik <matej.sramcik@pantheon.tech>
import org.opendaylight.transportpce.networkmodel.listeners.TcaListener;
import org.opendaylight.transportpce.networkmodel.listeners.TcaListener221;
import org.opendaylight.transportpce.networkmodel.listeners.TcaListener710;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev161014.OrgOpenroadmAlarmListener;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.de.operations.rev161014.OrgOpenroadmDeOperationsListener;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.OrgOpenroadmDeviceListener;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.concepts.Registration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private final NotificationService notificationService;
private final DataBroker dataBroker;
private final PortMapping portMapping;
- private final List<ListenerRegistration<?>> listeners;
+ private final List<Registration> listeners;
public NodeRegistration(String nodeId, String nodeVersion, NotificationService notificationService,
DataBroker dataBroker, PortMapping portMapping) {
this.notificationService = notificationService;
this.dataBroker = dataBroker;
this.portMapping = portMapping;
- listeners = new ArrayList<ListenerRegistration<?>>();
+ listeners = new ArrayList<Registration>();
}
public void registerListeners() {
public void unregisterListeners() {
LOG.info("Unregistering notification listeners for node: {}", this.nodeId);
- for (ListenerRegistration<?> listenerRegistration : listeners) {
+ for (Registration listenerRegistration : listeners) {
listenerRegistration.close();
}
}
private void registerListeners121() {
- OrgOpenroadmAlarmListener alarmListener = new AlarmNotificationListener(this.dataBroker);
+ AlarmNotificationListener alarmListener = new AlarmNotificationListener(this.dataBroker);
LOG.info("Registering notification listener on OrgOpenroadmAlarmListener for node: {}", nodeId);
- listeners.add(notificationService.registerNotificationListener(alarmListener));
+ listeners.add(notificationService.registerCompositeListener(alarmListener.getCompositeListener()));
- OrgOpenroadmDeOperationsListener deOperationsListener = new DeOperationsListener();
+ DeOperationsListener deOperationsListener = new DeOperationsListener();
LOG.info("Registering notification listener on OrgOpenroadmDeOperationsListener for node: {}", nodeId);
- listeners.add(notificationService.registerNotificationListener(deOperationsListener));
+ listeners.add(notificationService.registerCompositeListener(deOperationsListener.getCompositeListener()));
- OrgOpenroadmDeviceListener deviceListener = new DeviceListener121(nodeId, this.portMapping);
+ DeviceListener121 deviceListener = new DeviceListener121(nodeId, this.portMapping);
LOG.info("Registering notification listener on OrgOpenroadmDeviceListener for node: {}", nodeId);
- listeners.add(notificationService.registerNotificationListener(deviceListener));
+ listeners.add(notificationService.registerCompositeListener(deviceListener.getCompositeListener()));
TcaListener tcaListener = new TcaListener();
LOG.info("Registering notification listener on OrgOpenroadmTcaListener for node: {}", nodeId);
- listeners.add(notificationService.registerNotificationListener(tcaListener));
+ listeners.add(notificationService.registerCompositeListener(tcaListener.getCompositeListener()));
}
private void registerListeners221() {
AlarmNotificationListener221 alarmListener = new AlarmNotificationListener221(dataBroker);
LOG.info("Registering notification listener on OrgOpenroadmAlarmListener for node: {}", nodeId);
- listeners.add(notificationService.registerNotificationListener(alarmListener));
+ listeners.add(notificationService.registerCompositeListener(alarmListener.getCompositeListener()));
DeOperationsListener221 deOperationsListener = new DeOperationsListener221();
LOG.info("Registering notification listener on OrgOpenroadmDeOperationsListener for node: {}", nodeId);
- listeners.add(notificationService.registerNotificationListener(deOperationsListener));
+ listeners.add(notificationService.registerCompositeListener(deOperationsListener.getCompositeListener()));
DeviceListener221 deviceListener = new DeviceListener221(nodeId, this.portMapping);
LOG.info("Registering notification listener on OrgOpenroadmDeviceListener for node: {}", nodeId);
- listeners.add(notificationService.registerNotificationListener(deviceListener));
+ listeners.add(notificationService.registerCompositeListener(deviceListener.getCompositeListener()));
TcaListener221 tcaListener = new TcaListener221();
LOG.info("Registering notification listener on OrgOpenroadmTcaListener for node: {}", nodeId);
- listeners.add(notificationService.registerNotificationListener(tcaListener));
+ listeners.add(notificationService.registerCompositeListener(tcaListener.getCompositeListener()));
}
private void registerListeners710() {
AlarmNotificationListener710 alarmListener = new AlarmNotificationListener710(dataBroker);
LOG.info("Registering notification listener on OrgOpenroadmAlarmListener for node: {}", nodeId);
- listeners.add(notificationService.registerNotificationListener(alarmListener));
+ listeners.add(notificationService.registerCompositeListener(alarmListener.getCompositeListener()));
DeOperationsListener710 deOperationsListener = new DeOperationsListener710();
LOG.info("Registering notification listener on OrgOpenroadmDeOperationsListener for node: {}", nodeId);
- listeners.add(notificationService.registerNotificationListener(deOperationsListener));
+ listeners.add(notificationService.registerCompositeListener(deOperationsListener.getCompositeListener()));
DeviceListener710 deviceListener = new DeviceListener710(nodeId, this.portMapping);
LOG.info("Registering notification listener on OrgOpenroadmDeviceListener for node: {}", nodeId);
- listeners.add(notificationService.registerNotificationListener(deviceListener));
+ listeners.add(notificationService.registerCompositeListener(deviceListener.getCompositeListener()));
TcaListener710 tcaListener = new TcaListener710();
LOG.info("Registering notification listener on OrgOpenroadmTcaListener for node: {}", nodeId);
- listeners.add(notificationService.registerNotificationListener(tcaListener));
+ listeners.add(notificationService.registerCompositeListener(tcaListener.getCompositeListener()));
}
}
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
+import java.util.Set;
import java.util.concurrent.ExecutionException;
import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.NotificationService.CompositeListener;
import org.opendaylight.mdsal.binding.api.ReadTransaction;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.alarmsuppression.rev171102.ServiceNodelist;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.alarmsuppression.rev171102.service.nodelist.nodelist.Nodes;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.alarmsuppression.rev171102.service.nodelist.nodelist.NodesBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev161014.AlarmNotification;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev161014.OrgOpenroadmAlarmListener;
import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev161014.alarm.ProbableCause;
import org.opendaylight.yang.gen.v1.http.org.openroadm.resource.rev161014.resource.ResourceType;
import org.opendaylight.yang.gen.v1.http.org.openroadm.resource.rev161014.resource.resource.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class AlarmNotificationListener implements OrgOpenroadmAlarmListener {
+public class AlarmNotificationListener {
private static final Logger LOG = LoggerFactory.getLogger(AlarmNotificationListener.class);
private static final String PIPE = "|";
this.dataBroker = dataBroker;
}
+ public CompositeListener getCompositeListener() {
+ return new CompositeListener(Set.of(
+ new CompositeListener.Component<>(AlarmNotification.class, this::onAlarmNotification)));
+ }
/**
* Callback for alarm-notification.
*
* @param notification AlarmNotification object
*/
- @Override
- public void onAlarmNotification(AlarmNotification notification) {
+ private void onAlarmNotification(AlarmNotification notification) {
List<Nodes> allNodeList = new ArrayList<>();
InstanceIdentifier<ServiceNodelist> serviceNodeListIID = InstanceIdentifier.create(ServiceNodelist.class);
try (ReadTransaction rtx = dataBroker.newReadOnlyTransaction()) {
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
+import java.util.Set;
import java.util.concurrent.ExecutionException;
import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.NotificationService.CompositeListener;
import org.opendaylight.mdsal.binding.api.ReadTransaction;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.alarmsuppression.rev171102.ServiceNodelist;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.alarmsuppression.rev171102.service.nodelist.nodelist.Nodes;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.alarmsuppression.rev171102.service.nodelist.nodelist.NodesBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev181019.AlarmNotification;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev181019.OrgOpenroadmAlarmListener;
import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev181019.alarm.ProbableCause;
import org.opendaylight.yang.gen.v1.http.org.openroadm.resource.rev181019.resource.ResourceType;
import org.opendaylight.yang.gen.v1.http.org.openroadm.resource.rev181019.resource.resource.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class AlarmNotificationListener221 implements OrgOpenroadmAlarmListener {
+public class AlarmNotificationListener221 {
private static final Logger LOG = LoggerFactory.getLogger(AlarmNotificationListener221.class);
private static final String PIPE = "|";
this.dataBroker = dataBroker;
}
+ public CompositeListener getCompositeListener() {
+ return new CompositeListener(Set.of(
+ new CompositeListener.Component<>(AlarmNotification.class, this::onAlarmNotification)));
+ }
/**
* Callback for alarm-notification.
*
* @param notification AlarmNotification object
*/
- @Override
- public void onAlarmNotification(AlarmNotification notification) {
+ private void onAlarmNotification(AlarmNotification notification) {
List<Nodes> allNodeList = new ArrayList<>();
InstanceIdentifier<ServiceNodelist> serviceNodeListIID = InstanceIdentifier.create(ServiceNodelist.class);
try {
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
+import java.util.Set;
import java.util.concurrent.ExecutionException;
import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.NotificationService.CompositeListener;
import org.opendaylight.mdsal.binding.api.ReadTransaction;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.alarmsuppression.rev171102.ServiceNodelist;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.alarmsuppression.rev171102.service.nodelist.nodelist.Nodes;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.alarmsuppression.rev171102.service.nodelist.nodelist.NodesBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev200529.AlarmNotification;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev200529.OrgOpenroadmAlarmListener;
import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev200529.alarm.ProbableCause;
import org.opendaylight.yang.gen.v1.http.org.openroadm.resource.rev200529.resource.ResourceType;
import org.opendaylight.yang.gen.v1.http.org.openroadm.resource.rev200529.resource.resource.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class AlarmNotificationListener710 implements OrgOpenroadmAlarmListener {
+public class AlarmNotificationListener710 {
private static final Logger LOG = LoggerFactory.getLogger(AlarmNotificationListener710.class);
private static final String PIPE = "|";
this.dataBroker = dataBroker;
}
+ public CompositeListener getCompositeListener() {
+ return new CompositeListener(Set.of(
+ new CompositeListener.Component<>(AlarmNotification.class, this::onAlarmNotification)));
+ }
+
/**
* Callback for alarm-notification.
*
* @param notification AlarmNotification object
*/
- @Override
- public void onAlarmNotification(AlarmNotification notification) {
+ private void onAlarmNotification(AlarmNotification notification) {
List<Nodes> allNodeList = new ArrayList<>();
InstanceIdentifier<ServiceNodelist> serviceNodeListIID = InstanceIdentifier.create(ServiceNodelist.class);
try {
package org.opendaylight.transportpce.networkmodel.listeners;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.de.operations.rev161014.OrgOpenroadmDeOperationsListener;
+import java.util.Set;
+import org.opendaylight.mdsal.binding.api.NotificationService.CompositeListener;
import org.opendaylight.yang.gen.v1.http.org.openroadm.de.operations.rev161014.RestartNotification;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class DeOperationsListener implements OrgOpenroadmDeOperationsListener {
+public class DeOperationsListener {
private static final Logger LOG = LoggerFactory.getLogger(DeOperationsListener.class);
+ public CompositeListener getCompositeListener() {
+ return new CompositeListener(Set.of(
+ new CompositeListener.Component<>(RestartNotification.class, this::onRestartNotification)));
+ }
+
/**
* Callback for restart-notification.
*
* @param notification RestartNotification object
*/
- @Override
- public void onRestartNotification(RestartNotification notification) {
+ private void onRestartNotification(RestartNotification notification) {
LOG.info("Notification {} received {}", RestartNotification.QNAME, notification);
}
package org.opendaylight.transportpce.networkmodel.listeners;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.de.operations.rev181019.OrgOpenroadmDeOperationsListener;
+import java.util.Set;
+import org.opendaylight.mdsal.binding.api.NotificationService.CompositeListener;
import org.opendaylight.yang.gen.v1.http.org.openroadm.de.operations.rev181019.RestartNotification;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class DeOperationsListener221 implements OrgOpenroadmDeOperationsListener {
+public class DeOperationsListener221 {
private static final Logger LOG = LoggerFactory.getLogger(DeOperationsListener221.class);
+ public CompositeListener getCompositeListener() {
+ return new CompositeListener(Set.of(
+ new CompositeListener.Component<>(RestartNotification.class, this::onRestartNotification)));
+ }
+
/**
* Callback for restart-notification.
*
* @param notification RestartNotification object
*/
- @Override
- public void onRestartNotification(RestartNotification notification) {
+ private void onRestartNotification(RestartNotification notification) {
LOG.info("Notification {} received {}", RestartNotification.QNAME, notification);
}
package org.opendaylight.transportpce.networkmodel.listeners;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.de.operations.rev200529.OrgOpenroadmDeOperationsListener;
+import java.util.Set;
+import org.opendaylight.mdsal.binding.api.NotificationService.CompositeListener;
import org.opendaylight.yang.gen.v1.http.org.openroadm.de.operations.rev200529.RestartNotification;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class DeOperationsListener710 implements OrgOpenroadmDeOperationsListener {
+public class DeOperationsListener710 {
private static final Logger LOG = LoggerFactory.getLogger(DeOperationsListener710.class);
+ public CompositeListener getCompositeListener() {
+ return new CompositeListener(Set.of(
+ new CompositeListener.Component<>(RestartNotification.class, this::onRestartNotification)));
+ }
+
/**
* Callback for restart-notification.
*
* @param notification RestartNotification object
*/
- @Override
- public void onRestartNotification(RestartNotification notification) {
+ private void onRestartNotification(RestartNotification notification) {
LOG.info("Notification {} received {}", RestartNotification.QNAME, notification);
}
package org.opendaylight.transportpce.networkmodel.listeners;
import java.util.LinkedList;
+import java.util.Set;
+import org.opendaylight.mdsal.binding.api.NotificationService.CompositeListener;
import org.opendaylight.transportpce.common.mapping.PortMapping;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220922.mapping.Mapping;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.ChangeNotification;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.OrgOpenroadmDeviceListener;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.OtdrScanResult;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.change.notification.Edit;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.circuit.pack.Ports;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class DeviceListener121 implements OrgOpenroadmDeviceListener {
+public class DeviceListener121 {
private static final Logger LOG = LoggerFactory.getLogger(DeviceListener121.class);
private final String nodeId;
this.portMapping = portMapping;
}
+ public CompositeListener getCompositeListener() {
+ return new CompositeListener(Set.of(
+ new CompositeListener.Component<>(ChangeNotification.class, this::onChangeNotification),
+ new CompositeListener.Component<>(OtdrScanResult.class, this::onOtdrScanResult)
+ ));
+ }
+
/**
* Callback for change-notification.
*
* @param notification ChangeNotification object
*/
- @Override
- public void onChangeNotification(ChangeNotification notification) {
+
+ void onChangeNotification(ChangeNotification notification) {
if (notification.getEdit() == null) {
LOG.warn("unable to handle {} notificatin received - list of edit is null", ChangeNotification.QNAME);
return;
*
* @param notification OtdrScanResult object
*/
- @Override
- public void onOtdrScanResult(OtdrScanResult notification) {
+ private void onOtdrScanResult(OtdrScanResult notification) {
LOG.info("Notification {} received {}", OtdrScanResult.QNAME, notification);
}
package org.opendaylight.transportpce.networkmodel.listeners;
import java.util.LinkedList;
+import java.util.Set;
+import org.opendaylight.mdsal.binding.api.NotificationService.CompositeListener;
import org.opendaylight.transportpce.common.mapping.PortMapping;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220922.mapping.Mapping;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.ChangeNotification;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.CreateTechInfoNotification;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.OrgOpenroadmDeviceListener;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.OtdrScanResult;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.change.notification.Edit;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.circuit.pack.Ports;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class DeviceListener221 implements OrgOpenroadmDeviceListener {
+public class DeviceListener221 {
private static final Logger LOG = LoggerFactory.getLogger(DeviceListener221.class);
private final String nodeId;
this.portMapping = portMapping;
}
+ public CompositeListener getCompositeListener() {
+ return new CompositeListener(Set.of(
+ new CompositeListener.Component<>(ChangeNotification.class, this::onChangeNotification),
+ new CompositeListener.Component<>(CreateTechInfoNotification.class, this::onCreateTechInfoNotification),
+ new CompositeListener.Component<>(OtdrScanResult.class, this::onOtdrScanResult)
+ ));
+ }
+
/**
* Callback for change-notification.
*
* @param notification
* ChangeNotification object
*/
- @Override
- public void onChangeNotification(ChangeNotification notification) {
+ void onChangeNotification(ChangeNotification notification) {
LOG.info("notification received from device {}: {}", this.nodeId, notification.toString());
if (notification.getEdit() == null) {
LOG.warn("unable to handle {} notificatin received - list of edit is null", ChangeNotification.QNAME);
}
}
- @Override
- public void onCreateTechInfoNotification(CreateTechInfoNotification notification) {
+ private void onCreateTechInfoNotification(CreateTechInfoNotification notification) {
}
/**
* @param notification
* OtdrScanResult object
*/
- @Override
- public void onOtdrScanResult(OtdrScanResult notification) {
+ private void onOtdrScanResult(OtdrScanResult notification) {
LOG.info("Notification {} received {}", OtdrScanResult.QNAME, notification);
}
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.Set;
+import org.opendaylight.mdsal.binding.api.NotificationService.CompositeListener;
import org.opendaylight.transportpce.common.mapping.PortMapping;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220922.mapping.Mapping;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.ChangeNotification;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.CreateTechInfoNotification;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.OrgOpenroadmDeviceListener;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.OtdrScanResult;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.change.notification.Edit;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.circuit.pack.Ports;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class DeviceListener710 implements OrgOpenroadmDeviceListener {
+public class DeviceListener710 {
private static final Logger LOG = LoggerFactory.getLogger(DeviceListener710.class);
private final String nodeId;
this.portMapping = portMapping;
}
+ public CompositeListener getCompositeListener() {
+ return new CompositeListener(Set.of(
+ new CompositeListener.Component<>(ChangeNotification.class, this::onChangeNotification),
+ new CompositeListener.Component<>(CreateTechInfoNotification.class, this::onCreateTechInfoNotification),
+ new CompositeListener.Component<>(OtdrScanResult.class, this::onOtdrScanResult)
+ ));
+ }
+
/**
* Callback for change-notification.
*
* @param notification
* ChangeNotification object
*/
- @Override
- public void onChangeNotification(ChangeNotification notification) {
+ void onChangeNotification(ChangeNotification notification) {
LOG.debug("device71 notification received = {}", notification);
if (notification.getEdit() == null) {
LOG.warn("unable to handle {} notificatin received - list of edit is null", ChangeNotification.QNAME);
}
}
- @Override
- public void onCreateTechInfoNotification(CreateTechInfoNotification notification) {
+ private void onCreateTechInfoNotification(CreateTechInfoNotification notification) {
}
/**
* @param notification
* OtdrScanResult object
*/
- @Override
- public void onOtdrScanResult(OtdrScanResult notification) {
+ private void onOtdrScanResult(OtdrScanResult notification) {
LOG.info("Notification {} received {}", OtdrScanResult.QNAME, notification);
}
package org.opendaylight.transportpce.networkmodel.listeners;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.tca.rev161014.OrgOpenroadmTcaListener;
+import java.util.Set;
+import org.opendaylight.mdsal.binding.api.NotificationService.CompositeListener;
import org.opendaylight.yang.gen.v1.http.org.openroadm.tca.rev161014.TcaNotification;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class TcaListener implements OrgOpenroadmTcaListener {
+public class TcaListener {
private static final Logger LOG = LoggerFactory.getLogger(TcaListener.class);
+ public CompositeListener getCompositeListener() {
+ return new CompositeListener(Set.of(
+ new CompositeListener.Component<>(TcaNotification.class, this::onTcaNotification)));
+ }
+
/**
* Callback for tca-notification.
* @param notification TcaNotification object
*/
- @Override
- public void onTcaNotification(TcaNotification notification) {
+ private void onTcaNotification(TcaNotification notification) {
LOG.info("Notification {} received {}", TcaNotification.QNAME, notification);
}
package org.opendaylight.transportpce.networkmodel.listeners;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.tca.rev181019.OrgOpenroadmTcaListener;
+import java.util.Set;
+import org.opendaylight.mdsal.binding.api.NotificationService.CompositeListener;
import org.opendaylight.yang.gen.v1.http.org.openroadm.tca.rev181019.TcaNotification;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class TcaListener221 implements OrgOpenroadmTcaListener {
+public class TcaListener221 {
private static final Logger LOG = LoggerFactory.getLogger(TcaListener221.class);
+ public CompositeListener getCompositeListener() {
+ return new CompositeListener(Set.of(
+ new CompositeListener.Component<>(TcaNotification.class, this::onTcaNotification)));
+ }
+
/**
* Callback for tca-notification.
* @param notification TcaNotification object
*/
- @Override
- public void onTcaNotification(TcaNotification notification) {
+ private void onTcaNotification(TcaNotification notification) {
LOG.info("Notification {} received {}", TcaNotification.QNAME, notification);
}
package org.opendaylight.transportpce.networkmodel.listeners;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.tca.rev200327.OrgOpenroadmTcaListener;
+import java.util.Set;
+import org.opendaylight.mdsal.binding.api.NotificationService.CompositeListener;
import org.opendaylight.yang.gen.v1.http.org.openroadm.tca.rev200327.TcaNotification;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class TcaListener710 implements OrgOpenroadmTcaListener {
+public class TcaListener710 {
private static final Logger LOG = LoggerFactory.getLogger(TcaListener710.class);
+ public CompositeListener getCompositeListener() {
+ return new CompositeListener(Set.of(
+ new CompositeListener.Component<>(TcaNotification.class, this::onTcaNotification)));
+ }
+
/**
* Callback for tca-notification.
* @param notification TcaNotification object
*/
- @Override
- public void onTcaNotification(TcaNotification notification) {
+ private void onTcaNotification(TcaNotification notification) {
LOG.info("Notification {} received {}", TcaNotification.QNAME, notification);
}