Bump upstreams
[netconf.git] / plugins / netconf-client-mdsal / src / main / java / org / opendaylight / netconf / client / mdsal / impl / DefaultSslHandlerFactoryProvider.java
index 8d418a9e7c5e90fa9bb31b3b23ef15216a93a7c5..165e5ab710cae74e4c90cfd24f6f584125abde28 100644 (file)
@@ -23,17 +23,17 @@ import java.security.cert.X509Certificate;
 import java.security.spec.InvalidKeySpecException;
 import java.security.spec.PKCS8EncodedKeySpec;
 import java.util.Base64;
-import java.util.Collection;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import javax.annotation.PreDestroy;
 import javax.inject.Inject;
 import javax.inject.Singleton;
 import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.mdsal.binding.api.ClusteredDataTreeChangeListener;
 import org.opendaylight.mdsal.binding.api.DataBroker;
 import org.opendaylight.mdsal.binding.api.DataObjectModification;
+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.common.api.LogicalDatastoreType;
@@ -56,7 +56,7 @@ import org.slf4j.LoggerFactory;
 @Singleton
 @Component(service = SslHandlerFactoryProvider.class)
 public final class DefaultSslHandlerFactoryProvider
-        implements SslHandlerFactoryProvider, ClusteredDataTreeChangeListener<Keystore>, AutoCloseable {
+        implements SslHandlerFactoryProvider, DataTreeChangeListener<Keystore>, AutoCloseable {
     /**
      * Internal state, updated atomically.
      */
@@ -136,9 +136,8 @@ public final class DefaultSslHandlerFactoryProvider
     @Inject
     @Activate
     public DefaultSslHandlerFactoryProvider(@Reference final DataBroker dataBroker) {
-        reg = dataBroker.registerDataTreeChangeListener(
-            DataTreeIdentifier.create(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(Keystore.class)),
-            this);
+        reg = dataBroker.registerTreeChangeListener(
+            DataTreeIdentifier.of(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(Keystore.class)), this);
     }
 
     @Deactivate
@@ -232,7 +231,7 @@ public final class DefaultSslHandlerFactoryProvider
     }
 
     @Override
-    public void onDataTreeChanged(final Collection<DataTreeModification<Keystore>> changes) {
+    public void onDataTreeChanged(final List<DataTreeModification<Keystore>> changes) {
         LOG.debug("Starting update with {} changes", changes.size());
         final var builder = state.newBuilder();
         onDataTreeChanged(builder, changes);
@@ -241,15 +240,15 @@ public final class DefaultSslHandlerFactoryProvider
     }
 
     private static void onDataTreeChanged(final StateBuilder builder,
-            final Collection<DataTreeModification<Keystore>> changes) {
+            final List<DataTreeModification<Keystore>> changes) {
         for (var change : changes) {
             LOG.debug("Processing change {}", change);
             final var rootNode = change.getRootNode();
 
-            for (var changedChild : rootNode.getModifiedChildren()) {
-                if (changedChild.getDataType().equals(PrivateKey.class)) {
+            for (var changedChild : rootNode.modifiedChildren()) {
+                if (changedChild.dataType().equals(PrivateKey.class)) {
                     onPrivateKeyChanged(builder.privateKeys, (DataObjectModification<PrivateKey>)changedChild);
-                } else if (changedChild.getDataType().equals(TrustedCertificate.class)) {
+                } else if (changedChild.dataType().equals(TrustedCertificate.class)) {
                     onTrustedCertificateChanged(builder.trustedCertificates,
                         (DataObjectModification<TrustedCertificate>)changedChild);
                 }
@@ -259,14 +258,14 @@ public final class DefaultSslHandlerFactoryProvider
 
     private static void onPrivateKeyChanged(final HashMap<String, PrivateKey> privateKeys,
             final DataObjectModification<PrivateKey> objectModification) {
-        switch (objectModification.getModificationType()) {
+        switch (objectModification.modificationType()) {
             case SUBTREE_MODIFIED:
             case WRITE:
-                final var privateKey = objectModification.getDataAfter();
+                final var privateKey = objectModification.dataAfter();
                 privateKeys.put(privateKey.getName(), privateKey);
                 break;
             case DELETE:
-                privateKeys.remove(objectModification.getDataBefore().getName());
+                privateKeys.remove(objectModification.dataBefore().getName());
                 break;
             default:
                 break;
@@ -275,14 +274,14 @@ public final class DefaultSslHandlerFactoryProvider
 
     private static void onTrustedCertificateChanged(final HashMap<String, TrustedCertificate> trustedCertificates,
             final DataObjectModification<TrustedCertificate> objectModification) {
-        switch (objectModification.getModificationType()) {
+        switch (objectModification.modificationType()) {
             case SUBTREE_MODIFIED:
             case WRITE:
-                final var trustedCertificate = objectModification.getDataAfter();
+                final var trustedCertificate = objectModification.dataAfter();
                 trustedCertificates.put(trustedCertificate.getName(), trustedCertificate);
                 break;
             case DELETE:
-                trustedCertificates.remove(objectModification.getDataBefore().getName());
+                trustedCertificates.remove(objectModification.dataBefore().getName());
                 break;
             default:
                 break;