Class CmsUpdateBean

java.lang.Object
org.opencms.setup.CmsSetupBean
org.opencms.setup.CmsUpdateBean
All Implemented Interfaces:
org.opencms.main.I_CmsShellCommands

public class CmsUpdateBean extends CmsSetupBean
A java bean as a controller for the OpenCms update wizard.

Since:
6.0.0
  • Field Details

  • Constructor Details

  • Method Details

    • addSubscriptionDriver

      public void addSubscriptionDriver()
      Adds the subscription driver to the properties.

    • checkOceeVersion

      public boolean checkOceeVersion(String version)
      Compatibility check for OCEE modules.

      Parameters:
      version - the opencms version
      Returns:
      false if OCEE is present but not compatible with opencms version
    • createSharedFolder

      public void createSharedFolder() throws Exception
      Creates the shared folder if possible.

      Throws:
      Exception - if something goes wrong
    • deleteSpellcheckIndex

      public void deleteSpellcheckIndex()
      CmsShell command to delete spellcheck index.

      Called by cmsupdate.ori to remove spellcheck index. Necessary because Solr/Lucene versions might have incompatible changes, and deleting the index causes the spellcheck index to be rebuilt.

    • displayError

      public String displayError(String pathPrefix)
      Returns html code to display an error.

      Overrides:
      displayError in class CmsSetupBean
      Parameters:
      pathPrefix - to adjust the path
      Returns:
      html code
    • getAdminPwd

      public String getAdminPwd()
      Returns the admin Pwd.

      Returns:
      the admin Pwd
    • getAdminUser

      public String getAdminUser()
      Returns the admin User.

      Returns:
      the admin User
    • getConfigFolder

      Gets the folder for config files.
      Returns:
      the folder for config files
    • getDetectedVersion

      public double getDetectedVersion()
      Returns the detected mayor version, based on DB structure.

      Returns:
      the detected mayor version
    • getInstalledModules

      public Map<String,org.opencms.module.CmsModuleVersion> getInstalledModules()
      Returns a map of all previously installed modules.

      Returns:
      a map of [String, CmsModuleVersion] objects
      See Also:
      • CmsModuleManager.getAllInstalledModules()
    • getModulesToUpdate

      List of modules to be updated.

      Returns:
      a list of module names
    • getUpdateDBThread

      Returns the update database thread.

      Returns:
      the update database thread
    • getUpdateProject

      Returns the update Project.

      Returns:
      the update Project
    • getUpdateSite

      Returns the update site.

      Returns:
      the update site
    • getUptodateModules

      Returns the modules that does not need to be updated.

      Returns:
      a list of module names
    • getWorkplaceUpdateThread

      Returns the workplace update thread.

      Returns:
      the workplace update thread
    • getXmlConfigUpdater

      Gets the XML updater (lazily create it if it hasn't been created yet).
      Returns:
      the XML updater
    • getXmlUpdateFolder

      Gets the folder for XML update files.
      Returns:
      the folder for XML update files
    • htmlModules

      public String htmlModules()
      Description copied from class: CmsSetupBean
      Returns html for displaying a module selection box.

      Overrides:
      htmlModules in class CmsSetupBean
      Returns:
      html code
      See Also:
    • init

      public void init(String webAppRfsPath, String servletMapping, String defaultWebApplication)
      Creates a new instance of the setup Bean.

      Overrides:
      init in class CmsSetupBean
      Parameters:
      webAppRfsPath - path to the OpenCms web application
      servletMapping - the OpenCms servlet mapping
      defaultWebApplication - the name of the default web application
    • isKeepHistory

      public boolean isKeepHistory()
      Returns the keep History parameter value.

      Returns:
      the keep History parameter value
    • isNeedDbUpdate

      public boolean isNeedDbUpdate()
      Returns true if a DB update is needed.

      Returns:
      true if a DB update is needed
    • isValidUser

      public boolean isValidUser()
      Checks whether the selected user and password are valid and the user has the ROOT_ADMIN role.

      Returns:
      true if the selected user and password are valid and the user has the ROOT_ADMIN role
    • prepareUpdateStep1

      public void prepareUpdateStep1()
      Prepares step 1 of the update wizard.

    • prepareUpdateStep1b

      public void prepareUpdateStep1b()
      Prepares step 1 of the update wizard.

    • prepareUpdateStep1bOutput

      public void prepareUpdateStep1bOutput(javax.servlet.jsp.JspWriter out) throws IOException
      Generates the output for step 1 of the setup wizard.

      Parameters:
      out - the JSP print stream
      Throws:
      IOException - in case errors occur while writing to "out"
    • prepareUpdateStep5

      public void prepareUpdateStep5()
      Prepares step 5 of the update wizard.

    • prepareUpdateStep5b

      public void prepareUpdateStep5b()
      Prepares step 5 of the update wizard.

    • prepareUpdateStep5bOutput

      public void prepareUpdateStep5bOutput(javax.servlet.jsp.JspWriter out) throws IOException
      Generates the output for the update wizard.

      Parameters:
      out - the JSP print stream
      Throws:
      IOException - in case errors occur while writing to "out"
    • prepareUpdateStep6

      public void prepareUpdateStep6()
      Prepares step 6 of the update wizard.

    • setAdminPwd

      public void setAdminPwd(String adminPwd)
      Sets the admin Pwd.

      Parameters:
      adminPwd - the admin Pwd to set
    • setAdminUser

      public void setAdminUser(String adminUser)
      Sets the admin User.

      Parameters:
      adminUser - the admin User to set
    • setDetectedVersion

      public void setDetectedVersion(double detectedVersion)
      Sets the detected mayor version.

      Parameters:
      detectedVersion - the value to set
    • setKeepHistory

      public void setKeepHistory(boolean keepHistory)
      Sets the keep History parameter value.

      Parameters:
      keepHistory - the keep History parameter value to set
    • setPreserveLibModules

      public void setPreserveLibModules(String preserveLibModules)
      Sets the list of modules where the included libs should be preserved during update.

      Called from step_5_update_modules.jsp.

      Parameters:
      preserveLibModules - the comma separated list of module names
    • setUpdateProject

      public void setUpdateProject(String updateProject)
      Sets the update Project.

      Parameters:
      updateProject - the update Project to set
    • setUpdateSite

      public void setUpdateSite(String site)
      Sets the update site.

      Parameters:
      site - the update site to set
    • shellExit

      public void shellExit()
      Specified by:
      shellExit in interface org.opencms.main.I_CmsShellCommands
      Overrides:
      shellExit in class CmsSetupBean
      See Also:
      • I_CmsShellCommands.shellExit()
    • shellStart

      public void shellStart()
      Specified by:
      shellStart in interface org.opencms.main.I_CmsShellCommands
      Overrides:
      shellStart in class CmsSetupBean
      See Also:
      • I_CmsShellCommands.shellStart()
    • updateDBDriverProperties

      public void updateDBDriverProperties()
      Updates the JDBC driver class names.

      Needs to be executed before any database access.

    • updateModulesFromUpdateBean

      public void updateModulesFromUpdateBean() throws Exception
      Installed all modules that have been set using CmsSetupBean.setInstallModules(String).

      This method is invoked as a shell command.

      Throws:
      Exception - if something goes wrong
    • updateRelations

      public void updateRelations() throws Exception
      Fills the relations db tables during the update.

      Throws:
      Exception - if something goes wrong
    • getAdminGroup

      protected String getAdminGroup()
      Returns the admin Group.

      Returns:
      the admin Group
    • getModulesToDelete

      Computes a list of modules which need to be removed before updating the other modules, e.g. because of resource type conflicts.

      Returns:
      the list of names of modules which need to be removed
    • removeModule

      protected void removeModule(String moduleName, org.opencms.report.I_CmsReport report) throws org.opencms.main.CmsException
      Removes a module.

      Parameters:
      moduleName - the name of the module to remove
      report - the report to write to
      Throws:
      org.opencms.main.CmsException - in case something goes wrong
    • setAdminGroup

      protected void setAdminGroup(String adminGroup)
      Sets the admin Group.

      Parameters:
      adminGroup - the admin Group to set
    • updateModule

      protected void updateModule(String moduleName, String importFile, org.opencms.report.I_CmsReport report) throws Exception
      Imports a module (zipfile) from the default module directory, creating a temporary project for this.

      Parameters:
      moduleName - the name of the module to replace
      importFile - the name of the import .zip file located in the update module directory
      report - the shell report to write the output
      Throws:
      Exception - if something goes wrong
      See Also:
      • CmsImportExportManager.importData(org.opencms.file.CmsObject, I_CmsReport, org.opencms.importexport.CmsImportParameters)