Class CmsAutoSetupProperties


  • public final class CmsAutoSetupProperties
    extends java.lang.Object
    Reads and manages the configuration file for the OpenCms auto-setup.

    Note that each property set in the file is overwritten if the identical property is set as Java system property (what is used, e.g., by the setup wizard). Moreover, the property setup.install.components can be set via an accordingly named environment variable.

    Since:
    6.0.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static org.apache.commons.logging.Log LOG
      The log object for this class.
      static java.lang.String PROP_DB_CONNECTION_STRING_PARAMS
      The DB connection string parameters property name.
      static java.lang.String PROP_DB_CONNECTION_URL
      The property key db.connection.url for providing the JDBC connection string, e.g., jdbc:mysql://localhost:3306/ for the default MySQL installation.
      static java.lang.String PROP_DB_CREATE_DB
      The property key db.create.db for specifying if the database should be created during the setup.
      static java.lang.String PROP_DB_CREATE_PWD
      The property key db.create.pwd for specifying the password for the database user that is used during the setup connection.
      static java.lang.String PROP_DB_CREATE_TABLES
      The property key db.create.tables for specifying if the database tables in the OpenCms database should be created.
      static java.lang.String PROP_DB_CREATE_USER
      The property key db.create.user for specifying the name of the database user that is used during the setup connection.
      static java.lang.String PROP_DB_DEFAULT_TABLESPACE
      The property key db.default.tablespace necessary dependent on the chosen DBMS.
      static java.lang.String PROP_DB_DROP_DB
      The property key db.dropDb for specifying if an existing database should be dropped when the setup is configured to create a database with the same name.
      static java.lang.String PROP_DB_INDEX_TABLESPACE
      The property key db.index.tablespace necessary dependent on the chosen DBMS.
      static java.lang.String PROP_DB_JDBC_DRIVER
      The property key db.jdbc.driver for specifying the fully qualified name of the Java class implementing the JDBC driver to use for the connection.
      static java.lang.String PROP_DB_NAME
      The property key db.name for specifying the name of the database used by OpenCms, e.g.
      static java.lang.String PROP_DB_PRODUCT
      The property key db.product for specifying the used DBMS.
      static java.lang.String PROP_DB_PROVIDER
      The property key db.provider for specifying the database provider.
      static java.lang.String PROP_DB_TEMPLATE_DB
      The property key db.template.db necessary dependent of the chosen DBMS.
      static java.lang.String PROP_DB_TEMPORARY_TABLESPACE
      The property key db.temporary.tablespace necessary dependent of the chosen DBMS..
      static java.lang.String PROP_DB_WORKER_PWD
      The property key db.worker.pwd for providing the password of the database user that is used when running OpenCms after the setup.
      static java.lang.String PROP_DB_WORKER_USER
      The property key db.worker.user for providing the name of the database user that is used for the connection when running OpenCms after the setup.
      static java.lang.String PROP_SERVER_ETHERNET_ADDRESS
      The property key server.ethernet.address.
      static java.lang.String PROP_SERVER_NAME
      The property key server.name for specifying the server's name.
      static java.lang.String PROP_SERVER_SERVLET_MAPPING
      The property key server.servlet.mapping for specifying the name of the OpenCms servlet (by default opencms).
      static java.lang.String PROP_SERVER_URL
      The property key server.url for specifying the server's URL.
      static java.lang.String PROP_SETUP_DEFAULT_WEBAPP
      The property key setup.default.webapp.
      static java.lang.String PROP_SETUP_INSTALL_COMPONENTS
      The property key setup.install.components to choose the components that should be installed during the setup.
      static java.lang.String PROP_SETUP_SHOW_PROGRESS
      The property key setup.show.progress to specify if dots '.' should be printed to the real STDOUT while a setup is in progress.
      static java.lang.String PROP_SETUP_WEBAPP_PATH
      The property key setup.webapp.path to specify the path of the OpenCms webapp to install, e.g., /var/lib/tomcat7/webapps/opencms.
    • Constructor Summary

      Constructors 
      Constructor Description
      CmsAutoSetupProperties​(java.lang.String propertiesFile)
      Public constructor.
    • Field Detail

      • LOG

        public static final org.apache.commons.logging.Log LOG
        The log object for this class.
      • PROP_DB_CONNECTION_URL

        public static final java.lang.String PROP_DB_CONNECTION_URL
        The property key db.connection.url for providing the JDBC connection string, e.g., jdbc:mysql://localhost:3306/ for the default MySQL installation.
        See Also:
        Constant Field Values
      • PROP_DB_CREATE_DB

        public static final java.lang.String PROP_DB_CREATE_DB
        The property key db.create.db for specifying if the database should be created during the setup.

        Set to true to create the database automatically, or false if it should not.

        NOTE: Automatic database creation is not supported for all DBMSs.

        See Also:
        Constant Field Values
      • PROP_DB_CREATE_PWD

        public static final java.lang.String PROP_DB_CREATE_PWD
        The property key db.create.pwd for specifying the password for the database user that is used during the setup connection.
        See Also:
        Constant Field Values
      • PROP_DB_CREATE_TABLES

        public static final java.lang.String PROP_DB_CREATE_TABLES
        The property key db.create.tables for specifying if the database tables in the OpenCms database should be created.

        Set to true to create the database automatically, or false if it should not.

        See Also:
        Constant Field Values
      • PROP_DB_CREATE_USER

        public static final java.lang.String PROP_DB_CREATE_USER
        The property key db.create.user for specifying the name of the database user that is used during the setup connection. NOTE: The user must have administration permissions. The user data is deleted, when the setup is finished.
        See Also:
        Constant Field Values
      • PROP_DB_DROP_DB

        public static final java.lang.String PROP_DB_DROP_DB
        The property key db.dropDb for specifying if an existing database should be dropped when the setup is configured to create a database with the same name. Set to true if existing databases should be dropped when necessary, or to false if not.
        See Also:
        Constant Field Values
      • PROP_DB_JDBC_DRIVER

        public static final java.lang.String PROP_DB_JDBC_DRIVER
        The property key db.jdbc.driver for specifying the fully qualified name of the Java class implementing the JDBC driver to use for the connection.

        Hint: The names can be found in the database.properties file in the webapp' folders setup/database//.

        See Also:
        Constant Field Values
      • PROP_DB_NAME

        public static final java.lang.String PROP_DB_NAME
        The property key db.name for specifying the name of the database used by OpenCms, e.g. choose "opencms".
        See Also:
        Constant Field Values
      • PROP_DB_PRODUCT

        public static final java.lang.String PROP_DB_PRODUCT
        The property key db.product for specifying the used DBMS. Values should match the folders under the OpenCms webapp's folder setup/database/.
        See Also:
        Constant Field Values
      • PROP_DB_WORKER_PWD

        public static final java.lang.String PROP_DB_WORKER_PWD
        The property key db.worker.pwd for providing the password of the database user that is used when running OpenCms after the setup. CAUTION: For security reasons, the user should not have administration permissions. The user data is stored in the opencms.properties file after the setup.
        See Also:
        Constant Field Values
      • PROP_DB_WORKER_USER

        public static final java.lang.String PROP_DB_WORKER_USER
        The property key db.worker.user for providing the name of the database user that is used for the connection when running OpenCms after the setup. CAUTION: For security reasons, the user should not have administration permissions. The user data is stored in the opencms.properties file after the setup. .
        See Also:
        Constant Field Values
      • PROP_SERVER_ETHERNET_ADDRESS

        public static final java.lang.String PROP_SERVER_ETHERNET_ADDRESS
        The property key server.ethernet.address. Specify a valid MAC-Address. It is used internally by OpenCms. (If not given, the address is generated automatically.)
        See Also:
        Constant Field Values
      • PROP_SERVER_NAME

        public static final java.lang.String PROP_SERVER_NAME
        The property key server.name for specifying the server's name. Special server names are of particular interest in a cluster installation.
        See Also:
        Constant Field Values
      • PROP_SERVER_URL

        public static final java.lang.String PROP_SERVER_URL
        The property key server.url for specifying the server's URL. It is used, e.g., for the site configuration.
        See Also:
        Constant Field Values
      • PROP_SETUP_DEFAULT_WEBAPP

        public static final java.lang.String PROP_SETUP_DEFAULT_WEBAPP
        The property key setup.default.webapp. Provide the default webapp in your servlet container (Default: ROOT).
        See Also:
        Constant Field Values
      • PROP_SETUP_INSTALL_COMPONENTS

        public static final java.lang.String PROP_SETUP_INSTALL_COMPONENTS
        The property key setup.install.components to choose the components that should be installed during the setup.

        The available components are configured in setup/components.properties in the webapp's folder.

        NOTE: You can specify the components to install also as Java system property (highest priority) or via an environment variable (second choice). The value specified in the configuration file is only the third choice.

        See Also:
        Constant Field Values
      • PROP_SETUP_SHOW_PROGRESS

        public static final java.lang.String PROP_SETUP_SHOW_PROGRESS
        The property key setup.show.progress to specify if dots '.' should be printed to the real STDOUT while a setup is in progress.
        See Also:
        Constant Field Values
      • PROP_SETUP_WEBAPP_PATH

        public static final java.lang.String PROP_SETUP_WEBAPP_PATH
        The property key setup.webapp.path to specify the path of the OpenCms webapp to install, e.g., /var/lib/tomcat7/webapps/opencms.
        See Also:
        Constant Field Values
    • Constructor Detail

      • CmsAutoSetupProperties

        public CmsAutoSetupProperties​(java.lang.String propertiesFile)
                               throws java.io.IOException,
                                      java.lang.SecurityException
        Public constructor.

        Parameters:
        propertiesFile - the path to the setup properties file
        Throws:
        java.io.IOException - if the property file could not be read
        java.lang.SecurityException - if the environment variables could not be read
    • Method Detail

      • getConnectionUrl

        public java.lang.String getConnectionUrl()
        Returns the connectionUrl.

        Returns:
        the connectionUrl
      • getConStrParams

        public java.lang.String getConStrParams()
        Returns the DB connection string parameters.

        Returns:
        the DB connection string parameters
      • getCreatePwd

        public java.lang.String getCreatePwd()
        Returns the createPwd.

        Returns:
        the createPwd
      • getCreateUser

        public java.lang.String getCreateUser()
        Returns the createUser.

        Returns:
        the createUser
      • getDbName

        public java.lang.String getDbName()
        Returns:
        the name of the db name used
      • getDbProduct

        public java.lang.String getDbProduct()
        Returns:
        the name of the db product used
      • getDbProvider

        public java.lang.String getDbProvider()
        Returns the dbProvider.

        Returns:
        the dbProvider
      • getDefaultTablespace

        public java.lang.String getDefaultTablespace()
        Returns the defaultTablespace.

        Returns:
        the defaultTablespace
      • getEthernetAddress

        public java.lang.String getEthernetAddress()
        Returns the ethernetAddress.

        Returns:
        the ethernetAddress
      • getIndexTablespace

        public java.lang.String getIndexTablespace()
        Returns the indexTablespace.

        Returns:
        the indexTablespace
      • getInstallComponents

        public java.util.List<java.lang.String> getInstallComponents()
        Returns the installComponents.

        Returns:
        the installComponents
      • getJdbcDriver

        public java.lang.String getJdbcDriver()
        Returns the jdbcDriver.

        Returns:
        the jdbcDriver
      • getServeltMapping

        public java.lang.String getServeltMapping()
        Returns the serveltMapping.

        Returns:
        the serveltMapping
      • getServerName

        public java.lang.String getServerName()
        Returns the serverName.

        Returns:
        the serverName
      • getServerUrl

        public java.lang.String getServerUrl()
        Returns the serverUrl.

        Returns:
        the serverUrl
      • getSetupConfiguration

        public org.opencms.configuration.CmsParameterConfiguration getSetupConfiguration()
        Returns the setup configuration object.

        Returns:
        the setup configuration object
      • getSetupDefaultWebappName

        public java.lang.String getSetupDefaultWebappName()
        Returns the setupWebappName.

        Returns:
        the setupWebappName
      • getSetupWebappPath

        public java.lang.String getSetupWebappPath()
        Returns the setupWebappPath.

        Returns:
        the setupWebappPath
      • getTemplateDb

        public java.lang.String getTemplateDb()
        Returns the templateDb.

        Returns:
        the templateDb
      • getTemporaryTablespace

        public java.lang.String getTemporaryTablespace()
        Returns the temporaryTablespace.

        Returns:
        the temporaryTablespace
      • getWebappPath

        public java.lang.String getWebappPath()
        Returns the webappPath.

        Returns:
        the webappPath
      • getWorkerPwd

        public java.lang.String getWorkerPwd()
        Returns the workerPwd.

        Returns:
        the workerPwd
      • getWorkerUser

        public java.lang.String getWorkerUser()
        Returns the workerUser.

        Returns:
        the workerUser
      • isCreateDb

        public boolean isCreateDb()
        Returns the createDb.

        Returns:
        the createDb
      • isCreateTables

        public boolean isCreateTables()
        Returns the createTables.

        Returns:
        the createTables
      • isDropDb

        public boolean isDropDb()
        Returns the dropDb.

        Returns:
        the dropDb
      • isShowProgress

        public boolean isShowProgress()
        Indicates if dots '.' should be printed to the real STDOUT while a setup is in progress.

        Returns:
        true if dots '.' should be printed to the real STDOUT while a setup is in progress
      • toParameterMap

        public java.util.Map<java.lang.String,​java.lang.String[]> toParameterMap()
        Converts and returns this object as map.

        Returns:
        this object as map