Add default implementation for AsyncWriteTransaction#commit 35/69935/2
authorTom Pantelis <tompantelis@gmail.com>
Fri, 23 Mar 2018 01:13:14 +0000 (21:13 -0400)
committerTom Pantelis <tompantelis@gmail.com>
Fri, 23 Mar 2018 13:36:21 +0000 (09:36 -0400)
This method has been deprecated for quite some time and time for
removal. There are still sub-classes in other projects that
override it so first add a default implementation to throw
UnsupportedOperationException. When patches are merged in the
pther projects, we can remkve this method (and TransactionStatus).

Change-Id: I5e3581d50a4f92df3984a663d04ce026a52252b2
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
20 files changed:
opendaylight/md-sal/mdsal-trace/dom-impl/src/main/java/org/opendaylight/controller/md/sal/trace/dom/impl/AbstractTracingWriteTransaction.java
opendaylight/md-sal/mdsal-trace/dom-impl/src/main/java/org/opendaylight/controller/md/sal/trace/dom/impl/TracingReadWriteTransaction.java
opendaylight/md-sal/mdsal-trace/dom-impl/src/main/java/org/opendaylight/controller/md/sal/trace/dom/impl/TracingWriteTransaction.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/md/sal/binding/api/ForwardingReadWriteTransaction.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/md/sal/binding/api/ForwardingWriteTransaction.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMWriteTransactionAdapter.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/CrossBrokerMountPointTest.java
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncDataBroker.java
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncDataTransactionFactory.java
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncWriteTransaction.java
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataModification.java [deleted file]
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/AbstractDataTransaction.java [deleted file]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/compat/LegacyDOMDataBrokerAdapter.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMForwardedWriteTransaction.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/PingPongTransaction.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/PingPongTransactionChain.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/legacy/sharded/adapter/ShardedDOMDataBrokerDelegatingReadWriteTransaction.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/legacy/sharded/adapter/ShardedDOMDataBrokerDelegatingWriteTransaction.java
opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/md/sal/dom/spi/ForwardingDOMDataReadWriteTransaction.java
opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/md/sal/dom/spi/ForwardingDOMDataWriteTransaction.java

index 319f214..9cc67ba 100644 (file)
@@ -9,16 +9,13 @@ package org.opendaylight.controller.md.sal.trace.dom.impl;
 
 import com.google.common.collect.ImmutableSet;
 import com.google.common.util.concurrent.CheckedFuture;
-import com.google.common.util.concurrent.ListenableFuture;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
 import java.util.Set;
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
-import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
@@ -103,12 +100,6 @@ abstract class AbstractTracingWriteTransaction implements DOMDataWriteTransactio
         return delegate.submit();
     }
 
-    @Override
-    public ListenableFuture<RpcResult<TransactionStatus>> commit() {
-        logOps();
-        return delegate.commit();
-    }
-
     @Override
     public Object getIdentifier() {
         return delegate.getIdentifier();
index 091e2a4..31287b0 100644 (file)
@@ -9,9 +9,7 @@ package org.opendaylight.controller.md.sal.trace.dom.impl;
 
 import com.google.common.base.Optional;
 import com.google.common.util.concurrent.CheckedFuture;
-import com.google.common.util.concurrent.ListenableFuture;
 import java.util.Objects;
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
@@ -19,7 +17,6 @@ import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
 import org.opendaylight.controller.md.sal.trace.closetracker.impl.CloseTracked;
 import org.opendaylight.controller.md.sal.trace.closetracker.impl.CloseTrackedRegistry;
 import org.opendaylight.controller.md.sal.trace.closetracker.impl.CloseTrackedTrait;
-import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
@@ -54,12 +51,6 @@ class TracingReadWriteTransaction
         return super.submit();
     }
 
-    @Override
-    public ListenableFuture<RpcResult<TransactionStatus>> commit() {
-        closeTracker.removeFromTrackedRegistry();
-        return super.commit();
-    }
-
     @Override
     public boolean cancel() {
         closeTracker.removeFromTrackedRegistry();
index 5cd0d63..18c6117 100644 (file)
@@ -8,14 +8,11 @@
 package org.opendaylight.controller.md.sal.trace.dom.impl;
 
 import com.google.common.util.concurrent.CheckedFuture;
-import com.google.common.util.concurrent.ListenableFuture;
-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.dom.api.DOMDataWriteTransaction;
 import org.opendaylight.controller.md.sal.trace.closetracker.impl.CloseTracked;
 import org.opendaylight.controller.md.sal.trace.closetracker.impl.CloseTrackedRegistry;
 import org.opendaylight.controller.md.sal.trace.closetracker.impl.CloseTrackedTrait;
-import org.opendaylight.yangtools.yang.common.RpcResult;
 
 class TracingWriteTransaction extends AbstractTracingWriteTransaction
         implements CloseTracked<TracingWriteTransaction> {
@@ -34,12 +31,6 @@ class TracingWriteTransaction extends AbstractTracingWriteTransaction
         return super.submit();
     }
 
-    @Override
-    public ListenableFuture<RpcResult<TransactionStatus>> commit() {
-        closeTracker.removeFromTrackedRegistry();
-        return super.commit();
-    }
-
     @Override
     public boolean cancel() {
         closeTracker.removeFromTrackedRegistry();
index 97a6db6..756ed96 100644 (file)
@@ -10,14 +10,11 @@ package org.opendaylight.controller.md.sal.binding.api;
 import com.google.common.base.Optional;
 import com.google.common.collect.ForwardingObject;
 import com.google.common.util.concurrent.CheckedFuture;
-import com.google.common.util.concurrent.ListenableFuture;
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcResult;
 
 /**
  * Utility {@link ReadWriteTransaction} implementation which forwards all interface method
@@ -84,9 +81,4 @@ public class ForwardingReadWriteTransaction extends ForwardingObject implements
     public void delete(LogicalDatastoreType store, InstanceIdentifier<?> path) {
         delegate.delete(store, path);
     }
-
-    @Override
-    public ListenableFuture<RpcResult<TransactionStatus>> commit() {
-        return delegate.commit();
-    }
 }
index 13151ee..8c10c6f 100644 (file)
@@ -9,13 +9,10 @@ package org.opendaylight.controller.md.sal.binding.api;
 
 import com.google.common.collect.ForwardingObject;
 import com.google.common.util.concurrent.CheckedFuture;
-import com.google.common.util.concurrent.ListenableFuture;
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcResult;
 
 /**
  * Utility {@link WriteTransaction} implementation which forwards all interface method
@@ -72,11 +69,6 @@ public class ForwardingWriteTransaction extends ForwardingObject implements Writ
         return delegate.submit();
     }
 
-    @Override
-    public ListenableFuture<RpcResult<TransactionStatus>> commit() {
-        return delegate.commit();
-    }
-
     @Override
     public Object getIdentifier() {
         return delegate.getIdentifier();
index 6540ad9..c6c9c9f 100644 (file)
@@ -8,20 +8,16 @@
 package org.opendaylight.controller.md.sal.binding.impl;
 
 import com.google.common.util.concurrent.CheckedFuture;
-import com.google.common.util.concurrent.ListenableFuture;
 import java.util.ArrayList;
 import java.util.List;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
-import org.opendaylight.controller.md.sal.common.impl.service.AbstractDataTransaction;
 import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizationException;
 import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizationOperation;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 
@@ -70,11 +66,6 @@ class BindingDOMWriteTransactionAdapter<T extends DOMDataWriteTransaction> exten
         doDelete(store, path);
     }
 
-    @Override
-    public ListenableFuture<RpcResult<TransactionStatus>> commit() {
-        return AbstractDataTransaction.convertToLegacyCommitFuture(submit());
-    }
-
     @Override
     public CheckedFuture<Void,TransactionCommitFailedException> submit() {
         return doSubmit();
index d80e49c..74c0ade 100644 (file)
@@ -14,7 +14,6 @@ import static org.junit.Assert.assertTrue;
 import com.google.common.base.Optional;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import java.util.Collections;
 import java.util.Map;
@@ -25,7 +24,6 @@ import org.junit.Test;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.MountPoint;
 import org.opendaylight.controller.md.sal.binding.api.MountPointService;
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
@@ -53,7 +51,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controll
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
@@ -182,11 +179,6 @@ public class CrossBrokerMountPointTest {
                             return false;
                         }
 
-                        @Override
-                        public ListenableFuture<RpcResult<TransactionStatus>> commit() {
-                            return null;
-                        }
-
                         @Override
                         public void delete(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
                             throw new UnsupportedOperationException();
index 6da0af4..dff2f8b 100644 (file)
@@ -31,7 +31,7 @@ import org.opendaylight.yangtools.concepts.Path;
  * For a detailed explanation of how transaction are isolated and how transaction-local
  * changes are committed to global data tree, see
  * {@link AsyncReadTransaction}, {@link AsyncWriteTransaction},
- * {@link AsyncReadWriteTransaction} and {@link AsyncWriteTransaction#commit()}.
+ * {@link AsyncReadWriteTransaction} and {@link AsyncWriteTransaction#submit()}.
  *
  *
  * <p>
index 22fa5ff..46f6ccc 100644 (file)
@@ -39,7 +39,7 @@ import org.opendaylight.yangtools.concepts.Path;
  * For a detailed explanation of how transaction are isolated and how transaction-local
  * changes are committed to global data tree, see
  * {@link AsyncReadTransaction}, {@link AsyncWriteTransaction},
- * {@link AsyncReadWriteTransaction} and {@link AsyncWriteTransaction#commit()}.
+ * {@link AsyncReadWriteTransaction} and {@link AsyncWriteTransaction#submit()}.
  *
  * <p>
  * It is strongly recommended to use the type of transaction, which
@@ -83,7 +83,7 @@ public interface AsyncDataTransactionFactory<P extends Path<P>, D> {
      * Preconditions for mutation of data tree are captured from the snapshot of
      * data tree state, when the transaction is allocated. If data was
      * changed during transaction in an incompatible way then the commit of this transaction
-     * will fail. See {@link AsyncWriteTransaction#commit()} for more
+     * will fail. See {@link AsyncWriteTransaction#submit()} for more
      * details about conflicting and not-conflicting changes and
      * failure scenarios.
      *
@@ -99,7 +99,7 @@ public interface AsyncDataTransactionFactory<P extends Path<P>, D> {
      * Preconditions for mutation of data tree are captured from the snapshot of
      * data tree state, when the transaction is allocated. If data was
      * changed during transaction in an incompatible way then the commit of this transaction
-     * will fail. See {@link AsyncWriteTransaction#commit()} for more
+     * will fail. See {@link AsyncWriteTransaction#submit()} for more
      * details about conflicting and not-conflicting changes and
      * failure scenarios.
      *
@@ -107,7 +107,7 @@ public interface AsyncDataTransactionFactory<P extends Path<P>, D> {
      * Since this transaction does not provide a view of the data it SHOULD BE
      * used only by callers which are exclusive writers (exporters of data)
      * to the subtree they modify. This prevents optimistic
-     * lock failures as described in {@link AsyncWriteTransaction#commit()}.
+     * lock failures as described in {@link AsyncWriteTransaction#submit()}.
      *
      * <p>
      * Exclusivity of writers to particular subtree SHOULD BE enforced by
index f12cb88..e98d671 100644 (file)
@@ -102,17 +102,14 @@ public interface AsyncWriteTransaction<P extends Path<P>, D> extends AsyncTransa
      * Cancels the transaction.
      *
      * <p>
-     * Transactions can only be cancelled if it's status is
-     * {@link TransactionStatus#NEW} or {@link TransactionStatus#SUBMITED}
+     * Transactions can only be cancelled if it's state is new or submitted.
      *
      * <p>
-     * Invoking cancel() on {@link TransactionStatus#FAILED} or
-     * {@link TransactionStatus#CANCELED} will have no effect, and transaction
+     * Invoking cancel() on a failed or cancelled transaction will have no effect, and transaction
      * is considered cancelled.
      *
      * <p>
-     * Invoking cancel() on finished transaction  (future returned by {@link #submit()}
-     * already completed with {@link TransactionStatus#COMMITED}) will always
+     * Invoking cancel() on a finished transaction (future returned by {@link #submit()} already completed will always
      * fail (return false).
      *
      * @return <tt>false</tt> if the task could not be cancelled, typically because it has already completed normally
@@ -130,7 +127,7 @@ public interface AsyncWriteTransaction<P extends Path<P>, D> extends AsyncTransa
      * @param path
      *            Data object path
      * @throws IllegalStateException
-     *             if the transaction is no longer {@link TransactionStatus#NEW}
+     *             if the transaction as already been submitted or cancelled
      */
     void delete(LogicalDatastoreType store, P path);
 
@@ -149,8 +146,7 @@ public interface AsyncWriteTransaction<P extends Path<P>, D> extends AsyncTransa
      * {@link IllegalStateException}.
      *
      * <p>
-     * The transaction is marked as {@link TransactionStatus#SUBMITED} and
-     * enqueued into the data store back-end for processing.
+     * The transaction is marked as submitted and enqueued into the data store back-end for processing.
      *
      * <p>
      * Whether or not the commit is successful is determined by versioning
@@ -335,7 +331,7 @@ public interface AsyncWriteTransaction<P extends Path<P>, D> extends AsyncTransa
      *         derived from TransactionCommitFailedException.
      *
      * @throws IllegalStateException
-     *             if the transaction is not {@link TransactionStatus#NEW}
+     *             if the transaction is not new
      */
     CheckedFuture<Void,TransactionCommitFailedException> submit();
 
@@ -345,6 +341,7 @@ public interface AsyncWriteTransaction<P extends Path<P>, D> extends AsyncTransa
      * @deprecated Use {@link #submit()} instead.
      */
     @Deprecated
-    ListenableFuture<RpcResult<TransactionStatus>> commit();
-
+    default ListenableFuture<RpcResult<TransactionStatus>> commit() {
+        throw new UnsupportedOperationException("commit() is deprecated, use submit() instead");
+    }
 }
diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataModification.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataModification.java
deleted file mode 100644 (file)
index 8803efa..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (c) 2013 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.api.data;
-
-import java.util.concurrent.Future;
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
-import org.opendaylight.yangtools.concepts.Path;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-
-/**
- * Deprecated.
- *
- * @deprecated Replaced by {@link AsyncWriteTransaction}
- */
-@Deprecated
-public interface DataModification<P extends Path<P>, D> extends DataChange<P, D>, DataReader<P, D> {
-    /**
-     * Returns transaction identifier.
-     *
-     * @return Transaction identifier
-     */
-    Object getIdentifier();
-
-    TransactionStatus getStatus();
-
-    /**
-     * Store a piece of data at specified path. This acts as a merge operation,
-     * which is to say that any pre-existing data which is not explicitly
-     * overwritten will be preserved. This means that if you store a container,
-     * its child lists will be merged. Performing the following put operations:
-     *
-     * <p>
-     * 1) container { list [ a ] }
-     * 2) container { list [ b ] }
-     *
-     * <p>
-     * will result in the following data being present:
-     *
-     * <p>
-     * container { list [ a, b ] }
-     *
-     * <p>
-     * This also means that storing the container will preserve any augmentations
-     * which have been attached to it.
-     *
-     * <p>
-     * If you require an explicit replace operation, perform
-     * {@link removeOperationalData} first.
-     */
-    void putOperationalData(P path, D data);
-
-    /**
-     * Store a piece of data at specified path. This acts as a merge operation,
-     * which is to say that any pre-existing data which is not explicitly
-     * overwritten will be preserved. This means that if you store a container,
-     * its child lists will be merged. Performing the following put operations:
-     *
-     * <p>
-     * 1) container { list [ a ] }
-     * 2) container { list [ b ] }
-     *
-     * <p>
-     * will result in the following data being present:
-     *
-     * <p>
-     * container { list [ a, b ] }
-     *
-     * <p>
-     * This also means that storing the container will preserve any augmentations
-     * which have been attached to it.
-     *
-     * <p>
-     * If you require an explicit replace operation, perform
-     * {@link removeConfigurationData} first.
-     */
-    void putConfigurationData(P path, D data);
-
-    void removeOperationalData(P path);
-
-    void removeConfigurationData(P path);
-
-    /**
-     * Initiates a two-phase commit of modification.
-     *
-     * <p>
-     * The successful commit changes the state of the system and may affect
-     * several components.
-     *
-     * <p>
-     * The effects of successful commit of data are described in the
-     * specifications and YANG models describing the Provider components of
-     * controller. It is assumed that Consumer has an understanding of this
-     * changes.
-     *
-     * @return Result of the Commit, containing success information or list of
-     *         encountered errors, if commit was not successful. The Future
-     *         blocks until {@link TransactionStatus#COMMITED} or
-     *         {@link TransactionStatus#FAILED} is reached.
-     */
-    Future<RpcResult<TransactionStatus>> commit();
-}
diff --git a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/AbstractDataTransaction.java b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/AbstractDataTransaction.java
deleted file mode 100644 (file)
index e441cfa..0000000
+++ /dev/null
@@ -1,30 +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 com.google.common.util.concurrent.CheckedFuture;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
-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 {
-    private static final Logger LOG = LoggerFactory.getLogger(AbstractDataTransaction.class);
-    private static final ListenableFuture<RpcResult<TransactionStatus>> SUCCESS_FUTURE =
-            Futures.immediateFuture(RpcResultBuilder.success(TransactionStatus.COMMITED).build());
-
-    public static ListenableFuture<RpcResult<TransactionStatus>> convertToLegacyCommitFuture(
-            final CheckedFuture<Void,TransactionCommitFailedException> from) {
-        return Futures.transformAsync(from, input -> SUCCESS_FUTURE);
-    }
-}
index f495037..b3df0c3 100644 (file)
@@ -15,14 +15,12 @@ import com.google.common.collect.ForwardingObject;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableMap.Builder;
 import com.google.common.util.concurrent.CheckedFuture;
-import com.google.common.util.concurrent.ListenableFuture;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicReference;
 import javax.annotation.Nonnull;
 import org.opendaylight.controller.cluster.databroker.AbstractDOMBroker;
 import org.opendaylight.controller.cluster.datastore.DistributedDataStoreInterface;
 import org.opendaylight.controller.cluster.datastore.compat.LegacyDOMStoreAdapter;
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.DataStoreUnavailableException;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
@@ -30,7 +28,6 @@ import org.opendaylight.controller.md.sal.common.api.data.OptimisticLockFailedEx
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
-import org.opendaylight.controller.md.sal.common.impl.service.AbstractDataTransaction;
 import org.opendaylight.controller.md.sal.dom.api.ClusteredDOMDataTreeChangeListener;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBrokerExtension;
@@ -51,7 +48,6 @@ import org.opendaylight.mdsal.dom.api.DOMDataTreeReadWriteTransaction;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteTransaction;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.util.concurrent.ExceptionMapper;
-import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
@@ -304,11 +300,6 @@ public class LegacyDOMDataBrokerAdapter extends ForwardingObject implements DOMD
         public CheckedFuture<Void, TransactionCommitFailedException> submit() {
             return MappingCheckedFuture.create(writeDelegate().submit(), SUBMIT_EX_MAPPER);
         }
-
-        @Override
-        public ListenableFuture<RpcResult<TransactionStatus>> commit() {
-            return AbstractDataTransaction.convertToLegacyCommitFuture(submit());
-        }
     }
 
     private static class DOMDataReadOnlyTransactionAdapter implements DOMDataReadOnlyTransaction {
index 8774304..68940fd 100644 (file)
@@ -10,20 +10,16 @@ package org.opendaylight.controller.md.sal.dom.broker.impl;
 import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Map;
 import java.util.concurrent.Future;
 import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
-import org.opendaylight.controller.md.sal.common.impl.service.AbstractDataTransaction;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
-import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.slf4j.Logger;
@@ -129,12 +125,6 @@ class DOMForwardedWriteTransaction<T extends DOMStoreWriteTransaction> extends
         return future.cancel(false);
     }
 
-    @Deprecated
-    @Override
-    public ListenableFuture<RpcResult<TransactionStatus>> commit() {
-        return AbstractDataTransaction.convertToLegacyCommitFuture(submit());
-    }
-
     @Override
     @SuppressWarnings("checkstyle:illegalcatch")
     public CheckedFuture<Void, TransactionCommitFailedException> submit() {
index 8ca89ff..aa8f3e1 100644 (file)
@@ -12,13 +12,9 @@ import com.google.common.base.MoreObjects.ToStringHelper;
 import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.FutureCallback;
-import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.SettableFuture;
-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.service.AbstractDataTransaction;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
-import org.opendaylight.yangtools.yang.common.RpcResult;
 
 /**
  * Transaction context. Tracks the relationship with the backend transaction.
@@ -27,7 +23,6 @@ import org.opendaylight.yangtools.yang.common.RpcResult;
  */
 final class PingPongTransaction implements FutureCallback<Void> {
     private final CheckedFuture<Void, TransactionCommitFailedException> submitFuture;
-    private final ListenableFuture<RpcResult<TransactionStatus>> commitFuture;
     private final DOMDataReadWriteTransaction delegate;
     private final SettableFuture<Void> future;
     private DOMDataReadWriteTransaction frontendTransaction;
@@ -36,7 +31,6 @@ final class PingPongTransaction implements FutureCallback<Void> {
         this.delegate = Preconditions.checkNotNull(delegate);
         future = SettableFuture.create();
         submitFuture = new PingPongFuture(future);
-        commitFuture = AbstractDataTransaction.convertToLegacyCommitFuture(submitFuture);
     }
 
     DOMDataReadWriteTransaction getTransaction() {
@@ -51,10 +45,6 @@ final class PingPongTransaction implements FutureCallback<Void> {
         return submitFuture;
     }
 
-    ListenableFuture<RpcResult<TransactionStatus>> getCommitFuture() {
-        return commitFuture;
-    }
-
     @Override
     public void onSuccess(final Void result) {
         future.set(result);
@@ -79,4 +69,4 @@ final class PingPongTransaction implements FutureCallback<Void> {
     protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
         return toStringHelper.add("delegate", delegate);
     }
-}
\ No newline at end of file
+}
index 4a6ea67..c8027d0 100644 (file)
@@ -13,7 +13,6 @@ import com.google.common.base.Verify;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import java.util.AbstractMap.SimpleImmutableEntry;
 import java.util.Map.Entry;
@@ -21,7 +20,6 @@ import java.util.concurrent.CancellationException;
 import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
 import javax.annotation.Nonnull;
 import javax.annotation.concurrent.GuardedBy;
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
@@ -34,7 +32,6 @@ import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
 import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
 import org.opendaylight.controller.md.sal.dom.spi.ForwardingDOMDataReadWriteTransaction;
-import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.slf4j.Logger;
@@ -458,14 +455,6 @@ public final class PingPongTransactionChain implements DOMTransactionChain {
                 return tx.getSubmitFuture();
             }
 
-            @Deprecated
-            @Override
-            public ListenableFuture<RpcResult<TransactionStatus>> commit() {
-                readyTransaction(tx);
-                isOpen = false;
-                return tx.getCommitFuture();
-            }
-
             @Override
             public boolean cancel() {
                 if (isOpen) {
index 3f9cdd6..3eab723 100644 (file)
@@ -26,15 +26,12 @@ import java.util.Map;
 import java.util.Queue;
 import javax.annotation.Nonnull;
 import javax.annotation.concurrent.NotThreadSafe;
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
@@ -61,9 +58,6 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 // FIXME explicitly enforce just one subtree requirement
 @NotThreadSafe
 class ShardedDOMDataBrokerDelegatingReadWriteTransaction implements DOMDataReadWriteTransaction {
-    private static final ListenableFuture<RpcResult<TransactionStatus>> SUCCESS_FUTURE = Futures
-            .immediateFuture(RpcResultBuilder.success(TransactionStatus.COMMITED).build());
-
     private final DOMDataReadOnlyTransaction readTxDelegate;
     private final DOMDataWriteTransaction writeTxDelegate;
     private final Object txIdentifier;
@@ -117,11 +111,6 @@ class ShardedDOMDataBrokerDelegatingReadWriteTransaction implements DOMDataReadW
         return writeTxDelegate.submit();
     }
 
-    @Override
-    public ListenableFuture<RpcResult<TransactionStatus>> commit() {
-        return Futures.transformAsync(submit(), input -> SUCCESS_FUTURE, MoreExecutors.directExecutor());
-    }
-
     @Override
     public CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> read(final LogicalDatastoreType store,
                                                                                    final YangInstanceIdentifier path) {
index 70d4287..e72d9e0 100644 (file)
@@ -12,22 +12,15 @@ import static com.google.common.base.Preconditions.checkNotNull;
 
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
 import org.opendaylight.controller.md.sal.dom.broker.impl.TransactionCommitFailedExceptionMapper;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteTransaction;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 class ShardedDOMDataBrokerDelegatingWriteTransaction implements DOMDataWriteTransaction {
-    private static final ListenableFuture<RpcResult<TransactionStatus>> SUCCESS_FUTURE = Futures
-            .immediateFuture(RpcResultBuilder.success(TransactionStatus.COMMITED).build());
-
     private final DOMDataTreeWriteTransaction delegateTx;
     private final Object txIdentifier;
 
@@ -64,11 +57,6 @@ class ShardedDOMDataBrokerDelegatingWriteTransaction implements DOMDataWriteTran
         return Futures.makeChecked(delegateTx.submit(), TransactionCommitFailedExceptionMapper.COMMIT_ERROR_MAPPER);
     }
 
-    @Override
-    public ListenableFuture<RpcResult<TransactionStatus>> commit() {
-        return Futures.transformAsync(submit(), input -> SUCCESS_FUTURE);
-    }
-
     @Override
     public Object getIdentifier() {
         return txIdentifier;
index 7b0bae7..ea2bb95 100644 (file)
@@ -10,14 +10,11 @@ package org.opendaylight.controller.md.sal.dom.spi;
 import com.google.common.base.Optional;
 import com.google.common.collect.ForwardingObject;
 import com.google.common.util.concurrent.CheckedFuture;
-import com.google.common.util.concurrent.ListenableFuture;
 import javax.annotation.Nonnull;
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
-import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
@@ -73,10 +70,4 @@ public abstract class ForwardingDOMDataReadWriteTransaction extends ForwardingOb
     public CheckedFuture<Void, TransactionCommitFailedException> submit() {
         return delegate().submit();
     }
-
-    @Override
-    @Deprecated
-    public ListenableFuture<RpcResult<TransactionStatus>> commit() {
-        return delegate().commit();
-    }
 }
index e544ee8..807ea51 100644 (file)
@@ -9,13 +9,10 @@ package org.opendaylight.controller.md.sal.dom.spi;
 
 import com.google.common.collect.ForwardingObject;
 import com.google.common.util.concurrent.CheckedFuture;
-import com.google.common.util.concurrent.ListenableFuture;
 import javax.annotation.Nonnull;
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
-import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
@@ -58,10 +55,4 @@ public abstract class ForwardingDOMDataWriteTransaction extends ForwardingObject
     public CheckedFuture<Void, TransactionCommitFailedException> submit() {
         return delegate().submit();
     }
-
-    @Override
-    @Deprecated
-    public ListenableFuture<RpcResult<TransactionStatus>> commit() {
-        return delegate().commit();
-    }
 }

©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.