Class AbstractModule

    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      boolean canChangeEnabled()
      Default implementation, returns true.
      protected java.lang.String getRelativePath​(java.lang.String baseDir, java.io.File file)
      Helper method that calculates the relative path of file, based on the given baseDir.
      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
    • 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 interface UpgradeModule
      • 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 the UpgradeModule.canChangeEnabled() return true, otherwise it will throw an IllegalArgumentException
        Specified by:
        setEnabled in interface UpgradeModule
      • canChangeEnabled

        public boolean canChangeEnabled()
        Default implementation, returns true.
        Specified by:
        canChangeEnabled in interface UpgradeModule
      • 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 file, based on the given baseDir. Basically, it removes the baseDir from the file's absolute path.

        If file is not within baseDir (i.e. file's absolutePath doesn't start with baseDir it throws an IllegalArgumentException
        Throws:
        java.lang.IllegalArgumentException