Package com.microstrategy.web.platform
Class ApplicationParameters
- java.lang.Object
-
- com.microstrategy.utils.config.AbstractConfigurationElement
-
- com.microstrategy.web.platform.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.
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 passingfalse
in the constructor.- Since:
- MicroStrategy Web 9.0.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.microstrategy.utils.config.AbstractConfigurationElement
AbstractConfigurationElement.FilteredList
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CONFIG_FILE_PATH
Constant for the parameter's name that identifies the page-config file location.static java.lang.String
CONFIG_FILES_DEFAULT_LOCATION
Constant for the parameter's name that identifies the default configuration files location.static java.lang.String
DTD_PATH
Constant for the parameter's name that identifies the dtd files location.static java.lang.String
EVENTS_PATH
Constant for the parameter's name that identifies the events file location.static java.lang.String
GLOBAL_NODE
static java.lang.String
LOCALES_CONFIG_PATH
Constant for the parameter's name that identifies the locales.xml file location.static java.lang.String
NODE_NAME
static java.lang.String
STYLE_CATALOG_PATH
Constant for the parameter's name that identifies the style-catalog file location.-
Fields inherited from class com.microstrategy.utils.config.AbstractConfigurationElement
ATT_CONFIG_SRC, ATT_DELETED, ATT_POSITION, ATT_PROTOTYPE, ATT_USE_DEFAULT
-
-
Constructor Summary
Constructors Constructor Description ApplicationParameters()
ApplicationParameters(boolean useWebXmlParameters)
Createa a new instance and indicates whether to use parameters defined in /WEB-INF/web.xml
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
getConfigFilesBaseFolder(java.lang.String controllerName)
Returns the default location of configuration files based on theCONFIG_FILES_DEFAULT_LOCATION
parameter value.ControllerInfoList
getControllers()
Returns the list of controllers as defined in the xml file.java.lang.String
getDTDsBasePath()
Returns the path to the folder where system dtd files, used to validate xml files, is located.java.lang.String
getEventsCatalogPath()
Returns the path for the events.xml file.ParameterInfoList
getGlobalParameters()
Returns the list of global parameters, i.e.protected java.lang.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 thegetKey
andsetKey
methods.java.lang.String
getLocalesConfigPath()
Returns the path for the locales.xml file.java.lang.String
getPageConfigPath(java.lang.String controllerName)
Returns the path for the pageConfig file used by the given controller.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.java.util.Enumeration
getParameterNames(java.lang.String controllerName)
Returns the complete list of parameters names for the given controller.java.lang.String
getStyleCatalogPath()
Returns the path for the styleCatalog file.protected void
initFromFile(java.lang.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.void
initFromWebXML(java.lang.String webXmlPath)
Parses the web.xml for context-param and init-parameters.void
load(java.lang.String fileName)
Extends load by making sure parameters of web.xml are also loaded if necessary.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.void
saveWebXMLAs(java.lang.String newLocation)
This method saves the parameters found in the web.xml file into the given path using the new xml structure.boolean
useWebXml()
Returnstrue
is this class will return values from the web.xml.-
Methods inherited from class com.microstrategy.utils.config.AbstractConfigurationElement
addFileSource, applyCustomization, applyCustomizations, cleanUpDeletedElements, clone, delete, deltas, deltas, equalAtts, equalElements, equalNodeValues, equals, equalsIncludingDeletedElements, exportAttributesToXML, exportElementsToXML, exportNodeValueToXML, getAttribute, getAttributes, getBoolAttribute, getChildKey, getConfigSrc, getDTDFileName, getElement, getElement, getElements, getFileLoader, getIntAttribute, getIntAttribute, getKey, getLineNumber, getList, getNextKey, getNodeName, getNodeValue, getNodeValue, getOrCreateElement, getParent, getPosition, getPrototype, getRegisteredClass, getSelfInitPath, getSource, getStrAttribute, getUseDefault, getXMLParserParameters, getXMLSerializerParameters, hashCode, hashCodeAtts, hashCodeElements, hashCodeNodeValues, hasRegisteredClass, initAttributesFromXML, initDefaultAttributes, initElementFromXML, initElementsFromXML, initFromResource, initFromXML, initFromXML, initNodeValueFromXML, initPrototype, isActive, isCustomized, isDeleted, isDirty, isInSource, isKeyAttribute, mergeChanges, newChildInstance, newSource, original, populate, printAttributes, printElements, printNodeValue, refreshLists, registerClass, registerElement, registerElement, registerElementList, reload, reloadPrototype, removeAttribute, removeDefaults, replaceList, restore, save, save, saveChangesAs, saveConfig, saveFlatXML, saveNode, saveSource, setAttribute, setBoolAttribute, setChildOriginals, setConfigSrc, setCustomized, setElement, setFileLoader, setIntAttribute, setKey, setLineNumber, setNodeName, setNodeValue, setPosition, setPrototype, setSelfInitPath, setStrAttribute, setUseDefault, setUseValidation, throwConfigParseException, toString, toXML, toXML, toXML, toXML, useNodeValue, useValidation
-
-
-
-
Field Detail
-
NODE_NAME
public static final java.lang.String NODE_NAME
- See Also:
- Constant Field Values
-
GLOBAL_NODE
public static final java.lang.String GLOBAL_NODE
- See Also:
- Constant Field Values
-
STYLE_CATALOG_PATH
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
-
CONFIG_FILE_PATH
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
-
EVENTS_PATH
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
-
CONFIG_FILES_DEFAULT_LOCATION
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
-
LOCALES_CONFIG_PATH
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
-
-
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 thegetKey
andsetKey
methods.- Specified by:
getKeyAttribute
in classAbstractConfigurationElement
-
useWebXml
public boolean useWebXml()
Returnstrue
is this class will return values from the web.xml.
-
load
public void load(java.lang.String fileName) throws ConfigException
Extends load by making sure parameters of web.xml are also loaded if necessary.- Specified by:
load
in interfaceConfigurationFile
- Overrides:
load
in classAbstractConfigurationElement
- Parameters:
fileName
- The path to the configuration file. This path will be resolved by theFileLoader
- Throws:
ConfigException
-
initFromFile
protected void initFromFile(java.lang.String filePath, CustomizationInfo c) throws ConfigException
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.- Overrides:
initFromFile
in classAbstractConfigurationElement
- Throws:
ConfigException
-
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:- if the parameter value is empty,
null
is returned. - if the parameter value starts with a slash (either forward "\" or backward "/"),
the prefix
FileLoader.RELATIVE_PREFIX
, or the prefixFileLoader.ABSOLUTE_PREFIX
, the parameter value is returned as is. - otherwise, it returns the concatenation of the
getConfigFilesBaseFolder(java.lang.String)
value and the parameter value.
- if the parameter value is empty,
-
getConfigFilesBaseFolder
protected java.lang.String getConfigFilesBaseFolder(java.lang.String controllerName)
Returns the default location of configuration files based on theCONFIG_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.- Throws:
ConfigException
-
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.- Throws:
ConfigException
-
-