2 * Copyright (c) 2015 Cisco Systems, Inc. and others. 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.sal.rest.impl;
10 import java.io.IOException;
11 import org.opendaylight.netconf.sal.rest.api.RestconfNormalizedNodeWriter;
12 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
13 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
14 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter;
17 * This class just delegates all of the functionality to Yangtools normalized node writer.
19 public final class RestconfDelegatingNormalizedNodeWriter implements RestconfNormalizedNodeWriter {
20 private final NormalizedNodeWriter delegNNWriter;
22 private RestconfDelegatingNormalizedNodeWriter(final NormalizedNodeStreamWriter streamWriter, final boolean
24 this.delegNNWriter = NormalizedNodeWriter.forStreamWriter(streamWriter, orderKeyLeaves);
27 public static RestconfDelegatingNormalizedNodeWriter forStreamWriter(final NormalizedNodeStreamWriter writer) {
28 return forStreamWriter(writer, true);
31 public static RestconfDelegatingNormalizedNodeWriter forStreamWriter(final NormalizedNodeStreamWriter writer,
32 final boolean orderKeyLeaves) {
33 return new RestconfDelegatingNormalizedNodeWriter(writer, orderKeyLeaves);
37 public RestconfDelegatingNormalizedNodeWriter write(final NormalizedNode node) throws IOException {
38 delegNNWriter.write(node);
43 public void flush() throws IOException {
44 delegNNWriter.flush();
48 public void close() throws IOException {
49 delegNNWriter.close();