Class AbstractModule
- java.lang.Object
-
- com.microstrategy.web.app.utils.upgrade.AbstractModule
-
- All Implemented Interfaces:
UpgradeModule
- Direct Known Subclasses:
AbstractXMLConfigModule
,CleanUpModule
,CopyFilesModule
,EventsModule
,GenericFileModule
,PropertiesModule
,WebXMLModule
public abstract class AbstractModule extends java.lang.Object implements UpgradeModule
This is the based implementation of anUpgradeModule
. It implements the logic to enabled/disabled the module. It also defines an abstractrun(com.microstrategy.web.app.utils.upgrade.UpgradeInfo)
method that is used to trigger the module's execution.- Since:
- MicroStrategy Web 9.0.0
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractModule(UpgradeManager manager)
Default constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
canChangeEnabled()
Default implementation, returnstrue
.protected java.lang.String
getRelativePath(java.lang.String baseDir, java.io.File file)
Helper method that calculates the relative path offile
, based on the givenbaseDir
.protected UpgradeManager
getUpgradeManager()
Returns the UpgradeManager that created this AbstractModule instance.boolean
isEnabled()
Whether the module is enabled.abstract void
run(UpgradeInfo info)
Method triggered to execute the module's upgrade tasks.void
setEnabled(boolean value)
Method to change the enabled status of the module.-
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
-
AbstractModule
protected AbstractModule(UpgradeManager manager)
Default constructor. Receives the UpgradeManager instantiating this AbstractModule.
-
-
Method Detail
-
run
public abstract void run(UpgradeInfo info) throws UpgradeException
Method triggered to execute the module's upgrade tasks.- Parameters:
info
- upgrade information.- Throws:
UpgradeException
- when an unexpected error that prevents the module to cotinue occurs. Other errors should simply be logged.
-
getUpgradeManager
protected UpgradeManager getUpgradeManager()
Returns the UpgradeManager that created this AbstractModule instance.
-
isEnabled
public boolean isEnabled()
Description copied from interface:UpgradeModule
Whether the module is enabled. If not enabled, the module will not be executed during the upgrade.- Specified by:
isEnabled
in interfaceUpgradeModule
-
setEnabled
public void setEnabled(boolean value)
Description copied from interface:UpgradeModule
Method to change the enabled status of the module. This method can only be invoked if theUpgradeModule.canChangeEnabled()
returntrue
, otherwise it will throw an IllegalArgumentException- Specified by:
setEnabled
in interfaceUpgradeModule
-
canChangeEnabled
public boolean canChangeEnabled()
Default implementation, returnstrue
.- Specified by:
canChangeEnabled
in interfaceUpgradeModule
-
getRelativePath
protected java.lang.String getRelativePath(java.lang.String baseDir, java.io.File file) throws java.lang.IllegalArgumentException
Helper method that calculates the relative path of
Iffile
, based on the givenbaseDir
. Basically, it removes thebaseDir
from the file's absolute path.file
is not withinbaseDir
(i.e. file's absolutePath doesn't start withbaseDir
it throws an IllegalArgumentException- Throws:
java.lang.IllegalArgumentException
-
-