org.jhuapl.edu.sages.etl.oldstuff
Class TestOpenCsvJar

java.lang.Object
  extended by org.jhuapl.edu.sages.etl.oldstuff.TestOpenCsvJar

public class TestOpenCsvJar
extends Object

Author:
POKUAM1

Constructor Summary
TestOpenCsvJar()
           
TestOpenCsvJar(String dbms, int portNumber, String userName, String password, String serverName, String dbName)
           
 
Method Summary
static SagesEtlException abort(String msg, Throwable e)
          returns a SagesEtlException that wraps the original exception
protected static String addFlagColumn(String tableToModify)
           
protected static void alterCleanseTableAddFlagColumn(Connection c, Savepoint save1, Savepoint createCleanseSavepoint)
           
protected static void alterStagingTableAddFlagColumn(Connection c, Savepoint save1, Savepoint createCleanseSavepoint)
           
protected static Savepoint buildCleanseTable(Connection c, TestOpenCsvJar tocj, Savepoint save1)
           
protected static String buildInsertIntoCleansingTableSql(Connection c, TestOpenCsvJar tocj)
           
protected static void buildStagingTable(Connection c, TestOpenCsvJar tocj, Savepoint save1)
           
protected static void copyFromCleanseToStaging(Connection c, TestOpenCsvJar tocj, Savepoint save2)
           
protected static String[] determineHeaderColumns(File file)
           
protected static int errorCleanup(Savepoint savepoint, Connection connection, File currentCsv, Exception e)
           
protected static void extractHeaderColumns(TestOpenCsvJar tocj)
           
protected static void generateSourceDestMappings(TestOpenCsvJar tocj)
           
 Connection getConnection()
          Establishes database connection to the target database
protected  void initializeProperties(ETLProperties etlProperties)
           
static void main(String[] args)
           
protected static void setAndExecuteInsertIntoCleansingTablePreparedStatement(Connection c, TestOpenCsvJar tocj, ArrayList<String[]> entries_rawdata, Savepoint save2, PreparedStatement ps_INSERT_CLEANSE)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestOpenCsvJar

public TestOpenCsvJar(String dbms,
                      int portNumber,
                      String userName,
                      String password,
                      String serverName,
                      String dbName)
               throws SagesEtlException
Parameters:
dbms -
portNumber -
userName -
password -
serverName -
dbName -
Throws:
SagesEtlException

TestOpenCsvJar

public TestOpenCsvJar()
               throws SagesEtlException
Parameters:
dbms -
portNumber -
userName -
password -
serverName -
dbName -
Throws:
SagesEtlException
Method Detail

initializeProperties

protected void initializeProperties(ETLProperties etlProperties)
                             throws SagesEtlException
Throws:
SagesEtlException

getConnection

public Connection getConnection()
                         throws SQLException
Establishes database connection to the target database

Returns:
Connection
Throws:
SQLException

abort

public static SagesEtlException abort(String msg,
                                      Throwable e)
returns a SagesEtlException that wraps the original exception

Parameters:
msg - SAGES ETL message to display
e - the original exception
Returns:
SagesEtlException

main

public static void main(String[] args)
                 throws Exception
Parameters:
args -
Throws:
Exception

copyFromCleanseToStaging

protected static void copyFromCleanseToStaging(Connection c,
                                               TestOpenCsvJar tocj,
                                               Savepoint save2)
                                        throws SQLException
Parameters:
c -
tocj -
save2 -
Throws:
SQLException

setAndExecuteInsertIntoCleansingTablePreparedStatement

protected static void setAndExecuteInsertIntoCleansingTablePreparedStatement(Connection c,
                                                                             TestOpenCsvJar tocj,
                                                                             ArrayList<String[]> entries_rawdata,
                                                                             Savepoint save2,
                                                                             PreparedStatement ps_INSERT_CLEANSE)
                                                                      throws SQLException
Parameters:
c -
tocj -
entries_rawdata -
save2 -
ps_INSERT_CLEANSE -
Throws:
SQLException

buildInsertIntoCleansingTableSql

protected static String buildInsertIntoCleansingTableSql(Connection c,
                                                         TestOpenCsvJar tocj)
                                                  throws SQLException
Parameters:
c -
tocj -
Returns:
Throws:
SQLException

generateSourceDestMappings

protected static void generateSourceDestMappings(TestOpenCsvJar tocj)
Parameters:
tocj -

alterStagingTableAddFlagColumn

protected static void alterStagingTableAddFlagColumn(Connection c,
                                                     Savepoint save1,
                                                     Savepoint createCleanseSavepoint)
                                              throws SQLException,
                                                     SagesEtlException
Parameters:
c -
save1 -
createCleanseSavepoint -
Throws:
SQLException
SagesEtlException

buildStagingTable

protected static void buildStagingTable(Connection c,
                                        TestOpenCsvJar tocj,
                                        Savepoint save1)
                                 throws SQLException,
                                        SagesEtlException
Parameters:
c -
tocj -
save1 -
Throws:
SQLException
SagesEtlException

alterCleanseTableAddFlagColumn

protected static void alterCleanseTableAddFlagColumn(Connection c,
                                                     Savepoint save1,
                                                     Savepoint createCleanseSavepoint)
                                              throws SQLException,
                                                     SagesEtlException
Parameters:
c -
save1 -
createCleanseSavepoint -
Throws:
SQLException
SagesEtlException

buildCleanseTable

protected static Savepoint buildCleanseTable(Connection c,
                                             TestOpenCsvJar tocj,
                                             Savepoint save1)
                                      throws SQLException,
                                             SagesEtlException
Parameters:
c -
tocj -
save1 -
Returns:
Throws:
SQLException
SagesEtlException

extractHeaderColumns

protected static void extractHeaderColumns(TestOpenCsvJar tocj)
                                    throws FileNotFoundException,
                                           IOException
Parameters:
tocj -
Throws:
FileNotFoundException
IOException

determineHeaderColumns

protected static String[] determineHeaderColumns(File file)
                                          throws FileNotFoundException,
                                                 IOException
Parameters:
master_entries_rawdata -
file -
Throws:
FileNotFoundException
IOException

errorCleanup

protected static int errorCleanup(Savepoint savepoint,
                                  Connection connection,
                                  File currentCsv,
                                  Exception e)

addFlagColumn

protected static String addFlagColumn(String tableToModify)
Returns:


Copyright © 2013 Johns Hopkins University Applied Physics Laboratory. All rights reserved.