Package generalDatabase
Class DBProcess
java.lang.Object
PamguardMVC.PamProcess
generalDatabase.DBProcess
- All Implemented Interfaces:
PamObserver,ProcessAnnotator
-
Field Summary
Fields inherited from class PamguardMVC.PamProcess
outputDataBlocks, parentDataBlock, processName, sampleRate -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanchangeColumnFormat(String tableName, PamTableItem tableItem) Change the format of a column.booleancheckColumn(EmptyTableDefinition tableDef, PamTableItem tableItem) Check a database table column exists.booleancheckTable(EmptyTableDefinition tableDef) Check a database table.booleancheckTable(SQLLogging sqlLogging) Check a table and it's subtable if there is one.voidbooleanclearTable(EmptyTableDefinition tableDef) Completely clear the contents of a tablebooleanclearTable(String tableName) booleancolumnExists(EmptyTableDefinition tableDef, PamTableItem tableItem) Check that a specific table column existsintcolumnNull(String tableName, PamTableItem tableItem) Check to see if a column is empty.booleandeleteDataFrom(long timeMillis) booleandeleteTable(EmptyTableDefinition tableDef) Deletes tablevoidexportDatabaseSchema(JFrame parentFrame) Export all available database schema, converting PamTableDefinitions into valid xsd documents.Returns a list of all table names in the databasegetStoreStatus(DBControlUnit dbControlUnit, boolean getDetail) Get the store status for use with pre-process checks.voidnewData(PamObservable o, PamDataUnit dataUnit) voidpamStart()Called for each process to tell it to start (may not be necessary for processes which are listening for data anyway).voidpamStop()Stops the process.booleanpopulateNewColumn(EmptyTableDefinition tableDef, PamTableItem tableColWithValues, PamTableItem tableColToUpdate) Copies the data from one column to anotherbooleanrenameTable(String oldName, String newName) voidrepopulateLoggerTables(FormsControl formsControlTemp) Similar to the checkTables method, this will copy the logger table information currently in memory to the database.protected booleansaveEndSettings(long timeNow) booleanCalled from the settings manager whenever settings would normally be saved to file.protected booleansaveStartSettings(long timeNow) booleantableExists(EmptyTableDefinition tableDef) Check a database table exists.voidupdateData(PamObservable o, PamDataUnit dataUnit) Informs the PamObserver that existing data have been updatedvoidMethods inherited from class PamguardMVC.PamProcess
absMillisecondsToSamples, absSamplesToMilliseconds, addData, addMultiPlexDataBlock, addOutputDataBlock, changedThreading, clearOldData, createAnnotations, destroyProcess, dumpBufferStatus, flushDataBlockBuffers, getAncestorDataBlock, getAnnotation, getChainPosition, getCompatibleDataUnits, getCpuPercent, getFrequencyRange, getLastSourceNotificationObject, getLastSourceNotificationType, getMuiltiplexDataBlock, getNumAnnotations, getNumMuiltiplexDataBlocks, getNumOutputDataBlocks, getObserverName, getObserverObject, getOfflineData, getOfflineData, getOutputDataBlock, getOutputDataBlocks, getPamControlledUnit, getParentDataBlock, getParentDataBlocks, getParentProcess, getProcessCheck, getProcessName, getRawSourceDataBlock, getRawSourceDataBlock, getRequiredDataHistory, getSampleRate, getSourceDataBlock, getSourceProcess, hasOutputDatablock, isCanMultiThread, isExternalProcess, isMultiplex, makePamProcess, masterClockUpdate, noteNewSettings, notifyModelChanged, prepareProcess, prepareProcessOK, processNewBuoyData, receiveSourceNotification, relMillisecondsToSamples, relSamplesToMilliseconds, removeAllDataBlocks, removeAllMultiPlexDataBlocks, removeMultiPlexDataBlock, removeObservable, removeOutputDatablock, resetDataBlocks, saveViewerData, setCanMultiThread, setExternalProcess, setMultiplex, setParentDataBlock, setParentDataBlock, setProcessCheck, setProcessName, setSampleRate, setupProcess, toString
-
Constructor Details
-
DBProcess
-
-
Method Details
-
pamStart
public void pamStart()Description copied from class:PamProcessCalled for each process to tell it to start (may not be necessary for processes which are listening for data anyway).- Specified by:
pamStartin classPamProcess
-
saveStartSettings
protected boolean saveStartSettings(long timeNow) -
saveEndSettings
protected boolean saveEndSettings(long timeNow) -
pamStop
public void pamStop()Description copied from class:PamProcessStops the process.- Specified by:
pamStopin classPamProcess
-
saveSettingsToDB
public boolean saveSettingsToDB()Called from the settings manager whenever settings would normally be saved to file. Just saves the latest of all PAMGUARD settings, first deleting any other settings in the logLastSettings table.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.
- Returns:
- true if successful.
-
checkTables
public void checkTables() -
repopulateLoggerTables
Similar to the checkTables method, this will copy the logger table information currently in memory to the database. Note that this refers to the form definitions table, beginning with the UDF_ prefix. If the table already exists in the database, the user is given the option to overwrite it with the current format in memory, or leave it in the database as is. Note that a FormsControl object is also passed to this method, as a backup, because the user doesn't necessarily need a User Forms module in their setup. If they are only using the forms for annotations (say, for the detection group localiser) then all they need are the tables in the database. But without a FormsControl object registered to PamController, the repopulateLoggerTables call will fail. If there is a FormsControl object registered to PamController, or if formsControlTemp is null, then formsControlTemp is ignored. The only time it is used is if there is no official Logger form module in the users setup, yet there are UDF tables in the database.- Parameters:
formsControlTemp- a FormsControl object with information about UDF tables in the database. Can be null. Ye
-
checkTable
Check a table and it's subtable if there is one.- Parameters:
sqlLogging-- Returns:
-
checkTable
Check a database table. If it does not exist, create it.Then check all columns and if a column does not exist, create that too.
- Parameters:
tableDef- table definition- Returns:
- true if table is OK, i.e. table and all columns either existed or were successfully created.
-
getListOfTables
Returns a list of all table names in the database- Returns:
-
tableExists
Check a database table exists.- Parameters:
tableDef- table definition- Returns:
- true if the table exists
-
renameTable
- Parameters:
oldName-newName-- Returns:
- true if worked
-
checkColumn
Check a database table column exists. If it doesn't exist, attempt to create it.- Parameters:
tableDef- table definitiontableItem- table item- Returns:
- true if column existed or was created.
-
populateNewColumn
public boolean populateNewColumn(EmptyTableDefinition tableDef, PamTableItem tableColWithValues, PamTableItem tableColToUpdate) Copies the data from one column to another- Parameters:
tableDef- the table to modifytableColWithValues- the table column to copy the values FROMtableColToUpdate- the table column to copy the values TO- Returns:
- true if data was properly copied
-
columnExists
Check that a specific table column exists- Parameters:
tableDef- table definitiontableItem- table item- Returns:
- true if the column exists
-
changeColumnFormat
Change the format of a column.- Returns:
- true if change sucessful
-
columnNull
Check to see if a column is empty.- Parameters:
tableName-tableItem-- Returns:
- 0 if there are data, 1 if no rows at all and 2 if there are data, but some are null
-
deleteTable
Deletes table- Parameters:
tableDef- tableDef identifying the table to be deleted.- Returns:
- true if successful.
-
clearTable
Completely clear the contents of a table- Parameters:
tableDef- tabledef identifying the table.- Returns:
- true if successful.
-
clearTable
-
updateProcessList
public void updateProcessList() -
newData
- Overrides:
newDatain classPamProcess
-
updateData
Description copied from interface:PamObserverInforms the PamObserver that existing data have been updated- Specified by:
updateDatain interfacePamObserver- Overrides:
updateDatain classPamProcess
-
getLogSettings
-
getLogLastSettings
-
getLogViewerSettings
- Returns:
- the logViewerSettings
-
exportDatabaseSchema
Export all available database schema, converting PamTableDefinitions into valid xsd documents.- Parameters:
parentFrame-
-
getStoreStatus
Get the store status for use with pre-process checks.- Parameters:
getDetail- get full details of start and end times.- Returns:
- database store status.
-
deleteDataFrom
public boolean deleteDataFrom(long timeMillis)
-