f56a49b72d8f4495a49ced727e7ca6610b1b201f
[controller.git] / opendaylight / md-sal / sal-dom-broker / src / main / java / org / opendaylight / controller / md / sal / dom / broker / impl / DOMForwardedReadWriteTransaction.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.controller.md.sal.dom.broker.impl;
10
11 import com.google.common.base.Optional;
12 import com.google.common.util.concurrent.CheckedFuture;
13 import java.util.Map;
14 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
15 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
16 import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
17 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
18 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
19 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
20
21 /**
22  *
23  * Read-Write Transaction, which is composed of several
24  * {@link DOMStoreReadWriteTransaction} transactions. Subtransaction is selected by
25  * {@link LogicalDatastoreType} type parameter in:
26  *
27  * <ul>
28  * <li>{@link #read(LogicalDatastoreType, YangInstanceIdentifier)}
29  * <li>{@link #put(LogicalDatastoreType, YangInstanceIdentifier, NormalizedNode)}
30  * <li>{@link #delete(LogicalDatastoreType, YangInstanceIdentifier)}
31  * <li>{@link #merge(LogicalDatastoreType, YangInstanceIdentifier, NormalizedNode)}
32  * </ul>
33  * {@link #commit()} will result in invocation of
34  * {@link DOMDataCommitImplementation#submit(org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction, Iterable)}
35  * invocation with all {@link org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort} for underlying
36  * transactions.
37  *
38  */
39 final class DOMForwardedReadWriteTransaction extends DOMForwardedWriteTransaction<DOMStoreReadWriteTransaction> implements DOMDataReadWriteTransaction {
40     protected DOMForwardedReadWriteTransaction(final Object identifier,
41             final Map<LogicalDatastoreType, DOMStoreReadWriteTransaction> backingTxs,
42             final AbstractDOMForwardedTransactionFactory<?> commitImpl) {
43         super(identifier, backingTxs, commitImpl);
44     }
45
46     @Override
47     public CheckedFuture<Optional<NormalizedNode<?,?>>, ReadFailedException> read(
48             final LogicalDatastoreType store, final YangInstanceIdentifier path) {
49         return getSubtransaction(store).read(path);
50     }
51
52     @Override
53     public CheckedFuture<Boolean, ReadFailedException> exists(
54         final LogicalDatastoreType store,
55         final YangInstanceIdentifier path) {
56         return getSubtransaction(store).exists(path);
57     }
58 }

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