public class DbSchemaUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
ALTER_TABLE_PREFIX |
static String |
CREATE_INDEX_PREFIX |
static String |
CREATE_SEQUENCE_PREFIX |
static String |
CREATE_TABLE_PREFIX |
static String |
CREATE_VIEW_PREFIX |
protected static int |
FETCH_SIZE |
protected static Set<String> |
HIDDEN_FILES |
static Set<String> |
OPTIONAL_DBOBJECTS |
protected static boolean |
schemaPrepared |
Constructor and Description |
---|
DbSchemaUtils() |
Modifier and Type | Method and Description |
---|---|
protected static List<org.openmdx.base.naming.Path> |
getIdentityPatterns(org.openmdx.base.mof.cci.ModelElement_1_0 classDef,
org.openmdx.base.naming.Path segmentIdentity,
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 List<String> |
getIndexNames()
Get all index names from reference schema.
|
static List<String> |
getIndexNames(Connection connS)
Get all index names from reference schema.
|
static String |
getJdbcDriverName(String connectionUrl) |
protected static String |
getObjectDefinition(String type,
String object,
List<String> schema,
String targetDatabaseName,
boolean replaceObject)
Get definition for given db object from reference schema.
|
protected static List<String> |
getSchema(Connection conn)
Get reference schema.
|
protected static Connection |
getSchemaConnection()
Get connection to database holding the schema.
|
static List<String> |
getSequenceNames()
Get all sequence names from reference schema.
|
static List<String> |
getSequenceNames(Connection connS)
Get all sequence names from reference schema.
|
static List<String> |
getTableNames()
Get all table names from reference schema.
|
static List<String> |
getTableNames(Connection connS)
Get all table names from reference schema.
|
static List<String> |
getViewNames()
Get all view names from reference schema.
|
static List<String> |
getViewNames(Connection connS)
Get all view names from reference schema.
|
protected static Set<File> |
listFilesRecursively(File dir)
Recursiviley list files of dir.
|
static String |
mapColumnDefinition(String targetDatabaseName,
String command)
Map HSQLDB column definition to target database specific column definition.
|
static List<String> |
migrateData(Connection connT,
boolean fix)
Migrate data from an older schema version to latest version.
|
static List<String> |
migrateMediaToDB(String providerName,
javax.jdo.PersistenceManager pm)
Migrate media to file system in case org.opencrx.mediadir.* is set.
|
static List<String> |
migrateMediaToFS(String providerName,
javax.jdo.PersistenceManager pm,
Connection connT,
boolean validateOnly)
Migrate media to file system in case org.opencrx.mediadir.* is set.
|
static List<String> |
validateIndexes(Connection connT,
boolean fix)
Validate existence of indexes with reference schema.
|
static List<String> |
validateSequences(Connection connT,
boolean fix)
Validate existence of sequences with reference schema.
|
static List<String> |
validateTableColumns(Connection connT,
boolean fix)
Compare columns of all tables with reference schema.
|
static List<String> |
validateTables(Connection connT,
boolean fix)
Compare tables of given database with reference schema.
|
static List<String> |
validateViews(Connection connT,
boolean fix)
Validate existence of views with reference schema.
|
protected static final int FETCH_SIZE
public static final String CREATE_TABLE_PREFIX
public static final String CREATE_VIEW_PREFIX
public static final String CREATE_SEQUENCE_PREFIX
public static final String CREATE_INDEX_PREFIX
public static final String ALTER_TABLE_PREFIX
protected static boolean schemaPrepared
protected static Connection getSchemaConnection() throws org.openmdx.base.exception.ServiceException
org.openmdx.base.exception.ServiceException
protected static List<String> getSchema(Connection conn) throws org.openmdx.base.exception.ServiceException
org.openmdx.base.exception.ServiceException
protected static String getObjectDefinition(String type, String object, List<String> schema, String targetDatabaseName, boolean replaceObject)
type
- object
- schema
- targetDatabaseName
- replaceObject
- public static String mapColumnDefinition(String targetDatabaseName, String command)
targetDatabaseName
- command
- public static List<String> getTableNames() throws org.openmdx.base.exception.ServiceException
org.openmdx.base.exception.ServiceException
public static List<String> getTableNames(Connection connS) throws org.openmdx.base.exception.ServiceException
org.openmdx.base.exception.ServiceException
public static List<String> getViewNames(Connection connS) throws org.openmdx.base.exception.ServiceException
org.openmdx.base.exception.ServiceException
public static List<String> getViewNames() throws org.openmdx.base.exception.ServiceException
org.openmdx.base.exception.ServiceException
public static List<String> getIndexNames(Connection connS) throws org.openmdx.base.exception.ServiceException
org.openmdx.base.exception.ServiceException
public static List<String> getIndexNames() throws org.openmdx.base.exception.ServiceException
org.openmdx.base.exception.ServiceException
public static List<String> getSequenceNames(Connection connS) throws org.openmdx.base.exception.ServiceException
org.openmdx.base.exception.ServiceException
public static List<String> getSequenceNames() throws org.openmdx.base.exception.ServiceException
org.openmdx.base.exception.ServiceException
public static List<String> validateTables(Connection connT, boolean fix) throws org.openmdx.base.exception.ServiceException
connT
- fix
- org.openmdx.base.exception.ServiceException
public static List<String> validateTableColumns(Connection connT, boolean fix) throws org.openmdx.base.exception.ServiceException
connT
- fix
- org.openmdx.base.exception.ServiceException
public static List<String> validateViews(Connection connT, boolean fix) throws org.openmdx.base.exception.ServiceException
connT
- fix
- org.openmdx.base.exception.ServiceException
public static List<String> migrateData(Connection connT, boolean fix) throws org.openmdx.base.exception.ServiceException
connT
- fix
- org.openmdx.base.exception.ServiceException
protected static List<org.openmdx.base.naming.Path> getIdentityPatterns(org.openmdx.base.mof.cci.ModelElement_1_0 classDef, org.openmdx.base.naming.Path segmentIdentity, String referenceName) throws org.openmdx.base.exception.ServiceException
classDef
- segmentIdentity
- referenceName
- org.openmdx.base.exception.ServiceException
protected static Set<File> listFilesRecursively(File dir)
dir
- public static List<String> migrateMediaToFS(String providerName, javax.jdo.PersistenceManager pm, Connection connT, boolean validateOnly) throws org.openmdx.base.exception.ServiceException
segment
- org.openmdx.base.exception.ServiceException
public static List<String> migrateMediaToDB(String providerName, javax.jdo.PersistenceManager pm) throws org.openmdx.base.exception.ServiceException
segment
- org.openmdx.base.exception.ServiceException
public static List<String> validateIndexes(Connection connT, boolean fix) throws org.openmdx.base.exception.ServiceException
connT
- fix
- org.openmdx.base.exception.ServiceException
public static List<String> validateSequences(Connection connT, boolean fix) throws org.openmdx.base.exception.ServiceException
connT
- fix
- 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.