Package org.opencms.setup.db
Class CmsUpdateDBManager
- java.lang.Object
-
- org.opencms.setup.db.CmsUpdateDBManager
-
public class CmsUpdateDBManager extends java.lang.Object
This manager controls the update of the database from OpenCms 6 to OpenCms 7.- Since:
- 7.0.0
-
-
Constructor Summary
Constructors Constructor Description CmsUpdateDBManager()
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getDbDriver(java.lang.String pool)
Returns the configured jdbc driver for the given pool.java.lang.String
getDbName()
Returns the database name.java.lang.String
getDbParams(java.lang.String pool)
Returns the configured jdbc url parameters for the given pool.java.lang.String
getDbUrl(java.lang.String pool)
Returns the configured jdbc connection url for the given pool.java.lang.String
getDbUser(java.lang.String pool)
Returns the configured database user for the given pool.double
getDetectedVersion()
Returns the detected mayor version, based on DB structure.protected I_CmsUpdateDBPart
getInstanceForDb(I_CmsUpdateDBPart dbUpdater, java.lang.String dbName)
Creates a new instance for the given database and setting the db pool data.protected void
getMySqlEngine(java.util.Map<java.lang.String,java.lang.String> dbPoolData)
Retrieves the mysql engine name.protected void
getOracleTablespaces(java.util.Map<java.lang.String,java.lang.String> dbPoolData)
Retrieves the oracle tablespace names.java.util.List<java.lang.String>
getPools()
Returns all configured database pools.protected void
getPostgreSqlTablespaces(java.util.Map<java.lang.String,java.lang.String> dbPoolData)
Retrieves the postgresql tablespace names.java.lang.String
htmlPool(java.lang.String pool)
Generates html code for the given db pool.java.lang.String
htmlPool(java.lang.String pool, boolean hiddenInfo)
void
initialize(CmsUpdateBean updateBean)
Initializes the Update Manager object with the updateBean to get the database connection.boolean
needUpdate()
Checks if an update is needed.void
run()
Updates all database pools.void
updateDatabase(java.lang.String pool)
Updates the database.
-
-
-
Constructor Detail
-
CmsUpdateDBManager
public CmsUpdateDBManager()
Default constructor.
-
-
Method Detail
-
getDbDriver
public java.lang.String getDbDriver(java.lang.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 java.lang.String getDbName()
Returns the database name.- Returns:
- the database name
-
getDbParams
public java.lang.String getDbParams(java.lang.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 java.lang.String getDbUrl(java.lang.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 java.lang.String getDbUser(java.lang.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 java.util.List<java.lang.String> getPools()
Returns all configured database pools.- Returns:
- a list of
String
objects
-
htmlPool
public java.lang.String htmlPool(java.lang.String pool) throws java.lang.Exception
Generates html code for the given db pool.- Parameters:
pool
- the db pool to generate html for- Returns:
- html code
- Throws:
java.lang.Exception
- if something goes wrong
-
htmlPool
public java.lang.String htmlPool(java.lang.String pool, boolean hiddenInfo)
-
initialize
public void initialize(CmsUpdateBean updateBean) throws java.lang.Exception
Initializes the Update Manager object with the updateBean to get the database connection.- Parameters:
updateBean
- the update bean with the database connection- Throws:
java.lang.Exception
- if the setup bean is not initialized
-
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(java.lang.String pool)
Updates the database.- Parameters:
pool
- the database pool to update
-
getInstanceForDb
protected I_CmsUpdateDBPart getInstanceForDb(I_CmsUpdateDBPart dbUpdater, java.lang.String dbName)
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
-
getMySqlEngine
protected void getMySqlEngine(java.util.Map<java.lang.String,java.lang.String> dbPoolData)
Retrieves the mysql engine name.- Parameters:
dbPoolData
- the database pool data
-
getOracleTablespaces
protected void getOracleTablespaces(java.util.Map<java.lang.String,java.lang.String> dbPoolData)
Retrieves the oracle tablespace names.- Parameters:
dbPoolData
- the database pool data
-
getPostgreSqlTablespaces
protected void getPostgreSqlTablespaces(java.util.Map<java.lang.String,java.lang.String> dbPoolData)
Retrieves the postgresql tablespace names.- Parameters:
dbPoolData
- the database pool data
-
-