Merge "Bug-2301 - Clustering:Snapshots need not be stored in in-mem ReplicatedLog...
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / messages / CloseTransactionChain.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.messages;
10
11 import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages;
12
13 public class CloseTransactionChain implements SerializableMessage {
14     public static final Class<ShardTransactionChainMessages.CloseTransactionChain> SERIALIZABLE_CLASS =
15         ShardTransactionChainMessages.CloseTransactionChain.class;
16     private final String transactionChainId;
17
18     public CloseTransactionChain(final String transactionChainId){
19         this.transactionChainId = transactionChainId;
20     }
21
22     @Override
23     public Object toSerializable() {
24         return ShardTransactionChainMessages.CloseTransactionChain.newBuilder()
25             .setTransactionChainId(transactionChainId).build();
26     }
27
28     public static CloseTransactionChain fromSerializable(final Object message){
29         ShardTransactionChainMessages.CloseTransactionChain closeTransactionChain
30             = (ShardTransactionChainMessages.CloseTransactionChain) message;
31
32         return new CloseTransactionChain(closeTransactionChain.getTransactionChainId());
33     }
34
35     public String getTransactionChainId() {
36         return transactionChainId;
37     }
38 }