org.opencms.setup
Class CmsUpdateBean

java.lang.Object
  extended by org.opencms.setup.CmsSetupBean
      extended by org.opencms.setup.CmsUpdateBean
All Implemented Interfaces:
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.5 $
Author:
Michael Moossen

Field Summary
static String JARS_FOLDER
          name of the jars folder.
static String UPDATE_FOLDER
          name of the update folder.
 
Fields inherited from class org.opencms.setup.CmsSetupBean
GENERIC_PROVIDER, HTML_MESSAGE_FILE, m_availableModules, m_cms, m_installModules, m_moduleDependencies, 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
protected  String getAdminGroup()
          Returns the admin Group.
 String getAdminPwd()
          Returns the admin Pwd.
 String getAdminUser()
          Returns the admin User.
 Map getAvailableModules()
          Returns a map with all available modules.
 Map getModuleDependencies()
          Returns a map with lists of dependent module package names keyed by module package names.
 String getUpdateLogName()
          Returns the name of the update log file.
 String getUpdateProject()
          Returns the update Project.
 String getUpdateSite()
          Returns the update site.
 CmsUpdateThread getWorkplaceUpdateThread()
          Returns the workplace update thread.
 void init(String webAppRfsPath, String servletMapping, String defaultWebApplication)
          Creates a new instance of the setup Bean.
 void prepareUpdateStep4()
          Prepares step 4 of the update wizard.
 void prepareUpdateStep4b()
          Prepares the update wizard.
 void prepareUpdateStep4bOutput(JspWriter out)
          Generates the output for the update wizard.
 void prepareUpdateStep6()
          Prepares step 6 of the update wizard.
protected  void setAdminGroup(String adminGroup)
          Sets the admin Group.
 void setAdminPwd(String adminPwd)
          Sets the admin Pwd.
 void setAdminUser(String adminUser)
          Sets the admin User.
 void setUpdateProject(String updateProject)
          Sets the update Project.
 void setUpdateSite(String site)
          Sets the update site.
 void shellExit()
          May be called after shell exit, can e.g.
 void shellStart()
          May be called before shell startup, can e.g.
 void updateJarsFromUpdateBean()
          Removes all jars indicated in the jars.to.remove property of file /update/jars/removejars.properties, and copies all jars in the /update/jars/ folder to the /WEB-INF/lib/ folder.
protected  void updateModule(String moduleName, 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, getConfigRfsPath, getDatabase, getDatabaseConfigPage, getDatabaseName, getDatabaseProperties, getDatabases, getDb, getDbConStrParams, getDbCreateConStr, getDbCreatePwd, getDbCreateUser, getDbDriver, getDbProperty, getDbTestQuery, getDbWorkConStr, getDbWorkPwd, getDbWorkUser, getDefaultContentEncoding, getDefaultWebApplication, getDisplayForModule, getErrors, getEthernetAddress, getExtProperty, getHtmlHelpIcon, getHtmlPart, getHtmlPart, getModulesToInstall, getPool, getProperties, getReplacer, getServerName, getServletMapping, getSetupLogName, getSortedDatabases, getWebAppRfsPath, getWizardEnabled, getWorkplaceImportThread, getWorkplaceSite, importModuleFromDefault, importModulesFromSetupBean, init, initHtmlParts, initShellCmsObject, isChecked, isInitialized, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JARS_FOLDER

public static final String JARS_FOLDER
name of the jars folder.

See Also:
Constant Field Values

UPDATE_FOLDER

public static final String UPDATE_FOLDER
name of the update folder.

See Also:
Constant Field Values
Constructor Detail

CmsUpdateBean

public CmsUpdateBean()
Default constructor.

Method Detail

getAdminPwd

public String getAdminPwd()
Returns the admin Pwd.

Returns:
the admin Pwd

getAdminUser

public String getAdminUser()
Returns the admin User.

Returns:
the admin User

getAvailableModules

public Map getAvailableModules()
Returns a map with all available modules.

The map contains maps keyed by module package names. Each of these maps contains various information about the module such as the module name, version, description, and a list of it's dependencies. You should refer to the source code of this method to understand the data structure of the map returned by this method!

Overrides:
getAvailableModules in class CmsSetupBean
Returns:
a map with all available modules

getModuleDependencies

public Map getModuleDependencies()
Returns a map with lists of dependent module package names keyed by module package names.

Overrides:
getModuleDependencies in class CmsSetupBean
Returns:
a map with lists of dependent module package names keyed by module package names

getUpdateLogName

public String getUpdateLogName()
Returns the name of the update log file.

Returns:
the name of the update log file

getUpdateProject

public String getUpdateProject()
Returns the update Project.

Returns:
the update Project

getUpdateSite

public String getUpdateSite()
Returns the update site.

Returns:
the update site

getWorkplaceUpdateThread

public CmsUpdateThread getWorkplaceUpdateThread()
Returns the workplace update thread.

Returns:
the workplace update thread

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

prepareUpdateStep4

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


prepareUpdateStep4b

public void prepareUpdateStep4b()
Prepares the update wizard.


prepareUpdateStep4bOutput

public void prepareUpdateStep4bOutput(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

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()
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()

updateJarsFromUpdateBean

public void updateJarsFromUpdateBean()
                              throws IOException
Removes all jars indicated in the jars.to.remove property of file /update/jars/removejars.properties, and copies all jars in the /update/jars/ folder to the /WEB-INF/lib/ folder.

Throws:
IOException - if something goes wrong

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

getAdminGroup

protected String getAdminGroup()
Returns the admin Group.

Returns:
the admin Group

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