From b4a53f0a27e00309ba4ef1fbbe2fece33fc97ca6 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Mon, 6 Feb 2023 16:12:48 +0100 Subject: [PATCH] Clean up TlsAllowedDevicesMonitorImpl constants We have single-use constants, let's just inline them to their use in constructor. JIRA: NETCONF-949 Change-Id: I12618fe42c46b0b561e85980f5cdbfce5201fad3 Signed-off-by: Robert Varga --- .../tls/TlsAllowedDevicesMonitorImpl.java | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/apps/callhome-provider/src/main/java/org/opendaylight/netconf/callhome/mount/tls/TlsAllowedDevicesMonitorImpl.java b/apps/callhome-provider/src/main/java/org/opendaylight/netconf/callhome/mount/tls/TlsAllowedDevicesMonitorImpl.java index 8ae403354f..6cbc10f6c2 100644 --- a/apps/callhome-provider/src/main/java/org/opendaylight/netconf/callhome/mount/tls/TlsAllowedDevicesMonitorImpl.java +++ b/apps/callhome-provider/src/main/java/org/opendaylight/netconf/callhome/mount/tls/TlsAllowedDevicesMonitorImpl.java @@ -39,33 +39,28 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf. import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.Device; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.device.transport.Tls; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.device.transport.tls.TlsClientParams; -import org.opendaylight.yangtools.concepts.ListenerRegistration; +import org.opendaylight.yangtools.concepts.Registration; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class TlsAllowedDevicesMonitorImpl implements TlsAllowedDevicesMonitor, AutoCloseable { - private static final Logger LOG = LoggerFactory.getLogger(TlsAllowedDevicesMonitorImpl.class); - - private static final InstanceIdentifier ALLOWED_DEVICES_PATH = - InstanceIdentifier.create(NetconfCallhomeServer.class).child(AllowedDevices.class).child(Device.class); - private static final DataTreeIdentifier ALLOWED_DEVICES = - DataTreeIdentifier.create(LogicalDatastoreType.CONFIGURATION, ALLOWED_DEVICES_PATH); - private static final InstanceIdentifier KEYSTORE_PATH = InstanceIdentifier.create(Keystore.class); - private static final DataTreeIdentifier KEYSTORE = DataTreeIdentifier.create( - LogicalDatastoreType.CONFIGURATION, KEYSTORE_PATH); - private static final ConcurrentMap DEVICE_TO_PRIVATE_KEY = new ConcurrentHashMap<>(); private static final ConcurrentMap DEVICE_TO_CERTIFICATE = new ConcurrentHashMap<>(); private static final ConcurrentMap CERTIFICATE_TO_PUBLIC_KEY = new ConcurrentHashMap<>(); - private final ListenerRegistration allowedDevicesReg; - private final ListenerRegistration certificatesReg; + private final Registration allowedDevicesReg; + private final Registration certificatesReg; public TlsAllowedDevicesMonitorImpl(final DataBroker dataBroker) { - allowedDevicesReg = dataBroker.registerDataTreeChangeListener(ALLOWED_DEVICES, new AllowedDevicesMonitor()); - certificatesReg = dataBroker.registerDataTreeChangeListener(KEYSTORE, new CertificatesMonitor()); + allowedDevicesReg = dataBroker.registerDataTreeChangeListener( + DataTreeIdentifier.create(LogicalDatastoreType.CONFIGURATION, + InstanceIdentifier.create(NetconfCallhomeServer.class).child(AllowedDevices.class).child(Device.class)), + new AllowedDevicesMonitor()); + certificatesReg = dataBroker.registerDataTreeChangeListener( + DataTreeIdentifier.create(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(Keystore.class)), + new CertificatesMonitor()); } @Override -- 2.36.6