dbms
Class DBMSBase

java.lang.Object
  extended by dbms.DBMSBase
All Implemented Interfaces:
DBMSConstants

public class DBMSBase
extends java.lang.Object
implements DBMSConstants

Base class for the DBMS classes


Field Summary
private  DBMSSql commands
           
private  DBConnection connection
           
 
Fields inherited from interface dbms.DBMSConstants
CLOSE_BRACE, COLON_SEPARATOR, COMMA, DOUBLE_QUOTE, DRIVER_LOCATION, EMPTY_STRING, FILE_SEPARATOR, LIMITED_DATABASE, NEW_LINE, OPEN_BRACE, QUOTE_CHARACTER, SINGLE_QUOTE, SPACE, USER_DIR
 
Constructor Summary
DBMSBase(DBMSSql commands, java.lang.String hostname, java.lang.String username, java.lang.String password)
          Constructor to create a connection object.
 
Method Summary
private  java.lang.String createColumns(java.util.List columnNames, java.util.List columnTypes)
          concatenates the columnCreate string
(package private)  void getCatalogs(java.util.ArrayList<java.lang.String> catalogs)
          Gets a list of the catalogs on the DBMS
private  java.sql.ResultSet getResultSet(java.lang.String tableName)
          Uses the DBMSSql commands object to retrieve a resultset for the specific DBMS
private  java.sql.Statement getStatement()
           
(package private)  void getTables(java.util.ArrayList<java.lang.String> tables, java.lang.String catalog)
          Gets a list of the tables on a catalog
 void insertData(java.lang.String tableName, java.util.List columnNames, java.util.List<java.util.List<java.lang.Object>> data)
          retrieves a list of commands for the DBMS you are using
private  void setConnection(java.lang.String url, java.lang.String driver, java.lang.String username, java.lang.String password)
          Creates a new connection to a database and generates both a Statement object and a DatabaseMetaData object these are stored as instance fields (statement / dbm)
 void setup(java.lang.String database, java.lang.String tableName, java.util.List columnNames, java.util.List columnTypes, java.util.List<java.util.List<java.lang.Object>> data)
          Creates the table based on provided information
 void setupDatabase(java.lang.String databaseName)
          This creates a new database based on individual DBMS requirments
 void setupTable(java.lang.String database, java.lang.String tableName, java.util.List columnNames, java.util.List columnTypes)
          Updates the current list of Drivers from the config files to load a list of sqlDrivers
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

connection

private DBConnection connection

commands

private DBMSSql commands
Constructor Detail

DBMSBase

public DBMSBase(DBMSSql commands,
                java.lang.String hostname,
                java.lang.String username,
                java.lang.String password)
         throws java.lang.Exception
Constructor to create a connection object.

Parameters:
commands -
hostname -
username -
password -
Throws:
java.lang.Exception
Method Detail

getResultSet

private java.sql.ResultSet getResultSet(java.lang.String tableName)
                                 throws java.lang.Exception
Uses the DBMSSql commands object to retrieve a resultset for the specific DBMS

Parameters:
tableName -
Returns:
Throws:
java.lang.Exception

createColumns

private java.lang.String createColumns(java.util.List columnNames,
                                       java.util.List columnTypes)
concatenates the columnCreate string

Parameters:
columnNames -
columnTypes -
Returns:

setConnection

private void setConnection(java.lang.String url,
                           java.lang.String driver,
                           java.lang.String username,
                           java.lang.String password)
                    throws java.lang.Exception
Creates a new connection to a database and generates both a Statement object and a DatabaseMetaData object these are stored as instance fields (statement / dbm)

Parameters:
url -
driver -
username -
password -
Throws:
java.lang.Exception

setupDatabase

public void setupDatabase(java.lang.String databaseName)
                   throws java.lang.Exception
This creates a new database based on individual DBMS requirments

Parameters:
databaseName - the name of the database to create
Throws:
java.lang.Exception

setup

public void setup(java.lang.String database,
                  java.lang.String tableName,
                  java.util.List columnNames,
                  java.util.List columnTypes,
                  java.util.List<java.util.List<java.lang.Object>> data)
           throws java.lang.Exception
Creates the table based on provided information

Parameters:
database -
tableName -
columnNames -
columnTypes -
data -
Throws:
java.lang.Exception

setupTable

public void setupTable(java.lang.String database,
                       java.lang.String tableName,
                       java.util.List columnNames,
                       java.util.List columnTypes)
                throws java.lang.Exception
Updates the current list of Drivers from the config files to load a list of sqlDrivers

Parameters:
database -
tableName -
columnNames -
columnTypes -
Throws:
java.lang.Exception

insertData

public void insertData(java.lang.String tableName,
                       java.util.List columnNames,
                       java.util.List<java.util.List<java.lang.Object>> data)
                throws java.lang.Exception
retrieves a list of commands for the DBMS you are using

Parameters:
tableName -
columnNames -
data -
Throws:
java.lang.Exception

getCatalogs

void getCatalogs(java.util.ArrayList<java.lang.String> catalogs)
           throws java.sql.SQLException
Gets a list of the catalogs on the DBMS

Parameters:
catalogs - a list of catalogs to update
Throws:
java.sql.SQLException

getTables

void getTables(java.util.ArrayList<java.lang.String> tables,
               java.lang.String catalog)
         throws java.sql.SQLException
Gets a list of the tables on a catalog

Parameters:
tables -
catalog -
Throws:
java.sql.SQLException

getStatement

private java.sql.Statement getStatement()
Returns:
a statement object