Class AbstractXMLConfigModule
- java.lang.Object
-
- com.microstrategy.web.app.utils.upgrade.AbstractModule
-
- com.microstrategy.web.app.utils.upgrade.AbstractXMLConfigModule
-
- All Implemented Interfaces:
UpgradeModule
- Direct Known Subclasses:
LocalesModule
,PageConfigsModule
,StyleCatalogModule
public abstract class AbstractXMLConfigModule extends AbstractModule
Extends
AbstractModule
by providing specific support to upgrade xml configuration files. This files have to use the AbstractConfigurationElement to parse the file's content in order to be upgraded by this class.Running this module involves three main tasks:
- Calculate deltas: Loads the base xml definition, and the customized xml definition and calculates differences.
- Process deltas: If necessary the module can read through the differences and do further changes to ensure the new xml will follow new best practices.
- Save deltas: Once deltas have been calculated and process, they will be saved as part of a plugin
The location of all xml configuration files is specified through a parameter in the web.xml, subclasses need to implement
initParameterName()
to identify the name of such parameter.- Since:
- MicroStrategy Web 9.0.0
-
-
Constructor Summary
Constructors Constructor Description AbstractXMLConfigModule(UpgradeManager manager)
Default constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected AbstractConfigurationElement
calculateDeltas(AbstractConfigurationElement base, AbstractConfigurationElement custom)
Calculate deltas between the base and the custom element.protected java.lang.String
calculateNewPath(java.lang.String path, java.lang.String newRelativePath)
Returns the new relative path for the given file, as should be defined in Microstrategy Web.protected abstract java.lang.Class
elementClass()
Subclasses must implement this method to identify the AbstractConfigurationElement class that represents the root node of the xml.protected AbstractConfigurationElement
getBaseElement(java.lang.String controllerName)
Returns the AbstractConfigurationElement as defined in the base Microstrategy Web installation.protected AbstractConfigurationElement
getCustomElement(java.lang.String controllerName)
Returns the AbstractConfigurationElement as defined in the customized Microstrategy Web version.protected UpgradeInfo
getUpgradeInfo()
protected abstract java.lang.String
initParameterName()
Subclasses must implement this method to identify the name of the init-parameter that defines the location of the xml configuration file.protected void
processConfigFile(java.lang.String controllerName)
Process the configuration file for the givencontrollerName
.protected AbstractConfigurationElement
processDeltas(AbstractConfigurationElement deltas)
Modifies deltas so in the new plugin they reflect Microstrategy's recommended best practices.void
run(UpgradeInfo info)
It checks in the target application for the value of theinitParameterName()
to see if it's defined (globally and on every controller); whenever the value is defined, it callsprocessConfigFile(java.lang.String)
to process the correspoding configuration file.protected AbstractConfigurationElement
saveDeltas(AbstractConfigurationElement deltas)
Saves deltas into the plugin folder.-
Methods inherited from class com.microstrategy.web.app.utils.upgrade.AbstractModule
canChangeEnabled, getRelativePath, getUpgradeManager, isEnabled, setEnabled
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.microstrategy.web.app.utils.upgrade.UpgradeModule
getDescription, getName
-
-
-
-
Constructor Detail
-
AbstractXMLConfigModule
public AbstractXMLConfigModule(UpgradeManager manager)
Default constructor. Receives the UpgradeManager instantiating this AbstractModule.
-
-
Method Detail
-
run
public void run(UpgradeInfo info) throws UpgradeException
It checks in the target application for the value of theinitParameterName()
to see if it's defined (globally and on every controller); whenever the value is defined, it callsprocessConfigFile(java.lang.String)
to process the correspoding configuration file.- Specified by:
run
in classAbstractModule
- Parameters:
info
- upgrade information.- Throws:
UpgradeException
- when an unexpected error that prevents the module to cotinue occurs. Other errors should simply be logged.
-
processConfigFile
protected void processConfigFile(java.lang.String controllerName) throws UpgradeException
Process the configuration file for the givencontrollerName
. It calculate deltas from the base-element and the custom-element (as specified by the parameter value for this controller), modifies the deltas as necessary and then saves them in the corresponding plugin folder. If both elements are equal, it returns with no further changes.- Throws:
UpgradeException
-
getUpgradeInfo
protected UpgradeInfo getUpgradeInfo()
-
calculateDeltas
protected AbstractConfigurationElement calculateDeltas(AbstractConfigurationElement base, AbstractConfigurationElement custom) throws UpgradeException
Calculate deltas between the base and the custom element. If equals, it returns null;- Throws:
UpgradeException
-
processDeltas
protected AbstractConfigurationElement processDeltas(AbstractConfigurationElement deltas)
Modifies deltas so in the new plugin they reflect Microstrategy's recommended best practices.
-
saveDeltas
protected AbstractConfigurationElement saveDeltas(AbstractConfigurationElement deltas) throws UpgradeException
Saves deltas into the plugin folder.- Throws:
UpgradeException
-
getBaseElement
protected AbstractConfigurationElement getBaseElement(java.lang.String controllerName) throws ConfigException
Returns the AbstractConfigurationElement as defined in the base Microstrategy Web installation. Returns an empty object if the parameter is not defined in the base Microstrategy Web version.- Throws:
ConfigException
-
getCustomElement
protected AbstractConfigurationElement getCustomElement(java.lang.String controllerName) throws ConfigException
Returns the AbstractConfigurationElement as defined in the customized Microstrategy Web version. Returns an empty object if the parameter is not defined in this version.- Throws:
ConfigException
-
calculateNewPath
protected java.lang.String calculateNewPath(java.lang.String path, java.lang.String newRelativePath)
Returns the new relative path for the given file, as should be defined in Microstrategy Web. This file is also marked as processed in the upgrade-manager so it gets copied to the correct new relative location when copying files.- Parameters:
path
- The path of the file being processed. This path needs to point to an existing file.newRelativePath
- The path relative to the customization's root folder where the file will be placed when upgrade is complete- Returns:
- a relative path that locates the file within Microstrategy Web in the target plugin folder.
-
elementClass
protected abstract java.lang.Class elementClass()
Subclasses must implement this method to identify the AbstractConfigurationElement class that represents the root node of the xml.
-
initParameterName
protected abstract java.lang.String initParameterName()
Subclasses must implement this method to identify the name of the init-parameter that defines the location of the xml configuration file.
-
-