|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectPamguardMVC.PamProcess
generalDatabase.DBProcess
public class DBProcess
| Nested Class Summary | |
|---|---|
(package private) class |
DBProcess.TimerAction
|
(package private) class |
DBProcess.ViewTimerAction
|
| Field Summary | |
|---|---|
private DBControl |
databaseControll
|
private java.util.ArrayList<PamDataBlock> |
dataBlocks
|
private java.util.ArrayList<DbSpecial> |
dbSpecials
|
private int |
dbWriteErrors
|
private int |
dbWriteOKs
|
private static java.lang.String |
expMessage
From early 2008 (release 1.1) until August 2008 (release 1.1.1) A LocalTime column had been added to database tables to store the local computer time with each record as well as UTC. |
private LogSettings |
logLastSettings
|
private LogModules |
logModules
|
private LogSettings |
logSettings
|
private javax.swing.Timer |
timer
|
private javax.swing.Timer |
viewTimer
|
| Fields inherited from class PamguardMVC.PamProcess |
|---|
outputDataBlocks, processName, sampleRate |
| Constructor Summary | |
|---|---|
DBProcess(DBControl databaseControll)
|
|
| Method Summary | |
|---|---|
private boolean |
addColumn(EmptyTableDefinition tableDef,
PamTableItem tableItem)
|
boolean |
changeColumnFormat(java.lang.String tableName,
PamTableItem tableItem)
Change the format of a column. |
boolean |
checkColumn(EmptyTableDefinition tableDef,
PamTableItem tableItem)
Check a database table column exists. |
boolean |
checkTable(EmptyTableDefinition tableDef)
Check a database table. |
void |
checkTables()
|
boolean |
clearTable(EmptyTableDefinition tableDef)
Completely clear the contents of a table |
boolean |
clearTable(java.lang.String tableName)
|
boolean |
columnExists(EmptyTableDefinition tableDef,
PamTableItem tableItem)
Check that a specific table column exists |
private boolean |
columnExists(EmptyTableDefinition tableDef,
java.lang.String columnName,
int sqlType)
Check a specific table column exists |
private boolean |
columnExists(java.lang.String tableName,
java.lang.String columnName,
int sqlType)
Check a specific table column exists |
private boolean |
createTable(EmptyTableDefinition tableDef)
Create the entire table from scratch using a single SQL command |
(package private) void |
fixLocalTimeProblem(EmptyTableDefinition tableDef)
|
LogSettings |
getLogLastSettings()
|
LogSettings |
getLogSettings()
|
private boolean |
logData(PamDataBlock block,
PamDataUnit unit)
Hope this doesn't happen during PamguardViewer. |
void |
newData(PamObservable o,
PamDataUnit dataUnit)
|
void |
pamStart()
Called for each process to tell it to start (may not be necessary for processes which are listening for data anyway. |
void |
pamStop()
Stops the process. |
private void |
prepareForMixedMode()
|
private boolean |
reLogData(PamDataBlock block,
PamDataUnit unit)
Hope this doesn't happen during PamguardViewer. |
private boolean |
runStmt(java.lang.String str)
|
boolean |
saveSettingsToDB()
Called from the settings manager whenever settings would normally be saved to file. |
protected boolean |
saveStartSettings()
|
private boolean |
shouldLog(PamDataBlock pamDataBlock,
PamDataUnit pamDataUnit)
|
boolean |
tableExists(EmptyTableDefinition tableDef)
Check a database table exists. |
void |
updateData(PamObservable o,
PamDataUnit dataUnit)
|
protected void |
updateProcessList()
|
private void |
viewTimerAction()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private DBControl databaseControll
private java.util.ArrayList<PamDataBlock> dataBlocks
private javax.swing.Timer timer
private int dbWriteOKs
private int dbWriteErrors
private java.util.ArrayList<DbSpecial> dbSpecials
private javax.swing.Timer viewTimer
private LogModules logModules
private LogSettings logSettings
private LogSettings logLastSettings
private static java.lang.String expMessage
Unfortunately, it transpires that LocalTime is a reserved word in MySQL, so while MS Access databases worked OK, it became impossible to create tables with MySQL.
The column name has now been changed from LocalTime to PCLocalTime. New databases will not be affected, however, there are now old MS Access databases out there that have a LocalTime column, where we need a PCLocalTime column.
This function attempts to fix this automatically.
| Constructor Detail |
|---|
public DBProcess(DBControl databaseControll)
| Method Detail |
|---|
public void pamStart()
PamProcess
pamStart in class PamProcessprotected boolean saveStartSettings()
public void pamStop()
PamProcess
pamStop in class PamProcesspublic boolean saveSettingsToDB()
The logSettings object does a slightly different task of always storing the current PAMGAURD settings in a table which grows and grows, giving a permanent record of PAMGUARD settings over time.
Unlike the settings in the growing table of logSettings, the settings stored from logLastSettings are also stored when viewer or mixed mode is exited.
private void prepareForMixedMode()
private void viewTimerAction()
public void checkTables()
public boolean checkTable(EmptyTableDefinition tableDef)
Then check all columns and if a column does not exist, create that too.
tableDef - table definition
public boolean tableExists(EmptyTableDefinition tableDef)
tableDef - table definition
void fixLocalTimeProblem(EmptyTableDefinition tableDef)
public boolean checkColumn(EmptyTableDefinition tableDef,
PamTableItem tableItem)
tableDef - table definitiontableItem - table item
public boolean columnExists(EmptyTableDefinition tableDef,
PamTableItem tableItem)
tableDef - table definitiontableItem - table item
private boolean columnExists(EmptyTableDefinition tableDef,
java.lang.String columnName,
int sqlType)
tableDef - table definitioncolumnName - column namesqlType - column sql type
private boolean columnExists(java.lang.String tableName,
java.lang.String columnName,
int sqlType)
tableName - table namecolumnName - column namesqlType - column sql type
public boolean changeColumnFormat(java.lang.String tableName,
PamTableItem tableItem)
private boolean runStmt(java.lang.String str)
private boolean createTable(EmptyTableDefinition tableDef)
tableDef - Tabe definition structure
PamTableDefinition
private boolean addColumn(EmptyTableDefinition tableDef,
PamTableItem tableItem)
public boolean clearTable(EmptyTableDefinition tableDef)
tableDef - tabledef identifying the table.
public boolean clearTable(java.lang.String tableName)
protected void updateProcessList()
public void newData(PamObservable o,
PamDataUnit dataUnit)
newData in class PamProcess
public void updateData(PamObservable o,
PamDataUnit dataUnit)
updateData in class PamProcess
private boolean logData(PamDataBlock block,
PamDataUnit unit)
block - unit -
private boolean reLogData(PamDataBlock block,
PamDataUnit unit)
block - unit -
private boolean shouldLog(PamDataBlock pamDataBlock,
PamDataUnit pamDataUnit)
public LogSettings getLogSettings()
public LogSettings getLogLastSettings()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||