atg.adapter.gsa
Class GSARepositorySchemaGenerator

java.lang.Object
  extended by atg.adapter.gsa.GSARepositorySchemaGenerator

public class GSARepositorySchemaGenerator
extends java.lang.Object

This class is used to generate drop and alter a database schema required for a given repository. It uses the Apache DDLUtils tools for the actual schema manipulation. To use the class first initialize it's "model" by passing a GSARepository to the constructor. Afterwards you may invoke the action methods such as:

These methods affect the DataSource used by the given GSARepository. If that DataSource is not accessible then these methods will fail. Schema modification may continue or fail on error. Set the strict property to true to always fail on error. The default is to continue on error.

Version:
$Id: //test/UnitTests/base/main/src/Java/atg/adapter/gsa/ GSARepositorySchemaGenerator.java#1 $
Author:
adamb

Field Summary
 org.apache.ddlutils.model.Database mDatabase
           
 DatabaseTypeNameToJDBC mDatabaseTypeNameToJDBC
           
 org.apache.ddlutils.Platform mPlatform
           
 atg.adapter.gsa.GSARepository mRepository
           
 
Constructor Summary
GSARepositorySchemaGenerator(atg.adapter.gsa.GSARepository pRepository)
          Creates a new GSARepositorySchemaGenerator and initializes it with a model based upon the given repository.
 
Method Summary
 void alterSchema(boolean pContinueOnError)
          Alters the schema based on the current model.
 void buildModel(atg.adapter.gsa.GSARepository pRepository)
          Initialize this class with a model for the given repository.
 void createSchema(boolean pContinueOnError, boolean pDrop)
          Creates the schema based on the current model.
 void dropSchema(boolean pContinueOnError)
          Drops the schema based on the current model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mRepository

public atg.adapter.gsa.GSARepository mRepository

mPlatform

public org.apache.ddlutils.Platform mPlatform

mDatabase

public org.apache.ddlutils.model.Database mDatabase

mDatabaseTypeNameToJDBC

public DatabaseTypeNameToJDBC mDatabaseTypeNameToJDBC
Constructor Detail

GSARepositorySchemaGenerator

public GSARepositorySchemaGenerator(atg.adapter.gsa.GSARepository pRepository)
                             throws atg.repository.RepositoryException
Creates a new GSARepositorySchemaGenerator and initializes it with a model based upon the given repository.

Parameters:
pRepository -
Throws:
atg.repository.RepositoryException
Method Detail

buildModel

public void buildModel(atg.adapter.gsa.GSARepository pRepository)
                throws atg.repository.RepositoryException
Initialize this class with a model for the given repository. Any previous model will be discarded.

Parameters:
pRepository -
Throws:
atg.repository.RepositoryException

createSchema

public void createSchema(boolean pContinueOnError,
                         boolean pDrop)
                  throws org.apache.ddlutils.DatabaseOperationException,
                         java.sql.SQLException
Creates the schema based on the current model. If no model has been created, this method throws a NoModelException.

Parameters:
pContinueOnError - - If true, continue on error, else fail.
pDrop - - If true, drops schema first before attempting to create it.
Throws:
java.sql.SQLException
org.apache.ddlutils.DatabaseOperationException

dropSchema

public void dropSchema(boolean pContinueOnError)
                throws org.apache.ddlutils.DatabaseOperationException,
                       java.sql.SQLException
Drops the schema based on the current model. If no model has been created, this method throws a NoModelException.

Parameters:
pContinueOnError - - If true, continue on error, else fail.
Throws:
java.sql.SQLException
org.apache.ddlutils.DatabaseOperationException

alterSchema

public void alterSchema(boolean pContinueOnError)
                 throws org.apache.ddlutils.DatabaseOperationException,
                        java.sql.SQLException
Alters the schema based on the current model. If no model has been created, this method throws a NoModelException. This method attempts to preserve the data in the target database.

Parameters:
pContinueOnError - - If true, fail on error, else continue on error.
Throws:
java.sql.SQLException
org.apache.ddlutils.DatabaseOperationException


Copyright © 2009. All Rights Reserved.