From 76be1e8862f19d6f37eed04a86e4b8539b502350 Mon Sep 17 00:00:00 2001 From: Max Schenkelberg Date: Fri, 6 Sep 2013 15:59:45 -0500 Subject: [PATCH] Issue #2277 Switched DataCubeContainer calls to not use ScriptCreator Amend: Added comments as requested Change-Id: Ib787d43638f20babfc7f89ce2eac958e31d21c3c Former-commit-id: 3509baaa742d44e3f400d41f2b39a9734ea4a44f [formerly 8a500677d3c0b8b9dc55a656dc9f9d53e91cdeaf] [formerly b633f9987a38aca9ef9248e49678a8e81e2ae21d] [formerly 3509baaa742d44e3f400d41f2b39a9734ea4a44f [formerly 8a500677d3c0b8b9dc55a656dc9f9d53e91cdeaf] [formerly b633f9987a38aca9ef9248e49678a8e81e2ae21d] [formerly 2d1db7d0e2e4c9064fe389d41246c2c5f13a253a [formerly b633f9987a38aca9ef9248e49678a8e81e2ae21d [formerly efb402d2835f715143cddffeec2bd7c20d0a65f6]]]] Former-commit-id: 2d1db7d0e2e4c9064fe389d41246c2c5f13a253a Former-commit-id: 70c91ed24b91bc5fb2f4a9a432ef5248bf42418f [formerly 1bdef4ddd33ee93dbff1b9a05084be39c8ec5a13] [formerly c6fb597995ca49d9e40c0fe52f6d3e660affe671 [formerly 61e6dd13165d20c99e96eb27b171947d1ac4caab]] Former-commit-id: c7d9f743abf7aa67f2754beecdece51254dec003 [formerly 66d023227d5df7d5571edf045b1de285cd453653] Former-commit-id: 1a466db041d4dc4e7b3096698a8aba190df6efae --- .../ACARSSoundingDataCubeAdapter.java | 50 +++--- .../coopprecip/CoopPrecipDataCubeAdapter.java | 13 +- .../core/datastructure/DataCubeContainer.java | 53 ++++-- .../datastructure/DefaultDataCubeAdapter.java | 40 +++-- .../core/datastructure/IDataCubeAdapter.java | 20 +-- .../rsc/AbstractRequestableResourceData.java | 47 ++---- cave/com.raytheon.uf.viz.cwat/plugin.xml | 7 - .../adapters/crosssection/GridCSAdapter.java | 21 +-- .../varheight/GridVarHeightAdapter.java | 23 +-- .../data/AbstractDataCubeAdapter.java | 81 +++------ .../npp/viirs/data/VIIRSDataCubeAdapter.java | 17 +- .../uf/viz/npp/AbstractNppResourceData.java | 24 +-- .../com.raytheon.uf.viz.preciprate/plugin.xml | 7 - cave/com.raytheon.uf.viz.qpf/plugin.xml | 9 +- .../AbstractPDOVerticalSoundingProvider.java | 71 -------- .../providers/BufruaSoundingProvider.java | 36 +++- .../providers/GridSoundingProvider.java | 24 ++- .../refresh/ThinClientDataUpdateTree.java | 24 +-- cave/com.raytheon.uf.viz.vil/plugin.xml | 7 - cave/com.raytheon.viz.aviation/plugin.xml | 7 - .../ui/dialog/ChooseByIdDialog.java | 159 +++++++----------- cave/com.raytheon.viz.gfe/build.properties | 3 - cave/com.raytheon.viz.gfe/plugin.xml | 7 - .../scriptTemplates/gfeTemplate.vm | 56 ------ cave/com.raytheon.viz.grid/plugin.xml | 7 - .../viz/grid/util/GridDataCubeAdapter.java | 47 ++---- .../viz/hydrocommon/HydroDisplayManager.java | 33 ++-- cave/com.raytheon.viz.lightning/plugin.xml | 9 +- cave/com.raytheon.viz.pointdata/plugin.xml | 32 ---- .../viz/pointdata/PlotModelGenerator.java | 42 ++--- .../util/HeightOfRequestableData.java | 16 +- .../pointdata/util/PointDataCubeAdapter.java | 121 ++----------- cave/com.raytheon.viz.radar/plugin.xml | 7 - cave/com.raytheon.viz.redbook/plugin.xml | 7 - cave/com.raytheon.viz.satellite/plugin.xml | 7 - .../satellite/SatelliteDataCubeAdapter.java | 123 ++++---------- .../plugin.xml | 13 +- cave/com.raytheon.viz.warngen/plugin.xml | 7 - .../scriptTemplates/warngenRequestTemplate.vm | 21 --- cave/com.raytheon.viz.warnings/plugin.xml | 7 - .../viz/warnings/rsc/AbstractWWAResource.java | 19 +-- .../uf/common/dataplugin/bufrua/UAObs.java | 4 +- .../bufrua/dao/BufrUAPointDataTransform.java | 131 +++++++-------- .../common/dataplugin/PluginDataObject.java | 4 + .../dataquery/requests/DbQueryRequest.java | 8 + .../dataquery/requests/RequestConstraint.java | 39 ++++- .../plugin.xml | 7 - .../gov.noaa.nws.ncep.viz.rsc.atcf/plugin.xml | 7 - .../plugin.xml | 7 - ncep/gov.noaa.nws.ncep.viz.rsc.ffg/plugin.xml | 7 - .../gov.noaa.nws.ncep.viz.rsc.hrcn/plugin.xml | 7 - .../gov.noaa.nws.ncep.viz.rsc.idft/plugin.xml | 7 - .../plugin.xml | 7 - .../plugin.xml | 9 - .../plugin.xml | 7 - .../plugin.xml | 7 - .../plugin.xml | 7 - .../plugin.xml | 7 - .../plugin.xml | 7 - .../plugin.xml | 7 - .../plugin.xml | 7 - ncep/gov.noaa.nws.ncep.viz.rsc.wcp/plugin.xml | 7 - 62 files changed, 501 insertions(+), 1123 deletions(-) delete mode 100644 cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/providers/AbstractPDOVerticalSoundingProvider.java delete mode 100644 cave/com.raytheon.viz.gfe/scriptTemplates/gfeTemplate.vm delete mode 100644 cave/com.raytheon.viz.warngen/scriptTemplates/warngenRequestTemplate.vm diff --git a/cave/com.raytheon.uf.viz.acarssounding/src/com/raytheon/uf/viz/acarssounding/ACARSSoundingDataCubeAdapter.java b/cave/com.raytheon.uf.viz.acarssounding/src/com/raytheon/uf/viz/acarssounding/ACARSSoundingDataCubeAdapter.java index 7cd7d391ed..761b797585 100644 --- a/cave/com.raytheon.uf.viz.acarssounding/src/com/raytheon/uf/viz/acarssounding/ACARSSoundingDataCubeAdapter.java +++ b/cave/com.raytheon.uf.viz.acarssounding/src/com/raytheon/uf/viz/acarssounding/ACARSSoundingDataCubeAdapter.java @@ -29,6 +29,7 @@ import java.util.List; import java.util.Map; import java.util.Set; +import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.acarssounding.ACARSSoundingLayer; import com.raytheon.uf.common.dataplugin.acarssounding.ACARSSoundingRecord; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; @@ -42,8 +43,6 @@ import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.wxmath.ZToPsa; -import com.raytheon.uf.viz.core.catalog.ScriptCreator; -import com.raytheon.uf.viz.core.comm.Loader; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.derivparam.library.DerivedParameterGenerator; import com.raytheon.viz.pointdata.util.AbstractPointDataInventory; @@ -64,6 +63,7 @@ import com.raytheon.viz.pointdata.util.PointDataCubeAdapter; * ------------ ---------- ----------- -------------------------- * Sep 26, 2012 bsteffen Initial javadoc * Aug 14, 2013 2262 dgilling Use new wxmath method for ztopsa. + * Sep 9, 2013 2277 mschenke Got rid of ScriptCreator references * * * @@ -143,36 +143,34 @@ public class ACARSSoundingDataCubeAdapter extends PointDataCubeAdapter { public PointDataContainer getBaseRecords(Collection baseParameters, Map queryParams) throws VizException { List baseParams = new ArrayList(baseParameters); - String script = ScriptCreator.createScript(queryParams, 1000, "select"); - List respList = Loader.loadData(script, 60000); - ACARSSoundingRecord[] records = new ACARSSoundingRecord[respList.size()]; - for (int i = 0; i < records.length; i++) { - records[i] = (ACARSSoundingRecord) respList.get(i); - } + + PluginDataObject[] pdos = getData(queryParams, null); + int numRecords = pdos.length; + Object[] vals = new Object[baseParams.size()]; for (int i = 0; i < baseParams.size(); i++) { String parameter = baseParams.get(i); if (REFTIME.equals(parameter)) { - vals[i] = new long[records.length]; + vals[i] = new long[numRecords]; } else if (FORECASTHR.equals(parameter)) { - vals[i] = new int[records.length]; + vals[i] = new int[numRecords]; } else if (NUMLEVELS.equals(parameter)) { - vals[i] = new int[records.length]; + vals[i] = new int[numRecords]; } else if (STATIONID.equals(parameter)) { - vals[i] = new String[records.length]; + vals[i] = new String[numRecords]; } else if (DATAURI.equals(parameter)) { - vals[i] = new String[records.length]; + vals[i] = new String[numRecords]; } else if (TAILNUMBER.equals(parameter)) { - vals[i] = new String[records.length]; + vals[i] = new String[numRecords]; } else { - vals[i] = new float[records.length][]; + vals[i] = new float[numRecords][]; } } - int[] ids = new int[records.length]; - float[] latitudes = new float[records.length]; - float[] longitudes = new float[records.length]; - for (int i = 0; i < records.length; i++) { - ACARSSoundingRecord record = records[i]; + int[] ids = new int[numRecords]; + float[] latitudes = new float[numRecords]; + float[] longitudes = new float[numRecords]; + for (int i = 0; i < numRecords; i++) { + ACARSSoundingRecord record = (ACARSSoundingRecord) pdos[i]; latitudes[i] = record.getLocation().getLatitude().floatValue(); longitudes[i] = record.getLocation().getLongitude().floatValue(); ids[i] = record.getId(); @@ -189,19 +187,19 @@ public class ACARSSoundingDataCubeAdapter extends PointDataCubeAdapter { if (baseParams.contains(STATIONID)) { int j = baseParams.indexOf(STATIONID); String[] data = (String[]) vals[j]; - data[i] = records[i].getLocation().getStationId(); + data[i] = record.getLocation().getStationId(); } if (baseParams.contains(DATAURI)) { int j = baseParams.indexOf(DATAURI); String[] data = (String[]) vals[j]; - data[i] = records[i].getDataURI(); + data[i] = record.getDataURI(); } // TODO currently it is necessary to remove duplicate flight levels // and pressure values to avoid errors in interpolation when // calculating values at rounded numbers(500mb) however it is not // good to be discarding random data Set uniqueLayers = new HashSet(); - Set allLayers = records[i].getLevels(); + Set allLayers = record.getLevels(); List levels = new ArrayList(); List pressures = new ArrayList(); for (ACARSSoundingLayer layer : allLayers) { @@ -298,8 +296,8 @@ public class ACARSSoundingDataCubeAdapter extends PointDataCubeAdapter { maxLength = val[j].length; } } - float[] newValues = new float[maxLength * records.length]; - for (int j = 0; j < records.length; j++) { + float[] newValues = new float[maxLength * numRecords]; + for (int j = 0; j < numRecords; j++) { for (int k = 0; k < maxLength; k++) { if (val[j] != null && val[j].length > k) { newValues[j * maxLength + k] = val[j][k]; @@ -309,7 +307,7 @@ public class ACARSSoundingDataCubeAdapter extends PointDataCubeAdapter { } } dataRecords[i] = new FloatDataRecord(baseParams.get(i), "", - newValues, 2, new long[] { maxLength, records.length }); + newValues, 2, new long[] { maxLength, numRecords }); } } diff --git a/cave/com.raytheon.uf.viz.coopprecip/src/com/raytheon/uf/viz/coopprecip/CoopPrecipDataCubeAdapter.java b/cave/com.raytheon.uf.viz.coopprecip/src/com/raytheon/uf/viz/coopprecip/CoopPrecipDataCubeAdapter.java index 81182255cb..9812a550bc 100644 --- a/cave/com.raytheon.uf.viz.coopprecip/src/com/raytheon/uf/viz/coopprecip/CoopPrecipDataCubeAdapter.java +++ b/cave/com.raytheon.uf.viz.coopprecip/src/com/raytheon/uf/viz/coopprecip/CoopPrecipDataCubeAdapter.java @@ -43,7 +43,6 @@ import com.raytheon.uf.common.pointdata.PointDataView; import com.raytheon.uf.common.time.BinOffset; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.catalog.DirectDbQuery; -import com.raytheon.uf.viz.core.catalog.LayerProperty; import com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter; import com.raytheon.uf.viz.core.datastructure.VizDataCubeException; import com.raytheon.uf.viz.core.exception.VizException; @@ -54,7 +53,7 @@ import com.vividsolutions.jts.geom.Coordinate; /** * - * TODO Add Description + * {@link IDataCubeAdapter} for coop precip data * *
  * 
@@ -65,6 +64,7 @@ import com.vividsolutions.jts.geom.Coordinate;
  * Dec 3, 2010            bsteffen     Initial creation
  * Aug 14,2012   #1055    dgilling     Fix getData regression from
  *                                     fxatext schema changes.
+ * Sep  9, 2013  #2277    mschenke     Got rid of ScriptCreator references
  * 
  * 
* @@ -388,40 +388,35 @@ public class CoopPrecipDataCubeAdapter implements IDataCubeAdapter { @Override public IDataRecord[] getRecord(PluginDataObject obj) throws VizDataCubeException { - // TODO Auto-generated method stub return null; } @Override public IDataRecord[] getRecord(PluginDataObject obj, Request req, String dataset) throws VizDataCubeException { - // TODO Auto-generated method stub return null; } @Override public void getRecords(List objs, Request req, String dataset) throws VizDataCubeException { - // TODO Auto-generated method stub } @Override - public List getData(LayerProperty property, int timeOut) + public PluginDataObject[] getData( + Map constraints, DataTime[] selectedTimes) throws VizException { - // TODO Auto-generated method stub return null; } @Override public void initInventory() { - // TODO Auto-generated method stub } @Override public Object getInventory() { - // TODO Auto-generated method stub return null; } diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/datastructure/DataCubeContainer.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/datastructure/DataCubeContainer.java index 80ed0d1195..5efaea01d1 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/datastructure/DataCubeContainer.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/datastructure/DataCubeContainer.java @@ -40,7 +40,6 @@ import com.raytheon.uf.common.datastorage.records.IDataRecord; import com.raytheon.uf.common.pointdata.PointDataContainer; import com.raytheon.uf.common.time.BinOffset; import com.raytheon.uf.common.time.DataTime; -import com.raytheon.uf.viz.core.catalog.LayerProperty; import com.raytheon.uf.viz.core.exception.VizException; /** @@ -55,6 +54,7 @@ import com.raytheon.uf.viz.core.exception.VizException; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Jul 22, 2008 brockwoo Initial creation + * Sep 9, 2013 2277 mschenke Got rid of ScriptCreator references * * * @@ -323,24 +323,46 @@ public class DataCubeContainer { } /** - * Returns a list of responses for the requested layer property. If a - * derived parameter, this will piece together the base parameteters. + * Returns {@link PluginDataObject}s for the specified request constraints * - * @param property - * The layer property to request - * @param timeOut - * A timeout period for the request to EDEX - * @return A list of responses + * @param constraints + * @return * @throws VizException */ - public static List getData(LayerProperty property, int timeOut) + public static PluginDataObject[] getData( + Map constraints) throws VizException { + return getData(constraints, (DataTime[]) null); + } + + /** + * Returns {@link PluginDataObject}s for the specified request constraints + * and selected time + * + * @param constraints + * @return + * @throws VizException + */ + public static PluginDataObject[] getData( + Map constraints, DataTime time) throws VizException { - // Regular layer - HashMap originalQuery = property - .getEntryQueryParameters(false); - String pluginName = originalQuery.get("pluginName") + return getData(constraints, time != null ? new DataTime[] { time } + : null); + } + + /** + * Returns {@link PluginDataObject}s for the specified request constraints + * and selected times + * + * @param constraints + * @return + * @throws VizException + */ + public static PluginDataObject[] getData( + Map constraints, DataTime[] times) + throws VizException { + String pluginName = constraints.get(PluginDataObject.PLUGIN_NAME_ID) .getConstraintValue(); - return getInstance(pluginName).adapter.getData(property, timeOut); + return getInstance(pluginName).adapter.getData(constraints, times); } public static Object getInventory(String plugin) { @@ -349,7 +371,8 @@ public class DataCubeContainer { public static List> getBaseUpdateConstraints( Map constraints) { - RequestConstraint pluginRC = constraints.get("pluginName"); + RequestConstraint pluginRC = constraints + .get(PluginDataObject.PLUGIN_NAME_ID); String plugin = null; if (pluginRC != null && pluginRC.getConstraintType() == ConstraintType.EQUALS) { diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/datastructure/DefaultDataCubeAdapter.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/datastructure/DefaultDataCubeAdapter.java index c98b3b970f..166ef36e6a 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/datastructure/DefaultDataCubeAdapter.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/datastructure/DefaultDataCubeAdapter.java @@ -24,16 +24,16 @@ import java.util.List; import java.util.Map; import com.raytheon.uf.common.dataplugin.PluginDataObject; +import com.raytheon.uf.common.dataquery.requests.DbQueryRequest; 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.requests.TimeQueryRequestSet; +import com.raytheon.uf.common.dataquery.responses.DbQueryResponse; import com.raytheon.uf.common.datastorage.Request; import com.raytheon.uf.common.datastorage.records.IDataRecord; import com.raytheon.uf.common.pointdata.PointDataContainer; import com.raytheon.uf.common.time.DataTime; -import com.raytheon.uf.viz.core.catalog.LayerProperty; -import com.raytheon.uf.viz.core.catalog.ScriptCreator; -import com.raytheon.uf.viz.core.comm.Loader; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.requests.ThriftClient; @@ -47,8 +47,8 @@ import com.raytheon.uf.viz.core.requests.ThriftClient; * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Dec 7, 2011 mschenke Initial creation - * + * Dec 7, 2011 mschenke Initial creation + * Sep 9, 2013 2277 mschenke Got rid of ScriptCreator references * * * @author mschenke @@ -188,14 +188,32 @@ public class DefaultDataCubeAdapter implements IDataCubeAdapter { * (non-Javadoc) * * @see - * com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getData(com.raytheon - * .uf.viz.core.catalog.LayerProperty, int) + * com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getData(java. + * util.Map, com.raytheon.uf.common.time.DataTime[]) */ @Override - public List getData(LayerProperty property, int timeOut) + public PluginDataObject[] getData( + Map constraints, DataTime[] selectedTimes) throws VizException { - String scriptToExecute = ScriptCreator.createScript(property); - return Loader.loadScripts(new String[] { scriptToExecute }, timeOut); + DbQueryRequest request = new DbQueryRequest(constraints); + if (selectedTimes != null && selectedTimes.length > 0) { + RequestConstraint timeConstraint = new RequestConstraint(); + if (selectedTimes.length == 1) { + timeConstraint.setConstraintType(ConstraintType.EQUALS); + timeConstraint.setConstraintValue(selectedTimes[0].toString()); + } else { + timeConstraint.setConstraintType(ConstraintType.IN); + String[] times = new String[selectedTimes.length]; + for (int i = 0; i < times.length; ++i) { + times[i] = selectedTimes[i].toString(); + } + timeConstraint.setConstraintValueList(times); + } + request.addConstraint(PluginDataObject.DATATIME_ID, timeConstraint); + } + DbQueryResponse response = (DbQueryResponse) ThriftClient + .sendRequest(request); + return response.getEntityObjects(PluginDataObject.class); } /* @@ -206,7 +224,6 @@ public class DefaultDataCubeAdapter implements IDataCubeAdapter { */ @Override public void initInventory() { - // TODO Auto-generated method stub } @@ -218,7 +235,6 @@ public class DefaultDataCubeAdapter implements IDataCubeAdapter { */ @Override public Object getInventory() { - // TODO Auto-generated method stub return null; } diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/datastructure/IDataCubeAdapter.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/datastructure/IDataCubeAdapter.java index bfe563f73a..8348c61f6e 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/datastructure/IDataCubeAdapter.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/datastructure/IDataCubeAdapter.java @@ -29,7 +29,6 @@ import com.raytheon.uf.common.datastorage.Request; import com.raytheon.uf.common.datastorage.records.IDataRecord; import com.raytheon.uf.common.pointdata.PointDataContainer; import com.raytheon.uf.common.time.DataTime; -import com.raytheon.uf.viz.core.catalog.LayerProperty; import com.raytheon.uf.viz.core.exception.VizException; /** @@ -131,18 +130,19 @@ public interface IDataCubeAdapter { String dataset) throws VizDataCubeException; /** - * Builds a list of responses for the specified LayerPropterty. This - * includes looking at the derived parameter library and determining if any - * derived parameter satisfies the request. The list should contain the - * record type the is expected by the resource. For example, a GribRecord - * would be returned from a GRIB IDataCubeAdapter instance. + * Builds an array of {@link PluginDataObject}s for the specified metadata + * map and times. This includes looking at the derived parameter library and + * determining if any derived parameter satisfies the request. The list + * should contain the record type the is expected by the resource. For + * example, a GribRecord would be returned from a GRIB IDataCubeAdapter + * instance. * - * @param property - * the layer property - * @return A list of records that are expected by the resource + * @param request + * @return * @throws VizException */ - public List getData(LayerProperty property, int timeOut) + public PluginDataObject[] getData( + Map constraints, DataTime[] selectedTimes) throws VizException; /** diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/AbstractRequestableResourceData.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/AbstractRequestableResourceData.java index 8c8d8f0cf3..9d5d0bc4f3 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/AbstractRequestableResourceData.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/AbstractRequestableResourceData.java @@ -23,6 +23,7 @@ import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; @@ -41,6 +42,7 @@ import com.raytheon.uf.common.dataplugin.PluginException; import com.raytheon.uf.common.dataplugin.annotations.DataURIUtil; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.requests.RequestableMetadataMarshaller; +import com.raytheon.uf.common.dataquery.requests.TimeQueryRequest; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; @@ -49,13 +51,13 @@ import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.RecordFactory; import com.raytheon.uf.viz.core.alerts.AbstractAlertMessageParser; import com.raytheon.uf.viz.core.alerts.AlertMessage; -import com.raytheon.uf.viz.core.catalog.LayerProperty; import com.raytheon.uf.viz.core.comm.Loader; import com.raytheon.uf.viz.core.datastructure.DataCubeContainer; import com.raytheon.uf.viz.core.drawables.IDescriptor; import com.raytheon.uf.viz.core.exception.NoDataAvailableException; import com.raytheon.uf.viz.core.exception.NoMatchingTimesException; import com.raytheon.uf.viz.core.exception.VizException; +import com.raytheon.uf.viz.core.requests.ThriftClient; import com.raytheon.uf.viz.core.rsc.IResourceDataChanged.ChangeType; /** @@ -492,10 +494,7 @@ public abstract class AbstractRequestableResourceData extends */ protected PluginDataObject[] requestPluginDataObjects( Collection loadSet) throws VizException { - LayerProperty property = new LayerProperty(); - // TODO fix? - property.setDesiredProduct(ResourceType.PLAN_VIEW); - // property.setDesiredProduct("Imagery"); + Map constraints = getMetadataMap(); BinOffset binOffset = getBinOffset(); @@ -503,14 +502,12 @@ public abstract class AbstractRequestableResourceData extends if (binOffset == null) { // Just ask for the data - property.setEntryQueryParameters(getMetadataMap(), false); - property.setNumberOfImages(9999); selectedEntryTimes = new ArrayList(loadSet); } else { - property.setEntryQueryParameters(getMetadataMap(), true); - property.setNumberOfImages(9999); - // Find all the actual datatimes for the bins - DataTime[] allDataTimes = property.getAllEntryTimes(); + // Find all the actual datatimes for the bins. TODO: Better way to + // do this? Construct time range for each datatime in loadSet and + // request data in that range? + DataTime[] allDataTimes = getAvailableTimes(constraints, null); List trueDataTimes = new ArrayList(); for (DataTime realDataTime : allDataTimes) { @@ -526,8 +523,6 @@ public abstract class AbstractRequestableResourceData extends selectedEntryTimes = trueDataTimes; } - Object[] resp = null; - ArrayList responses = new ArrayList( selectedEntryTimes.size()); @@ -539,21 +534,13 @@ public abstract class AbstractRequestableResourceData extends } List slice = selectedEntryTimes.subList(start, end); - property.setSelectedEntryTimes(slice.toArray(new DataTime[slice - .size()])); - - resp = DataCubeContainer.getData(property, 60000).toArray( - new Object[] {}); - for (Object o : resp) { - responses.add((PluginDataObject) o); - } + PluginDataObject[] pdos = DataCubeContainer.getData( + getMetadataMap(), slice.toArray(new DataTime[0])); + responses.addAll(Arrays.asList(pdos)); } - PluginDataObject[] arr = responses - .toArray(new PluginDataObject[responses.size()]); - - Arrays.sort(arr, layerComparator); - return arr; + Collections.sort(responses, layerComparator); + return responses.toArray(new PluginDataObject[0]); } /** @@ -601,12 +588,8 @@ public abstract class AbstractRequestableResourceData extends Map constraintMap, BinOffset binOffset) throws VizException { Validate.notNull(constraintMap); - LayerProperty property = new LayerProperty(); - - property.setDesiredProduct(ResourceType.PLAN_VIEW); - property.setEntryQueryParameters(constraintMap, true, binOffset); - DataTime[] availableTimes = property.getEntryTimes(); - return availableTimes; + return DataCubeContainer.performTimeQuery(constraintMap, false, + binOffset); } /** diff --git a/cave/com.raytheon.uf.viz.cwat/plugin.xml b/cave/com.raytheon.uf.viz.cwat/plugin.xml index 09880f3eee..81c7b8b45e 100644 --- a/cave/com.raytheon.uf.viz.cwat/plugin.xml +++ b/cave/com.raytheon.uf.viz.cwat/plugin.xml @@ -28,13 +28,6 @@ renderingOrderId="IMAGE_LOCAL" resourceType="PLAN_VIEW"/> - - - - diff --git a/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/crosssection/GridCSAdapter.java b/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/crosssection/GridCSAdapter.java index 04b8d14118..e3e90181ec 100644 --- a/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/crosssection/GridCSAdapter.java +++ b/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/crosssection/GridCSAdapter.java @@ -46,10 +46,8 @@ import com.raytheon.uf.common.geospatial.MapUtil; import com.raytheon.uf.common.geospatial.PointUtil; import com.raytheon.uf.common.gridcoverage.GridCoverage; import com.raytheon.uf.common.time.DataTime; -import com.raytheon.uf.viz.core.catalog.LayerProperty; import com.raytheon.uf.viz.core.datastructure.DataCubeContainer; import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.uf.viz.core.rsc.ResourceType; import com.raytheon.uf.viz.xy.InterpUtils; import com.raytheon.uf.viz.xy.crosssection.adapter.AbstractCrossSectionAdapter; import com.raytheon.uf.viz.xy.crosssection.display.CrossSectionDescriptor; @@ -72,7 +70,8 @@ import com.vividsolutions.jts.geom.Coordinate; * in the data array for anything * below 300MB for RUC80. * Oct 2, 2012 DR 15259 M.Porricelli Allow plotting when 3 levels - * available (DGEX) + * available (DGEX) + * Sep 9, 2013 2277 mschenke Got rid of ScriptCreator references * * * @@ -362,17 +361,11 @@ public class GridCSAdapter extends AbstractCrossSectionAdapter { new RequestConstraint(descriptor.getHeightScale() .getParameter())); - LayerProperty property = new LayerProperty(); - property.setDesiredProduct(ResourceType.PLAN_VIEW); - - property.setEntryQueryParameters(metadataMap, false); - property.setNumberOfImages(9999); - property.setSelectedEntryTimes(new DataTime[] { time }); - - List recs = DataCubeContainer.getData(property, 60000); - yRecords = new HashSet(recs.size()); - for (Object obj : recs) { - yRecords.add((GridRecord) obj); + PluginDataObject[] pdos = DataCubeContainer.getData(metadataMap, + time); + yRecords = new HashSet(pdos.length); + for (PluginDataObject pdo : pdos) { + yRecords.add((GridRecord) pdo); } this.yRecords.put(time, yRecords); if (yRecords.isEmpty()) { diff --git a/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/varheight/GridVarHeightAdapter.java b/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/varheight/GridVarHeightAdapter.java index 6da703c340..f6b2d78c5f 100644 --- a/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/varheight/GridVarHeightAdapter.java +++ b/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/varheight/GridVarHeightAdapter.java @@ -46,10 +46,8 @@ import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.time.DataTime; -import com.raytheon.uf.viz.core.catalog.LayerProperty; import com.raytheon.uf.viz.core.datastructure.DataCubeContainer; import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.uf.viz.core.rsc.ResourceType; import com.raytheon.uf.viz.xy.InterpUtils; import com.raytheon.uf.viz.xy.varheight.adapter.AbstractVarHeightAdapter; import com.raytheon.viz.core.graphing.xy.XYData; @@ -66,7 +64,8 @@ import com.raytheon.viz.grid.inv.GridInventory; * SOFTWARE HISTORY * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * May 7, 2010 bsteffen Initial creation + * May 7, 2010 bsteffen Initial creation + * Sep 9, 2013 2277 mschenke Got rid of ScriptCreator references * * * @@ -373,24 +372,16 @@ public class GridVarHeightAdapter extends AbstractVarHeightAdapter { } } - if (times.size() > 0) { + if (times.isEmpty() == false) { Map metadataMap = new HashMap( resourceData.getMetadataMap()); metadataMap.put(GridInventory.PARAMETER_QUERY, new RequestConstraint(heightScale.getParameter())); - LayerProperty property = new LayerProperty(); - property.setDesiredProduct(ResourceType.PLAN_VIEW); - - property.setEntryQueryParameters(metadataMap, false); - property.setNumberOfImages(9999); - property.setSelectedEntryTimes(times.toArray(new DataTime[times - .size()])); - - List recs = DataCubeContainer.getData(property, 60000); - - for (Object obj : recs) { - GridRecord gRecord = (GridRecord) obj; + PluginDataObject[] pdos = DataCubeContainer.getData(metadataMap, + times.toArray(new DataTime[0])); + for (PluginDataObject pdo : pdos) { + GridRecord gRecord = (GridRecord) pdo; Set recordSet = yRecordMap.get(gRecord .getDataTime()); if (recordSet != null) { diff --git a/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/data/AbstractDataCubeAdapter.java b/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/data/AbstractDataCubeAdapter.java index 1e8b124fbb..a74326d05a 100644 --- a/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/data/AbstractDataCubeAdapter.java +++ b/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/data/AbstractDataCubeAdapter.java @@ -37,10 +37,8 @@ import com.raytheon.uf.common.dataquery.responses.DbQueryResponse; import com.raytheon.uf.common.dataquery.responses.DbQueryResponseSet; import com.raytheon.uf.common.datastorage.Request; import com.raytheon.uf.common.datastorage.records.IDataRecord; -import com.raytheon.uf.common.pointdata.PointDataContainer; import com.raytheon.uf.common.time.DataTime; -import com.raytheon.uf.viz.core.catalog.LayerProperty; -import com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter; +import com.raytheon.uf.viz.core.datastructure.DefaultDataCubeAdapter; import com.raytheon.uf.viz.core.datastructure.VizDataCubeException; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.requests.ThriftClient; @@ -69,11 +67,12 @@ import com.raytheon.uf.viz.derivparam.tree.AbstractRequestableNode; * @version 1.0 */ -public abstract class AbstractDataCubeAdapter implements IDataCubeAdapter { +public abstract class AbstractDataCubeAdapter extends DefaultDataCubeAdapter { private String[] supportedPlugins; protected AbstractDataCubeAdapter(String[] supportedPlugins) { + super(null); this.supportedPlugins = supportedPlugins; } @@ -181,49 +180,19 @@ public abstract class AbstractDataCubeAdapter implements IDataCubeAdapter { * (non-Javadoc) * * @see - * com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getPoints(java - * .lang.String, java.lang.String[], java.util.Map) + * com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getData(java. + * util.Map, com.raytheon.uf.common.time.DataTime[]) */ @Override - public PointDataContainer getPoints(String plugin, String[] parameters, - Map queryParams) throws VizException { - // TODO Someday we should put objective analysis code - // into this area - return null; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getPoints(java - * .lang.String, java.lang.String[], java.lang.String, java.util.Map) - */ - @Override - public PointDataContainer getPoints(String plugin, String[] parameters, - String levelKey, Map queryParams) + public PluginDataObject[] getData( + Map constraints, DataTime[] selectedTimes) throws VizException { - // TODO Someday we should put objective analysis code - // into this area - return null; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getData(com.raytheon - * .uf.viz.core.catalog.LayerProperty, int) - */ - @Override - public List getData(LayerProperty property, int timeOut) - throws VizException { - List requests = evaluateRequestConstraints(property - .getEntryQueryParameters(false)); + List requests = evaluateRequestConstraints(new HashMap( + constraints)); Set availability = null; - if (property.getSelectedEntryTime() != null) { + if (selectedTimes != null) { availability = new HashSet(); - for (DataTime time : property.getSelectedEntryTime()) { + for (DataTime time : selectedTimes) { availability.add(new TimeAndSpace(time)); } } else { @@ -232,8 +201,8 @@ public abstract class AbstractDataCubeAdapter implements IDataCubeAdapter { // pull the actual results from the cache List requesters = new ArrayList(); - MetadataContainer container = createMetadataContainer(property - .getEntryQueryParameters(false)); + MetadataContainer container = createMetadataContainer(new HashMap( + constraints)); for (AbstractRequestableNode request : requests) { container.prepareRequests(request, availability); } @@ -241,7 +210,8 @@ public abstract class AbstractDataCubeAdapter implements IDataCubeAdapter { requesters.addAll(container.getData(request, availability)); } - return getData(property, requesters); + return getData(constraints, selectedTimes, requesters).toArray( + new PluginDataObject[0]); } protected MetadataContainer createMetadataContainer( @@ -255,21 +225,6 @@ public abstract class AbstractDataCubeAdapter implements IDataCubeAdapter { return new AvailabilityContainer(constraints); } - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter# - * getBaseUpdateConstraints(java.util.Map) - */ - @Override - public List> getBaseUpdateConstraints( - Map constraints) { - List> result = new ArrayList>( - 1); - result.add(constraints); - return result; - } - /* * (non-Javadoc) * @@ -321,6 +276,8 @@ public abstract class AbstractDataCubeAdapter implements IDataCubeAdapter { * @param requesters * @return */ - protected abstract List getData(LayerProperty property, - List requesters) throws VizException; + protected abstract List getData( + Map constraints, + DataTime[] selectedTimes, List requesters) + throws VizException; } diff --git a/cave/com.raytheon.uf.viz.npp.viirs/src/com/raytheon/uf/viz/npp/viirs/data/VIIRSDataCubeAdapter.java b/cave/com.raytheon.uf.viz.npp.viirs/src/com/raytheon/uf/viz/npp/viirs/data/VIIRSDataCubeAdapter.java index fa906e4f67..285dbd6e96 100644 --- a/cave/com.raytheon.uf.viz.npp.viirs/src/com/raytheon/uf/viz/npp/viirs/data/VIIRSDataCubeAdapter.java +++ b/cave/com.raytheon.uf.viz.npp.viirs/src/com/raytheon/uf/viz/npp/viirs/data/VIIRSDataCubeAdapter.java @@ -33,7 +33,6 @@ import com.raytheon.uf.common.datastorage.records.IDataRecord; import com.raytheon.uf.common.pointdata.PointDataContainer; import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.time.DataTime; -import com.raytheon.uf.viz.core.catalog.LayerProperty; import com.raytheon.uf.viz.core.datastructure.CubeUtil; import com.raytheon.uf.viz.core.datastructure.VizDataCubeException; import com.raytheon.uf.viz.core.exception.VizException; @@ -196,13 +195,16 @@ public class VIIRSDataCubeAdapter extends AbstractDataCubeAdapter { * (non-Javadoc) * * @see - * com.raytheon.uf.viz.derivparam.data.AbstractDataCubeAdapter#getData(com - * .raytheon.uf.viz.core.catalog.LayerProperty, java.util.List) + * com.raytheon.uf.viz.derivparam.data.AbstractDataCubeAdapter#getData(java + * .util.Map, com.raytheon.uf.common.time.DataTime[], java.util.List) */ @Override - protected List getData(LayerProperty property, - List requesters) throws VizException { - List results = new ArrayList(requesters.size()); + protected List getData( + Map constraints, + DataTime[] selectedTimes, List requesters) + throws VizException { + List results = new ArrayList( + requesters.size()); for (AbstractRequestableData requester : requesters) { List baseRecords = new ArrayList(); findBaseRecords(requester, baseRecords); @@ -258,7 +260,8 @@ public class VIIRSDataCubeAdapter extends AbstractDataCubeAdapter { getBaseUpdateConstraints(baseConstraints, d.node); } } else if (!node.isConstant()) { - // If everything is working correctly than this is dead code, but it is here just in case I missed something. + // If everything is working correctly than this is dead code, but it + // is here just in case I missed something. Activator.statusHandler.handle(Priority.WARN, this.getClass() .getSimpleName() + " cannot determine base constraints for " diff --git a/cave/com.raytheon.uf.viz.npp/src/com/raytheon/uf/viz/npp/AbstractNppResourceData.java b/cave/com.raytheon.uf.viz.npp/src/com/raytheon/uf/viz/npp/AbstractNppResourceData.java index bb15ef8da8..4ac1d2c57c 100644 --- a/cave/com.raytheon.uf.viz.npp/src/com/raytheon/uf/viz/npp/AbstractNppResourceData.java +++ b/cave/com.raytheon.uf.viz.npp/src/com/raytheon/uf/viz/npp/AbstractNppResourceData.java @@ -35,11 +35,9 @@ import javax.xml.bind.annotation.XmlElement; import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; -import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.TimeRange; import com.raytheon.uf.common.time.util.TimeUtil; -import com.raytheon.uf.viz.core.catalog.LayerProperty; import com.raytheon.uf.viz.core.datastructure.DataCubeContainer; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData; @@ -100,23 +98,15 @@ public abstract class AbstractNppResourceData extends DataTime last = timesToLoad.get(timesToLoad.size() - 1); Map requestMap = new HashMap( getMetadataMap()); - RequestConstraint timeConst = new RequestConstraint(); - timeConst.setConstraintType(ConstraintType.BETWEEN); - timeConst - .setBetweenValueList(new String[] { - TimeUtil.formatToSqlTimestamp(first.getValidPeriod() - .getStart()), - TimeUtil.formatToSqlTimestamp(last.getValidPeriod() - .getEnd()) }); - requestMap.put("dataTime.refTime", timeConst); + requestMap.put( + "dataTime.refTime", + new RequestConstraint(TimeUtil.formatToSqlTimestamp(first + .getValidPeriod().getStart()), TimeUtil + .formatToSqlTimestamp(last.getValidPeriod().getEnd()))); - LayerProperty property = new LayerProperty(); - property.setEntryQueryParameters(requestMap, false); - property.setNumberOfImages(Integer.MAX_VALUE); - - List pdos = DataCubeContainer.getData(property, 60000); + PluginDataObject[] pdos = DataCubeContainer.getData(requestMap); List finalList = new ArrayList( - pdos != null ? pdos.size() : 0); + pdos != null ? pdos.length : 0); if (pdos != null) { for (Object obj : pdos) { diff --git a/cave/com.raytheon.uf.viz.preciprate/plugin.xml b/cave/com.raytheon.uf.viz.preciprate/plugin.xml index 6df1ae3f9e..053a68e050 100644 --- a/cave/com.raytheon.uf.viz.preciprate/plugin.xml +++ b/cave/com.raytheon.uf.viz.preciprate/plugin.xml @@ -27,13 +27,6 @@ recordClass="com.raytheon.uf.common.dataplugin.preciprate.PrecipRateRecord" renderingOrderId="IMAGE_LOCAL" resourceType="PLAN_VIEW"/> - - - - diff --git a/cave/com.raytheon.uf.viz.qpf/plugin.xml b/cave/com.raytheon.uf.viz.qpf/plugin.xml index edff58d73d..1ddfaad149 100644 --- a/cave/com.raytheon.uf.viz.qpf/plugin.xml +++ b/cave/com.raytheon.uf.viz.qpf/plugin.xml @@ -28,14 +28,7 @@ renderingOrderId="CONTOUR" resourceType="PLAN_VIEW"/> - - - - - + - * - * SOFTWARE HISTORY - * - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * Jul 26, 2013 2190 mschenke Initial creation - * - * - * - * @author mschenke - * @version 1.0 - */ - -public abstract class AbstractPDOVerticalSoundingProvider extends - AbstractVerticalSoundingProvider { - - @Override - protected PluginDataObject[] queryForData( - Map constraints, DataTime time, - Coordinate location) { - try { - LayerProperty props = new LayerProperty(); - props.setEntryTimes(new DataTime[] { time }); - props.setSelectedEntryTimes(new DataTime[] { time }); - props.setEntryQueryParameters(constraints, false); - return DataCubeContainer.getData(props, Integer.MAX_VALUE).toArray( - new PluginDataObject[0]); - } catch (VizException e) { - throw new RuntimeException("Error querying for sounding records: " - + constraints, e); - } - } - -} diff --git a/cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/providers/BufruaSoundingProvider.java b/cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/providers/BufruaSoundingProvider.java index 1a35d0f36b..bfeb805065 100644 --- a/cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/providers/BufruaSoundingProvider.java +++ b/cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/providers/BufruaSoundingProvider.java @@ -30,15 +30,18 @@ import org.opengis.referencing.operation.TransformException; import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.bufrua.UAObs; import com.raytheon.uf.common.dataplugin.bufrua.UAObsAdapter; +import com.raytheon.uf.common.dataplugin.bufrua.dao.BufrUAPointDataTransform; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.requests.TimeQueryRequest; import com.raytheon.uf.common.geospatial.MapUtil; +import com.raytheon.uf.common.pointdata.PointDataContainer; import com.raytheon.uf.common.sounding.SoundingLayer; import com.raytheon.uf.common.sounding.VerticalSounding; import com.raytheon.uf.common.sounding.adapter.IVerticalSoundingProvider; import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.time.BinOffset; import com.raytheon.uf.common.time.DataTime; +import com.raytheon.uf.viz.core.datastructure.DataCubeContainer; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.requests.ThriftClient; import com.raytheon.uf.viz.sounding.Activator; @@ -55,7 +58,8 @@ import com.vividsolutions.jts.index.strtree.STRtree; * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Jul 22, 2013 2190 mschenke Initial creation + * Jul 22, 2013 2190 mschenke Initial creation + * Sep 9, 2013 2277 mschenke Got rid of ScriptCreator references * * * @@ -63,7 +67,8 @@ import com.vividsolutions.jts.index.strtree.STRtree; * @version 1.0 */ -public class BufruaSoundingProvider extends AbstractPDOVerticalSoundingProvider { +public class BufruaSoundingProvider extends + AbstractVerticalSoundingProvider { private static final double MAX_MOUSE_DISTANCE_DEG = 5.0; @@ -73,7 +78,7 @@ public class BufruaSoundingProvider extends AbstractPDOVerticalSoundingProvider protected DataTime[] queryForSoundingTimes( Map constraints) { TimeQueryRequest request = new TimeQueryRequest(); - request.setPluginName("bufrua"); + request.setPluginName(UAObs.PLUGIN_NAME); request.setBinOffset(new BinOffset(3600, 3600)); request.setQueryTerms(constraints); try { @@ -85,6 +90,31 @@ public class BufruaSoundingProvider extends AbstractPDOVerticalSoundingProvider } } + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.viz.sounding.providers.AbstractVerticalSoundingProvider + * #queryForData(java.util.Map, com.raytheon.uf.common.time.DataTime, + * com.vividsolutions.jts.geom.Coordinate) + */ + @Override + protected PluginDataObject[] queryForData( + Map constraints, DataTime time, + Coordinate location) { + try { + constraints.put(PluginDataObject.DATATIME_ID, + new RequestConstraint(time.toString())); + PointDataContainer pdc = DataCubeContainer.getPointData( + UAObs.PLUGIN_NAME, BufrUAPointDataTransform.MAN_PARAMS, + constraints); + return BufrUAPointDataTransform.toUAObsRecords(pdc); + } catch (VizException e) { + throw new RuntimeException("Error querying for sounding records: " + + constraints, e); + } + } + /* * (non-Javadoc) * diff --git a/cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/providers/GridSoundingProvider.java b/cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/providers/GridSoundingProvider.java index 2b58c2c462..632294a128 100644 --- a/cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/providers/GridSoundingProvider.java +++ b/cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/providers/GridSoundingProvider.java @@ -49,6 +49,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.datastructure.DataCubeContainer; import com.raytheon.uf.viz.core.datastructure.VizDataCubeException; +import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.viz.core.map.GeoUtil; import com.vividsolutions.jts.geom.Coordinate; @@ -69,7 +70,8 @@ import com.vividsolutions.jts.geom.Coordinate; * @version 1.0 */ -public class GridSoundingProvider extends AbstractPDOVerticalSoundingProvider { +public class GridSoundingProvider extends + AbstractVerticalSoundingProvider { private static final String PARAM_TEMP = "T"; @@ -172,6 +174,26 @@ public class GridSoundingProvider extends AbstractPDOVerticalSoundingProvider { new RequestConstraint(Level.getInvalidLevelValueAsString())); } + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.viz.sounding.providers.AbstractVerticalSoundingProvider + * #queryForData(java.util.Map, com.raytheon.uf.common.time.DataTime, + * com.vividsolutions.jts.geom.Coordinate) + */ + @Override + protected PluginDataObject[] queryForData( + Map constraints, DataTime time, + Coordinate location) { + try { + return DataCubeContainer.getData(constraints, time); + } catch (VizException e) { + throw new RuntimeException("Error querying for sounding records: " + + constraints, e); + } + } + /* * (non-Javadoc) * diff --git a/cave/com.raytheon.uf.viz.thinclient.cave/src/com/raytheon/uf/viz/thinclient/cave/refresh/ThinClientDataUpdateTree.java b/cave/com.raytheon.uf.viz.thinclient.cave/src/com/raytheon/uf/viz/thinclient/cave/refresh/ThinClientDataUpdateTree.java index 333d5db5d8..3d3dded27d 100644 --- a/cave/com.raytheon.uf.viz.thinclient.cave/src/com/raytheon/uf/viz/thinclient/cave/refresh/ThinClientDataUpdateTree.java +++ b/cave/com.raytheon.uf.viz.thinclient.cave/src/com/raytheon/uf/viz/thinclient/cave/refresh/ThinClientDataUpdateTree.java @@ -24,7 +24,6 @@ import java.util.Collection; import java.util.Date; import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; import java.util.Set; import java.util.TimeZone; @@ -39,7 +38,6 @@ import com.raytheon.uf.common.time.msgs.GetServerTimeRequest; import com.raytheon.uf.common.time.msgs.GetServerTimeResponse; import com.raytheon.uf.viz.core.RecordFactory; import com.raytheon.uf.viz.core.alerts.AlertMessage; -import com.raytheon.uf.viz.core.catalog.LayerProperty; import com.raytheon.uf.viz.core.datastructure.DataCubeContainer; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.requests.ThriftClient; @@ -103,22 +101,14 @@ public class ThinClientDataUpdateTree extends DataUpdateTree { metadata = new HashMap(metadata); metadata.put("insertTime", new RequestConstraint(time, ConstraintType.GREATER_THAN)); - LayerProperty property = new LayerProperty(); try { - property.setEntryQueryParameters(metadata, false); - List records = DataCubeContainer.getData(property, - 60000); - if (records != null && !records.isEmpty()) { - for (Object record : records) { - if (record instanceof PluginDataObject) { - PluginDataObject pdo = (PluginDataObject) record; - AlertMessage am = new AlertMessage(); - am.dataURI = pdo.getDataURI(); - am.decodedAlert = RecordFactory.getInstance() - .loadMapFromUri(am.dataURI); - messages.add(am); - } - } + PluginDataObject[] pdos = DataCubeContainer.getData(metadata); + for (PluginDataObject pdo : pdos) { + AlertMessage am = new AlertMessage(); + am.dataURI = pdo.getDataURI(); + am.decodedAlert = RecordFactory.getInstance() + .loadMapFromUri(am.dataURI); + messages.add(am); } } catch (VizException e) { statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), diff --git a/cave/com.raytheon.uf.viz.vil/plugin.xml b/cave/com.raytheon.uf.viz.vil/plugin.xml index 66f098a732..6a32720b4b 100644 --- a/cave/com.raytheon.uf.viz.vil/plugin.xml +++ b/cave/com.raytheon.uf.viz.vil/plugin.xml @@ -28,11 +28,4 @@ renderingOrderId="IMAGE_LOCAL" resourceType="PLAN_VIEW"/> - - - - \ No newline at end of file diff --git a/cave/com.raytheon.viz.aviation/plugin.xml b/cave/com.raytheon.viz.aviation/plugin.xml index 2a6e132304..b55243ee4e 100644 --- a/cave/com.raytheon.viz.aviation/plugin.xml +++ b/cave/com.raytheon.viz.aviation/plugin.xml @@ -62,13 +62,6 @@ commandId="com.raytheon.viz.aviation.openavnconfig"> - - - - diff --git a/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/ui/dialog/ChooseByIdDialog.java b/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/ui/dialog/ChooseByIdDialog.java index 6e72a745be..5e65f83fce 100644 --- a/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/ui/dialog/ChooseByIdDialog.java +++ b/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/ui/dialog/ChooseByIdDialog.java @@ -22,10 +22,12 @@ package com.raytheon.viz.awipstools.ui.dialog; import java.io.File; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; import java.util.HashMap; +import java.util.LinkedHashSet; import java.util.List; -import org.apache.commons.lang.ArrayUtils; import org.eclipse.core.runtime.Status; import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.swt.SWT; @@ -49,11 +51,13 @@ import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; +import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.radar.RadarRecord; import com.raytheon.uf.common.dataplugin.radar.util.RadarDataRetriever; import com.raytheon.uf.common.dataplugin.radar.util.RadarRecordUtil; +import com.raytheon.uf.common.dataquery.requests.DbQueryRequest; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; -import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType; +import com.raytheon.uf.common.dataquery.responses.DbQueryResponse; import com.raytheon.uf.common.datastorage.DataStoreFactory; import com.raytheon.uf.common.datastorage.IDataStore; import com.raytheon.uf.common.pointdata.spatial.ObStation; @@ -64,13 +68,10 @@ import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.HDF5Util; import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.VizConstants; -import com.raytheon.uf.viz.core.catalog.LayerProperty; -import com.raytheon.uf.viz.core.catalog.ScriptCreator; -import com.raytheon.uf.viz.core.comm.Loader; import com.raytheon.uf.viz.core.datastructure.DataCubeContainer; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.globals.VizGlobalsManager; -import com.raytheon.uf.viz.core.rsc.ResourceType; +import com.raytheon.uf.viz.core.requests.ThriftClient; import com.raytheon.uf.viz.points.IPointChangedListener; import com.raytheon.uf.viz.points.PointsDataManager; import com.raytheon.viz.awipstools.IToolChangedListener; @@ -95,6 +96,7 @@ import com.vividsolutions.jts.geom.GeometryFactory; * Sep 03, 2013 2310 bsteffen Use IPointChangedListener and * IToolChangedListener instead of * IResourceDataChanged. + * Sep 9, 2013 2277 mschenke Got rid of ScriptCreator references * * * @@ -114,7 +116,7 @@ public class ChooseByIdDialog extends CaveSWTDialog implements private Button pointsRdo, baselinesRdo, homeRdo; private final List changeListeners = new ArrayList(); - + private final List pointStationIdTextFields; private final List baselineStationIdTextFields; @@ -343,28 +345,14 @@ public class ChooseByIdDialog extends CaveSWTDialog implements Coordinate c = null; RadarRecord rr = null; - LayerProperty property = new LayerProperty(); HashMap metadataMap = new HashMap(); - RequestConstraint requestConstraint = null; - Object[] resp = null; DataTime[] availableDataTimes = null; - DataTime[] selectedDataTimes = null; + Collection selectedDataTimes = new LinkedHashSet(); - requestConstraint = new RequestConstraint(); - requestConstraint.setConstraintType(ConstraintType.EQUALS); - requestConstraint.setConstraintValue("149"); - metadataMap.put("productCode", requestConstraint); - - requestConstraint = new RequestConstraint(); - requestConstraint.setConstraintType(ConstraintType.EQUALS); - requestConstraint.setConstraintValue("radar"); - metadataMap.put("pluginName", requestConstraint); - - requestConstraint = new RequestConstraint(); - requestConstraint.setConstraintType(ConstraintType.EQUALS); - requestConstraint.setConstraintValue("Graphic"); - metadataMap.put("format", requestConstraint); + metadataMap.put("productCode", new RequestConstraint("149")); + metadataMap.put("pluginName", new RequestConstraint("radar")); + metadataMap.put("format", new RequestConstraint("Graphic")); try { availableDataTimes = DataCubeContainer.performTimeQuery( @@ -379,70 +367,52 @@ public class ChooseByIdDialog extends CaveSWTDialog implements } if (availableDataTimes != null && availableDataTimes.length > 0) { - Arrays.sort(availableDataTimes); - ArrayUtils.reverse(availableDataTimes); + Arrays.sort(availableDataTimes, Collections.reverseOrder()); - selectedDataTimes = new DataTime[frameCount]; - int count = 0; - int numElements = availableDataTimes.length; - int indx = 0; - while (count < frameCount && indx < numElements) { - boolean found = false; - DataTime dt = availableDataTimes[indx]; - if (dt == null) { - ++indx; - continue; + for (int i = 0; i < availableDataTimes.length + && selectedDataTimes.size() < frameCount; ++i) { + DataTime dt = availableDataTimes[i]; + if (dt != null) { + selectedDataTimes.add(dt); } - - for (DataTime t : selectedDataTimes) { - if (dt.equals(t)) { - found = true; - } - } - - if (!found) { - selectedDataTimes[count] = dt; - ++count; - } - ++indx; } } - property.setDesiredProduct(ResourceType.PLAN_VIEW); - property.setNumberOfImages(9999); - property.setSelectedEntryTimes(selectedDataTimes); - - try { - property.setEntryQueryParameters(metadataMap, false); - resp = DataCubeContainer.getData(property, 60000).toArray( - new Object[] {}); - } catch (Exception e) { - Status s = new Status(Status.INFO, UiPlugin.PLUGIN_ID, - "The query for the entered Mesocyclone ID has failed."); - ErrorDialog.openError(Display.getCurrent().getActiveShell(), - "Error Finding Mesocyclone ID", - "Error Finding Mesocyclone ID", s); - return null; - } - - for (int i = 0; i < resp.length; i++) { - rr = (RadarRecord) resp[i]; - File loc = HDF5Util.findHDF5Location(rr); - - IDataStore dataStore = DataStoreFactory.getDataStore(loc); + if (selectedDataTimes.isEmpty() == false) { + PluginDataObject[] resp = null; try { - RadarDataRetriever.populateRadarRecord(dataStore, rr); + resp = DataCubeContainer.getData(metadataMap, + selectedDataTimes.toArray(new DataTime[0])); } catch (Exception e) { - e.printStackTrace(); + Status s = new Status(Status.INFO, UiPlugin.PLUGIN_ID, + "The query for the entered Mesocyclone ID has failed."); + ErrorDialog.openError( + Display.getCurrent().getActiveShell(), + "Error Finding Mesocyclone ID", + "Error Finding Mesocyclone ID", s); + return null; } - List ids = RadarRecordUtil.getDMDFeatureIDs(rr); - if (!ids.contains(mesoId)) { - continue; + for (int i = 0; i < resp.length; i++) { + rr = (RadarRecord) resp[i]; + File loc = HDF5Util.findHDF5Location(rr); + + IDataStore dataStore = DataStoreFactory.getDataStore(loc); + + try { + RadarDataRetriever.populateRadarRecord(dataStore, rr); + } catch (Exception e) { + e.printStackTrace(); + } + + List ids = RadarRecordUtil.getDMDFeatureIDs(rr); + if (!ids.contains(mesoId)) { + continue; + } + c = RadarRecordUtil.getDMDLonLatFromFeatureID(rr, mesoId); + break; } - c = RadarRecordUtil.getDMDLonLatFromFeatureID(rr, mesoId); - break; } return c; @@ -454,33 +424,26 @@ public class ChooseByIdDialog extends CaveSWTDialog implements * @return the ObStation with the given stationID */ private ObStation getObStation(String stationID) { + ObStation obStation = null; + DbQueryRequest request = new DbQueryRequest(); + request.addConstraint( + "gid", + new RequestConstraint(ObStation.createGID( + ObStation.CAT_TYPE_ICAO, stationID))); + request.setEntityClass(ObStation.class); + request.setLimit(1); - HashMap query = new HashMap(); - query.put("pluginName", new RequestConstraint("table")); - query.put("databasename", new RequestConstraint("metadata")); - query.put("classname", - new RequestConstraint(ObStation.class.getCanonicalName())); - String gid = ObStation - .createGID(ObStation.CAT_TYPE_ICAO, stationID); - query.put("gid", new RequestConstraint(gid)); - - LayerProperty lpParm = new LayerProperty(); - - List list = null; try { - lpParm.setEntryQueryParameters(query, false); - String tableScript = ScriptCreator.createScript(lpParm); - list = Loader.loadData(tableScript, 10000); + DbQueryResponse response = (DbQueryResponse) ThriftClient + .sendRequest(request); + if (response.getNumResults() == 1) { + obStation = response.getEntityObjects(ObStation.class)[0]; + } } catch (VizException e) { statusHandler.handle(Priority.WARN, "Error querying for points", e); } - ObStation obStation = null; - if (list != null && list.size() != 0) { - obStation = ((ObStation) (list.get(0))); - } - return obStation; } diff --git a/cave/com.raytheon.viz.gfe/build.properties b/cave/com.raytheon.viz.gfe/build.properties index fd64ec8139..2edb123d08 100644 --- a/cave/com.raytheon.viz.gfe/build.properties +++ b/cave/com.raytheon.viz.gfe/build.properties @@ -4,12 +4,9 @@ bin.includes = META-INF/,\ plugin.xml,\ T.bin,\ Td.bin,\ - scriptTemplates/,\ icons/,\ - config.xml,\ localization/,\ images/,\ help/,\ - OSGI-INF/component.xml,\ res/ source.. = src/ diff --git a/cave/com.raytheon.viz.gfe/plugin.xml b/cave/com.raytheon.viz.gfe/plugin.xml index 171e37d05f..ce040a602c 100644 --- a/cave/com.raytheon.viz.gfe/plugin.xml +++ b/cave/com.raytheon.viz.gfe/plugin.xml @@ -1789,13 +1789,6 @@ - - - - - - - - - getData(LayerProperty property, - List requesters) throws VizException { - List results = new ArrayList(requesters.size()); + protected List getData( + Map constraints, + DataTime[] selectedTimes, List requesters) + throws VizException { + List results = new ArrayList( + requesters.size()); for (AbstractRequestableData requester : requesters) { List records = new ArrayList(); if (requester.getDataTime() == null || requester.getTimeAndSpace().isTimeAgnostic()) { - DataTime[] entryTime = property.getSelectedEntryTime(); + DataTime[] entryTime = selectedTimes; if (entryTime != null && entryTime.length > 0) { List entryTimes = new ArrayList( Arrays.asList(entryTime)); @@ -429,21 +430,15 @@ public class GridDataCubeAdapter extends AbstractDataCubeAdapter { RequestableDataRecord rec = new RequestableDataRecord( requester); rec.setDataTime(time.clone()); - try { - rec.setDataURI(null); - rec.constructDataURI(); - } catch (PluginException e) { - throw new VizException(e); - } - boolean n = true; - for (Object result : results) { - if (((GridRecord) result).getDataURI().equals( - rec.getDataURI())) { - n = false; + rec.setDataURI(null); + boolean newRecord = true; + for (PluginDataObject result : results) { + if (result.getDataURI().equals(rec.getDataURI())) { + newRecord = false; break; } } - if (n) { + if (newRecord) { records.add(rec); } } @@ -467,12 +462,7 @@ public class GridDataCubeAdapter extends AbstractDataCubeAdapter { for (GridCoverage coverage : coverages) { record = new RequestableDataRecord(record); record.setLocation(coverage); - try { - record.setDataURI(null); - record.constructDataURI(); - } catch (PluginException e) { - throw new VizException(e); - } + record.setDataURI(null); spaceRecords.add(record); } } @@ -481,10 +471,9 @@ public class GridDataCubeAdapter extends AbstractDataCubeAdapter { } results.addAll(records); } - if (property.getEntryQueryParameters(false).containsKey( - GridInventory.ENSEMBLE_QUERY)) { - String ensemble = property.getEntryQueryParameters(false) - .get(GridInventory.ENSEMBLE_QUERY).getConstraintValue(); + if (constraints.containsKey(GridInventory.ENSEMBLE_QUERY)) { + String ensemble = constraints.get(GridInventory.ENSEMBLE_QUERY) + .getConstraintValue(); if (ensemble != null) { for (Object rec : results) { ((GridRecord) rec).setEnsembleId(ensemble); diff --git a/cave/com.raytheon.viz.hydrocommon/src/com/raytheon/viz/hydrocommon/HydroDisplayManager.java b/cave/com.raytheon.viz.hydrocommon/src/com/raytheon/viz/hydrocommon/HydroDisplayManager.java index e8b5df40c3..99f613734b 100644 --- a/cave/com.raytheon.viz.hydrocommon/src/com/raytheon/viz/hydrocommon/HydroDisplayManager.java +++ b/cave/com.raytheon.viz.hydrocommon/src/com/raytheon/viz/hydrocommon/HydroDisplayManager.java @@ -45,7 +45,6 @@ import com.raytheon.uf.common.mpe.util.XmrgFile; import com.raytheon.uf.common.ohd.AppsDefaults; import com.raytheon.uf.common.util.FileUtil; import com.raytheon.uf.viz.core.IDisplayPane; -import com.raytheon.uf.viz.core.catalog.LayerProperty; import com.raytheon.uf.viz.core.datastructure.DataCubeContainer; import com.raytheon.uf.viz.core.datastructure.LoopProperties; import com.raytheon.uf.viz.core.drawables.IDescriptor; @@ -309,20 +308,14 @@ public class HydroDisplayManager { + rfc)); try { - LayerProperty lp = new LayerProperty(); - lp.setNumberOfImages(9999); - lp.setEntryQueryParameters(reqMap, false); - - List dataList = DataCubeContainer.getData(lp, 30); + PluginDataObject[] pdos = DataCubeContainer.getData(reqMap); GridRecord gr = null; - int i = 0; - for (Object o : dataList) { - gr = (GridRecord) o; - IDataRecord[] recArr = DataCubeContainer - .getDataRecord((PluginDataObject) o); + for (PluginDataObject pdo : pdos) { + gr = (GridRecord) pdo; + IDataRecord[] recArr = DataCubeContainer.getDataRecord(gr); gr.setMessageData(((FloatDataRecord) recArr[0]) .getFloatData()); - ++i; + break; } FFGGridResourceData resourceData = new FFGGridResourceData( @@ -477,20 +470,14 @@ public class HydroDisplayManager { + rfc)); try { - LayerProperty lp = new LayerProperty(); - lp.setNumberOfImages(9999); - lp.setEntryQueryParameters(reqMap, false); - - List dataList = DataCubeContainer.getData(lp, 30); + PluginDataObject[] pdos = DataCubeContainer.getData(reqMap); GridRecord gr = null; - int i = 0; - for (Object o : dataList) { - gr = (GridRecord) o; - IDataRecord[] recArr = DataCubeContainer - .getDataRecord((PluginDataObject) o); + for (PluginDataObject pdo : pdos) { + gr = (GridRecord) pdo; + IDataRecord[] recArr = DataCubeContainer.getDataRecord(gr); gr.setMessageData(((FloatDataRecord) recArr[0]) .getFloatData()); - ++i; + break; } RFCGriddedBasinFFGResourceData resourceData = new RFCGriddedBasinFFGResourceData( diff --git a/cave/com.raytheon.viz.lightning/plugin.xml b/cave/com.raytheon.viz.lightning/plugin.xml index 166bd5b6df..845785ab61 100644 --- a/cave/com.raytheon.viz.lightning/plugin.xml +++ b/cave/com.raytheon.viz.lightning/plugin.xml @@ -30,14 +30,7 @@ resourceType="PLAN_VIEW"> - - - - - + - - - - - - - - - - - - - - - - diff --git a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/PlotModelGenerator.java b/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/PlotModelGenerator.java index b10945f509..69088fd33b 100644 --- a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/PlotModelGenerator.java +++ b/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/PlotModelGenerator.java @@ -22,7 +22,6 @@ package com.raytheon.viz.pointdata; import java.awt.image.BufferedImage; import java.util.ArrayList; -import java.util.HashMap; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedQueue; @@ -34,18 +33,18 @@ import org.eclipse.core.runtime.jobs.Job; import org.eclipse.swt.graphics.RGB; import com.raytheon.uf.common.dataplugin.PluginDataObject; +import com.raytheon.uf.common.dataquery.requests.DbQueryRequest; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType; +import com.raytheon.uf.common.dataquery.responses.DbQueryResponse; import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.IGraphicsTarget.LineStyle; -import com.raytheon.uf.viz.core.catalog.LayerProperty; -import com.raytheon.uf.viz.core.catalog.ScriptCreator; import com.raytheon.uf.viz.core.comm.Connector; import com.raytheon.uf.viz.core.data.prep.IODataPreparer; import com.raytheon.uf.viz.core.drawables.IImage; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.map.IMapDescriptor; -import com.raytheon.uf.viz.core.rsc.ResourceType; +import com.raytheon.uf.viz.core.requests.ThriftClient; /** * A Eclipse Job thread that will listen for new stations on a queue and request @@ -177,11 +176,9 @@ public class PlotModelGenerator extends Job { if (stationQuery.size() > 0) { try { - String script = createActionASCII(stationQuery); - Object[] obs = asciiConnection.connect(script, null, 60000); - - for (Object plugindo : obs) { - PluginDataObject ob = (PluginDataObject) plugindo; + PluginDataObject[] obs = requestPluginDataObjects(stationQuery + .toArray(new String[0])); + for (PluginDataObject ob : obs) { ImageContainer ic = icaoImageMap.get(ob.getDataURI()); if (ic != null) { ic.record = ob; @@ -368,28 +365,19 @@ public class PlotModelGenerator extends Job { } } - private String createActionASCII(ArrayList stationQuery) + private PluginDataObject[] requestPluginDataObjects(String[] uris) throws VizException { - - LayerProperty prop = new LayerProperty(); - - HashMap params = new HashMap(); - - RequestConstraint pluginName = new RequestConstraint(); - pluginName.setConstraintValue(this.plugin); - params.put("pluginName", pluginName); - + DbQueryRequest request = new DbQueryRequest(); + request.addConstraint("pluginName", new RequestConstraint(plugin)); RequestConstraint ids = new RequestConstraint(); ids.setConstraintType(ConstraintType.IN); - ids.setConstraintValueList(stationQuery.toArray(new String[stationQuery - .size()])); - params.put("dataURI", ids); + ids.setConstraintValueList(uris); + request.addConstraint("dataURI", ids); + request.setLimit(uris.length); - prop.setDesiredProduct(ResourceType.PLAN_VIEW); - prop.setEntryQueryParameters(params, false); - prop.setNumberOfImages(stationQuery.size()); - - return ScriptCreator.createScript(prop, "plot"); + DbQueryResponse response = (DbQueryResponse) ThriftClient + .sendRequest(request); + return response.getEntityObjects(PluginDataObject.class); } public void setPlotModelLineStyle(LineStyle lineStyle) { diff --git a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/util/HeightOfRequestableData.java b/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/util/HeightOfRequestableData.java index 070d6ae12f..747c0791fd 100644 --- a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/util/HeightOfRequestableData.java +++ b/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/util/HeightOfRequestableData.java @@ -21,7 +21,6 @@ package com.raytheon.viz.pointdata.util; import java.awt.Point; import java.util.HashMap; -import java.util.List; import java.util.Map; import javax.measure.unit.SI; @@ -42,7 +41,6 @@ import com.raytheon.uf.common.geospatial.MapUtil; import com.raytheon.uf.common.geospatial.PointUtil; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.wxmath.PToZsa; -import com.raytheon.uf.viz.core.catalog.LayerProperty; import com.raytheon.uf.viz.core.datastructure.DataCubeContainer; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.derivparam.data.AbstractRequestableData; @@ -211,18 +209,12 @@ public class HeightOfRequestableData extends AbstractRequestableData { */ private PluginDataObject loadPressureLevel(DataTime time) throws VizException { - - LayerProperty lp = new LayerProperty(); - lp.setNumberOfImages(1); - lp.setEntryQueryParameters(getConstraints(), false); - if (time != null) { - lp.setSelectedEntryTimes(new DataTime[] { time }); - } - List resp = DataCubeContainer.getData(lp, 60000); - if (resp.isEmpty()) { + PluginDataObject[] pdos = DataCubeContainer.getData(getConstraints(), + time); + if (pdos == null || pdos.length == 0) { return null; } - PluginDataObject gribRec = (PluginDataObject) resp.get(0); + PluginDataObject gribRec = pdos[0]; IDataRecord[] dr = DataCubeContainer.getDataRecord(gribRec); if (dr != null) { float[] data = (float[]) dr[0].getDataObject(); diff --git a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/util/PointDataCubeAdapter.java b/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/util/PointDataCubeAdapter.java index 6cdf0b2cdc..6816bd5f2c 100644 --- a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/util/PointDataCubeAdapter.java +++ b/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/util/PointDataCubeAdapter.java @@ -26,30 +26,19 @@ import java.util.List; import java.util.Map; import com.raytheon.uf.common.comm.CommunicationException; -import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.level.Level; import com.raytheon.uf.common.dataplugin.level.mapping.LevelMappingFactory; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; -import com.raytheon.uf.common.dataquery.requests.TimeQueryRequest; -import com.raytheon.uf.common.dataquery.requests.TimeQueryRequestSet; -import com.raytheon.uf.common.datastorage.Request; import com.raytheon.uf.common.datastorage.records.FloatDataRecord; import com.raytheon.uf.common.datastorage.records.IDataRecord; import com.raytheon.uf.common.pointdata.PointDataContainer; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; -import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.RecordFactory; -import com.raytheon.uf.viz.core.catalog.LayerProperty; -import com.raytheon.uf.viz.core.catalog.ScriptCreator; -import com.raytheon.uf.viz.core.comm.Loader; -import com.raytheon.uf.viz.core.datastructure.CubeUtil; -import com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter; -import com.raytheon.uf.viz.core.datastructure.VizDataCubeException; +import com.raytheon.uf.viz.core.datastructure.DefaultDataCubeAdapter; import com.raytheon.uf.viz.core.exception.VizCommunicationException; import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.uf.viz.core.requests.ThriftClient; import com.raytheon.uf.viz.derivparam.data.AbstractRequestableData; import com.raytheon.uf.viz.derivparam.inv.AvailabilityContainer; import com.raytheon.uf.viz.derivparam.library.DerivedParameterGenerator; @@ -78,33 +67,23 @@ import com.raytheon.viz.pointdata.PointDataRequest; * @version 1.0 */ -public class PointDataCubeAdapter implements IDataCubeAdapter { +public class PointDataCubeAdapter extends DefaultDataCubeAdapter { private static final transient IUFStatusHandler statusHandler = UFStatus .getHandler(PointDataCubeAdapter.class); public static String PLUGIN_NAME = PointDataInventory.PLUGIN_NAME; - private static String[] supportedPlugins = { "obs", "madis", "modelsounding", - "bufrssmi", "bufrquikscat", "lsr", "sfcobs", "goessounding", - "bufrascat", "poessounding", "profiler", "bufrua", "ldadmesonet", - "ldadhydro", "qc", "fssobs", "bufrmosAVN", "bufrmosETA", - "bufrmosGFS", "bufrmosHPC", "bufrmosLAMP", "bufrmosMRF", - "bufrmosNGM" }; + private static String[] supportedPlugins = { "obs", "madis", + "modelsounding", "bufrssmi", "bufrquikscat", "lsr", "sfcobs", + "goessounding", "bufrascat", "poessounding", "profiler", "bufrua", + "ldadmesonet", "ldadhydro", "qc", "fssobs", "bufrmosAVN", + "bufrmosETA", "bufrmosGFS", "bufrmosHPC", "bufrmosLAMP", + "bufrmosMRF", "bufrmosNGM" }; protected AbstractPointDataInventory inventory; - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getData(com.raytheon - * .uf.viz.core.catalog.LayerProperty, java.util.Map) - */ - @Override - public List getData(LayerProperty property, int timeOut) - throws VizException { - String scriptToExecute = ScriptCreator.createScript(property); - return Loader.loadScripts(new String[] { scriptToExecute }, timeOut); + public PointDataCubeAdapter() { + super(PLUGIN_NAME); } /* @@ -239,31 +218,6 @@ public class PointDataCubeAdapter implements IDataCubeAdapter { baseParams.toArray(new String[] {}), null, queryParams); } - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getRecord(com - * .raytheon.uf.common.dataplugin.PluginDataObject) - */ - @Override - public IDataRecord[] getRecord(PluginDataObject obj) - throws VizDataCubeException { - if (obj.getMessageData() == null) { - IDataRecord record = null; - try { - record = CubeUtil.retrieveData(obj, obj.getPluginName()); - } catch (VizException e) { - throw new VizDataCubeException( - "Error retrieving point data record.", e); - } - - return new IDataRecord[] { record }; - } - - return null; - } - /* * (non-Javadoc) * @@ -299,59 +253,4 @@ public class PointDataCubeAdapter implements IDataCubeAdapter { } } - @Override - public IDataRecord[] getRecord(PluginDataObject obj, Request req, - String dataset) throws VizDataCubeException { - if (obj.getMessageData() == null) { - IDataRecord record = null; - try { - record = CubeUtil.retrieveData(obj, obj.getPluginName(), req, - dataset); - } catch (VizException e) { - throw new VizDataCubeException( - "Error retrieving point data record.", e); - } - - return new IDataRecord[] { record }; - } - - return null; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getRecords(java - * .util.List, com.raytheon.uf.common.datastorage.Request, java.lang.String) - */ - @Override - public void getRecords(List objs, Request req, - String dataset) throws VizDataCubeException { - for (PluginDataObject obj : objs) { - IDataRecord[] records = getRecord(obj, req, dataset); - obj.setMessageData(records); - } - } - - @Override - public List> getBaseUpdateConstraints( - Map constraints) { - List> result = new ArrayList>( - 1); - result.add(constraints); - return result; - } - - @Override - public List> timeQuery(List requests) - throws VizException { - TimeQueryRequestSet set = new TimeQueryRequestSet(); - set.setRequests(requests.toArray(new TimeQueryRequest[0])); - - @SuppressWarnings("unchecked") - List> result = (List>) ThriftClient - .sendRequest(set); - return result; - } } diff --git a/cave/com.raytheon.viz.radar/plugin.xml b/cave/com.raytheon.viz.radar/plugin.xml index fd55cfb605..7f17406ca6 100644 --- a/cave/com.raytheon.viz.radar/plugin.xml +++ b/cave/com.raytheon.viz.radar/plugin.xml @@ -55,13 +55,6 @@ commandId="com.raytheon.viz.radar.ui.RadarDisplayControls"> - - - - - - - - - - - - diff --git a/cave/com.raytheon.viz.satellite/src/com/raytheon/viz/satellite/SatelliteDataCubeAdapter.java b/cave/com.raytheon.viz.satellite/src/com/raytheon/viz/satellite/SatelliteDataCubeAdapter.java index 82cc4783ce..9a0b3868c3 100644 --- a/cave/com.raytheon.viz.satellite/src/com/raytheon/viz/satellite/SatelliteDataCubeAdapter.java +++ b/cave/com.raytheon.viz.satellite/src/com/raytheon/viz/satellite/SatelliteDataCubeAdapter.java @@ -44,7 +44,6 @@ import org.geotools.coverage.grid.GridCoverageFactory; import org.geotools.coverage.grid.GridGeometry2D; import com.raytheon.uf.common.dataplugin.PluginDataObject; -import com.raytheon.uf.common.dataplugin.PluginException; import com.raytheon.uf.common.dataplugin.satellite.SatelliteRecord; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType; @@ -56,15 +55,11 @@ import com.raytheon.uf.common.datastorage.Request; import com.raytheon.uf.common.datastorage.records.ByteDataRecord; import com.raytheon.uf.common.datastorage.records.IDataRecord; import com.raytheon.uf.common.geospatial.MapUtil; -import com.raytheon.uf.common.pointdata.PointDataContainer; import com.raytheon.uf.common.time.BinOffset; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.HDF5Util; import com.raytheon.uf.viz.core.catalog.CatalogQuery; -import com.raytheon.uf.viz.core.catalog.LayerProperty; -import com.raytheon.uf.viz.core.catalog.ScriptCreator; -import com.raytheon.uf.viz.core.comm.Loader; -import com.raytheon.uf.viz.core.datastructure.CubeUtil; +import com.raytheon.uf.viz.core.datastructure.DefaultDataCubeAdapter; import com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter; import com.raytheon.uf.viz.core.datastructure.VizDataCubeException; import com.raytheon.uf.viz.core.exception.VizException; @@ -77,7 +72,7 @@ import com.raytheon.uf.viz.derivparam.library.DerivedParameterRequest; import com.raytheon.uf.viz.derivparam.library.IDerivParamField; /** - * TODO Add Description + * {@link IDataCubeAdapter} for satellite plugin data * *
  * 
@@ -91,13 +86,14 @@ import com.raytheon.uf.viz.derivparam.library.IDerivParamField;
  * Apr 08, 2013 1293       bkowal      Removed references to hdffileid.
  * Jun 04, 2013 2041       bsteffen    Switch derived parameters to use
  *                                     concurrent python for threading.
+ * Sep  9, 2013 2277       mschenke    Got rid of ScriptCreator references
  * 
* * @author jsanchez * @version 1.0 */ -public class SatelliteDataCubeAdapter implements IDataCubeAdapter { +public class SatelliteDataCubeAdapter extends DefaultDataCubeAdapter { private static final String PE = "physicalElement"; @@ -105,21 +101,27 @@ public class SatelliteDataCubeAdapter implements IDataCubeAdapter { private Map derParLibrary; + /** + * @param pluginName + */ + public SatelliteDataCubeAdapter() { + super(SatelliteRecord.PLUGIN_ID); + } + @Override - public List getData(LayerProperty property, int timeOut) + public PluginDataObject[] getData( + Map constraints, DataTime[] selectedTimes) throws VizException { - if (!property.getEntryQueryParameters(false).containsKey("DERIVED")) { - String scriptToExecute = ScriptCreator.createScript(property); - return Loader - .loadScripts(new String[] { scriptToExecute }, timeOut); + Map originalQuery = constraints; + if (originalQuery.containsKey(DERIVED) == false) { + return super.getData(originalQuery, selectedTimes); } + String requestedParam; - ArrayList initResponses = new ArrayList(); - HashMap originalQuery = property - .getEntryQueryParameters(false); - ArrayList listOfRequests = new ArrayList(); - HashMap modifiedQuery = property - .getEntryQueryParameters(false); + List initResponses = new ArrayList(); + List listOfRequests = new ArrayList(); + Map modifiedQuery = new HashMap( + originalQuery); modifiedQuery.remove(DERIVED); modifiedQuery.remove(PE); @@ -148,12 +150,9 @@ public class SatelliteDataCubeAdapter implements IDataCubeAdapter { Map query = modifyQuery( modifiedQuery, field); - property.setEntryQueryParameters(query, false); - String scriptToExecute = ScriptCreator.createScript(property); - List responses = Loader.loadScripts( - new String[] { scriptToExecute }, timeOut); - for (int i = 0; i < responses.size(); i++) { - SatelliteRecord record = (SatelliteRecord) responses.get(i); + PluginDataObject[] pdos = super.getData(query, selectedTimes); + for (PluginDataObject pdo : pdos) { + SatelliteRecord record = (SatelliteRecord) pdo; if (requestInitialized) { for (DerivedParameterRequest definedRequest : listOfRequests) { if (record.getDataTime().compareTo( @@ -173,20 +172,16 @@ public class SatelliteDataCubeAdapter implements IDataCubeAdapter { SatelliteRecord derivedRecord = new SatelliteRecord( record.getDataURI()); // Make sure to get the number of interpolation levels! - derivedRecord.setInterpolationLevels(record.getInterpolationLevels()); - + derivedRecord.setInterpolationLevels(record + .getInterpolationLevels()); + derivedRecord.setPhysicalElement(originalQuery.get(PE) .getConstraintValue()); derivedRecord.setMessageData(request); derivedRecord.setCoverage(record.getCoverage()); - // This should not be necessary but file based tile set - // expects it. - try { - derivedRecord.setDataURI(null); - derivedRecord.constructDataURI(); - } catch (PluginException e) { - throw new VizException(e); - } + // Reset dataURI after setting fields + derivedRecord.setDataURI(null); + initResponses.add(derivedRecord); } } @@ -204,31 +199,17 @@ public class SatelliteDataCubeAdapter implements IDataCubeAdapter { } } } - return initResponses; + return initResponses.toArray(new PluginDataObject[0]); } else { - String scriptToExecute = ScriptCreator.createScript(property); - return Loader - .loadScripts(new String[] { scriptToExecute }, timeOut); + return super.getData(originalQuery, selectedTimes); } - - } - - public String recordKeyGenerator(PluginDataObject pdo) { - return null; } @Override public IDataRecord[] getRecord(PluginDataObject obj) throws VizDataCubeException { if (obj.getMessageData() == null) { - IDataRecord record = null; - try { - record = CubeUtil.retrieveData(obj, obj.getPluginName()); - } catch (VizException e) { - throw new VizDataCubeException( - "Error retrieving satellite record.", e); - } - return new IDataRecord[] { record }; + return super.getRecord(obj); } return null; @@ -238,15 +219,7 @@ public class SatelliteDataCubeAdapter implements IDataCubeAdapter { public IDataRecord[] getRecord(PluginDataObject obj, Request req, String dataset) throws VizDataCubeException { if (obj.getMessageData() == null) { - IDataRecord record = null; - try { - record = CubeUtil.retrieveData(obj, obj.getPluginName(), req, - dataset); - } catch (VizException e) { - throw new VizDataCubeException( - "Error retrieving satellite record.", e); - } - return new IDataRecord[] { record }; + return super.getRecord(obj, req, dataset); } boolean interpolate = false; @@ -344,34 +317,11 @@ public class SatelliteDataCubeAdapter implements IDataCubeAdapter { } } - @Override - public String[] getSupportedPlugins() { - return new String[] { "satellite" }; - } - - @Override - public Object getInventory() { - return null; - } - @Override public void initInventory() { derParLibrary = DerivedParameterGenerator.getDerParLibrary(); } - @Override - public PointDataContainer getPoints(String plugin, String[] parameters, - Map queryParams) throws VizException { - return getPoints(plugin, parameters, null, queryParams); - } - - @Override - public PointDataContainer getPoints(String plugin, String[] parameters, - String levelKey, Map queryParams) - throws VizException { - return null; - } - private String getDataset(String dataUri, String dataset) { return "/" + dataUri + "/" + dataset; } @@ -457,10 +407,7 @@ public class SatelliteDataCubeAdapter implements IDataCubeAdapter { } constraints.put(PE, pe); } - List> result = new ArrayList>( - 1); - result.add(constraints); - return result; + return super.getBaseUpdateConstraints(constraints); } @Override diff --git a/cave/com.raytheon.viz.ui.personalities.awips/plugin.xml b/cave/com.raytheon.viz.ui.personalities.awips/plugin.xml index 2e2087a736..ed8e8510fd 100644 --- a/cave/com.raytheon.viz.ui.personalities.awips/plugin.xml +++ b/cave/com.raytheon.viz.ui.personalities.awips/plugin.xml @@ -41,18 +41,7 @@ name="AWIPS" description="Command category for AWIPS"> - - - - - - - + diff --git a/cave/com.raytheon.viz.warngen/plugin.xml b/cave/com.raytheon.viz.warngen/plugin.xml index 22ea540c16..bc3c92982b 100644 --- a/cave/com.raytheon.viz.warngen/plugin.xml +++ b/cave/com.raytheon.viz.warngen/plugin.xml @@ -89,13 +89,6 @@ - - - - - - - - diff --git a/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/AbstractWWAResource.java b/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/AbstractWWAResource.java index 34424f20bd..bc41941b55 100644 --- a/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/AbstractWWAResource.java +++ b/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/AbstractWWAResource.java @@ -32,7 +32,6 @@ import com.raytheon.uf.viz.core.IGraphicsTarget.LineStyle; import com.raytheon.uf.viz.core.IGraphicsTarget.TextStyle; import com.raytheon.uf.viz.core.IGraphicsTarget.VerticalAlignment; import com.raytheon.uf.viz.core.VizApp; -import com.raytheon.uf.viz.core.catalog.LayerProperty; import com.raytheon.uf.viz.core.datastructure.DataCubeContainer; import com.raytheon.uf.viz.core.drawables.IDescriptor.FramesInfo; import com.raytheon.uf.viz.core.drawables.IFont; @@ -44,7 +43,6 @@ import com.raytheon.uf.viz.core.map.MapDescriptor; import com.raytheon.uf.viz.core.rsc.AbstractVizResource; import com.raytheon.uf.viz.core.rsc.IResourceDataChanged; import com.raytheon.uf.viz.core.rsc.LoadProperties; -import com.raytheon.uf.viz.core.rsc.ResourceType; import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability; import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability; import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability; @@ -568,21 +566,8 @@ public abstract class AbstractWWAResource extends earliestRequested = earliest; - LayerProperty property = new LayerProperty(); - property.setDesiredProduct(ResourceType.PLAN_VIEW); - property.setEntryQueryParameters(map, false); - property.setNumberOfImages(9999); - - Object[] resp = null; - resp = DataCubeContainer.getData(property, 60000).toArray( - new Object[] {}); - PluginDataObject[] arr = new PluginDataObject[resp.length]; - int i = 0; - for (Object o : resp) { - arr[i] = (PluginDataObject) o; - i++; - } - addRecord(sort(arr)); + PluginDataObject[] pdos = DataCubeContainer.getData(map); + addRecord(sort(pdos)); } protected String[] getText(AbstractWarningRecord record, double mapWidth) { diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.bufrua/src/com/raytheon/uf/common/dataplugin/bufrua/UAObs.java b/edexOsgi/com.raytheon.uf.common.dataplugin.bufrua/src/com/raytheon/uf/common/dataplugin/bufrua/UAObs.java index 7a8f31ecd3..a9706471cc 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.bufrua/src/com/raytheon/uf/common/dataplugin/bufrua/UAObs.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.bufrua/src/com/raytheon/uf/common/dataplugin/bufrua/UAObs.java @@ -108,7 +108,7 @@ import com.vividsolutions.jts.geom.Geometry; * Both refTime and forecastTime are included in the refTimeIndex since * forecastTime is unlikely to be used. */ -@org.hibernate.annotations.Table(appliesTo = "bufrua", indexes = { @Index(name = "bufrua_refTimeIndex", columnNames = { +@org.hibernate.annotations.Table(appliesTo = UAObs.PLUGIN_NAME, indexes = { @Index(name = "bufrua_refTimeIndex", columnNames = { "refTime", "forecastTime" }) }) @XmlRootElement @XmlAccessorType(XmlAccessType.NONE) @@ -137,6 +137,8 @@ public class UAObs extends PersistablePluginDataObject implements } }; + public static final String PLUGIN_NAME = "bufrua"; + public static final Unit DISTANCE_UNIT = SI.METER; public static final Unit TEMPERATURE_UNIT = SI.KELVIN; diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.bufrua/src/com/raytheon/uf/common/dataplugin/bufrua/dao/BufrUAPointDataTransform.java b/edexOsgi/com.raytheon.uf.common.dataplugin.bufrua/src/com/raytheon/uf/common/dataplugin/bufrua/dao/BufrUAPointDataTransform.java index 968264b596..45fb608ac1 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.bufrua/src/com/raytheon/uf/common/dataplugin/bufrua/dao/BufrUAPointDataTransform.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.bufrua/src/com/raytheon/uf/common/dataplugin/bufrua/dao/BufrUAPointDataTransform.java @@ -20,6 +20,7 @@ package com.raytheon.uf.common.dataplugin.bufrua.dao; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import org.apache.commons.logging.Log; @@ -46,6 +47,7 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools; * Aug 19, 2009 jkorman Initial creation * Jul 19, 2013 1992 bsteffen Remove redundant time columns from * bufrua. + * Sep 9, 2013 2277 mschenke Got rid of ScriptCreator references * * * @@ -56,61 +58,44 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools; public class BufrUAPointDataTransform { /** The logger */ - private static Log logger = LogFactory.getLog(BufrUAPointDataTransform.class); + private static Log logger = LogFactory + .getLog(BufrUAPointDataTransform.class); + + public static final String[] HDR_PARAMS = new String[] { "wmoStaNum", + "staName", "validTime", "relTime", "staElev", "latitude", + "longitude", "dataURI", "sfcPressure", "rptType" }; public static final String HDR_PARAMS_LIST; static { StringBuffer sb = new StringBuffer(); - - sb.append("wmoStaNum,"); - sb.append("staName,"); - sb.append("validTime,"); - sb.append("relTime,"); - sb.append("staElev,"); - sb.append("latitude,"); - sb.append("longitude,"); - sb.append("dataURI,"); - sb.append("sfcPressure,"); - sb.append("rptType,"); - - + for (int i = 0; i < HDR_PARAMS.length - 1; ++i) { + sb.append(HDR_PARAMS[i]).append(","); + } + sb.append(HDR_PARAMS[HDR_PARAMS.length - 1]); HDR_PARAMS_LIST = sb.toString(); } - + + private static final String[] OTHER_PARAMS = new String[] { "numMand", + "prMan", "htMan", "tpMan", "tdMan", "wdMan", "wsMan", "numTrop", + "prTrop", "tpTrop", "tdTrop", "wdTrop", "wsTrop", "numMwnd", + "prMaxW", "wdMaxW", "wsMaxW", "numSigT", "prSigT", "tpSigT", + "tdSigT", "numSigW", "htSigW", "wdSigW", "wsSigW" }; + + public static final String[] MAN_PARAMS = Arrays.copyOf(HDR_PARAMS, + HDR_PARAMS.length + OTHER_PARAMS.length); + public static final String MAN_PARAMS_LIST; static { StringBuffer sb = new StringBuffer(); - sb.append(HDR_PARAMS_LIST); - sb.append("numMand,"); - sb.append("prMan,"); - sb.append("htMan,"); - sb.append("tpMan,"); - sb.append("tdMan,"); - sb.append("wdMan,"); - sb.append("wsMan,"); - //------------------------- - sb.append("numTrop,"); - sb.append("prTrop,"); - sb.append("tpTrop,"); - sb.append("tdTrop,"); - sb.append("wdTrop,"); - sb.append("wsTrop,"); - //------------------------- - sb.append("numMwnd,"); - sb.append("prMaxW,"); - sb.append("wdMaxW,"); - sb.append("wsMaxW,"); - //------------------------- - sb.append("numSigT,"); - sb.append("prSigT,"); - sb.append("tpSigT,"); - sb.append("tdSigT,"); - //------------------------- - sb.append("numSigW,"); - sb.append("htSigW,"); - sb.append("wdSigW,"); - sb.append("wsSigW"); - //------------------------- + sb.append(HDR_PARAMS_LIST).append(","); + + for (int i = 0; i < OTHER_PARAMS.length - 1; ++i) { + sb.append(OTHER_PARAMS[i]).append(","); + MAN_PARAMS[HDR_PARAMS.length + i] = OTHER_PARAMS[i]; + } + sb.append(OTHER_PARAMS[OTHER_PARAMS.length - 1]); + MAN_PARAMS[MAN_PARAMS.length - 1] = OTHER_PARAMS[OTHER_PARAMS.length - 1]; + MAN_PARAMS_LIST = sb.toString(); } @@ -138,14 +123,14 @@ public class BufrUAPointDataTransform { obs.setLocation(location); Integer sfcpres = pdv.getNumber("sfcPressure").intValue(); obs.setPressure_station(sfcpres); - + obs.setStationName(pdv.getString("staName")); } return obs; } - + private static UAObs getManUAObsRecord(PointDataView pdv, UAObs obs) { - if(obs != null) { + if (obs != null) { Number numLvls = pdv.getNumber("numMand"); Number[] pr = pdv.getNumberAllLevels("prMan"); Number[] ht = pdv.getNumberAllLevels("htMan"); @@ -154,7 +139,7 @@ public class BufrUAPointDataTransform { Number[] wd = pdv.getNumberAllLevels("wdMan"); Number[] ws = pdv.getNumberAllLevels("wsMan"); - if ((numLvls != null)&&(numLvls.intValue() > 0)) { + if ((numLvls != null) && (numLvls.intValue() > 0)) { for (int i = 0; i < numLvls.intValue(); i++) { if (pr[i] != null) { if ((pr[i].intValue() > 120000) @@ -163,7 +148,7 @@ public class BufrUAPointDataTransform { } } UAObsLevel lvl = new UAObsLevel(); - if(pr[i].intValue() == obs.getPressure_station()) { + if (pr[i].intValue() == obs.getPressure_station()) { lvl.setVertSig(LayerTools.SFC_LEVEL); lvl.setGeoHeight(obs.getElevation()); } else { @@ -186,7 +171,7 @@ public class BufrUAPointDataTransform { wd = pdv.getNumberAllLevels("wdTrop"); ws = pdv.getNumberAllLevels("wsTrop"); - if ((numLvls != null)&&(numLvls.intValue() > 0)) { + if ((numLvls != null) && (numLvls.intValue() > 0)) { for (int i = 0; i < numLvls.intValue(); i++) { if (pr[i] != null) { if ((pr[i].intValue() > 120000) @@ -210,7 +195,7 @@ public class BufrUAPointDataTransform { wd = pdv.getNumberAllLevels("wdMaxW"); ws = pdv.getNumberAllLevels("wsMaxW"); - if ((numLvls != null)&&(numLvls.intValue() > 0)) { + if ((numLvls != null) && (numLvls.intValue() > 0)) { for (int i = 0; i < numLvls.intValue(); i++) { if (pr[i] != null) { if ((pr[i].intValue() > 120000) @@ -262,7 +247,7 @@ public class BufrUAPointDataTransform { } return obs; } - + /** * * @param pdv @@ -296,41 +281,41 @@ public class BufrUAPointDataTransform { } return obs; } - + /** * * @param container * @return */ - public static UAObs [] toUAObsRecords(PointDataContainer container) { + public static UAObs[] toUAObsRecords(PointDataContainer container) { List records = new ArrayList(); container.setCurrentSz(container.getAllocatedSz()); for (int i = 0; i < container.getCurrentSz(); i++) { PointDataView pdv = container.readRandom(i); - + UAObs obs = getUAObsHdr(pdv); - if(obs != null) { - - switch(obs.getReportType()) { - - case LayerTools.MANLVL_LO : - case LayerTools.MANLVL_HI : { - obs = getManUAObsRecord(pdv,obs); + if (obs != null) { + + switch (obs.getReportType()) { + + case LayerTools.MANLVL_LO: + case LayerTools.MANLVL_HI: { + obs = getManUAObsRecord(pdv, obs); break; } - - case LayerTools.SIGTLVL_LO : - case LayerTools.SIGTLVL_HI : { - obs = getObsSigTLevelData(pdv,obs); + + case LayerTools.SIGTLVL_LO: + case LayerTools.SIGTLVL_HI: { + obs = getObsSigTLevelData(pdv, obs); break; } - - case LayerTools.SIGWLVL_LO : - case LayerTools.SIGWLVL_HI : { - obs = getObsSigWLevelData(pdv,obs); + + case LayerTools.SIGWLVL_LO: + case LayerTools.SIGWLVL_HI: { + obs = getObsSigWLevelData(pdv, obs); break; } - } + } records.add(obs); } } diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin/src/com/raytheon/uf/common/dataplugin/PluginDataObject.java b/edexOsgi/com.raytheon.uf.common.dataplugin/src/com/raytheon/uf/common/dataplugin/PluginDataObject.java index b1a22cadd5..b7e2d441e0 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin/src/com/raytheon/uf/common/dataplugin/PluginDataObject.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin/src/com/raytheon/uf/common/dataplugin/PluginDataObject.java @@ -118,6 +118,10 @@ public abstract class PluginDataObject extends PersistableDataObject implements private static final long serialVersionUID = 1L; + public static final String PLUGIN_NAME_ID = "pluginName"; + + public static final String DATATIME_ID = "dataTime"; + public static final String ID_GEN = "idgen"; @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = ID_GEN) diff --git a/edexOsgi/com.raytheon.uf.common.dataquery/src/com/raytheon/uf/common/dataquery/requests/DbQueryRequest.java b/edexOsgi/com.raytheon.uf.common.dataquery/src/com/raytheon/uf/common/dataquery/requests/DbQueryRequest.java index c0281724f8..c2e31b1188 100644 --- a/edexOsgi/com.raytheon.uf.common.dataquery/src/com/raytheon/uf/common/dataquery/requests/DbQueryRequest.java +++ b/edexOsgi/com.raytheon.uf.common.dataquery/src/com/raytheon/uf/common/dataquery/requests/DbQueryRequest.java @@ -148,6 +148,14 @@ public class DbQueryRequest implements IServerRequest { @DynamicSerializeElement private Integer limit; + public DbQueryRequest() { + // For serialization + } + + public DbQueryRequest(Map constraints) { + setConstraints(new HashMap(constraints)); + } + public String getDatabase() { return database; } diff --git a/edexOsgi/com.raytheon.uf.common.dataquery/src/com/raytheon/uf/common/dataquery/requests/RequestConstraint.java b/edexOsgi/com.raytheon.uf.common.dataquery/src/com/raytheon/uf/common/dataquery/requests/RequestConstraint.java index 6bd330e742..d533d81454 100644 --- a/edexOsgi/com.raytheon.uf.common.dataquery/src/com/raytheon/uf/common/dataquery/requests/RequestConstraint.java +++ b/edexOsgi/com.raytheon.uf.common.dataquery/src/com/raytheon/uf/common/dataquery/requests/RequestConstraint.java @@ -120,7 +120,11 @@ public class RequestConstraint implements ISerializableObject, Cloneable { * Constructor */ public RequestConstraint() { - this.constraintType = ConstraintType.EQUALS; + this(ConstraintType.EQUALS); + } + + public RequestConstraint(ConstraintType constraintType) { + this.constraintType = constraintType; this.asMap = new HashMap, Object>(); } @@ -146,6 +150,39 @@ public class RequestConstraint implements ISerializableObject, Cloneable { this.constraintType = type; } + /** + * Creates a {@link RequestConstraint} with {@link ConstraintType#IN} with + * inConstraints set as the {@link #setConstraintValueList(Collection)} + * + * @param inConstraints + */ + public RequestConstraint(Collection inConstraints) { + this(ConstraintType.IN); + setConstraintValueList(inConstraints); + } + + /** + * Creates a {@link RequestConstraint} with {@link ConstraintType#IN} with + * inConstraints set as the {@link #setConstraintValueList(String[])} + * + * @param inConstraints + */ + public RequestConstraint(String[] inConstraints) { + this(ConstraintType.IN); + setConstraintValueList(inConstraints); + } + + /** + * Creates a {@link RequestConstraint} with {@link ConstraintType#BETWEEN} + * + * @param low + * @param high + */ + public RequestConstraint(String low, String high) { + this(ConstraintType.BETWEEN); + setBetweenValueList(new String[] { low, high }); + } + @Override public RequestConstraint clone() { return new RequestConstraint(constraintValue, constraintType); diff --git a/ncep/gov.noaa.nws.ncep.viz.rsc.airmet/plugin.xml b/ncep/gov.noaa.nws.ncep.viz.rsc.airmet/plugin.xml index 3b45bdd217..77b65a1180 100644 --- a/ncep/gov.noaa.nws.ncep.viz.rsc.airmet/plugin.xml +++ b/ncep/gov.noaa.nws.ncep.viz.rsc.airmet/plugin.xml @@ -10,13 +10,6 @@ renderingOrderId="PLOT" resourceType="PLAN_VIEW"/> - - - - - - - - diff --git a/ncep/gov.noaa.nws.ncep.viz.rsc.convsigmet/plugin.xml b/ncep/gov.noaa.nws.ncep.viz.rsc.convsigmet/plugin.xml index a2155f57a3..996ef87380 100644 --- a/ncep/gov.noaa.nws.ncep.viz.rsc.convsigmet/plugin.xml +++ b/ncep/gov.noaa.nws.ncep.viz.rsc.convsigmet/plugin.xml @@ -10,13 +10,6 @@ renderingOrderId="PLOT" resourceType="PLAN_VIEW"/> - - - - - - - - - - - - - - - - - - - - - --> - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ncep/gov.noaa.nws.ncep.viz.rsc.wavesat/plugin.xml b/ncep/gov.noaa.nws.ncep.viz.rsc.wavesat/plugin.xml index d644daf962..f87f0c189b 100644 --- a/ncep/gov.noaa.nws.ncep.viz.rsc.wavesat/plugin.xml +++ b/ncep/gov.noaa.nws.ncep.viz.rsc.wavesat/plugin.xml @@ -11,13 +11,6 @@ renderingOrderId="PLOT" resourceType="PLAN_VIEW"/> - - - - - - - -