733ce71d6c1083dc6da99a29ff22138cd94d03e3
[controller.git] / opendaylight / md-sal / cds-access-api / src / main / java / org / opendaylight / controller / cluster / access / commands / ReadTransactionSuccess.java
1 /*
2  * Copyright (c) 2016 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 package org.opendaylight.controller.cluster.access.commands;
9
10 import com.google.common.annotations.Beta;
11 import com.google.common.base.Optional;
12 import com.google.common.base.Preconditions;
13 import org.opendaylight.controller.cluster.access.ABIVersion;
14 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
15 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
16
17 /**
18  * Successful reply to an {@link ReadTransactionRequest}. It indicates presence of requested data via
19  * {@link #getData()}.
20  *
21  * @author Robert Varga
22  */
23 @Beta
24 public final class ReadTransactionSuccess extends TransactionSuccess<ReadTransactionSuccess> {
25     private static final long serialVersionUID = 1L;
26     private final Optional<NormalizedNode<?, ?>> data;
27
28     public ReadTransactionSuccess(final TransactionIdentifier identifier, final long sequence,
29             final Optional<NormalizedNode<?, ?>> data) {
30         super(identifier, sequence);
31         this.data = Preconditions.checkNotNull(data);
32     }
33
34     public Optional<NormalizedNode<?, ?>> getData() {
35         return data;
36     }
37
38     @Override
39     protected AbstractTransactionSuccessProxy<ReadTransactionSuccess> externalizableProxy(final ABIVersion version) {
40         return new ReadTransactionSuccessProxyV1(this);
41     }
42
43     @Override
44     protected ReadTransactionSuccess cloneAsVersion(final ABIVersion version) {
45         return this;
46     }
47 }

©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.