Slim down NetconfKeystoreAdapter 29/102329/2
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 9 Sep 2022 21:57:30 +0000 (23:57 +0200)
committerRobert Varga <nite@hq.sk>
Mon, 12 Sep 2022 15:27:05 +0000 (15:27 +0000)
There is no need to store DataBroker and our listen path, ditch these
two fields.

Change-Id: Ie5c1e13eaacebcb6f4636712ec352a449a201f43
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfKeystoreAdapter.java

index 789295365851ad1d60c87cfaa841e4f6cddf06ce..a984294945a52ea941e5a16a592dd25efed7eb0f 100644 (file)
@@ -48,18 +48,14 @@ import org.slf4j.LoggerFactory;
 public final class NetconfKeystoreAdapter implements ClusteredDataTreeChangeListener<Keystore> {
     private static final Logger LOG = LoggerFactory.getLogger(NetconfKeystoreAdapter.class);
 
-    private final InstanceIdentifier<Keystore> keystoreIid = InstanceIdentifier.create(Keystore.class);
-
-    private final DataBroker dataBroker;
     private final Map<String, KeyCredential> pairs = Collections.synchronizedMap(new HashMap<>());
     private final Map<String, PrivateKey> privateKeys = Collections.synchronizedMap(new HashMap<>());
     private final Map<String, TrustedCertificate> trustedCertificates = Collections.synchronizedMap(new HashMap<>());
 
     public NetconfKeystoreAdapter(final DataBroker dataBroker) {
-        this.dataBroker = dataBroker;
-
-        dataBroker.registerDataTreeChangeListener(DataTreeIdentifier.create(LogicalDatastoreType.CONFIGURATION,
-            keystoreIid), this);
+        dataBroker.registerDataTreeChangeListener(
+            DataTreeIdentifier.create(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(Keystore.class)),
+            this);
     }
 
     public Optional<KeyCredential> getKeypairFromId(final String keyId) {