public class SchemaCheck
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private static java.lang.String |
CASE_SENSITIVE
Token that specifies the legacy CASE-SENSITIVE attribute.
|
private static java.lang.String |
COLUMN_LABEL
Token that specifies the legacy COLUMN-LABEL attribute.
|
private static java.util.Set<java.lang.String> |
COMMENT_TOKENS
Collection of all known comment tokens.
|
private Database |
database
Database being inspected.
|
private static java.lang.String |
DELIMITERS
Delimiters for pairs of [Token: value] in SQL comment.
|
private static java.lang.String |
DIGITS
Token that specifies the legacy DIGITS attribute, where available.
|
private java.lang.String |
dmoPackage
Package into which DMO interface and implementation classes are to be added
|
private static java.lang.String |
DUMP_NAME
Token that specifies the dump name of a table.
|
private static java.lang.String |
FORMAT
Token that specifies the legacy FORMAT attribute.
|
private static java.util.concurrent.ConcurrentMap<Database,SchemaCheck> |
instances
One
SchemaCheck instance per mutable database, on which to synchronize operations |
private java.util.Map<java.lang.String,DmoMeta> |
knownTables
Stored metadata information on dynamic tables mapped by their legacy name.
|
private static java.lang.String |
LABEL
Token that specifies the legacy LABEL attribute.
|
private static java.lang.String |
LEGACY_NAME
Token that specifies the legacy name for a table/field/index.
|
private static java.lang.String |
LEGACY_TYPE
Token that specifies the legacy type.
|
private static CentralLogger |
LOG
Logger.
|
static java.lang.String |
SKIP
Token that specifies the legacy type.
|
private static java.lang.String |
SQL_NULL
Constant for SQL NULL text reported by JDBC metadata
|
private static java.util.concurrent.atomic.AtomicLong |
tableCounter
Counter used for generation of unique names for dynamic tables.
|
| Modifier | Constructor and Description |
|---|---|
private |
SchemaCheck(Database database)
Private constructor, meant to be called only from
run(Database, boolean). |
| Modifier and Type | Method and Description |
|---|---|
private void |
deregisterTable(Table table)
Table was dropped.
|
(package private) Aast |
generateSchemaAst(Table table,
java.lang.String ifaceName,
java.lang.String tableName,
java.lang.String legacyTableName,
java.util.Map<java.lang.String,java.lang.String> fields4GLtoORM)
Generate AST that represents the target table and has the same structure as .p2o files from
the conversion stage.
|
private java.lang.String |
getAstPath(java.lang.String ifaceName)
Get the path representing the DMO interface in the AST registry.
|
private java.util.Set<Attribute> |
getAttributesToSkip(java.util.Collection<Attribute> attributes,
Dialect dialect)
Get a list of attributes that should not be handled as a DMO property.
|
private java.lang.String |
getInterfaceName(Table table)
Convert table name to interface name for DMOs.
|
static java.lang.String |
getTokenValue(java.util.Map<java.lang.String,java.lang.String> attributes,
java.lang.String token,
java.lang.String def)
Returns an attribute from the map or default value otherwise.
|
void |
processChanges(boolean bootstrap)
Notify the FWD runtime that a mutable database schema has been modified.
|
static java.util.Map<java.lang.String,java.lang.String> |
processComment(java.lang.String comment)
Process a comment and split in pairs of (token, value).
|
private void |
registerTable(Table table)
Table was created.
|
static void |
run(character ldbName)
Notify the FWD runtime that a mutable database schema may have been modified.
|
(package private) static void |
run(Database database,
boolean bootstrap)
Notify the FWD runtime that a mutable database schema may have been modified.
|
private static final CentralLogger LOG
private static final java.lang.String SQL_NULL
private static final java.util.concurrent.atomic.AtomicLong tableCounter
private static final java.util.concurrent.ConcurrentMap<Database,SchemaCheck> instances
SchemaCheck instance per mutable database, on which to synchronize operationsprivate static final java.lang.String DELIMITERS
String.split(String).private final Database database
private final java.lang.String dmoPackage
private final java.util.Map<java.lang.String,DmoMeta> knownTables
private static final java.lang.String LEGACY_NAME
private static final java.lang.String DUMP_NAME
private static final java.lang.String LABEL
private static final java.lang.String COLUMN_LABEL
private static final java.lang.String FORMAT
private static final java.lang.String CASE_SENSITIVE
private static final java.lang.String DIGITS
private static final java.lang.String LEGACY_TYPE
public static final java.lang.String SKIP
private static final java.util.Set<java.lang.String> COMMENT_TOKENS
private SchemaCheck(Database database)
run(Database, boolean).database - Database whose schema is being processed.public static void run(character ldbName)
This is intended to be a development-time operation and should not be invoked while the target database is in active use, as DMO classes will be added and potentially removed as part of the update.
ldbName - Logical name of the database whose schema is meant to have changed.static void run(Database database, boolean bootstrap)
This is intended to be a development-time operation and should not be invoked while the target database is in active use, as DMO classes will be added and potentially removed as part of the update.
database - Helper object which represents physical database whose schema is meant to have changed.bootstrap - true if invoked during database bootstrap; false if invoked by application
logic.public void processChanges(boolean bootstrap)
This is intended to be a development-time operation and should not be invoked while the target database is in active use, as DMO classes will be added and potentially removed as part of the update.
private void deregisterTable(Table table)
TODO: this will remove the strong reference within the AsmClassLoader, but we also need to
remove strong references to the DMO interface (and implementation class) throughout the runtime.
table - Table objectprivate void registerTable(Table table)
table - A table object which contains information on the DMO/table to be constructed and register.private java.lang.String getAstPath(java.lang.String ifaceName)
ifaceName - Short name of DMO interface.private java.lang.String getInterfaceName(Table table)
table - Table objectAast generateSchemaAst(Table table, java.lang.String ifaceName, java.lang.String tableName, java.lang.String legacyTableName, java.util.Map<java.lang.String,java.lang.String> fields4GLtoORM)
table - Object containing definitions of the target table.ifaceName - The name of the target DMO interface.tableName - The name of the target SQL table.legacyTableName - The legacy (Progress) name of the table.fields4GLtoORM - Map 4GL field names to ORM names.private java.util.Set<Attribute> getAttributesToSkip(java.util.Collection<Attribute> attributes, Dialect dialect)
attributes - All available columns.dialect - Database dialect for datatype translation purposes.public static java.util.Map<java.lang.String,java.lang.String> processComment(java.lang.String comment)
comment - The comment as read from SQL remark.public static java.lang.String getTokenValue(java.util.Map<java.lang.String,java.lang.String> attributes,
java.lang.String token,
java.lang.String def)
attributes - The map of legacy attributes.token - The tokendef - the default value to be returned in case the token is not found.