Class CmsSetupBean

  • All Implemented Interfaces:
    org.opencms.main.I_CmsShellCommands
    Direct Known Subclasses:
    CmsUpdateBean

    public class CmsSetupBean
    extends java.lang.Object
    implements org.opencms.main.I_CmsShellCommands
    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);
     

    Since:
    6.0.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ADDITIONAL_PREFIX
      Prefix for 'marker' properties in opencms.properties where additional properties should be inserted.
      static java.lang.String AS400_PROVIDER
      DB provider constant for as400.
      static java.lang.String COMPONENTS_PROPERTIES
      The name of the components properties file.
      static java.lang.String DB2_PROVIDER
      DB provider constant for db2.
      protected static int DEFAULT_POSITION
      The default component position, is missing.
      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 HSQLDB_PROVIDER
      DB provider constant for hsqldb.
      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<java.lang.String,​org.opencms.module.CmsModule> m_availableModules
      A map with all available modules.
      protected org.opencms.file.CmsObject m_cms
      A CmsObject to execute shell commands.
      protected org.opencms.workplace.tools.CmsIdentifiableObjectContainer<CmsSetupComponent> m_components
      Contains all defined components.
      protected java.util.List<java.lang.String> 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.util.Map<java.lang.String,​java.util.List<java.lang.String>> m_moduleDependencies
      A map with lists of dependent module package names keyed by module package names.
      protected java.util.Map<java.lang.String,​java.lang.String> 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 MSSQL_PROVIDER
      DB provider constant for mssql.
      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.
      protected static java.lang.String PROPKEY_CHECKED
      Properties file key constant post fix.
      protected static java.lang.String PROPKEY_COMPONENT
      Properties file key constant prefix.
      protected static java.lang.String PROPKEY_COMPONENTS
      Properties file key constant.
      protected static java.lang.String PROPKEY_DEPENDENCIES
      Properties file key constant post fix.
      protected static java.lang.String PROPKEY_DESCRIPTION
      Properties file key constant post fix.
      protected static java.lang.String PROPKEY_MODULES
      Properties file key constant post fix.
      protected static java.lang.String PROPKEY_NAME
      Properties file key constant post fix.
      protected static java.lang.String PROPKEY_POSITION
      Properties file key constant post fix.
    • Constructor Summary

      Constructors 
      Constructor Description
      CmsSetupBean()
      Default constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void addComponentsFromPath​(java.lang.String fileName)
      Reads all components from the given location, a folder or a zip file.
      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).
      java.util.Map<java.lang.String,​java.util.List<java.lang.String>> buildDepsForAllComponents()
      Returns a map of dependencies.
      void checkEthernetAddress()
      Checks the ethernet address value and generates a dummy address, if necessary.
      void clearCache()
      Clears the cache.
      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 occurred.
      java.util.Map<java.lang.String,​org.opencms.module.CmsModule> getAvailableModules()
      Returns a map with all available modules.
      protected java.lang.String getComponentModules​(java.util.List<java.lang.String> componentIds)
      Returns a pipe separated list of module names for the given list of components.
      org.opencms.workplace.tools.CmsIdentifiableObjectContainer<CmsSetupComponent> getComponents()
      Returns the components.
      protected org.opencms.configuration.CmsParameterConfiguration getComponentsProperties​(java.lang.String location)
      Reads all properties from the components.properties file at the given location, a folder or a zip file.
      java.lang.String getConfigRfsPath()
      Returns the "config" path in the OpenCms web application.
      java.lang.String getContextPath()  
      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<java.lang.String> 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<java.lang.String,​java.util.Properties> getDatabaseProperties()
      Returns a map with the database properties of *all* available database configurations keyed by their database keys (e.g.
      java.util.List<java.lang.String> 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​(org.opencms.module.CmsModule module)
      Returns the display string for a given module.
      java.util.List<java.lang.String> 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 getFullDatabaseKey()
      Returns the fullDatabaseKey.
      java.lang.String getHtmlForDbSelection()
      Generates the HTML code for the drop down for db selection.
      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<java.lang.String,​java.util.List<java.lang.String>> 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<java.lang.String> getModulesToInstall()
      Returns A list with the package names of the modules to be installed.
      java.lang.String getPool()
      Gets the default pool.
      org.opencms.configuration.CmsParameterConfiguration getProperties()
      Returns the parameter configuration.
      java.util.Map<java.lang.String,​java.lang.String> 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<java.lang.String> 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.
      boolean hasIndexHtml()
      Returns true if there is an index.html file in the default site after the module import.
      protected java.lang.String htmlComponent​(CmsSetupComponent component)
      Returns html for the given component to fill the selection list.
      java.lang.String htmlComponents()
      Returns the html code for component selection.
      protected java.lang.String htmlModule​(org.opencms.module.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​(java.lang.String webAppRfsPath, java.lang.String servletMapping, java.lang.String defaultWebApplication)
      Creates a new instance of the setup Bean.
      void init​(javax.servlet.jsp.PageContext pageContext)
      Creates a new instance of the setup Bean from a JSP page.
      void init​(javax.servlet.ServletContext servCtx, javax.servlet.ServletConfig servConfig)  
      void initHtmlParts()
      This method reads the properties from the htmlmsg.property file and sets the HTML part properties with the matching values.
      protected void initializeComponents​(java.util.Collection<java.lang.String> modules)
      Initializes and validates the read components.
      void initShellCmsObject​(org.opencms.file.CmsObject cms, org.opencms.main.CmsShell shell)  
      boolean isAutoMode()
      Returns the autoMode.
      java.lang.String isChecked​(java.lang.String value1, java.lang.String value2)
      Over simplistic helper to compare two strings to check radio buttons.
      protected boolean isImportRunning()
      Returns true if the import thread is currently running.
      boolean isInitialized()
      Returns true if this setup bean is correctly initialized.
      java.lang.String jsComponentDependencies()
      Returns js code with array definition for the available component dependencies.
      java.lang.String jsComponentModules()
      Returns js code with array definition for the component modules.
      java.lang.String jsComponentNames()
      Returns js code with array definition for the available components names.
      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.
      void lockWizard()
      Locks (i.e.
      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.opencms.configuration.CmsParameterConfiguration properties, java.lang.String file, boolean backup)
      Saves properties to specified file.
      void saveProperties​(org.opencms.configuration.CmsParameterConfiguration properties, java.lang.String file, boolean backup, java.util.Set<java.lang.String> forceWrite)
      Saves properties to specified file.
      void setAutoMode​(boolean autoMode)
      Sets the autoMode.
      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​(java.util.Map<java.lang.String,​java.lang.String[]> request, java.lang.String provider, java.lang.String contextPath, javax.servlet.http.HttpSession session)
      Sets the needed database parameters.
      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 setFullDatabaseKey​(java.lang.String fullDatabaseKey)
      Sets the fullDatabaseKey.
      void setInstallModules​(java.lang.String value)
      Sets the list with the package names of the modules to be installed.
      void setReplacer​(java.util.Map<java.lang.String,​java.lang.String> map)
      Sets the replacer.
      void setServerName​(java.lang.String name)
      Sets the OpenCms server name.
      void setStartView​(java.lang.String userName, java.lang.String view)
      Sets the start view for the given user.
      void setWorkplaceSite​(java.lang.String newSite)
      Sets the OpenCms workplace site.
      void shellExit()  
      void shellStart()  
      java.util.List<java.lang.String> sortModules​(java.util.Collection<org.opencms.module.CmsModule> modules)
      Sorts the modules for display.
      void updateConfiguration()
      Writes configuration changes back to the XML configuration.
      boolean validateJdbc()
      Checks the jdbc driver.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • backupConfiguration

        public 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).
        Parameters:
        filename - something like e.g. "opencms.xml"
        originalFilename - the configurations real file name, e.g. "opencms.xml.ori"
      • buildDepsForAllComponents

        public java.util.Map<java.lang.String,​java.util.List<java.lang.String>> buildDepsForAllComponents()
        Returns a map of dependencies.

        The component dependencies are get from the setup and module components.properties files found.

        Returns:
        a Map of component ids as keys and a list of dependency names as values
      • checkEthernetAddress

        public void checkEthernetAddress()
        Checks the ethernet address value and generates a dummy address, if necessary.

        *

      • clearCache

        public void clearCache()
        Clears the cache.

      • copyFile

        public void copyFile​(java.lang.String source,
                             java.lang.String target)
        Copies a given file.

        Parameters:
        source - the source file
        target - the destination file
      • displayError

        public java.lang.String displayError​(java.lang.String pathPrefix)
        Returns html code to display an error.

        Parameters:
        pathPrefix - to adjust the path
        Returns:
        html code
      • displayErrors

        public java.lang.String displayErrors​(java.lang.String pathPrefix)
        Returns html code to display the errors occurred.

        Parameters:
        pathPrefix - to adjust the path
        Returns:
        html code
      • getAvailableModules

        public java.util.Map<java.lang.String,​org.opencms.module.CmsModule> 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!

        Returns:
        a map with all available modules
      • getComponents

        public org.opencms.workplace.tools.CmsIdentifiableObjectContainer<CmsSetupComponentgetComponents()
        Returns the components.

        Returns:
        the components
      • getConfigRfsPath

        public java.lang.String getConfigRfsPath()
        Returns the "config" path in the OpenCms web application.

        Returns:
        the config path
      • getDatabase

        public java.lang.String getDatabase()
        Returns the key of the selected database server (e.g. "mysql", "generic" or "oracle").

        Returns:
        the key of the selected database server (e.g. "mysql", "generic" or "oracle")
      • getDatabaseConfigPage

        public java.lang.String getDatabaseConfigPage​(java.lang.String key)
        Returns the URI of a database config page (in step 3) for a specified database key.

        Parameters:
        key - the database key (e.g. "mysql", "generic" or "oracle")
        Returns:
        the URI of a database config page
      • getDatabaseLibs

        public java.util.List<java.lang.String> getDatabaseLibs​(java.lang.String databaseKey)
        Returns a list of needed jar filenames for a database server setup specified by a database key (e.g. "mysql", "generic" or "oracle").

        Parameters:
        databaseKey - a database key (e.g. "mysql", "generic" or "oracle")
        Returns:
        a list of needed jar filenames
      • getDatabaseName

        public 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. "mysql", "generic" or "oracle").

        Parameters:
        databaseKey - a database key (e.g. "mysql", "generic" or "oracle")
        Returns:
        the clear text name for a database server setup
      • getDatabaseProperties

        public java.util.Map<java.lang.String,​java.util.Properties> getDatabaseProperties()
        Returns a map with the database properties of *all* available database configurations keyed by their database keys (e.g. "mysql", "generic" or "oracle").

        Returns:
        a map with the database properties of *all* available database configurations
      • getDatabases

        public java.util.List<java.lang.String> getDatabases()
        Returns a list with they keys (e.g. "mysql", "generic" or "oracle") of all available database server setups found in "/setup/database/".

        Returns:
        a list with they keys (e.g. "mysql", "generic" or "oracle") of all available database server setups
      • getDb

        public java.lang.String getDb()
        Returns the database name.

        Returns:
        the database name
      • getDbConStrParams

        public java.lang.String getDbConStrParams()
        Returns the JDBC connect URL parameters.

        Returns:
        the JDBC connect URL parameters
      • getDbCreateConStr

        public java.lang.String getDbCreateConStr()
        Returns the database create statement.

        Returns:
        the database create statement
      • getDbCreatePwd

        public java.lang.String getDbCreatePwd()
        Returns the password used for database creation.

        Returns:
        the password used for database creation
      • getDbCreateUser

        public java.lang.String getDbCreateUser()
        Returns the database user that is used to connect to the database.

        Returns:
        the database user
      • getDbDriver

        public java.lang.String getDbDriver()
        Returns the database driver belonging to the database from the default configuration.

        Returns:
        name of the database driver
      • getDbProperty

        public java.lang.String getDbProperty​(java.lang.String key)
        Returns the value for a given key from the database properties.
        Parameters:
        key - the property key
        Returns:
        the string value for a given key
      • getDbTestQuery

        public java.lang.String getDbTestQuery()
        Returns the validation query belonging to the database from the default configuration .

        Returns:
        query used to validate connections
      • getDbWorkConStr

        public java.lang.String getDbWorkConStr()
        Returns a connection string.

        Returns:
        the connection string used by the OpenCms core
      • getDbWorkPwd

        public java.lang.String getDbWorkPwd()
        Returns the password of the database from the properties .

        Returns:
        the password for the OpenCms database user
      • getDbWorkUser

        public java.lang.String getDbWorkUser()
        Returns the user of the database from the properties.

        Returns:
        the database user used by the opencms core
      • getDefaultContentEncoding

        public java.lang.String getDefaultContentEncoding()
        Returns the default content encoding.

        Returns:
        String
      • getDefaultWebApplication

        public java.lang.String getDefaultWebApplication()
        Returns the name of the default web application, configured in web.xml.

        By default this is "ROOT".

        Returns:
        the name of the default web application, configured in web.xml
      • getDisplayForModule

        public java.lang.String getDisplayForModule​(org.opencms.module.CmsModule module)
        Returns the display string for a given module.

        Parameters:
        module - a module
        Returns:
        the display string for the given module
      • getErrors

        public java.util.List<java.lang.String> getErrors()
        Returns the error messages.

        Returns:
        a vector of error messages
      • getEthernetAddress

        public java.lang.String getEthernetAddress()
        Returns the mac ethernet address.

        Returns:
        the mac ethernet addess
      • getFullDatabaseKey

        public java.lang.String getFullDatabaseKey()
        Returns the fullDatabaseKey.

        Returns:
        the fullDatabaseKey
      • getHtmlForDbSelection

        public java.lang.String getHtmlForDbSelection()
        Generates the HTML code for the drop down for db selection.

        Returns:
        the generated HTML
      • getHtmlHelpIcon

        public 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.

        Parameters:
        id - the id of the desired help div
        pathPrefix - the path prefix to the image
        Returns:
        the HTML part for the help icon or an empty String, if the part was not found
      • getHtmlPart

        public java.lang.String getHtmlPart​(java.lang.String part)
        Returns the specified HTML part of the HTML property file to create the output.

        Parameters:
        part - the name of the desired part
        Returns:
        the HTML part or an empty String, if the part was not found
      • getHtmlPart

        public 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.

        Parameters:
        part - the name of the desired part
        replaceString - String which is inserted in the found HTML part at the location of "$replace$"
        Returns:
        the HTML part or an empty String, if the part was not found
      • getLibFolder

        public java.lang.String getLibFolder()
        Returns the path to the /WEB-INF/lib folder.

        Returns:
        the path to the /WEB-INF/lib folder
      • getLogName

        public java.lang.String getLogName()
        Returns the name of the log file.

        Returns:
        the name of the log file
      • getModuleDependencies

        public java.util.Map<java.lang.String,​java.util.List<java.lang.String>> getModuleDependencies()
        Returns a map with lists of dependent module package names keyed by module package names.

        Returns:
        a map with lists of dependent module package names keyed by module package names
      • getModuleFolder

        public java.lang.String getModuleFolder()
        Returns the absolute path to the module root folder.

        Returns:
        the absolute path to the module root folder
      • getModulesToInstall

        public java.util.List<java.lang.String> getModulesToInstall()
        Returns A list with the package names of the modules to be installed.

        Returns:
        A list with the package names of the modules to be installed
      • getPool

        public java.lang.String getPool()
        Gets the default pool.

        Returns:
        name of the default pool
      • getProperties

        public org.opencms.configuration.CmsParameterConfiguration getProperties()
        Returns the parameter configuration.

        Returns:
        the parameter configuration
      • getReplacer

        public java.util.Map<java.lang.String,​java.lang.String> getReplacer()
        Returns the replacer.

        Returns:
        the replacer
      • getServerName

        public java.lang.String getServerName()
        Return the OpenCms server name.

        Returns:
        the OpenCms server name
      • getServletConfig

        public javax.servlet.ServletConfig getServletConfig()
        Returns the initial servlet configuration.

        Returns:
        the initial servlet configuration
      • getServletMapping

        public java.lang.String getServletMapping()
        Returns the OpenCms servlet mapping, configured in web.xml.

        By default this is "/opencms/*".

        Returns:
        the OpenCms servlet mapping, configured in web.xml
      • getSortedDatabases

        public java.util.List<java.lang.String> getSortedDatabases()
        Returns a sorted list with they keys (e.g. "mysql", "generic" or "oracle") of all available database server setups found in "/setup/database/" sorted by their ranking property.

        Returns:
        a sorted list with they keys (e.g. "mysql", "generic" or "oracle") of all available database server setups
      • getWebAppRfsPath

        public java.lang.String getWebAppRfsPath()
        Returns the absolute path to the OpenCms home directory.

        Returns:
        the path to the OpenCms home directory
      • getWizardEnabled

        public boolean getWizardEnabled()
        Checks if the setup wizard is enabled.

        Returns:
        true if the setup wizard is enables, false otherwise
      • getWorkplaceSite

        public java.lang.String getWorkplaceSite()
        Return the OpenCms workplace site.

        Returns:
        the OpenCms workplace site
      • hasIndexHtml

        public boolean hasIndexHtml()
        Returns true if there is an index.html file in the default site after the module import.
        Returns:
        true if there is an index.html file
      • htmlComponents

        public java.lang.String htmlComponents()
        Returns the html code for component selection.

        Returns:
        html code
      • htmlModuleHelpDescriptions

        public java.lang.String htmlModuleHelpDescriptions()
        Returns html code for the module descriptions in help ballons.

        Returns:
        html code
      • htmlModules

        public java.lang.String htmlModules()
        Returns html for displaying a module selection box.

        Returns:
        html code
      • importModulesFromSetupBean

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

        This method is invoked as a shell command.

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

        public void init​(javax.servlet.jsp.PageContext pageContext)
        Creates a new instance of the setup Bean from a JSP page.

        Parameters:
        pageContext - the JSP's page context
      • init

        public void init​(javax.servlet.ServletContext servCtx,
                         javax.servlet.ServletConfig servConfig)
      • init

        public void init​(java.lang.String webAppRfsPath,
                         java.lang.String servletMapping,
                         java.lang.String defaultWebApplication)
        Creates a new instance of the setup Bean.

        Parameters:
        webAppRfsPath - path to the OpenCms web application
        servletMapping - the OpenCms servlet mapping
        defaultWebApplication - the name of the default web application
      • initHtmlParts

        public void initHtmlParts()
        This method reads the properties from the htmlmsg.property file and sets the HTML part properties with the matching values.

      • initShellCmsObject

        public void initShellCmsObject​(org.opencms.file.CmsObject cms,
                                       org.opencms.main.CmsShell shell)
        Specified by:
        initShellCmsObject in interface org.opencms.main.I_CmsShellCommands
        See Also:
        I_CmsShellCommands.initShellCmsObject(org.opencms.file.CmsObject, org.opencms.main.CmsShell)
      • isAutoMode

        public boolean isAutoMode()
        Returns the autoMode.

        Returns:
        the autoMode
      • isChecked

        public java.lang.String isChecked​(java.lang.String value1,
                                          java.lang.String value2)
        Over simplistic helper to compare two strings to check radio buttons.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        "checked" if both values are equal, the empty String "" otherwise
      • isInitialized

        public boolean isInitialized()
        Returns true if this setup bean is correctly initialized.

        Returns:
        true if this setup bean is correctly initialized
      • jsComponentDependencies

        public java.lang.String jsComponentDependencies()
        Returns js code with array definition for the available component dependencies.

        Returns:
        js code
      • jsComponentModules

        public java.lang.String jsComponentModules()
        Returns js code with array definition for the component modules.

        Returns:
        js code
      • jsComponentNames

        public java.lang.String jsComponentNames()
        Returns js code with array definition for the available components names.

        Returns:
        js code
      • jsModuleDependencies

        public java.lang.String jsModuleDependencies()
        Returns js code with array definition for the available module dependencies.

        Returns:
        js code
      • jsModuleNames

        public java.lang.String jsModuleNames()
        Returns js code with array definition for the available module names.

        Returns:
        js code
      • lockWizard

        public void lockWizard()
        Locks (i.e. disables) the setup wizard.

      • prepareStep10

        public void prepareStep10()
        Prepares step 10 of the setup wizard.

      • prepareStep8

        public boolean prepareStep8()
        Prepares step 8 of the setup wizard.

        Returns:
        true if the workplace should be imported
      • prepareStep8b

        public void prepareStep8b()
        Prepares step 8b of the setup wizard.

      • prepareStep8bOutput

        public void prepareStep8bOutput​(javax.servlet.jsp.JspWriter out)
                                 throws java.io.IOException
        Generates the output for step 8b of the setup wizard.

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

        public void saveProperties​(org.opencms.configuration.CmsParameterConfiguration properties,
                                   java.lang.String file,
                                   boolean backup)
        Saves properties to specified file.

        Parameters:
        properties - the properties to be saved
        file - the file to save the properties to
        backup - if true, create a backupfile
      • saveProperties

        public void saveProperties​(org.opencms.configuration.CmsParameterConfiguration properties,
                                   java.lang.String file,
                                   boolean backup,
                                   java.util.Set<java.lang.String> forceWrite)
        Saves properties to specified file.

        Parameters:
        properties - the properties to be saved
        file - the file to save the properties to
        backup - if true, create a backupfile
        forceWrite - the keys for the properties which should always be written, even if they don't exist in the configuration file
      • setAutoMode

        public void setAutoMode​(boolean autoMode)
        Sets the autoMode.

        Parameters:
        autoMode - the autoMode to set
      • setDatabase

        public void setDatabase​(java.lang.String databaseKey)
        Sets the database drivers to the given value.

        Parameters:
        databaseKey - the key of the selected database server (e.g. "mysql", "generic" or "oracle")
      • setDb

        public void setDb​(java.lang.String db)
        Sets the database name.

        Parameters:
        db - the database name to set
      • setDbConStrParams

        public void setDbConStrParams​(java.lang.String value)
        Sets the JDBC connect URL parameters.

        Parameters:
        value - the JDBC connect URL parameters
      • setDbCreateConStr

        public void setDbCreateConStr​(java.lang.String dbCreateConStr)
        Sets the database create statement.

        Parameters:
        dbCreateConStr - the database create statement
      • setDbCreatePwd

        public void setDbCreatePwd​(java.lang.String dbCreatePwd)
        Sets the password used for the initial OpenCms database creation.

        This password will not be stored permanently, but used only in the setup wizard.

        Parameters:
        dbCreatePwd - the password used for the initial OpenCms database creation
      • setDbCreateUser

        public void setDbCreateUser​(java.lang.String dbCreateUser)
        Set the database user that is used to connect to the database.

        Parameters:
        dbCreateUser - the user to set
      • setDbDriver

        public void setDbDriver​(java.lang.String driver)
        Sets the database driver belonging to the database.

        Parameters:
        driver - name of the opencms driver
      • setDbParamaters

        public boolean setDbParamaters​(javax.servlet.http.HttpServletRequest request,
                                       java.lang.String provider)
        Sets the needed database parameters.

        Parameters:
        request - the http request
        provider - the db provider
        Returns:
        true if already submitted
      • setDbParamaters

        public boolean setDbParamaters​(java.util.Map<java.lang.String,​java.lang.String[]> request,
                                       java.lang.String provider,
                                       java.lang.String contextPath,
                                       javax.servlet.http.HttpSession session)
        Sets the needed database parameters.

        Parameters:
        request - the http request
        provider - the db provider
        contextPath - the context path to use
        session - the session to use or null if running outside a servlet container
        Returns:
        true if already submitted
      • setDbProperty

        public void setDbProperty​(java.lang.String key,
                                  java.lang.String value)
        This method sets the value for a given key in the database properties.

        Parameters:
        key - The key of the property
        value - The value of the property
      • setDbWorkConStr

        public void setDbWorkConStr​(java.lang.String dbWorkConStr)
        Sets the connection string to the database to the given value.

        Parameters:
        dbWorkConStr - the connection string used by the OpenCms core
      • setDbWorkPwd

        public void setDbWorkPwd​(java.lang.String dbWorkPwd)
        Sets the password of the database to the given value.

        Parameters:
        dbWorkPwd - the password for the OpenCms database user
      • setDbWorkUser

        public void setDbWorkUser​(java.lang.String dbWorkUser)
        Sets the user of the database to the given value.

        Parameters:
        dbWorkUser - the database user used by the opencms core
      • setEthernetAddress

        public void setEthernetAddress​(java.lang.String ethernetAddress)
        Set the mac ethernet address, required for UUID generation.

        Parameters:
        ethernetAddress - the mac addess to set
      • setFullDatabaseKey

        public void setFullDatabaseKey​(java.lang.String fullDatabaseKey)
        Sets the fullDatabaseKey.

        Parameters:
        fullDatabaseKey - the fullDatabaseKey to set
      • setInstallModules

        public void setInstallModules​(java.lang.String value)
        Sets the list with the package names of the modules to be installed.

        Parameters:
        value - a string with the package names of the modules to be installed delimited by the pipe symbol "|"
      • setReplacer

        public void setReplacer​(java.util.Map<java.lang.String,​java.lang.String> map)
        Sets the replacer.

        Parameters:
        map - the replacer to set
      • setServerName

        public void setServerName​(java.lang.String name)
        Sets the OpenCms server name.

        Parameters:
        name - the OpenCms server name
      • setStartView

        public void setStartView​(java.lang.String userName,
                                 java.lang.String view)
                          throws org.opencms.main.CmsException
        Sets the start view for the given user.

        Parameters:
        userName - the name of the user
        view - the start view path
        Throws:
        org.opencms.main.CmsException - if something goes wrong
      • setWorkplaceSite

        public void setWorkplaceSite​(java.lang.String newSite)
        Sets the OpenCms workplace site.

        Parameters:
        newSite - the OpenCms workplace site
      • shellExit

        public void shellExit()
        Specified by:
        shellExit in interface org.opencms.main.I_CmsShellCommands
        See Also:
        I_CmsShellCommands.shellExit()
      • shellStart

        public void shellStart()
        Specified by:
        shellStart in interface org.opencms.main.I_CmsShellCommands
        See Also:
        I_CmsShellCommands.shellStart()
      • sortModules

        public java.util.List<java.lang.String> sortModules​(java.util.Collection<org.opencms.module.CmsModule> modules)
        Sorts the modules for display.

        Parameters:
        modules - the list of CmsModule objects
        Returns:
        a sorted list of module names
      • updateConfiguration

        public void updateConfiguration()
        Writes configuration changes back to the XML configuration.
      • validateJdbc

        public boolean validateJdbc()
        Checks the jdbc driver.

        Returns:
        true if at least one of the recommended drivers is found
      • addComponentsFromPath

        protected void addComponentsFromPath​(java.lang.String fileName)
                                      throws org.opencms.configuration.CmsConfigurationException
        Reads all components from the given location, a folder or a zip file.

        Parameters:
        fileName - the location to read the components from
        Throws:
        org.opencms.configuration.CmsConfigurationException - if something goes wrong
      • getComponentModules

        protected java.lang.String getComponentModules​(java.util.List<java.lang.String> componentIds)
        Returns a pipe separated list of module names for the given list of components.

        Parameters:
        componentIds - the list of component IDs to get the modules for
        Returns:
        a pipe separated list of module names for the given list of components
      • getComponentsProperties

        protected org.opencms.configuration.CmsParameterConfiguration getComponentsProperties​(java.lang.String location)
                                                                                       throws java.io.FileNotFoundException,
                                                                                              org.opencms.configuration.CmsConfigurationException
        Reads all properties from the components.properties file at the given location, a folder or a zip file.

        Parameters:
        location - the location to read the properties from
        Returns:
        the read properties
        Throws:
        java.io.FileNotFoundException - if the properties file could not be found
        org.opencms.configuration.CmsConfigurationException - if the something else goes wrong
      • getExtProperty

        protected java.lang.String getExtProperty​(java.lang.String key)
        Returns the value for a given key from the extended properties.
        Parameters:
        key - the property key
        Returns:
        the string value for a given key
      • htmlComponent

        protected java.lang.String htmlComponent​(CmsSetupComponent component)
        Returns html for the given component to fill the selection list.

        Parameters:
        component - the component to generate the code for
        Returns:
        html code
      • htmlModule

        protected java.lang.String htmlModule​(org.opencms.module.CmsModule module,
                                              int pos)
        Returns html for the given module to fill the selection list.

        Parameters:
        module - the module to generate the code for
        pos - the position in the list
        Returns:
        html code
      • importModuleFromDefault

        protected void importModuleFromDefault​(java.lang.String importFile)
                                        throws java.lang.Exception
        Imports a module (zipfile) from the default module directory, creating a temporary project for this.

        Parameters:
        importFile - the name of the import module located in the default module directory
        Throws:
        java.lang.Exception - if something goes wrong
        See Also:
        CmsImportExportManager.importData(CmsObject, org.opencms.report.I_CmsReport, CmsImportParameters)
      • initializeComponents

        protected void initializeComponents​(java.util.Collection<java.lang.String> modules)
        Initializes and validates the read components.

        Parameters:
        modules - a modifiable list of the modules to be imported
      • isImportRunning

        protected boolean isImportRunning()
        Returns true if the import thread is currently running.

        Returns:
        true if the import thread is currently running
      • readDatabaseConfig

        protected void readDatabaseConfig()
        Stores the properties of all available database configurations in a map keyed by their database key names (e.g. "mysql", "generic" or "oracle").

      • setExtProperty

        protected void setExtProperty​(java.lang.String key,
                                      java.lang.String value)
        This method sets the value for a given key in the extended properties.
        Parameters:
        key - The key of the property
        value - The value of the property