X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-dom-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fdom%2Fbroker%2Fimpl%2FAbstractDOMForwardedCompositeTransaction.java;h=4924e092babcef803a6014478843487c382f5c20;hp=0c07b0684c9b9291344c8f55daadd7d3846ee4da;hb=3859df9beca8f13f1ff2b2744ed3470a1715bec3;hpb=8b2b53c7f6d697bd790084b7e6f58f87cfabf721 diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/AbstractDOMForwardedCompositeTransaction.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/AbstractDOMForwardedCompositeTransaction.java index 0c07b0684c..4924e092ba 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/AbstractDOMForwardedCompositeTransaction.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/AbstractDOMForwardedCompositeTransaction.java @@ -1,22 +1,26 @@ /* * 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.dom.broker.impl; +import static com.google.common.base.Preconditions.checkArgument; +import static java.util.Objects.requireNonNull; + +import java.util.Collection; +import java.util.Map; import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction; import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransaction; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; -import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableMap; - /** * Composite DOM Transaction backed by {@link DOMStoreTransaction}. * + *

* Abstract base for composite transaction, which provides access only to common * functionality as retrieval of subtransaction, close method and retrieval of * identifier. @@ -26,14 +30,14 @@ import com.google.common.collect.ImmutableMap; * @param * Subtransaction type */ +@Deprecated abstract class AbstractDOMForwardedCompositeTransaction implements - AsyncTransaction> { + AsyncTransaction> { - private final ImmutableMap backingTxs; + private final Map backingTxs; private final Object identifier; /** - * * Creates new composite Transactions. * * @param identifier @@ -41,32 +45,32 @@ abstract class AbstractDOMForwardedCompositeTransaction backingTxs) { - this.identifier = Preconditions.checkNotNull(identifier, "Identifier should not be null"); - this.backingTxs = Preconditions.checkNotNull(backingTxs, "Backing transactions should not be null"); + protected AbstractDOMForwardedCompositeTransaction(final Object identifier, final Map backingTxs) { + this.identifier = requireNonNull(identifier, "Identifier should not be null"); + this.backingTxs = requireNonNull(backingTxs, "Backing transactions should not be null"); } /** * Returns subtransaction associated with supplied key. * - * @param key - * @return + * @param key key + * @return subtransaction * @throws NullPointerException * if key is null * @throws IllegalArgumentException * if no subtransaction is associated with key. */ protected final T getSubtransaction(final K key) { - Preconditions.checkNotNull(key, "key must not be null."); - Preconditions.checkArgument(backingTxs.containsKey(key), "No subtransaction associated with %s", key); - return backingTxs.get(key); + final T ret = backingTxs.get(requireNonNull(key, "key must not be null.")); + checkArgument(ret != null, "No subtransaction associated with %s", key); + return ret; } /** * Returns immutable Iterable of all subtransactions. * */ - protected Iterable getSubtransactions() { + protected Collection getSubtransactions() { return backingTxs.values(); } @@ -75,12 +79,11 @@ abstract class AbstractDOMForwardedCompositeTransaction