Class XmlMetaWriter


  • public final class XmlMetaWriter
    extends java.lang.Object
    Class to write module details object into an XML file.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.String DEFAULT_FILE_SEPARATOR
      Default(UNIX) file separator.
      private static java.util.regex.Pattern FILEPATH_CONVERSION
      Compiled pattern for . used for generating file paths from package names.
      private static java.lang.String XML_TAG_DESCRIPTION
      Description tag of metadata XML files.
      private static java.lang.String XML_TAG_NAME
      Name tag of metadata XML files.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private XmlMetaWriter()
      Do no allow XmlMetaWriter instances to be created.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static void createPropertySection​(ModuleDetails moduleDetails, org.w3c.dom.Element checkModule, org.w3c.dom.Document doc)
      Create the property section of the module detail object.
      static void write​(ModuleDetails moduleDetails)
      Helper function to write module details to XML file.
      private static void writeToFile​(org.w3c.dom.Document document, ModuleDetails moduleDetails)
      Function to write the prepared document object into an XML file.
      • Methods inherited from class java.lang.Object

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

      • XmlMetaWriter

        private XmlMetaWriter()
        Do no allow XmlMetaWriter instances to be created.
    • Method Detail

      • write

        public static void write​(ModuleDetails moduleDetails)
                          throws javax.xml.transform.TransformerException,
                                 javax.xml.parsers.ParserConfigurationException
        Helper function to write module details to XML file.
        Parameters:
        moduleDetails - module details
        Throws:
        javax.xml.transform.TransformerException - if a transformer exception occurs
        javax.xml.parsers.ParserConfigurationException - if a parser configuration exception occurs
      • createPropertySection

        private static void createPropertySection​(ModuleDetails moduleDetails,
                                                  org.w3c.dom.Element checkModule,
                                                  org.w3c.dom.Document doc)
        Create the property section of the module detail object.
        Parameters:
        moduleDetails - module details
        checkModule - root doc element
        doc - document object
      • writeToFile

        private static void writeToFile​(org.w3c.dom.Document document,
                                        ModuleDetails moduleDetails)
                                 throws javax.xml.transform.TransformerException
        Function to write the prepared document object into an XML file.
        Parameters:
        document - document updated with all module metadata
        moduleDetails - the corresponding module details object
        Throws:
        javax.xml.transform.TransformerException - if a transformer exception occurs