Class YangXmlUtils


  • public class YangXmlUtils
    extends java.lang.Object
    Util CLass for Yang models. Clean abstraction to read, obtain and populate XML from Yang models translated into XML skeletons.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      org.slf4j.Logger log  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected YangXmlUtils()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.io.InputStream getCfgInputStream​(java.lang.String file)  
      static YangXmlUtils getInstance()
      Single Instance of Yang utilities retriever.
      java.lang.String getString​(org.apache.commons.configuration.XMLConfiguration cfg)
      Return the string representation of the XMLConfig without header and configuration element.
      org.apache.commons.configuration.XMLConfiguration getXmlConfiguration​(java.lang.String file, java.util.List<YangElement> elements)
      Retrieves a valid XML configuration for a specific XML path for multiple instance of YangElements objects.
      org.apache.commons.configuration.XMLConfiguration getXmlConfiguration​(java.lang.String file, java.util.Map<java.lang.String,​java.lang.String> values)
      Retrieves a valid XML configuration for a specific XML path for a single instance of the Map specified key-value pairs.
      org.apache.commons.configuration.XMLConfiguration loadXml​(java.io.InputStream xmlStream)
      Method to read an input stream into a XMLConfiguration.
      java.util.List<YangElement> readXmlConfiguration​(org.apache.commons.configuration.HierarchicalConfiguration cfg, java.lang.String path)
      Reads a valid XML configuration and returns a Map containing XML field name.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • log

        public final org.slf4j.Logger log
    • Constructor Detail

      • YangXmlUtils

        protected YangXmlUtils()
    • Method Detail

      • getXmlConfiguration

        public org.apache.commons.configuration.XMLConfiguration getXmlConfiguration​(java.lang.String file,
                                                                                     java.util.Map<java.lang.String,​java.lang.String> values)
        Retrieves a valid XML configuration for a specific XML path for a single instance of the Map specified key-value pairs.
        Parameters:
        file - path of the file to be used.
        values - map of key and values to set under the generic path.
        Returns:
        Hierarchical configuration containing XML with values.
      • getXmlConfiguration

        public org.apache.commons.configuration.XMLConfiguration getXmlConfiguration​(java.lang.String file,
                                                                                     java.util.List<YangElement> elements)
        Retrieves a valid XML configuration for a specific XML path for multiple instance of YangElements objects.
        Parameters:
        file - path of the file to be used.
        elements - List of YangElements that are to be set.
        Returns:
        Hierachical configuration containing XML with values.
      • getCfgInputStream

        protected java.io.InputStream getCfgInputStream​(java.lang.String file)
      • readXmlConfiguration

        public java.util.List<YangElement> readXmlConfiguration​(org.apache.commons.configuration.HierarchicalConfiguration cfg,
                                                                java.lang.String path)
        Reads a valid XML configuration and returns a Map containing XML field name. and value contained for every subpath.
        Parameters:
        cfg - the Configuration to read.
        path - path of the information to be read.
        Returns:
        list of elements containing baskey and map of key value pairs.
      • getInstance

        public static YangXmlUtils getInstance()
        Single Instance of Yang utilities retriever.
        Returns:
        instance of YangXmlUtils
      • getString

        public java.lang.String getString​(org.apache.commons.configuration.XMLConfiguration cfg)
        Return the string representation of the XMLConfig without header and configuration element.
        Parameters:
        cfg - the XML to convert
        Returns:
        the cfg string.
      • loadXml

        public org.apache.commons.configuration.XMLConfiguration loadXml​(java.io.InputStream xmlStream)
        Method to read an input stream into a XMLConfiguration.
        Parameters:
        xmlStream - inputstream containing XML description
        Returns:
        the XMLConfiguration object