Switch default stream output to Magnesium
[controller.git] / opendaylight / md-sal / sal-clustering-commons / src / main / java / org / opendaylight / controller / cluster / datastore / node / utils / stream / LithiumNormalizedNodeOutputStreamWriter.java
1 /*
2  * Copyright (c) 2014, 2015 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.datastore.node.utils.stream;
9
10 import java.io.DataOutput;
11 import java.io.IOException;
12 import org.opendaylight.yangtools.yang.common.QName;
13 import org.opendaylight.yangtools.yang.common.QNameModule;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
15
16 /**
17  * NormalizedNodeOutputStreamWriter will be used by distributed datastore to send normalized node in
18  * a stream.
19  * A stream writer wrapper around this class will write node objects to stream in recursive manner.
20  * for example - If you have a ContainerNode which has a two LeafNode as children, then
21  * you will first call
22  * {@link #startContainerNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier, int)},
23  * then will call
24  * {@link #leafNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier, Object)} twice
25  * and then, {@link #endNode()} to end container node.
26  *
27  * <p>Based on the each node, the node type is also written to the stream, that helps in reconstructing the object,
28  * while reading.
29  */
30 final class LithiumNormalizedNodeOutputStreamWriter extends AbstractLithiumDataOutput {
31     LithiumNormalizedNodeOutputStreamWriter(final DataOutput output) {
32         super(output);
33     }
34
35     @Override
36     short streamVersion() {
37         return TokenTypes.LITHIUM_VERSION;
38     }
39
40     @Override
41     void writeQNameInternal(final QName qname) throws IOException {
42         defaultWriteQName(qname);
43     }
44
45     @Override
46     void writeModule(final QNameModule module) throws IOException {
47         defaultWriteModule(module);
48     }
49
50     @Override
51     void writeAugmentationIdentifier(final AugmentationIdentifier aid) throws IOException {
52         defaultWriteAugmentationIdentifier(aid);
53     }
54 }