Class ConfigLoader

    • Constructor Summary

      Constructors 
      Constructor Description
      ConfigLoader​(java.io.File configFile)
      Create new ConfigLoader using supplied File.
      ConfigLoader​(java.lang.String configFileName, Config config)
      Create new ConfigLoader using supplied filename and config.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private static java.lang.String getAttribute​(org.w3c.dom.Element element, java.lang.String name)
      Override default behavior of element.getAttribute (returns the empty string) to return null.
      private static java.lang.String getContainedText​(org.w3c.dom.Node parent, java.lang.String childTagName)
      With a given parent XML Element, find the text contents of the child element with supplied name.
      Decorator getDecoratorByName​(java.lang.String name)
      Retrieve Decorator based on name specified in configuration file.
      java.lang.String getMappedName​(java.lang.String path)
      Get name of Decorator mapped to given path.
      private void loadConfig()
      Load configuration from file.
      private void parseConfig​(org.w3c.dom.Document document)
      Parse configuration from XML document.
      private void populatePathMapper​(org.w3c.dom.NodeList patternNodes, java.lang.String role, java.lang.String name)
      Extracts each URL pattern and adds it to the pathMapper map.
      private void refresh()
      Check if configuration file has been updated, and if so, reload.
      private void storeDecorator​(Decorator d)
      Store Decorator in Map
      • Methods inherited from class java.lang.Object

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

      • decorators

        private java.util.Map decorators
      • configLastModified

        private long configLastModified
      • configFile

        private java.io.File configFile
      • configFileName

        private java.lang.String configFileName
      • config

        private Config config
    • Constructor Detail

      • ConfigLoader

        public ConfigLoader​(java.io.File configFile)
                     throws javax.servlet.ServletException
        Create new ConfigLoader using supplied File.
        Throws:
        javax.servlet.ServletException
      • ConfigLoader

        public ConfigLoader​(java.lang.String configFileName,
                            Config config)
                     throws javax.servlet.ServletException
        Create new ConfigLoader using supplied filename and config.
        Throws:
        javax.servlet.ServletException
    • Method Detail

      • getDecoratorByName

        public Decorator getDecoratorByName​(java.lang.String name)
                                     throws javax.servlet.ServletException
        Retrieve Decorator based on name specified in configuration file.
        Throws:
        javax.servlet.ServletException
      • getMappedName

        public java.lang.String getMappedName​(java.lang.String path)
                                       throws javax.servlet.ServletException
        Get name of Decorator mapped to given path.
        Throws:
        javax.servlet.ServletException
      • loadConfig

        private void loadConfig()
                         throws javax.servlet.ServletException
        Load configuration from file.
        Throws:
        javax.servlet.ServletException
      • parseConfig

        private void parseConfig​(org.w3c.dom.Document document)
        Parse configuration from XML document.
      • populatePathMapper

        private void populatePathMapper​(org.w3c.dom.NodeList patternNodes,
                                        java.lang.String role,
                                        java.lang.String name)
        Extracts each URL pattern and adds it to the pathMapper map.
      • getAttribute

        private static java.lang.String getAttribute​(org.w3c.dom.Element element,
                                                     java.lang.String name)
        Override default behavior of element.getAttribute (returns the empty string) to return null.
      • getContainedText

        private static java.lang.String getContainedText​(org.w3c.dom.Node parent,
                                                         java.lang.String childTagName)
        With a given parent XML Element, find the text contents of the child element with supplied name.
      • storeDecorator

        private void storeDecorator​(Decorator d)
        Store Decorator in Map
      • refresh

        private void refresh()
                      throws javax.servlet.ServletException
        Check if configuration file has been updated, and if so, reload.
        Throws:
        javax.servlet.ServletException