Class 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
    • Constructor Detail

    • Method Detail

      • addSubscriptionDriver

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

      • checkOceeVersion

        public boolean checkOceeVersion​(java.lang.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 java.lang.Exception
        Creates the shared folder if possible.

        Throws:
        java.lang.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 java.lang.String displayError​(java.lang.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 java.lang.String getAdminPwd()
        Returns the admin Pwd.

        Returns:
        the admin Pwd
      • getAdminUser

        public java.lang.String getAdminUser()
        Returns the admin User.

        Returns:
        the admin User
      • getConfigFolder

        public java.io.File 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 java.util.Map<java.lang.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

        public java.util.List<java.lang.String> getModulesToUpdate()
        List of modules to be updated.

        Returns:
        a list of module names
      • getUpdateProject

        public java.lang.String getUpdateProject()
        Returns the update Project.

        Returns:
        the update Project
      • getUpdateSite

        public java.lang.String getUpdateSite()
        Returns the update site.

        Returns:
        the update site
      • getUptodateModules

        public java.util.List<java.lang.String> getUptodateModules()
        Returns the modules that does not need to be updated.

        Returns:
        a list of module names
      • getXmlUpdateFolder

        public java.io.File getXmlUpdateFolder()
        Gets the folder for XML update files.
        Returns:
        the folder for XML update files
      • init

        public void init​(java.lang.String webAppRfsPath,
                         java.lang.String servletMapping,
                         java.lang.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 java.io.IOException
        Generates the output for step 1 of the setup wizard.

        Parameters:
        out - the JSP print stream
        Throws:
        java.io.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 java.io.IOException
        Generates the output for the update wizard.

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

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

      • setAdminPwd

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

        Parameters:
        adminPwd - the admin Pwd to set
      • setAdminUser

        public void setAdminUser​(java.lang.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​(java.lang.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​(java.lang.String updateProject)
        Sets the update Project.

        Parameters:
        updateProject - the update Project to set
      • setUpdateSite

        public void setUpdateSite​(java.lang.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.

      • updateRelations

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

        Throws:
        java.lang.Exception - if something goes wrong
      • getAdminGroup

        protected java.lang.String getAdminGroup()
        Returns the admin Group.

        Returns:
        the admin Group
      • getModulesToDelete

        protected java.util.List<java.lang.String> 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​(java.lang.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​(java.lang.String adminGroup)
        Sets the admin Group.

        Parameters:
        adminGroup - the admin Group to set
      • updateModule

        protected void updateModule​(java.lang.String moduleName,
                                    java.lang.String importFile,
                                    org.opencms.report.I_CmsReport report)
                             throws java.lang.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:
        java.lang.Exception - if something goes wrong
        See Also:
        CmsImportExportManager.importData(org.opencms.file.CmsObject, I_CmsReport, org.opencms.importexport.CmsImportParameters)