From 84377d3e8cb67482b52516b8be2478f37d9662c2 Mon Sep 17 00:00:00 2001 From: Max Schenkelberg Date: Wed, 11 Sep 2013 14:07:29 -0500 Subject: [PATCH] Issue #2277 Remove more ScriptCreator references Change-Id: I8524faa9914c81afb7ace709b857bca2ef7ff747 Former-commit-id: 63e90f695582f1d9ea487bc32522260473ad5aff [formerly 17b38d9f7279d08240ba16006cfa421c5fdaa260 [formerly 0d898da3aebc056c372c7785538b0b27e3e986ef]] Former-commit-id: 17b38d9f7279d08240ba16006cfa421c5fdaa260 Former-commit-id: 487775918d99bad542c145644299d3f71561546a --- .../uf/viz/core/catalog/CatalogQuery.java | 2 +- .../com/raytheon/uf/viz/core/comm/Loader.java | 46 +--- .../viz/datadelivery/comm/RegistryQuery.java | 109 -------- .../fog/ui/resource/FogResourceData.java | 78 +++--- .../resources/SafeSeasResourceData.java | 170 ++++++------ .../uf/viz/monitor/scan/ScanMonitor.java | 75 +++--- .../raytheon/uf/viz/monitor/ObsMonitor.java | 242 +++++++----------- .../build.properties | 3 +- .../raytheon/uf/viz/vil/VILResourceData.java | 19 +- .../viz/aviation/guidance/GuidanceUtil.java | 41 +-- .../aviation/monitor/LtgMonitorObserver.java | 17 +- .../viz/aviation/monitor/TafUtil.java | 64 ++--- .../viz/avnconfig/TafSiteInfoEditorDlg.java | 47 ++-- .../texteditor/msgs/IAviationObserver.java | 5 +- .../texteditor/util/AviationTextUtility.java | 75 +----- .../edex/plugin/taf/common/TafRecord.java | 8 +- .../binlightning/BinLightningRecord.java | 8 +- .../dataplugin/fssobs/FSSObsRecord.java | 6 +- .../fssobs/FSSObsRecordTransform.java | 132 ++++++---- .../dataplugin/gfe/db/objects/GFERecord.java | 2 +- .../dataplugin/profiler/ProfilerObs.java | 2 +- .../common/dataplugin/radar/RadarRecord.java | 2 +- .../dataplugin/warning/WarningRecord.java | 8 +- .../common/dataplugin/PluginDataObject.java | 2 + .../dataquery/requests/RequestConstraint.java | 30 ++- .../rsc/lightning/rsc/NcLtngAlertParser.java | 15 +- .../viz/ui/perspectives/NcAutoUpdater.java | 5 +- 27 files changed, 430 insertions(+), 783 deletions(-) delete mode 100644 cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/comm/RegistryQuery.java diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/catalog/CatalogQuery.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/catalog/CatalogQuery.java index 72867a3d39..a5fbbf82b6 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/catalog/CatalogQuery.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/catalog/CatalogQuery.java @@ -78,7 +78,7 @@ public class CatalogQuery { for (int i = 0; i < fieldResults.length; ++i) { fieldResults[i] = String.valueOf(results[i]); } - return fieldResults.length == 0 ? null : fieldResults; + return fieldResults; } /** diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/comm/Loader.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/comm/Loader.java index 6c421443c9..b4eae0429a 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/comm/Loader.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/comm/Loader.java @@ -32,8 +32,6 @@ import com.raytheon.uf.common.dataplugin.annotations.DataURIUtil; import com.raytheon.uf.common.dataquery.requests.DbQueryRequest; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.responses.DbQueryResponse; -import com.raytheon.uf.viz.core.catalog.LayerProperty; -import com.raytheon.uf.viz.core.catalog.ScriptCreator; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.requests.ThriftClient; @@ -65,18 +63,12 @@ public class Loader { public static final String SELECT_MODE = "select"; - private static final String PLUGINNAME_COLUMN = "pluginName"; - - private static final String DATAURI_COLUMN = "dataURI"; - public static final String ROW_NAME = "rowname"; public static final String CLASS_NAME = "classname"; public static final String DATABASE_NAME = "databasename"; - public static final String PLUGIN_NAME = PLUGINNAME_COLUMN; - /** * Private constructor */ @@ -84,28 +76,6 @@ public class Loader { } - /** - * Loads a list of objects from a LayerProperty - * - * @param property - * the layerproperty - * @param mode - * the mode (e.g. "select") - * @param timeOut - * the timeout in milliseconds - * @return the list of objects - * @throws VizException - */ - public static List loadData(LayerProperty property, String mode, - int timeOut) throws VizException { - Validate.notNull(property, "LayerProperty can not be null"); - Validate.notNull(property, "Mode must not be null"); - - String script = ScriptCreator.createScript(property, mode); - List responses = loadScripts(new String[] { script }, timeOut); - return responses; - } - /** * Takes an array of scripts and returns a list of responses returned from * the scripts @@ -143,33 +113,23 @@ public class Loader { } /** - * Load a plugin data object from a request map + * Load a plugin data object from a data uri * * @param obj * the request map * @return the fully filled out plugindataobject * @throws VizException */ - public static PluginDataObject loadData(Map obj) - throws VizException { + public static PluginDataObject loadData(String dataURI) throws VizException { Map vals = new HashMap(); - if (!obj.containsKey(DATAURI_COLUMN) - || !obj.containsKey(PLUGINNAME_COLUMN)) { - throw new IllegalArgumentException( - "Map must contain a datauri and plugin name"); - } - try { vals.putAll(RequestConstraint.toConstraintMapping(DataURIUtil - .createDataURIMap(obj.get(DATAURI_COLUMN).toString()))); + .createDataURIMap(dataURI))); } catch (PluginException e) { throw new VizException(e); } - vals.put(PLUGINNAME_COLUMN, - new RequestConstraint(obj.get(PLUGINNAME_COLUMN).toString())); - DbQueryRequest request = new DbQueryRequest(vals); request.setLimit(1); DbQueryResponse response = (DbQueryResponse) ThriftClient diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/comm/RegistryQuery.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/comm/RegistryQuery.java deleted file mode 100644 index 4ede1c7834..0000000000 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/comm/RegistryQuery.java +++ /dev/null @@ -1,109 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ - -package com.raytheon.uf.viz.datadelivery.comm; - -import java.util.HashMap; -import java.util.Map; - -import com.raytheon.uf.common.dataquery.requests.RequestConstraint; -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.viz.core.catalog.ScriptCreator; -import com.raytheon.uf.viz.core.exception.VizException; - -/** - * - * An interface to the registry. - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * 11/20/12     #218       dhladky    Initial creation
- * 
- * - * @author dhladky - * @version 1.0 - */ -public class RegistryQuery { - private static final transient IUFStatusHandler statusHandler = UFStatus - .getHandler(RegistryQuery.class); - - /** - * Sets a query to return only distinct values from the index. - */ - public static final int DISTINCTVALUES = 0; - - /** - * Sets a query to return all values from the index. - */ - public static final int ALLVALUES = 1; - - private static final int REQUESTTIMEOUT = 60000; - - public static enum Mode { - DISTINCT, MAX - }; - - /** - * Find data entries in the Data Delivery Registry - * - * @param fieldName - * The fieldname to search for - * @param queryTerms - * A hashmap containing the parameter name/value to search for - * @return A string array containing the found values or null if nothing is - * found - * @throws VizException - */ - public static Object[] performQuery( - Map queryTerms) throws VizException { - String query = assembleQuery(queryTerms, Mode.DISTINCT); - System.out.println("Query: " + query); - DatadeliveryConnector connection = DatadeliveryConnector.getInstance(); - - Object[] registryObjects = connection.connect(query, null, - REQUESTTIMEOUT); - - // TODO: Figure out what magic is required for specific queries. - // Eventually I'd like to make this several methods - - return registryObjects; - } - - private static String assembleQuery( - Map queryTerms, Mode mode) - throws VizException { - HashMap map = new HashMap( - queryTerms); - if (mode == Mode.DISTINCT) { - map.put("searchField1", new RequestConstraint()); - - } else { - throw new IllegalArgumentException("Unsupported mode: " + mode); - } - - return ScriptCreator.createScript(map, 1, "catalog"); - } - -} diff --git a/cave/com.raytheon.uf.viz.monitor.fog/src/com/raytheon/uf/viz/monitor/fog/ui/resource/FogResourceData.java b/cave/com.raytheon.uf.viz.monitor.fog/src/com/raytheon/uf/viz/monitor/fog/ui/resource/FogResourceData.java index 55ae2176e5..342c11d514 100644 --- a/cave/com.raytheon.uf.viz.monitor.fog/src/com/raytheon/uf/viz/monitor/fog/ui/resource/FogResourceData.java +++ b/cave/com.raytheon.uf.viz.monitor.fog/src/com/raytheon/uf/viz/monitor/fog/ui/resource/FogResourceData.java @@ -45,7 +45,6 @@ import com.raytheon.uf.viz.monitor.fog.FogMonitor; import com.raytheon.uf.viz.monitor.fog.threshold.FogAlgorithmMgr; import com.raytheon.viz.core.rsc.displays.GriddedImageDisplay; - /** * FogResourceData * @@ -70,40 +69,43 @@ import com.raytheon.viz.core.rsc.displays.GriddedImageDisplay; public class FogResourceData extends AbstractRequestableResourceData { private static final transient IUFStatusHandler statusHandler = UFStatus .getHandler(FogResourceData.class); + public FogRecord[] records; - + public Map dataObjectMap; - + public Map gridImageMap; - + protected FogMonitor monitor; - + protected FogAlgorithmMgr fogAlgMgr; - + protected FogThreat fogThreat; - + @Override protected AbstractVizResource constructResource( LoadProperties loadProperties, PluginDataObject[] objects) { - + records = new FogRecord[objects.length]; dataObjectMap = new HashMap(); gridImageMap = new HashMap(); - + for (int i = 0; i < objects.length; i++) { records[i] = (FogRecord) objects[i]; try { records[i] = populateRecord(records[i]); } catch (VizException e) { - statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); + statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), + e); } - if ( dataObjectMap.containsKey(records[i].getRefHour().getTime()) ) { - if ( dataObjectMap.get(records[i].getRefHour().getTime()).getDataTime().greaterThan(records[i].getDataTime()) ) { - continue; - } else { - dataObjectMap.remove(records[i].getRefHour().getTime()); - gridImageMap.remove(records[i].getRefHour().getTime()); - } + if (dataObjectMap.containsKey(records[i].getRefHour().getTime())) { + if (dataObjectMap.get(records[i].getRefHour().getTime()) + .getDataTime().greaterThan(records[i].getDataTime())) { + continue; + } else { + dataObjectMap.remove(records[i].getRefHour().getTime()); + gridImageMap.remove(records[i].getRefHour().getTime()); + } } dataObjectMap.put(records[i].getRefHour().getTime(), records[i]); gridImageMap.put(records[i].getRefHour().getTime(), null); @@ -111,7 +113,7 @@ public class FogResourceData extends AbstractRequestableResourceData { FogResource fogRes = new FogResource(this, loadProperties); getFogMonitor().addFogResourceListener(fogRes); - + return fogRes; } @@ -121,7 +123,7 @@ public class FogResourceData extends AbstractRequestableResourceData { public FogRecord[] getRecords() { return records; } - + /** * @param records * the records to set @@ -129,19 +131,18 @@ public class FogResourceData extends AbstractRequestableResourceData { public void setRecords(FogRecord[] records) { this.records = records; } - + /** * populate Fog Record * * @param record */ - public FogRecord populateRecord(FogRecord record) - throws VizException { + public FogRecord populateRecord(FogRecord record) throws VizException { IDataStore dataStore = getDataStore(record); record.retrieveFromDataStore(dataStore); return record; } - + /** * Get the data store * @@ -149,35 +150,21 @@ public class FogResourceData extends AbstractRequestableResourceData { * @return */ private IDataStore getDataStore(FogRecord record) { - IDataStore dataStore = null; - try { - Map vals = new HashMap(); - vals.put("dataURI", record.getDataURI()); - vals.put("pluginName", record.getPluginName()); - - record = (FogRecord) Loader.loadData(vals); - - File loc = HDF5Util.findHDF5Location(record); - dataStore = DataStoreFactory.getDataStore(loc); - - } catch (VizException e) { - e.printStackTrace(); - } - - return dataStore; + return DataStoreFactory.getDataStore(HDF5Util.findHDF5Location(record)); } - + /** Get the Fog Algorithm manager **/ protected FogAlgorithmMgr getAlgorithmManager() { - + if (fogAlgMgr == null) { fogAlgMgr = FogAlgorithmMgr.getInstance(); } return fogAlgMgr; } - + /** * Gets the fog Threat generator + * * @return */ protected FogThreat getFogThreat() { @@ -186,7 +173,7 @@ public class FogResourceData extends AbstractRequestableResourceData { } return fogThreat; } - + /** Get the Fog monitor **/ protected FogMonitor getFogMonitor() { if (monitor == null) { @@ -194,12 +181,11 @@ public class FogResourceData extends AbstractRequestableResourceData { } return monitor; } - + public void resetGridImgMap() { - for(Date key: dataObjectMap.keySet()){ + for (Date key : dataObjectMap.keySet()) { gridImageMap.put(key, null); } } - } diff --git a/cave/com.raytheon.uf.viz.monitor.safeseas/src/com/raytheon/uf/viz/monitor/safeseas/resources/SafeSeasResourceData.java b/cave/com.raytheon.uf.viz.monitor.safeseas/src/com/raytheon/uf/viz/monitor/safeseas/resources/SafeSeasResourceData.java index 588d6c83f1..3a99f433eb 100644 --- a/cave/com.raytheon.uf.viz.monitor.safeseas/src/com/raytheon/uf/viz/monitor/safeseas/resources/SafeSeasResourceData.java +++ b/cave/com.raytheon.uf.viz.monitor.safeseas/src/com/raytheon/uf/viz/monitor/safeseas/resources/SafeSeasResourceData.java @@ -19,7 +19,6 @@ */ package com.raytheon.uf.viz.monitor.safeseas.resources; -import java.io.File; import java.util.Date; import java.util.HashMap; import java.util.Map; @@ -36,7 +35,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.viz.core.HDF5Util; -import com.raytheon.uf.viz.core.comm.Loader; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData; import com.raytheon.uf.viz.core.rsc.AbstractVizResource; @@ -55,8 +53,8 @@ import com.raytheon.uf.viz.monitor.safeseas.SafeSeasMonitor; * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * July 21, 2010 4891 skorolev Initial Creation. - * + * Jul 21, 2010 4891 skorolev Initial Creation. + * Sep 11, 2013 2277 mschenke Got rid of ScriptCreator references * * * @author skorolev @@ -71,21 +69,20 @@ public class SafeSeasResourceData extends AbstractRequestableResourceData { private static final transient IUFStatusHandler statusHandler = UFStatus .getHandler(SafeSeasResourceData.class); - @XmlAttribute - protected String plotSource = "SAFESEAS Table"; + @XmlAttribute + protected String plotSource = "SAFESEAS Table"; - public FogRecord[] records; + public FogRecord[] records; public Map dataObjectMap; - protected SafeSeasMonitor monitor; + protected SafeSeasMonitor monitor; public HashMap plotted; - protected FogAlgorithmMgr fogAlgMgr; - - protected SSFogThreat fogThreatSS; + protected FogAlgorithmMgr fogAlgMgr; + protected SSFogThreat fogThreatSS; /* * (non-Javadoc) @@ -96,15 +93,15 @@ public class SafeSeasResourceData extends AbstractRequestableResourceData { * com.raytheon.uf.viz.core.drawables.IDescriptor) */ @Override - protected AbstractVizResource constructResource( - LoadProperties loadProperties, PluginDataObject[] objects) { + protected AbstractVizResource constructResource( + LoadProperties loadProperties, PluginDataObject[] objects) { - records = new FogRecord[objects.length]; + records = new FogRecord[objects.length]; dataObjectMap = new HashMap(); plotted = new HashMap(); - for (int i = 0; i < objects.length; i++) { - records[i] = (FogRecord) objects[i]; + for (int i = 0; i < objects.length; i++) { + records[i] = (FogRecord) objects[i]; try { records[i] = populateRecord(records[i]); } catch (VizException e) { @@ -115,12 +112,11 @@ public class SafeSeasResourceData extends AbstractRequestableResourceData { } dataObjectMap.put(records[i].getRefHour().getTime(), records[i]); plotted.put(records[i].getRefHour().getTime(), new Boolean(false)); - } + } - SafeSeasResource ssRes = new SafeSeasResource(this, - loadProperties); - getSafeSeasMonitor().addSSResourceListener(ssRes); - return ssRes; + SafeSeasResource ssRes = new SafeSeasResource(this, loadProperties); + getSafeSeasMonitor().addSSResourceListener(ssRes); + return ssRes; } /** @@ -133,7 +129,6 @@ public class SafeSeasResourceData extends AbstractRequestableResourceData { return monitor; } - /* * (non-Javadoc) * @@ -147,87 +142,72 @@ public class SafeSeasResourceData extends AbstractRequestableResourceData { } - /** - * @return the records - */ - public FogRecord[] getRecords() { - return records; - } + /** + * @return the records + */ + public FogRecord[] getRecords() { + return records; + } - /** - * @param records - * the records to set - */ - public void setRecords(FogRecord[] records) { - this.records = records; - } + /** + * @param records + * the records to set + */ + public void setRecords(FogRecord[] records) { + this.records = records; + } - /** - * populate Fog Record - * - * @param record - */ - public FogRecord populateRecord(FogRecord record) throws VizException { - IDataStore dataStore = getDataStore(record); - record.retrieveFromDataStore(dataStore); - return record; - } + /** + * populate Fog Record + * + * @param record + */ + public FogRecord populateRecord(FogRecord record) throws VizException { + IDataStore dataStore = getDataStore(record); + record.retrieveFromDataStore(dataStore); + return record; + } - /** - * Get the data store - * - * @param record - * @return - */ - private IDataStore getDataStore(FogRecord record) { - IDataStore dataStore = null; - try { - Map vals = new HashMap(); - vals.put("dataURI", record.getDataURI()); - vals.put("pluginName", record.getPluginName()); + /** + * Get the data store + * + * @param record + * @return + */ + private IDataStore getDataStore(FogRecord record) { + return DataStoreFactory.getDataStore(HDF5Util.findHDF5Location(record)); + } - record = (FogRecord) Loader.loadData(vals); + /** Get the Fog Algorithm manager **/ + protected FogAlgorithmMgr getAlgorithmManager() { - File loc = HDF5Util.findHDF5Location(record); - dataStore = DataStoreFactory.getDataStore(loc); + if (fogAlgMgr == null) { + fogAlgMgr = FogAlgorithmMgr.getInstance(); + } + return fogAlgMgr; + } - } catch (VizException e) { - e.printStackTrace(); - } + /** + * Gets the fog Threat generator + * + * @return + */ + protected SSFogThreat getSSFogThreat() { + if (fogThreatSS == null) { + fogThreatSS = new SSFogThreat(getAlgorithmManager() + .getAlgorithmXML()); + } + return fogThreatSS; + } - return dataStore; - } + /** Get the SafeSeasMonitor monitor **/ + protected SafeSeasMonitor getFogMonitor() { + if (monitor == null) { + monitor = SafeSeasMonitor.getInstance(); + } + return monitor; + } - /** Get the Fog Algorithm manager **/ - protected FogAlgorithmMgr getAlgorithmManager() { - - if (fogAlgMgr == null) { - fogAlgMgr = FogAlgorithmMgr.getInstance(); - } - return fogAlgMgr; - } - - /** - * Gets the fog Threat generator - * - * @return - */ - protected SSFogThreat getSSFogThreat() { - if (fogThreatSS == null) { - fogThreatSS = new SSFogThreat(getAlgorithmManager() - .getAlgorithmXML()); - } - return fogThreatSS; - } - - /** Get the SafeSeasMonitor monitor **/ - protected SafeSeasMonitor getFogMonitor() { - if (monitor == null) { - monitor = SafeSeasMonitor.getInstance(); - } - return monitor; - } - /** * @return plotSource */ diff --git a/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/ScanMonitor.java b/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/ScanMonitor.java index b930fb0adf..ce7581875c 100644 --- a/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/ScanMonitor.java +++ b/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/ScanMonitor.java @@ -48,7 +48,11 @@ import com.raytheon.uf.common.dataplugin.scan.data.DMDTableDataRow; import com.raytheon.uf.common.dataplugin.scan.data.ScanTableData; import com.raytheon.uf.common.dataplugin.scan.data.ScanTableDataRow; import com.raytheon.uf.common.dataplugin.warning.AbstractWarningRecord; +import com.raytheon.uf.common.dataplugin.warning.PracticeWarningRecord; +import com.raytheon.uf.common.dataplugin.warning.WarningRecord; +import com.raytheon.uf.common.dataquery.requests.DbQueryRequest; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; +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.geospatial.ISpatialQuery; @@ -71,12 +75,9 @@ import com.raytheon.uf.viz.core.HDF5Util; import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.catalog.DirectDbQuery; import com.raytheon.uf.viz.core.catalog.DirectDbQuery.QueryLanguage; -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.comm.Loader; import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.uf.viz.core.rsc.ResourceType; +import com.raytheon.uf.viz.core.requests.ThriftClient; import com.raytheon.uf.viz.monitor.IMonitor; import com.raytheon.uf.viz.monitor.ResourceMonitor; import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent; @@ -93,6 +94,7 @@ import com.raytheon.uf.viz.monitor.scan.tables.SCANDmdTableDlg; import com.raytheon.uf.viz.monitor.scan.tables.SCANMesoTableDlg; import com.raytheon.uf.viz.monitor.scan.tables.SCANTableData; import com.raytheon.uf.viz.monitor.scan.tables.SCANTvsTableDlg; +import com.raytheon.viz.core.mode.CAVEMode; import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Geometry; import com.vividsolutions.jts.geom.GeometryFactory; @@ -115,6 +117,7 @@ import com.vividsolutions.jts.io.WKBReader; * Jul 24, 2013 2218 mpduff Improved error handling, optimizations * Jul 30, 2013 2143 skorolev Changes for non-blocking dialogs. * Aug 15, 2013 2143 mpduff Fixed bug in nullifyMonitor() + * Sep 11, 2013 2277 mschenke Got rid of ScriptCreator references * * * @author dhladky @@ -478,11 +481,8 @@ public class ScanMonitor extends ResourceMonitor implements IScanDialogListener double tilt) throws VizException { String uri = getAvailableUri(tilt, date, type, icao); ScanRecord scanRec = null; - Map vals = new HashMap(); - vals.put("pluginName", "scan"); - vals.put("dataURI", uri); if (uri != null) { - scanRec = (ScanRecord) Loader.loadData(vals); + scanRec = (ScanRecord) Loader.loadData(uri); File loc = HDF5Util.findHDF5Location(scanRec); IDataStore dataStore = DataStoreFactory.getDataStore(loc); if (scanRec != null) { @@ -694,7 +694,7 @@ public class ScanMonitor extends ResourceMonitor implements IScanDialogListener try { ScanRecord rec = getScanRecord(type, icao, date, tilt); if (rec != null) { - data = getScanRecord(type, icao, date, tilt).getTableData(); + data = rec.getTableData(); } } catch (VizException ve) { statusHandler.warn("Couldn't load new ScanRecord: " + type.name()); @@ -1548,47 +1548,42 @@ public class ScanMonitor extends ResourceMonitor implements IScanDialogListener public Map retrieveWarnings(String icao, Date time, boolean severe, boolean tvs) { - Object[] resp; List removeList = new ArrayList(); HashMap cells = new HashMap(); List tvswarnings = new ArrayList(); List severewarnings = new ArrayList(); - HashMap vals = new HashMap(); - LayerProperty lp = new LayerProperty(); + + DbQueryRequest request = new DbQueryRequest(); + // TODO: There should be a smarter way to cap data requested using time + // passed in possibly. Should investigate into it + request.setLimit(NUMBER_OF_IMAGES); + request.setEntityClass(CAVEMode.getMode() == CAVEMode.PRACTICE ? PracticeWarningRecord.class + : WarningRecord.class); + if (icao != null) { + request.addConstraint("officeid", + new RequestConstraint(icao.toUpperCase())); + } + GeometryFactory factory = new GeometryFactory(); try { ScanTableData cellTable = getTableData(ScanTables.CELL, icao, time); - vals.put("pluginName", new RequestConstraint("warning")); - if (icao != null) { - vals.put("officeid", new RequestConstraint(icao.toUpperCase())); - } - lp.setDesiredProduct(ResourceType.PLAN_VIEW); - lp.setEntryQueryParameters(vals, false); - - lp.setNumberOfImages(NUMBER_OF_IMAGES); - - String script = ScriptCreator.createScript(lp); - if (script != null) { - resp = Connector.getInstance().connect(script, null, 60000); - - for (int i = 0; i < resp.length; i++) { - - AbstractWarningRecord rec = (AbstractWarningRecord) resp[i]; - - if (rec.getPhensig() != null) { - if (tvs - && rec.getPhensig().equals( - ScanUtils.TORNADO_WARNING_PHENSIG)) { - tvswarnings.add(rec); - } - if (severe - && rec.getPhensig().equals( - ScanUtils.SEVERE_THUNDERSTORM_PHENSIG)) { - severewarnings.add(rec); - } + DbQueryResponse response = (DbQueryResponse) ThriftClient + .sendRequest(request); + for (AbstractWarningRecord rec : response + .getEntityObjects(AbstractWarningRecord.class)) { + if (rec.getPhensig() != null) { + if (tvs + && rec.getPhensig().equals( + ScanUtils.TORNADO_WARNING_PHENSIG)) { + tvswarnings.add(rec); + } + if (severe + && rec.getPhensig().equals( + ScanUtils.SEVERE_THUNDERSTORM_PHENSIG)) { + severewarnings.add(rec); } } } diff --git a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/ObsMonitor.java b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/ObsMonitor.java index ab54e7aa90..71e02c44ed 100644 --- a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/ObsMonitor.java +++ b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/ObsMonitor.java @@ -22,22 +22,23 @@ package com.raytheon.uf.viz.monitor; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; +import java.util.Map; import java.util.regex.Pattern; import org.eclipse.swt.widgets.Display; import com.raytheon.uf.common.dataplugin.PluginDataObject; +import com.raytheon.uf.common.dataplugin.annotations.DataURIUtil; import com.raytheon.uf.common.dataplugin.fssobs.FSSObsRecord; +import com.raytheon.uf.common.dataplugin.fssobs.FSSObsRecordTransform; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; +import com.raytheon.uf.common.pointdata.PointDataContainer; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.alerts.AlertMessage; -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.datastructure.DataCubeContainer; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.localization.LocalizationManager; import com.raytheon.uf.viz.core.notification.NotificationMessage; -import com.raytheon.uf.viz.core.rsc.ResourceType; import com.raytheon.uf.viz.monitor.data.ObReport; import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent; import com.raytheon.uf.viz.monitor.events.IMonitorThresholdEvent; @@ -52,6 +53,7 @@ import com.raytheon.uf.viz.monitor.events.IMonitorThresholdEvent; * ------------ ---------- ----------- -------------------------- * Feb 25, 2010 4759 dhladky Initial creation. * Mar 15, 2012 14510 zhao modified processProductAtStartup() + * Sep 11, 2013 2277 mschenke Got rid of ScriptCreator references * * * @@ -66,17 +68,17 @@ public abstract class ObsMonitor extends Monitor { @Override protected abstract void nullifyMonitor(); - + /** * these are the over-arching "First line" checked patterns by plugin, first * letter of icao **/ protected ArrayList pluginPatterns = new ArrayList(); - + /** these are the patterns for the stations **/ protected ArrayList stationPatterns = new ArrayList(); - /** Current CWA **/ + /** Current CWA **/ public static String cwa = LocalizationManager.getInstance().getSite(); /** @@ -86,7 +88,7 @@ public abstract class ObsMonitor extends Monitor { */ protected abstract void process(ObReport result) throws Exception; - + protected abstract void processAtStartup(ObReport report); @Override @@ -100,7 +102,7 @@ public abstract class ObsMonitor extends Monitor { @Override public abstract void configUpdate(IMonitorConfigurationEvent me); - + /** * use this to do the initial filtering */ @@ -120,7 +122,7 @@ public abstract class ObsMonitor extends Monitor { return false; } } - + /** * Process the incoming dataURI * @@ -128,151 +130,103 @@ public abstract class ObsMonitor extends Monitor { * @param filtered */ public void processURI(String dataURI, AlertMessage filtered) { - - // Map attribs = filtered.decodedAlert; - HashMap vals = new HashMap(); - LayerProperty lp = new LayerProperty(); try { - // vals.put("cwa", new RequestConstraint(cwa)); - vals.put("dataURI", new RequestConstraint(dataURI)); - vals.put("pluginName", new RequestConstraint("fssobs")); - // vals.put("monitorUse", - // new RequestConstraint(attribs.get("monitorUse").toString())); - - lp.setDesiredProduct(ResourceType.PLAN_VIEW); - lp.setEntryQueryParameters(vals); - - String script = null; - try { - script = ScriptCreator.createScript(lp); - } catch (IllegalArgumentException e) { - System.out.println("Unsupported plugin name: " + pluginName - + " encountered"); - } - if (script != null) { - Object[] resp = Connector.getInstance().connect(script, null, - 60000); - if ((resp != null) && (resp.length > 0)) { - final PluginDataObject objectToSend = (PluginDataObject) resp[0]; - try { - Display.getDefault().asyncExec(new Runnable() { - public void run() { - try { - // ObReport obReport = new ObReport(); - // obReport.init(); - if (objectToSend instanceof FSSObsRecord - && ((FSSObsRecord) objectToSend) - .getTimeObs() != null) { - ObReport result = GenerateFSSObReport.generateObReport(objectToSend); - System.out - .println("New FSSrecord ===> " - + objectToSend - .getDataURI()); - process(result); - } - } catch (Exception e) { - e.printStackTrace(); - } + Map constraints = RequestConstraint + .toConstraintMapping(DataURIUtil.createDataURIMap(dataURI)); + FSSObsRecord[] pdos = requestFSSObs(constraints, null); + if (pdos.length > 0 && pdos[0].getTimeObs() != null) { + final FSSObsRecord objectToSend = pdos[0]; + try { + Display.getDefault().asyncExec(new Runnable() { + public void run() { + try { + ObReport result = GenerateFSSObReport + .generateObReport(objectToSend); + System.out.println("New FSSrecord ===> " + + objectToSend.getDataURI()); + process(result); + } catch (Exception e) { + e.printStackTrace(); } - }); - } catch (Exception e) { - e.printStackTrace(); - } - - } else if (resp == null) { - - } else if (resp.length == 0) { - + } + }); + } catch (Exception e) { + e.printStackTrace(); } } - } catch (final VizException e) { + } catch (final Exception e) { System.err.println("ObsMonitor: URI: " + dataURI - + " failed to process. "+e.getMessage()); + + " failed to process. " + e.getMessage()); } } - /** - * Process products at startup - * - * @param monitorUse - * - */ - public void processProductAtStartup(String monitorUse) { + /** + * Process products at startup + * + * @param monitorUse + * + */ + public void processProductAtStartup(String monitorUse) { - /** - * Assume this number for MaxNumObsTimes is larger enough to cover data - * of all observations (at least 24 hours' worth of data) in database - * [changed from 10 to 240 on May, 18, 2010 for DR #6015, zhao] - */ - int MaxNumObsTimes = 240; - HashMap vals = new HashMap(); - LayerProperty lp = new LayerProperty(); - try { - vals.put("cwa", new RequestConstraint(cwa)); - vals.put("pluginName", new RequestConstraint("fssobs")); - vals.put("monitorUse", new RequestConstraint(monitorUse)); + /** + * Assume this number for MaxNumObsTimes is larger enough to cover data + * of all observations (at least 24 hours' worth of data) in database + * [changed from 10 to 240 on May, 18, 2010 for DR #6015, zhao] + */ + int MaxNumObsTimes = 240; + Map vals = new HashMap(); + try { + vals.put("cwa", new RequestConstraint(cwa)); + vals.put(FSSObsRecord.PLUGIN_NAME_ID, new RequestConstraint( + FSSObsRecord.PLUGIN_NAME)); + vals.put("monitorUse", new RequestConstraint(monitorUse)); - lp.setDesiredProduct(ResourceType.PLAN_VIEW); - lp.setEntryQueryParameters(vals); + DataTime[] dataTimesAvailable = DataCubeContainer.performTimeQuery( + vals, false); + DataTime[] selectedTimes = dataTimesAvailable; - // Ensure that the latest product is retrieved. - // [Modified: retrieve at most MaxNumObsTimes data - // points, Feb - // 19, 2010, zhao] - DataTime[] dataTimesAvailable = lp.getEntryTimes(); - Arrays.sort(dataTimesAvailable); - if (dataTimesAvailable.length != 0) { - // at most, MaxNumObsTimes observation times are - // considered - if (dataTimesAvailable.length > MaxNumObsTimes) { - DataTime[] obsDataTime = new DataTime[MaxNumObsTimes]; - System.arraycopy(dataTimesAvailable, - dataTimesAvailable.length - MaxNumObsTimes, - obsDataTime, 0, MaxNumObsTimes); - lp.setSelectedEntryTimes(obsDataTime); - } else { - lp.setSelectedEntryTimes(dataTimesAvailable); - } - } - String script = null; - try { - script = ScriptCreator.createScript(lp); - } catch (IllegalArgumentException e) { - System.out.println("Unsupported plugin name encountered"); - } - if (script != null) { - final Object[] resp = Connector.getInstance().connect(script, - null, - 60000); - System.out.println("ObsMonitor: Retriving data for monitor: " + monitorUse); - if ((resp != null) && (resp.length > 0)) { + // Ensure that the latest product is retrieved. + // [Modified: retrieve at most MaxNumObsTimes data + // points, Feb + // 19, 2010, zhao] + if (dataTimesAvailable.length > 0) { + Arrays.sort(dataTimesAvailable); + // at most, MaxNumObsTimes observation times are + // considered + if (dataTimesAvailable.length > MaxNumObsTimes) { + selectedTimes = new DataTime[MaxNumObsTimes]; + System.arraycopy(dataTimesAvailable, + dataTimesAvailable.length - MaxNumObsTimes, + selectedTimes, 0, MaxNumObsTimes); + } - //Display.getDefault().syncExec(new Runnable() { - //public void run() { - for (int j = 0; j < resp.length; j++) { - PluginDataObject objectToSend = (PluginDataObject) resp[j]; - ObReport result = GenerateFSSObReport.generateObReport(objectToSend); - processAtStartup(result); - } - //} + FSSObsRecord[] obsRecords = requestFSSObs(vals, selectedTimes); + for (PluginDataObject objectToSend : obsRecords) { + ObReport result = GenerateFSSObReport + .generateObReport(objectToSend); + processAtStartup(result); + } + } + } catch (final VizException e) { + System.err + .println("No data in database at startup. " + monitorUse); + } + } - //}); - - } else if (resp == null) { - System.out - .println("Null Response From Script Created For: " - + monitorUse); - } else if (resp.length == 0) { - System.out - .println("Zero Length Response From Script Created For: " - + monitorUse); - } - } else { - System.out.println("Null script return For: " + monitorUse); - } - } catch (final VizException e) { - System.err - .println("No data in database at startup. " + monitorUse); - } - } + private FSSObsRecord[] requestFSSObs( + Map constraints, DataTime[] times) + throws VizException { + if (times != null) { + String[] timeStrs = new String[times.length]; + for (int i = 0; i < times.length; ++i) { + timeStrs[i] = times[i].toString(); + } + constraints.put(PluginDataObject.DATATIME_ID, + new RequestConstraint(timeStrs)); + } + PointDataContainer pdc = DataCubeContainer.getPointData( + FSSObsRecord.PLUGIN_NAME, FSSObsRecordTransform.FSSOBS_PARAMS, + constraints); + return FSSObsRecordTransform.toFSSObsRecords(pdc); + } } diff --git a/cave/com.raytheon.uf.viz.npp.nucaps/build.properties b/cave/com.raytheon.uf.viz.npp.nucaps/build.properties index 3459198753..15f66d39dc 100644 --- a/cave/com.raytheon.uf.viz.npp.nucaps/build.properties +++ b/cave/com.raytheon.uf.viz.npp.nucaps/build.properties @@ -2,4 +2,5 @@ source.. = src/ output.. = bin/ bin.includes = META-INF/,\ .,\ - localization/ + localization/,\ + plugin.xml diff --git a/cave/com.raytheon.uf.viz.vil/src/com/raytheon/uf/viz/vil/VILResourceData.java b/cave/com.raytheon.uf.viz.vil/src/com/raytheon/uf/viz/vil/VILResourceData.java index d6b10705f1..ac9ca555f8 100644 --- a/cave/com.raytheon.uf.viz.vil/src/com/raytheon/uf/viz/vil/VILResourceData.java +++ b/cave/com.raytheon.uf.viz.vil/src/com/raytheon/uf/viz/vil/VILResourceData.java @@ -19,7 +19,6 @@ **/ package com.raytheon.uf.viz.vil; -import java.io.File; import java.util.HashMap; import java.util.Map; @@ -33,7 +32,6 @@ import com.raytheon.uf.common.datastorage.DataStoreFactory; import com.raytheon.uf.common.datastorage.IDataStore; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.HDF5Util; -import com.raytheon.uf.viz.core.comm.Loader; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData; import com.raytheon.uf.viz.core.rsc.AbstractVizResource; @@ -114,21 +112,6 @@ public class VILResourceData extends AbstractRequestableResourceData { * @return */ private IDataStore getDataStore(VILRecord record) { - IDataStore dataStore = null; - try { - Map vals = new HashMap(); - vals.put("dataURI", record.getDataURI()); - vals.put("pluginName", record.getPluginName()); - - record = (VILRecord) Loader.loadData(vals); - - File loc = HDF5Util.findHDF5Location(record); - dataStore = DataStoreFactory.getDataStore(loc); - - } catch (VizException e) { - e.printStackTrace(); - } - - return dataStore; + return DataStoreFactory.getDataStore(HDF5Util.findHDF5Location(record)); } } diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/guidance/GuidanceUtil.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/guidance/GuidanceUtil.java index 584c314f4e..05a27b97bc 100644 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/guidance/GuidanceUtil.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/guidance/GuidanceUtil.java @@ -19,19 +19,10 @@ **/ package com.raytheon.viz.aviation.guidance; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - import com.raytheon.uf.common.dataplugin.gfe.point.GFEPointDataContainers; import com.raytheon.uf.common.dataplugin.gfe.request.GetPointDataRequest; import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse; -import com.raytheon.uf.common.dataplugin.obs.metar.MetarRecord; -import com.raytheon.uf.common.dataquery.requests.RequestConstraint; -import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.VizApp; -import com.raytheon.uf.viz.core.catalog.LayerProperty; -import com.raytheon.uf.viz.core.comm.Loader; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.requests.ThriftClient; @@ -45,6 +36,7 @@ import com.raytheon.uf.viz.core.requests.ThriftClient; * ------------ ---------- ----------- -------------------------- * Jul 29, 2009 njensen Initial creation * Mar 11, 2013 1735 rferrel Get a list of GFE Point Data Containers + * Sep 11, 2013 2277 mschenke Got rid of ScriptCreator references * * * @@ -54,37 +46,6 @@ import com.raytheon.uf.viz.core.requests.ThriftClient; public class GuidanceUtil { - /** - * Temporary workaround for metars, should be removed ASAP - * - * @param siteID - * @return - */ - @Deprecated - // TODO Remove this method no longer used in java, python of xml - // configuration. - public static MetarRecord getLatestMetar(String siteID) { - try { - Map map = new HashMap(); - map.put("pluginName", new RequestConstraint("obs")); - map.put("location.stationId", new RequestConstraint(siteID)); - LayerProperty lp = new LayerProperty(); - lp.setEntryQueryParameters(map); - DataTime[] dt = lp.getEntryTimes(); - if (dt.length == 0) { - return null; - } - lp.setSelectedEntryTimes(new DataTime[] { dt[dt.length - 1] }); - List objs = Loader.loadData(lp, "select", 10000); - MetarRecord metar = (MetarRecord) objs.get(0); - return metar; - } catch (VizException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return null; - } - /** * Get a list of GFE Point Data information for the task request. * diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/monitor/LtgMonitorObserver.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/monitor/LtgMonitorObserver.java index dd02715561..997041b246 100644 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/monitor/LtgMonitorObserver.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/monitor/LtgMonitorObserver.java @@ -20,14 +20,9 @@ package com.raytheon.viz.aviation.monitor; import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; import com.raytheon.uf.common.dataplugin.binlightning.BinLightningRecord; -import com.raytheon.uf.common.dataquery.requests.RequestConstraint; 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.exception.VizException; import com.raytheon.viz.aviation.observer.TafMonitorDlg; @@ -42,6 +37,7 @@ import com.raytheon.viz.aviation.observer.TafMonitorDlg; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Sep 10, 2009 njensen Initial creation + * Sep 11, 2013 2277 mschenke Got rid of ScriptCreator references * * * @@ -77,21 +73,12 @@ public class LtgMonitorObserver extends MonitorObserver { private static BinLightningRecord getRecord(String dataUri) { BinLightningRecord rec = null; - Map map = new HashMap(); - map.put("pluginName", new RequestConstraint("binlightning")); - map.put("dataURI", new RequestConstraint(dataUri)); - LayerProperty lp = new LayerProperty(); try { - lp.setEntryQueryParameters(map); - List objs = Loader.loadData(lp, "select", 10000); - if (objs.size() > 0) { - rec = (BinLightningRecord) objs.get(0); - } + rec = (BinLightningRecord) Loader.loadData(dataUri); } catch (VizException e) { // TODO Auto-generated catch block e.printStackTrace(); } - return rec; } diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/monitor/TafUtil.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/monitor/TafUtil.java index 556459afad..7ed7311c4d 100644 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/monitor/TafUtil.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/monitor/TafUtil.java @@ -19,22 +19,22 @@ **/ package com.raytheon.viz.aviation.monitor; -import java.util.ArrayList; +import java.util.Arrays; import java.util.Calendar; -import java.util.Date; +import java.util.Collections; +import java.util.Comparator; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.TimeZone; import com.raytheon.edex.plugin.taf.common.TafRecord; +import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; 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.comm.Loader; +import com.raytheon.uf.viz.core.datastructure.DataCubeContainer; import com.raytheon.uf.viz.core.exception.VizException; /** @@ -49,7 +49,8 @@ import com.raytheon.uf.viz.core.exception.VizException; * Jul 6, 2010 5792 rferrel getLatestTafs now returns tafs * sorted by issue date newest at * the start of the array. - * 08AUG2012 15613 zhao Modified safeFormatTaf() + * 08AUG2012 15613 zhao Modified safeFormatTaf() + * Sep 11, 2013 2277 mschenke Got rid of ScriptCreator references * * * @@ -92,15 +93,11 @@ public class TafUtil { public static TafRecord[] getLatestTafs(String siteID, int numberOfTafs) { try { Map map = new HashMap(); - map.put("pluginName", new RequestConstraint("taf")); + map.put(TafRecord.PLUGIN_NAME_ID, new RequestConstraint( + TafRecord.PLUGIN_NAME)); map.put("stationId", new RequestConstraint(siteID)); - LayerProperty lp = new LayerProperty(); - lp.setEntryQueryParameters(map); - lp.setNumberOfImages(numberOfTafs); - // Assume entry times are the same as issue time and are - // returned sorted with oldest to newest timestamp. - DataTime[] dt = lp.getEntryTimes(); + DataTime[] dt = DataCubeContainer.performTimeQuery(map, false); if (dt.length == 0) { return null; } @@ -117,35 +114,23 @@ public class TafUtil { break; } } - lp.setSelectedEntryTimes(requestedTimes); - List objs = Loader.loadData(lp, "select", 10000); - TafRecord[] tafs = new TafRecord[objs.size()]; - // No need to sort single record - if (objs.size() == 1) { - tafs[0] = (TafRecord) objs.get(0); + PluginDataObject[] pdos = DataCubeContainer.getData(map, + requestedTimes); + TafRecord[] tafs = new TafRecord[pdos.length]; + for (int i = 0; i < pdos.length; ++i) { + tafs[i] = (TafRecord) pdos[i]; } - // sort so newest issued taf record is first. - else { - ArrayList tafList = new ArrayList( - objs.size()); - tafList.add((TafRecord) objs.get(0)); - - for (int i = 1; i < objs.size(); i++) { - TafRecord tafI = (TafRecord) objs.get(i); - Date timeI = tafI.getIssue_time(); - - for (k = 0; k < i; ++k) { - if (timeI.compareTo(tafList.get(k).getIssue_time()) > 0) { - break; + // Sort newest first based on issue time + Arrays.sort(tafs, + Collections.reverseOrder(new Comparator() { + @Override + public int compare(TafRecord o1, TafRecord o2) { + return o1.getIssue_time().compareTo( + o2.getIssue_time()); } - } + })); - tafList.add(k, tafI); - } - - tafList.toArray(tafs); - } return tafs; } catch (VizException e) { statusHandler.handle(Priority.PROBLEM, "Error retrieving TAFs", e); @@ -167,7 +152,8 @@ public class TafUtil { if (includeHeader) { sb.append(t.getWmoHeader()); sb.append(LINE_BREAK); - sb.append("TAF").append(t.getStationId().substring(1,4)).append(LINE_BREAK); + sb.append("TAF").append(t.getStationId().substring(1, 4)) + .append(LINE_BREAK); } String firstLine = text[0]; if (firstLine.startsWith("TAF AMD") diff --git a/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/TafSiteInfoEditorDlg.java b/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/TafSiteInfoEditorDlg.java index 4981cd8a81..8dbc5f7312 100644 --- a/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/TafSiteInfoEditorDlg.java +++ b/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/TafSiteInfoEditorDlg.java @@ -24,7 +24,6 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; -import java.util.List; import java.util.Map; import org.apache.commons.configuration.ConfigurationException; @@ -50,16 +49,15 @@ import org.eclipse.swt.widgets.Text; import com.raytheon.uf.common.dataplugin.text.AfosWmoIdDataContainer; import com.raytheon.uf.common.dataplugin.text.db.AfosToAwips; import com.raytheon.uf.common.dataplugin.text.request.GetPartialAfosIdRequest; +import com.raytheon.uf.common.dataquery.requests.DbQueryRequest; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; +import com.raytheon.uf.common.dataquery.responses.DbQueryResponse; import com.raytheon.uf.common.localization.LocalizationFile; import com.raytheon.uf.common.localization.exception.LocalizationOpFailedException; import com.raytheon.uf.common.pointdata.spatial.ObStation; 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.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; import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType; @@ -84,6 +82,7 @@ import com.vividsolutions.jts.geom.Point; * and made non-blocking. * 15 Oct 2012 1229 rferrel Changes for non-blocking TextEditorSetupDlg. * 15 OCT 2012 1229 rferrel Changes for non-blocking HelpUsageDlg. + * 11 Sep 2013 2277 mschenke Got rid of ScriptCreator references * * * @@ -487,8 +486,7 @@ public class TafSiteInfoEditorDlg extends CaveSWTDialog { String description = "AvnFPS - Site Info Editor Help"; String helpText = "This dialog is used to define TAF site information.\n\nTo add a new site, enter site id and press \"Update\". Edit\ndisplayed entries and press \"Save\". Create default template\nfiles.\n\nTo change an existing TAF site attribute, enter site id and\npress the \"Load\" button.\n\nTo create template files, press \"Make\" in the \"Templates\"\narea.\n\nTo edit template file, select issue hour, then press \"Edit\"\nin the \"Templates\" area.\n\nYou can use \"Update\" button to extract information from\nAWIPS configuration files. Only non-empty fields will be\noverwritten."; - usageDlg = new HelpUsageDlg(shell, description, - helpText); + usageDlg = new HelpUsageDlg(shell, description, helpText); usageDlg.open(); } else { usageDlg.bringToTop(); @@ -1003,34 +1001,21 @@ public class TafSiteInfoEditorDlg extends CaveSWTDialog { private ObStation getObStation(String icao) throws VizException { // New up request constraint for table request and // also of the classname of the table for the request - String tablePluginName = "table"; - String tableDatabaseName = "metadata"; - String tableClassName = ObStation.class.getName(); - RequestConstraint rcTable = new RequestConstraint(tablePluginName); - RequestConstraint rcDatabase = new RequestConstraint(tableDatabaseName); - RequestConstraint rcClass = new RequestConstraint(tableClassName); - RequestConstraint rcGid = new RequestConstraint(ObStation.createGID( - ObStation.CAT_TYPE_ICAO, icao)); + DbQueryRequest request = new DbQueryRequest(); + request.setEntityClass(ObStation.class); + request.addConstraint( + "gid", + new RequestConstraint(ObStation.createGID( + ObStation.CAT_TYPE_ICAO, icao))); + request.setLimit(1); - // New up hash map and populate with entry query - // parameters before new'ng up layer property - HashMap query = new HashMap(); - query.put("pluginName", rcTable); - query.put("databasename", rcDatabase); - query.put("classname", rcClass); - query.put("gid", rcGid); - - // New up layer property and set the entry parameters - LayerProperty lpParm = new LayerProperty(); - lpParm.setEntryQueryParameters(query, false); - // Create Image Script for table request - String tableScript = ScriptCreator.createScript(lpParm); - List list = Loader.loadData(tableScript, 10000); - - if (list.size() == 0) { + DbQueryResponse response = (DbQueryResponse) ThriftClient + .sendRequest(request); + ObStation[] stations = response.getEntityObjects(ObStation.class); + if (stations.length == 0) { throw new VizException("Station not found: " + icao); } - return (ObStation) list.get(0); + return stations[0]; } /** diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/msgs/IAviationObserver.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/msgs/IAviationObserver.java index 23bb4423e5..18dcfecb75 100644 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/msgs/IAviationObserver.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/msgs/IAviationObserver.java @@ -19,8 +19,6 @@ **/ package com.raytheon.viz.texteditor.msgs; -import java.util.List; - /** * The IAviationObserver interface specifies a method that allows the Aviation * Plug-in to save a working TAF bulletin. @@ -30,6 +28,7 @@ import java.util.List; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * May 15, 2008 1119 grichard Initial creation + * Sep 11, 2013 2277 mschenke Removed unused function * * * @@ -38,7 +37,7 @@ import java.util.List; */ public interface IAviationObserver { + void saveTafBulletin(String wrkTaf); - List recoverTafBulletin(); } diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/util/AviationTextUtility.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/util/AviationTextUtility.java index 649b13dd49..4d8ec1e987 100644 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/util/AviationTextUtility.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/util/AviationTextUtility.java @@ -22,7 +22,6 @@ package com.raytheon.viz.texteditor.util; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; -import java.util.List; import java.util.TimeZone; import javax.xml.bind.JAXBException; @@ -40,9 +39,7 @@ 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.localization.LocalizationManager; -import com.raytheon.uf.viz.core.status.StatusConstants; import com.raytheon.viz.core.mode.CAVEMode; -import com.raytheon.viz.texteditor.Activator; import com.raytheon.viz.texteditor.StdTextProductFactory; import com.raytheon.viz.texteditor.msgs.IAviationObserver; @@ -59,6 +56,7 @@ import com.raytheon.viz.texteditor.msgs.IAviationObserver; * dependency * 05/10/2010 2187 cjeanbap Added StdTextProductFactory * functionality. + * 09/11/2013 2277 mschenke Removed unused function * * * @author grichard @@ -66,7 +64,8 @@ import com.raytheon.viz.texteditor.msgs.IAviationObserver; */ public class AviationTextUtility implements IAviationObserver { - private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(AviationTextUtility.class); + private static final transient IUFStatusHandler statusHandler = UFStatus + .getHandler(AviationTextUtility.class); /** * Method to save a temporary working version of a TAF bulletin to the text @@ -126,8 +125,7 @@ public class AviationTextUtility implements IAviationObserver { rcRow = new RequestConstraint( SerializationUtil.marshalToXml(tmpProd)); } catch (JAXBException e) { - statusHandler.handle(Priority.PROBLEM, - "Error serializing data", e); + statusHandler.handle(Priority.PROBLEM, "Error serializing data", e); return; } // New up hash map and populate with entry query @@ -154,72 +152,11 @@ public class AviationTextUtility implements IAviationObserver { // textEditor.insert(((StdTextProduct) (list.get(0))) // .getProduct()); } catch (VizException e1) { - statusHandler.handle(Priority.PROBLEM, - "Error retrieving metadata", e1); + statusHandler.handle(Priority.PROBLEM, "Error retrieving metadata", + e1); } } - /** - * Method to recover a temporary working version of a TAF bulletin from the - * text database. - * - * @return String -- recovered temporary working version of a TAF bulletin - */ - @Override - public List recoverTafBulletin() { - // Set the node based on localization. - String siteNode = LocalizationManager.getInstance().getCurrentSite(); - - // Set the Site ID based on localization. - String siteName = LocalizationManager.getInstance().getCurrentSite() - .toUpperCase(); - if (siteName.length() == 3) { - siteName = SiteMap.getInstance().getSite4LetterId(siteName); - } - if ((siteName == null) || (siteName.equals(""))) { - siteName = "CCCC"; - } - - // New up request constraint for table request and - // also of the class name of the table for the request - RequestConstraint rcTable = new RequestConstraint("table"); - String tableDatabaseName = "fxa"; - String tableClassName = StdTextProduct.class.getName(); - - RequestConstraint rcDatabase = new RequestConstraint(tableDatabaseName); - RequestConstraint rcClass = new RequestConstraint(tableClassName); - - RequestConstraint rcNode = new RequestConstraint(siteNode); - RequestConstraint rcCategory = new RequestConstraint("WRK"); - RequestConstraint rcDesignator = new RequestConstraint("TAF"); - - // New up hash map and populate with entry query - // parameters before newing up layer property - HashMap query = new HashMap(); - query.put("pluginName", rcTable); - query.put("databasename", rcDatabase); - query.put("classname", rcClass); - query.put("prodId.cccid", rcNode); - query.put("prodId.nnnid", rcCategory); - query.put("prodId.xxxid", rcDesignator); - - // New up layer property and set then entry parameters - LayerProperty lpParm = new LayerProperty(); - try { - lpParm.setEntryQueryParameters(query, false); - // Create Image Script for table request - String tableScript = ScriptCreator.createScript(lpParm); - // Capture the script to the console for now... - // System.out.printf("The query script is: %n%s%n", - // tableScript); - return Loader.loadData(tableScript, 10000); - } catch (VizException e1) { - statusHandler.handle(Priority.PROBLEM, - "Error retrieving metadata", e1); - } - return null; - } - private String getCurrentDate() { Date now = SimulatedTime.getSystemTime().getTime(); SimpleDateFormat formatter = new SimpleDateFormat("ddHHmm"); diff --git a/edexOsgi/com.raytheon.edex.plugin.taf/src/com/raytheon/edex/plugin/taf/common/TafRecord.java b/edexOsgi/com.raytheon.edex.plugin.taf/src/com/raytheon/edex/plugin/taf/common/TafRecord.java index 4690840804..f9f1943290 100644 --- a/edexOsgi/com.raytheon.edex.plugin.taf/src/com/raytheon/edex/plugin/taf/common/TafRecord.java +++ b/edexOsgi/com.raytheon.edex.plugin.taf/src/com/raytheon/edex/plugin/taf/common/TafRecord.java @@ -77,12 +77,12 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; */ @Entity @SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "tafseq") -@Table(name = "taf", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) }) +@Table(name = TafRecord.PLUGIN_NAME, uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) }) /* * Both refTime and forecastTime are included in the refTimeIndex since * forecastTime is unlikely to be used. */ -@org.hibernate.annotations.Table(appliesTo = "taf", indexes = { @Index(name = "taf_refTimeIndex", columnNames = { +@org.hibernate.annotations.Table(appliesTo = TafRecord.PLUGIN_NAME, indexes = { @Index(name = "taf_refTimeIndex", columnNames = { "refTime", "forecastTime" }) }) @DynamicSerialize @XmlAccessorType(XmlAccessType.NONE) @@ -91,6 +91,8 @@ public class TafRecord extends PluginDataObject implements ISpatialEnabled { private static final long serialVersionUID = 1L; + public static final String PLUGIN_NAME = "taf"; + @DynamicSerializeElement @XmlElement @Column @@ -429,6 +431,6 @@ public class TafRecord extends PluginDataObject implements ISpatialEnabled { @Override public String getPluginName() { - return "taf"; + return PLUGIN_NAME; } } diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/src/com/raytheon/uf/common/dataplugin/binlightning/BinLightningRecord.java b/edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/src/com/raytheon/uf/common/dataplugin/binlightning/BinLightningRecord.java index e6d780cf60..4f649f7b34 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/src/com/raytheon/uf/common/dataplugin/binlightning/BinLightningRecord.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/src/com/raytheon/uf/common/dataplugin/binlightning/BinLightningRecord.java @@ -91,12 +91,12 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools; */ @Entity @SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "binlightningseq") -@Table(name = "binlightning", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) }) +@Table(name = BinLightningRecord.PLUGIN_NAME, uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) }) /* * Both refTime and forecastTime are included in the refTimeIndex since * forecastTime is unlikely to be used. */ -@org.hibernate.annotations.Table(appliesTo = "binlightning", indexes = { @Index(name = "binlightning_refTimeIndex", columnNames = { +@org.hibernate.annotations.Table(appliesTo = BinLightningRecord.PLUGIN_NAME, indexes = { @Index(name = "binlightning_refTimeIndex", columnNames = { "refTime", "forecastTime" }) }) @XmlRootElement @DynamicSerialize @@ -107,6 +107,8 @@ public class BinLightningRecord extends PersistablePluginDataObject implements /** Serializable id * */ private static final long serialVersionUID = 1L; + public static final String PLUGIN_NAME = "binlightning"; + @Transient private long[] obsTimes = null; @@ -509,6 +511,6 @@ public class BinLightningRecord extends PersistablePluginDataObject implements @Override public String getPluginName() { - return "binlightning"; + return PLUGIN_NAME; } } diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.fssobs/src/com/raytheon/uf/common/dataplugin/fssobs/FSSObsRecord.java b/edexOsgi/com.raytheon.uf.common.dataplugin.fssobs/src/com/raytheon/uf/common/dataplugin/fssobs/FSSObsRecord.java index 8389e5d301..1726596ce6 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.fssobs/src/com/raytheon/uf/common/dataplugin/fssobs/FSSObsRecord.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.fssobs/src/com/raytheon/uf/common/dataplugin/fssobs/FSSObsRecord.java @@ -44,12 +44,12 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; @Entity @SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "fssobsseq") -@Table(name = "fssobs", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) }) +@Table(name = FSSObsRecord.PLUGIN_NAME, uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) }) /* * Both refTime and forecastTime are included in the refTimeIndex since * forecastTime is unlikely to be used. */ -@org.hibernate.annotations.Table(appliesTo = "fssobs", indexes = { @Index(name = "fssobs_refTimeIndex", columnNames = { +@org.hibernate.annotations.Table(appliesTo = FSSObsRecord.PLUGIN_NAME, indexes = { @Index(name = "fssobs_refTimeIndex", columnNames = { "refTime", "forecastTime" }) }) @XmlRootElement @XmlAccessorType(XmlAccessType.NONE) @@ -1240,6 +1240,6 @@ public class FSSObsRecord extends PersistablePluginDataObject implements @Override public String getPluginName() { - return "fssobs"; + return PLUGIN_NAME; } } diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.fssobs/src/com/raytheon/uf/common/dataplugin/fssobs/FSSObsRecordTransform.java b/edexOsgi/com.raytheon.uf.common.dataplugin.fssobs/src/com/raytheon/uf/common/dataplugin/fssobs/FSSObsRecordTransform.java index aeb74977b6..b16fbd19af 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.fssobs/src/com/raytheon/uf/common/dataplugin/fssobs/FSSObsRecordTransform.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.fssobs/src/com/raytheon/uf/common/dataplugin/fssobs/FSSObsRecordTransform.java @@ -31,78 +31,118 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools; * Provides a transform from PointDataContainer to FSSObsRecord. * *
- *
+ * 
  * SOFTWARE HISTORY
- *
+ * 
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Mar 8, 2011            skorolev     Initial creation
- *
+ * 
  * 
- * + * * @author skorolev - * @version 1.0 + * @version 1.0 */ public class FSSObsRecordTransform { - private static final String DATA_URI = "dataURI"; - private static final String LONGITUDE = "longitude"; - private static final String LATITUDE = "latitude"; - private static final String ELEVATION = "elevation"; + private static final String DATA_URI = "dataURI"; + + private static final String LONGITUDE = "longitude"; + + private static final String LATITUDE = "latitude"; + + private static final String ELEVATION = "elevation"; + private static final String CEILING = "ceiling"; + private static final String DEWPOINT = "dewpoint"; + private static final String DEWPOINT_DEPR = "dewpointDepr"; + private static final String FROSTBITE_TIME = "frostbiteTime"; + private static final String HORIZONTAL_VIS = "horzVisibility"; + private static final String HOURLY_PRECIP = "hourlyPrecip"; + private static final String MAX_WIND_SPEED = "maxWindSpeed"; + private static final String PLATFORM_ID = "platformId"; + private static final String PRES_WEATHER = "presWeather"; + private static final String PRESS_CHANGE3_HOUR = "pressChange3Hour"; + private static final String PRESS_CHANGE_CHAR = "pressChangeChar"; + private static final String PRESS_ALTIMETER = "pressureAltimeter"; + private static final String PRI_SWELL_WV_DIR = "primarySwellWaveDir"; + private static final String PRI_SWELL_WV_HGT = "primarySwellWaveHeight"; + private static final String PRI_SWELL_WV_PD = "primarySwellWavePeriod"; + private static final String RAW_MESSAGE = "rawMessage"; + private static final String REL_HUMIDITY = "relativeHumidity"; + private static final String SEA_LEVEL_PRESS = "seaLevelPress"; + private static final String SEA_SFC_TEMP = "seaSurfaceTemp"; + private static final String SEC_SWELL_WV_DIR = "secondarySwellWaveDir"; + private static final String SEC_SWELL_WV_HGT = "secondarySwellWaveHeight"; + private static final String SEC_SWELL_WV_PD = "secondarySwellWavePeriod"; + private static final String SKY_COVER = "skyCover"; + private static final String SNOW_INC_HOURLY = "snincrHourly"; + private static final String SNOW_INC_TOTAL = "snincrTotal"; + private static final String SNOW_DEPTH = "snowDepth"; + private static final String STATION_NAME = "stnName"; + private static final String TEMPERATURE = "temperature"; + private static final String TIME_OBS = "timeObs"; private static final String REF_HOUR = "refHour"; + private static final String CLOUD_AMOUNT_TOT = "totCloudAmount"; + private static final String VISIBILITY = "visibility"; - private static final String WAVE_HEIGHT = "highResWaveHeight"; + + private static final String WAVE_HEIGHT = "highResWaveHeight"; + private static final String WV_HGT = "waveHeight"; + private static final String WV_PD = "wavePeriod"; + private static final String WV_STEEPNESS = "waveSteepness"; + private static final String WIND_DIR = "windDir"; + private static final String WIND_GUST = "windGust"; + private static final String WIND_SPEED = "windSpeed"; - - private static final String[] FSSOBS_PARAMS = { DATA_URI, LONGITUDE, - LATITUDE, ELEVATION, CEILING, DEWPOINT, DEWPOINT_DEPR, - FROSTBITE_TIME, HORIZONTAL_VIS, HOURLY_PRECIP, MAX_WIND_SPEED, - PLATFORM_ID, PRES_WEATHER, PRESS_CHANGE3_HOUR, PRESS_CHANGE_CHAR, - PRESS_ALTIMETER, PRI_SWELL_WV_DIR, PRI_SWELL_WV_HGT, - PRI_SWELL_WV_PD, RAW_MESSAGE, REL_HUMIDITY, SEA_LEVEL_PRESS, - SEA_SFC_TEMP, SEC_SWELL_WV_DIR, SEC_SWELL_WV_HGT, SEC_SWELL_WV_PD, - SKY_COVER, SNOW_INC_HOURLY, SNOW_INC_TOTAL, SNOW_DEPTH, + + public static final String[] FSSOBS_PARAMS = { DATA_URI, LONGITUDE, + LATITUDE, ELEVATION, CEILING, DEWPOINT, DEWPOINT_DEPR, + FROSTBITE_TIME, HORIZONTAL_VIS, HOURLY_PRECIP, MAX_WIND_SPEED, + PLATFORM_ID, PRES_WEATHER, PRESS_CHANGE3_HOUR, PRESS_CHANGE_CHAR, + PRESS_ALTIMETER, PRI_SWELL_WV_DIR, PRI_SWELL_WV_HGT, + PRI_SWELL_WV_PD, RAW_MESSAGE, REL_HUMIDITY, SEA_LEVEL_PRESS, + SEA_SFC_TEMP, SEC_SWELL_WV_DIR, SEC_SWELL_WV_HGT, SEC_SWELL_WV_PD, + SKY_COVER, SNOW_INC_HOURLY, SNOW_INC_TOTAL, SNOW_DEPTH, STATION_NAME, TEMPERATURE, TIME_OBS, REF_HOUR, CLOUD_AMOUNT_TOT, - VISIBILITY, - WAVE_HEIGHT, WV_HGT, WV_PD, WV_STEEPNESS, WIND_DIR, WIND_GUST, - WIND_SPEED }; - + VISIBILITY, WAVE_HEIGHT, WV_HGT, WV_PD, WV_STEEPNESS, WIND_DIR, + WIND_GUST, WIND_SPEED }; + public static final String FSSOBS_PARAMS_LIST; static { @@ -119,7 +159,6 @@ public class FSSObsRecordTransform { FSSOBS_PARAMS_LIST = sb.toString(); } - /** * * @param container @@ -139,20 +178,20 @@ public class FSSObsRecordTransform { } return records.toArray(new FSSObsRecord[records.size()]); } - + private static FSSObsRecord toFSSObsRecord(PointDataView pdv) { FSSObsRecord obs = null; if (pdv != null) { - // String uri = pdv.getString(DATA_URI); - obs = new FSSObsRecord(); - obs.setDataURI(pdv.getString(DATA_URI)); - SurfaceObsLocation loc = new SurfaceObsLocation( - pdv.getString(PLATFORM_ID)); - Double lat = pdv.getNumber(LATITUDE).doubleValue(); - Double lon = pdv.getNumber(LONGITUDE).doubleValue(); - loc.assignLocation(lat, lon); - loc.setElevation(pdv.getNumber(ELEVATION).intValue()); - obs.setLocation(loc); + // String uri = pdv.getString(DATA_URI); + obs = new FSSObsRecord(); + obs.setDataURI(pdv.getString(DATA_URI)); + SurfaceObsLocation loc = new SurfaceObsLocation( + pdv.getString(PLATFORM_ID)); + Double lat = pdv.getNumber(LATITUDE).doubleValue(); + Double lon = pdv.getNumber(LONGITUDE).doubleValue(); + loc.assignLocation(lat, lon); + loc.setElevation(pdv.getNumber(ELEVATION).intValue()); + obs.setLocation(loc); obs.setCeiling(pdv.getFloat(CEILING)); obs.setDewpoint(pdv.getNumber(DEWPOINT).floatValue()); obs.setDewpointDepr(pdv.getFloat(DEWPOINT_DEPR)); @@ -162,19 +201,26 @@ public class FSSObsRecordTransform { obs.setMaxWindSpeed(pdv.getFloat(MAX_WIND_SPEED)); obs.setPlatformId(pdv.getString(PLATFORM_ID)); obs.setPresWeather(pdv.getStringAllLevels(PRES_WEATHER)); - obs.setPressChange3Hour(pdv.getNumber(PRESS_CHANGE3_HOUR).floatValue()); + obs.setPressChange3Hour(pdv.getNumber(PRESS_CHANGE3_HOUR) + .floatValue()); obs.setPressChangeChar(pdv.getString(PRESS_CHANGE_CHAR)); obs.setPressureAltimeter(pdv.getFloat(PRESS_ALTIMETER)); - obs.setPrimarySwellWaveDir(pdv.getNumber(PRI_SWELL_WV_DIR).doubleValue()); - obs.setPrimarySwellWaveHeight(pdv.getNumber(PRI_SWELL_WV_HGT).doubleValue()); - obs.setPrimarySwellWavePeriod(pdv.getNumber(PRI_SWELL_WV_PD).intValue()); + obs.setPrimarySwellWaveDir(pdv.getNumber(PRI_SWELL_WV_DIR) + .doubleValue()); + obs.setPrimarySwellWaveHeight(pdv.getNumber(PRI_SWELL_WV_HGT) + .doubleValue()); + obs.setPrimarySwellWavePeriod(pdv.getNumber(PRI_SWELL_WV_PD) + .intValue()); obs.setRawMessage(pdv.getString(RAW_MESSAGE)); obs.setRelativeHumidity(pdv.getFloat(REL_HUMIDITY)); obs.setSeaLevelPress(pdv.getFloat(SEA_LEVEL_PRESS)); obs.setSeaSurfaceTemp(pdv.getFloat(SEA_SFC_TEMP)); - obs.setSecondarySwellWaveDir(pdv.getNumber(SEC_SWELL_WV_DIR).doubleValue()); - obs.setSecondarySwellWaveHeight(pdv.getNumber(SEC_SWELL_WV_HGT).doubleValue()); - obs.setSecondarySwellWavePeriod(pdv.getNumber(SEC_SWELL_WV_PD).intValue()); + obs.setSecondarySwellWaveDir(pdv.getNumber(SEC_SWELL_WV_DIR) + .doubleValue()); + obs.setSecondarySwellWaveHeight(pdv.getNumber(SEC_SWELL_WV_HGT) + .doubleValue()); + obs.setSecondarySwellWavePeriod(pdv.getNumber(SEC_SWELL_WV_PD) + .intValue()); obs.setSkyCover(pdv.getStringAllLevels(SKY_COVER)); obs.setSnincrHourly(pdv.getFloat(SNOW_INC_HOURLY)); obs.setSnincrTotal(pdv.getFloat(SNOW_INC_TOTAL)); @@ -187,7 +233,7 @@ public class FSSObsRecordTransform { obs.setRefHour(TimeTools.newCalendar(rh)); obs.setTotCloudAmount(pdv.getNumber(CLOUD_AMOUNT_TOT).intValue()); obs.setVisibility(pdv.getNumber(VISIBILITY).floatValue()); - obs.setHighResWaveHeight(pdv.getFloat(WAVE_HEIGHT)); + obs.setHighResWaveHeight(pdv.getFloat(WAVE_HEIGHT)); obs.setWaveHeight(pdv.getNumber(WV_HGT).doubleValue()); obs.setWavePeriod(pdv.getNumber(WV_PD).intValue()); obs.setWindDir(pdv.getNumber(WIND_DIR).floatValue()); diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/db/objects/GFERecord.java b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/db/objects/GFERecord.java index 691320c6da..9bae76c55f 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/db/objects/GFERecord.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/db/objects/GFERecord.java @@ -86,7 +86,7 @@ import com.raytheon.uf.common.time.TimeRange; */ @Entity @SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "gfeseq") -@Table(name = "gfe", uniqueConstraints = { @UniqueConstraint(columnNames = { +@Table(name = GFERecord.PLUGIN_NAME, uniqueConstraints = { @UniqueConstraint(columnNames = { "parmId_id", "rangestart", "rangeend", "refTime", "forecasttime" }) }) /* * Both refTime and forecastTime are included in the refTimeIndex since diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.profiler/src/com/raytheon/uf/common/dataplugin/profiler/ProfilerObs.java b/edexOsgi/com.raytheon.uf.common.dataplugin.profiler/src/com/raytheon/uf/common/dataplugin/profiler/ProfilerObs.java index 9783d4703f..3c8720bf16 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.profiler/src/com/raytheon/uf/common/dataplugin/profiler/ProfilerObs.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.profiler/src/com/raytheon/uf/common/dataplugin/profiler/ProfilerObs.java @@ -89,7 +89,7 @@ import com.vividsolutions.jts.geom.Geometry; */ @Entity @SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "profilerseq") -@Table(name = "profiler", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) }) +@Table(name = ProfilerObs.PLUGIN_NAME, uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) }) /* * Both refTime and forecastTime are included in the refTimeIndex since * forecastTime is unlikely to be used. diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.radar/src/com/raytheon/uf/common/dataplugin/radar/RadarRecord.java b/edexOsgi/com.raytheon.uf.common.dataplugin.radar/src/com/raytheon/uf/common/dataplugin/radar/RadarRecord.java index 30cdafc814..7517138e3b 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.radar/src/com/raytheon/uf/common/dataplugin/radar/RadarRecord.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.radar/src/com/raytheon/uf/common/dataplugin/radar/RadarRecord.java @@ -142,7 +142,7 @@ import com.vividsolutions.jts.geom.Coordinate; */ @Entity @SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "radarseq") -@Table(name = "radar", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) }) +@Table(name = RadarRecord.PLUGIN_NAME, uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) }) /* * Both refTime and forecastTime are included in the refTimeIndex since * forecastTime is unlikely to be used. diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/WarningRecord.java b/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/WarningRecord.java index 587f4d7ec7..75775681d5 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/WarningRecord.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/WarningRecord.java @@ -60,12 +60,12 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; */ @Entity @SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "warningseq") -@Table(name = "warning", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) }) +@Table(name = WarningRecord.PLUGIN_NAME, uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) }) /* * Both refTime and forecastTime are included in the refTimeIndex since * forecastTime is unlikely to be used. */ -@org.hibernate.annotations.Table(appliesTo = "warning", indexes = { +@org.hibernate.annotations.Table(appliesTo = WarningRecord.PLUGIN_NAME, indexes = { @Index(name = "warning_refTimeIndex", columnNames = { "refTime", "forecastTime" }), @Index(name = "warning_office_phensig_index", columnNames = { @@ -133,6 +133,8 @@ public class WarningRecord extends AbstractWarningRecord { } + public static final String PLUGIN_NAME = "warning"; + private static final long serialVersionUID = 1L; /** @@ -173,6 +175,6 @@ public class WarningRecord extends AbstractWarningRecord { @Override public String getPluginName() { - return "warning"; + return PLUGIN_NAME; } } 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 b7e2d441e0..c8e94c6c81 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 @@ -122,6 +122,8 @@ public abstract class PluginDataObject extends PersistableDataObject implements public static final String DATATIME_ID = "dataTime"; + public static final String DATAURI_ID = "dataURI"; + 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/RequestConstraint.java b/edexOsgi/com.raytheon.uf.common.dataquery/src/com/raytheon/uf/common/dataquery/requests/RequestConstraint.java index d533d81454..76fd4605bd 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 @@ -114,7 +114,7 @@ public class RequestConstraint implements ISerializableObject, Cloneable { @DynamicSerializeElement protected String constraintValue; - protected transient Map, Object> asMap; + protected transient Map, Object> asMap = new HashMap, Object>(); /** * Constructor @@ -124,8 +124,7 @@ public class RequestConstraint implements ISerializableObject, Cloneable { } public RequestConstraint(ConstraintType constraintType) { - this.constraintType = constraintType; - this.asMap = new HashMap, Object>(); + this(null, constraintType); } /** @@ -135,8 +134,7 @@ public class RequestConstraint implements ISerializableObject, Cloneable { * the value to constrain on */ public RequestConstraint(String value) { - this(); - this.constraintValue = value; + this(value, ConstraintType.EQUALS); } /** @@ -146,30 +144,36 @@ public class RequestConstraint implements ISerializableObject, Cloneable { * @param type */ public RequestConstraint(String value, ConstraintType type) { - this(value); + this.constraintValue = value; this.constraintType = type; } /** - * Creates a {@link RequestConstraint} with {@link ConstraintType#IN} with - * inConstraints set as the {@link #setConstraintValueList(Collection)} + * Converts inConstraints into String[] and calls + * {@link RequestConstraint#RequestConstraint(String[])} * * @param inConstraints */ public RequestConstraint(Collection inConstraints) { - this(ConstraintType.IN); - setConstraintValueList(inConstraints); + this(inConstraints.toArray(new String[0])); } /** * Creates a {@link RequestConstraint} with {@link ConstraintType#IN} with - * inConstraints set as the {@link #setConstraintValueList(String[])} + * inConstraints set as the {@link #setConstraintValueList(String[])} if + * inConstraints size == 1 then {@link ConstraintType#EQUALS} will be used + * instead * * @param inConstraints */ public RequestConstraint(String[] inConstraints) { - this(ConstraintType.IN); - setConstraintValueList(inConstraints); + this.constraintType = ConstraintType.IN; + if (inConstraints.length == 1) { + this.constraintType = ConstraintType.EQUALS; + this.constraintValue = inConstraints[0]; + } else { + setConstraintValueList(inConstraints); + } } /** diff --git a/ncep/gov.noaa.nws.ncep.viz.rsc.lightning/src/gov/noaa/nws/ncep/viz/rsc/lightning/rsc/NcLtngAlertParser.java b/ncep/gov.noaa.nws.ncep.viz.rsc.lightning/src/gov/noaa/nws/ncep/viz/rsc/lightning/rsc/NcLtngAlertParser.java index 89bb2f62a2..690ea20201 100644 --- a/ncep/gov.noaa.nws.ncep.viz.rsc.lightning/src/gov/noaa/nws/ncep/viz/rsc/lightning/rsc/NcLtngAlertParser.java +++ b/ncep/gov.noaa.nws.ncep.viz.rsc.lightning/src/gov/noaa/nws/ncep/viz/rsc/lightning/rsc/NcLtngAlertParser.java @@ -1,10 +1,5 @@ package gov.noaa.nws.ncep.viz.rsc.lightning.rsc; -import java.util.HashMap; -import java.util.Map; - -import com.raytheon.uf.common.dataplugin.PluginDataObject; -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.comm.Loader; @@ -18,14 +13,6 @@ public class NcLtngAlertParser extends AbstractAlertMessageParser { @Override public Object parseAlertMessage(AlertMessage message, AbstractRequestableResourceData reqResourceData) throws VizException { - - Object objectToSend = null; - Map attribs = new HashMap( - message.decodedAlert); - String dataURI = message.dataURI; - attribs.put("dataURI", message.dataURI); - objectToSend = Loader.loadData(attribs); - - return objectToSend; + return Loader.loadData(message.dataURI); } } diff --git a/ncep/gov.noaa.nws.ncep.viz.ui.perspectives/src/gov/noaa/nws/ncep/viz/ui/perspectives/NcAutoUpdater.java b/ncep/gov.noaa.nws.ncep.viz.ui.perspectives/src/gov/noaa/nws/ncep/viz/ui/perspectives/NcAutoUpdater.java index c6db6b09d5..4c5e35aa06 100644 --- a/ncep/gov.noaa.nws.ncep.viz.ui.perspectives/src/gov/noaa/nws/ncep/viz/ui/perspectives/NcAutoUpdater.java +++ b/ncep/gov.noaa.nws.ncep.viz.ui.perspectives/src/gov/noaa/nws/ncep/viz/ui/perspectives/NcAutoUpdater.java @@ -81,8 +81,6 @@ public class NcAutoUpdater implements IAlertObserver { AbstractRequestableResourceData reqResourceData) throws VizException { Object objectToSend = null; - Map attribs = new HashMap( - message.decodedAlert); String dataURI = message.dataURI; if (reqResourceData.isUpdatingOnMetadataOnly()) { PluginDataObject record = RecordFactory.getInstance() @@ -90,8 +88,7 @@ public class NcAutoUpdater implements IAlertObserver { objectToSend = record; } else { - attribs.put("dataURI", message.dataURI); - objectToSend = Loader.loadData(attribs); + objectToSend = Loader.loadData(dataURI); } return objectToSend; }