system
Class DBMSPlug

java.lang.Object
  extended by system.DBMSPlug

public class DBMSPlug
extends java.lang.Object

This class corresponds directly to the DBMSSocket class. It is the systems plug into the DBMS Package.


Constructor Summary
DBMSPlug()
           
 
Method Summary
static java.util.ArrayList<java.lang.String> getCatalogs(java.util.ArrayList<java.lang.String> catalogs)
          Gets the catalogs from the DBMS package.
static boolean getConnection(java.lang.String url, int vendor, java.lang.String user, java.lang.String password)
          Gets the connection from the DBMS package
static java.util.ArrayList<java.lang.Object> getDBColumnTypes(java.util.ArrayList<java.lang.Object> columnTypesJava)
          Sets the database column types based on the column types supplied by the valiadation and the user.
static java.util.ArrayList<java.lang.String> getTables(java.lang.String catalog, java.util.ArrayList<java.lang.String> tables)
          Gets the table names of a particular database file.
static java.lang.String[] getVendors()
          Gets the vendors of supplying DBMS.
static void sendDataToDBMS(java.lang.String database, java.lang.String tableName, java.util.ArrayList<java.lang.Object> columnNames, java.util.ArrayList<java.lang.Object> columnTypes, java.util.List<java.util.List<java.lang.Object>> data)
          Sends the data to the database table to be inserted.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBMSPlug

public DBMSPlug()
Method Detail

getConnection

public static boolean getConnection(java.lang.String url,
                                    int vendor,
                                    java.lang.String user,
                                    java.lang.String password)
                             throws java.lang.ClassNotFoundException,
                                    java.lang.Exception
Gets the connection from the DBMS package

Parameters:
url - the url of the connection stream.
vendor - the vendor of the conection stream.
user - the username of the conection stream.
password - the password of the conection stream.
Returns:
the confirmation of whether the connection was established.
Throws:
java.lang.ClassNotFoundException - throws all exceptions to be caught in the Bol class.
java.lang.Exception - throws all exceptions to be caught in the Bol class.

getTables

public static java.util.ArrayList<java.lang.String> getTables(java.lang.String catalog,
                                                              java.util.ArrayList<java.lang.String> tables)
                                                       throws java.sql.SQLException
Gets the table names of a particular database file.

Parameters:
catalog - the catalog needed for reference.
tables - the tables needed to be populated.
Returns:
the completed list of table names.
Throws:
java.sql.SQLException - throws all exceptions to be caught in the Bol class.

getCatalogs

public static java.util.ArrayList<java.lang.String> getCatalogs(java.util.ArrayList<java.lang.String> catalogs)
                                                         throws java.sql.SQLException
Gets the catalogs from the DBMS package.

Parameters:
catalogs - the catalogs needing to be populated.
Returns:
the completed list of catalogs.
Throws:
java.sql.SQLException - throws all exceptions to be caught in the Bol class.

sendDataToDBMS

public static void sendDataToDBMS(java.lang.String database,
                                  java.lang.String tableName,
                                  java.util.ArrayList<java.lang.Object> columnNames,
                                  java.util.ArrayList<java.lang.Object> columnTypes,
                                  java.util.List<java.util.List<java.lang.Object>> data)
                           throws java.lang.Exception
Sends the data to the database table to be inserted.

Parameters:
database - the database the data is to be inserted into.
tableName - the table the data is to be inserted into.
columnNames - the column names the data is grouped under.
columnTypes - the types of data the columns have.
data - the data to be inserted into the database.
Throws:
java.lang.Exception - throws all exceptions to be caught in the Bol class.

getVendors

public static java.lang.String[] getVendors()
                                     throws java.lang.Exception
Gets the vendors of supplying DBMS.

Returns:
the string array of vendors on the machine.
Throws:
java.lang.Exception - throws all exceptions to be caught in the Bol class.

getDBColumnTypes

public static java.util.ArrayList<java.lang.Object> getDBColumnTypes(java.util.ArrayList<java.lang.Object> columnTypesJava)
Sets the database column types based on the column types supplied by the valiadation and the user.

Parameters:
columnTypesJava - the datatypes of the columns of data.
Returns:
the database equivalent to the java datatypes.