Class CmsUpdateDBManager

java.lang.Object
org.opencms.setup.db.CmsUpdateDBManager

public class CmsUpdateDBManager extends Object
This manager controls the update of the database from OpenCms 6 to OpenCms 7.

Since:
7.0.0
  • Field Details

  • Constructor Details

  • Method Details

    • getDbDriver

      public String getDbDriver(String pool)
      Returns the configured jdbc driver for the given pool.

      Parameters:
      pool - the db pool to get the driver for
      Returns:
      the driver class name
    • getDbName

      public String getDbName()
      Returns the database name.

      Returns:
      the database name
    • getDbParams

      public String getDbParams(String pool)
      Returns the configured jdbc url parameters for the given pool.

      Parameters:
      pool - the db pool to get the params for
      Returns:
      the jdbc url parameters
    • getDbUrl

      public String getDbUrl(String pool)
      Returns the configured jdbc connection url for the given pool.

      Parameters:
      pool - the db pool to get the url for
      Returns:
      the jdbc connection url
    • getDbUser

      public String getDbUser(String pool)
      Returns the configured database user for the given pool.

      Parameters:
      pool - the db pool to get the user for
      Returns:
      the database user
    • getDetectedVersion

      public double getDetectedVersion()
      Returns the detected mayor version, based on DB structure.

      Returns:
      the detected mayor version
    • getPools

      public List<String> getPools()
      Returns all configured database pools.

      Returns:
      a list of String objects
    • htmlPool

      public String htmlPool(String pool) throws Exception
      Generates html code for the given db pool.

      Parameters:
      pool - the db pool to generate html for
      Returns:
      html code
      Throws:
      Exception - if something goes wrong
    • htmlPool

      public String htmlPool(String pool, boolean hiddenInfo)
    • initialize

      public void initialize(CmsUpdateBean updateBean) throws Exception
      Initializes the Update Manager object with the updateBean to get the database connection.

      Parameters:
      updateBean - the update bean with the database connection
      Throws:
      Exception - if the setup bean is not initialized
    • isStorageSchemaUpdateEnabled

      public boolean isStorageSchemaUpdateEnabled(String value)
      Checks if the storage schema update is enabled by configuration.

      Parameters:
      value - the configured value
      Returns:
      true if the storage schema should be updated if needed
    • needsStorageSchemaUpdate

      public boolean needsStorageSchemaUpdate(CmsSetupDb setupDb)
      Checks if the storage schema is missing or incomplete.

      Parameters:
      setupDb - the database connection
      Returns:
      true if the storage schema needs to be updated
    • needUpdate

      public boolean needUpdate()
      Checks if an update is needed.

      Returns:
      if an update is needed
    • run

      public void run()
      Updates all database pools.

    • updateDatabase

      public void updateDatabase(String pool)
      Updates the database.

      Parameters:
      pool - the database pool to update
    • executeUpdatePlugins

      protected void executeUpdatePlugins(Map<String,String> dbPoolData, List<I_CmsUpdateDBPart> plugins, String dbName)
      Executes the given update plugins.

      Parameters:
      dbPoolData - the database pool data
      plugins - the update plugins
      dbName - the database implementation name
    • getInstanceForDb

      Creates a new instance for the given database and setting the db pool data.

      Parameters:
      dbUpdater - the generic updater part
      dbName - the database to get a new instance for
      Returns:
      right instance instance for the given database
    • getLegacyUpdateDbName

      protected String getLegacyUpdateDbName(Map<String,String> dbPoolData)
      Returns the database implementation name for legacy database updates.

      Parameters:
      dbPoolData - the database pool data
      Returns:
      the database implementation name, or null if the database is not supported by the legacy updater
    • getMySqlEngine

      protected void getMySqlEngine(Map<String,String> dbPoolData)
      Retrieves the mysql engine name.

      Parameters:
      dbPoolData - the database pool data
    • getOracleTablespaces

      protected void getOracleTablespaces(Map<String,String> dbPoolData)
      Retrieves the oracle tablespace names.

      Parameters:
      dbPoolData - the database pool data
    • getPostgreSqlTablespaces

      protected void getPostgreSqlTablespaces(Map<String,String> dbPoolData)
      Retrieves the postgresql tablespace names.

      Parameters:
      dbPoolData - the database pool data
    • getSchemaUpdateDbName

      protected String getSchemaUpdateDbName(Map<String,String> dbPoolData)
      Returns the database implementation name for schema based database updates.

      Parameters:
      dbPoolData - the database pool data
      Returns:
      the database implementation name, or null if the database is not supported
    • hasStorageContentIndex

      protected boolean hasStorageContentIndex(CmsSetupDb setupDb)
      Checks if the content table storage index exists.

      Parameters:
      setupDb - the database connection
      Returns:
      true if the index exists
    • hasStorageContentStorageIndex

      protected boolean hasStorageContentStorageIndex(CmsSetupDb setupDb)
      Checks if the content table storage-leading index exists.

      Parameters:
      setupDb - the database connection
      Returns:
      true if the index exists
    • hasStorageOfflineContentIndex

      protected boolean hasStorageOfflineContentIndex(CmsSetupDb setupDb)
      Checks if the offline content table storage index exists.

      Parameters:
      setupDb - the database connection
      Returns:
      true if the index exists
    • hasStorageOfflineContentStorageIndex

      protected boolean hasStorageOfflineContentStorageIndex(CmsSetupDb setupDb)
      Checks if the offline content table storage-leading index exists.

      Parameters:
      setupDb - the database connection
      Returns:
      true if the index exists
    • needsStorageSchemaUpdate

      protected boolean needsStorageSchemaUpdate()
      Checks if the storage schema is missing or incomplete for the default database pool.

      Returns:
      true if the storage schema needs to be updated