3 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
5 * This program and the accompanying materials are made available under the
6 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7 * and is available at http://www.eclipse.org/legal/epl-v10.html
11 package org.opendaylight.controller.cluster.datastore;
13 import akka.actor.ActorRef;
15 import org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard.ShardStats;
16 import org.opendaylight.controller.cluster.datastore.messages.DeleteData;
17 import org.opendaylight.controller.cluster.datastore.messages.MergeData;
18 import org.opendaylight.controller.cluster.datastore.messages.ReadyTransaction;
19 import org.opendaylight.controller.cluster.datastore.messages.WriteData;
20 import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransaction;
21 import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
22 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
28 public class ShardWriteTransaction extends ShardTransaction {
29 private final DOMStoreWriteTransaction transaction;
31 public ShardWriteTransaction(DOMStoreWriteTransaction transaction, ActorRef shardActor,
32 SchemaContext schemaContext, ShardStats shardStats) {
33 super(shardActor, schemaContext, shardStats);
34 this.transaction = transaction;
38 public void handleReceive(Object message) throws Exception {
39 if(WriteData.SERIALIZABLE_CLASS.equals(message.getClass())) {
40 writeData(transaction, WriteData.fromSerializable(message, schemaContext));
41 } else if(MergeData.SERIALIZABLE_CLASS.equals(message.getClass())) {
42 mergeData(transaction, MergeData.fromSerializable(message, schemaContext));
43 } else if(DeleteData.SERIALIZABLE_CLASS.equals(message.getClass())) {
44 deleteData(transaction, DeleteData.fromSerializable(message));
45 } else if(ReadyTransaction.SERIALIZABLE_CLASS.equals(message.getClass())) {
46 readyTransaction(transaction, new ReadyTransaction());
48 super.handleReceive(message);
53 protected DOMStoreTransaction getDOMStoreTransaction() {