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;
@Singleton
@Component(service = SslHandlerFactoryProvider.class)
public final class DefaultSslHandlerFactoryProvider
- implements SslHandlerFactoryProvider, ClusteredDataTreeChangeListener<Keystore>, AutoCloseable {
+ implements SslHandlerFactoryProvider, DataTreeChangeListener<Keystore>, AutoCloseable {
/**
* Internal state, updated atomically.
*/
@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
}
@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);
}
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);
}
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;
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;