mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-11-22 07:02:29 +00:00
Log Tethys output and include instrumentid in Deployment queries
This commit is contained in:
parent
4d294b56a8
commit
8257122d14
27
src/tethys/database/TethysActions.java
Normal file
27
src/tethys/database/TethysActions.java
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
package tethys.database;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Possible document actions
|
||||||
|
* @author dg50
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public enum TethysActions {
|
||||||
|
|
||||||
|
ADDDOCUMENT, DELETEDOCUMENT, UPDATEDOCUMENT;
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public String toString() {
|
||||||
|
// switch (this) {
|
||||||
|
// case ADDDOCUMENT:
|
||||||
|
// return "Add document";
|
||||||
|
// case DELETEDOCUMENT:
|
||||||
|
// return "Delete document";
|
||||||
|
// case UPDATEDOCUMENT:
|
||||||
|
// return "Update document";
|
||||||
|
// default:
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
16
src/tethys/database/TethysLogDataBlock.java
Normal file
16
src/tethys/database/TethysLogDataBlock.java
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
package tethys.database;
|
||||||
|
|
||||||
|
import PamguardMVC.PamDataBlock;
|
||||||
|
import PamguardMVC.PamProcess;
|
||||||
|
import tethys.TethysControl;
|
||||||
|
|
||||||
|
public class TethysLogDataBlock extends PamDataBlock<TethysLogDataUnit> {
|
||||||
|
|
||||||
|
private TethysControl tethysControl;
|
||||||
|
|
||||||
|
public TethysLogDataBlock(TethysControl tethysControl) {
|
||||||
|
super(TethysLogDataUnit.class, "Tethys Log", null, 0);
|
||||||
|
this.tethysControl = tethysControl;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
59
src/tethys/database/TethysLogDataUnit.java
Normal file
59
src/tethys/database/TethysLogDataUnit.java
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
package tethys.database;
|
||||||
|
|
||||||
|
import PamguardMVC.PamDataUnit;
|
||||||
|
|
||||||
|
public class TethysLogDataUnit extends PamDataUnit {
|
||||||
|
|
||||||
|
private String collection;
|
||||||
|
private String documentId;
|
||||||
|
private TethysActions action;
|
||||||
|
private String comment;
|
||||||
|
private boolean success;
|
||||||
|
|
||||||
|
public TethysLogDataUnit(long timeMilliseconds, String collection, String documentId, TethysActions action, boolean success, String comment) {
|
||||||
|
super(timeMilliseconds);
|
||||||
|
this.collection = collection;
|
||||||
|
this.documentId = documentId;
|
||||||
|
this.action = action;
|
||||||
|
this.success = success;
|
||||||
|
this.comment = comment;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the collection
|
||||||
|
*/
|
||||||
|
public String getCollection() {
|
||||||
|
return collection;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the documentId
|
||||||
|
*/
|
||||||
|
public String getDocumentId() {
|
||||||
|
return documentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the action
|
||||||
|
*/
|
||||||
|
public TethysActions getAction() {
|
||||||
|
return action;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the comment
|
||||||
|
*/
|
||||||
|
public String getComment() {
|
||||||
|
return comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the success
|
||||||
|
*/
|
||||||
|
public boolean isSuccess() {
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
128
src/tethys/database/TethysLogger.java
Normal file
128
src/tethys/database/TethysLogger.java
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
package tethys.database;
|
||||||
|
|
||||||
|
import java.sql.Types;
|
||||||
|
|
||||||
|
import PamguardMVC.PamDataUnit;
|
||||||
|
import generalDatabase.DBControlUnit;
|
||||||
|
import generalDatabase.DBProcess;
|
||||||
|
import generalDatabase.PamConnection;
|
||||||
|
import generalDatabase.PamTableDefinition;
|
||||||
|
import generalDatabase.PamTableItem;
|
||||||
|
import generalDatabase.SQLLogging;
|
||||||
|
import generalDatabase.SQLTypes;
|
||||||
|
import tethys.TethysControl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logging everything we put into Tethys in our own database.
|
||||||
|
* @author dg50
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class TethysLogger extends SQLLogging {
|
||||||
|
|
||||||
|
private static TethysLogger tethysLogger;
|
||||||
|
|
||||||
|
private TethysControl tethysControl;
|
||||||
|
|
||||||
|
private TethysLogDataBlock logDataBlock;
|
||||||
|
|
||||||
|
private PamTableDefinition tableDefinition;
|
||||||
|
|
||||||
|
private PamTableItem collection, documentId, action, status, comment;
|
||||||
|
|
||||||
|
private boolean tableChecked = false;
|
||||||
|
|
||||||
|
private TethysLogger(TethysControl tethysControl, TethysLogDataBlock pamDataBlock) {
|
||||||
|
super(pamDataBlock);
|
||||||
|
this.tethysControl = tethysControl;
|
||||||
|
this.logDataBlock = pamDataBlock;
|
||||||
|
tableDefinition = new PamTableDefinition("TethysLog");
|
||||||
|
tableDefinition.addTableItem(collection = new PamTableItem("Collection", Types.VARCHAR));
|
||||||
|
tableDefinition.addTableItem(documentId = new PamTableItem("DocumentId", Types.VARCHAR));
|
||||||
|
tableDefinition.addTableItem(action = new PamTableItem("Action", Types.VARCHAR));
|
||||||
|
tableDefinition.addTableItem(status = new PamTableItem("Status", Types.VARCHAR));
|
||||||
|
tableDefinition.addTableItem(comment = new PamTableItem("Comment", Types.VARCHAR));
|
||||||
|
tableDefinition.setUpdatePolicy(UPDATE_POLICY_OVERWRITE);
|
||||||
|
setTableDefinition(tableDefinition);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TethysLogger getTethysLogger(TethysControl tethysControl) {
|
||||||
|
if (tethysLogger == null) {
|
||||||
|
tethysLogger = createTethysLogger(tethysControl);
|
||||||
|
}
|
||||||
|
return tethysLogger;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean checkTable() {
|
||||||
|
if (tableChecked == true) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (findDBProcess() == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
tableChecked = findDBProcess().checkTable(tableDefinition);
|
||||||
|
}
|
||||||
|
return tableChecked;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean logAction(String collection, String documentId, TethysActions action, boolean success, String comment) {
|
||||||
|
PamConnection con = findDBConnection();
|
||||||
|
if (con == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (checkTable() == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
TethysLogDataUnit dataUnit = new TethysLogDataUnit(System.currentTimeMillis(), collection, documentId, action, success, comment);
|
||||||
|
return this.logData(con, dataUnit);
|
||||||
|
}
|
||||||
|
|
||||||
|
private PamConnection findDBConnection() {
|
||||||
|
return DBControlUnit.findConnection();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find the database controlled unit. <br>Must exist in viewer mode surely, but perhaps
|
||||||
|
* created after the Tethys module if the user is really crafty !
|
||||||
|
* @return the DB controlled unit.
|
||||||
|
*/
|
||||||
|
private DBControlUnit findDBControl() {
|
||||||
|
return DBControlUnit.findDatabaseControl();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fine the database process. Should exist.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private DBProcess findDBProcess() {
|
||||||
|
DBControlUnit dbControl = findDBControl();
|
||||||
|
if (dbControl == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return dbControl.getDbProcess();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static TethysLogger createTethysLogger(TethysControl tethysControl) {
|
||||||
|
TethysLogDataBlock datablock = new TethysLogDataBlock(tethysControl);
|
||||||
|
TethysLogger newLogger = new TethysLogger(tethysControl, datablock);
|
||||||
|
return newLogger;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTableData(SQLTypes sqlTypes, PamDataUnit pamDataUnit) {
|
||||||
|
TethysLogDataUnit tldu = (TethysLogDataUnit) pamDataUnit;
|
||||||
|
collection.setValue(tldu.getCollection());
|
||||||
|
documentId.setValue(tldu.getDocumentId());
|
||||||
|
action.setValue(tldu.getAction().toString());
|
||||||
|
status.setValue(tldu.isSuccess() ? "Success" : "Fail");
|
||||||
|
comment.setValue(tldu.getComment());
|
||||||
|
}
|
||||||
|
|
||||||
|
// public TethysLogger(TethysControl tethysControl) {
|
||||||
|
// this.tethysControl = tethysControl;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -19,6 +19,8 @@ import dbxml.Queries;
|
|||||||
import dbxml.uploader.Importer;
|
import dbxml.uploader.Importer;
|
||||||
import nilus.MarshalXML;
|
import nilus.MarshalXML;
|
||||||
import tethys.TethysControl;
|
import tethys.TethysControl;
|
||||||
|
import tethys.database.TethysActions;
|
||||||
|
import tethys.database.TethysLogger;
|
||||||
import tethys.output.TethysExportParams;
|
import tethys.output.TethysExportParams;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -123,6 +125,28 @@ public class DBXMLConnect {
|
|||||||
return retFile;
|
return retFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean postAndLog(Object nilusObject) throws TethysException
|
||||||
|
{
|
||||||
|
TethysException e = null;
|
||||||
|
boolean success = false;
|
||||||
|
try {
|
||||||
|
success = postToTethys(nilusObject);
|
||||||
|
}
|
||||||
|
catch (TethysException ex) {
|
||||||
|
e = ex;
|
||||||
|
}
|
||||||
|
TethysLogger logger = TethysLogger.getTethysLogger(tethysControl);
|
||||||
|
Class objClass = nilusObject.getClass();
|
||||||
|
String collection = getTethysCollection(objClass.getName());
|
||||||
|
String documentId = getDocumentId(nilusObject);
|
||||||
|
logger.logAction(collection, documentId, TethysActions.ADDDOCUMENT, success, "");
|
||||||
|
if (e != null) {
|
||||||
|
throw (e);
|
||||||
|
}
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* take a nilus object loaded with PamGuard data and post it to the Tethys database
|
* take a nilus object loaded with PamGuard data and post it to the Tethys database
|
||||||
*
|
*
|
||||||
@ -130,7 +154,7 @@ public class DBXMLConnect {
|
|||||||
* @return error string, null string means there are no errors
|
* @return error string, null string means there are no errors
|
||||||
* @throws TethysException
|
* @throws TethysException
|
||||||
*/
|
*/
|
||||||
public boolean postToTethys(Object nilusObject) throws TethysException
|
private boolean postToTethys(Object nilusObject) throws TethysException
|
||||||
{
|
{
|
||||||
Class objClass = nilusObject.getClass();
|
Class objClass = nilusObject.getClass();
|
||||||
String collection = getTethysCollection(objClass.getName());
|
String collection = getTethysCollection(objClass.getName());
|
||||||
|
@ -287,6 +287,23 @@ public class DBXMLQueries {
|
|||||||
return projectNames;
|
return projectNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get project deployments that use a specific instrument id. More use than the call without this
|
||||||
|
* extra clause since it can handle overlapping deployments.
|
||||||
|
* @param projectName
|
||||||
|
* @param instrumentId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public ArrayList<nilus.Deployment> getProjectDeployments(String projectName, String instrumentId) {
|
||||||
|
if (projectName == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String qBase = "{\"return\":[\"Deployment\"],\"select\":[{\"op\":\"=\",\"operands\":[\"Deployment/Project\",\"%s\"],\"optype\":\"binary\"},{\"op\":\"=\","
|
||||||
|
+ "\"operands\":[\"Deployment/Instrument/InstrumentId\",\"%s\"],\"optype\":\"binary\"}],\"enclose\":1}";
|
||||||
|
String qStr = String.format(qBase, projectName, instrumentId);
|
||||||
|
|
||||||
|
return runProjectDeploymentsQuery(projectName, qStr);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Get some basic (not all) data for deployments associated with a project. Note that
|
* Get some basic (not all) data for deployments associated with a project. Note that
|
||||||
* this may include deployments which are NOT part of the current dataset. That requires
|
* this may include deployments which are NOT part of the current dataset. That requires
|
||||||
@ -300,7 +317,16 @@ public class DBXMLQueries {
|
|||||||
}
|
}
|
||||||
String qBase = "{\"return\":[\"Deployment\"],\"select\":[{\"op\":\"=\",\"operands\":[\"Deployment/Project\",\"%s\"],\"optype\":\"binary\"}],\"enclose\":1}";
|
String qBase = "{\"return\":[\"Deployment\"],\"select\":[{\"op\":\"=\",\"operands\":[\"Deployment/Project\",\"%s\"],\"optype\":\"binary\"}],\"enclose\":1}";
|
||||||
String qStr = String.format(qBase, projectName);
|
String qStr = String.format(qBase, projectName);
|
||||||
|
return runProjectDeploymentsQuery(projectName, qStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run the actual projects query from either of the two above functions.
|
||||||
|
* @param projectName
|
||||||
|
* @param qStr
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private ArrayList<nilus.Deployment> runProjectDeploymentsQuery(String projectName, String qStr) {
|
||||||
DBQueryResult result = null;
|
DBQueryResult result = null;
|
||||||
try {
|
try {
|
||||||
result = executeQuery(qStr);
|
result = executeQuery(qStr);
|
||||||
|
@ -123,7 +123,7 @@ public class DeploymentHandler implements TethysStateObserver {
|
|||||||
*/
|
*/
|
||||||
public boolean updateProjectDeployments() {
|
public boolean updateProjectDeployments() {
|
||||||
DeploymentData projData = tethysControl.getGlobalDeplopymentData();
|
DeploymentData projData = tethysControl.getGlobalDeplopymentData();
|
||||||
ArrayList<Deployment> tethysDocs = tethysControl.getDbxmlQueries().getProjectDeployments(projData.getProject());
|
ArrayList<Deployment> tethysDocs = tethysControl.getDbxmlQueries().getProjectDeployments(projData.getProject(), getInstrumentId());
|
||||||
if (tethysDocs == null) {
|
if (tethysDocs == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -326,7 +326,7 @@ public class DeploymentHandler implements TethysStateObserver {
|
|||||||
dbxmlConnect.updateDocument(deployment);
|
dbxmlConnect.updateDocument(deployment);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dbxmlConnect.postToTethys(deployment);
|
dbxmlConnect.postAndLog(deployment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (TethysException e) {
|
catch (TethysException e) {
|
||||||
@ -363,7 +363,7 @@ public class DeploymentHandler implements TethysStateObserver {
|
|||||||
dbxmlConnect.updateDocument(deployment);
|
dbxmlConnect.updateDocument(deployment);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dbxmlConnect.postToTethys(deployment);
|
dbxmlConnect.postAndLog(deployment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (TethysException e) {
|
catch (TethysException e) {
|
||||||
|
@ -41,9 +41,15 @@ import tethys.output.StreamExportParams;
|
|||||||
import tethys.output.TethysExportParams;
|
import tethys.output.TethysExportParams;
|
||||||
import tethys.pamdata.TethysDataProvider;
|
import tethys.pamdata.TethysDataProvider;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Functions for handling output of Detections documents.
|
||||||
|
* Works closely with a TethysDataProvider and DataBlockSpeciesManager
|
||||||
|
* to generate Detections elements for an xml doc to export to Tethys.
|
||||||
|
* @author dg50
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class DetectionsHandler {
|
public class DetectionsHandler {
|
||||||
|
|
||||||
|
|
||||||
private TethysControl tethysControl;
|
private TethysControl tethysControl;
|
||||||
|
|
||||||
public int uniqueDetectionsId=1;
|
public int uniqueDetectionsId=1;
|
||||||
@ -53,6 +59,10 @@ public class DetectionsHandler {
|
|||||||
|
|
||||||
private ExportWorker exportWorker;
|
private ExportWorker exportWorker;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param tethysControl
|
||||||
|
*/
|
||||||
public DetectionsHandler(TethysControl tethysControl) {
|
public DetectionsHandler(TethysControl tethysControl) {
|
||||||
super();
|
super();
|
||||||
this.tethysControl = tethysControl;
|
this.tethysControl = tethysControl;
|
||||||
@ -96,159 +106,13 @@ public class DetectionsHandler {
|
|||||||
return new StreamDetectionsSummary(detectionsDocs);
|
return new StreamDetectionsSummary(detectionsDocs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
// /**
|
* Get the Detection Effort part of a Detections document
|
||||||
// * Here is where we export data for a specific data stream to Tethys.
|
* @param pDeployment
|
||||||
// *
|
* @param dataBlock
|
||||||
// * @param aDataBlock
|
* @param exportParams
|
||||||
// * @param aDeployment
|
* @return
|
||||||
// * @param tethysExportParams
|
*/
|
||||||
// * @param streamExportParams
|
|
||||||
// */
|
|
||||||
// public boolean exportDetections(PamDataBlock aDataBlock, Deployment deployment, DetectionGranularity granularity, TethysExportParams tethysExportParams,
|
|
||||||
// StreamExportParams streamExportParams) {
|
|
||||||
// if (granularity == null || granularity.granularity == null) {
|
|
||||||
// granularity = new DetectionGranularity(GRANULARITY.TIME, 3600);
|
|
||||||
// }
|
|
||||||
// switch (granularity.granularity) {
|
|
||||||
// case BINARYFILE:
|
|
||||||
// return exportByBinaryFile(aDataBlock, deployment, tethysExportParams, streamExportParams);
|
|
||||||
// case NONE:
|
|
||||||
// return exportEverything(aDataBlock, deployment, tethysExportParams, streamExportParams);
|
|
||||||
// case TIME:
|
|
||||||
// return exportByTimeChunk(aDataBlock, deployment, granularity.granularityIntervalSeconds, tethysExportParams, streamExportParams);
|
|
||||||
// default:
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return false;
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private boolean exportByBinaryFile(PamDataBlock dataBlock, Deployment deployment,
|
|
||||||
// TethysExportParams tethysExportParams, StreamExportParams streamExportParams) {
|
|
||||||
// long deploymentStart = TethysTimeFuncs.millisFromGregorianXML(deployment.getDeploymentDetails().getAudioTimeStamp());
|
|
||||||
// long deploymentStop = TethysTimeFuncs.millisFromGregorianXML(deployment.getRecoveryDetails().getAudioTimeStamp());
|
|
||||||
// /*
|
|
||||||
// * there should be a pretty good correspondence between the start of a binary file and the deploymentStart
|
|
||||||
// * since they all derived from the same start clock.
|
|
||||||
// */
|
|
||||||
// OfflineDataMap dataMap = dataBlock.getPrimaryDataMap();
|
|
||||||
// if (dataMap == null) {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// List<OfflineDataMapPoint> mapPoints = dataMap.getMapPoints();
|
|
||||||
// boolean ok = true;
|
|
||||||
// for (OfflineDataMapPoint mapPoint : mapPoints) {
|
|
||||||
// if (mapPoint.getEndTime() < deploymentStart) {
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
// if (mapPoint.getStartTime() >= deploymentStop) {
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
// ok &= loadAndExport(dataBlock, deployment, Math.max(deploymentStart, mapPoint.getStartTime()),
|
|
||||||
// Math.min(deploymentStop, mapPoint.getEndTime()), tethysExportParams, streamExportParams);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// return ok;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private boolean exportEverything(PamDataBlock dataBlock, Deployment deployment,
|
|
||||||
// TethysExportParams tethysExportParams, StreamExportParams streamExportParams) {
|
|
||||||
// long deploymentStart = TethysTimeFuncs.millisFromGregorianXML(deployment.getDeploymentDetails().getAudioTimeStamp());
|
|
||||||
// long deploymentStop = TethysTimeFuncs.millisFromGregorianXML(deployment.getRecoveryDetails().getAudioTimeStamp());
|
|
||||||
// return loadAndExport(dataBlock, deployment, deploymentStart, deploymentStop, tethysExportParams, streamExportParams);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private boolean exportByTimeChunk(PamDataBlock dataBlock, Deployment deployment, long granularityIntervalSeconds,
|
|
||||||
// TethysExportParams tethysExportParams, StreamExportParams streamExportParams) {
|
|
||||||
//
|
|
||||||
// long deploymentStart = TethysTimeFuncs.millisFromGregorianXML(deployment.getDeploymentDetails().getAudioTimeStamp());
|
|
||||||
// long deploymentStop = TethysTimeFuncs.millisFromGregorianXML(deployment.getRecoveryDetails().getAudioTimeStamp());
|
|
||||||
// long chunkMillis = granularityIntervalSeconds*1000;
|
|
||||||
// long exportStart = deploymentStart / chunkMillis;
|
|
||||||
// exportStart *= chunkMillis;
|
|
||||||
// boolean ok = true;
|
|
||||||
// while (exportStart < deploymentStop) {
|
|
||||||
// ok &= loadAndExport(dataBlock, deployment, Math.max(deploymentStart, exportStart),
|
|
||||||
// Math.min(deploymentStop, exportStart + chunkMillis), tethysExportParams, streamExportParams);
|
|
||||||
// exportStart += chunkMillis;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return ok;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * Load and export data for a given time period. This may be a complete deployment, it may be a short section. Do as told !
|
|
||||||
// * Hopefully data interval is small enough to hold all in memory - it needs to be if the document will fit in mempory, so should be OK
|
|
||||||
// * @param dataBlock
|
|
||||||
// * @param deployment
|
|
||||||
// * @param max
|
|
||||||
// * @param min
|
|
||||||
// * @param tethysExportParams
|
|
||||||
// * @param streamExportParams
|
|
||||||
// */
|
|
||||||
// private boolean loadAndExport(PamDataBlock dataBlock, Deployment deployment, long startTimeMillis, long endTimeMillis,
|
|
||||||
// TethysExportParams tethysExportParams, StreamExportParams streamExportParams) {
|
|
||||||
// // load the data
|
|
||||||
// dataBlock.loadViewerData(startTimeMillis, endTimeMillis, null);
|
|
||||||
// DataSelector dataSelector = dataBlock.getDataSelector(tethysControl.getDataSelectName(), false);
|
|
||||||
// /*
|
|
||||||
// * for easier synching, get a copy of the data and also apply the data selector right away so that
|
|
||||||
// * we've a list of exactly the right data.
|
|
||||||
// */
|
|
||||||
// ArrayList<PamDataUnit> data = dataBlock.getDataCopy(startTimeMillis, endTimeMillis, true, dataSelector);
|
|
||||||
// /*
|
|
||||||
// * Here, make Detection object and add the DetectionEffort data.
|
|
||||||
// */
|
|
||||||
// DeploymentData globalDeplData = tethysControl.getGlobalDeplopymentData();
|
|
||||||
// TethysDataProvider dataProvider = dataBlock.getTethysDataProvider();
|
|
||||||
// Detections detections = new Detections();
|
|
||||||
//// String prefix = getDetectionsDocIdPrefix(globalDeplData.getProject(), dataBlock);
|
|
||||||
// String prefix = deployment.getId();
|
|
||||||
// detections.setId(String.format("%s_%d", prefix, uniqueDetectionsId++));
|
|
||||||
// detections.setDescription(dataProvider.getDescription(deployment, tethysExportParams));
|
|
||||||
// DataSourceType dataSource = new DataSourceType();
|
|
||||||
// dataSource.setDeploymentId(deployment.getId());
|
|
||||||
//// dataSource.setEnsembleId(""); ToDo
|
|
||||||
// detections.setDataSource(dataSource);
|
|
||||||
// detections.setAlgorithm(dataProvider.getAlgorithm());
|
|
||||||
// detections.setUserId("Unknown user");
|
|
||||||
// detections.setEffort(getDetectorEffort(deployment, startTimeMillis, endTimeMillis));
|
|
||||||
// DetectionGroup detectionGroup = new DetectionGroup();
|
|
||||||
// detections.setOnEffort(detectionGroup);
|
|
||||||
// List<Detection> detectionList = detectionGroup.getDetection();
|
|
||||||
// for (int i = 0; i < data.size(); i++) {
|
|
||||||
// PamDataUnit dataUnit = data.get(i);
|
|
||||||
// Detection detection = dataProvider.createDetection(dataUnit, tethysExportParams, streamExportParams);
|
|
||||||
// if (detection != null) {
|
|
||||||
// detectionList.add(detection);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// System.out.printf("Exporting %d %s detections for time period %s to %s\n", detectionList.size(), dataBlock.getDataName(),
|
|
||||||
// detections.getEffort().getStart().toString(), detections.getEffort().getEnd().toString());
|
|
||||||
// /*
|
|
||||||
// * We should now have a fully populated Detections object, so write it to the database
|
|
||||||
// * using functions in DBXMLConnect
|
|
||||||
// */
|
|
||||||
// ArrayList<Detections> detectionDocuments = new ArrayList();
|
|
||||||
// detectionDocuments.add(detections);
|
|
||||||
//
|
|
||||||
//// tethysControl.getDbxmlConnect().postToTethys(detectionDocuments); // call whatever you need to call in here to write the Detections.
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// return true;
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
// private boolean exportByTimeChunk(PamDataBlock aDataBlock, Deployment deployment, long granularityIntervalSeconds,
|
|
||||||
// TethysExportParams tethysExportParams, StreamExportParams streamExportParams) {
|
|
||||||
// // TODO Auto-generated method stub
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
|
|
||||||
private DetectionEffort getDetectorEffort(PDeployment pDeployment, PamDataBlock dataBlock, StreamExportParams exportParams) {
|
private DetectionEffort getDetectorEffort(PDeployment pDeployment, PamDataBlock dataBlock, StreamExportParams exportParams) {
|
||||||
DetectionEffort effort = new DetectionEffort();
|
DetectionEffort effort = new DetectionEffort();
|
||||||
Deployment deployment = pDeployment.deployment;
|
Deployment deployment = pDeployment.deployment;
|
||||||
@ -312,25 +176,24 @@ public class DetectionsHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param dataBlock
|
||||||
|
* @return default value is PAMGuard
|
||||||
|
*/
|
||||||
public String getSupportSoftware(PamDataBlock dataBlock) {
|
public String getSupportSoftware(PamDataBlock dataBlock) {
|
||||||
return "PAMGuard";
|
return "PAMGuard";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param dataBlock
|
||||||
|
* @return PAMGuard version
|
||||||
|
*/
|
||||||
public String getSupportSoftwareVersion(PamDataBlock dataBlock) {
|
public String getSupportSoftwareVersion(PamDataBlock dataBlock) {
|
||||||
// should try to dig into the binary store and get the version from there.
|
// should try to dig into the binary store and get the version from there.
|
||||||
return PamguardVersionInfo.version;
|
return PamguardVersionInfo.version;
|
||||||
}
|
}
|
||||||
// /**
|
|
||||||
// * Get a prefix for a id for a Detections document. This is just the project name
|
|
||||||
// * and the datablock name. Something may need to be added to allow for multiple
|
|
||||||
// * analysis going into one database.
|
|
||||||
// * @param project
|
|
||||||
// * @param dataBlock
|
|
||||||
// * @return Detections document prefix.
|
|
||||||
// */
|
|
||||||
// public static final String getDetectionsDocIdPrefix(String project, PamDataBlock dataBlock) {
|
|
||||||
// return project + "_" + dataBlock.getDataName();
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detections will be exported in a separate worker thread since export may take some time and
|
* Detections will be exported in a separate worker thread since export may take some time and
|
||||||
@ -375,7 +238,9 @@ public class DetectionsHandler {
|
|||||||
streamExportParams.granularity = allowed[0];
|
streamExportParams.granularity = allowed[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* send a cancel command to export thread if it's running
|
||||||
|
*/
|
||||||
public void cancelExport() {
|
public void cancelExport() {
|
||||||
activeExport = false;
|
activeExport = false;
|
||||||
}
|
}
|
||||||
@ -482,18 +347,6 @@ public class DetectionsHandler {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (documentCount > 500000 && mapPoint != dataMap.getLastMapPoint()) {
|
|
||||||
// prog = new DetectionExportProgress(deployment, currentDetections,
|
|
||||||
// lastUnitTime, totalCount, exportCount, skipCount, DetectionExportProgress.STATE_WRITING);
|
|
||||||
// exportObserver.update(prog);
|
|
||||||
// closeDetectionsDocument(currentDetections, mapPoint.getEndTime());
|
|
||||||
// try {
|
|
||||||
// dbxmlConnect.postToTethys(currentDetections);
|
|
||||||
// } catch (TethysException e) {
|
|
||||||
// tethysControl.showException(e);
|
|
||||||
// }
|
|
||||||
// currentDetections = null;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
Detection dets[] = granularityHandler.cleanup(deployment.getAudioEnd());
|
Detection dets[] = granularityHandler.cleanup(deployment.getAudioEnd());
|
||||||
if (dets != null) {
|
if (dets != null) {
|
||||||
@ -504,9 +357,6 @@ public class DetectionsHandler {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// prog = new DetectionExportProgress(null, null,
|
|
||||||
// lastUnitTime, totalCount, exportCount, skipCount, DetectionExportProgress.STATE_GATHERING);
|
|
||||||
// exportObserver.update(prog);
|
|
||||||
return exportCount;
|
return exportCount;
|
||||||
}/**
|
}/**
|
||||||
* Export detections in all deployments for this PAMGuard dataset.
|
* Export detections in all deployments for this PAMGuard dataset.
|
||||||
@ -601,7 +451,7 @@ public class DetectionsHandler {
|
|||||||
exportObserver.update(prog);
|
exportObserver.update(prog);
|
||||||
closeDetectionsDocument(currentDetections, mapPoint.getEndTime());
|
closeDetectionsDocument(currentDetections, mapPoint.getEndTime());
|
||||||
try {
|
try {
|
||||||
dbxmlConnect.postToTethys(currentDetections);
|
dbxmlConnect.postAndLog(currentDetections);
|
||||||
} catch (TethysException e) {
|
} catch (TethysException e) {
|
||||||
tethysControl.showException(e);
|
tethysControl.showException(e);
|
||||||
}
|
}
|
||||||
@ -627,7 +477,7 @@ public class DetectionsHandler {
|
|||||||
lastUnitTime, totalCount, exportCount, skipCount, DetectionExportProgress.STATE_WRITING);
|
lastUnitTime, totalCount, exportCount, skipCount, DetectionExportProgress.STATE_WRITING);
|
||||||
closeDetectionsDocument(currentDetections, deployment.getAudioEnd());
|
closeDetectionsDocument(currentDetections, deployment.getAudioEnd());
|
||||||
try {
|
try {
|
||||||
dbxmlConnect.postToTethys(currentDetections);
|
dbxmlConnect.postAndLog(currentDetections);
|
||||||
} catch (TethysException e) {
|
} catch (TethysException e) {
|
||||||
tethysControl.showException(e);
|
tethysControl.showException(e);
|
||||||
}
|
}
|
||||||
@ -640,6 +490,15 @@ public class DetectionsHandler {
|
|||||||
exportObserver.update(prog);
|
exportObserver.update(prog);
|
||||||
return DetectionExportProgress.STATE_COMPLETE;
|
return DetectionExportProgress.STATE_COMPLETE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start a new detections document for the deployment and datablock. <br>
|
||||||
|
* Add all the standard information to the top of the Document
|
||||||
|
* @param deployment
|
||||||
|
* @param dataBlock
|
||||||
|
* @param exportParams
|
||||||
|
* @return new Detections document
|
||||||
|
*/
|
||||||
private Detections startDetectionsDocument(PDeployment deployment, PamDataBlock dataBlock,
|
private Detections startDetectionsDocument(PDeployment deployment, PamDataBlock dataBlock,
|
||||||
StreamExportParams exportParams) {
|
StreamExportParams exportParams) {
|
||||||
Detections detections = new Detections();
|
Detections detections = new Detections();
|
||||||
@ -701,6 +560,14 @@ public class DetectionsHandler {
|
|||||||
detections.getEffort().setEnd(TethysTimeFuncs.xmlGregCalFromMillis(audioEnd));
|
detections.getEffort().setEnd(TethysTimeFuncs.xmlGregCalFromMillis(audioEnd));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Worker thread for exporting detections.
|
||||||
|
* Currently, it counts them first, then checks the user wants to export
|
||||||
|
* This requires going through the data twice, but may be sensible to avoid
|
||||||
|
* people outputting stupidly large documents.
|
||||||
|
* @author dg50
|
||||||
|
*
|
||||||
|
*/
|
||||||
private class ExportWorker extends SwingWorker<Integer, DetectionExportProgress> implements DetectionExportObserver {
|
private class ExportWorker extends SwingWorker<Integer, DetectionExportProgress> implements DetectionExportObserver {
|
||||||
|
|
||||||
private PamDataBlock dataBlock;
|
private PamDataBlock dataBlock;
|
||||||
|
@ -174,7 +174,7 @@ public class TethysExporter {
|
|||||||
// System.out.println(deployment.toString());
|
// System.out.println(deployment.toString());
|
||||||
deploymentDocs.add(deployment);
|
deploymentDocs.add(deployment);
|
||||||
try {
|
try {
|
||||||
tethysControl.getDbxmlConnect().postToTethys(deployment);
|
tethysControl.getDbxmlConnect().postAndLog(deployment);
|
||||||
} catch (TethysException e) {
|
} catch (TethysException e) {
|
||||||
tethysControl.showException(e);
|
tethysControl.showException(e);
|
||||||
}
|
}
|
||||||
|
@ -60,9 +60,9 @@ import java.io.StringReader;
|
|||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Automatically provides Tethys data based on the SQL database interface
|
* Automatically provides Tethys data for a PAMGuard datablock.
|
||||||
* for a data block. does most of what needs to be done, though individual modules
|
* Does most of what needs to be done, though individual modules
|
||||||
* may want to override this, call the base createDetection function and then add a
|
* will want to override this, call the base createDetection function and then add a
|
||||||
* few more bespoke elements.
|
* few more bespoke elements.
|
||||||
* @author dg50
|
* @author dg50
|
||||||
*
|
*
|
||||||
@ -86,24 +86,6 @@ abstract public class AutoTethysProvider implements TethysDataProvider {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public TethysSchema getSchema() {
|
|
||||||
// SQLLogging logging = pamDataBlock.getLogging();
|
|
||||||
// if (logging == null) {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
// DBSchemaWriter schemaWriter = new DBSchemaWriter();
|
|
||||||
// Document doc = schemaWriter.generateDatabaseSchema(pamDataBlock, logging, logging.getTableDefinition());
|
|
||||||
// TethysSchema schema = new TethysSchema(doc);
|
|
||||||
// return schema;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public TethysDataPoint getDataPoint(PamDataUnit pamDataUnit) {
|
|
||||||
// // TODO Auto-generated method stub
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DescriptionType getDescription(Deployment deployment, TethysExportParams tethysExportParams) {
|
public DescriptionType getDescription(Deployment deployment, TethysExportParams tethysExportParams) {
|
||||||
@ -155,7 +137,6 @@ abstract public class AutoTethysProvider implements TethysDataProvider {
|
|||||||
try {
|
try {
|
||||||
paramPacker = new TethysParameterPacker(tethysControl);
|
paramPacker = new TethysParameterPacker(tethysControl);
|
||||||
} catch (JAXBException e) {
|
} catch (JAXBException e) {
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
List<Element> genList = paramPacker.packParameters(pamDataBlock);
|
List<Element> genList = paramPacker.packParameters(pamDataBlock);
|
||||||
@ -164,70 +145,17 @@ abstract public class AutoTethysProvider implements TethysDataProvider {
|
|||||||
}
|
}
|
||||||
paramList.addAll(genList);
|
paramList.addAll(genList);
|
||||||
|
|
||||||
// Document doc = XMLUtils.createBlankDoc();
|
|
||||||
// PamguardXMLWriter pamXMLWriter = PamguardXMLWriter.getXMLWriter();
|
|
||||||
// Element dummyEl = doc.createElement("MODULES");
|
|
||||||
// doc.appendChild(dummyEl);
|
|
||||||
// PamSettings[] settingsObjs = getSettingsObjects();
|
|
||||||
// if (settingsObjs == null) {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
//// pamXMLWriter.setStaticNameSpace(TethysControl.xmlNameSpace);
|
|
||||||
// Element settingsEl = pamXMLWriter.writeUnitSettings(doc, dummyEl, pamSettings, settingsObjs);
|
|
||||||
// if (settingsEl == null) {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//// settingsEl = addNameSpaceToElements(doc, settingsEl, TethysControl.xmlNameSpace);
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// dummyEl.appendChild(settingsEl);
|
|
||||||
// NodeList childs = settingsEl.getChildNodes();
|
|
||||||
// for (int i = 0; i < childs.getLength(); i++) {
|
|
||||||
// Node el = childs.item(i);
|
|
||||||
// // System.out.println(el.getNodeName());
|
|
||||||
// if (el instanceof Element) {
|
|
||||||
// paramList.add((Element) el);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // Document doc = pamXMLWriter.writeOneModule((PamSettings) pamControlledUnit, System.currentTimeMillis());
|
|
||||||
// // String moduleXML = null;
|
|
||||||
// if (doc != null) {
|
|
||||||
// // this string should be XML of all the settings for the module controlling this
|
|
||||||
// // datablock.
|
|
||||||
// // moduleXML = pamXMLWriter.getAsString(doc, true); // change to false to get smaller xml
|
|
||||||
// // System.out.printf("Module settings for datablock %s are:\n", moduleXML);
|
|
||||||
// // System.out.println(moduleXML);
|
|
||||||
// // Element pamguard = doc.get("PAMGUARD");
|
|
||||||
// // Element modules = (Element) pamguard.getElementsByTagName("MODULES");
|
|
||||||
// // doc.get
|
|
||||||
// // NodeList childs = doc.getChildNodes();
|
|
||||||
// // for (int i = 0; i < childs.getLength(); i++) {
|
|
||||||
// // Node el = childs.item(i);
|
|
||||||
// // System.out.println(el.getNodeName());
|
|
||||||
// // if (el instanceof Element) {
|
|
||||||
// // paramList.add((Element) el);
|
|
||||||
// // }
|
|
||||||
// // }
|
|
||||||
// // String moduleXML = pamXMLWriter.getAsString(doc, true); // change to false to get smaller xml
|
|
||||||
// // System.out.printf("Module settings for datablock %s are:\n%s", this.pamDataBlock.getDataName(), moduleXML);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // // try the old say
|
|
||||||
// // Document doc2 = pamXMLWriter.writeOneModule((PamSettings) pamControlledUnit, System.currentTimeMillis());
|
|
||||||
// // String moduleXML = null;
|
|
||||||
// // if (doc2 != null) {
|
|
||||||
// // // this string should be XML of all the settings for the module controlling this
|
|
||||||
// // // datablock.
|
|
||||||
// // moduleXML = pamXMLWriter.getAsString(doc2, true); // change to false to get smaller xml
|
|
||||||
// // System.out.printf("Module settings for datablock %s are:\n%s", pamDataBlock.getDataName(),moduleXML);
|
|
||||||
// // }
|
|
||||||
// //
|
|
||||||
|
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Not used. Was an attempt to automatically add name spaces to the PAMGuard settings
|
||||||
|
* XML I generate, but we found a better way.
|
||||||
|
* @param doc
|
||||||
|
* @param settingsEl
|
||||||
|
* @param xmlNameSpace
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
private Element addNameSpaceToElements(Document doc, Element settingsEl, String xmlNameSpace) {
|
private Element addNameSpaceToElements(Document doc, Element settingsEl, String xmlNameSpace) {
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
package tethys.pamdata;
|
|
||||||
|
|
||||||
import PamguardMVC.PamDataUnit;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This will be a unit of Tethys Data, e.g. a Detection.
|
|
||||||
* Can it also be used for things like GPS data ?
|
|
||||||
* @author dg50
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class TethysDataPoint {
|
|
||||||
|
|
||||||
public TethysDataPoint(PamDataUnit dataUnit) {
|
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -40,40 +40,6 @@ import tethys.TethysControl;
|
|||||||
*/
|
*/
|
||||||
public class TethysParameterPacker {
|
public class TethysParameterPacker {
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Parameters should look something like below. however, only packing them with a long
|
|
||||||
// schema name seems to work.
|
|
||||||
// *
|
|
||||||
//<Algorithm>
|
|
||||||
//<Method>Analyst detections</Method>
|
|
||||||
//<Software>Triton</Software>
|
|
||||||
//<Version>unknown</Version>
|
|
||||||
//<Parameters>
|
|
||||||
//<LTSA_plot_time_h>0.75</LTSA_plot_time_h>
|
|
||||||
//<LTSA_low_Hz>0.0</LTSA_low_Hz>
|
|
||||||
//<LTSA_high_Hz>5000.0</LTSA_high_Hz>
|
|
||||||
//<LTSA_brightness>30.0</LTSA_brightness>
|
|
||||||
//</Parameters>
|
|
||||||
//</Algorithm>
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
// // this works. Can look at the source to see how it's done.
|
|
||||||
// // may have fun making this work for more complex structures.
|
|
||||||
// try {
|
|
||||||
// Helper helper = new Helper();
|
|
||||||
// helper.AddAnyElement(paramList, "Threshold", "3.5");
|
|
||||||
//
|
|
||||||
// * and see Matlab code for dbStruct2DOM at C:\Users\dg50\source\repos\TethysMatlab\db
|
|
||||||
// * for more complex structures
|
|
||||||
// * This looks like it may be possible to rewrite my functions for
|
|
||||||
// * writing structures to XML using the helper.AddAnyElement function as
|
|
||||||
// * an example and I should be able to output my complex structures.
|
|
||||||
//
|
|
||||||
// } catch (JAXBException | ParserConfigurationException e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
*/
|
|
||||||
|
|
||||||
private MarshalXML marshaller;
|
private MarshalXML marshaller;
|
||||||
|
|
||||||
private PamguardXMLWriter xmlWriter;
|
private PamguardXMLWriter xmlWriter;
|
||||||
@ -94,6 +60,12 @@ public class TethysParameterPacker {
|
|||||||
xmlWriter = PamguardXMLWriter.getXMLWriter();
|
xmlWriter = PamguardXMLWriter.getXMLWriter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of elements of parameters for all modules feeding
|
||||||
|
* the given datablock. These are given in reverse order.
|
||||||
|
* @param pamDataBlock output datablock
|
||||||
|
* @return parameters of all modules feeding that datablock.
|
||||||
|
*/
|
||||||
public List<Element> packParameters(PamDataBlock pamDataBlock) {
|
public List<Element> packParameters(PamDataBlock pamDataBlock) {
|
||||||
PamProcess pamProcess = pamDataBlock.getParentProcess();
|
PamProcess pamProcess = pamDataBlock.getParentProcess();
|
||||||
PamControlledUnit pamControlledUnit = pamProcess.getPamControlledUnit();
|
PamControlledUnit pamControlledUnit = pamProcess.getPamControlledUnit();
|
||||||
|
@ -7,6 +7,7 @@ import org.w3c.dom.Document;
|
|||||||
* wrapper around an XML string, or a JAXB object or something,
|
* wrapper around an XML string, or a JAXB object or something,
|
||||||
* but may get more sophisticated. TBD in discussions with SDSU
|
* but may get more sophisticated. TBD in discussions with SDSU
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public class TethysSchema {
|
public class TethysSchema {
|
||||||
|
|
||||||
private Document schemaDoc;
|
private Document schemaDoc;
|
||||||
|
Loading…
Reference in New Issue
Block a user