X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-cli%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fcli%2Fwriter%2Fimpl%2FNormalizedNodeWriter.java;fp=opendaylight%2Fnetconf%2Fnetconf-cli%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fcli%2Fwriter%2Fimpl%2FNormalizedNodeWriter.java;h=0000000000000000000000000000000000000000;hp=83c6955fb6651e64276e0965254526b2e9659e7e;hb=23fe9ca678ada6263fec5dd996f4025e4a32fcf5;hpb=071a641d7c12c0e6112d5ce0afe806b54f116ed2 diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/NormalizedNodeWriter.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/NormalizedNodeWriter.java deleted file mode 100644 index 83c6955fb6..0000000000 --- a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/NormalizedNodeWriter.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.netconf.cli.writer.impl; - -import java.io.IOException; -import java.util.Iterator; -import java.util.List; -import org.opendaylight.controller.netconf.cli.io.ConsoleIO; -import org.opendaylight.controller.netconf.cli.writer.OutFormatter; -import org.opendaylight.controller.netconf.cli.writer.WriteException; -import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild; -import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; -import org.opendaylight.yangtools.yang.data.impl.schema.transform.base.serializer.NodeSerializerDispatcher; -import org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.DomUtils; -import org.opendaylight.yangtools.yang.model.api.DataSchemaNode; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class NormalizedNodeWriter extends AbstractWriter { - - private static final Logger LOG = LoggerFactory.getLogger(NormalizedNodeWriter.class); - private final OutFormatter out; - - public NormalizedNodeWriter(final ConsoleIO console, final OutFormatter out) { - super(console); - this.out = out; - } - - public void writeInner(final DataSchemaNode dataSchemaNode, final List> dataNodes) throws WriteException, - IOException { - //Preconditions.checkState(dataNodes.size() == 1); - // TODO - add getDispatcher method to CnSnToNormalizedNodeParserFactory - // to be able call dispatchChildElement - final NormalizedNode dataContainerChild = dataNodes.get(0); - - if (dataContainerChild != null) { - console.writeLn(serializeToCliOutput(dataContainerChild, dataSchemaNode)); - } - - } - - private String serializeToCliOutput(final NormalizedNode dataContainerChild, - final DataSchemaNode childSchema) { - final CliOutputFromNormalizedNodeSerializerFactory factorySerialization = CliOutputFromNormalizedNodeSerializerFactory - .getInstance(out, DomUtils.defaultValueCodecProvider()); - final NodeSerializerDispatcher dispatcher = factorySerialization.getDispatcher(); - final Iterable result = dispatcher.dispatchChildElement(childSchema, (DataContainerChild) dataContainerChild); - - if (result == null) { - return ""; - } - - final Iterator output = result.iterator(); - if (!output.hasNext()) { - return ""; - } - - return output.next(); - } - -}