Class ApplicationParameters

  • All Implemented Interfaces:
    ConfigurationElement, ConfigurationFile, java.lang.Cloneable

    public class ApplicationParameters
    extends AbstractConfigurationElement
    This class represents the application parameters, typically configured through the "microstrategy.xml" file. This element has two children:
    • global: refers to parameters that apply to all controllers.
    • controllers: a list of parameters that are specific to a single controller.
    The getParameter(java.lang.String, java.lang.String) method therefore receives two arguments, the name of the parameter and the name of the controller. If a parameter was specified for the given controller, it returns that value; otherwise if the parameter was specified globally, it returns that value; if the parameter is not found it returns null. To provide backwards compability, if the "web.xml" is found inside the WEB-INF/ folder, this class will also parse this file and use the init-parameters and context-parameters of this file. This behavior can be turned off by passing false in the constructor.
    MicroStrategy Web 9.0.0
    • Field Detail


        public static final java.lang.String STYLE_CATALOG_PATH
        Constant for the parameter's name that identifies the style-catalog file location.
        See Also:
        Constant Field Values

        public static final java.lang.String CONFIG_FILE_PATH
        Constant for the parameter's name that identifies the page-config file location.
        See Also:
        Constant Field Values

        public static final java.lang.String EVENTS_PATH
        Constant for the parameter's name that identifies the events file location.
        See Also:
        Constant Field Values
      • DTD_PATH

        public static final java.lang.String DTD_PATH
        Constant for the parameter's name that identifies the dtd files location.
        See Also:
        Constant Field Values

        public static final java.lang.String CONFIG_FILES_DEFAULT_LOCATION
        Constant for the parameter's name that identifies the default configuration files location.
        See Also:
        Constant Field Values

        public static final java.lang.String LOCALES_CONFIG_PATH
        Constant for the parameter's name that identifies the locales.xml file location.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ApplicationParameters

        public ApplicationParameters()
      • ApplicationParameters

        public ApplicationParameters​(boolean useWebXmlParameters)
        Createa a new instance and indicates whether to use parameters defined in /WEB-INF/web.xml
    • Method Detail

      • getKeyAttribute

        protected java.lang.String getKeyAttribute()
        Description copied from class: AbstractConfigurationElement
        This method must return the attribute that uniquely identifies this element among its siblings; if no single attribute can be used, return null and override the getKey and setKey methods.
        Specified by:
        getKeyAttribute in class AbstractConfigurationElement
      • useWebXml

        public boolean useWebXml()
        Returns true is this class will return values from the web.xml.
      • getParameter

        public java.lang.String getParameter​(java.lang.String parameterName,
                                             java.lang.String controllerName)
        Returns the value of the given parameter.
        If a controllername is specified, it first checks if the parameter is defined for this controller, if not it will return the value is defined for the global parameters. If the parameter is not defined at either level (controller or global), it returns null.
      • getParameterNames

        public java.util.Enumeration getParameterNames​(java.lang.String controllerName)
        Returns the complete list of parameters names for the given controller. The list also includes global parameters.
      • getGlobalParameters

        public ParameterInfoList getGlobalParameters()
        Returns the list of global parameters, i.e. parameters that apply to all controllers.
      • getControllers

        public ControllerInfoList getControllers()
        Returns the list of controllers as defined in the xml file.
      • getDTDsBasePath

        public java.lang.String getDTDsBasePath()
        Returns the path to the folder where system dtd files, used to validate xml files, is located. It's equivalent to:
        getParameter(DTD_PATH, null);
      • getLocalesConfigPath

        public java.lang.String getLocalesConfigPath()
        Returns the path for the locales.xml file. It's equivalent to:
        getConfigFilePath(LOCALES_CONFIG_PATH, null);
      • getStyleCatalogPath

        public java.lang.String getStyleCatalogPath()
        Returns the path for the styleCatalog file. It's equivalent to:
        getConfigFilePath(STYLE_CATALOG_PATH, null);
      • getPageConfigPath

        public java.lang.String getPageConfigPath​(java.lang.String controllerName)
        Returns the path for the pageConfig file used by the given controller. It's equivalent to:
        getConfigFilePath(CONFIG_FILE_PATH, controllerName);
      • getEventsCatalogPath

        public java.lang.String getEventsCatalogPath()
        Returns the path for the events.xml file. It's equivalent to:
        getConfigFilePath(EVENTS_PATH, null);
      • resolveConfigFilePath

        public java.lang.String resolveConfigFilePath​(java.lang.String parameterName,
                                                      java.lang.String controllerName)
        It reads the value of the given parameter in the given controller, and if necessary it prefixes it with the config files base folder location. The following rules are applied:
        1. if the parameter value is empty, null is returned.
        2. if the parameter value starts with a slash (either forward "\" or backward "/"), the prefix FileLoader.RELATIVE_PREFIX, or the prefix FileLoader.ABSOLUTE_PREFIX, the parameter value is returned as is.
        3. otherwise, it returns the concatenation of the getConfigFilesBaseFolder(java.lang.String) value and the parameter value.
      • getConfigFilesBaseFolder

        protected java.lang.String getConfigFilesBaseFolder​(java.lang.String controllerName)
        Returns the default location of configuration files based on the CONFIG_FILES_DEFAULT_LOCATION parameter value. If the parameter is empty, it returns the root folder "/".
      • initFromWebXML

        public void initFromWebXML​(java.lang.String webXmlPath)
                            throws ConfigException
        Parses the web.xml for context-param and init-parameters.
      • saveWebXMLAs

        public void saveWebXMLAs​(java.lang.String newLocation)
                          throws ConfigException
        This method saves the parameters found in the web.xml file into the given path using the new xml structure. It's only intended to use for upgrading from the old xml structure to the current.