Allow programmatic module sharding configuration
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / databroker / DOMBrokerReadWriteTransaction.java
1 /*
2  * Copyright (c) 2015 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 package org.opendaylight.controller.cluster.databroker;
9
10 import com.google.common.util.concurrent.FluentFuture;
11 import java.util.Map;
12 import java.util.Optional;
13 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
14 import org.opendaylight.mdsal.dom.api.DOMDataTreeReadWriteTransaction;
15 import org.opendaylight.mdsal.dom.spi.store.DOMStoreReadWriteTransaction;
16 import org.opendaylight.mdsal.dom.spi.store.DOMStoreTransactionFactory;
17 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
18 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
19
20 public class DOMBrokerReadWriteTransaction extends AbstractDOMBrokerWriteTransaction<DOMStoreReadWriteTransaction>
21         implements DOMDataTreeReadWriteTransaction {
22
23     /**
24      * Constructs an instance.
25      *
26      * @param identifier identifier of transaction.
27      * @param storeTxFactories the backing transaction store factories
28      */
29     protected DOMBrokerReadWriteTransaction(Object identifier,
30             Map<LogicalDatastoreType, ? extends DOMStoreTransactionFactory>  storeTxFactories,
31             final AbstractDOMTransactionFactory<?> commitImpl) {
32         super(identifier, storeTxFactories, commitImpl);
33     }
34
35     @Override
36     public FluentFuture<Optional<NormalizedNode<?,?>>> read(final LogicalDatastoreType store,
37             final YangInstanceIdentifier path) {
38         return getSubtransaction(store).read(path);
39     }
40
41     @Override
42     public FluentFuture<Boolean> exists(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
43         return getSubtransaction(store).exists(path);
44     }
45
46     @Override
47     protected DOMStoreReadWriteTransaction createTransaction(LogicalDatastoreType key) {
48         return getTxFactory(key).newReadWriteTransaction();
49     }
50 }

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