2 * Copyright (C) 2019 Ericsson Software Technology AB. All rights reserved.
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
8 package org.opendaylight.netconf.topology.singleton.messages;
10 import static java.util.Objects.requireNonNull;
12 import java.io.Externalizable;
13 import java.io.IOException;
14 import java.io.ObjectInput;
15 import java.io.ObjectOutput;
16 import org.opendaylight.controller.cluster.datastore.node.utils.stream.SerializationUtils;
17 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
20 * Message container which holds node data {@link ContainerNode}, prepared to send between remote hosts with
21 * serialization when remote action is invoked.
23 public class ContainerNodeMessage implements Externalizable {
24 private static final long serialVersionUID = 1L;
26 private ContainerNode node;
28 public ContainerNodeMessage() {
29 // Empty Constructor Needed for Externalizable
33 * Constructor for {@code ContainerNodeMessage}.
35 * @param node ContainerNode
37 public ContainerNodeMessage(final ContainerNode node) {
38 this.node = requireNonNull(node);
41 public ContainerNode getNode() {
46 public void writeExternal(final ObjectOutput out) throws IOException {
47 SerializationUtils.writeNormalizedNode(out, node);
51 public void readExternal(final ObjectInput in) throws IOException {
52 node = (ContainerNode) SerializationUtils.readNormalizedNode(in).get();
56 public String toString() {
57 return "ContainerNodeMessage [node=" + node + "]";