public class

ApplicationParameters

extends AbstractConfigurationElement
java.lang.Object
   ↳ com.microstrategy.utils.config.AbstractConfigurationElement
     ↳ com.microstrategy.web.platform.ApplicationParameters

Class Overview

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(String, 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.

Summary

Constants
String CONFIG_FILES_DEFAULT_LOCATION Constant for the parameter's name that identifies the default configuration files location.
String CONFIG_FILE_PATH Constant for the parameter's name that identifies the page-config file location.
String DTD_PATH Constant for the parameter's name that identifies the dtd files location.
String EVENTS_PATH Constant for the parameter's name that identifies the events file location.
String GLOBAL_NODE
String LOCALES_CONFIG_PATH Constant for the parameter's name that identifies the locales.xml file location.
String NODE_NAME
String STYLE_CATALOG_PATH Constant for the parameter's name that identifies the style-catalog file location.
[Expand]
Inherited Constants
From class com.microstrategy.utils.config.AbstractConfigurationElement
Public Constructors
ApplicationParameters()
ApplicationParameters(boolean useWebXmlParameters)
Createa a new instance and indicates whether to use parameters defined in /WEB-INF/web.xml
Public Methods
ControllerInfoList getControllers()
Returns the list of controllers as defined in the xml file.
String getDTDsBasePath()
Returns the path to the folder where system dtd files, used to validate xml files, is located.
String getEventsCatalogPath()
Returns the path for the events.xml file.
ParameterInfoList getGlobalParameters()
Returns the list of global parameters, i.e.
String getLocalesConfigPath()
Returns the path for the locales.xml file.
String getPageConfigPath(String controllerName)
Returns the path for the pageConfig file used by the given controller.
String getParameter(String parameterName, String controllerName)
Returns the value of the given parameter.
Enumeration getParameterNames(String controllerName)
Returns the complete list of parameters names for the given controller.
String getStyleCatalogPath()
Returns the path for the styleCatalog file.
void initFromWebXML(String webXmlPath)
Parses the web.xml for context-param and init-parameters.
void load(String fileName)
Extends load by making sure parameters of web.xml are also loaded if necessary.
String resolveConfigFilePath(String parameterName, 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.
void saveWebXMLAs(String newLocation)
This method saves the parameters found in the web.xml file into the given path using the new xml structure.
boolean useWebXml()
Returns true is this class will return values from the web.xml.
Protected Methods
String getConfigFilesBaseFolder(String controllerName)
Returns the default location of configuration files based on the CONFIG_FILES_DEFAULT_LOCATION parameter value.
String getKeyAttribute()
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.
void initFromFile(String filePath, CustomizationInfo c)
Extends initFromFile by checking if the path is for the web.xml, if so, it calls initFromWebXML, as parsing this file is different from the current implementation.
[Expand]
Inherited Methods
From class com.microstrategy.utils.config.AbstractConfigurationElement
From class java.lang.Object
From interface com.microstrategy.utils.config.ConfigurationElement
From interface com.microstrategy.utils.config.ConfigurationFile

Constants

public static final String CONFIG_FILES_DEFAULT_LOCATION

Constant for the parameter's name that identifies the default configuration files location.

Constant Value: "serverConfigFilesDefaultLocation"

public static final String CONFIG_FILE_PATH

Constant for the parameter's name that identifies the page-config file location.

Constant Value: "configFile"

public static final String DTD_PATH

Constant for the parameter's name that identifies the dtd files location.

Constant Value: "dtdLocation"

public static final String EVENTS_PATH

Constant for the parameter's name that identifies the events file location.

Constant Value: "eventsFile"

public static final String GLOBAL_NODE

Constant Value: "global"

public static final String LOCALES_CONFIG_PATH

Constant for the parameter's name that identifies the locales.xml file location.

Constant Value: "localesFile"

public static final String NODE_NAME

Constant Value: "application"

public static final String STYLE_CATALOG_PATH

Constant for the parameter's name that identifies the style-catalog file location.

Constant Value: "styleCatalogFile"

Public Constructors

public ApplicationParameters ()

public ApplicationParameters (boolean useWebXmlParameters)

Createa a new instance and indicates whether to use parameters defined in /WEB-INF/web.xml

Public Methods

public ControllerInfoList getControllers ()

Returns the list of controllers as defined in the xml file.

public 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);

public String getEventsCatalogPath ()

Returns the path for the events.xml file. It's equivalent to:

getConfigFilePath(EVENTS_PATH, null);

public ParameterInfoList getGlobalParameters ()

Returns the list of global parameters, i.e. parameters that apply to all controllers.

public String getLocalesConfigPath ()

Returns the path for the locales.xml file. It's equivalent to:

getConfigFilePath(LOCALES_CONFIG_PATH, null);

public String getPageConfigPath (String controllerName)

Returns the path for the pageConfig file used by the given controller. It's equivalent to:

getConfigFilePath(CONFIG_FILE_PATH, controllerName);

public String getParameter (String parameterName, 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.

public Enumeration getParameterNames (String controllerName)

Returns the complete list of parameters names for the given controller. The list also includes global parameters.

public String getStyleCatalogPath ()

Returns the path for the styleCatalog file. It's equivalent to:

getConfigFilePath(STYLE_CATALOG_PATH, null);

public void initFromWebXML (String webXmlPath)

Parses the web.xml for context-param and init-parameters.

public void load (String fileName)

Extends load by making sure parameters of web.xml are also loaded if necessary.

Parameters
fileName The path to the configuration file. This path will be resolved by the FileLoader

public String resolveConfigFilePath (String parameterName, 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 RELATIVE_PREFIX, or the prefix ABSOLUTE_PREFIX, the parameter value is returned as is.
  3. otherwise, it returns the concatenation of the getConfigFilesBaseFolder(String) value and the parameter value.

public void saveWebXMLAs (String newLocation)

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.

public boolean useWebXml ()

Returns true is this class will return values from the web.xml.

Protected Methods

protected String getConfigFilesBaseFolder (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 "/".

protected String getKeyAttribute ()

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.

protected void initFromFile (String filePath, CustomizationInfo c)

Extends initFromFile by checking if the path is for the web.xml, if so, it calls initFromWebXML, as parsing this file is different from the current implementation.