Class Factories

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.util.Hashtable<java.lang.String,​Factories> classMap
      Tags / class mapping
      static java.util.Hashtable<java.lang.String,​java.lang.String> implMap
      Hashtable containig the mapping between the XML tag names and the corresponding factory classes.
      static java.lang.String INHERIT_TAG
      General tag - "InheritFrom"
      static Log logger
      Logger
      static java.lang.String MOD_TS_TAG
      Modification time stamp
      static java.lang.String NAME_ATTRIBUTE
      General attribute - "name"
      static java.lang.String NAME_TAG
      General tag - "Name"
      static java.lang.String NULLBEHAVIOR
      General attribute - "NullBehavior"
      static java.lang.String NULLBEHAVIORVALUE
      General attribute - "NullBehaviorValue"
      static java.lang.String NULLDEFINITION
      General attribute - "NullDefinition"
      static java.lang.String NULLDEFINITIONVALUE
      General attribute - "NullDefinitionValue"
      static java.lang.String PARAMETER_TAG
      General tag - "parameter"
      Factories parent
      Parent of this factory.
      static java.lang.String USER_COMMENT_ATTRIBUTE
      General attribute - "UserComment"
      static java.lang.String VALUE_ATTRIBUTE
      General attribute - "value"
    • Constructor Summary

      Constructors 
      Constructor Description
      Factories()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void build​(BaseConfiguration config, org.w3c.dom.Element element)
      Generate a XML element from a configuration object.
      static void debug​(java.lang.String msg)
      Prints debug message.
      static void dump​(BaseConfiguration config)
      List information for this factory.
      void getBaseName​(BaseConfiguration config, org.w3c.dom.Element elem)
      This method retries the name and inheritFrom attributes/elements and configures the base object with its name and also calls MetamergeConfig for any inherited objects.
      static java.lang.String getClassTag​(java.lang.Object config)  
      static Factories getFactory​(java.lang.String tag)  
      static BaseConfiguration getImpl​(java.lang.String tag)  
      void getInheritsFrom​(BaseConfiguration config, org.w3c.dom.Element elem)
      This method retries the inheritsFrom element and configures the base object with the retrieved information.
      java.lang.String getNodeText​(org.w3c.dom.Node node)  
      java.lang.String getNodeTextByName​(org.w3c.dom.Element node, java.lang.String name)  
      void getParameter​(org.w3c.dom.Element p, BaseConfiguration config)
      Add simple parameter to configuration.
      void getParameters​(org.w3c.dom.Element p, BaseConfiguration config)
      Add simple parameters to configuration.
      org.w3c.dom.Element getSingleElement​(org.w3c.dom.Element node, java.lang.String name)  
      static boolean isDebugMode()  
      static void logmsg​(java.lang.String msg)
      Logs message.
      void parse​(BaseConfiguration config, org.w3c.dom.Element element)
      Parse a XML element into a configuration object.
      void setBaseName​(BaseConfiguration config, org.w3c.dom.Element elem)
      Attaches to the XML tree a single element representing the user comment.
      void setInheritsFrom​(BaseConfiguration config, org.w3c.dom.Element elem)
      Set the inheritFrom if it exists.
      void setParameter​(org.w3c.dom.Element p, BaseConfiguration config, java.lang.Object pname)
      Generates XML element for parameter, initialize it and attach it to the p object.
      org.w3c.dom.Element setParameters​(org.w3c.dom.Element p, BaseConfiguration config, java.lang.String tag)  
      void setSingleElement​(org.w3c.dom.Element node, java.lang.String tag, BaseConfiguration bc, java.lang.String name)
      Sets a simple tag/value.
      void setSingleElement​(org.w3c.dom.Element node, java.lang.String tag, java.lang.String value)
      Sets a simple tag/value.
      • Methods inherited from class java.lang.Object

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

      • logger

        public static final Log logger
        Logger
      • classMap

        public static final java.util.Hashtable<java.lang.String,​Factories> classMap
        Tags / class mapping
      • implMap

        public static final java.util.Hashtable<java.lang.String,​java.lang.String> implMap
        Hashtable containig the mapping between the XML tag names and the corresponding factory classes.
      • PARAMETER_TAG

        public static final java.lang.String PARAMETER_TAG
        General tag - "parameter"
        See Also:
        Constant Field Values
      • NAME_TAG

        public static final java.lang.String NAME_TAG
        General tag - "Name"
        See Also:
        Constant Field Values
      • INHERIT_TAG

        public static final java.lang.String INHERIT_TAG
        General tag - "InheritFrom"
        See Also:
        Constant Field Values
      • NAME_ATTRIBUTE

        public static final java.lang.String NAME_ATTRIBUTE
        General attribute - "name"
        See Also:
        Constant Field Values
      • VALUE_ATTRIBUTE

        public static final java.lang.String VALUE_ATTRIBUTE
        General attribute - "value"
        See Also:
        Constant Field Values
      • USER_COMMENT_ATTRIBUTE

        public static final java.lang.String USER_COMMENT_ATTRIBUTE
        General attribute - "UserComment"
        See Also:
        Constant Field Values
      • NULLBEHAVIOR

        public static final java.lang.String NULLBEHAVIOR
        General attribute - "NullBehavior"
        See Also:
        Constant Field Values
      • NULLBEHAVIORVALUE

        public static final java.lang.String NULLBEHAVIORVALUE
        General attribute - "NullBehaviorValue"
        See Also:
        Constant Field Values
      • NULLDEFINITION

        public static final java.lang.String NULLDEFINITION
        General attribute - "NullDefinition"
        See Also:
        Constant Field Values
      • NULLDEFINITIONVALUE

        public static final java.lang.String NULLDEFINITIONVALUE
        General attribute - "NullDefinitionValue"
        See Also:
        Constant Field Values
      • MOD_TS_TAG

        public static final java.lang.String MOD_TS_TAG
        Modification time stamp
        See Also:
        Constant Field Values
      • parent

        public Factories parent
        Parent of this factory.
    • Constructor Detail

      • Factories

        public Factories()
    • Method Detail

      • getFactory

        public static Factories getFactory​(java.lang.String tag)
                                    throws java.lang.Exception
        Parameters:
        tag - XML tag name
        Returns:
        factory for the specified XML element
        Throws:
        java.lang.Exception - no mapping for such XML tag exist
      • getImpl

        public static BaseConfiguration getImpl​(java.lang.String tag)
                                         throws java.lang.Exception
        Parameters:
        tag - XML tag name
        Returns:
        new instance of configuration implementation
        Throws:
        java.lang.Exception - no mapping for such XML tag exist
      • getClassTag

        public static java.lang.String getClassTag​(java.lang.Object config)
        Parameters:
        config - Factory object
        Returns:
        XML tag name used for the specified class
      • isDebugMode

        public static boolean isDebugMode()
        Returns:
        true if debug is enabled. Otherwise, false is returned.
      • parse

        public void parse​(BaseConfiguration config,
                          org.w3c.dom.Element element)
                   throws java.lang.Exception
        Parse a XML element into a configuration object.
        Parameters:
        config - an instance of the BaseConfiguration class which internal parameters will get set based on the information from the provided XML Element.
        element - this is a part of the XML tree that represents the BaseConfiguration object.
        Throws:
        java.lang.Exception - in case the configuration object the provided XML element represents is not recognized.
      • build

        public void build​(BaseConfiguration config,
                          org.w3c.dom.Element element)
                   throws java.lang.Exception
        Generate a XML element from a configuration object.
        Parameters:
        config - an instance of the BaseConfiguration class which internal parameters will be represented as a XML sub-tree.
        element - this is the part of the XML tree where the config object's XML representation will be attached to.
        Throws:
        java.lang.Exception - in case the tag name of the provided XML element is not recognized as a valid name which is used for configuration object representation as a XML.
      • debug

        public static void debug​(java.lang.String msg)
        Prints debug message.
        Parameters:
        msg - text of the message
      • logmsg

        public static void logmsg​(java.lang.String msg)
        Logs message.
        Parameters:
        msg - text of the message.
      • dump

        public static void dump​(BaseConfiguration config)
        List information for this factory.
        Parameters:
        config - configuration object
      • getBaseName

        public void getBaseName​(BaseConfiguration config,
                                org.w3c.dom.Element elem)
                         throws java.lang.Exception
        This method retries the name and inheritFrom attributes/elements and configures the base object with its name and also calls MetamergeConfig for any inherited objects.
        Parameters:
        config - an instance of the BaseConfiguration class which internal parameters will get set based on the information from the provided XML Element.
        elem - this is a part of the XML tree that represents the BaseConfiguration object.
        Throws:
        java.lang.Exception - if could not return text from node's children
      • getInheritsFrom

        public void getInheritsFrom​(BaseConfiguration config,
                                    org.w3c.dom.Element elem)
                             throws java.lang.Exception
        This method retries the inheritsFrom element and configures the base object with the retrieved information.
        Parameters:
        config - an instance of the BaseConfiguration class which internal parameters will get set based on the information from the provided XML Element.
        elem - this is a part of the XML tree that represents the BaseConfiguration object.
        Throws:
        java.lang.Exception - if could not return text from node's children
      • setBaseName

        public void setBaseName​(BaseConfiguration config,
                                org.w3c.dom.Element elem)
                         throws java.lang.Exception
        Attaches to the XML tree a single element representing the user comment.
        Parameters:
        config - an instance of the BaseConfiguration class which internal parameters will get set based on the information from the provided XML Element.
        elem - this is the part of the XML tree where the config object's XML representation will be attached to.
        Throws:
        java.lang.Exception - if could not return text from node's children
      • setInheritsFrom

        public void setInheritsFrom​(BaseConfiguration config,
                                    org.w3c.dom.Element elem)
                             throws java.lang.Exception
        Set the inheritFrom if it exists.
        Parameters:
        config - an instance of the BaseConfiguration class which internal parameters will get set based on the information from the provided XML Element.
        elem - this is the part of the XML tree where the config object's XML representation will be attached to.
        Throws:
        java.lang.Exception
      • getParameters

        public void getParameters​(org.w3c.dom.Element p,
                                  BaseConfiguration config)
                           throws java.lang.Exception
        Add simple parameters to configuration.
        Parameters:
        p - this is a part of the XML tree that represents the BaseConfiguration object.
        config - an instance of the BaseConfiguration class
        Throws:
        java.lang.Exception
      • getParameter

        public void getParameter​(org.w3c.dom.Element p,
                                 BaseConfiguration config)
                          throws java.lang.Exception
        Add simple parameter to configuration.
        Parameters:
        p - this is a part of the XML tree that represents the BaseConfiguration object.
        config - an instance of the BaseConfiguration class
        Throws:
        java.lang.Exception
      • setParameters

        public org.w3c.dom.Element setParameters​(org.w3c.dom.Element p,
                                                 BaseConfiguration config,
                                                 java.lang.String tag)
                                          throws java.lang.Exception
        Parameters:
        config - an instance of the BaseConfiguration class which internal parameters will get set based on the information from the provided XML Element.
        p - this is the part of the XML tree where the config object's XML representation will be attached to.
        tag - XML tag name to be created
        Returns:
        Element containing the simple parameters
        Throws:
        java.lang.Exception
      • setParameter

        public void setParameter​(org.w3c.dom.Element p,
                                 BaseConfiguration config,
                                 java.lang.Object pname)
                          throws java.lang.Exception
        Generates XML element for parameter, initialize it and attach it to the p object.
        Parameters:
        config - an instance of the BaseConfiguration class which internal parameters will get set based on the information from the provided XML Element.
        p - this is the part of the XML tree where the config object's XML representation will be attached to.
        pname -
        Throws:
        java.lang.Exception
      • getNodeText

        public java.lang.String getNodeText​(org.w3c.dom.Node node)
                                     throws java.lang.Exception
        Parameters:
        node - Node object
        Returns:
        text from a node's children
        Throws:
        java.lang.Exception
      • getSingleElement

        public org.w3c.dom.Element getSingleElement​(org.w3c.dom.Element node,
                                                    java.lang.String name)
                                             throws java.lang.Exception
        Parameters:
        node - Node object
        name - name to locate
        Returns:
        a single Element from a node's children
        Throws:
        java.lang.Exception
      • getNodeTextByName

        public java.lang.String getNodeTextByName​(org.w3c.dom.Element node,
                                                  java.lang.String name)
                                           throws java.lang.Exception
        Parameters:
        node - Node object
        name - child name
        Returns:
        text from a single named node's children
        Throws:
        java.lang.Exception
      • setSingleElement

        public void setSingleElement​(org.w3c.dom.Element node,
                                     java.lang.String tag,
                                     BaseConfiguration bc,
                                     java.lang.String name)
                              throws java.lang.Exception
        Sets a simple tag/value.
        Parameters:
        node - Node object
        tag - XML tag name
        bc - BaseConfiguration object
        name - name of the single Element
        Throws:
        java.lang.Exception
      • setSingleElement

        public void setSingleElement​(org.w3c.dom.Element node,
                                     java.lang.String tag,
                                     java.lang.String value)
                              throws java.lang.Exception
        Sets a simple tag/value.
        Parameters:
        node - Node object
        tag - XML tag name
        value - text node value
        Throws:
        java.lang.Exception