2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
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
9 package org.opendaylight.controller.cluster.databroker;
11 import com.google.common.base.Optional;
12 import com.google.common.util.concurrent.CheckedFuture;
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.DOMDataReadOnlyTransaction;
17 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction;
18 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
19 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
21 public class DOMBrokerReadOnlyTransaction<T extends DOMStoreReadTransaction>
22 extends AbstractDOMBrokerTransaction<LogicalDatastoreType, T>
23 implements DOMDataReadOnlyTransaction {
25 * Creates new composite Transactions.
27 * @param identifier Identifier of transaction.
29 protected DOMBrokerReadOnlyTransaction(Object identifier, Map storeTxFactories) {
30 super(identifier, storeTxFactories);
34 public CheckedFuture<Optional<NormalizedNode<?,?>>, ReadFailedException> read(
35 final LogicalDatastoreType store, final YangInstanceIdentifier path) {
36 return getSubtransaction(store).read(path);
40 public CheckedFuture<Boolean, ReadFailedException> exists(
41 final LogicalDatastoreType store,
42 final YangInstanceIdentifier path) {
43 return getSubtransaction(store).exists(path);
48 closeSubtransactions();
52 protected T createTransaction(LogicalDatastoreType key) {
53 return (T) getTxFactory(key).newReadOnlyTransaction();