org.opensubsystems.core.persist.db.postgresql
Class PostgreSQLVersionedDatabaseSchema

java.lang.Object
  extended by org.opensubsystems.core.persist.db.DatabaseSchemaImpl
      extended by org.opensubsystems.core.persist.db.VersionedDatabaseSchema
          extended by org.opensubsystems.core.persist.db.postgresql.PostgreSQLVersionedDatabaseSchema
All Implemented Interfaces:
DatabaseOperations, DatabaseSchema

public class PostgreSQLVersionedDatabaseSchema
extends VersionedDatabaseSchema

PostgreSQL versioned database schema provide functionality of creating and upgrading of Postgre SQL database schemas in the database based on their versions. This class keeps track of existing and current versiones of PostgreSQL database schemas and upgrades them as necesary

Version:
$Id: PostgreSQLVersionedDatabaseSchema.java,v 1.7 2007/01/07 06:14:43 bastafidli Exp $
Author:
Julo Legeny
Code reviewer:
Miro Halas
Code reviewed:
1.3 2004/12/18 06:18:37 bastafidli

Field Summary
 
Fields inherited from class org.opensubsystems.core.persist.db.VersionedDatabaseSchema
SCHEMA_TABLE_NAME, VERSIONED_SCHEMA_NAME, VERSIONED_SCHEMA_VERSION
 
Fields inherited from class org.opensubsystems.core.persist.db.DatabaseSchemaImpl
DATABASE_SCHEMA_PREFIX, DATABASE_SCHEMA_PREFIX_DEFAULT, m_arrDependentSchemas, m_bIsInDomain, m_iSchemaVersion, m_strSchemaName, NL
 
Fields inherited from interface org.opensubsystems.core.persist.db.DatabaseOperations
DBOP_DELETE, DBOP_INSERT, DBOP_SELECT, DBOP_UPDATE
 
Constructor Summary
PostgreSQLVersionedDatabaseSchema()
           
 
Method Summary
 void create(java.sql.Connection cntDBConnection, java.lang.String strUserName)
          Create the schema.
protected  void createUserDefinedType(java.sql.Connection cntDBConnection, java.lang.String strUserName)
          Create user defined type that stores return values (generated id and timestamp) from stored procedures.
 void loadExistingSchemas(java.sql.Connection cntDBConnection, java.util.Map mpSchemasToAdd, java.util.Map mpSchemasToUpgrade)
          Check what schemas already exists in the repository.
 void upgrade(java.sql.Connection cntDBConnection, java.lang.String strUserName, int iOriginalVersion)
          Upgrade the schema.
 
Methods inherited from class org.opensubsystems.core.persist.db.VersionedDatabaseSchema
add, createOrUpgradeSchemas, init
 
Methods inherited from class org.opensubsystems.core.persist.db.DatabaseSchemaImpl
getDependentSchemas, getJoinFromWhere, getName, getOwnerColumnNames, getSchemaPrefix, getVersion, handleSQLException, isExistingIndex, isInDomain, upgradeView
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PostgreSQLVersionedDatabaseSchema

public PostgreSQLVersionedDatabaseSchema()
                                  throws OSSException
Throws:
OSSException - - database cannot be started.
Method Detail

loadExistingSchemas

public void loadExistingSchemas(java.sql.Connection cntDBConnection,
                                java.util.Map mpSchemasToAdd,
                                java.util.Map mpSchemasToUpgrade)
                         throws OSSException
Check what schemas already exists in the repository.

Overrides:
loadExistingSchemas in class VersionedDatabaseSchema
Parameters:
cntDBConnection - - valid connection to database
mpSchemasToAdd - - current schemas will at the end contains schemas, which must be added
mpSchemasToUpgrade - - schemas to upgrade will contain schemas, which must be upgraded
Throws:
OSSException - - problem initializing the schema

create

public void create(java.sql.Connection cntDBConnection,
                   java.lang.String strUserName)
            throws java.sql.SQLException,
                   OSSException
Create the schema.

Specified by:
create in interface DatabaseSchema
Overrides:
create in class VersionedDatabaseSchema
Parameters:
cntDBConnection - - valid connection to database
strUserName - - name of user who will be accessing this table
Throws:
java.sql.SQLException - - problem creating the schema
OSSException - - problem creating the schema

upgrade

public void upgrade(java.sql.Connection cntDBConnection,
                    java.lang.String strUserName,
                    int iOriginalVersion)
             throws java.sql.SQLException
Upgrade the schema.

Specified by:
upgrade in interface DatabaseSchema
Overrides:
upgrade in class DatabaseSchemaImpl
Parameters:
cntDBConnection - - valid connection to database
strUserName - - name of user who will be accessing this table
iOriginalVersion - - original version from which to upgrade
Throws:
java.sql.SQLException - - problem creating the database schema

createUserDefinedType

protected void createUserDefinedType(java.sql.Connection cntDBConnection,
                                     java.lang.String strUserName)
                              throws java.sql.SQLException
Create user defined type that stores return values (generated id and timestamp) from stored procedures.

Parameters:
cntDBConnection - - database connection
strUserName - - user name
Throws:
java.sql.SQLException - - exception occured during creating user defined type


Copyright © 2003 - 2006 OpenSubsystems s.r.o.