public class DbSchemaUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ALTER_TABLE_PREFIX |
static java.lang.String |
CREATE_INDEX_PREFIX |
static java.lang.String |
CREATE_SEQUENCE_PREFIX |
static java.lang.String |
CREATE_TABLE_PREFIX |
static java.lang.String |
CREATE_VIEW_PREFIX |
protected static org.openmdx.base.dataprovider.layer.persistence.jdbc.Database_2[] |
databasePlugIns |
protected static int |
FETCH_SIZE |
protected static java.util.Set<java.lang.String> |
HIDDEN_FILES |
static java.util.Set<java.lang.String> |
OPTIONAL_DBOBJECTS |
protected static boolean |
schemaPrepared |
Constructor and Description |
---|
DbSchemaUtils() |
Modifier and Type | Method and Description |
---|---|
protected static org.openmdx.base.dataprovider.layer.persistence.jdbc.Database_2[] |
getDatabasePlugIns()
Get database plug-ins configuration.
|
protected static java.util.List<org.openmdx.base.naming.Path> |
getIdentityPatterns(org.openmdx.base.mof.cci.ModelElement_1_0 classDef,
org.openmdx.base.naming.Path segmentIdentity,
java.lang.String referenceName)
Get identity patterns for given class in case the class has references matching the
referenceName and the identity pattern matches the segment authority.
|
static java.util.List<java.lang.String> |
getIndexNames()
Get all index names from reference schema.
|
static java.util.List<java.lang.String> |
getIndexNames(java.sql.Connection connS)
Get all index names from reference schema.
|
static java.lang.String |
getJdbcDriverName(java.lang.String connectionUrl) |
protected static java.lang.String |
getObjectDefinition(java.lang.String type,
java.lang.String object,
java.util.List<java.lang.String> schema,
java.lang.String targetDatabaseName,
boolean replaceObject)
Get definition for given db object from reference schema.
|
protected static java.util.List<java.lang.String> |
getSchema(java.sql.Connection conn)
Get reference schema.
|
protected static java.sql.Connection |
getSchemaConnection()
Get connection to database holding the schema.
|
static java.util.List<java.lang.String> |
getSequenceNames()
Get all sequence names from reference schema.
|
static java.util.List<java.lang.String> |
getSequenceNames(java.sql.Connection connS)
Get all sequence names from reference schema.
|
static java.util.List<java.lang.String> |
getTableNames()
Get all table names from reference schema.
|
static java.util.List<java.lang.String> |
getTableNames(java.sql.Connection connS)
Get all table names from reference schema.
|
static java.util.List<java.lang.String> |
getViewNames()
Get all view names from reference schema.
|
static java.util.List<java.lang.String> |
getViewNames(java.sql.Connection connS)
Get all view names from reference schema.
|
protected static java.util.Set<java.io.File> |
listFilesRecursively(java.io.File dir)
Recursiviley list files of dir.
|
static java.lang.String |
mapColumnDefinition(java.lang.String targetDatabaseName,
java.lang.String command)
Map HSQLDB column definition to target database specific column definition.
|
static java.util.List<java.lang.String> |
migrateData(java.sql.Connection connT,
boolean fix)
Migrate data from an older schema version to latest version.
|
static java.util.List<java.lang.String> |
migrateMediaToDB(java.lang.String providerName,
javax.jdo.PersistenceManager pm)
Migrate media to file system in case org.opencrx.mediadir.* is set.
|
static java.util.List<java.lang.String> |
migrateMediaToFS(java.lang.String providerName,
javax.jdo.PersistenceManager pm,
java.sql.Connection connT,
boolean validateOnly)
Migrate media to file system in case org.opencrx.mediadir.* is set.
|
static java.util.List<java.lang.String> |
validateIndexes(java.sql.Connection connT,
boolean fix)
Validate existence of indexes with reference schema.
|
static java.util.List<java.lang.String> |
validateSequences(java.sql.Connection connT,
boolean fix)
Validate existence of sequences with reference schema.
|
static java.util.List<java.lang.String> |
validateTableColumns(java.sql.Connection connT,
boolean fix)
Compare columns of all tables with reference schema.
|
static java.util.List<java.lang.String> |
validateTables(java.sql.Connection connT,
boolean fix)
Compare tables of given database with reference schema.
|
static java.util.List<java.lang.String> |
validateViews(java.sql.Connection connT,
boolean fix)
Validate existence of views with reference schema.
|
protected static final int FETCH_SIZE
protected static final java.util.Set<java.lang.String> HIDDEN_FILES
public static final java.lang.String CREATE_TABLE_PREFIX
public static final java.lang.String CREATE_VIEW_PREFIX
public static final java.lang.String CREATE_SEQUENCE_PREFIX
public static final java.lang.String CREATE_INDEX_PREFIX
public static final java.lang.String ALTER_TABLE_PREFIX
public static final java.util.Set<java.lang.String> OPTIONAL_DBOBJECTS
protected static boolean schemaPrepared
protected static org.openmdx.base.dataprovider.layer.persistence.jdbc.Database_2[] databasePlugIns
public static java.lang.String getJdbcDriverName(java.lang.String connectionUrl)
protected static java.sql.Connection getSchemaConnection() throws org.openmdx.base.exception.ServiceException
org.openmdx.base.exception.ServiceException
protected static java.util.List<java.lang.String> getSchema(java.sql.Connection conn) throws org.openmdx.base.exception.ServiceException
org.openmdx.base.exception.ServiceException
protected static java.lang.String getObjectDefinition(java.lang.String type, java.lang.String object, java.util.List<java.lang.String> schema, java.lang.String targetDatabaseName, boolean replaceObject)
type
- object
- schema
- targetDatabaseName
- replaceObject
- public static java.lang.String mapColumnDefinition(java.lang.String targetDatabaseName, java.lang.String command)
targetDatabaseName
- command
- public static java.util.List<java.lang.String> getTableNames() throws org.openmdx.base.exception.ServiceException
org.openmdx.base.exception.ServiceException
public static java.util.List<java.lang.String> getTableNames(java.sql.Connection connS) throws org.openmdx.base.exception.ServiceException
org.openmdx.base.exception.ServiceException
public static java.util.List<java.lang.String> getViewNames(java.sql.Connection connS) throws org.openmdx.base.exception.ServiceException
org.openmdx.base.exception.ServiceException
public static java.util.List<java.lang.String> getViewNames() throws org.openmdx.base.exception.ServiceException
org.openmdx.base.exception.ServiceException
public static java.util.List<java.lang.String> getIndexNames(java.sql.Connection connS) throws org.openmdx.base.exception.ServiceException
org.openmdx.base.exception.ServiceException
public static java.util.List<java.lang.String> getIndexNames() throws org.openmdx.base.exception.ServiceException
org.openmdx.base.exception.ServiceException
public static java.util.List<java.lang.String> getSequenceNames(java.sql.Connection connS) throws org.openmdx.base.exception.ServiceException
org.openmdx.base.exception.ServiceException
public static java.util.List<java.lang.String> getSequenceNames() throws org.openmdx.base.exception.ServiceException
org.openmdx.base.exception.ServiceException
public static java.util.List<java.lang.String> validateTables(java.sql.Connection connT, boolean fix) throws org.openmdx.base.exception.ServiceException
connT
- fix
- org.openmdx.base.exception.ServiceException
public static java.util.List<java.lang.String> validateTableColumns(java.sql.Connection connT, boolean fix) throws org.openmdx.base.exception.ServiceException
connT
- fix
- org.openmdx.base.exception.ServiceException
public static java.util.List<java.lang.String> validateViews(java.sql.Connection connT, boolean fix) throws org.openmdx.base.exception.ServiceException
connT
- fix
- org.openmdx.base.exception.ServiceException
public static java.util.List<java.lang.String> migrateData(java.sql.Connection connT, boolean fix) throws org.openmdx.base.exception.ServiceException
connT
- fix
- org.openmdx.base.exception.ServiceException
protected static java.util.List<org.openmdx.base.naming.Path> getIdentityPatterns(org.openmdx.base.mof.cci.ModelElement_1_0 classDef, org.openmdx.base.naming.Path segmentIdentity, java.lang.String referenceName) throws org.openmdx.base.exception.ServiceException
classDef
- segmentIdentity
- referenceName
- org.openmdx.base.exception.ServiceException
protected static java.util.Set<java.io.File> listFilesRecursively(java.io.File dir)
dir
- public static java.util.List<java.lang.String> migrateMediaToFS(java.lang.String providerName, javax.jdo.PersistenceManager pm, java.sql.Connection connT, boolean validateOnly) throws org.openmdx.base.exception.ServiceException
segment
- org.openmdx.base.exception.ServiceException
public static java.util.List<java.lang.String> migrateMediaToDB(java.lang.String providerName, javax.jdo.PersistenceManager pm) throws org.openmdx.base.exception.ServiceException
segment
- org.openmdx.base.exception.ServiceException
public static java.util.List<java.lang.String> validateIndexes(java.sql.Connection connT, boolean fix) throws org.openmdx.base.exception.ServiceException
connT
- fix
- org.openmdx.base.exception.ServiceException
public static java.util.List<java.lang.String> validateSequences(java.sql.Connection connT, boolean fix) throws org.openmdx.base.exception.ServiceException
connT
- fix
- org.openmdx.base.exception.ServiceException
protected static org.openmdx.base.dataprovider.layer.persistence.jdbc.Database_2[] getDatabasePlugIns() throws org.openmdx.base.exception.ServiceException
org.openmdx.base.exception.ServiceException
This software is published under the BSD license. Copyright © 2003-${build.year}, CRIXP AG, Switzerland, All rights reserved. Use is subject to license terms.