Package org.opencms.setup
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 Summary
Fields Modifier and Type Field Description static java.lang.String
EMPTY_JAR_ATTRIBUTE_KEY
The empty jar marker attribute key.static java.lang.String
FOLDER_UPDATE
Folder constant name.protected int
m_newLoggingDBOffset
The new logging offset in the database update thread.protected int
m_oldLoggingDBOffset
The old logging offset in the database update thread.-
Fields inherited from class org.opencms.setup.CmsSetupBean
ADDITIONAL_PREFIX, AS400_PROVIDER, COMPONENTS_PROPERTIES, DB2_PROVIDER, DEFAULT_POSITION, FOLDER_BACKUP, FOLDER_DATABASE, FOLDER_LIB, FOLDER_SETUP, GENERIC_PROVIDER, HSQLDB_PROVIDER, HTML_MESSAGE_FILE, m_availableModules, m_cms, m_components, m_installModules, m_logFile, m_moduleDependencies, m_moduleFilenames, m_modulesFolder, m_newLoggingOffset, m_oldLoggingOffset, m_webAppRfsPath, MAXDB_PROVIDER, MSSQL_PROVIDER, MYSQL_PROVIDER, ORACLE_PROVIDER, POSTGRESQL_PROVIDER, PROPKEY_CHECKED, PROPKEY_COMPONENT, PROPKEY_COMPONENTS, PROPKEY_DEPENDENCIES, PROPKEY_DESCRIPTION, PROPKEY_MODULES, PROPKEY_NAME, PROPKEY_POSITION
-
-
Constructor Summary
Constructors Constructor Description CmsUpdateBean()
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSubscriptionDriver()
Adds the subscription driver to the properties.boolean
checkOceeVersion(java.lang.String version)
Compatibility check for OCEE modules.void
createSharedFolder()
Creates the shared folder if possible.void
deleteSpellcheckIndex()
CmsShell command to delete spellcheck index.java.lang.String
displayError(java.lang.String pathPrefix)
Returns html code to display an error.protected java.lang.String
getAdminGroup()
Returns the admin Group.java.lang.String
getAdminPwd()
Returns the admin Pwd.java.lang.String
getAdminUser()
Returns the admin User.java.io.File
getConfigFolder()
Gets the folder for config files.double
getDetectedVersion()
Returns the detected mayor version, based on DB structure.java.util.Map<java.lang.String,org.opencms.module.CmsModuleVersion>
getInstalledModules()
Returns a map of all previously installed modules.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.java.util.List<java.lang.String>
getModulesToUpdate()
List of modules to be updated.CmsUpdateDBThread
getUpdateDBThread()
Returns the update database thread.java.lang.String
getUpdateProject()
Returns the update Project.java.lang.String
getUpdateSite()
Returns the update site.java.util.List<java.lang.String>
getUptodateModules()
Returns the modules that does not need to be updated.CmsUpdateThread
getWorkplaceUpdateThread()
Returns the workplace update thread.CmsXmlConfigUpdater
getXmlConfigUpdater()
Gets the XML updater (lazily create it if it hasn't been created yet).java.io.File
getXmlUpdateFolder()
Gets the folder for XML update files.java.lang.String
htmlModules()
Returns html for displaying a module selection box.void
init(java.lang.String webAppRfsPath, java.lang.String servletMapping, java.lang.String defaultWebApplication)
Creates a new instance of the setup Bean.boolean
isKeepHistory()
Returns the keep History parameter value.boolean
isNeedDbUpdate()
Returnstrue
if a DB update is needed.boolean
isValidUser()
Checks whether the selected user and password are valid and the user has the ROOT_ADMIN role.void
prepareUpdateStep1()
Prepares step 1 of the update wizard.void
prepareUpdateStep1b()
Prepares step 1 of the update wizard.void
prepareUpdateStep1bOutput(javax.servlet.jsp.JspWriter out)
Generates the output for step 1 of the setup wizard.void
prepareUpdateStep5()
Prepares step 5 of the update wizard.void
prepareUpdateStep5b()
Prepares step 5 of the update wizard.void
prepareUpdateStep5bOutput(javax.servlet.jsp.JspWriter out)
Generates the output for the update wizard.void
prepareUpdateStep6()
Prepares step 6 of the update wizard.protected void
removeModule(java.lang.String moduleName, org.opencms.report.I_CmsReport report)
Removes a module.protected void
setAdminGroup(java.lang.String adminGroup)
Sets the admin Group.void
setAdminPwd(java.lang.String adminPwd)
Sets the admin Pwd.void
setAdminUser(java.lang.String adminUser)
Sets the admin User.void
setDetectedVersion(double detectedVersion)
Sets the detected mayor version.void
setKeepHistory(boolean keepHistory)
Sets the keep History parameter value.void
setPreserveLibModules(java.lang.String preserveLibModules)
Sets the list of modules where the included libs should be preserved during update.void
setUpdateProject(java.lang.String updateProject)
Sets the update Project.void
setUpdateSite(java.lang.String site)
Sets the update site.void
shellExit()
void
shellStart()
void
updateDBDriverProperties()
Updates the JDBC driver class names.protected void
updateModule(java.lang.String moduleName, java.lang.String importFile, org.opencms.report.I_CmsReport report)
Imports a module (zipfile) from the default module directory, creating a temporary project for this.void
updateModulesFromUpdateBean()
Installed all modules that have been set usingCmsSetupBean.setInstallModules(String)
.void
updateRelations()
Fills the relations db tables during the update.-
Methods inherited from class org.opencms.setup.CmsSetupBean
addComponentsFromPath, backupConfiguration, buildDepsForAllComponents, checkEthernetAddress, clearCache, copyFile, displayErrors, getAvailableModules, getComponentModules, getComponents, getComponentsProperties, getConfigRfsPath, getContextPath, getDatabase, getDatabaseLibs, getDatabaseName, getDatabaseProperties, getDatabases, getDb, getDbConStrParams, getDbCreateConStr, getDbCreatePwd, getDbCreateUser, getDbDriver, getDbProperty, getDbTestQuery, getDbWorkConStr, getDbWorkPwd, getDbWorkUser, getDefaultContentEncoding, getDefaultWebApplication, getDisplayForModule, getErrors, getEthernetAddress, getExtProperty, getFullDatabaseKey, getHtmlForDbSelection, getHtmlHelpIcon, getHtmlPart, getHtmlPart, getLibFolder, getLogName, getModuleDependencies, getModuleFolder, getModulesToInstall, getPool, getProperties, getReplacer, getServerName, getServletConfig, getServletMapping, getSortedDatabases, getWebAppRfsPath, getWizardEnabled, getWorkplaceImportThread, getWorkplaceSite, getXmlHelper, hasIndexHtml, htmlComponent, htmlComponents, htmlModule, htmlModuleHelpDescriptions, importModuleFromDefault, importModulesFromSetupBean, init, init, initHtmlParts, initializeComponents, initShellCmsObject, isAutoMode, isChecked, isImportRunning, isInitialized, jsComponentDependencies, jsComponentModules, jsComponentNames, jsModuleDependencies, jsModuleNames, lockWizard, prepareStep10, prepareStep8, prepareStep8b, prepareStep8bOutput, readDatabaseConfig, saveProperties, saveProperties, setAutoMode, setDatabase, setDb, setDbConStrParams, setDbCreateConStr, setDbCreatePwd, setDbCreateUser, setDbDriver, setDbParamaters, setDbParamaters, setDbProperty, setDbWorkConStr, setDbWorkPwd, setDbWorkUser, setEthernetAddress, setExtProperty, setFullDatabaseKey, setInstallModules, setReplacer, setServerName, setStartView, setWorkplaceSite, sortModules, updateConfiguration, validateJdbc
-
-
-
-
Field Detail
-
EMPTY_JAR_ATTRIBUTE_KEY
public static final java.lang.String EMPTY_JAR_ATTRIBUTE_KEY
The empty jar marker attribute key.- See Also:
- Constant Field Values
-
FOLDER_UPDATE
public static final java.lang.String FOLDER_UPDATE
Folder constant name.
-
m_newLoggingDBOffset
protected int m_newLoggingDBOffset
The new logging offset in the database update thread.
-
m_oldLoggingDBOffset
protected int m_oldLoggingDBOffset
The old logging offset in the database update thread.
-
-
Constructor Detail
-
CmsUpdateBean
public CmsUpdateBean()
Default constructor.
-
-
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 classCmsSetupBean
- 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,
objectsCmsModuleVersion
] - 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
-
getUpdateDBThread
public CmsUpdateDBThread getUpdateDBThread()
Returns the update database thread.- Returns:
- the update database thread
-
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
-
getWorkplaceUpdateThread
public CmsUpdateThread getWorkplaceUpdateThread()
Returns the workplace update thread.- Returns:
- the workplace update thread
-
getXmlConfigUpdater
public CmsXmlConfigUpdater getXmlConfigUpdater()
Gets the XML updater (lazily create it if it hasn't been created yet).- Returns:
- the XML updater
-
getXmlUpdateFolder
public java.io.File getXmlUpdateFolder()
Gets the folder for XML update files.- Returns:
- the folder for XML update files
-
htmlModules
public java.lang.String htmlModules()
Description copied from class:CmsSetupBean
Returns html for displaying a module selection box.- Overrides:
htmlModules
in classCmsSetupBean
- Returns:
- html code
- See Also:
CmsSetupBean.htmlModules()
-
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 classCmsSetupBean
- Parameters:
webAppRfsPath
- path to the OpenCms web applicationservletMapping
- the OpenCms servlet mappingdefaultWebApplication
- 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()
Returnstrue
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 interfaceorg.opencms.main.I_CmsShellCommands
- Overrides:
shellExit
in classCmsSetupBean
- See Also:
I_CmsShellCommands.shellExit()
-
shellStart
public void shellStart()
- Specified by:
shellStart
in interfaceorg.opencms.main.I_CmsShellCommands
- Overrides:
shellStart
in classCmsSetupBean
- 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 java.lang.Exception
Installed all modules that have been set usingCmsSetupBean.setInstallModules(String)
.This method is invoked as a shell command.
- Throws:
java.lang.Exception
- if something goes wrong
-
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 removereport
- 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 replaceimportFile
- the name of the import .zip file located in the update module directoryreport
- 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)
-
-