Merge "Re-added config.version to config-module-archetype."
[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 import java.util.concurrent.ExecutorService;
18
19 /**
20  * TransactionChainProxy acts as a proxy for a DOMStoreTransactionChain created on a remote shard
21  */
22 public class TransactionChainProxy implements DOMStoreTransactionChain{
23     private final ActorContext actorContext;
24     private final ExecutorService transactionExecutor;
25
26     public TransactionChainProxy(ActorContext actorContext, ExecutorService transactionExecutor) {
27         this.actorContext = actorContext;
28         this.transactionExecutor = transactionExecutor;
29     }
30
31     @Override
32     public DOMStoreReadTransaction newReadOnlyTransaction() {
33         return new TransactionProxy(actorContext,
34             TransactionProxy.TransactionType.READ_ONLY, transactionExecutor);
35     }
36
37     @Override
38     public DOMStoreReadWriteTransaction newReadWriteTransaction() {
39         return new TransactionProxy(actorContext,
40             TransactionProxy.TransactionType.WRITE_ONLY, transactionExecutor);
41     }
42
43     @Override
44     public DOMStoreWriteTransaction newWriteOnlyTransaction() {
45         return new TransactionProxy(actorContext,
46             TransactionProxy.TransactionType.READ_WRITE, transactionExecutor);
47     }
48
49     @Override
50     public void close() {
51         // FIXME : The problem here is don't know which shard the transaction chain is to be created on ???
52         throw new UnsupportedOperationException("close - not sure what to do here?");
53     }
54 }