Bug 4035: Remove unused implementations from sal-common-impl 70/24470/5
authorTony Tkacik <ttkacik@cisco.com>
Thu, 23 Jul 2015 12:23:26 +0000 (14:23 +0200)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 18 Aug 2015 18:55:37 +0000 (18:55 +0000)
Removed  left-overs from Hydrogen and Helium which are
not used anymore in Lithium codebase and will be unnecessary
in Beryllium codebase.

Removed classes were never part of public API contracts
outside of MD-SAL.

Change-Id: I2d19373b270e539598fe31b7e493db494b017100
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
14 files changed:
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractDataChange.java [deleted file]
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractDataModification.java [deleted file]
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractRoutedRegistration.java [deleted file]
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/routing/AbstractDataReadRouter.java [deleted file]
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/AbstractDataBroker.java [deleted file]
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/AbstractDataTransaction.java
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/DataChangeEventImpl.java [deleted file]
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/DataChangeListenerRegistration.java [deleted file]
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/ImmutableDataChangeEvent.java [deleted file]
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/InitialDataChangeEventImpl.java [deleted file]
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/ListenerStateCapture.java [deleted file]
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/RootedChangeSet.java [deleted file]
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/TwoPhaseCommit.java [deleted file]
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataNormalizationOperation.java

diff --git a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractDataChange.java b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractDataChange.java
deleted file mode 100644 (file)
index a90595b..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.md.sal.common.impl;
-
-import java.util.Map;
-import java.util.Set;
-
-import org.opendaylight.controller.md.sal.common.api.data.DataChange;
-import org.opendaylight.yangtools.concepts.Path;
-
-public abstract class AbstractDataChange<P extends Path<P>, D> implements DataChange<P, D> {
-
-    private final Map<P, D> createdCfg;
-    private final Map<P, D> createdOperational;
-    private final Set<P> removedCfg;
-    private final Set<P> removedOperational;
-    private final Map<P, D> updatedCfg;
-    private final Map<P, D> updatedOperational;
-
-    public AbstractDataChange(Map<P, D> createdCfg, Map<P, D> createdOperational, Set<P> removedCfg,
-            Set<P> removedOperational, Map<P, D> updatedCfg, Map<P, D> updatedOperational) {
-        this.createdCfg = createdCfg;
-        this.createdOperational =  createdOperational;
-        this.removedCfg =  (removedCfg);
-        this.removedOperational =  (removedOperational);
-        this.updatedCfg =  (updatedCfg);
-        this.updatedOperational =  (updatedOperational);
-    }
-
-    @Override
-    public final Map<P, D> getCreatedConfigurationData() {
-        return this.createdCfg;
-    }
-
-    @Override
-    public final Map<P, D> getCreatedOperationalData() {
-        return this.createdOperational;
-    }
-
-    @Override
-    public final Set<P> getRemovedConfigurationData() {
-        return this.removedCfg;
-    }
-
-    @Override
-    public final Set<P> getRemovedOperationalData() {
-        return this.removedOperational;
-    }
-
-    @Override
-    public final Map<P, D> getUpdatedConfigurationData() {
-        return this.updatedCfg;
-    }
-
-    @Override
-    public final Map<P, D> getUpdatedOperationalData() {
-        return this.updatedOperational;
-    }
-
-}
diff --git a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractDataModification.java b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractDataModification.java
deleted file mode 100644 (file)
index 1d3967f..0000000
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.md.sal.common.impl;
-
-import static org.opendaylight.controller.md.sal.common.api.TransactionStatus.NEW;
-
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.opendaylight.controller.md.sal.common.api.data.DataModification;
-import org.opendaylight.controller.md.sal.common.api.data.DataReader;
-import org.opendaylight.yangtools.concepts.Path;
-
-@Deprecated
-public abstract class AbstractDataModification<P extends Path<P>, D> implements DataModification<P, D> {
-
-    private final Map<P, D> operationalOriginal;
-    private final Map<P, D> configurationOriginal;
-
-    private final Map<P, D> operationalCreated;
-    private final Map<P, D> configurationCreated;
-
-    private final Map<P, D> configurationUpdate;
-    private final Map<P, D> operationalUpdate;
-
-    private final Map<P, P> configurationRemove;
-    private final Map<P, P> operationalRemove;
-
-    private final Map<P, D> unmodifiable_configurationOriginal;
-    private final Map<P, D> unmodifiable_operationalOriginal;
-    private final Map<P, D> unmodifiable_configurationCreated;
-    private final Map<P, D> unmodifiable_operationalCreated;
-    private final Map<P, D> unmodifiable_configurationUpdate;
-    private final Map<P, D> unmodifiable_operationalUpdate;
-    private final Set<P> unmodifiable_configurationRemove;
-    private final Set<P> unmodifiable_OperationalRemove;
-    private final DataReader<P, D> reader;
-
-    public AbstractDataModification(final DataReader<P, D> reader) {
-        this.reader = reader;
-        this.configurationUpdate = new LinkedHashMap<>();
-        this.operationalUpdate = new LinkedHashMap<>();
-        this.configurationRemove = new LinkedHashMap<>();
-        this.operationalRemove = new LinkedHashMap<>();
-
-        this.configurationOriginal = new LinkedHashMap<>();
-        this.operationalOriginal = new LinkedHashMap<>();
-
-        this.configurationCreated = new LinkedHashMap<>();
-        this.operationalCreated = new LinkedHashMap<>();
-
-        unmodifiable_configurationOriginal = Collections.unmodifiableMap(configurationOriginal);
-        unmodifiable_operationalOriginal = Collections.unmodifiableMap(operationalOriginal);
-        unmodifiable_configurationCreated = Collections.unmodifiableMap(configurationCreated);
-        unmodifiable_operationalCreated = Collections.unmodifiableMap(operationalCreated);
-        unmodifiable_configurationUpdate = Collections.unmodifiableMap(configurationUpdate);
-        unmodifiable_operationalUpdate = Collections.unmodifiableMap(operationalUpdate);
-        unmodifiable_configurationRemove = Collections.unmodifiableSet(configurationRemove.keySet());
-        unmodifiable_OperationalRemove = Collections.unmodifiableSet(operationalRemove.keySet());
-    }
-
-    @Override
-    public final void putConfigurationData(final P path, final D data) {
-        checkMutable();
-        D original = null;
-        if ((original = getConfigurationOriginal(path)) == null) {
-            configurationCreated.put(path, data);
-        }
-
-        configurationUpdate.put(path, mergeConfigurationData(path,original, data));
-    }
-
-    @Override
-    public final void putOperationalData(final P path, final D data) {
-        checkMutable();
-        D original = null;
-        if ((original = getOperationalOriginal(path)) == null) {
-            operationalCreated.put(path, data);
-        }
-        operationalUpdate.put(path, mergeOperationalData(path,original,data));
-    }
-
-    @Override
-    public final void removeOperationalData(final P path) {
-        checkMutable();
-        getOperationalOriginal(path);
-        operationalUpdate.remove(path);
-        operationalRemove.put(path, path);
-    }
-
-    @Override
-    public final void removeConfigurationData(final P path) {
-        checkMutable();
-        getConfigurationOriginal(path);
-        configurationUpdate.remove(path);
-        configurationRemove.put(path, path);
-    }
-
-    private final void checkMutable() {
-        if (!NEW.equals(this.getStatus())) {
-            throw new IllegalStateException("Transaction was already submitted");
-        }
-    }
-
-    @Override
-    public final Map<P, D> getUpdatedConfigurationData() {
-
-        return unmodifiable_configurationUpdate;
-    }
-
-    @Override
-    public final Map<P, D> getUpdatedOperationalData() {
-        return unmodifiable_operationalUpdate;
-    }
-
-    @Override
-    public final Set<P> getRemovedConfigurationData() {
-        return unmodifiable_configurationRemove;
-    }
-
-    @Override
-    public final Set<P> getRemovedOperationalData() {
-        return unmodifiable_OperationalRemove;
-    }
-
-    @Override
-    public Map<P, D> getCreatedConfigurationData() {
-        return unmodifiable_configurationCreated;
-    }
-
-    @Override
-    public Map<P, D> getCreatedOperationalData() {
-        return unmodifiable_operationalCreated;
-    }
-
-    @Override
-    public Map<P, D> getOriginalConfigurationData() {
-        return unmodifiable_configurationOriginal;
-    }
-
-    @Override
-    public Map<P, D> getOriginalOperationalData() {
-        return unmodifiable_operationalOriginal;
-    }
-
-    @Override
-    public D readOperationalData(final P path) {
-        return reader.readOperationalData(path);
-    }
-
-    @Override
-    public D readConfigurationData(final P path) {
-        return reader.readConfigurationData(path);
-    }
-
-    private D getConfigurationOriginal(final P path) {
-        D data = configurationOriginal.get(path);
-        if (data != null) {
-            return data;
-        }
-        data = reader.readConfigurationData(path);
-        if (data != null) {
-            configurationOriginal.put(path, data);
-            return data;
-        }
-        return null;
-    }
-
-    private D getOperationalOriginal(final P path) {
-        D data = operationalOriginal.get(path);
-        if (data != null) {
-            return data;
-        }
-        data = reader.readOperationalData(path);
-        if (data != null) {
-            operationalOriginal.put(path, data);
-            return data;
-        }
-        return null;
-    }
-
-    protected D mergeOperationalData(final P path,final D stored, final D modified) {
-        return modified;
-    }
-
-    protected D mergeConfigurationData(final P path,final D stored, final D modified) {
-        return modified;
-    }
-}
diff --git a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractRoutedRegistration.java b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractRoutedRegistration.java
deleted file mode 100644 (file)
index 22c458a..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.md.sal.common.impl;
-
-import org.opendaylight.controller.md.sal.common.api.routing.RoutedRegistration;
-import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
-import org.opendaylight.yangtools.concepts.Path;
-
-public abstract class AbstractRoutedRegistration<C, P extends Path<P>, S> extends AbstractObjectRegistration<S> implements
-        RoutedRegistration<C, P, S> {
-
-    public AbstractRoutedRegistration(S instance) {
-        super(instance);
-    }
-}
diff --git a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/routing/AbstractDataReadRouter.java b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/routing/AbstractDataReadRouter.java
deleted file mode 100644 (file)
index fea06bb..0000000
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.md.sal.common.impl.routing;
-
-import java.util.Map.Entry;
-
-import org.opendaylight.controller.md.sal.common.api.data.DataReader;
-import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
-import org.opendaylight.yangtools.concepts.Path;
-import org.opendaylight.yangtools.concepts.Registration;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.collect.FluentIterable;
-import com.google.common.collect.HashMultimap;
-import com.google.common.collect.Multimap;
-import com.google.common.collect.Multimaps;
-
-/**
- * Base abstract implementation of DataReadRouter, which performs
- * a read operation on multiple data readers and then merges result.
- *
- * @param <P>
- * @param <D>
- */
-@Deprecated
-public abstract class AbstractDataReadRouter<P extends Path<P>, D> implements DataReader<P, D> {
-
-    Multimap<P, DataReaderRegistration<P, D>> configReaders = Multimaps.synchronizedSetMultimap(HashMultimap.<P, DataReaderRegistration<P, D>>create());
-    Multimap<P, DataReaderRegistration<P, D>> operationalReaders = Multimaps.synchronizedSetMultimap(HashMultimap.<P, DataReaderRegistration<P, D>>create());
-
-    @Override
-    public D readConfigurationData(P path) {
-        FluentIterable<D> dataBits = FluentIterable //
-                .from(getReaders(configReaders, path)).transform(configurationRead(path));
-        return merge(path,dataBits);
-    }
-
-    @Override
-    public D readOperationalData(P path) {
-        FluentIterable<D> dataBits = FluentIterable //
-                .from(getReaders(operationalReaders, path)).transform(operationalRead(path));
-        return merge(path,dataBits);
-
-    }
-
-    /**
-     * Merges data readed by reader instances from specified path
-     *
-     * @param path Path on which read was performed
-     * @param data Data which was returned by read operation.
-     * @return Merged result.
-     */
-    protected abstract D merge(P path,Iterable<D> data);
-
-    /**
-     * Returns a function which performs configuration read for supplied path
-     *
-     * @param path
-     * @return function which performs configuration read for supplied path
-     */
-
-    private Function<DataReader<P, D>, D> configurationRead(final P path) {
-        return new Function<DataReader<P, D>, D>() {
-            @Override
-            public D apply(DataReader<P, D> input) {
-                return input.readConfigurationData(path);
-            }
-        };
-    }
-
-    /**
-     * Returns a function which performs operational read for supplied path
-     *
-     * @param path
-     * @return function which performs operational read for supplied path
-     */
-    private Function<DataReader<P, D>, D> operationalRead(final P path) {
-        return new Function<DataReader<P, D>, D>() {
-            @Override
-            public D apply(DataReader<P, D> input) {
-                return input.readOperationalData(path);
-            }
-        };
-    }
-
-    // Registrations
-
-    /**
-     * Register's a reader for operational data.
-     *
-     * @param path Path which is served by this reader
-     * @param reader Reader instance which is responsible for reading particular subpath.
-     * @return
-     */
-    public Registration registerOperationalReader(P path, DataReader<P, D> reader) {
-        OperationalDataReaderRegistration<P, D> ret = new OperationalDataReaderRegistration<>(path, reader);
-        operationalReaders.put(path, ret);
-        return ret;
-    }
-
-    public Registration registerConfigurationReader(P path, DataReader<P, D> reader) {
-        ConfigurationDataReaderRegistration<P, D> ret = new ConfigurationDataReaderRegistration<>(path, reader);
-        configReaders.put(path, ret);
-        return ret;
-    }
-
-    Iterable<DataReader<P, D>> getOperationalReaders(P path) {
-        return getReaders(operationalReaders, path);
-    }
-
-    Iterable<DataReader<P, D>> getConfigurationReaders(P path) {
-        return getReaders(configReaders, path);
-    }
-
-    private Iterable<DataReader<P, D>> getReaders(Multimap<P, DataReaderRegistration<P, D>> readerMap, P path) {
-        return FluentIterable
-            .from(readerMap.entries()) //
-            .filter(affects(path)) //
-            .transform(retrieveInstance());
-    }
-
-    private void removeRegistration(OperationalDataReaderRegistration<?, ?> registration) {
-        operationalReaders.remove(registration.getKey(), registration);
-    }
-
-    private void removeRegistration(ConfigurationDataReaderRegistration<?, ?> registration) {
-        configReaders.remove(registration.getKey(), registration);
-    }
-
-    private Function<? super Entry<P, DataReaderRegistration<P, D>>, DataReader<P, D>> retrieveInstance() {
-        return new Function<Entry<P, DataReaderRegistration<P, D>>, DataReader<P,D>>() {
-            @Override
-            public DataReader<P, D> apply(Entry<P, DataReaderRegistration<P, D>> input) {
-                return input.getValue().getInstance();
-            }
-        };
-    }
-
-    private Predicate<? super Entry<P, DataReaderRegistration<P, D>>> affects(final P path) {
-
-        return new Predicate<Entry<P, DataReaderRegistration<P, D>>>() {
-
-            @Override
-            public boolean apply(Entry<P, DataReaderRegistration<P, D>> input) {
-                final P key = input.getKey();
-                return key.contains(path) || ((P) path).contains(key);
-            }
-
-        };
-    }
-
-    @SuppressWarnings("hiding")
-    private class ConfigurationDataReaderRegistration<P extends Path<P>, D> extends DataReaderRegistration<P, D> {
-
-        public ConfigurationDataReaderRegistration(P key, DataReader<P, D> instance) {
-            super(key, instance);
-        }
-
-        @Override
-        protected void removeRegistration() {
-            AbstractDataReadRouter.this.removeRegistration(this);
-        }
-    }
-
-    @SuppressWarnings("hiding")
-    private class OperationalDataReaderRegistration<P extends Path<P>, D> extends DataReaderRegistration<P, D> {
-
-        public OperationalDataReaderRegistration(P key, DataReader<P, D> instance) {
-            super(key, instance);
-        }
-
-        @Override
-        protected void removeRegistration() {
-            AbstractDataReadRouter.this.removeRegistration(this);
-        }
-    }
-
-    private abstract static class DataReaderRegistration<P extends Path<P>, D> extends
-            AbstractObjectRegistration<DataReader<P, D>> {
-
-        private final P key;
-
-        public P getKey() {
-            return this.key;
-        }
-
-        public DataReaderRegistration(P key, DataReader<P, D> instance) {
-            super(instance);
-            this.key = key;
-        }
-    }
-}
diff --git a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/AbstractDataBroker.java b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/AbstractDataBroker.java
deleted file mode 100644 (file)
index 88cb039..0000000
+++ /dev/null
@@ -1,438 +0,0 @@
-/**
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.md.sal.common.impl.service;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Future;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-import org.opendaylight.controller.md.sal.common.api.RegistrationListener;
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
-import org.opendaylight.controller.md.sal.common.api.data.DataChangeEvent;
-import org.opendaylight.controller.md.sal.common.api.data.DataChangeListener;
-import org.opendaylight.controller.md.sal.common.api.data.DataChangePublisher;
-import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler;
-import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandlerRegistration;
-import org.opendaylight.controller.md.sal.common.api.data.DataModificationTransactionFactory;
-import org.opendaylight.controller.md.sal.common.api.data.DataProvisionService;
-import org.opendaylight.controller.md.sal.common.api.data.DataReader;
-import org.opendaylight.controller.md.sal.common.impl.routing.AbstractDataReadRouter;
-import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
-import org.opendaylight.yangtools.concepts.CompositeObjectRegistration;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.concepts.Path;
-import org.opendaylight.yangtools.concepts.Registration;
-import org.opendaylight.yangtools.util.ListenerRegistry;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Function;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-import com.google.common.collect.FluentIterable;
-import com.google.common.collect.HashMultimap;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Multimap;
-import com.google.common.collect.Multimaps;
-import com.google.common.util.concurrent.MoreExecutors;
-
-@Deprecated
-public abstract class AbstractDataBroker<P extends Path<P>, D extends Object, DCL extends DataChangeListener<P, D>>
-        implements DataModificationTransactionFactory<P, D>, DataReader<P, D>, DataChangePublisher<P, D, DCL>,
-        DataProvisionService<P, D> {
-    private final static Logger LOG = LoggerFactory.getLogger(AbstractDataBroker.class);
-
-    private ExecutorService executor;
-
-    public ExecutorService getExecutor() {
-        return this.executor;
-    }
-
-    public void setExecutor(final ExecutorService executor) {
-        this.executor = executor;
-    }
-
-    private ExecutorService notificationExecutor = MoreExecutors.sameThreadExecutor();
-
-    public ExecutorService getNotificationExecutor() {
-        return this.notificationExecutor;
-    }
-
-    public void setNotificationExecutor(final ExecutorService notificationExecutor) {
-        this.notificationExecutor = notificationExecutor;
-    }
-
-    private AbstractDataReadRouter<P, D> dataReadRouter;
-
-    private final AtomicLong submittedTransactionsCount = new AtomicLong();
-
-    private final AtomicLong failedTransactionsCount = new AtomicLong();
-
-    private final AtomicLong finishedTransactionsCount = new AtomicLong();
-
-    public AbstractDataReadRouter<P, D> getDataReadRouter() {
-        return this.dataReadRouter;
-    }
-
-    public void setDataReadRouter(final AbstractDataReadRouter<P, D> dataReadRouter) {
-        this.dataReadRouter = dataReadRouter;
-    }
-
-    public AtomicLong getSubmittedTransactionsCount() {
-        return this.submittedTransactionsCount;
-    }
-
-    public AtomicLong getFailedTransactionsCount() {
-        return this.failedTransactionsCount;
-    }
-
-    public AtomicLong getFinishedTransactionsCount() {
-        return this.finishedTransactionsCount;
-    }
-
-    private final Multimap<P, DataChangeListenerRegistration<P, D, DCL>> listeners = Multimaps
-            .synchronizedSetMultimap(HashMultimap.<P, DataChangeListenerRegistration<P, D, DCL>> create());
-
-    private final Multimap<P, DataCommitHandlerRegistrationImpl<P, D>> commitHandlers = Multimaps
-            .synchronizedSetMultimap(HashMultimap.<P, DataCommitHandlerRegistrationImpl<P, D>> create());
-
-    private final Lock registrationLock = new ReentrantLock();
-
-    private final ListenerRegistry<RegistrationListener<DataCommitHandlerRegistration<P, D>>> commitHandlerRegistrationListeners = new ListenerRegistry<RegistrationListener<DataCommitHandlerRegistration<P, D>>>();
-
-    public AbstractDataBroker() {
-    }
-
-    protected ImmutableList<DataCommitHandler<P, D>> affectedCommitHandlers(final Set<P> paths) {
-        final Supplier<ImmutableList<DataCommitHandler<P, D>>> _function = new Supplier<ImmutableList<DataCommitHandler<P, D>>>() {
-            @Override
-            public ImmutableList<DataCommitHandler<P, D>> get() {
-                Map<P, Collection<DataCommitHandlerRegistrationImpl<P, D>>> _asMap = commitHandlers.asMap();
-                Set<Entry<P, Collection<DataCommitHandlerRegistrationImpl<P, D>>>> _entrySet = _asMap.entrySet();
-                FluentIterable<Entry<P, Collection<DataCommitHandlerRegistrationImpl<P, D>>>> _from = FluentIterable
-                        .<Entry<P, Collection<DataCommitHandlerRegistrationImpl<P, D>>>> from(_entrySet);
-                final Predicate<Entry<P, Collection<DataCommitHandlerRegistrationImpl<P, D>>>> _function = new Predicate<Entry<P, Collection<DataCommitHandlerRegistrationImpl<P, D>>>>() {
-                    @Override
-                    public boolean apply(final Entry<P, Collection<DataCommitHandlerRegistrationImpl<P, D>>> it) {
-                        P _key = it.getKey();
-                        boolean _isAffectedBy = isAffectedBy(_key, paths);
-                        return _isAffectedBy;
-                    }
-                };
-                FluentIterable<Entry<P, Collection<DataCommitHandlerRegistrationImpl<P, D>>>> _filter = _from
-                        .filter(_function);
-                final Function<Entry<P, Collection<DataCommitHandlerRegistrationImpl<P, D>>>, Collection<DataCommitHandlerRegistrationImpl<P, D>>> _function_1 = new Function<Entry<P, Collection<DataCommitHandlerRegistrationImpl<P, D>>>, Collection<DataCommitHandlerRegistrationImpl<P, D>>>() {
-                    @Override
-                    public Collection<DataCommitHandlerRegistrationImpl<P, D>> apply(
-                            final Entry<P, Collection<DataCommitHandlerRegistrationImpl<P, D>>> it) {
-                        Collection<DataCommitHandlerRegistrationImpl<P, D>> _value = it.getValue();
-                        return _value;
-                    }
-                };
-                FluentIterable<DataCommitHandlerRegistrationImpl<P, D>> _transformAndConcat = _filter
-                        .<DataCommitHandlerRegistrationImpl<P, D>> transformAndConcat(_function_1);
-                final Function<DataCommitHandlerRegistrationImpl<P, D>, DataCommitHandler<P, D>> _function_2 = new Function<DataCommitHandlerRegistrationImpl<P, D>, DataCommitHandler<P, D>>() {
-                    @Override
-                    public DataCommitHandler<P, D> apply(final DataCommitHandlerRegistrationImpl<P, D> it) {
-                        DataCommitHandler<P, D> _instance = it.getInstance();
-                        return _instance;
-                    }
-                };
-                FluentIterable<DataCommitHandler<P, D>> _transform = _transformAndConcat
-                        .<DataCommitHandler<P, D>> transform(_function_2);
-                return _transform.toList();
-            }
-        };
-        return AbstractDataBroker.<ImmutableList<DataCommitHandler<P, D>>> withLock(this.registrationLock, _function);
-    }
-
-    protected ImmutableList<DataCommitHandler<P, D>> probablyAffectedCommitHandlers(final HashSet<P> paths) {
-        final Supplier<ImmutableList<DataCommitHandler<P, D>>> _function = new Supplier<ImmutableList<DataCommitHandler<P, D>>>() {
-            @Override
-            public ImmutableList<DataCommitHandler<P, D>> get() {
-                Map<P, Collection<DataCommitHandlerRegistrationImpl<P, D>>> _asMap = commitHandlers.asMap();
-                Set<Entry<P, Collection<DataCommitHandlerRegistrationImpl<P, D>>>> _entrySet = _asMap.entrySet();
-                FluentIterable<Entry<P, Collection<DataCommitHandlerRegistrationImpl<P, D>>>> _from = FluentIterable
-                        .<Entry<P, Collection<DataCommitHandlerRegistrationImpl<P, D>>>> from(_entrySet);
-                final Predicate<Entry<P, Collection<DataCommitHandlerRegistrationImpl<P, D>>>> _function = new Predicate<Entry<P, Collection<DataCommitHandlerRegistrationImpl<P, D>>>>() {
-                    @Override
-                    public boolean apply(final Entry<P, Collection<DataCommitHandlerRegistrationImpl<P, D>>> it) {
-                        P _key = it.getKey();
-                        boolean _isProbablyAffectedBy = isProbablyAffectedBy(_key, paths);
-                        return _isProbablyAffectedBy;
-                    }
-                };
-                FluentIterable<Entry<P, Collection<DataCommitHandlerRegistrationImpl<P, D>>>> _filter = _from
-                        .filter(_function);
-                final Function<Entry<P, Collection<DataCommitHandlerRegistrationImpl<P, D>>>, Collection<DataCommitHandlerRegistrationImpl<P, D>>> _function_1 = new Function<Entry<P, Collection<DataCommitHandlerRegistrationImpl<P, D>>>, Collection<DataCommitHandlerRegistrationImpl<P, D>>>() {
-                    @Override
-                    public Collection<DataCommitHandlerRegistrationImpl<P, D>> apply(
-                            final Entry<P, Collection<DataCommitHandlerRegistrationImpl<P, D>>> it) {
-                        Collection<DataCommitHandlerRegistrationImpl<P, D>> _value = it.getValue();
-                        return _value;
-                    }
-                };
-                FluentIterable<DataCommitHandlerRegistrationImpl<P, D>> _transformAndConcat = _filter
-                        .<DataCommitHandlerRegistrationImpl<P, D>> transformAndConcat(_function_1);
-                final Function<DataCommitHandlerRegistrationImpl<P, D>, DataCommitHandler<P, D>> _function_2 = new Function<DataCommitHandlerRegistrationImpl<P, D>, DataCommitHandler<P, D>>() {
-                    @Override
-                    public DataCommitHandler<P, D> apply(final DataCommitHandlerRegistrationImpl<P, D> it) {
-                        DataCommitHandler<P, D> _instance = it.getInstance();
-                        return _instance;
-                    }
-                };
-                FluentIterable<DataCommitHandler<P, D>> _transform = _transformAndConcat
-                        .<DataCommitHandler<P, D>> transform(_function_2);
-                return _transform.toList();
-            }
-        };
-        return AbstractDataBroker.<ImmutableList<DataCommitHandler<P, D>>> withLock(this.registrationLock, _function);
-    }
-
-    protected Map<P, D> deepGetBySubpath(final Map<P, D> dataSet, final P path) {
-        return Collections.<P, D> emptyMap();
-    }
-
-    @Override
-    public final D readConfigurationData(final P path) {
-        AbstractDataReadRouter<P, D> _dataReadRouter = this.getDataReadRouter();
-        return _dataReadRouter.readConfigurationData(path);
-    }
-
-    @Override
-    public final D readOperationalData(final P path) {
-        AbstractDataReadRouter<P, D> _dataReadRouter = this.getDataReadRouter();
-        return _dataReadRouter.readOperationalData(path);
-    }
-
-    private static <T extends Object> T withLock(final Lock lock, final Supplier<T> method) {
-        lock.lock();
-        try {
-            return method.get();
-        } finally {
-            lock.unlock();
-        }
-    }
-
-    @Override
-    public final Registration registerCommitHandler(final P path,
-            final DataCommitHandler<P, D> commitHandler) {
-        synchronized (commitHandler) {
-            final DataCommitHandlerRegistrationImpl<P, D> registration = new DataCommitHandlerRegistrationImpl<P, D>(
-                    path, commitHandler, this);
-            commitHandlers.put(path, registration);
-            LOG.trace("Registering Commit Handler {} for path: {}", commitHandler, path);
-            for (final ListenerRegistration<RegistrationListener<DataCommitHandlerRegistration<P, D>>> listener : commitHandlerRegistrationListeners) {
-                try {
-                    listener.getInstance().onRegister(registration);
-                } catch (Exception e) {
-                    LOG.error("Unexpected exception in listener {} during invoking onRegister", listener.getInstance(),
-                            e);
-                }
-            }
-            return registration;
-        }
-    }
-
-    @Override
-    public final ListenerRegistration<DCL> registerDataChangeListener(final P path, final DCL listener) {
-        synchronized (listeners) {
-            final DataChangeListenerRegistration<P, D, DCL> reg = new DataChangeListenerRegistration<P, D, DCL>(path,
-                    listener, AbstractDataBroker.this);
-            listeners.put(path, reg);
-            final D initialConfig = getDataReadRouter().readConfigurationData(path);
-            final D initialOperational = getDataReadRouter().readOperationalData(path);
-            final DataChangeEvent<P, D> event = createInitialListenerEvent(path, initialConfig, initialOperational);
-            listener.onDataChanged(event);
-            return reg;
-        }
-    }
-
-    public final CompositeObjectRegistration<DataReader<P, D>> registerDataReader(final P path,
-            final DataReader<P, D> reader) {
-
-        final Registration confReg = getDataReadRouter().registerConfigurationReader(path, reader);
-        final Registration dataReg = getDataReadRouter().registerOperationalReader(path, reader);
-        return new CompositeObjectRegistration<DataReader<P, D>>(reader, Arrays.asList(confReg, dataReg));
-    }
-
-    @Override
-    public ListenerRegistration<RegistrationListener<DataCommitHandlerRegistration<P, D>>> registerCommitHandlerListener(
-            final RegistrationListener<DataCommitHandlerRegistration<P, D>> commitHandlerListener) {
-        final ListenerRegistration<RegistrationListener<DataCommitHandlerRegistration<P, D>>> ret = this.commitHandlerRegistrationListeners
-                .register(commitHandlerListener);
-        return ret;
-    }
-
-    protected DataChangeEvent<P, D> createInitialListenerEvent(final P path, final D initialConfig,
-            final D initialOperational) {
-        InitialDataChangeEventImpl<P, D> _initialDataChangeEventImpl = new InitialDataChangeEventImpl<P, D>(
-                initialConfig, initialOperational);
-        return _initialDataChangeEventImpl;
-    }
-
-    protected final void removeListener(final DataChangeListenerRegistration<P, D, DCL> registration) {
-        synchronized (listeners) {
-            listeners.remove(registration.getPath(), registration);
-        }
-    }
-
-    protected final void removeCommitHandler(final DataCommitHandlerRegistrationImpl<P, D> registration) {
-        synchronized (commitHandlers) {
-
-            commitHandlers.remove(registration.getPath(), registration);
-            LOG.trace("Removing Commit Handler {} for path: {}", registration.getInstance(), registration.getPath());
-            for (final ListenerRegistration<RegistrationListener<DataCommitHandlerRegistration<P, D>>> listener : commitHandlerRegistrationListeners) {
-                try {
-                    listener.getInstance().onUnregister(registration);
-                } catch (Exception e) {
-                    LOG.error("Unexpected exception in listener {} during invoking onUnregister",
-                            listener.getInstance(), e);
-                }
-            }
-        }
-
-    }
-
-    protected final Collection<Entry<P, DataCommitHandlerRegistrationImpl<P, D>>> getActiveCommitHandlers() {
-        return commitHandlers.entries();
-    }
-
-    protected ImmutableList<ListenerStateCapture<P, D, DCL>> affectedListeners(final Set<P> paths) {
-
-        synchronized (listeners) {
-            return FluentIterable //
-                    .from(listeners.asMap().entrySet()) //
-                    .filter(new Predicate<Entry<P, Collection<DataChangeListenerRegistration<P, D, DCL>>>>() {
-                        @Override
-                        public boolean apply(final Entry<P, Collection<DataChangeListenerRegistration<P, D, DCL>>> it) {
-                            return isAffectedBy(it.getKey(), paths);
-                        }
-                    }) //
-                    .transform(
-                            new Function<Entry<P, Collection<DataChangeListenerRegistration<P, D, DCL>>>, ListenerStateCapture<P, D, DCL>>() {
-                                @Override
-                                public ListenerStateCapture<P, D, DCL> apply(
-                                        final Entry<P, Collection<DataChangeListenerRegistration<P, D, DCL>>> it) {
-                                    return new ListenerStateCapture<P, D, DCL>(it.getKey(), it.getValue(),
-                                            createContainsPredicate(it.getKey()));
-                                }
-                            }) //
-                    .toList();
-        }
-    }
-
-    protected ImmutableList<ListenerStateCapture<P, D, DCL>> probablyAffectedListeners(final Set<P> paths) {
-        synchronized (listeners) {
-            return FluentIterable //
-                    .from(listeners.asMap().entrySet()) //
-                    .filter(new Predicate<Entry<P, Collection<DataChangeListenerRegistration<P, D, DCL>>>>() {
-                        @Override
-                        public boolean apply(final Entry<P, Collection<DataChangeListenerRegistration<P, D, DCL>>> it) {
-                            return isProbablyAffectedBy(it.getKey(), paths);
-                        }
-                    }) //
-                    .transform(
-                            new Function<Entry<P, Collection<DataChangeListenerRegistration<P, D, DCL>>>, ListenerStateCapture<P, D, DCL>>() {
-                                @Override
-                                public ListenerStateCapture<P, D, DCL> apply(
-                                        final Entry<P, Collection<DataChangeListenerRegistration<P, D, DCL>>> it) {
-                                    return new ListenerStateCapture<P, D, DCL>(it.getKey(), it.getValue(),
-                                            createIsContainedPredicate(it.getKey()));
-                                }
-                            }) //
-                    .toList();
-        }
-    }
-
-    protected Predicate<P> createContainsPredicate(final P key) {
-        return new Predicate<P>() {
-            @Override
-            public boolean apply(final P other) {
-                return key.contains(other);
-            }
-        };
-    }
-
-    protected Predicate<P> createIsContainedPredicate(final P key) {
-        return new Predicate<P>() {
-            @Override
-            public boolean apply(final P other) {
-                return other.contains(key);
-            }
-        };
-    }
-
-    protected boolean isAffectedBy(final P key, final Set<P> paths) {
-        final Predicate<P> contains = this.createContainsPredicate(key);
-        if (paths.contains(key)) {
-            return true;
-        }
-        for (final P path : paths) {
-            if (contains.apply(path)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    protected boolean isProbablyAffectedBy(final P key, final Set<P> paths) {
-        final Predicate<P> isContained = this.createIsContainedPredicate(key);
-        for (final P path : paths) {
-            if (isContained.apply(path)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    final Future<RpcResult<TransactionStatus>> commit(final AbstractDataTransaction<P, D> transaction) {
-        Preconditions.checkNotNull(transaction);
-        final TwoPhaseCommit<P, D, DCL> task = new TwoPhaseCommit<P, D, DCL>(transaction, this);
-
-        this.getSubmittedTransactionsCount().getAndIncrement();
-        return this.getExecutor().submit(task);
-    }
-
-    private static class DataCommitHandlerRegistrationImpl<P extends Path<P>, D extends Object> //
-            extends AbstractObjectRegistration<DataCommitHandler<P, D>> //
-            implements DataCommitHandlerRegistration<P, D> {
-
-        private AbstractDataBroker<P, D, ? extends Object> dataBroker;
-        private final P path;
-
-        @Override
-        public P getPath() {
-            return this.path;
-        }
-
-        public DataCommitHandlerRegistrationImpl(final P path, final DataCommitHandler<P, D> instance,
-                final AbstractDataBroker<P, D, ? extends Object> broker) {
-            super(instance);
-            this.dataBroker = broker;
-            this.path = path;
-        }
-
-        @Override
-        protected void removeRegistration() {
-            this.dataBroker.removeCommitHandler(this);
-            this.dataBroker = null;
-        }
-    }
-}
index be95bc4..f83a778 100644 (file)
  */
 package org.opendaylight.controller.md.sal.common.impl.service;
 
-import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.AsyncFunction;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
-import org.opendaylight.controller.md.sal.common.impl.AbstractDataModification;
-import org.opendaylight.yangtools.concepts.Path;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 @Deprecated
-public abstract class AbstractDataTransaction<P extends Path<P>, D extends Object> extends
-        AbstractDataModification<P, D> {
+public abstract class AbstractDataTransaction {
     private static final Logger LOG = LoggerFactory.getLogger(AbstractDataTransaction.class);
     private static final ListenableFuture<RpcResult<TransactionStatus>> SUCCESS_FUTURE =
             Futures.immediateFuture(RpcResultBuilder.success(TransactionStatus.COMMITED).build());
 
-    private final Object identifier;
-    private final long allocationTime;
-    private long readyTime = 0;
-    private long completeTime = 0;
-
-    private TransactionStatus status = TransactionStatus.NEW;
-
-    private final AbstractDataBroker<P, D, ? extends Object> broker;
-
-    protected AbstractDataTransaction(final Object identifier,
-            final AbstractDataBroker<P, D, ? extends Object> dataBroker) {
-        super(dataBroker);
-        this.identifier = Preconditions.checkNotNull(identifier);
-        this.broker = Preconditions.checkNotNull(dataBroker);
-        this.allocationTime = System.nanoTime();
-        LOG.debug("Transaction {} Allocated.", identifier);
-    }
-
-    @Override
-    public Object getIdentifier() {
-        return this.identifier;
-    }
-
-    @Override
-    public Future<RpcResult<TransactionStatus>> commit() {
-        readyTime = System.nanoTime();
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Transaction {} Ready after {}ms.", identifier, TimeUnit.NANOSECONDS.toMillis(readyTime - allocationTime));
-        }
-        changeStatus(TransactionStatus.SUBMITED);
-        return this.broker.commit(this);
-    }
-
-    @Override
-    public D readConfigurationData(final P path) {
-        final D local = getUpdatedConfigurationData().get(path);
-        if (local != null) {
-            return local;
-        }
-        return this.broker.readConfigurationData(path);
-    }
-
-    @Override
-    public D readOperationalData(final P path) {
-        final D local = this.getUpdatedOperationalData().get(path);
-        if (local != null) {
-            return local;
-        }
-        return this.broker.readOperationalData(path);
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + ((identifier == null) ? 0 : identifier.hashCode());
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        AbstractDataTransaction<?, ?> other = (AbstractDataTransaction<?, ?>) obj;
-        if (identifier == null) {
-            if (other.identifier != null) {
-                return false;
-            }
-        } else if (!identifier.equals(other.identifier)) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public TransactionStatus getStatus() {
-        return this.status;
-    }
-
-    protected abstract void onStatusChange(final TransactionStatus status);
-
-    public void succeeded() {
-        this.completeTime = System.nanoTime();
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Transaction {} Committed after {}ms.", identifier, TimeUnit.NANOSECONDS.toMillis(completeTime - readyTime));
-        }
-        changeStatus(TransactionStatus.COMMITED);
-    }
-
-    public void failed() {
-        this.completeTime = System.nanoTime();
-
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Transaction {} Failed after {}ms.", identifier, TimeUnit.NANOSECONDS.toMillis(completeTime - readyTime));
-        }
-        changeStatus(TransactionStatus.FAILED);
-    }
-
-    private void changeStatus(final TransactionStatus status) {
-        LOG.debug("Transaction {} transitioned from {} to {}", getIdentifier(), this.status, status);
-        this.status = status;
-        this.onStatusChange(status);
-    }
-
     public static ListenableFuture<RpcResult<TransactionStatus>> convertToLegacyCommitFuture(final CheckedFuture<Void,TransactionCommitFailedException> from) {
         return Futures.transform(from, new AsyncFunction<Void, RpcResult<TransactionStatus>>() {
             @Override
diff --git a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/DataChangeEventImpl.java b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/DataChangeEventImpl.java
deleted file mode 100644 (file)
index 5e2e9de..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.md.sal.common.impl.service;
-
-import java.util.Map;
-import java.util.Set;
-
-import org.opendaylight.controller.md.sal.common.api.data.DataChange;
-import org.opendaylight.controller.md.sal.common.api.data.DataChangeEvent;
-import org.opendaylight.yangtools.concepts.Immutable;
-import org.opendaylight.yangtools.concepts.Path;
-
-@Deprecated
-public class DataChangeEventImpl<P extends Path<P>, D> implements DataChangeEvent<P, D>, Immutable {
-
-    private final DataChange<P, D> dataChange;
-
-    private final D originalConfigurationSubtree;
-    private final D originalOperationalSubtree;
-    private final D updatedOperationalSubtree;
-    private final D updatedConfigurationSubtree;
-
-
-
-
-    public DataChangeEventImpl(DataChange<P, D> dataChange, D originalConfigurationSubtree,
-            D originalOperationalSubtree, D updatedOperationalSubtree, D updatedConfigurationSubtree) {
-        super();
-        this.dataChange = dataChange;
-        this.originalConfigurationSubtree = originalConfigurationSubtree;
-        this.originalOperationalSubtree = originalOperationalSubtree;
-        this.updatedOperationalSubtree = updatedOperationalSubtree;
-        this.updatedConfigurationSubtree = updatedConfigurationSubtree;
-    }
-
-    @Override
-    public D getOriginalConfigurationSubtree() {
-        return originalConfigurationSubtree;
-    }
-
-    @Override
-    public D getOriginalOperationalSubtree() {
-        return originalOperationalSubtree;
-    }
-
-    @Override
-    public D getUpdatedOperationalSubtree() {
-        return updatedOperationalSubtree;
-    }
-
-    @Override
-    public D getUpdatedConfigurationSubtree() {
-        return updatedConfigurationSubtree;
-    }
-
-    public Map<P, D> getCreatedOperationalData() {
-        return dataChange.getCreatedOperationalData();
-    }
-
-    public Map<P, D> getCreatedConfigurationData() {
-        return dataChange.getCreatedConfigurationData();
-    }
-
-    public Map<P, D> getUpdatedOperationalData() {
-        return dataChange.getUpdatedOperationalData();
-    }
-
-    public Map<P, D> getUpdatedConfigurationData() {
-        return dataChange.getUpdatedConfigurationData();
-    }
-
-    public Set<P> getRemovedConfigurationData() {
-        return dataChange.getRemovedConfigurationData();
-    }
-
-    public Set<P> getRemovedOperationalData() {
-        return dataChange.getRemovedOperationalData();
-    }
-
-    public Map<P, D> getOriginalConfigurationData() {
-        return dataChange.getOriginalConfigurationData();
-    }
-
-    public Map<P, D> getOriginalOperationalData() {
-        return dataChange.getOriginalOperationalData();
-    }
-
-}
diff --git a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/DataChangeListenerRegistration.java b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/DataChangeListenerRegistration.java
deleted file mode 100644 (file)
index 57d511e..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.md.sal.common.impl.service;
-
-import org.opendaylight.controller.md.sal.common.api.data.DataChangeListener;
-import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.concepts.Path;
-
-@SuppressWarnings("all")
-class DataChangeListenerRegistration<P extends Path<P>, D extends Object, DCL extends DataChangeListener<P, D>> extends
-        AbstractObjectRegistration<DCL> implements ListenerRegistration<DCL> {
-    private AbstractDataBroker<P, D, DCL> dataBroker;
-
-    private final P path;
-
-    public P getPath() {
-        return this.path;
-    }
-
-    public DataChangeListenerRegistration(final P path, final DCL instance, final AbstractDataBroker<P, D, DCL> broker) {
-        super(instance);
-        this.dataBroker = broker;
-        this.path = path;
-    }
-
-    @Override
-    protected void removeRegistration() {
-        this.dataBroker.removeListener(this);
-        this.dataBroker = null;
-    }
-}
diff --git a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/ImmutableDataChangeEvent.java b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/ImmutableDataChangeEvent.java
deleted file mode 100644 (file)
index 5671b48..0000000
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.controller.md.sal.common.impl.service;
-
-import java.util.Map;
-import java.util.Set;
-
-import org.opendaylight.controller.md.sal.common.api.data.DataChangeEvent;
-import org.opendaylight.controller.md.sal.common.api.data.DataModification;
-import org.opendaylight.yangtools.concepts.Path;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-
-@Deprecated
-public final class ImmutableDataChangeEvent<P extends Path<P>, D> implements DataChangeEvent<P,D> {
-
-    private final D updatedOperationalSubtree;
-    private final Map<P, D> updatedOperational;
-    private final D updatedConfigurationSubtree;
-    private final Map<P, D> updatedConfiguration;
-    private final Set<P> removedOperational;
-    private final Set<P> removedConfiguration;
-    private final D originalOperationalSubtree;
-    private final Map<P, D> originalOperational;
-    private final D originalConfigurationSubtree;
-    private final Map<P, D> originalConfiguration;
-    private final Map<P, D> createdOperational;
-    private final Map<P, D> createdConfiguration;
-
-
-    private ImmutableDataChangeEvent(final Builder<P, D> builder) {
-
-        createdConfiguration = builder.getCreatedConfiguration().build();
-        createdOperational = builder.getCreatedOperational().build();
-        originalConfiguration = builder.getOriginalConfiguration().build();
-        originalConfigurationSubtree = builder.getOriginalConfigurationSubtree();
-        originalOperational = builder.getOriginalOperational().build();
-        originalOperationalSubtree = builder.getOriginalOperationalSubtree();
-        removedConfiguration = builder.getRemovedConfiguration().build();
-        removedOperational = builder.getRemovedOperational().build();
-        updatedConfiguration = builder.getUpdatedConfiguration().build();
-        updatedConfigurationSubtree = builder.getUpdatedConfigurationSubtree();
-        updatedOperational = builder.getUpdatedOperational().build();
-        updatedOperationalSubtree = builder.getUpdatedOperationalSubtree();
-    }
-
-    @Override
-    public Map<P, D> getCreatedConfigurationData() {
-        return createdConfiguration;
-    }
-
-    @Override
-    public Map<P, D> getCreatedOperationalData() {
-        return createdOperational;
-    }
-
-    @Override
-    public Map<P, D> getOriginalConfigurationData() {
-        return originalConfiguration;
-    }
-    @Override
-    public D getOriginalConfigurationSubtree() {
-        return originalConfigurationSubtree;
-    }
-    @Override
-    public Map<P, D> getOriginalOperationalData() {
-        return originalOperational;
-    }
-    @Override
-    public D getOriginalOperationalSubtree() {
-        return originalOperationalSubtree;
-    }
-    @Override
-    public Set<P> getRemovedConfigurationData() {
-        return removedConfiguration;
-    }
-    @Override
-    public Set<P> getRemovedOperationalData() {
-        return removedOperational;
-    }
-    @Override
-    public Map<P, D> getUpdatedConfigurationData() {
-        return updatedConfiguration;
-    }
-    @Override
-    public D getUpdatedConfigurationSubtree() {
-        return updatedConfigurationSubtree;
-    }
-    @Override
-    public Map<P, D> getUpdatedOperationalData() {
-        return updatedOperational;
-    }
-    @Override
-    public D getUpdatedOperationalSubtree() {
-        return updatedOperationalSubtree;
-    }
-
-    public static final <P extends Path<P>,D> Builder<P, D> builder() {
-        return new Builder<>();
-    }
-
-    public static final class Builder<P extends Path<P>,D> {
-
-        private  D updatedOperationalSubtree;
-        private  D originalOperationalSubtree;
-        private  D originalConfigurationSubtree;
-        private  D updatedConfigurationSubtree;
-
-        private final ImmutableMap.Builder<P, D> updatedOperational = ImmutableMap.builder();
-        private final ImmutableMap.Builder<P, D> updatedConfiguration = ImmutableMap.builder();
-        private final ImmutableSet.Builder<P> removedOperational = ImmutableSet.builder();
-        private final ImmutableSet.Builder<P> removedConfiguration = ImmutableSet.builder();
-        private final ImmutableMap.Builder<P, D> originalOperational = ImmutableMap.builder();
-
-        private final ImmutableMap.Builder<P, D> originalConfiguration = ImmutableMap.builder();
-        private final ImmutableMap.Builder<P, D> createdOperational = ImmutableMap.builder();
-        private final ImmutableMap.Builder<P, D> createdConfiguration = ImmutableMap.builder();
-
-
-
-
-
-        protected Builder<P,D> addTransaction(final DataModification<P, D> data, final Predicate<P> keyFilter) {
-            updatedOperational.putAll(Maps.filterKeys(data.getUpdatedOperationalData(), keyFilter));
-            updatedConfiguration.putAll(Maps.filterKeys(data.getUpdatedConfigurationData(), keyFilter));
-            originalConfiguration.putAll(Maps.filterKeys(data.getOriginalConfigurationData(), keyFilter));
-            originalOperational.putAll(Maps.filterKeys(data.getOriginalOperationalData(), keyFilter));
-            createdOperational.putAll(Maps.filterKeys(data.getCreatedOperationalData(), keyFilter));
-            createdConfiguration.putAll(Maps.filterKeys(data.getCreatedConfigurationData(), keyFilter));
-            removedOperational.addAll(Sets.filter(data.getRemovedOperationalData(), keyFilter));
-            removedConfiguration.addAll(Sets.filter(data.getRemovedConfigurationData(), keyFilter));
-            return this;
-        }
-
-        protected Builder<P, D> addConfigurationChangeSet(final RootedChangeSet<P, D> changeSet) {
-            if(changeSet == null) {
-                return this;
-            }
-
-            originalConfiguration.putAll(changeSet.getOriginal());
-            createdConfiguration.putAll(changeSet.getCreated());
-            updatedConfiguration.putAll(changeSet.getUpdated());
-            removedConfiguration.addAll(changeSet.getRemoved());
-            return this;
-        }
-
-        protected Builder<P, D> addOperationalChangeSet(final RootedChangeSet<P, D> changeSet) {
-            if(changeSet == null) {
-                return this;
-            }
-            originalOperational.putAll(changeSet.getOriginal());
-            createdOperational.putAll(changeSet.getCreated());
-            updatedOperational.putAll(changeSet.getUpdated());
-            removedOperational.addAll(changeSet.getRemoved());
-            return this;
-        }
-
-        public ImmutableDataChangeEvent<P, D> build() {
-            return new ImmutableDataChangeEvent<P,D>(this);
-        }
-
-        protected D getUpdatedOperationalSubtree() {
-            return updatedOperationalSubtree;
-        }
-
-        public Builder<P, D> setUpdatedOperationalSubtree(final D updatedOperationalSubtree) {
-            this.updatedOperationalSubtree = updatedOperationalSubtree;
-            return this;
-        }
-
-        protected D getOriginalOperationalSubtree() {
-            return originalOperationalSubtree;
-        }
-
-        public Builder<P,D> setOriginalOperationalSubtree(final D originalOperationalSubtree) {
-            this.originalOperationalSubtree = originalOperationalSubtree;
-            return this;
-        }
-
-        protected D getOriginalConfigurationSubtree() {
-            return originalConfigurationSubtree;
-        }
-
-        public Builder<P, D> setOriginalConfigurationSubtree(final D originalConfigurationSubtree) {
-            this.originalConfigurationSubtree = originalConfigurationSubtree;
-            return this;
-        }
-
-        protected D getUpdatedConfigurationSubtree() {
-            return updatedConfigurationSubtree;
-        }
-
-        public Builder<P,D> setUpdatedConfigurationSubtree(final D updatedConfigurationSubtree) {
-            this.updatedConfigurationSubtree = updatedConfigurationSubtree;
-            return this;
-        }
-
-        protected ImmutableMap.Builder<P, D> getUpdatedOperational() {
-            return updatedOperational;
-        }
-
-        protected ImmutableMap.Builder<P, D> getUpdatedConfiguration() {
-            return updatedConfiguration;
-        }
-
-        protected ImmutableSet.Builder<P> getRemovedOperational() {
-            return removedOperational;
-        }
-
-        protected ImmutableSet.Builder<P> getRemovedConfiguration() {
-            return removedConfiguration;
-        }
-
-        protected ImmutableMap.Builder<P, D> getOriginalOperational() {
-            return originalOperational;
-        }
-
-        protected ImmutableMap.Builder<P, D> getOriginalConfiguration() {
-            return originalConfiguration;
-        }
-
-        protected ImmutableMap.Builder<P, D> getCreatedOperational() {
-            return createdOperational;
-        }
-
-        protected ImmutableMap.Builder<P, D> getCreatedConfiguration() {
-            return createdConfiguration;
-        }
-
-        public Builder<P,D> putOriginalOperational(final Map<? extends P, ? extends D> originalData) {
-            originalOperational.putAll(originalData);
-            return this;
-        }
-
-        public Builder<P,D> putCreatedOperational(final Map<? extends P, ? extends D> originalData) {
-            createdOperational.putAll(originalData);
-            return this;
-        }
-
-        public Builder<P,D> putUpdatedOperational(final Map<? extends P, ? extends D> originalData) {
-            updatedOperational.putAll(originalData);
-            return this;
-        }
-
-        public Builder<P,D> putRemovedOperational(final Set<? extends P> originalData) {
-            removedOperational.addAll(originalData);
-            return this;
-        }
-    }
-
-}
diff --git a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/InitialDataChangeEventImpl.java b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/InitialDataChangeEventImpl.java
deleted file mode 100644 (file)
index ebe7d9d..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.md.sal.common.impl.service;
-
-import java.util.Collections;
-import java.util.Map;
-import java.util.Set;
-
-import org.opendaylight.controller.md.sal.common.api.data.DataChangeEvent;
-import org.opendaylight.yangtools.concepts.Immutable;
-import org.opendaylight.yangtools.concepts.Path;
-
-@Deprecated
-public class InitialDataChangeEventImpl<P extends Path<P>,D> implements DataChangeEvent<P, D>, Immutable {
-
-    private final D updatedOperationalTree;
-    private final D updatedConfigurationTree;
-    private final Map<P,D> updatedConfigurationData;
-    private final Map<P,D> updatedOperationalData;
-
-    public InitialDataChangeEventImpl(D configTree, D operTree) {
-        updatedConfigurationTree = configTree;
-        updatedOperationalTree = operTree;
-        updatedConfigurationData = Collections.emptyMap();
-        updatedOperationalData = Collections.emptyMap();
-    }
-
-    public InitialDataChangeEventImpl(D configTree, D operTree, Map<P, D> updatedCfgData, Map<P, D> updatedOperData) {
-        updatedConfigurationTree = configTree;
-        updatedOperationalTree = operTree;
-        updatedConfigurationData = updatedCfgData;
-        updatedOperationalData = updatedOperData;
-    }
-
-    @Override
-    public Map<P, D> getCreatedConfigurationData() {
-        return Collections.emptyMap();
-    }
-
-    @Override
-    public Map<P, D> getCreatedOperationalData() {
-        return Collections.emptyMap();
-    }
-
-    @Override
-    public Map<P, D> getOriginalConfigurationData() {
-        return Collections.emptyMap();
-    }
-    @Override
-    public Map<P, D> getOriginalOperationalData() {
-        return Collections.emptyMap();
-    }
-    @Override
-    public Set<P> getRemovedConfigurationData() {
-        return Collections.emptySet();
-    }
-    @Override
-    public Set<P> getRemovedOperationalData() {
-        return Collections.emptySet();
-    }
-    @Override
-    public Map<P, D> getUpdatedConfigurationData() {
-        return updatedConfigurationData;
-    }
-
-    @Override
-    public D getUpdatedConfigurationSubtree() {
-        return updatedConfigurationTree;
-    }
-    @Override
-    public D getUpdatedOperationalSubtree() {
-        return updatedOperationalTree;
-    }
-
-    @Override
-    public D getOriginalConfigurationSubtree() {
-        return updatedConfigurationTree;
-    }
-
-    @Override
-    public D getOriginalOperationalSubtree() {
-        return updatedOperationalTree;
-    }
-
-    @Override
-    public Map<P, D> getUpdatedOperationalData() {
-        return updatedOperationalData;
-    }
-
-
-}
diff --git a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/ListenerStateCapture.java b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/ListenerStateCapture.java
deleted file mode 100644 (file)
index ab94163..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.controller.md.sal.common.impl.service;
-
-import java.util.Map;
-
-import org.opendaylight.controller.md.sal.common.api.data.DataChangeEvent;
-import org.opendaylight.controller.md.sal.common.api.data.DataChangeListener;
-import org.opendaylight.controller.md.sal.common.api.data.DataModification;
-import org.opendaylight.yangtools.concepts.Path;
-
-import com.google.common.base.Predicate;
-
-@Deprecated
-public final class ListenerStateCapture<P extends Path<P>, D, DCL extends DataChangeListener<P, D>> {
-
-    final P path;
-
-    final Iterable<DataChangeListenerRegistration<P, D, DCL>> listeners;
-
-    D initialOperationalState;
-
-    D initialConfigurationState;
-
-    D finalConfigurationState;
-
-    D finalOperationalState;
-
-    Map<P, D> additionalConfigOriginal;
-    Map<P, D> additionalConfigCreated;
-    Map<P, D> additionalConfigUpdated;
-    Map<P, D> additionalConfigDeleted;
-
-    Map<P, D> additionalOperOriginal;
-    Map<P, D> additionalOperCreated;
-    Map<P, D> additionalOperUpdated;
-    Map<P, D> additionalOperDeleted;
-
-    RootedChangeSet<P, D> normalizedConfigurationChanges;
-    RootedChangeSet<P, D> normalizedOperationalChanges;
-
-    private final Predicate<P> containsPredicate;
-
-    public ListenerStateCapture(P path, Iterable<DataChangeListenerRegistration<P, D, DCL>> listeners,
-            Predicate<P> containsPredicate) {
-        super();
-        this.path = path;
-        this.listeners = listeners;
-        this.containsPredicate = containsPredicate;
-    }
-
-    protected D getInitialOperationalState() {
-        return initialOperationalState;
-    }
-
-    protected void setInitialOperationalState(D initialOperationalState) {
-        this.initialOperationalState = initialOperationalState;
-    }
-
-    protected D getInitialConfigurationState() {
-        return initialConfigurationState;
-    }
-
-    protected void setInitialConfigurationState(D initialConfigurationState) {
-        this.initialConfigurationState = initialConfigurationState;
-    }
-
-    protected P getPath() {
-        return path;
-    }
-
-    protected Iterable<DataChangeListenerRegistration<P, D, DCL>> getListeners() {
-        return listeners;
-    }
-
-    protected D getFinalConfigurationState() {
-        return finalConfigurationState;
-    }
-
-    protected void setFinalConfigurationState(D finalConfigurationState) {
-        this.finalConfigurationState = finalConfigurationState;
-    }
-
-    protected D getFinalOperationalState() {
-        return finalOperationalState;
-    }
-
-    protected void setFinalOperationalState(D finalOperationalState) {
-        this.finalOperationalState = finalOperationalState;
-    }
-
-    protected RootedChangeSet<P, D> getNormalizedConfigurationChanges() {
-        return normalizedConfigurationChanges;
-    }
-
-    protected void setNormalizedConfigurationChanges(RootedChangeSet<P, D> normalizedConfigurationChanges) {
-        this.normalizedConfigurationChanges = normalizedConfigurationChanges;
-    }
-
-    protected RootedChangeSet<P, D> getNormalizedOperationalChanges() {
-        return normalizedOperationalChanges;
-    }
-
-    protected void setNormalizedOperationalChanges(RootedChangeSet<P, D> normalizedOperationalChange) {
-        this.normalizedOperationalChanges = normalizedOperationalChange;
-    }
-
-    protected DataChangeEvent<P, D> createEvent(DataModification<P, D> modification) {
-        return ImmutableDataChangeEvent.<P, D> builder()//
-                .addTransaction(modification, containsPredicate) //
-                .addConfigurationChangeSet(normalizedConfigurationChanges) //
-                .addOperationalChangeSet(normalizedOperationalChanges) //
-                .setOriginalConfigurationSubtree(initialConfigurationState) //
-                .setOriginalOperationalSubtree(initialOperationalState) //
-                .setUpdatedConfigurationSubtree(finalConfigurationState) //
-                .setUpdatedOperationalSubtree(finalOperationalState) //
-                .build();
-
-    }
-
-}
diff --git a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/RootedChangeSet.java b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/RootedChangeSet.java
deleted file mode 100644 (file)
index 43536b7..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.controller.md.sal.common.impl.service;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import org.opendaylight.yangtools.concepts.Path;
-
-public class RootedChangeSet<P extends Path<P>,D> {
-
-    private final P root;
-    private final Map<P,D> original;
-    private final Map<P,D> created = new HashMap<>();
-    private final Map<P,D> updated = new HashMap<>();
-    private final Set<P> removed = new HashSet<>();
-
-
-
-    public RootedChangeSet(P root,Map<P, D> original) {
-        super();
-        this.root = root;
-        this.original = original;
-    }
-
-    protected P getRoot() {
-        return root;
-    }
-
-    protected Map<P, D> getOriginal() {
-        return original;
-    }
-
-    protected Map<P, D> getCreated() {
-        return created;
-    }
-
-    protected Map<P, D> getUpdated() {
-        return updated;
-    }
-
-    protected Set<P> getRemoved() {
-        return removed;
-    }
-
-    public void addCreated(Map<P,D> created) {
-        this.created.putAll(created);
-    }
-
-    public void addCreated(Entry<P,D> entry) {
-        created.put(entry.getKey(), entry.getValue());
-    }
-
-    public void addUpdated(Entry<P,D> entry) {
-        updated.put(entry.getKey(), entry.getValue());
-    }
-
-    public void addRemoval(P path) {
-        removed.add(path);
-    }
-
-    public boolean isChange() {
-        return !created.isEmpty() || !updated.isEmpty() || !removed.isEmpty();
-    }
-}
diff --git a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/TwoPhaseCommit.java b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/TwoPhaseCommit.java
deleted file mode 100644 (file)
index 30c5898..0000000
+++ /dev/null
@@ -1,242 +0,0 @@
-/**
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.md.sal.common.impl.service;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
-import org.opendaylight.controller.md.sal.common.api.data.DataChangeEvent;
-import org.opendaylight.controller.md.sal.common.api.data.DataChangeListener;
-import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler;
-import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler.DataCommitTransaction;
-import org.opendaylight.yangtools.concepts.Path;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Optional;
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableList.Builder;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Sets;
-
-@Deprecated
-public class TwoPhaseCommit<P extends Path<P>, D extends Object, DCL extends DataChangeListener<P, D>> implements
-        Callable<RpcResult<TransactionStatus>> {
-    private final static Logger log = LoggerFactory.getLogger(TwoPhaseCommit.class);
-
-    private final AbstractDataTransaction<P, D> transaction;
-
-    private final AbstractDataBroker<P, D, DCL> dataBroker;
-
-    public TwoPhaseCommit(final AbstractDataTransaction<P, D> transaction, final AbstractDataBroker<P, D, DCL> broker) {
-        this.transaction = transaction;
-        this.dataBroker = broker;
-    }
-
-    @Override
-    public RpcResult<TransactionStatus> call() throws Exception {
-        final Object transactionId = this.transaction.getIdentifier();
-
-        Set<P> changedPaths = ImmutableSet.<P> builder().addAll(transaction.getUpdatedConfigurationData().keySet())
-                .addAll(transaction.getCreatedConfigurationData().keySet())
-                .addAll(transaction.getRemovedConfigurationData())
-                .addAll(transaction.getUpdatedOperationalData().keySet())
-                .addAll(transaction.getCreatedOperationalData().keySet())
-                .addAll(transaction.getRemovedOperationalData()).build();
-
-        log.trace("Transaction: {} Affected Subtrees: {}", transactionId, changedPaths);
-
-        // The transaction has no effects, let's just shortcut it
-        if (changedPaths.isEmpty()) {
-            dataBroker.getFinishedTransactionsCount().getAndIncrement();
-            transaction.succeeded();
-
-            log.trace("Transaction: {} Finished successfully (no effects).", transactionId);
-
-            return RpcResultBuilder.<TransactionStatus> success( TransactionStatus.COMMITED ).build();
-        }
-
-        final ImmutableList.Builder<ListenerStateCapture<P, D, DCL>> listenersBuilder = ImmutableList.builder();
-        listenersBuilder.addAll(dataBroker.affectedListeners(changedPaths));
-        filterProbablyAffectedListeners(dataBroker.probablyAffectedListeners(changedPaths),listenersBuilder);
-
-
-
-        final ImmutableList<ListenerStateCapture<P, D, DCL>> listeners = listenersBuilder.build();
-        final Iterable<DataCommitHandler<P, D>> commitHandlers = dataBroker.affectedCommitHandlers(changedPaths);
-        captureInitialState(listeners);
-
-
-        log.trace("Transaction: {} Starting Request Commit.",transactionId);
-        final List<DataCommitTransaction<P, D>> handlerTransactions = new ArrayList<>();
-        try {
-            for (final DataCommitHandler<P, D> handler : commitHandlers) {
-                DataCommitTransaction<P, D> requestCommit = handler.requestCommit(this.transaction);
-                if (requestCommit != null) {
-                    handlerTransactions.add(requestCommit);
-                } else {
-                    log.debug("Transaction: {}, Handler {}  is not participating in transaction.", transactionId,
-                            handler);
-                }
-            }
-        } catch (Exception e) {
-            log.error("Transaction: {} Request Commit failed", transactionId, e);
-            dataBroker.getFailedTransactionsCount().getAndIncrement();
-            this.transaction.failed();
-            return this.rollback(handlerTransactions, e);
-
-        }
-
-        log.trace("Transaction: {} Starting Finish.",transactionId);
-        final List<RpcResult<Void>> results = new ArrayList<RpcResult<Void>>();
-        try {
-            for (final DataCommitTransaction<P, D> subtransaction : handlerTransactions) {
-                results.add(subtransaction.finish());
-            }
-        } catch (Exception e) {
-            log.error("Transaction: {} Finish Commit failed", transactionId, e);
-            dataBroker.getFailedTransactionsCount().getAndIncrement();
-            transaction.failed();
-            return this.rollback(handlerTransactions, e);
-        }
-
-
-        dataBroker.getFinishedTransactionsCount().getAndIncrement();
-        transaction.succeeded();
-
-        log.trace("Transaction: {} Finished successfully.", transactionId);
-
-        captureFinalState(listeners);
-
-        log.trace("Transaction: {} Notifying listeners.", transactionId);
-
-        publishDataChangeEvent(listeners);
-        return RpcResultBuilder.<TransactionStatus> success(TransactionStatus.COMMITED).build();
-    }
-
-    private void captureInitialState(ImmutableList<ListenerStateCapture<P, D, DCL>> listeners) {
-        for (ListenerStateCapture<P, D, DCL> state : listeners) {
-            state.setInitialConfigurationState(dataBroker.readConfigurationData(state.getPath()));
-            state.setInitialOperationalState(dataBroker.readOperationalData(state.getPath()));
-        }
-    }
-
-
-    private void captureFinalState(ImmutableList<ListenerStateCapture<P, D, DCL>> listeners) {
-        for (ListenerStateCapture<P, D, DCL> state : listeners) {
-            state.setFinalConfigurationState(dataBroker.readConfigurationData(state.getPath()));
-            state.setFinalOperationalState(dataBroker.readOperationalData(state.getPath()));
-        }
-    }
-
-    private void filterProbablyAffectedListeners(
-            ImmutableList<ListenerStateCapture<P, D, DCL>> probablyAffectedListeners, Builder<ListenerStateCapture<P, D, DCL>> reallyAffected) {
-
-        for(ListenerStateCapture<P, D, DCL> listenerSet : probablyAffectedListeners) {
-            P affectedPath = listenerSet.getPath();
-            Optional<RootedChangeSet<P,D>> configChange = resolveConfigChange(affectedPath);
-            Optional<RootedChangeSet<P, D>> operChange = resolveOperChange(affectedPath);
-
-            if(configChange.isPresent() || operChange.isPresent()) {
-                reallyAffected.add(listenerSet);
-                if(configChange.isPresent()) {
-                    listenerSet.setNormalizedConfigurationChanges(configChange.get());
-                }
-
-                if(operChange.isPresent()) {
-                    listenerSet.setNormalizedOperationalChanges(operChange.get());
-                }
-            }
-        }
-    }
-
-    private Optional<RootedChangeSet<P, D>> resolveOperChange(P affectedPath) {
-        Map<P, D> originalOper = dataBroker.deepGetBySubpath(transaction.getOriginalOperationalData(),affectedPath);
-        Map<P, D> createdOper = dataBroker.deepGetBySubpath(transaction.getCreatedOperationalData(),affectedPath);
-        Map<P, D> updatedOper = dataBroker.deepGetBySubpath(transaction.getUpdatedOperationalData(),affectedPath);
-        Set<P> removedOper = Sets.filter(transaction.getRemovedOperationalData(), dataBroker.createIsContainedPredicate(affectedPath));
-        return resolveChanges(affectedPath,originalOper,createdOper,updatedOper,removedOper);
-    }
-
-    private Optional<RootedChangeSet<P, D>> resolveConfigChange(P affectedPath) {
-        Map<P, D> originalConfig = dataBroker.deepGetBySubpath(transaction.getOriginalConfigurationData(),affectedPath);
-        Map<P, D> createdConfig = dataBroker.deepGetBySubpath(transaction.getCreatedConfigurationData(),affectedPath);
-        Map<P, D> updatedConfig = dataBroker.deepGetBySubpath(transaction.getUpdatedConfigurationData(),affectedPath);
-        Set<P> removedConfig = Sets.filter(transaction.getRemovedConfigurationData(), dataBroker.createIsContainedPredicate(affectedPath));
-        return resolveChanges(affectedPath,originalConfig,createdConfig,updatedConfig,removedConfig);
-    }
-
-    private Optional<RootedChangeSet<P,D>> resolveChanges(P affectedPath, Map<P, D> originalConfig, Map<P, D> createdConfig, Map<P, D> updatedConfig,Set<P> potentialDeletions) {
-        Predicate<P> isContained = dataBroker.createIsContainedPredicate(affectedPath);
-
-        if(createdConfig.isEmpty() && updatedConfig.isEmpty() && potentialDeletions.isEmpty()) {
-            return Optional.absent();
-        }
-        RootedChangeSet<P, D> changeSet = new RootedChangeSet<P,D>(affectedPath,originalConfig);
-        changeSet.addCreated(createdConfig);
-
-        for(Entry<P, D> entry : updatedConfig.entrySet()) {
-            if(originalConfig.containsKey(entry.getKey())) {
-                changeSet.addUpdated(entry);
-            } else {
-                changeSet.addCreated(entry);
-            }
-        }
-
-        for(Entry<P,D> entry : originalConfig.entrySet()) {
-            for(P deletion : potentialDeletions) {
-                if(isContained.apply(deletion)) {
-                    changeSet.addRemoval(entry.getKey());
-                }
-            }
-        }
-
-        if(changeSet.isChange()) {
-            return Optional.of(changeSet);
-        } else {
-            return Optional.absent();
-        }
-
-    }
-
-    public void publishDataChangeEvent(final ImmutableList<ListenerStateCapture<P, D, DCL>> listeners) {
-        ExecutorService executor = this.dataBroker.getExecutor();
-        final Runnable notifyTask = new Runnable() {
-            @Override
-            public void run() {
-                for (final ListenerStateCapture<P, D, DCL> listenerSet : listeners) {
-                    DataChangeEvent<P, D> changeEvent = listenerSet.createEvent(transaction);
-                    for (final DataChangeListenerRegistration<P, D, DCL> listener : listenerSet.getListeners()) {
-                        try {
-                            listener.getInstance().onDataChanged(changeEvent);
-                        } catch (Exception e) {
-                            log.error("Unhandled exception when invoking listener {}", listener, e);
-                        }
-                    }
-                }
-            }
-        };
-        executor.submit(notifyTask);
-    }
-
-    public RpcResult<TransactionStatus> rollback(final List<DataCommitTransaction<P, D>> transactions, final Exception e) {
-        for (final DataCommitTransaction<P, D> transaction : transactions) {
-            transaction.rollback();
-        }
-        return RpcResultBuilder.<TransactionStatus> failed().withResult(TransactionStatus.FAILED).build();
-    }
-}
index 6e9d9fd..d75f438 100644 (file)
@@ -42,6 +42,7 @@ import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
+import org.opendaylight.yangtools.yang.model.util.EffectiveAugmentationSchema;
 
 @Deprecated
 public abstract class DataNormalizationOperation<T extends PathArgument> implements Identifiable<T> {
@@ -201,7 +202,7 @@ public abstract class DataNormalizationOperation<T extends PathArgument> impleme
         private DataNormalizationOperation<?> register(final DataNormalizationOperation<?> potential) {
             if (potential != null) {
                 byArg.put(potential.getIdentifier(), potential);
-                for (QName qName : potential.getQNameIdentifiers()) {
+                for (final QName qName : potential.getQNameIdentifiers()) {
                     byQName.put(qName, potential);
                 }
             }
@@ -222,9 +223,9 @@ public abstract class DataNormalizationOperation<T extends PathArgument> impleme
 
         @Override
         public NormalizedNode<?, ?> createDefault(final PathArgument currentArg) {
-            DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> builder = Builders
+            final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> builder = Builders
                     .mapEntryBuilder().withNodeIdentifier((NodeIdentifierWithPredicates) currentArg);
-            for (Entry<QName, Object> keyValue : ((NodeIdentifierWithPredicates) currentArg).getKeyValues().entrySet()) {
+            for (final Entry<QName, Object> keyValue : ((NodeIdentifierWithPredicates) currentArg).getKeyValues().entrySet()) {
                 builder.addChild(Builders.leafBuilder()
                         //
                         .withNodeIdentifier(new NodeIdentifier(keyValue.getKey())).withValue(keyValue.getValue())
@@ -341,12 +342,12 @@ public abstract class DataNormalizationOperation<T extends PathArgument> impleme
         @Override
         protected DataNormalizationOperation<?> fromLocalSchemaAndQName(final DataNodeContainer schema, final QName child)
                 throws DataNormalizationException {
-            Optional<DataSchemaNode> potential = findChildSchemaNode(schema, child);
+            final Optional<DataSchemaNode> potential = findChildSchemaNode(schema, child);
             if (!potential.isPresent()) {
                 return null;
             }
 
-            DataSchemaNode result = potential.get();
+            final DataSchemaNode result = potential.get();
             // We try to look up if this node was added by augmentation
             if ((schema instanceof DataSchemaNode) && result.isAugmenting()) {
                 return fromAugmentation(schema, (AugmentationTarget) schema, result);
@@ -452,14 +453,14 @@ public abstract class DataNormalizationOperation<T extends PathArgument> impleme
 
         protected ChoiceNodeNormalization(final ChoiceSchemaNode schema) {
             super(new NodeIdentifier(schema.getQName()),schema);
-            ImmutableMap.Builder<QName, DataNormalizationOperation<?>> byQNameBuilder = ImmutableMap.builder();
-            ImmutableMap.Builder<PathArgument, DataNormalizationOperation<?>> byArgBuilder = ImmutableMap.builder();
+            final ImmutableMap.Builder<QName, DataNormalizationOperation<?>> byQNameBuilder = ImmutableMap.builder();
+            final ImmutableMap.Builder<PathArgument, DataNormalizationOperation<?>> byArgBuilder = ImmutableMap.builder();
 
-            for (ChoiceCaseNode caze : schema.getCases()) {
-                for (DataSchemaNode cazeChild : caze.getChildNodes()) {
-                    DataNormalizationOperation<?> childOp = fromDataSchemaNode(cazeChild);
+            for (final ChoiceCaseNode caze : schema.getCases()) {
+                for (final DataSchemaNode cazeChild : caze.getChildNodes()) {
+                    final DataNormalizationOperation<?> childOp = fromDataSchemaNode(cazeChild);
                     byArgBuilder.put(childOp.getIdentifier(), childOp);
-                    for (QName qname : childOp.getQNameIdentifiers()) {
+                    for (final QName qname : childOp.getQNameIdentifiers()) {
                         byQNameBuilder.put(qname, childOp);
                     }
                 }
@@ -514,7 +515,7 @@ public abstract class DataNormalizationOperation<T extends PathArgument> impleme
     private static final Optional<DataSchemaNode> findChildSchemaNode(final DataNodeContainer parent,final QName child) {
         DataSchemaNode potential = parent.getDataChildByName(child);
         if (potential == null) {
-            Iterable<ChoiceSchemaNode> choices = FluentIterable.from(parent.getChildNodes()).filter(ChoiceSchemaNode.class);
+            final Iterable<ChoiceSchemaNode> choices = FluentIterable.from(parent.getChildNodes()).filter(ChoiceSchemaNode.class);
             potential = findChoice(choices, child);
         }
         return Optional.fromNullable(potential);
@@ -523,12 +524,12 @@ public abstract class DataNormalizationOperation<T extends PathArgument> impleme
     private static DataNormalizationOperation<?> fromSchemaAndQNameChecked(final DataNodeContainer schema,
             final QName child) throws DataNormalizationException {
 
-        Optional<DataSchemaNode> potential = findChildSchemaNode(schema, child);
+        final Optional<DataSchemaNode> potential = findChildSchemaNode(schema, child);
         if (!potential.isPresent()) {
             throw new DataNormalizationException(String.format("Supplied QName %s is not valid according to schema %s, potential children nodes: %s", child, schema,schema.getChildNodes()));
         }
 
-        DataSchemaNode result = potential.get();
+        final DataSchemaNode result = potential.get();
         // We try to look up if this node was added by augmentation
         if ((schema instanceof DataSchemaNode) && result.isAugmenting()) {
             return fromAugmentation(schema, (AugmentationTarget) schema, result);
@@ -538,8 +539,8 @@ public abstract class DataNormalizationOperation<T extends PathArgument> impleme
 
     private static ChoiceSchemaNode findChoice(final Iterable<ChoiceSchemaNode> choices, final QName child) {
         ChoiceSchemaNode foundChoice = null;
-        choiceLoop: for (ChoiceSchemaNode choice : choices) {
-            for (ChoiceCaseNode caze : choice.getCases()) {
+        choiceLoop: for (final ChoiceSchemaNode choice : choices) {
+            for (final ChoiceCaseNode caze : choice.getCases()) {
                 if (findChildSchemaNode(caze, child).isPresent()) {
                     foundChoice = choice;
                     break choiceLoop;
@@ -550,19 +551,19 @@ public abstract class DataNormalizationOperation<T extends PathArgument> impleme
     }
 
     public static AugmentationIdentifier augmentationIdentifierFrom(final AugmentationSchema augmentation) {
-        ImmutableSet.Builder<QName> potentialChildren = ImmutableSet.builder();
-        for (DataSchemaNode child : augmentation.getChildNodes()) {
+        final ImmutableSet.Builder<QName> potentialChildren = ImmutableSet.builder();
+        for (final DataSchemaNode child : augmentation.getChildNodes()) {
             potentialChildren.add(child.getQName());
         }
         return new AugmentationIdentifier(potentialChildren.build());
     }
 
     private static DataNodeContainer augmentationProxy(final AugmentationSchema augmentation, final DataNodeContainer schema) {
-        Set<DataSchemaNode> children = new HashSet<>();
-        for (DataSchemaNode augNode : augmentation.getChildNodes()) {
+        final Set<DataSchemaNode> children = new HashSet<>();
+        for (final DataSchemaNode augNode : augmentation.getChildNodes()) {
             children.add(schema.getDataChildByName(augNode.getQName()));
         }
-        return new DataSchemaContainerProxy(children);
+        return new EffectiveAugmentationSchema(augmentation, children);
     }
 
     /**
@@ -582,8 +583,8 @@ public abstract class DataNormalizationOperation<T extends PathArgument> impleme
     private static DataNormalizationOperation<?> fromAugmentation(final DataNodeContainer parent,
             final AugmentationTarget parentAug, final DataSchemaNode child) {
         AugmentationSchema augmentation = null;
-        for (AugmentationSchema aug : parentAug.getAvailableAugmentations()) {
-            DataSchemaNode potential = aug.getDataChildByName(child.getQName());
+        for (final AugmentationSchema aug : parentAug.getAvailableAugmentations()) {
+            final DataSchemaNode potential = aug.getDataChildByName(child.getQName());
             if (potential != null) {
                 augmentation = aug;
                 break;
@@ -616,7 +617,7 @@ public abstract class DataNormalizationOperation<T extends PathArgument> impleme
     }
 
     private static DataNormalizationOperation<?> fromListSchemaNode(final ListSchemaNode potential) {
-        List<QName> keyDefinition = potential.getKeyDefinition();
+        final List<QName> keyDefinition = potential.getKeyDefinition();
         if(keyDefinition == null || keyDefinition.isEmpty()) {
             return new UnkeyedListMixinNormalization(potential);
         }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.