jrunx.persistence.greylock
Class AbstractDBSchema

java.lang.Object
  |
  +--jrunx.persistence.greylock.BaseDB
        |
        +--jrunx.persistence.greylock.AbstractDBSchema
All Implemented Interfaces:
Const, DBSchema
Direct Known Subclasses:
CloudscapeDBSchema, DB2DBSchema, OracleDBSchema, PointbaseDBSchema, SQLServerDBSchema

public abstract class AbstractDBSchema
extends BaseDB
implements DBSchema, Const

Utility class for creating and deleting Tables used by the DB package.


Field Summary
protected  TypeMappingMetaData mappings
           
protected  java.lang.String schema
           
protected  java.lang.String vendor
           
 
Fields inherited from interface jrunx.persistence.greylock.Const
ARRAYED, BIGINT, BIT, BLOB, BYTE, CHAR, DOUBLE, FLOAT, ID, ID_TABLE, INCREMENT, INDEX, INSTANCE, INSTANCE_FORGE_IDS, INSTANCE_ID, INSTANCE_TABLE, INTEGER, INTERNALID, NAME, PARENT, PROPERTY_ID, PROPERTY_TABLE, RELATION_ID, SEARCHABLE, SEQUENCE_PROCEDURE, SHORT, SINK, SOURCE, TIMESTAMP, TYPE_FORGE_IDS, TYPE_ID, TYPE_TABLE, UNDERSCORE, VARCHAR, VIEW
 
Constructor Summary
AbstractDBSchema(java.lang.String vendor)
           
 
Method Summary
 void addColumn(java.lang.String columnName, java.lang.String table, java.lang.String dataType, java.sql.Connection con)
           
 void cleanDefaultTables(java.sql.Connection con)
          Drops user-defined tables and views, and cleans default tables
 void createDefaultTables(java.sql.Connection con)
          Create the default set of tables required by the db package.
 void createDefaultTables(javax.sql.DataSource ds)
          Create the default set of tables required by the db package.
 void createIndex(java.lang.String table, java.lang.String column, java.lang.Object idxName, java.sql.Connection con)
           
 void deleteColumn(java.lang.String column, java.lang.String table, java.sql.Connection con)
           
 void dropAll(java.sql.Connection con)
          Drop the default set of tables required by the db package.
protected  void dropDefaultObjects(java.sql.Connection con, DBInvoker inv)
           
 void dropIndex(java.lang.String table, java.lang.String column, java.lang.Object idxName, java.sql.Connection con)
           
 void dropTable(java.lang.String tableName, java.sql.Connection con)
           
protected  void dropUserDefinedObjects(java.sql.Connection con, DBInvoker inv)
           
 void dropView(java.lang.String viewName, java.sql.Connection con)
           
protected  void executeDDL(java.lang.String sql, java.sql.Connection con)
           
 boolean exists(java.sql.Connection con)
          Checks wether the database structure has been initialized
protected  void findSchema(java.sql.Connection con)
           
 java.lang.String getAddColumnSQL(java.lang.String columnName, java.lang.String table, java.lang.String dataType)
           
protected  java.lang.String getCreateIdGeneratorIndexSQL()
           
protected  java.lang.String getCreateIdGeneratorTableSQL()
           
 java.lang.String getCreateIndexSQL(java.lang.String table, java.lang.String column, java.lang.Object idxName)
           
protected  java.lang.String getCreateInstancesIndexSQL()
           
protected  java.lang.String getCreateInstancesTableSQL()
           
 java.lang.String getCreateJRunJoinSQL(java.lang.String tableName)
           
protected  java.lang.String getCreatePropertiesTableSQL()
           
abstract  java.lang.String getCreateSequencerProcedure()
           
protected  java.util.List getCreateTypesIndexSQL()
           
protected  java.lang.String getCreateTypesTableSQL()
           
protected  java.util.List getDefaultIndexesSql()
           
protected  java.util.Iterator getDefaultProcedures(java.sql.Connection con)
           
protected  java.util.List getDefaultProceduresSql()
           
protected  java.util.List getDefaultTables(java.sql.Connection con)
           
protected  java.util.List getDefaultTablesSql()
           
 java.lang.String getDeleteColumnSQL(java.lang.String column, java.lang.String table)
           
 java.lang.String getDropIndexSQL(java.lang.String table, java.lang.String column, java.lang.Object idxName)
           
 java.lang.String getDropProcedureSQL(java.lang.String procName)
           
 java.lang.String getDropTableSQL(java.lang.String tableName)
           
 java.lang.String getDropViewSQL(java.lang.String viewName)
           
abstract  java.lang.String getRenameColumnSQL(java.lang.String newName, java.lang.String oldName, java.lang.String table)
           
abstract  java.lang.String getRenameTableSQL(java.lang.String oldName, java.lang.String newName)
           
abstract  java.lang.String getRenameViewSQL(java.lang.String oldName, java.lang.String newName)
           
protected  java.util.Iterator getUserTables(java.sql.Connection con)
           
protected  java.util.Iterator getUserViews(java.sql.Connection con)
           
 void renameColumn(java.lang.String newName, java.lang.String oldName, java.lang.String table, java.sql.Connection con)
           
 void renameTable(java.lang.String oldName, java.lang.String newName, java.sql.Connection con)
           
 void renameView(java.lang.String oldName, java.lang.String newName, java.sql.Connection con)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

vendor

protected java.lang.String vendor

schema

protected java.lang.String schema

mappings

protected TypeMappingMetaData mappings
Constructor Detail

AbstractDBSchema

public AbstractDBSchema(java.lang.String vendor)
Method Detail

exists

public boolean exists(java.sql.Connection con)
               throws java.lang.Exception
Checks wether the database structure has been initialized
Specified by:
exists in interface DBSchema

createDefaultTables

public void createDefaultTables(javax.sql.DataSource ds)
                         throws java.lang.Exception
Create the default set of tables required by the db package.
Specified by:
createDefaultTables in interface DBSchema

createDefaultTables

public void createDefaultTables(java.sql.Connection con)
                         throws java.lang.Exception
Create the default set of tables required by the db package.
Specified by:
createDefaultTables in interface DBSchema

dropAll

public void dropAll(java.sql.Connection con)
             throws java.lang.Exception
Drop the default set of tables required by the db package.
Specified by:
dropAll in interface DBSchema

dropDefaultObjects

protected void dropDefaultObjects(java.sql.Connection con,
                                  DBInvoker inv)
                           throws java.sql.SQLException

dropUserDefinedObjects

protected void dropUserDefinedObjects(java.sql.Connection con,
                                      DBInvoker inv)
                               throws java.sql.SQLException

getDefaultTablesSql

protected java.util.List getDefaultTablesSql()

getDefaultIndexesSql

protected java.util.List getDefaultIndexesSql()

getDefaultProceduresSql

protected java.util.List getDefaultProceduresSql()

getDefaultProcedures

protected java.util.Iterator getDefaultProcedures(java.sql.Connection con)
                                           throws java.sql.SQLException

cleanDefaultTables

public void cleanDefaultTables(java.sql.Connection con)
                        throws java.lang.Exception
Drops user-defined tables and views, and cleans default tables
Specified by:
cleanDefaultTables in interface DBSchema

getDefaultTables

protected java.util.List getDefaultTables(java.sql.Connection con)
                                   throws java.sql.SQLException

getUserTables

protected java.util.Iterator getUserTables(java.sql.Connection con)
                                    throws java.sql.SQLException

getUserViews

protected java.util.Iterator getUserViews(java.sql.Connection con)
                                   throws java.sql.SQLException

findSchema

protected void findSchema(java.sql.Connection con)
                   throws java.sql.SQLException

executeDDL

protected void executeDDL(java.lang.String sql,
                          java.sql.Connection con)
                   throws java.sql.SQLException

deleteColumn

public void deleteColumn(java.lang.String column,
                         java.lang.String table,
                         java.sql.Connection con)
                  throws java.lang.Exception
Specified by:
deleteColumn in interface DBSchema

renameColumn

public void renameColumn(java.lang.String newName,
                         java.lang.String oldName,
                         java.lang.String table,
                         java.sql.Connection con)
                  throws java.lang.Exception
Specified by:
renameColumn in interface DBSchema

addColumn

public void addColumn(java.lang.String columnName,
                      java.lang.String table,
                      java.lang.String dataType,
                      java.sql.Connection con)
               throws java.lang.Exception
Specified by:
addColumn in interface DBSchema

dropTable

public void dropTable(java.lang.String tableName,
                      java.sql.Connection con)
               throws java.lang.Exception
Specified by:
dropTable in interface DBSchema

renameTable

public void renameTable(java.lang.String oldName,
                        java.lang.String newName,
                        java.sql.Connection con)
                 throws java.lang.Exception
Specified by:
renameTable in interface DBSchema

renameView

public void renameView(java.lang.String oldName,
                       java.lang.String newName,
                       java.sql.Connection con)
                throws java.lang.Exception

dropView

public void dropView(java.lang.String viewName,
                     java.sql.Connection con)
              throws java.lang.Exception
Specified by:
dropView in interface DBSchema

createIndex

public void createIndex(java.lang.String table,
                        java.lang.String column,
                        java.lang.Object idxName,
                        java.sql.Connection con)
                 throws java.lang.Exception
Specified by:
createIndex in interface DBSchema

dropIndex

public void dropIndex(java.lang.String table,
                      java.lang.String column,
                      java.lang.Object idxName,
                      java.sql.Connection con)
               throws java.lang.Exception
Specified by:
dropIndex in interface DBSchema

getCreateSequencerProcedure

public abstract java.lang.String getCreateSequencerProcedure()

getRenameTableSQL

public abstract java.lang.String getRenameTableSQL(java.lang.String oldName,
                                                   java.lang.String newName)
Specified by:
getRenameTableSQL in interface DBSchema

getRenameViewSQL

public abstract java.lang.String getRenameViewSQL(java.lang.String oldName,
                                                  java.lang.String newName)
Specified by:
getRenameViewSQL in interface DBSchema

getDropTableSQL

public java.lang.String getDropTableSQL(java.lang.String tableName)
Specified by:
getDropTableSQL in interface DBSchema

getDropViewSQL

public java.lang.String getDropViewSQL(java.lang.String viewName)
Specified by:
getDropViewSQL in interface DBSchema

getDropProcedureSQL

public java.lang.String getDropProcedureSQL(java.lang.String procName)

getDeleteColumnSQL

public java.lang.String getDeleteColumnSQL(java.lang.String column,
                                           java.lang.String table)
Specified by:
getDeleteColumnSQL in interface DBSchema

getRenameColumnSQL

public abstract java.lang.String getRenameColumnSQL(java.lang.String newName,
                                                    java.lang.String oldName,
                                                    java.lang.String table)
Specified by:
getRenameColumnSQL in interface DBSchema

getAddColumnSQL

public java.lang.String getAddColumnSQL(java.lang.String columnName,
                                        java.lang.String table,
                                        java.lang.String dataType)
Specified by:
getAddColumnSQL in interface DBSchema

getCreateIdGeneratorTableSQL

protected java.lang.String getCreateIdGeneratorTableSQL()

getCreateTypesTableSQL

protected java.lang.String getCreateTypesTableSQL()

getCreateInstancesTableSQL

protected java.lang.String getCreateInstancesTableSQL()

getCreatePropertiesTableSQL

protected java.lang.String getCreatePropertiesTableSQL()

getCreateInstancesIndexSQL

protected java.lang.String getCreateInstancesIndexSQL()

getCreateIdGeneratorIndexSQL

protected java.lang.String getCreateIdGeneratorIndexSQL()

getCreateTypesIndexSQL

protected java.util.List getCreateTypesIndexSQL()

getCreateJRunJoinSQL

public java.lang.String getCreateJRunJoinSQL(java.lang.String tableName)
Specified by:
getCreateJRunJoinSQL in interface DBSchema

getCreateIndexSQL

public java.lang.String getCreateIndexSQL(java.lang.String table,
                                          java.lang.String column,
                                          java.lang.Object idxName)
Specified by:
getCreateIndexSQL in interface DBSchema

getDropIndexSQL

public java.lang.String getDropIndexSQL(java.lang.String table,
                                        java.lang.String column,
                                        java.lang.Object idxName)
Specified by:
getDropIndexSQL in interface DBSchema


Copyright © 2002 Macromedia Corporation. All Rights Reserved.