Merge "Distributed Datastore integration with config subsystem Updated with the usage...
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / TransactionChainProxy.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.cluster.datastore;
10
11 import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
12 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction;
13 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
14 import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
15 import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
16
17 /**
18  * TransactionChainProxy acts as a proxy for a DOMStoreTransactionChain created on a remote shard
19  */
20 public class TransactionChainProxy implements DOMStoreTransactionChain{
21     private final ActorContext actorContext;
22
23     public TransactionChainProxy(ActorContext actorContext) {
24         this.actorContext = actorContext;
25     }
26
27     @Override
28     public DOMStoreReadTransaction newReadOnlyTransaction() {
29         return new TransactionProxy(actorContext,
30             TransactionProxy.TransactionType.READ_ONLY);
31     }
32
33     @Override
34     public DOMStoreReadWriteTransaction newReadWriteTransaction() {
35         return new TransactionProxy(actorContext,
36             TransactionProxy.TransactionType.WRITE_ONLY);
37     }
38
39     @Override
40     public DOMStoreWriteTransaction newWriteOnlyTransaction() {
41         return new TransactionProxy(actorContext,
42             TransactionProxy.TransactionType.READ_WRITE);
43     }
44
45     @Override
46     public void close() {
47         throw new UnsupportedOperationException("close - not sure what to do here?");
48     }
49 }