X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-clustering-commons%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Fnode%2Futils%2Fstream%2FNormalizedNodeInputStreamReader.java;h=239cd7cb57f703d9c6ef7795fc74fc72a889497b;hp=797258b4438cc61825524136ecb0b6aa4ff2aa5e;hb=69e914b3889a82fa2f7daa8d55e1aa0de23fb454;hpb=2e15a7b29e4517e7b1b1ded0acb5a0ccf03d77e0 diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/NormalizedNodeInputStreamReader.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/NormalizedNodeInputStreamReader.java old mode 100644 new mode 100755 index 797258b443..239cd7cb57 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/NormalizedNodeInputStreamReader.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/NormalizedNodeInputStreamReader.java @@ -1,400 +1,427 @@ /* + * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others. All rights reserved. * - * 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 - * + * 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.cluster.datastore.node.utils.stream; -import com.google.common.base.Preconditions; +import static java.util.Objects.requireNonNull; + +import com.google.common.base.Strings; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableList.Builder; +import java.io.DataInput; +import java.io.IOException; +import java.io.StringReader; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.dom.DOMSource; +import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.controller.cluster.datastore.node.utils.QNameFactory; +import org.opendaylight.yangtools.util.ImmutableOffsetMapTemplate; +import org.opendaylight.yangtools.yang.common.Empty; import org.opendaylight.yangtools.yang.common.QName; -import org.opendaylight.yangtools.yang.data.api.Node; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; -import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode; -import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode; -import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; -import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument; +import org.opendaylight.yangtools.yang.data.api.schema.LeafNode; import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode; -import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode; -import org.opendaylight.yangtools.yang.data.api.schema.MapNode; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; -import org.opendaylight.yangtools.yang.data.api.schema.OrderedMapNode; -import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode; -import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListNode; import org.opendaylight.yangtools.yang.data.impl.schema.Builders; -import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; -import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeAttrBuilder; -import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeBuilder; import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.ListNodeBuilder; -import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.NormalizedNodeAttrBuilder; +import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.NormalizedNodeBuilder; +import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.NormalizedNodeContainerBuilder; +import org.opendaylight.yangtools.yang.model.api.SchemaPath; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.DataInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.math.BigDecimal; -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; +import org.w3c.dom.Element; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; /** - * NormalizedNodeInputStreamReader reads the byte stream and constructs the normalized node including its children nodes. - * This process goes in recursive manner, where each NodeTypes object signifies the start of the object, except END_NODE. - * If a node can have children, then that node's end is calculated based on appearance of END_NODE. - * + * NormalizedNodeInputStreamReader reads the byte stream and constructs the normalized node including its children + * nodes. This process goes in recursive manner, where each NodeTypes object signifies the start of the object, except + * END_NODE. If a node can have children, then that node's end is calculated based on appearance of END_NODE. */ - -public class NormalizedNodeInputStreamReader implements NormalizedNodeStreamReader { +public class NormalizedNodeInputStreamReader extends ForwardingDataInput implements NormalizedNodeDataInput { private static final Logger LOG = LoggerFactory.getLogger(NormalizedNodeInputStreamReader.class); - private static final String REVISION_ARG = "?revision="; + private final @NonNull DataInput input; - private final DataInputStream reader; - - private final Map codedStringMap = new HashMap<>(); + private final List codedStringMap = new ArrayList<>(); private QName lastLeafSetQName; - public NormalizedNodeInputStreamReader(InputStream stream) throws IOException { - Preconditions.checkNotNull(stream); - reader = new DataInputStream(stream); + private NormalizedNodeBuilder> leafBuilder; + + @SuppressWarnings("rawtypes") + private NormalizedNodeBuilder> leafSetEntryBuilder; + + NormalizedNodeInputStreamReader(final DataInput input) { + this.input = requireNonNull(input); + } + + @Override + final DataInput delegate() { + return input; } @Override public NormalizedNode readNormalizedNode() throws IOException { - NormalizedNode node = null; + return readNormalizedNodeInternal(); + } + private NormalizedNode readNormalizedNodeInternal() throws IOException { // each node should start with a byte - byte nodeType = reader.readByte(); + byte nodeType = input.readByte(); - if(nodeType == NodeTypes.END_NODE) { - LOG.debug("End node reached. return"); + if (nodeType == NodeTypes.END_NODE) { + LOG.trace("End node reached. return"); + lastLeafSetQName = null; return null; } - else if(nodeType == NodeTypes.AUGMENTATION_NODE) { - LOG.debug("Reading augmentation node. will create augmentation identifier"); - YangInstanceIdentifier.AugmentationIdentifier identifier = - new YangInstanceIdentifier.AugmentationIdentifier(readQNameSet()); - DataContainerNodeBuilder augmentationBuilder = - Builders.augmentationBuilder().withNodeIdentifier(identifier); - augmentationBuilder = addDataContainerChildren(augmentationBuilder); - node = augmentationBuilder.build(); + switch (nodeType) { + case NodeTypes.AUGMENTATION_NODE: + AugmentationIdentifier augIdentifier = readAugmentationIdentifier(); + LOG.trace("Reading augmentation node {} ", augIdentifier); + return addDataContainerChildren(Builders.augmentationBuilder().withNodeIdentifier(augIdentifier)) + .build(); + + case NodeTypes.LEAF_SET_ENTRY_NODE: + final QName name = lastLeafSetQName != null ? lastLeafSetQName : readQName(); + final Object value = readObject(); + final NodeWithValue leafIdentifier = new NodeWithValue<>(name, value); + LOG.trace("Reading leaf set entry node {}, value {}", leafIdentifier, value); + return leafSetEntryBuilder().withNodeIdentifier(leafIdentifier).withValue(value).build(); + + case NodeTypes.MAP_ENTRY_NODE: + final NodeIdentifierWithPredicates entryIdentifier = readNormalizedNodeWithPredicates(); + LOG.trace("Reading map entry node {} ", entryIdentifier); + return addDataContainerChildren(Builders.mapEntryBuilder().withNodeIdentifier(entryIdentifier)) + .build(); + + default: + return readNodeIdentifierDependentNode(nodeType, readNodeIdentifier()); + } + } - } else { - if(nodeType == NodeTypes.LEAF_SET_ENTRY_NODE) { - LOG.debug("Reading leaf set entry node. Will create NodeWithValue instance identifier"); + private NormalizedNodeBuilder> leafBuilder() { + if (leafBuilder == null) { + leafBuilder = Builders.leafBuilder(); + } + return leafBuilder; + } + + @SuppressWarnings("rawtypes") + private NormalizedNodeBuilder> leafSetEntryBuilder() { + if (leafSetEntryBuilder == null) { + leafSetEntryBuilder = Builders.leafSetEntryBuilder(); + } + + return leafSetEntryBuilder; + } + + private NormalizedNode readNodeIdentifierDependentNode(final byte nodeType, final NodeIdentifier identifier) + throws IOException { + + switch (nodeType) { + case NodeTypes.LEAF_NODE: + LOG.trace("Read leaf node {}", identifier); // Read the object value - Object value = readObject(); + return leafBuilder().withNodeIdentifier(identifier).withValue(readObject()).build(); - YangInstanceIdentifier.NodeWithValue nodeWithValue = new YangInstanceIdentifier.NodeWithValue( - lastLeafSetQName, value); - node = Builders.leafSetEntryBuilder().withNodeIdentifier(nodeWithValue). - withValue(value).build(); + case NodeTypes.ANY_XML_NODE: + LOG.trace("Read xml node"); + return Builders.anyXmlBuilder().withNodeIdentifier(identifier).withValue(readDOMSource()).build(); - } else if(nodeType == NodeTypes.MAP_ENTRY_NODE) { - LOG.debug("Reading map entry node. Will create node identifier with predicates."); + case NodeTypes.MAP_NODE: + LOG.trace("Read map node {}", identifier); + return addDataContainerChildren(Builders.mapBuilder().withNodeIdentifier(identifier)).build(); - QName qName = readQName(); - YangInstanceIdentifier.NodeIdentifierWithPredicates nodeIdentifier = - new YangInstanceIdentifier.NodeIdentifierWithPredicates(qName, readKeyValueMap()); - DataContainerNodeAttrBuilder mapEntryBuilder - = Builders.mapEntryBuilder().withNodeIdentifier(nodeIdentifier); + case NodeTypes.CHOICE_NODE: + LOG.trace("Read choice node {}", identifier); + return addDataContainerChildren(Builders.choiceBuilder().withNodeIdentifier(identifier)).build(); - mapEntryBuilder = (DataContainerNodeAttrBuilder)addDataContainerChildren(mapEntryBuilder); - node = mapEntryBuilder.build(); + case NodeTypes.ORDERED_MAP_NODE: + LOG.trace("Reading ordered map node {}", identifier); + return addDataContainerChildren(Builders.orderedMapBuilder().withNodeIdentifier(identifier)).build(); - } else { - LOG.debug("Creating standard node identifier. "); + case NodeTypes.UNKEYED_LIST: + LOG.trace("Read unkeyed list node {}", identifier); + return addDataContainerChildren(Builders.unkeyedListBuilder().withNodeIdentifier(identifier)).build(); - QName qName = readQName(); - YangInstanceIdentifier.NodeIdentifier identifier = new YangInstanceIdentifier.NodeIdentifier(qName); - node = readNodeIdentifierDependentNode(nodeType, identifier); + case NodeTypes.UNKEYED_LIST_ITEM: + LOG.trace("Read unkeyed list item node {}", identifier); + return addDataContainerChildren(Builders.unkeyedListEntryBuilder() + .withNodeIdentifier(identifier)).build(); - } - } - return node; - } + case NodeTypes.CONTAINER_NODE: + LOG.trace("Read container node {}", identifier); + return addDataContainerChildren(Builders.containerBuilder().withNodeIdentifier(identifier)).build(); - private NormalizedNode readNodeIdentifierDependentNode(byte nodeType, YangInstanceIdentifier.NodeIdentifier identifier) - throws IOException { + case NodeTypes.LEAF_SET: + LOG.trace("Read leaf set node {}", identifier); + return addLeafSetChildren(identifier.getNodeType(), + Builders.leafSetBuilder().withNodeIdentifier(identifier)).build(); - switch(nodeType) { - case NodeTypes.LEAF_NODE : - LOG.debug("Read leaf node"); - // Read the object value - NormalizedNodeAttrBuilder leafBuilder = Builders.leafBuilder(); - return leafBuilder.withNodeIdentifier(identifier).withValue(readObject()).build(); - - case NodeTypes.ANY_XML_NODE : - LOG.debug("Read xml node"); - Node value = (Node) readObject(); - return Builders.anyXmlBuilder().withValue(value).build(); - - case NodeTypes.MAP_NODE : - LOG.debug("Read map node"); - CollectionNodeBuilder mapBuilder = Builders.mapBuilder().withNodeIdentifier(identifier); - mapBuilder = addMapNodeChildren(mapBuilder); - return mapBuilder.build(); - - case NodeTypes.CHOICE_NODE : - LOG.debug("Read choice node"); - DataContainerNodeBuilder choiceBuilder = - Builders.choiceBuilder().withNodeIdentifier(identifier); - choiceBuilder = addDataContainerChildren(choiceBuilder); - return choiceBuilder.build(); - - case NodeTypes.ORDERED_MAP_NODE : - LOG.debug("Reading ordered map node"); - CollectionNodeBuilder orderedMapBuilder = - Builders.orderedMapBuilder().withNodeIdentifier(identifier); - orderedMapBuilder = addMapNodeChildren(orderedMapBuilder); - return orderedMapBuilder.build(); - - case NodeTypes.UNKEYED_LIST : - LOG.debug("Read unkeyed list node"); - CollectionNodeBuilder unkeyedListBuilder = - Builders.unkeyedListBuilder().withNodeIdentifier(identifier); - unkeyedListBuilder = addUnkeyedListChildren(unkeyedListBuilder); - return unkeyedListBuilder.build(); - - case NodeTypes.UNKEYED_LIST_ITEM : - LOG.debug("Read unkeyed list item node"); - DataContainerNodeAttrBuilder unkeyedListEntryBuilder - = Builders.unkeyedListEntryBuilder().withNodeIdentifier(identifier); - - unkeyedListEntryBuilder = (DataContainerNodeAttrBuilder) - addDataContainerChildren(unkeyedListEntryBuilder); - return unkeyedListEntryBuilder.build(); - - case NodeTypes.CONTAINER_NODE : - LOG.debug("Read container node"); - DataContainerNodeAttrBuilder containerBuilder = - Builders.containerBuilder().withNodeIdentifier(identifier); - - containerBuilder = (DataContainerNodeAttrBuilder) - addDataContainerChildren(containerBuilder); - return containerBuilder.build(); - - case NodeTypes.LEAF_SET : - LOG.debug("Read leaf set node"); - ListNodeBuilder> leafSetBuilder = - Builders.leafSetBuilder().withNodeIdentifier(identifier); - leafSetBuilder = addLeafSetChildren(identifier.getNodeType(), leafSetBuilder); - return leafSetBuilder.build(); - - default : + case NodeTypes.ORDERED_LEAF_SET: + LOG.trace("Read ordered leaf set node {}", identifier); + return addLeafSetChildren(identifier.getNodeType(), + Builders.orderedLeafSetBuilder().withNodeIdentifier(identifier)).build(); + + default: return null; } } + private DOMSource readDOMSource() throws IOException { + String xml = readObject().toString(); + try { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + factory.setNamespaceAware(true); + Element node = factory.newDocumentBuilder().parse( + new InputSource(new StringReader(xml))).getDocumentElement(); + return new DOMSource(node); + } catch (SAXException | ParserConfigurationException e) { + throw new IOException("Error parsing XML: " + xml, e); + } + } + private QName readQName() throws IOException { // Read in the same sequence of writing String localName = readCodedString(); String namespace = readCodedString(); - String revision = readCodedString(); - String qName; - // Not using stringbuilder as compiler optimizes string concatenation of + - if(revision != null){ - qName = "(" + namespace+ REVISION_ARG + revision + ")" +localName; - } else { - qName = "(" + namespace + ")" +localName; - } + String revision = Strings.emptyToNull(readCodedString()); - return QNameFactory.create(qName); + return QNameFactory.create(new QNameFactory.Key(localName, namespace, revision)); } private String readCodedString() throws IOException { - boolean readFromMap = reader.readBoolean(); - if(readFromMap) { - return codedStringMap.get(reader.readInt()); - } else { - String value = reader.readUTF(); - if(value != null) { - codedStringMap.put(Integer.valueOf(codedStringMap.size()), value); - } - return value; + final byte valueType = input.readByte(); + switch (valueType) { + case TokenTypes.IS_NULL_VALUE: + return null; + case TokenTypes.IS_CODE_VALUE: + final int code = input.readInt(); + try { + return codedStringMap.get(code); + } catch (IndexOutOfBoundsException e) { + throw new IOException("String code " + code + " was not found", e); + } + case TokenTypes.IS_STRING_VALUE: + final String value = input.readUTF().intern(); + codedStringMap.add(value); + return value; + default: + throw new IOException("Unhandled string value type " + valueType); } } - private Set readQNameSet() throws IOException{ + private Set readQNameSet() throws IOException { // Read the children count - int count = reader.readInt(); + int count = input.readInt(); Set children = new HashSet<>(count); - for(int i = 0; i readKeyValueMap() throws IOException { - int count = reader.readInt(); - Map keyValueMap = new HashMap<>(count); + private AugmentationIdentifier readAugmentationIdentifier() throws IOException { + // FIXME: we should have a cache for these, too + return new AugmentationIdentifier(readQNameSet()); + } - for(int i = 0; i keys = ImmutableList.builderWithExpectedSize(count); + final Object[] values = new Object[count]; + for (int i = 0; i < count; i++) { + keys.add(readQName()); + values[i] = readObject(); + } - return keyValueMap; + return new NodeIdentifierWithPredicates(qname, ImmutableOffsetMapTemplate.ordered(keys.build()) + .instantiateWithValues(values)); + } } private Object readObject() throws IOException { - byte objectType = reader.readByte(); - switch(objectType) { + byte objectType = input.readByte(); + switch (objectType) { case ValueTypes.BITS_TYPE: return readObjSet(); - case ValueTypes.BOOL_TYPE : - return reader.readBoolean(); + case ValueTypes.BOOL_TYPE: + return input.readBoolean(); - case ValueTypes.BYTE_TYPE : - return reader.readByte(); + case ValueTypes.BYTE_TYPE: + return input.readByte(); - case ValueTypes.INT_TYPE : - return reader.readInt(); + case ValueTypes.INT_TYPE: + return input.readInt(); - case ValueTypes.LONG_TYPE : - return reader.readLong(); + case ValueTypes.LONG_TYPE: + return input.readLong(); - case ValueTypes.QNAME_TYPE : + case ValueTypes.QNAME_TYPE: return readQName(); - case ValueTypes.SHORT_TYPE : - return reader.readShort(); + case ValueTypes.SHORT_TYPE: + return input.readShort(); - case ValueTypes.STRING_TYPE : - return reader.readUTF(); + case ValueTypes.STRING_TYPE: + return input.readUTF(); - case ValueTypes.BIG_DECIMAL_TYPE : - return new BigDecimal(reader.readUTF()); + case ValueTypes.STRING_BYTES_TYPE: + return readStringBytes(); - case ValueTypes.BIG_INTEGER_TYPE : - return new BigInteger(reader.readUTF()); + case ValueTypes.BIG_DECIMAL_TYPE: + return new BigDecimal(input.readUTF()); - case ValueTypes.YANG_IDENTIFIER_TYPE : - int size = reader.readInt(); + case ValueTypes.BIG_INTEGER_TYPE: + return new BigInteger(input.readUTF()); - List pathArguments = new ArrayList<>(size); + case ValueTypes.BINARY_TYPE: + byte[] bytes = new byte[input.readInt()]; + input.readFully(bytes); + return bytes; - for(int i=0; i qnames = ImmutableList.builderWithExpectedSize(size); + for (int i = 0; i < size; ++i) { + qnames.add(readQName()); + } + return SchemaPath.create(qnames.build(), absolute); + } + + @Override + public YangInstanceIdentifier readYangInstanceIdentifier() throws IOException { + return readYangInstanceIdentifierInternal(); + } + + private YangInstanceIdentifier readYangInstanceIdentifierInternal() throws IOException { + int size = input.readInt(); + final Builder pathArguments = ImmutableList.builderWithExpectedSize(size); + for (int i = 0; i < size; i++) { + pathArguments.add(readPathArgument()); + } + return YangInstanceIdentifier.create(pathArguments.build()); + } + private Set readObjSet() throws IOException { - int count = reader.readInt(); + int count = input.readInt(); Set children = new HashSet<>(count); - for(int i = 0; i(readQName(), readObject()); + default: + // FIXME: throw hard error return null; } } - private ListNodeBuilder> addLeafSetChildren(QName nodeType, - ListNodeBuilder> builder) - throws IOException { + @SuppressWarnings("unchecked") + private ListNodeBuilder> addLeafSetChildren(final QName nodeType, + final ListNodeBuilder> builder) throws IOException { - LOG.debug("Reading children of leaf set"); + LOG.trace("Reading children of leaf set"); lastLeafSetQName = nodeType; - LeafSetEntryNode child = (LeafSetEntryNode)readNormalizedNode(); + LeafSetEntryNode child = (LeafSetEntryNode)readNormalizedNodeInternal(); - while(child != null) { + while (child != null) { builder.withChild(child); - child = (LeafSetEntryNode)readNormalizedNode(); + child = (LeafSetEntryNode)readNormalizedNodeInternal(); } return builder; } - private CollectionNodeBuilder addUnkeyedListChildren( - CollectionNodeBuilder builder) - throws IOException{ + @SuppressWarnings({ "unchecked", "rawtypes" }) + private NormalizedNodeContainerBuilder addDataContainerChildren( + final NormalizedNodeContainerBuilder builder) throws IOException { + LOG.trace("Reading data container (leaf nodes) nodes"); - LOG.debug("Reading children of unkeyed list"); - UnkeyedListEntryNode child = (UnkeyedListEntryNode)readNormalizedNode(); + NormalizedNode child = readNormalizedNodeInternal(); - while(child != null) { - builder.withChild(child); - child = (UnkeyedListEntryNode)readNormalizedNode(); + while (child != null) { + builder.addChild(child); + child = readNormalizedNodeInternal(); } return builder; } - - private DataContainerNodeBuilder addDataContainerChildren(DataContainerNodeBuilder builder) - throws IOException { - LOG.debug("Reading data container (leaf nodes) nodes"); - - DataContainerChild child = - (DataContainerChild) readNormalizedNode(); - - while(child != null) { - builder.withChild(child); - child = - (DataContainerChild) readNormalizedNode(); - } - return builder; - } - - - private CollectionNodeBuilder addMapNodeChildren(CollectionNodeBuilder builder) - throws IOException { - LOG.debug("Reading map node children"); - MapEntryNode child = (MapEntryNode)readNormalizedNode(); - - while(child != null){ - builder.withChild(child); - child = (MapEntryNode)readNormalizedNode(); - } - - return builder; - } - - - @Override - public void close() throws IOException { - reader.close(); - } - }