Merge "Issue #1735 Speed ups for AcarsSoundingRecords and conversion to ThriftClient in MonitorDataUtil." into omaha_13.4.1
Former-commit-id:d3517fbb70
[formerlyea2c0e6c40
] [formerlyb24ccfd7a3
] [formerlya422709ab6
[formerlyb24ccfd7a3
[formerly bc12d9c818b72ae16c485a33719817bd15301bca]]] Former-commit-id:a422709ab6
Former-commit-id: e364f2da4f532bb4457a194e508a8bcd3c974e67 [formerly32ea01b8b8
] Former-commit-id:bee4f5fafd
This commit is contained in:
commit
0e59bce548
8 changed files with 172 additions and 74 deletions
|
@ -95,7 +95,6 @@ class Monitor(MonitorP.Monitor):
|
||||||
def __compare(self, taf):
|
def __compare(self, taf):
|
||||||
now = time.time()
|
now = time.time()
|
||||||
text, maxval = [], -1.0
|
text, maxval = [], -1.0
|
||||||
#data = Globals.DRC.getLLWS(self.info['ident'])
|
|
||||||
data = LLWSData.retrieve(self.info['ident'], self.info)
|
data = LLWSData.retrieve(self.info['ident'], self.info)
|
||||||
if data is None:
|
if data is None:
|
||||||
data = []
|
data = []
|
||||||
|
|
|
@ -196,7 +196,6 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
|
||||||
} else {
|
} else {
|
||||||
this.derParLibrary = derParLibrary;
|
this.derParLibrary = derParLibrary;
|
||||||
}
|
}
|
||||||
long startTime = System.currentTimeMillis();
|
|
||||||
DataTree newTree = null;
|
DataTree newTree = null;
|
||||||
newTree = createBaseTree();
|
newTree = createBaseTree();
|
||||||
if (newTree == null) {
|
if (newTree == null) {
|
||||||
|
@ -224,9 +223,6 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println("Time to initialize "
|
|
||||||
+ this.getClass().getSimpleName() + ": "
|
|
||||||
+ (System.currentTimeMillis() - startTime) + "ms");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -27,6 +27,10 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import javax.xml.bind.JAXB;
|
import javax.xml.bind.JAXB;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.core.runtime.Status;
|
||||||
|
import org.eclipse.core.runtime.jobs.Job;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
@ -50,6 +54,7 @@ import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
import com.raytheon.uf.common.status.UFStatus;
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
|
import com.raytheon.uf.viz.core.datastructure.DataCubeContainer;
|
||||||
import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
||||||
import com.raytheon.viz.aviation.climatology.ClimateMenuDlg;
|
import com.raytheon.viz.aviation.climatology.ClimateMenuDlg;
|
||||||
import com.raytheon.viz.aviation.model.ForecastModel;
|
import com.raytheon.viz.aviation.model.ForecastModel;
|
||||||
|
@ -95,6 +100,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||||
* file exists.
|
* file exists.
|
||||||
* 10/02/2012 1229 rferrel Made dialog non-blocking.
|
* 10/02/2012 1229 rferrel Made dialog non-blocking.
|
||||||
* 10/09/2012 1229 rferrel Changes for non-blocking TafMonitorDlg.
|
* 10/09/2012 1229 rferrel Changes for non-blocking TafMonitorDlg.
|
||||||
|
* 04/10/2013 1735 rferrel Changes for taf monitor speed up.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -186,11 +192,21 @@ public class AviationDialog extends CaveSWTDialog implements IBackupRestart {
|
||||||
ForecastModel.getInstance().setBackupRestartUtility(this);
|
ForecastModel.getInstance().setBackupRestartUtility(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected Layout constructShellLayout() {
|
protected Layout constructShellLayout() {
|
||||||
return new GridLayout(1, false);
|
return new GridLayout(1, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void disposed() {
|
protected void disposed() {
|
||||||
font.dispose();
|
font.dispose();
|
||||||
|
@ -211,6 +227,13 @@ public class AviationDialog extends CaveSWTDialog implements IBackupRestart {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
|
||||||
|
* .eclipse.swt.widgets.Shell)
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void initializeComponents(Shell shell) {
|
protected void initializeComponents(Shell shell) {
|
||||||
setReturnValue(false);
|
setReturnValue(false);
|
||||||
|
@ -271,6 +294,25 @@ public class AviationDialog extends CaveSWTDialog implements IBackupRestart {
|
||||||
createLabel();
|
createLabel();
|
||||||
createList();
|
createList();
|
||||||
createComposite();
|
createComposite();
|
||||||
|
initAcarsSounding();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To speed up the display of the monitor this method starts up the Data
|
||||||
|
* Cube for the acarssounding inventory which can take over a second for the
|
||||||
|
* initial retrieval. This may cause blocking issues that slows the display
|
||||||
|
* of the monitor.
|
||||||
|
*/
|
||||||
|
private void initAcarsSounding() {
|
||||||
|
Job job = new Job("AviationDialog") {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
|
DataCubeContainer.getInventory("acarssounding");
|
||||||
|
return Status.OK_STATUS;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
job.schedule();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -221,7 +221,7 @@ public class CigVisByHourTabComp extends Composite implements ICigVisTabComp {
|
||||||
* Data to set.
|
* Data to set.
|
||||||
*/
|
*/
|
||||||
public void setCigVisData(CigVisDistDataManager data) {
|
public void setCigVisData(CigVisDistDataManager data) {
|
||||||
data = data;
|
this.data = data;
|
||||||
cigVisCanvasComp.setCigVisData(data);
|
cigVisCanvasComp.setCigVisData(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ package com.raytheon.viz.aviation.monitor;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -31,18 +32,21 @@ import com.raytheon.edex.plugin.ccfp.CcfpRecord;
|
||||||
import com.raytheon.uf.common.dataplugin.acarssounding.ACARSSoundingRecord;
|
import com.raytheon.uf.common.dataplugin.acarssounding.ACARSSoundingRecord;
|
||||||
import com.raytheon.uf.common.dataplugin.binlightning.BinLightningRecord;
|
import com.raytheon.uf.common.dataplugin.binlightning.BinLightningRecord;
|
||||||
import com.raytheon.uf.common.dataplugin.radar.RadarRecord;
|
import com.raytheon.uf.common.dataplugin.radar.RadarRecord;
|
||||||
|
import com.raytheon.uf.common.dataquery.requests.DbQueryRequest;
|
||||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||||
|
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
|
||||||
|
import com.raytheon.uf.common.dataquery.requests.TimeQueryRequest;
|
||||||
|
import com.raytheon.uf.common.dataquery.responses.DbQueryResponse;
|
||||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
import com.raytheon.uf.common.status.UFStatus;
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
import com.raytheon.uf.common.time.DataTime;
|
import com.raytheon.uf.common.time.DataTime;
|
||||||
import com.raytheon.uf.viz.core.catalog.CatalogQuery;
|
import com.raytheon.uf.viz.core.datastructure.DataCubeContainer;
|
||||||
import com.raytheon.uf.viz.core.catalog.LayerProperty;
|
|
||||||
import com.raytheon.uf.viz.core.comm.Loader;
|
|
||||||
import com.raytheon.uf.viz.core.exception.VizException;
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
|
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility functions for data requesting
|
* Utility functions for data requesting.
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
|
@ -50,6 +54,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Sep 10, 2009 njensen Initial creation
|
* Sep 10, 2009 njensen Initial creation
|
||||||
|
* Apr 10, 2013 1735 rferrel Convert to ThinClient and DbQueryRequests.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -72,22 +77,24 @@ public class MonitorDataUtil {
|
||||||
* Get the lightning data newer than a particular time
|
* Get the lightning data newer than a particular time
|
||||||
*
|
*
|
||||||
* @param time
|
* @param time
|
||||||
* @return
|
* @return records
|
||||||
*/
|
*/
|
||||||
public static BinLightningRecord[] getLightningData(long time) {
|
public static BinLightningRecord[] getLightningData(long time) {
|
||||||
|
DbQueryRequest request = new DbQueryRequest();
|
||||||
|
request.setEntityClass(BinLightningRecord.class);
|
||||||
|
|
||||||
Map<String, RequestConstraint> map = new HashMap<String, RequestConstraint>();
|
Map<String, RequestConstraint> map = new HashMap<String, RequestConstraint>();
|
||||||
map.put("pluginName", new RequestConstraint("binlightning"));
|
map.put("pluginName", new RequestConstraint("binlightning"));
|
||||||
map.put("startTime", new RequestConstraint(SDF.format(new Date(time)),
|
map.put("startTime", new RequestConstraint(SDF.format(new Date(time)),
|
||||||
RequestConstraint.ConstraintType.GREATER_THAN_EQUALS));
|
RequestConstraint.ConstraintType.GREATER_THAN_EQUALS));
|
||||||
LayerProperty lp = new LayerProperty();
|
request.setConstraints(map);
|
||||||
lp.setNumberOfImages(999);
|
request.setLimit(999);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
lp.setEntryQueryParameters(map);
|
DbQueryResponse response = (DbQueryResponse) ThriftClient
|
||||||
List<Object> objs = Loader.loadData(lp, "select", 10000);
|
.sendRequest(request);
|
||||||
BinLightningRecord[] records = new BinLightningRecord[objs.size()];
|
BinLightningRecord[] records = response
|
||||||
for (int i = 0; i < records.length; i++) {
|
.getEntityObjects(BinLightningRecord.class);
|
||||||
records[i] = (BinLightningRecord) objs.get(i);
|
|
||||||
}
|
|
||||||
return records;
|
return records;
|
||||||
} catch (VizException e) {
|
} catch (VizException e) {
|
||||||
statusHandler.handle(Priority.PROBLEM,
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
|
@ -96,39 +103,49 @@ public class MonitorDataUtil {
|
||||||
return new BinLightningRecord[0];
|
return new BinLightningRecord[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Obtain ccfp records greater then or equal to time.
|
||||||
|
*
|
||||||
|
* @param time
|
||||||
|
* @return records
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public static CcfpRecord[] getCcfpData(long time) {
|
public static CcfpRecord[] getCcfpData(long time) {
|
||||||
Map<String, RequestConstraint> map = new HashMap<String, RequestConstraint>();
|
Map<String, RequestConstraint> map = new HashMap<String, RequestConstraint>();
|
||||||
map.put("pluginName", new RequestConstraint("ccfp"));
|
|
||||||
map.put("dataTime.refTime",
|
map.put("dataTime.refTime",
|
||||||
new RequestConstraint(SDF.format(new Date(time)),
|
new RequestConstraint(SDF.format(new Date(time)),
|
||||||
RequestConstraint.ConstraintType.GREATER_THAN_EQUALS));
|
RequestConstraint.ConstraintType.GREATER_THAN_EQUALS));
|
||||||
try {
|
try {
|
||||||
String[] catalog = CatalogQuery.performQuery("dataTime", map);
|
TimeQueryRequest tqRequest = new TimeQueryRequest();
|
||||||
String[] times = catalog;
|
tqRequest.setPluginName("ccfp");
|
||||||
DataTime[] dts = null;
|
tqRequest.setQueryTerms(map);
|
||||||
Arrays.sort(catalog);
|
|
||||||
if (catalog.length > 3) {
|
|
||||||
dts = new DataTime[3];
|
|
||||||
dts[0] = new DataTime(catalog[catalog.length - 1]);
|
|
||||||
dts[1] = new DataTime(catalog[catalog.length - 2]);
|
|
||||||
dts[2] = new DataTime(catalog[catalog.length - 3]);
|
|
||||||
} else {
|
|
||||||
dts = new DataTime[times.length];
|
|
||||||
for (int i = 0; i < catalog.length; i++) {
|
|
||||||
dts[i] = new DataTime(catalog[catalog.length - i - 1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
map.remove("dataTime.refTime");
|
|
||||||
LayerProperty lp = new LayerProperty();
|
|
||||||
lp.setNumberOfImages(999);
|
|
||||||
lp.setSelectedEntryTimes(dts);
|
|
||||||
|
|
||||||
lp.setEntryQueryParameters(map);
|
List<DataTime> dtList = (List<DataTime>) ThriftClient
|
||||||
List<Object> objs = Loader.loadData(lp, "select", 10000);
|
.sendRequest(tqRequest);
|
||||||
CcfpRecord[] records = new CcfpRecord[objs.size()];
|
String[] dts = new String[dtList.size()];
|
||||||
for (int i = 0; i < records.length; i++) {
|
for (int index = 0; index < dts.length; ++index) {
|
||||||
records[i] = (CcfpRecord) objs.get(i);
|
dts[index] = dtList.get(index).toString();
|
||||||
}
|
}
|
||||||
|
map.put("pluginName", new RequestConstraint("ccfp"));
|
||||||
|
Arrays.sort(dts, Collections.reverseOrder());
|
||||||
|
|
||||||
|
if (dts.length > 3) {
|
||||||
|
dts = Arrays.copyOf(dts, 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
map.remove("dataTime.refTime");
|
||||||
|
|
||||||
|
DbQueryRequest request = new DbQueryRequest();
|
||||||
|
request.setEntityClass(CcfpRecord.class);
|
||||||
|
request.setLimit(999);
|
||||||
|
request.setConstraints(map);
|
||||||
|
RequestConstraint dataTimeRC = new RequestConstraint();
|
||||||
|
dataTimeRC.setConstraintType(ConstraintType.IN);
|
||||||
|
dataTimeRC.setConstraintValueList(dts);
|
||||||
|
request.addConstraint("dataTime", dataTimeRC);
|
||||||
|
DbQueryResponse response = (DbQueryResponse) ThriftClient
|
||||||
|
.sendRequest(request);
|
||||||
|
CcfpRecord[] records = response.getEntityObjects(CcfpRecord.class);
|
||||||
return records;
|
return records;
|
||||||
} catch (VizException e) {
|
} catch (VizException e) {
|
||||||
statusHandler.handle(Priority.PROBLEM,
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
|
@ -138,6 +155,13 @@ public class MonitorDataUtil {
|
||||||
return new CcfpRecord[0];
|
return new CcfpRecord[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the most recent radar vertical wind profile.
|
||||||
|
*
|
||||||
|
* @param radar
|
||||||
|
* @param time
|
||||||
|
* @return records
|
||||||
|
*/
|
||||||
public static RadarRecord[] getVerticalWindProfile(String radar, long time) {
|
public static RadarRecord[] getVerticalWindProfile(String radar, long time) {
|
||||||
Map<String, RequestConstraint> map = new HashMap<String, RequestConstraint>();
|
Map<String, RequestConstraint> map = new HashMap<String, RequestConstraint>();
|
||||||
map.put("pluginName", new RequestConstraint("radar"));
|
map.put("pluginName", new RequestConstraint("radar"));
|
||||||
|
@ -147,28 +171,37 @@ public class MonitorDataUtil {
|
||||||
map.put("icao", new RequestConstraint(radar.toLowerCase()));
|
map.put("icao", new RequestConstraint(radar.toLowerCase()));
|
||||||
map.put("mnemonic", new RequestConstraint("VWP"));
|
map.put("mnemonic", new RequestConstraint("VWP"));
|
||||||
|
|
||||||
LayerProperty lp = new LayerProperty();
|
DbQueryRequest request = new DbQueryRequest();
|
||||||
|
request.setEntityClass(RadarRecord.class);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
lp.setEntryQueryParameters(map);
|
DataTime[] dt = DataCubeContainer.performTimeQuery(map, true);
|
||||||
DataTime[] dt = lp.getEntryTimes();
|
map.remove("dataTime.refTime");
|
||||||
|
request.setConstraints(map);
|
||||||
if (dt.length > 0) {
|
if (dt.length > 0) {
|
||||||
lp.setSelectedEntryTimes(new DataTime[] { dt[dt.length - 1] });
|
request.addConstraint("dataTime",
|
||||||
}
|
new RequestConstraint(SDF.format(dt[0].getRefTime())));
|
||||||
|
|
||||||
List<Object> objs = Loader.loadData(lp, "select", 10000);
|
|
||||||
|
|
||||||
RadarRecord[] records = new RadarRecord[objs.size()];
|
|
||||||
for (int i = 0; i < records.length; i++) {
|
|
||||||
records[i] = (RadarRecord) objs.get(i);
|
|
||||||
}
|
}
|
||||||
|
DbQueryResponse response = (DbQueryResponse) ThriftClient
|
||||||
|
.sendRequest(request);
|
||||||
|
RadarRecord[] records = response
|
||||||
|
.getEntityObjects(RadarRecord.class);
|
||||||
return records;
|
return records;
|
||||||
} catch (VizException e) {
|
} catch (VizException e) {
|
||||||
// TODO Auto-generated catch block
|
statusHandler.handle(Priority.ERROR,
|
||||||
e.printStackTrace();
|
"Error retrieving radar vertical wind profile data", e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get ACARS most recent sounding record for a station that is greater then
|
||||||
|
* or equal to time.
|
||||||
|
*
|
||||||
|
* @param stationId
|
||||||
|
* @param time
|
||||||
|
* @return records
|
||||||
|
*/
|
||||||
public static ACARSSoundingRecord[] getAcarsSoundingRecords(
|
public static ACARSSoundingRecord[] getAcarsSoundingRecords(
|
||||||
String stationId, long time) {
|
String stationId, long time) {
|
||||||
Map<String, RequestConstraint> map = new HashMap<String, RequestConstraint>();
|
Map<String, RequestConstraint> map = new HashMap<String, RequestConstraint>();
|
||||||
|
@ -179,24 +212,26 @@ public class MonitorDataUtil {
|
||||||
map.put("location.stationId",
|
map.put("location.stationId",
|
||||||
new RequestConstraint(stationId.substring(1)));
|
new RequestConstraint(stationId.substring(1)));
|
||||||
|
|
||||||
LayerProperty lp = new LayerProperty();
|
DbQueryRequest request = new DbQueryRequest();
|
||||||
|
request.setEntityClass(ACARSSoundingRecord.class);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
lp.setEntryQueryParameters(map);
|
DataTime[] dt = DataCubeContainer.performTimeQuery(map, true);
|
||||||
DataTime[] dt = lp.getEntryTimes();
|
map.remove("dataTime.refTime");
|
||||||
|
request.setConstraints(map);
|
||||||
|
|
||||||
if (dt.length > 0) {
|
if (dt.length > 0) {
|
||||||
lp.setSelectedEntryTimes(new DataTime[] { dt[dt.length - 1] });
|
request.addConstraint("dataTime",
|
||||||
}
|
new RequestConstraint(SDF.format(dt[0].getRefTime())));
|
||||||
|
|
||||||
List<Object> objs = Loader.loadData(lp, "select", 10000);
|
|
||||||
|
|
||||||
ACARSSoundingRecord[] records = new ACARSSoundingRecord[objs.size()];
|
|
||||||
for (int i = 0; i < records.length; i++) {
|
|
||||||
records[i] = (ACARSSoundingRecord) objs.get(i);
|
|
||||||
}
|
}
|
||||||
|
DbQueryResponse response = (DbQueryResponse) ThriftClient
|
||||||
|
.sendRequest(request);
|
||||||
|
ACARSSoundingRecord[] records = response
|
||||||
|
.getEntityObjects(ACARSSoundingRecord.class);
|
||||||
return records;
|
return records;
|
||||||
} catch (VizException e) {
|
} catch (VizException e) {
|
||||||
// TODO Auto-generated catch block
|
statusHandler.handle(Priority.ERROR,
|
||||||
e.printStackTrace();
|
"Error retrieving Acars Sounding Records data", e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,7 +112,7 @@ public class PythonMonitorJob extends AbstractQueueJob<MonitorRequest> {
|
||||||
* Places request on static queue.
|
* Places request on static queue.
|
||||||
*
|
*
|
||||||
* @param req
|
* @param req
|
||||||
* @return
|
* @return true if request is accepted.
|
||||||
*/
|
*/
|
||||||
public static boolean offerRequest(MonitorRequest req) {
|
public static boolean offerRequest(MonitorRequest req) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -288,6 +288,11 @@ public class TafMonitorDlg extends CaveSWTDialog implements
|
||||||
currentDlg = this;
|
currentDlg = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected Layout constructShellLayout() {
|
protected Layout constructShellLayout() {
|
||||||
// Create the main layout for the shell.
|
// Create the main layout for the shell.
|
||||||
|
@ -297,6 +302,11 @@ public class TafMonitorDlg extends CaveSWTDialog implements
|
||||||
return mainLayout;
|
return mainLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void disposed() {
|
protected void disposed() {
|
||||||
SiteGridManager.clear();
|
SiteGridManager.clear();
|
||||||
|
@ -304,6 +314,13 @@ public class TafMonitorDlg extends CaveSWTDialog implements
|
||||||
tveDlg.disposeDialog();
|
tveDlg.disposeDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
|
||||||
|
* .eclipse.swt.widgets.Shell)
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void initializeComponents(Shell shell) {
|
protected void initializeComponents(Shell shell) {
|
||||||
setReturnValue(false);
|
setReturnValue(false);
|
||||||
|
@ -323,6 +340,11 @@ public class TafMonitorDlg extends CaveSWTDialog implements
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialog#preOpened()
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void preOpened() {
|
protected void preOpened() {
|
||||||
checkNow();
|
checkNow();
|
||||||
|
|
|
@ -66,13 +66,17 @@ public class DbQueryResponse implements ISerializableObject {
|
||||||
return getResults().size();
|
return getResults().size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public <T> T[] getEntityObjects(Class<T> entityType) {
|
public <T> T[] getEntityObjects(Class<T> entityType) {
|
||||||
|
return getFieldObjects(ENTITY_RESULT_KEY, entityType);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public <T> T[] getFieldObjects(String fieldKey, Class<T> fieldType) {
|
||||||
List<Map<String, Object>> results = getResults();
|
List<Map<String, Object>> results = getResults();
|
||||||
T[] entities = (T[]) Array.newInstance(entityType, results.size());
|
T[] entities = (T[]) Array.newInstance(fieldType, results.size());
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (Map<String, Object> result : results) {
|
for (Map<String, Object> result : results) {
|
||||||
entities[i++] = entityType.cast(result.get(ENTITY_RESULT_KEY));
|
entities[i++] = fieldType.cast(result.get(fieldKey));
|
||||||
}
|
}
|
||||||
return entities;
|
return entities;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue