|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opencms.setup.CmsSetupBean
public class CmsSetupBean
A java bean as a controller for the OpenCms setup wizard.
It is not allowed to customize this bean with methods for a specific database server setup!
Database server specific settings should be set/read using get/setDbProperty, as for example like:
setDbProperty("oracle.defaultTablespace", value);
Field Summary | |
---|---|
static java.lang.String |
FOLDER_BACKUP
Folder constant name. |
static java.lang.String |
FOLDER_DATABASE
Folder constant name. |
static java.lang.String |
FOLDER_LIB
Folder constant name. |
static java.lang.String |
FOLDER_SETUP
Folder constant name. |
static java.lang.String |
GENERIC_PROVIDER
DB provider constant. |
static java.lang.String |
HTML_MESSAGE_FILE
Name of the property file containing HTML fragments for setup wizard and error dialog. |
protected java.util.Map |
m_availableModules
A map with all available modules. |
protected CmsObject |
m_cms
A CmsObject to execute shell commands. |
protected java.util.List |
m_installModules
A list with the package names of the modules to be installed . |
protected java.lang.String |
m_logFile
Location for log file. |
protected java.lang.String |
m_logsFolder
Location for logs relative to the webapp folder. |
protected java.util.Map |
m_moduleDependencies
A map with lists of dependent module package names keyed by module package names. |
protected java.util.Map |
m_moduleFilenames
A map with all available modules filenames. |
protected java.lang.String |
m_modulesFolder
Location for module archives relative to the webapp folder. |
protected int |
m_newLoggingOffset
The new logging offset in the workplace import thread. |
protected int |
m_oldLoggingOffset
The lod logging offset in the workplace import thread. |
protected java.lang.String |
m_webAppRfsPath
The absolute path to the home directory of the OpenCms webapp. |
static java.lang.String |
MAXDB_PROVIDER
DB provider constant for maxdb. |
static java.lang.String |
MYSQL_PROVIDER
DB provider constant for mysql. |
static java.lang.String |
ORACLE_PROVIDER
DB provider constant for oracle. |
static java.lang.String |
POSTGRESQL_PROVIDER
DB provider constant for postgresql. |
Constructor Summary | |
---|---|
CmsSetupBean()
Default constructor. |
Method Summary | |
---|---|
void |
backupConfiguration(java.lang.String filename,
java.lang.String originalFilename)
Restores the opencms.xml either to or from a backup file, depending whether the setup wizard is executed the first time (the backup does not exist) or not (the backup exists). |
void |
checkEthernetAddress()
Checks the ethernet address value and generates a dummy address, if necessary. |
void |
copyFile(java.lang.String source,
java.lang.String target)
Copies a given file. |
java.lang.String |
displayError(java.lang.String pathPrefix)
Returns html code to display an error. |
java.lang.String |
displayErrors(java.lang.String pathPrefix)
Returns html code to display the errors occured. |
java.util.Map |
getAvailableModules()
Returns a map with all available modules. |
java.lang.String |
getConfigRfsPath()
Returns the "config" path in the OpenCms web application. |
java.lang.String |
getDatabase()
Returns the key of the selected database server (e.g. |
java.lang.String |
getDatabaseConfigPage(java.lang.String key)
Returns the URI of a database config page (in step 3) for a specified database key. |
java.util.List |
getDatabaseLibs(java.lang.String databaseKey)
Returns a list of needed jar filenames for a database server setup specified by a database key (e.g. |
java.lang.String |
getDatabaseName(java.lang.String databaseKey)
Returns the clear text name for a database server setup specified by a database key (e.g. |
java.util.Map |
getDatabaseProperties()
Returns a map with the database properties of *all* available database configurations keyed by their database keys (e.g. |
java.util.List |
getDatabases()
Returns a list with they keys (e.g. |
java.lang.String |
getDb()
Returns the database name. |
java.lang.String |
getDbConStrParams()
Returns the JDBC connect URL parameters. |
java.lang.String |
getDbCreateConStr()
Returns the database create statement. |
java.lang.String |
getDbCreatePwd()
Returns the password used for database creation. |
java.lang.String |
getDbCreateUser()
Returns the database user that is used to connect to the database. |
java.lang.String |
getDbDriver()
Returns the database driver belonging to the database from the default configuration. |
java.lang.String |
getDbProperty(java.lang.String key)
Returns the value for a given key from the database properties. |
java.lang.String |
getDbTestQuery()
Returns the validation query belonging to the database from the default configuration . |
java.lang.String |
getDbWorkConStr()
Returns a connection string. |
java.lang.String |
getDbWorkPwd()
Returns the password of the database from the properties . |
java.lang.String |
getDbWorkUser()
Returns the user of the database from the properties. |
java.lang.String |
getDefaultContentEncoding()
Returns the default content encoding. |
java.lang.String |
getDefaultWebApplication()
Returns the name of the default web application, configured in web.xml . |
java.lang.String |
getDisplayForModule(CmsModule module)
Returns the display string for a given module. |
java.util.List |
getErrors()
Returns the error messages. |
java.lang.String |
getEthernetAddress()
Returns the mac ethernet address. |
protected java.lang.String |
getExtProperty(java.lang.String key)
Returns the value for a given key from the extended properties. |
java.lang.String |
getHtmlHelpIcon(java.lang.String id,
java.lang.String pathPrefix)
Returns a help image icon tag to display a help text in the setup wizard. |
java.lang.String |
getHtmlPart(java.lang.String part)
Returns the specified HTML part of the HTML property file to create the output. |
java.lang.String |
getHtmlPart(java.lang.String part,
java.lang.String replaceString)
Returns the specified HTML part of the HTML property file to create the output. |
java.lang.String |
getLibFolder()
Returns the path to the /WEB-INF/lib folder. |
java.lang.String |
getLogName()
Returns the name of the log file. |
java.util.Map |
getModuleDependencies()
Returns a map with lists of dependent module package names keyed by module package names. |
java.lang.String |
getModuleFolder()
Returns the absolute path to the module root folder. |
java.util.List |
getModulesToInstall()
Returns A list with the package names of the modules to be installed. |
java.lang.String |
getPool()
Gets the default pool. |
org.apache.commons.collections.ExtendedProperties |
getProperties()
Returns the extended properties. |
java.util.Map |
getReplacer()
Returns the replacer. |
java.lang.String |
getServerName()
Return the OpenCms server name. |
javax.servlet.ServletConfig |
getServletConfig()
Returns the initial servlet configuration. |
java.lang.String |
getServletMapping()
Returns the OpenCms servlet mapping, configured in web.xml . |
java.util.List |
getSortedDatabases()
Returns a sorted list with they keys (e.g. |
java.lang.String |
getWebAppRfsPath()
Returns the absolute path to the OpenCms home directory. |
boolean |
getWizardEnabled()
Checks if the setup wizard is enabled. |
CmsSetupWorkplaceImportThread |
getWorkplaceImportThread()
Returns the workplace import thread. |
java.lang.String |
getWorkplaceSite()
Return the OpenCms workplace site. |
CmsSetupXmlHelper |
getXmlHelper()
Returns the xml Helper object. |
protected java.lang.String |
htmlModule(CmsModule module,
int pos)
Returns html for the given module to fill the selection list. |
java.lang.String |
htmlModuleHelpDescriptions()
Returns html code for the module descriptions in help ballons. |
java.lang.String |
htmlModules()
Returns html for displaying a module selection box. |
protected void |
importModuleFromDefault(java.lang.String importFile)
Imports a module (zipfile) from the default module directory, creating a temporary project for this. |
void |
importModulesFromSetupBean()
Installed all modules that have been set using setInstallModules(String) . |
void |
init(javax.servlet.jsp.PageContext pageContext)
Creates a new instance of the setup Bean from a JSP page. |
void |
init(java.lang.String webAppRfsPath,
java.lang.String servletMapping,
java.lang.String defaultWebApplication)
Creates a new instance of the setup Bean. |
void |
initHtmlParts()
This method reads the properties from the htmlmsg.property file and sets the HTML part properties with the matching values. |
void |
initShellCmsObject(CmsObject cms,
CmsShell shell)
Provides access to the shell CmsObject and the shell itself. |
java.lang.String |
isChecked(java.lang.String value1,
java.lang.String value2)
Over simplistic helper to compare two strings to check radio buttons. |
boolean |
isInitialized()
Returns true if this setup bean is correctly initialized. |
java.lang.String |
jsModuleDependencies()
Returns js code with array definition for the available module dependencies. |
java.lang.String |
jsModuleNames()
Returns js code with array definition for the available module names. |
org.apache.commons.collections.ExtendedProperties |
loadProperties(java.lang.String file)
Loads the default OpenCms properties. |
void |
lockWizard()
Locks (i.e. disables) the setup wizard. |
void |
prepareStep10()
Prepares step 10 of the setup wizard. |
boolean |
prepareStep8()
Prepares step 8 of the setup wizard. |
void |
prepareStep8b()
Prepares step 8b of the setup wizard. |
void |
prepareStep8bOutput(javax.servlet.jsp.JspWriter out)
Generates the output for step 8b of the setup wizard. |
protected void |
readDatabaseConfig()
Stores the properties of all available database configurations in a map keyed by their database key names (e.g. |
void |
saveProperties(org.apache.commons.collections.ExtendedProperties properties,
java.lang.String file,
boolean backup)
Saves properties to specified file. |
void |
setDatabase(java.lang.String databaseKey)
Sets the database drivers to the given value. |
void |
setDb(java.lang.String db)
Sets the database name. |
void |
setDbConStrParams(java.lang.String value)
Sets the JDBC connect URL parameters. |
void |
setDbCreateConStr(java.lang.String dbCreateConStr)
Sets the database create statement. |
void |
setDbCreatePwd(java.lang.String dbCreatePwd)
Sets the password used for the initial OpenCms database creation. |
void |
setDbCreateUser(java.lang.String dbCreateUser)
Set the database user that is used to connect to the database. |
void |
setDbDriver(java.lang.String driver)
Sets the database driver belonging to the database. |
boolean |
setDbParamaters(javax.servlet.http.HttpServletRequest request,
java.lang.String provider)
Sets the needed database parameters. |
void |
setDbProperty(java.lang.String key,
java.lang.String value)
This method sets the value for a given key in the database properties. |
void |
setDbWorkConStr(java.lang.String dbWorkConStr)
Sets the connection string to the database to the given value. |
void |
setDbWorkPwd(java.lang.String dbWorkPwd)
Sets the password of the database to the given value. |
void |
setDbWorkUser(java.lang.String dbWorkUser)
Sets the user of the database to the given value. |
void |
setEthernetAddress(java.lang.String ethernetAddress)
Set the mac ethernet address, required for UUID generation. |
protected void |
setExtProperty(java.lang.String key,
java.lang.String value)
This method sets the value for a given key in the extended properties. |
void |
setInstallModules(java.lang.String value)
Sets the list with the package names of the modules to be installed. |
void |
setReplacer(java.util.Map map)
Sets the replacer. |
void |
setServerName(java.lang.String name)
Sets the OpenCms server name. |
void |
setWorkplaceSite(java.lang.String newSite)
Sets the OpenCms workplace 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. |
java.util.List |
sortModules(java.util.Collection modules)
Sorts the modules for display. |
boolean |
validateJdbc()
Checks the jdbc driver. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String FOLDER_BACKUP
public static final java.lang.String FOLDER_DATABASE
public static final java.lang.String FOLDER_LIB
public static final java.lang.String FOLDER_SETUP
public static final java.lang.String GENERIC_PROVIDER
public static final java.lang.String HTML_MESSAGE_FILE
public static final java.lang.String MAXDB_PROVIDER
public static final java.lang.String MYSQL_PROVIDER
public static final java.lang.String ORACLE_PROVIDER
public static final java.lang.String POSTGRESQL_PROVIDER
protected java.util.Map m_availableModules
protected CmsObject m_cms
protected java.util.List m_installModules
protected java.lang.String m_logFile
protected java.lang.String m_logsFolder
protected java.util.Map m_moduleDependencies
protected java.util.Map m_moduleFilenames
protected java.lang.String m_modulesFolder
protected int m_newLoggingOffset
protected int m_oldLoggingOffset
protected java.lang.String m_webAppRfsPath
Constructor Detail |
---|
public CmsSetupBean()
Method Detail |
---|
public void backupConfiguration(java.lang.String filename, java.lang.String originalFilename)
filename
- something like e.g. "opencms.xml"originalFilename
- the configurations real file name, e.g. "opencms.xml.ori"public void checkEthernetAddress()
*
public void copyFile(java.lang.String source, java.lang.String target)
source
- the source filetarget
- the destination filepublic java.lang.String displayError(java.lang.String pathPrefix)
pathPrefix
- to adjust the path
public java.lang.String displayErrors(java.lang.String pathPrefix)
pathPrefix
- to adjust the path
public java.util.Map getAvailableModules()
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!
public java.lang.String getConfigRfsPath()
public java.lang.String getDatabase()
public java.lang.String getDatabaseConfigPage(java.lang.String key)
key
- the database key (e.g. "mysql", "generic" or "oracle")
public java.util.List getDatabaseLibs(java.lang.String databaseKey)
databaseKey
- a database key (e.g. "mysql", "generic" or "oracle")
public java.lang.String getDatabaseName(java.lang.String databaseKey)
databaseKey
- a database key (e.g. "mysql", "generic" or "oracle")
public java.util.Map getDatabaseProperties()
public java.util.List getDatabases()
public java.lang.String getDb()
public java.lang.String getDbConStrParams()
public java.lang.String getDbCreateConStr()
public java.lang.String getDbCreatePwd()
public java.lang.String getDbCreateUser()
public java.lang.String getDbDriver()
public java.lang.String getDbProperty(java.lang.String key)
key
- the property key
public java.lang.String getDbTestQuery()
public java.lang.String getDbWorkConStr()
public java.lang.String getDbWorkPwd()
public java.lang.String getDbWorkUser()
public java.lang.String getDefaultContentEncoding()
public java.lang.String getDefaultWebApplication()
web.xml
.
By default this is "ROOT"
.
web.xml
public java.lang.String getDisplayForModule(CmsModule module)
module
- a module
public java.util.List getErrors()
public java.lang.String getEthernetAddress()
public java.lang.String getHtmlHelpIcon(java.lang.String id, java.lang.String pathPrefix)
id
- the id of the desired help divpathPrefix
- the path prefix to the image
public java.lang.String getHtmlPart(java.lang.String part)
part
- the name of the desired part
public java.lang.String getHtmlPart(java.lang.String part, java.lang.String replaceString)
part
- the name of the desired partreplaceString
- String which is inserted in the found HTML part at the location of "$replace$"
public java.lang.String getLibFolder()
public java.lang.String getLogName()
public java.util.Map getModuleDependencies()
public java.lang.String getModuleFolder()
public java.util.List getModulesToInstall()
public java.lang.String getPool()
public org.apache.commons.collections.ExtendedProperties getProperties()
public java.util.Map getReplacer()
public java.lang.String getServerName()
public javax.servlet.ServletConfig getServletConfig()
public java.lang.String getServletMapping()
web.xml
.
By default this is "/opencms/*"
.
web.xml
public java.util.List getSortedDatabases()
public java.lang.String getWebAppRfsPath()
public boolean getWizardEnabled()
public CmsSetupWorkplaceImportThread getWorkplaceImportThread()
public java.lang.String getWorkplaceSite()
public CmsSetupXmlHelper getXmlHelper()
public java.lang.String htmlModuleHelpDescriptions()
public java.lang.String htmlModules()
public void importModulesFromSetupBean() throws java.lang.Exception
setInstallModules(String)
.This method is invoked as a shell command.
java.lang.Exception
- if something goes wrongpublic void init(javax.servlet.jsp.PageContext pageContext)
pageContext
- the JSP's page contextpublic void init(java.lang.String webAppRfsPath, java.lang.String servletMapping, java.lang.String defaultWebApplication)
webAppRfsPath
- path to the OpenCms web applicationservletMapping
- the OpenCms servlet mappingdefaultWebApplication
- the name of the default web applicationpublic void initHtmlParts()
public void initShellCmsObject(CmsObject cms, CmsShell shell)
I_CmsShellCommands
initShellCmsObject
in interface I_CmsShellCommands
cms
- the shell CmsObjectshell
- the CmsShellI_CmsShellCommands.initShellCmsObject(org.opencms.file.CmsObject, org.opencms.main.CmsShell)
public java.lang.String isChecked(java.lang.String value1, java.lang.String value2)
value1
- the first valuevalue2
- the second value
public boolean isInitialized()
public java.lang.String jsModuleDependencies()
public java.lang.String jsModuleNames()
public org.apache.commons.collections.ExtendedProperties loadProperties(java.lang.String file) throws java.io.IOException
file
- the file tp read the properties from
java.io.IOException
- in case of IO errorspublic void lockWizard()
public void prepareStep10()
public boolean prepareStep8() throws CmsXmlException
CmsXmlException
- if something goes wrongpublic void prepareStep8b()
public void prepareStep8bOutput(javax.servlet.jsp.JspWriter out) throws java.io.IOException
out
- the JSP print stream
java.io.IOException
- in case errors occur while writing to "out"public void saveProperties(org.apache.commons.collections.ExtendedProperties properties, java.lang.String file, boolean backup)
properties
- the properties to be savedfile
- the file to save the properties tobackup
- if true, create a backupfilepublic void setDatabase(java.lang.String databaseKey)
databaseKey
- the key of the selected database server (e.g. "mysql", "generic" or "oracle")public void setDb(java.lang.String db)
db
- the database name to setpublic void setDbConStrParams(java.lang.String value)
value
- the JDBC connect URL parameterspublic void setDbCreateConStr(java.lang.String dbCreateConStr)
dbCreateConStr
- the database create statementpublic void setDbCreatePwd(java.lang.String dbCreatePwd)
This password will not be stored permanently, but used only in the setup wizard.
dbCreatePwd
- the password used for the initial OpenCms database creationpublic void setDbCreateUser(java.lang.String dbCreateUser)
dbCreateUser
- the user to setpublic void setDbDriver(java.lang.String driver)
driver
- name of the opencms driverpublic boolean setDbParamaters(javax.servlet.http.HttpServletRequest request, java.lang.String provider)
request
- the http requestprovider
- the db provider
public void setDbProperty(java.lang.String key, java.lang.String value)
key
- The key of the propertyvalue
- The value of the propertypublic void setDbWorkConStr(java.lang.String dbWorkConStr)
dbWorkConStr
- the connection string used by the OpenCms corepublic void setDbWorkPwd(java.lang.String dbWorkPwd)
dbWorkPwd
- the password for the OpenCms database userpublic void setDbWorkUser(java.lang.String dbWorkUser)
dbWorkUser
- the database user used by the opencms corepublic void setEthernetAddress(java.lang.String ethernetAddress)
ethernetAddress
- the mac addess to setpublic void setInstallModules(java.lang.String value)
value
- a string with the package names of the modules to be installed delimited by the pipe symbol "|"public void setReplacer(java.util.Map map)
map
- the replacer to setpublic void setServerName(java.lang.String name)
name
- the OpenCms server namepublic void setWorkplaceSite(java.lang.String newSite)
newSite
- the OpenCms workplace sitepublic void shellExit()
I_CmsShellCommands
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.
shellExit
in interface I_CmsShellCommands
I_CmsShellCommands.shellExit()
public void shellStart()
I_CmsShellCommands
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.
shellStart
in interface I_CmsShellCommands
I_CmsShellCommands.shellStart()
public java.util.List sortModules(java.util.Collection modules)
modules
- the list of CmsModule
objects
public boolean validateJdbc()
true
if at least one of the recommended drivers is foundprotected java.lang.String getExtProperty(java.lang.String key)
key
- the property key
protected java.lang.String htmlModule(CmsModule module, int pos)
module
- the module to generate the code forpos
- the position in the list
protected void importModuleFromDefault(java.lang.String importFile) throws java.lang.Exception
importFile
- the name of the import module located in the default module directory
java.lang.Exception
- if something goes wrongCmsImportExportManager.importData(CmsObject, String, String, org.opencms.report.I_CmsReport)
protected void readDatabaseConfig()
protected void setExtProperty(java.lang.String key, java.lang.String value)
key
- The key of the propertyvalue
- The value of the property
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |