Class TorqueXmlParser


  • final class TorqueXmlParser
    extends java.lang.Object
    Parses xml output from TORQUE batch system.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private javax.xml.parsers.DocumentBuilder documentBuilder  
      private static org.slf4j.Logger LOGGER  
    • Constructor Summary

      Constructors 
      Constructor Description
      TorqueXmlParser()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected org.w3c.dom.Document parseDocument​(java.lang.String data)  
      protected java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​java.lang.String>> parseJobInfos​(java.lang.String data)
      Parses job info from "qstat -x"
      protected void recursiveMapFromElement​(org.w3c.dom.Node root, java.util.Map<java.lang.String,​java.lang.String> result)
      Create a Map from the tag names and text values of child nodes.
      • Methods inherited from class java.lang.Object

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

      • LOGGER

        private static final org.slf4j.Logger LOGGER
      • documentBuilder

        private final javax.xml.parsers.DocumentBuilder documentBuilder
    • Method Detail

      • recursiveMapFromElement

        protected void recursiveMapFromElement​(org.w3c.dom.Node root,
                                               java.util.Map<java.lang.String,​java.lang.String> result)
        Create a Map from the tag names and text values of child nodes. If a child node also has tags, those tags and their text values will also be added. If multiple of the same tag names occur, the value of the last occurrence will be stored.
        Parameters:
        root - XML element of which the children will be added to the map
        result - a mutable map that will have added to it tag names as keys and text values as values
        Throws:
        java.lang.IllegalArgumentException - if root is not an XML element
      • parseJobInfos

        protected java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​java.lang.String>> parseJobInfos​(java.lang.String data)
                                                                                                                      throws XenonException
        Parses job info from "qstat -x"
        Parameters:
        data - the stream to get the xml data from
        Returns:
        a list containing all queue names found
        Throws:
        XenonException - if the file could not be parsed
        XenonException - if the server version is not compatible with this adaptor