c87f1abb21c74cf585d2fcfe6a4057b0c7143e99
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / DistributedDataStore.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 akka.actor.ActorRef;
12 import akka.actor.ActorSystem;
13 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker;
14 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
15 import org.opendaylight.controller.sal.core.spi.data.DOMStore;
16 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction;
17 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
18 import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
19 import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
20 import org.opendaylight.yangtools.concepts.ListenerRegistration;
21 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
22 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
23
24 /**
25  *
26  */
27 public class DistributedDataStore implements DOMStore {
28   private final ActorRef shardManager;
29
30   public DistributedDataStore(ActorSystem actorSystem, String type) {
31     shardManager = actorSystem.actorOf(ShardManager.props(type));
32   }
33
34   @Override
35   public <L extends AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>> ListenerRegistration<L> registerChangeListener(InstanceIdentifier path, L listener, AsyncDataBroker.DataChangeScope scope) {
36     return new ListenerRegistrationProxy();
37   }
38
39   @Override
40   public DOMStoreTransactionChain createTransactionChain() {
41     return new TransactionChainProxy();
42   }
43
44   @Override
45   public DOMStoreReadTransaction newReadOnlyTransaction() {
46     return new TransactionProxy();
47   }
48
49   @Override
50   public DOMStoreWriteTransaction newWriteOnlyTransaction() {
51     return new TransactionProxy();
52   }
53
54   @Override
55   public DOMStoreReadWriteTransaction newReadWriteTransaction() {
56     return new TransactionProxy();
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.