From 676ce1b3f0b6bf7dfc0abbed1cc6e51787506356 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Mon, 4 Mar 2024 17:09:56 +0100 Subject: [PATCH] Fix warnings in sample-bundles We have a few warnings around deprecated APIs, fix them up. Change-Id: I3037fe65dcdced3cd14db842d3b7276836fcbe55 Signed-off-by: Robert Varga --- .../bundles/SampleFlowCapableNodeListener.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/samples/sample-bundles/src/main/java/org/opendaylight/openflowplugin/samples/sample/bundles/SampleFlowCapableNodeListener.java b/samples/sample-bundles/src/main/java/org/opendaylight/openflowplugin/samples/sample/bundles/SampleFlowCapableNodeListener.java index 80da8efcbb..b90d2e14fe 100644 --- a/samples/sample-bundles/src/main/java/org/opendaylight/openflowplugin/samples/sample/bundles/SampleFlowCapableNodeListener.java +++ b/samples/sample-bundles/src/main/java/org/opendaylight/openflowplugin/samples/sample/bundles/SampleFlowCapableNodeListener.java @@ -16,9 +16,9 @@ import java.util.concurrent.Future; import javax.annotation.PreDestroy; import javax.inject.Inject; import javax.inject.Singleton; -import org.opendaylight.mdsal.binding.api.ClusteredDataTreeChangeListener; import org.opendaylight.mdsal.binding.api.DataBroker; import org.opendaylight.mdsal.binding.api.DataObjectModification.ModificationType; +import org.opendaylight.mdsal.binding.api.DataTreeChangeListener; import org.opendaylight.mdsal.binding.api.DataTreeIdentifier; import org.opendaylight.mdsal.binding.api.DataTreeModification; import org.opendaylight.mdsal.binding.api.RpcService; @@ -90,8 +90,7 @@ import org.slf4j.LoggerFactory; */ @Singleton @Component(service = { }) -public final class SampleFlowCapableNodeListener - implements ClusteredDataTreeChangeListener, AutoCloseable { +public final class SampleFlowCapableNodeListener implements DataTreeChangeListener, AutoCloseable { private static final Logger LOG = LoggerFactory.getLogger(SampleFlowCapableNodeListener.class); private static final BundleId BUNDLE_ID = new BundleId(Uint32.ONE); @@ -113,9 +112,9 @@ public final class SampleFlowCapableNodeListener final InstanceIdentifier path = InstanceIdentifier.create(Nodes.class).child(Node.class) .augmentation(FlowCapableNode.class); final DataTreeIdentifier identifier = - DataTreeIdentifier.create(LogicalDatastoreType.OPERATIONAL, path); + DataTreeIdentifier.of(LogicalDatastoreType.OPERATIONAL, path); - listenerReg = dataBroker.registerDataTreeChangeListener(identifier, SampleFlowCapableNodeListener.this); + listenerReg = dataBroker.registerTreeChangeListener(identifier, SampleFlowCapableNodeListener.this); } @PreDestroy @@ -129,12 +128,11 @@ public final class SampleFlowCapableNodeListener @Override public void onDataTreeChanged(final List> modifications) { for (var modification : modifications) { - if (modification.getRootNode().getModificationType() == ModificationType.WRITE) { - LOG.info("Node connected: {}", - modification.getRootPath().getRootIdentifier().firstIdentifierOf(Node.class)); + if (modification.getRootNode().modificationType() == ModificationType.WRITE) { + final var nodePath = modification.getRootPath().path().firstIdentifierOf(Node.class); + LOG.info("Node connected: {}", nodePath); - final var nodeRef = - new NodeRef(modification.getRootPath().getRootIdentifier().firstIdentifierOf(Node.class)); + final var nodeRef = new NodeRef(nodePath); final var openBundleInput = new ControlBundleInputBuilder() .setNode(nodeRef) -- 2.36.6