Switch to using java.util.Base64
[yangtools.git] / yang / yang-data-jaxen / src / main / java / org / opendaylight / yangtools / yang / data / jaxen / NormalizedNodeNavigator.java
index d893af7fc97b3ede7015b9aa118b006ba9b07554..e28e56475dbe0e7d238ce9fa5ad1e151515a871b 100644 (file)
@@ -13,10 +13,8 @@ import com.google.common.base.Joiner;
 import com.google.common.base.Verify;
 import com.google.common.collect.Iterators;
 import com.google.common.collect.UnmodifiableIterator;
-import com.google.common.io.BaseEncoding;
-import java.util.AbstractMap.SimpleImmutableEntry;
+import java.util.Base64;
 import java.util.Iterator;
-import java.util.Map;
 import java.util.Map.Entry;
 import java.util.NoSuchElementException;
 import java.util.Set;
@@ -28,7 +26,6 @@ import org.jaxen.XPath;
 import org.jaxen.saxpath.SAXPathException;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.data.api.AttributesContainer;
 import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
 import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
@@ -168,7 +165,7 @@ final class NormalizedNodeNavigator extends DefaultNavigator implements NamedAcc
             //       allocations.
             if (value instanceof byte[]) {
                 // Binary
-                return BaseEncoding.base64().encode((byte[]) value);
+                return Base64.getEncoder().encodeToString((byte[]) value);
             }
             if (value instanceof Set) {
                 // Bits
@@ -228,34 +225,34 @@ final class NormalizedNodeNavigator extends DefaultNavigator implements NamedAcc
 
     @Override
     public Iterator<? extends Entry<?, ?>> getAttributeAxisIterator(final Object contextNode) {
-        final NormalizedNode<?, ?> node = contextNode(contextNode);
-        if (node instanceof AttributesContainer) {
-            final Map<QName, String> attributes = ((AttributesContainer) node).getAttributes();
-            if (attributes.isEmpty()) {
-                return null;
-            }
-
-            return attributes.entrySet().iterator();
-        }
-
+        // FIXME: how do we mix in metadata?
+        //      final NormalizedNode<?, ?> node = contextNode(contextNode);
+        //      if (node instanceof AttributesContainer) {
+        //          final Map<QName, String> attributes = ((AttributesContainer) node).getAttributes();
+        //          if (attributes.isEmpty()) {
+        //              return null;
+        //          }
+        //
+        //          return attributes.entrySet().iterator();
+        //      }
         return null;
     }
 
     @Override
     public Iterator<? extends Entry<?, ?>> getAttributeAxisIterator(final Object contextNode, final String localName,
             final String namespacePrefix, final String namespaceURI) {
-        final NormalizedNode<?, ?> node = contextNode(contextNode);
-        if (node instanceof AttributesContainer) {
-            final Map<QName, String> attributes = ((AttributesContainer) node).getAttributes();
-            if (attributes.isEmpty()) {
-                return null;
-            }
-
-            final QName qname = resolveQName(node, namespacePrefix, localName);
-            final String value = attributes.get(qname);
-            return value == null ? null : Iterators.singletonIterator(new SimpleImmutableEntry<>(qname, value));
-        }
-
+        // FIXME: how do we mix in metadata?
+        //      final NormalizedNode<?, ?> node = contextNode(contextNode);
+        //      if (node instanceof AttributesContainer) {
+        //          final Map<QName, String> attributes = ((AttributesContainer) node).getAttributes();
+        //          if (attributes.isEmpty()) {
+        //              return null;
+        //          }
+        //
+        //          final QName qname = resolveQName(node, namespacePrefix, localName);
+        //          final String value = attributes.get(qname);
+        //          return value == null ? null : Iterators.singletonIterator(new SimpleImmutableEntry<>(qname, value));
+        //      }
         return null;
     }