org.opencms.setup
Class CmsUpdateBean

java.lang.Object
  extended byorg.opencms.setup.CmsSetupBean
      extended byorg.opencms.setup.CmsUpdateBean
All Implemented Interfaces:
java.lang.Cloneable, I_CmsShellCommands

public class CmsUpdateBean
extends CmsSetupBean

A java bean as a controller for the OpenCms update wizard.

Since:
6.0.0
Version:
$Revision: 1.6 $
Author:
Michael Moossen

Field Summary
static java.lang.String FOLDER_UPDATE
          name of the update folder.
 
Fields inherited from class org.opencms.setup.CmsSetupBean
FOLDER_BACKUP, FOLDER_DATABASE, FOLDER_LIB, FOLDER_SETUP, FOLDER_WEBINF, GENERIC_PROVIDER, HTML_MESSAGE_FILE, m_availableModules, m_cms, m_installModules, m_logFile, m_logsFolder, m_moduleDependencies, m_moduleFilenames, m_modulesFolder, m_newLoggingOffset, m_oldLoggingOffset, m_webAppRfsPath, MAXDB_PROVIDER, MYSQL_PROVIDER, ORACLE_PROVIDER, POSTGRESQL_PROVIDER, REQUIRED_DB_SETUP_FILES
 
Constructor Summary
CmsUpdateBean()
          Default constructor.
 
Method Summary
 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.util.Map getInstalledModules()
          Returns a map of all previously installed modules.
 java.util.List getModulesToUpdate()
          List of modules to be updated.
 java.lang.String getUpdateProject()
          Returns the update Project.
 java.lang.String getUpdateSite()
          Returns the update site.
 java.util.List getUptodateModules()
          Returns the modules that does not need to be updated.
 CmsUpdateThread getWorkplaceUpdateThread()
          Returns the workplace update thread.
 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.
 void prepareUpdateStep5()
          Prepares step 4 of the update wizard.
 void prepareUpdateStep5b()
          Prepares 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 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 setUpdateProject(java.lang.String updateProject)
          Sets the update Project.
 void setUpdateSite(java.lang.String site)
          Sets the update site.
 void shellExit()
          May be called after shell exit, can e.g. be used to ouput a goodbye message.
 void shellStart()
          May be called before shell startup, can e.g. be used to ouput a welcome message.
protected  void updateModule(java.lang.String moduleName, java.lang.String importFile, 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 using CmsSetupBean.setInstallModules(String).
 
Methods inherited from class org.opencms.setup.CmsSetupBean
backupConfiguration, checkEthernetAddress, copyFile, getAvailableModules, getConfigRfsPath, getDatabase, getDatabaseConfigPage, getDatabaseLibs, getDatabaseName, getDatabaseProperties, getDatabases, getDb, getDbConStrParams, getDbCreateConStr, getDbCreatePwd, getDbCreateUser, getDbDriver, getDbProperty, getDbTestQuery, getDbWorkConStr, getDbWorkPwd, getDbWorkUser, getDefaultContentEncoding, getDefaultWebApplication, getDisplayForModule, getErrors, getEthernetAddress, getExtProperty, getHtmlHelpIcon, getHtmlPart, getHtmlPart, getLibFolder, getLogName, getModuleDependencies, getModuleFolder, getModulesToInstall, getPool, getProperties, getReplacer, getServerName, getServletConfig, getServletMapping, getSortedDatabases, getWebAppRfsPath, getWizardEnabled, getWorkplaceImportThread, getWorkplaceSite, getXmlHelper, htmlModule, htmlModuleHelpDescriptions, importModuleFromDefault, importModulesFromSetupBean, init, initHtmlParts, initShellCmsObject, isChecked, isInitialized, jsModuleDependencies, jsModuleNames, loadProperties, lockWizard, prepareStep10, prepareStep8, prepareStep8b, prepareStep8bOutput, readDatabaseConfig, saveProperties, setDatabase, setDb, setDbConStrParams, setDbCreateConStr, setDbCreatePwd, setDbCreateUser, setDbDriver, setDbParamaters, setDbProperty, setDbWorkConStr, setDbWorkPwd, setDbWorkUser, setEthernetAddress, setExtProperty, setInstallModules, setReplacer, setServerName, setWorkplaceSite, sortModules, validateJdbc
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FOLDER_UPDATE

public static final java.lang.String FOLDER_UPDATE
name of the update folder.

Constructor Detail

CmsUpdateBean

public CmsUpdateBean()
Default constructor.

Method Detail

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

getInstalledModules

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

htmlModules

public java.lang.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:
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 class CmsSetupBean
Parameters:
webAppRfsPath - path to the OpenCms web application
servletMapping - the OpenCms servlet mapping
defaultWebApplication - the name of the default web application

prepareUpdateStep5

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


prepareUpdateStep5b

public void prepareUpdateStep5b()
Prepares 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

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()
Description copied from interface: I_CmsShellCommands
May be called after shell exit, can e.g. be used to ouput a goodbye message.

Please note: This method is not guaranteed to be called. For a shell that has more then one shell command object initialized, only the exit method of one of thouse will be called.

Specified by:
shellExit in interface I_CmsShellCommands
Overrides:
shellExit in class CmsSetupBean
See Also:
I_CmsShellCommands.shellExit()

shellStart

public void shellStart()
Description copied from interface: I_CmsShellCommands
May be called before shell startup, can e.g. be used to ouput a welcome message.

Please note: This method is not guaranteed to be called. For a shell that has more then one shell command object initialized, only the start method of one of thouse will be called.

Specified by:
shellStart in interface I_CmsShellCommands
Overrides:
shellStart in class CmsSetupBean
See Also:
I_CmsShellCommands.shellStart()

updateModulesFromUpdateBean

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

This method is invoked as a shell command.

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

getAdminGroup

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

Returns:
the admin Group

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,
                            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, String, String, org.opencms.report.I_CmsReport)