edu.sc.seis.seisFile.winston
Class WinstonUtil

java.lang.Object
  extended by edu.sc.seis.seisFile.winston.WinstonUtil

public class WinstonUtil
extends java.lang.Object


Field Summary
static java.lang.String MYSQL_DRIVER
           
static long Y1970_TO_Y2000_SECONDS
           
 
Constructor Summary
WinstonUtil(java.lang.String databaseURL, java.lang.String username, java.lang.String password, java.lang.String prefix)
           
WinstonUtil(java.lang.String databaseURL, java.lang.String username, java.lang.String password, java.lang.String prefix, java.lang.String driverClassname)
           
 
Method Summary
 SyncFile calculateSyncBetweenDates(WinstonSCNL channel, int startYear, int startMonth, int startDay, int endYear, int endMonth, int endDay, java.lang.String dataCenterName)
           
 SyncFile calculateSyncForDay(WinstonTable table)
           
 void close()
           
 void createConnection()
           
 WinstonSCNL createWinstonSCNL(java.lang.String station, java.lang.String channel, java.lang.String network, java.lang.String locId)
           
 WinstonTable createWinstonTable(WinstonSCNL database, int year, int month, int day)
           
static double dateToJ2kSeconds(java.util.Date date)
           
 java.util.List<TraceBuf2> extractData(WinstonSCNL channel, java.util.Date startTime, java.util.Date endTime)
           
 java.util.List<TraceBuf2> extractData(WinstonTable table, java.util.Date startTime, java.util.Date endTime)
           
 java.lang.String getDatabaseURL()
           
 java.lang.String getPassword()
           
 java.lang.String getPrefix()
           
 java.lang.String getUsername()
           
static java.util.Date j2KSecondsToDate(double j2kSeconds)
           
 java.util.List<WinstonSCNL> listChannelDatabases()
           
 java.util.List<WinstonTable> listDayTables(WinstonSCNL channel)
           
 java.util.List<WinstonTable> listTablesBetweenDates(WinstonSCNL channel, int startYear, int startMonth, int startDay, int endYear, int endMonth, int endDay)
           
static java.lang.String prefixTableName(java.lang.String prefix, java.lang.String tableName)
           
 void useDatabase(WinstonSCNL channel)
           
 void writeSyncBetweenDates(WinstonSCNL channel, int startYear, int startMonth, int startDay, int endYear, int endMonth, int endDay, SyncFileWriter writer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MYSQL_DRIVER

public static final java.lang.String MYSQL_DRIVER
See Also:
Constant Field Values

Y1970_TO_Y2000_SECONDS

public static final long Y1970_TO_Y2000_SECONDS
See Also:
Constant Field Values
Constructor Detail

WinstonUtil

public WinstonUtil(java.lang.String databaseURL,
                   java.lang.String username,
                   java.lang.String password,
                   java.lang.String prefix)

WinstonUtil

public WinstonUtil(java.lang.String databaseURL,
                   java.lang.String username,
                   java.lang.String password,
                   java.lang.String prefix,
                   java.lang.String driverClassname)
Method Detail

createWinstonSCNL

public WinstonSCNL createWinstonSCNL(java.lang.String station,
                                     java.lang.String channel,
                                     java.lang.String network,
                                     java.lang.String locId)

createWinstonTable

public WinstonTable createWinstonTable(WinstonSCNL database,
                                       int year,
                                       int month,
                                       int day)

listChannelDatabases

public java.util.List<WinstonSCNL> listChannelDatabases()
                                                 throws java.sql.SQLException
Throws:
java.sql.SQLException

useDatabase

public void useDatabase(WinstonSCNL channel)
                 throws java.sql.SQLException
Throws:
java.sql.SQLException

listDayTables

public java.util.List<WinstonTable> listDayTables(WinstonSCNL channel)
                                           throws java.sql.SQLException
Throws:
java.sql.SQLException

listTablesBetweenDates

public java.util.List<WinstonTable> listTablesBetweenDates(WinstonSCNL channel,
                                                           int startYear,
                                                           int startMonth,
                                                           int startDay,
                                                           int endYear,
                                                           int endMonth,
                                                           int endDay)
                                                    throws java.sql.SQLException
Throws:
java.sql.SQLException

calculateSyncBetweenDates

public SyncFile calculateSyncBetweenDates(WinstonSCNL channel,
                                          int startYear,
                                          int startMonth,
                                          int startDay,
                                          int endYear,
                                          int endMonth,
                                          int endDay,
                                          java.lang.String dataCenterName)
                                   throws java.sql.SQLException
Throws:
java.sql.SQLException

writeSyncBetweenDates

public void writeSyncBetweenDates(WinstonSCNL channel,
                                  int startYear,
                                  int startMonth,
                                  int startDay,
                                  int endYear,
                                  int endMonth,
                                  int endDay,
                                  SyncFileWriter writer)
                           throws java.sql.SQLException
Throws:
java.sql.SQLException

calculateSyncForDay

public SyncFile calculateSyncForDay(WinstonTable table)
                             throws java.sql.SQLException
Throws:
java.sql.SQLException

extractData

public java.util.List<TraceBuf2> extractData(WinstonSCNL channel,
                                             java.util.Date startTime,
                                             java.util.Date endTime)
                                      throws java.sql.SQLException,
                                             java.util.zip.DataFormatException
Throws:
java.sql.SQLException
java.util.zip.DataFormatException

extractData

public java.util.List<TraceBuf2> extractData(WinstonTable table,
                                             java.util.Date startTime,
                                             java.util.Date endTime)
                                      throws java.sql.SQLException,
                                             java.util.zip.DataFormatException
Throws:
java.sql.SQLException
java.util.zip.DataFormatException

j2KSecondsToDate

public static java.util.Date j2KSecondsToDate(double j2kSeconds)

dateToJ2kSeconds

public static double dateToJ2kSeconds(java.util.Date date)

getDatabaseURL

public java.lang.String getDatabaseURL()

getUsername

public java.lang.String getUsername()

getPassword

public java.lang.String getPassword()

getPrefix

public java.lang.String getPrefix()

prefixTableName

public static java.lang.String prefixTableName(java.lang.String prefix,
                                               java.lang.String tableName)

createConnection

public void createConnection()
                      throws java.sql.SQLException
Throws:
java.sql.SQLException

close

public void close()
           throws java.sql.SQLException
Throws:
java.sql.SQLException