Package org.opencms.setup.db
Class CmsUpdateDBManager
java.lang.Object
org.opencms.setup.db.CmsUpdateDBManager
This manager controls the update of the database from OpenCms 6 to OpenCms 7.
- Since:
- 7.0.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidexecuteUpdatePlugins(Map<String, String> dbPoolData, List<I_CmsUpdateDBPart> plugins, String dbName) Executes the given update plugins.getDbDriver(String pool) Returns the configured jdbc driver for the given pool.Returns the database name.getDbParams(String pool) Returns the configured jdbc url parameters for the given pool.Returns the configured jdbc connection url for the given pool.Returns the configured database user for the given pool.doubleReturns the detected mayor version, based on DB structure.protected I_CmsUpdateDBPartgetInstanceForDb(I_CmsUpdateDBPart dbUpdater, String dbName) Creates a new instance for the given database and setting the db pool data.protected StringgetLegacyUpdateDbName(Map<String, String> dbPoolData) Returns the database implementation name for legacy database updates.protected voidgetMySqlEngine(Map<String, String> dbPoolData) Retrieves the mysql engine name.protected voidgetOracleTablespaces(Map<String, String> dbPoolData) Retrieves the oracle tablespace names.getPools()Returns all configured database pools.protected voidgetPostgreSqlTablespaces(Map<String, String> dbPoolData) Retrieves the postgresql tablespace names.protected StringgetSchemaUpdateDbName(Map<String, String> dbPoolData) Returns the database implementation name for schema based database updates.protected booleanhasStorageContentIndex(CmsSetupDb setupDb) Checks if the content table storage index exists.protected booleanhasStorageContentStorageIndex(CmsSetupDb setupDb) Checks if the content table storage-leading index exists.protected booleanhasStorageOfflineContentIndex(CmsSetupDb setupDb) Checks if the offline content table storage index exists.protected booleanChecks if the offline content table storage-leading index exists.Generates html code for the given db pool.voidinitialize(CmsUpdateBean updateBean) Initializes the Update Manager object with the updateBean to get the database connection.booleanChecks if the storage schema update is enabled by configuration.protected booleanChecks if the storage schema is missing or incomplete for the default database pool.booleanneedsStorageSchemaUpdate(CmsSetupDb setupDb) Checks if the storage schema is missing or incomplete.booleanChecks if an update is needed.voidrun()Updates all database pools.voidupdateDatabase(String pool) Updates the database.
-
Field Details
-
PARAM_STORAGE_SCHEMA_UPDATE
Property for controlling the storage schema update.- See Also:
-
STORAGE_SCHEMA_UPDATE_AUTO
Automatic storage schema update mode.- See Also:
-
STORAGE_SCHEMA_UPDATE_FALSE
Disabled storage schema update mode.- See Also:
-
STORAGE_SCHEMA_UPDATE_TRUE
Enabled storage schema update mode.- See Also:
-
-
Constructor Details
-
CmsUpdateDBManager
public CmsUpdateDBManager()Default constructor.
-
-
Method Details
-
getDbDriver
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
Returns the database name.- Returns:
- the database name
-
getDbParams
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
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
Returns the configured database user for the given pool.- Parameters:
pool- the db pool to get the user for- Returns:
- the database user
-
getDetectedVersion
Returns the detected mayor version, based on DB structure.- Returns:
- the detected mayor version
-
getPools
Returns all configured database pools.- Returns:
- a list of
Stringobjects
-
htmlPool
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
-
initialize
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
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
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
Checks if an update is needed.- Returns:
- if an update is needed
-
run
Updates all database pools. -
updateDatabase
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 dataplugins- the update pluginsdbName- the database implementation name
-
getInstanceForDb
Creates a new instance for the given database and setting the db pool data.- Parameters:
dbUpdater- the generic updater partdbName- the database to get a new instance for- Returns:
- right instance instance for the given database
-
getLegacyUpdateDbName
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
Retrieves the mysql engine name.- Parameters:
dbPoolData- the database pool data
-
getOracleTablespaces
Retrieves the oracle tablespace names.- Parameters:
dbPoolData- the database pool data
-
getPostgreSqlTablespaces
Retrieves the postgresql tablespace names.- Parameters:
dbPoolData- the database pool data
-
getSchemaUpdateDbName
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
Checks if the content table storage index exists.- Parameters:
setupDb- the database connection- Returns:
- true if the index exists
-
hasStorageContentStorageIndex
Checks if the content table storage-leading index exists.- Parameters:
setupDb- the database connection- Returns:
- true if the index exists
-
hasStorageOfflineContentIndex
Checks if the offline content table storage index exists.- Parameters:
setupDb- the database connection- Returns:
- true if the index exists
-
hasStorageOfflineContentStorageIndex
Checks if the offline content table storage-leading index exists.- Parameters:
setupDb- the database connection- Returns:
- true if the index exists
-
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
-