|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uk.org.ogsadai.client.dbcreate2.CreateTestDB
Base class for creating and populating test database tables.
Field Summary | |
private static java.lang.String |
COPYRIGHT_NOTICE
|
protected java.lang.String |
mBookingTable
|
protected TravelDataCreator |
mData
Generates the test data. |
protected java.lang.String |
mDatabase
|
protected java.lang.String |
mDBMS
|
protected java.lang.String |
mDestinationTable
|
protected java.lang.String |
mDriver
|
protected java.lang.String |
mHost
|
protected int |
mNumberOfBookings
|
protected int |
mNumberOfDestinations
|
protected int |
mNumberOfTravellers
|
protected java.lang.String |
mPassword
|
protected java.lang.String |
mPort
|
protected int |
mRows
|
protected int |
mSizeOfBlob
|
protected java.lang.String |
mTablePrefix
|
protected java.lang.String |
mTravellerTable
|
protected java.lang.String |
mUsername
|
Constructor Summary | |
CreateTestDB(java.lang.String[] args)
Parse the arguments and populates the test database. |
Method Summary | |
protected void |
createBookingTable(java.sql.Connection connection)
Creates a new table with name mTablePrefix+mBookingTable
and populates it with data generated by the TravelDataCreator. |
protected void |
createDestinationTable(java.sql.Connection connection)
Creates a new table with name mTablePrefix+mDestinationTable
and populates it with data generated by the TravelDataCreator. |
protected void |
createTravellerTable(java.sql.Connection connection)
Creates a new table with name mTablePrefix+mTravellerTable
and populates it with data generated by the TravelDataCreator. |
protected abstract void |
dropTableIfExists(java.sql.Connection connection,
java.lang.String tablename)
Drops the specified table. |
protected abstract java.sql.Connection |
getConnection()
Returns a java.sql.Connection data resource. |
protected java.lang.String |
getCreateBookingTableStatement()
Constructs the statement for creating the traveller table. |
protected java.lang.String |
getCreateDestinationTableStatement()
Constructs the statement for creating a destination table. |
protected java.lang.String |
getCreateTravellerTableStatement()
Constructs the statement for creating the traveller table. |
protected void |
loadDriver()
Loads the driver class specified by the mDriver instance
variable. |
protected void |
populateDatabase()
Populates the test database with the test data. |
protected void |
printUsage()
Prints the general usage instructions for a CreateTestDB client. |
protected void |
printVariables(java.lang.String prefix)
Displays the settings prefixed by the specified string. |
protected abstract void |
setDefaultSettings()
Sets the default settings for the client. |
protected boolean |
setupArguments(java.lang.String[] args)
Parses the arguments general to most CreateTestDB clients. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final java.lang.String COPYRIGHT_NOTICE
protected final TravelDataCreator mData
protected java.lang.String mDBMS
protected java.lang.String mDriver
protected java.lang.String mHost
protected java.lang.String mPort
protected java.lang.String mDatabase
protected java.lang.String mUsername
protected java.lang.String mPassword
protected java.lang.String mTablePrefix
protected java.lang.String mTravellerTable
protected java.lang.String mDestinationTable
protected java.lang.String mBookingTable
protected int mRows
protected int mNumberOfTravellers
protected int mNumberOfDestinations
protected int mNumberOfBookings
protected int mSizeOfBlob
Constructor Detail |
public CreateTestDB(java.lang.String[] args)
args
- the arguments passed to the client's main method.Method Detail |
protected abstract void setDefaultSettings()
protected void populateDatabase() throws CreateTestDatabaseException
CreateTestDatabaseException
- if something went wrongprotected boolean setupArguments(java.lang.String[] args)
args
- the argument string
protected void printUsage()
protected void printVariables(java.lang.String prefix)
prefix
- the displayed settings begin with "prefix
Settings:"protected void loadDriver() throws CreateTestDatabaseException
mDriver
instance
variable.
CreateTestDatabaseException
- if there is a problem loading the driverprotected abstract java.sql.Connection getConnection() throws java.sql.SQLException
java.sql.Connection
data resource.
java.sql.SQLException
protected abstract void dropTableIfExists(java.sql.Connection connection, java.lang.String tablename) throws java.sql.SQLException
connection
- a connection to the data resourcetablename
- the name of the table to be created
java.sql.SQLException
protected java.lang.String getCreateTravellerTableStatement()
protected java.lang.String getCreateBookingTableStatement()
protected java.lang.String getCreateDestinationTableStatement()
protected void createTravellerTable(java.sql.Connection connection) throws java.sql.SQLException
mTablePrefix+mTravellerTable
and populates it with data generated by the TravelDataCreator.
connection
- a connection to the data resource
java.sql.SQLException
protected void createDestinationTable(java.sql.Connection connection) throws java.sql.SQLException
mTablePrefix+mDestinationTable
and populates it with data generated by the TravelDataCreator.
connection
- a connection to the data resource
java.sql.SQLException
protected void createBookingTable(java.sql.Connection connection) throws java.sql.SQLException
mTablePrefix+mBookingTable
and populates it with data generated by the TravelDataCreator.
connection
- a connection to the data resource
java.sql.SQLException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |