Class SiteSetupQuestionFileParser


  • public class SiteSetupQuestionFileParser
    extends Object
    This parser is mainly to parse the questions.xml file:
    Author:
    zqian
    • Field Detail

      • m_adminSiteName

        protected static String m_adminSiteName
      • m_configFolder

        protected static String m_configFolder
      • m_configBackupFolder

        protected static String m_configBackupFolder
      • m_configXml

        protected static String m_configXml
    • Constructor Detail

      • SiteSetupQuestionFileParser

        public SiteSetupQuestionFileParser()
    • Method Detail

      • getAdminSiteName

        public String getAdminSiteName()
      • setAdminSiteName

        public void setAdminSiteName​(String siteName)
      • getConfigFolderReference

        public static String getConfigFolderReference()
        the reference to config folder
        Returns:
      • getConfigBackupFolderReference

        public static String getConfigBackupFolderReference()
        the reference to config backup folder
        Returns:
      • isConfigurationXmlAvailable

        public static boolean isConfigurationXmlAvailable()
        Is the configuration XML file provided and readable
        Returns:
        true If the XML file is provided and readable, false otherwise
      • exists

        protected static boolean exists​(String resourceName)
        Does the specified configuration/hierarchy resource exist?
        Parameters:
        resourceName - Resource name
        Returns:
        true If we can access this content
      • enableSecurityAdvisor

        protected static void enableSecurityAdvisor()
        Establish a security advisor to allow the "embedded" azg work to occur with no need for additional security permissions.
      • popSecurityAdvisor

        protected static void popSecurityAdvisor()
        remove recent SecurityAdvisor
      • updateConfig

        public static SiteSetupQuestionMap updateConfig()
        Update configuration data from an XML resource
        Parameters:
        configFileRef - XML configuration reference (/content/...)
      • populateConfig

        protected static SiteSetupQuestionMap populateConfig​(String configurationXml,
                                                             InputStream stream)
        Populate cached values from a configuration XML resource. We always try to parse the resource, regardless of any prior success or failure.
        Parameters:
        configurationXml - Configuration resource name (this doubles as a unique key into the configuration cache)
      • saveParameter

        protected void saveParameter​(Document document,
                                     Map parameterMap,
                                     String name)
        Lookup and save one dynamic configuration parameter
        Parameters:
        Configuration - XML
        parameterMap - Parameter name=value pairs
        name - Parameter name
      • parseXmlFromStream

        protected static Document parseXmlFromStream​(InputStream stream)
        Parse an XML resource
        Parameters:
        filename - The filename (or URI) to parse
        Returns:
        DOM Document (null if parse fails)
      • getXmlDocumentBuilder

        protected static DocumentBuilder getXmlDocumentBuilder()
        Get a DOM Document builder.
        Returns:
        The DocumentBuilder
        Throws:
        DomException
      • normalizeText

        protected String normalizeText​(String original,
                                       String update)
        "Normalize" XML text node content to create a simple string
        Parameters:
        original - Original text
        update - Text to add to the original string (a space separates the two)
        Returns:
        Concatenated contents (trimmed)
      • getText

        protected String getText​(Document root,
                                 String elementName)
        Get the text associated with this element
        Parameters:
        root - The document containing the text element
        Returns:
        Text (trimmed of leading/trailing whitespace, null if none)
      • getText

        protected String getText​(Element root,
                                 String elementName)
        Get the text associated with this element
        Parameters:
        root - The root node of the text element
        Returns:
        Text (trimmed of leading/trailing whitespace, null if none)