From fff6719c0660d3e0d4808c226b2b6154d0d0deb6 Mon Sep 17 00:00:00 2001 From: Ben Steffensmeier Date: Mon, 1 Oct 2012 15:38:53 -0500 Subject: [PATCH] Issue #189 switch DAT to grid. Former-commit-id: c2a12bbfdd77d5af2233b309bbfa65bd70969f43 [formerly 4d6358ec521ebcdc29acff127d8294aaee89d856] [formerly c2a12bbfdd77d5af2233b309bbfa65bd70969f43 [formerly 4d6358ec521ebcdc29acff127d8294aaee89d856] [formerly b3190ba34ddd9ef158ca01dcc97a84ce28e7eaed [formerly a062b80648acb5d7ba664821bb9f65bdf985a971]]] Former-commit-id: b3190ba34ddd9ef158ca01dcc97a84ce28e7eaed Former-commit-id: a7d78f268f209be177e9d7301a378551d8a397c2 [formerly a2b019d65520c561f62fa35f16783206c49bc928] Former-commit-id: b7036a34a873a35c3052f07c885f7e873e19aaf4 --- .../META-INF/MANIFEST.MF | 11 +- .../uf/common/dataplugin/ffmp/FFMPUtils.java | 70 +++++----- .../META-INF/MANIFEST.MF | 5 +- .../dataplugin/scan/data/ModelData.java | 18 +-- .../META-INF/MANIFEST.MF | 13 +- .../raytheon/uf/edex/dat/utils/DATUtils.java | 25 ++-- .../uf/edex/dat/utils/FreezingLevel.java | 16 +-- .../META-INF/MANIFEST.MF | 8 +- .../uf/edex/plugin/cwat/CWAThreat.java | 4 +- .../edex/plugin/cwat/common/CWATConfig.java | 24 ++-- .../META-INF/MANIFEST.MF | 12 +- .../uf/edex/plugin/ffmp/FFMPGenerator.java | 88 +++++++------ .../edex/plugin/ffmp/common/FFMPConfig.java | 10 +- .../plugin/ffmp/common/FFMPProcessor.java | 10 +- .../META-INF/MANIFEST.MF | 10 +- .../uf/edex/plugin/qpf/common/QPFConfig.java | 6 +- .../META-INF/MANIFEST.MF | 16 +-- .../res/spring/scan-common.xml | 2 +- .../uf/edex/plugin/scan/ScanURIFilter.java | 64 ++++----- .../edex/plugin/scan/process/CAPEProduct.java | 38 ++---- .../plugin/scan/process/GH1000Product.java | 38 ++---- .../plugin/scan/process/GH500Product.java | 38 ++---- .../edex/plugin/scan/process/GridProduct.java | 124 ++++++++++++++++++ .../edex/plugin/scan/process/HELIProduct.java | 38 ++---- .../edex/plugin/scan/process/ScanProduct.java | 23 ++-- .../edex/plugin/scan/process/U500Product.java | 38 ++---- .../edex/plugin/scan/process/U700Product.java | 38 ++---- .../edex/plugin/scan/process/V700Product.java | 38 ++---- .../META-INF/MANIFEST.MF | 7 +- 29 files changed, 414 insertions(+), 418 deletions(-) create mode 100644 edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/GridProduct.java diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.ffmp/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.dataplugin.ffmp/META-INF/MANIFEST.MF index e7d07c71be..ff5ebc10f8 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.ffmp/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.ffmp/META-INF/MANIFEST.MF @@ -10,18 +10,13 @@ Export-Package: com.raytheon.uf.common.dataplugin.ffmp, com.raytheon.uf.common.dataplugin.ffmp.dao Require-Bundle: javax.persistence;bundle-version="1.0.0", com.raytheon.edex.common;bundle-version="1.11.1", - org.apache.commons.logging;bundle-version="1.0.4", - org.geotools;bundle-version="2.5.2", com.raytheon.uf.common.monitor;bundle-version="1.11.5", - com.raytheon.uf.common.dataplugin, - com.raytheon.uf.common.dataplugin.qpf;bundle-version="1.11.9", com.raytheon.uf.common.hydro;bundle-version="1.11.11", com.raytheon.uf.common.mpe;bundle-version="1.11.11", com.raytheon.uf.common.localization;bundle-version="1.11.13", com.raytheon.uf.common.status;bundle-version="1.12.1174", com.raytheon.uf.common.site, - com.raytheon.uf.common.dataplugin.radar;bundle-version="1.0.0", com.raytheon.uf.common.dataplugin.shef;bundle-version="1.12.1174", - com.raytheon.uf.common.cache;bundle-version="1.12.1174" -Import-Package: com.raytheon.uf.common.dataplugin.grib, - com.raytheon.uf.common.datastorage.hdf5 + com.raytheon.uf.common.cache;bundle-version="1.12.1174", + com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1174", + com.raytheon.uf.common.dataplugin.grid;bundle-version="1.0.0" diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.ffmp/src/com/raytheon/uf/common/dataplugin/ffmp/FFMPUtils.java b/edexOsgi/com.raytheon.uf.common.dataplugin.ffmp/src/com/raytheon/uf/common/dataplugin/ffmp/FFMPUtils.java index d8197bc1a8..13758d47ec 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.ffmp/src/com/raytheon/uf/common/dataplugin/ffmp/FFMPUtils.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.ffmp/src/com/raytheon/uf/common/dataplugin/ffmp/FFMPUtils.java @@ -31,11 +31,18 @@ import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.Map; +import java.util.Set; import org.geotools.coverage.grid.GridGeometry2D; import org.geotools.referencing.GeodeticCalculator; +import com.raytheon.uf.common.dataplugin.grid.GridConstants; +import com.raytheon.uf.common.dataplugin.grid.GridRecord; import com.raytheon.uf.common.dataplugin.shef.util.ShefConstants; +import com.raytheon.uf.common.dataquery.requests.DbQueryRequest; +import com.raytheon.uf.common.dataquery.requests.DbQueryRequest.OrderMode; +import com.raytheon.uf.common.dataquery.requests.RequestConstraint; +import com.raytheon.uf.common.dataquery.responses.DbQueryResponse; import com.raytheon.uf.common.geospatial.ISpatialQuery; import com.raytheon.uf.common.geospatial.MapUtil; import com.raytheon.uf.common.geospatial.SpatialException; @@ -44,6 +51,7 @@ import com.raytheon.uf.common.hydro.spatial.HRAPCoordinates; import com.raytheon.uf.common.hydro.spatial.HRAPSubGrid; import com.raytheon.uf.common.monitor.scan.ScanUtils; import com.raytheon.uf.common.mpe.util.XmrgFile; +import com.raytheon.uf.common.serialization.comm.RequestRouter; import com.raytheon.uf.common.site.SiteMap; import com.raytheon.uf.edex.database.dao.CoreDao; import com.raytheon.uf.edex.database.dao.DaoConfig; @@ -71,7 +79,6 @@ import com.vividsolutions.jts.io.WKTWriter; * ------------ ---------- ----------- -------------------------- * 06/22/09 2152 D. Hladky Initial release * 06/18/12 DR 15108 G. Zhang Fix County FIPS 4-digit issue - * 09/05/12 DR 15164 G. Zhang Fix FFMP Table county/state name null issue * * * @author dhladky @@ -873,31 +880,28 @@ public class FFMPUtils { * @param rfc * @return */ - public static HashMap getFFGModelInfo(String rfc) { + public static Set getFFGParameters(String rfc) { + Set ffgHash = new HashSet(); /** * Had to add this bit of code for ncgrib models */ - String sql = "select id, parameterabbreviation from awips.grib_models where modelname = 'FFG-" - + rfc.substring(1) + "\'"; - - ISpatialQuery sq = null; - HashMap ffgHash = new HashMap(); - + DbQueryRequest request = new DbQueryRequest(); + request.setEntityClass(GridRecord.class.getName()); + request.setDistinct(true); + request.addRequestField(GridConstants.PARAMETER_ABBREVIATION); + request.addConstraint(GridConstants.DATASET_ID, new RequestConstraint( + "FFG-" + rfc.substring(1))); try { - sq = SpatialQueryFactory.create(); - Object[] results = sq.dbRequest(sql, META_DB); - if (results.length > 0) { - for (int i = 0; i < results.length; i++) { - Object[] results2 = (Object[]) results[i]; - if (results2.length > 0) { - Integer id = (Integer) results2[0]; - String key = (String) results2[1]; - ffgHash.put(key, id); - } - } + DbQueryResponse response = (DbQueryResponse) RequestRouter + .route(request); + + for (Map map : response.getResults()) { + String key = (String) map + .get(GridConstants.PARAMETER_ABBREVIATION); + ffgHash.add(key); } - } catch (SpatialException e) { + } catch (Exception e) { e.printStackTrace(); } @@ -910,24 +914,26 @@ public class FFMPUtils { * @param id * @return */ - public static String getFFGDataURI(int id, String plugin) { - String sql = "select datauri from awips." + plugin - + " where modelinfo_id = " + id + " order by reftime desc"; - - ISpatialQuery sq = null; - String uri = null; + public static String getFFGDataURI(String parameter, String plugin) { + DbQueryRequest request = new DbQueryRequest(); + request.setEntityClass(GridRecord.class.getName()); + request.addRequestField("dataURI"); + request.addConstraint(GridConstants.PARAMETER_ABBREVIATION, + new RequestConstraint(parameter)); + request.setOrderByField("dataTime.refTime", OrderMode.DESC); try { - sq = SpatialQueryFactory.create(); - Object[] results = sq.dbRequest(sql, META_DB); - if (results.length > 0) { - uri = (String) results[0]; + DbQueryResponse response = (DbQueryResponse) RequestRouter + .route(request); + + for (Map map : response.getResults()) { + return (String) map.get("dataURI"); } - } catch (SpatialException e) { + } catch (Exception e) { e.printStackTrace(); } - return uri; + return null; } /** diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.scan/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.dataplugin.scan/META-INF/MANIFEST.MF index fbed137140..38f08d641e 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.scan/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.scan/META-INF/MANIFEST.MF @@ -12,12 +12,9 @@ Export-Package: com.raytheon.uf.common.dataplugin.scan, Require-Bundle: javax.persistence;bundle-version="1.0.0", com.raytheon.edex.common;bundle-version="1.11.1", org.apache.commons.logging;bundle-version="1.0.4", - org.geotools;bundle-version="2.5.2", com.raytheon.uf.common.monitor;bundle-version="1.11.5", com.raytheon.uf.common.dataplugin.binlightning;bundle-version="1.11.26", - com.raytheon.uf.common.dataplugin.bufrua;bundle-version="1.11.26", - com.raytheon.uf.common.dataplugin.ffmp;bundle-version="1.11.31", - com.raytheon.uf.common.dataplugin.grib;bundle-version="1.11.31", + com.raytheon.uf.common.dataplugin.grid, com.raytheon.uf.common.sounding;bundle-version="1.12.1112", com.raytheon.uf.common.dataplugin.radar;bundle-version="1.0.0" diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.scan/src/com/raytheon/uf/common/dataplugin/scan/data/ModelData.java b/edexOsgi/com.raytheon.uf.common.dataplugin.scan/src/com/raytheon/uf/common/dataplugin/scan/data/ModelData.java index ce28c26353..006f955220 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.scan/src/com/raytheon/uf/common/dataplugin/scan/data/ModelData.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.scan/src/com/raytheon/uf/common/dataplugin/scan/data/ModelData.java @@ -31,7 +31,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.geotools.coverage.grid.GridGeometry2D; -import com.raytheon.uf.common.dataplugin.grib.GribRecord; +import com.raytheon.uf.common.dataplugin.grid.GridRecord; import com.raytheon.uf.common.datastorage.records.FloatDataRecord; import com.raytheon.uf.common.geospatial.ISpatialObject; import com.raytheon.uf.common.geospatial.MapUtil; @@ -46,7 +46,7 @@ import com.vividsolutions.jts.geom.Coordinate; @DynamicSerialize public class ModelData implements ISerializableObject { - private final Map> gribMap; + private final Map> gribMap; private transient final Log logger = LogFactory.getLog(getClass()); @@ -54,7 +54,7 @@ public class ModelData implements ISerializableObject { * Public constructor */ public ModelData() { - gribMap = new HashMap>(); + gribMap = new HashMap>(); } /** @@ -80,7 +80,7 @@ public class ModelData implements ISerializableObject { * @return * @throws Exception */ - private synchronized GribRecord getRecord(String modelName, String prodType) + private synchronized GridRecord getRecord(String modelName, String prodType) throws Exception { return gribMap.get(modelName).get(prodType); } @@ -90,8 +90,8 @@ public class ModelData implements ISerializableObject { * * @param gr */ - public synchronized void setGribRecord(String modelName, String prodType, - GribRecord gr) { + public synchronized void setGridRecord(String modelName, String prodType, + GridRecord gr) { if (gribMap.get(modelName) != null) { if (gribMap.get(modelName).get(prodType) != null) { if (!gribMap.get(modelName).get(prodType).getDataURI() @@ -103,7 +103,7 @@ public class ModelData implements ISerializableObject { gribMap.get(modelName).put(prodType, gr); } } else { - HashMap modelHash = new HashMap(); + HashMap modelHash = new HashMap(); modelHash.put(prodType, gr); // add new gribMap.put(modelName, modelHash); @@ -115,7 +115,7 @@ public class ModelData implements ISerializableObject { * * @param gr */ - public synchronized GribRecord getGribRecord(String modelName, + public synchronized GridRecord getGridRecord(String modelName, String prodType) { return gribMap.get(modelName).get(prodType); } @@ -160,7 +160,7 @@ public class ModelData implements ISerializableObject { double value = -99999.0; try { Point point = getPoint(modelName, prodType, coor); - GribRecord gribRec = getRecord(modelName, prodType); + GridRecord gribRec = getRecord(modelName, prodType); FloatDataRecord rec = (FloatDataRecord) getRecord(modelName, prodType).getMessageData(); value = rec.getFloatData()[(gribRec.getSpatialObject().getNx() * point.x) diff --git a/edexOsgi/com.raytheon.uf.edex.dat.utils/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.dat.utils/META-INF/MANIFEST.MF index 78796b025d..24fad222b6 100644 --- a/edexOsgi/com.raytheon.uf.edex.dat.utils/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.edex.dat.utils/META-INF/MANIFEST.MF @@ -5,23 +5,16 @@ Bundle-SymbolicName: com.raytheon.uf.edex.dat.utils Bundle-Version: 1.12.1174.qualifier Bundle-Vendor: RAYTHEON Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Import-Package: com.raytheon.edex.plugin.grib, - com.raytheon.edex.plugin.grib.dao, - com.raytheon.uf.common.dataplugin.ffmp, - com.raytheon.uf.common.dataplugin.ffmp.dao, - com.raytheon.uf.common.dataplugin.grib, - com.raytheon.uf.common.dataplugin.level, - com.raytheon.uf.common.dataplugin.radar.util, +Import-Package: com.raytheon.uf.common.dataplugin.ffmp, + com.raytheon.uf.common.dataplugin.grid, com.raytheon.uf.common.dataplugin.scan.data, com.raytheon.uf.common.localization, com.raytheon.uf.common.menus, com.raytheon.uf.common.menus.xml, com.raytheon.uf.common.monitor.xml, - com.raytheon.uf.common.status, - com.raytheon.uf.common.ohd + com.raytheon.uf.common.status Export-Package: com.raytheon.uf.edex.dat.utils Require-Bundle: com.raytheon.edex.common;bundle-version="1.12.2", - org.geotools;bundle-version="2.5.2", com.raytheon.uf.common.dataplugin.ffmp;bundle-version="1.12.2", com.raytheon.uf.common.monitor;bundle-version="1.12.2", org.apache.commons.logging;bundle-version="1.0.4", diff --git a/edexOsgi/com.raytheon.uf.edex.dat.utils/src/com/raytheon/uf/edex/dat/utils/DATUtils.java b/edexOsgi/com.raytheon.uf.edex.dat.utils/src/com/raytheon/uf/edex/dat/utils/DATUtils.java index 80c2001187..0b64cbd375 100644 --- a/edexOsgi/com.raytheon.uf.edex.dat.utils/src/com/raytheon/uf/edex/dat/utils/DATUtils.java +++ b/edexOsgi/com.raytheon.uf.edex.dat.utils/src/com/raytheon/uf/edex/dat/utils/DATUtils.java @@ -25,11 +25,10 @@ import java.util.ArrayList; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import com.raytheon.edex.plugin.grib.dao.GribDao; import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.PluginException; import com.raytheon.uf.common.dataplugin.ffmp.FFMPVirtualGageBasin; -import com.raytheon.uf.common.dataplugin.grib.GribRecord; +import com.raytheon.uf.common.dataplugin.grid.GridRecord; import com.raytheon.uf.common.dataplugin.persist.IPersistable; import com.raytheon.uf.common.dataplugin.shef.util.ShefConstants; import com.raytheon.uf.common.datastorage.IDataStore; @@ -97,12 +96,12 @@ public class DATUtils { * @param uri * @return */ - public static GribRecord getGribRecord(String uri) throws PluginException { + public static GridRecord getGridRecord(String uri) throws PluginException { - GribRecord gr = new GribRecord(uri); - GribDao gd = (GribDao) PluginFactory.getInstance().getPluginDao( + GridRecord gr = new GridRecord(uri); + PluginDao gd = PluginFactory.getInstance().getPluginDao( gr.getPluginName()); - gr = (GribRecord) gd.getMetadata(uri); + gr = (GridRecord) gd.getMetadata(uri); if (gr != null) { @@ -264,30 +263,30 @@ public class DATUtils { * @param param * @return */ - public static GribRecord getMostRecentGribRecord(int interval, String sql, + public static GridRecord getMostRecentGridRecord(int interval, String sql, SCANModelParameterXML param) { - GribRecord rec = null; + GridRecord rec = null; try { ScanDataCache cache = ScanDataCache.getInstance(); Object[] obs = dbRequest(sql); - GribRecord newRec = null; + GridRecord newRec = null; if (obs != null && obs.length > 0) { String uri = (String) obs[0]; - newRec = getGribRecord(uri); + newRec = getGridRecord(uri); } if (cache.getModelData().isType(param.getModelName(), param.getParameterName())) { - GribRecord oldRec = cache.getModelData().getGribRecord( + GridRecord oldRec = cache.getModelData().getGridRecord( param.getModelName(), param.getParameterName()); if (newRec != null) { if (newRec.getDataTime().getRefTime() .after(oldRec.getDataTime().getRefTime())) { - cache.getModelData().setGribRecord( + cache.getModelData().setGridRecord( param.getModelName(), param.getParameterName(), newRec); rec = newRec; @@ -299,7 +298,7 @@ public class DATUtils { } } else { if (newRec != null) { - cache.getModelData().setGribRecord(param.getModelName(), + cache.getModelData().setGridRecord(param.getModelName(), param.getParameterName(), newRec); rec = newRec; } diff --git a/edexOsgi/com.raytheon.uf.edex.dat.utils/src/com/raytheon/uf/edex/dat/utils/FreezingLevel.java b/edexOsgi/com.raytheon.uf.edex.dat.utils/src/com/raytheon/uf/edex/dat/utils/FreezingLevel.java index 66bdeb5573..3b21559b85 100644 --- a/edexOsgi/com.raytheon.uf.edex.dat.utils/src/com/raytheon/uf/edex/dat/utils/FreezingLevel.java +++ b/edexOsgi/com.raytheon.uf.edex.dat.utils/src/com/raytheon/uf/edex/dat/utils/FreezingLevel.java @@ -25,7 +25,7 @@ import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map.Entry; -import com.raytheon.uf.common.dataplugin.grib.GribRecord; +import com.raytheon.uf.common.dataplugin.grid.GridRecord; import com.raytheon.uf.common.monitor.xml.SCANModelParameterXML; import com.vividsolutions.jts.geom.Coordinate; @@ -235,13 +235,13 @@ public class FreezingLevel { * @param param * @return */ - private GribRecord populateRecord(String model, String param) { + private GridRecord populateRecord(String model, String param) { int interval = 1440; SCANModelParameterXML paramXML = new SCANModelParameterXML(); paramXML.setModelName(model); paramXML.setParameterName(param); String sql = getSQL(interval, model, param); - GribRecord modelRec = DATUtils.getMostRecentGribRecord(interval, sql, + GridRecord modelRec = DATUtils.getMostRecentGridRecord(interval, sql, paramXML); if (modelRec != null) { @@ -339,14 +339,12 @@ public class FreezingLevel { } // Gets the most recent record of it's type - String sql = "select datauri from grib where modelinfo_id = (select id from grib_models where parameterabbreviation = \'" + String sql = "select grid.datauri from grid, grid_info, level where grid.info_id = grid_info.id and grid_info.level_id = level.id and grid_info.parameter_abbreviation = \'" + paramName - + "\' and modelname = \'" + + "\' and grid_info.datasetId = \'" + model - + "\' and level_id = (select id from level where masterlevel_name = 'MB' and levelonevalue = '" - + level - + "\'" - + " limit 1)) order by forecasttime desc limit 1"; + + "\' and level.masterlevel_name = 'MB' and level.levelonevalue = '" + + level + "\'" + " order by grid.forecasttime desc limit 1"; return sql; } } diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.cwat/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.plugin.cwat/META-INF/MANIFEST.MF index e817351e35..41e7e5454a 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.cwat/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.edex.plugin.cwat/META-INF/MANIFEST.MF @@ -5,12 +5,9 @@ Bundle-SymbolicName: com.raytheon.uf.edex.plugin.cwat Bundle-Version: 1.12.1174.qualifier Bundle-Vendor: RAYTHEON Eclipse-RegisterBuddy: com.raytheon.edex.common, com.raytheon.uf.common.serialization, com.raytheon.uf.viz.core -Require-Bundle: org.eclipse.ui, - org.eclipse.core.runtime, - com.raytheon.uf.edex.cpgsrv;bundle-version="1.11.7";resolution:=optional, +Require-Bundle: com.raytheon.uf.edex.cpgsrv;bundle-version="1.11.7";resolution:=optional, com.raytheon.edex.common;bundle-version="1.11.7", com.raytheon.uf.common.monitor;bundle-version="1.11.7", - org.geotools;bundle-version="2.5.2", org.apache.commons.collections, org.apache.commons.logging;bundle-version="1.0.4", com.raytheon.uf.common.dataplugin.cwat;bundle-version="1.0.0", @@ -18,11 +15,10 @@ Require-Bundle: org.eclipse.ui, com.raytheon.uf.common.monitor.cpg;bundle-version="1.0.0", com.raytheon.uf.common.status;bundle-version="1.12.1152", com.raytheon.uf.common.localization, - com.raytheon.uf.common.comm, com.raytheon.uf.common.dataplugin.radar;bundle-version="1.0.0", com.raytheon.uf.common.dataplugin.scan;bundle-version="1.12.1174", com.raytheon.uf.common.sounding;bundle-version="1.12.1174", - com.raytheon.uf.common.dataplugin.grib;bundle-version="1.12.1174", + com.raytheon.uf.common.dataplugin.grid, com.raytheon.uf.edex.plugin.scan;bundle-version="1.12.1174", com.raytheon.uf.edex.dat.utils;bundle-version="1.12.1174" Bundle-RequiredExecutionEnvironment: JavaSE-1.6 diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.cwat/src/com/raytheon/uf/edex/plugin/cwat/CWAThreat.java b/edexOsgi/com.raytheon.uf.edex.plugin.cwat/src/com/raytheon/uf/edex/plugin/cwat/CWAThreat.java index cbb4ce4df5..d8038c7110 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.cwat/src/com/raytheon/uf/edex/plugin/cwat/CWAThreat.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.cwat/src/com/raytheon/uf/edex/plugin/cwat/CWAThreat.java @@ -31,7 +31,7 @@ import org.opengis.referencing.datum.PixelInCell; import org.opengis.referencing.operation.TransformException; import com.raytheon.uf.common.dataplugin.binlightning.BinLightningRecord; -import com.raytheon.uf.common.dataplugin.grib.GribRecord; +import com.raytheon.uf.common.dataplugin.grid.GridRecord; import com.raytheon.uf.common.dataplugin.radar.RadarRecord; import com.raytheon.uf.common.dataplugin.radar.util.RadarConstants; import com.raytheon.uf.common.dataplugin.radar.util.RadarConstants.MapValues; @@ -1074,7 +1074,7 @@ public class CWAThreat { * @param rec * @return */ - private Coordinate getGridCoordinate(Coordinate coor, GribRecord rec) { + private Coordinate getGridCoordinate(Coordinate coor, GridRecord rec) { Coordinate latLonCoor = null; ReferencedCoordinate rcoor = new ReferencedCoordinate(coor, diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.cwat/src/com/raytheon/uf/edex/plugin/cwat/common/CWATConfig.java b/edexOsgi/com.raytheon.uf.edex.plugin.cwat/src/com/raytheon/uf/edex/plugin/cwat/common/CWATConfig.java index 972b802e62..b93edcfbfd 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.cwat/src/com/raytheon/uf/edex/plugin/cwat/common/CWATConfig.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.cwat/src/com/raytheon/uf/edex/plugin/cwat/common/CWATConfig.java @@ -29,7 +29,7 @@ import org.opengis.referencing.crs.ProjectedCRS; import com.raytheon.edex.urifilter.URIGenerateMessage; import com.raytheon.uf.common.dataplugin.PluginException; import com.raytheon.uf.common.dataplugin.binlightning.BinLightningRecord; -import com.raytheon.uf.common.dataplugin.grib.GribRecord; +import com.raytheon.uf.common.dataplugin.grid.GridRecord; import com.raytheon.uf.common.dataplugin.radar.RadarRecord; import com.raytheon.uf.common.dataplugin.radar.RadarStation; import com.raytheon.uf.common.dataplugin.radar.util.RadarConstants.GraphicBlockValues; @@ -123,13 +123,13 @@ public class CWATConfig { public static final int dimensions = 2; /** wind speed u 700 mb **/ - public GribRecord u700 = null; + public GridRecord u700 = null; /** wind speed v 700 mb **/ - public GribRecord v700 = null; + public GridRecord v700 = null; /** U wind at 500 mb **/ - public GribRecord u500 = null; + public GridRecord u500 = null; public VerticalSounding vs = null; @@ -462,23 +462,23 @@ public class CWATConfig { } } - public GribRecord getU700() { + public GridRecord getU700() { return u700; } - public GribRecord getV700() { + public GridRecord getV700() { return v700; } - public void setU700(GribRecord u700) { + public void setU700(GridRecord u700) { this.u700 = u700; } - public void setV700(GribRecord v700) { + public void setV700(GridRecord v700) { this.v700 = v700; } - public GribRecord getU500() { + public GridRecord getU500() { return u500; } @@ -563,15 +563,15 @@ public class CWATConfig { // check back for a couple hours int interval = 1440; - u700 = DATUtils.getMostRecentGribRecord(interval, + u700 = DATUtils.getMostRecentGridRecord(interval, U700Product.getSQL(interval, U700Product.U700), param700U); - v700 = DATUtils.getMostRecentGribRecord(interval, + v700 = DATUtils.getMostRecentGridRecord(interval, V700Product.getSQL(interval, V700Product.V700), param700V); - u500 = DATUtils.getMostRecentGribRecord(interval, + u500 = DATUtils.getMostRecentGridRecord(interval, U500Product.getSQL(interval, U500Product.U500), param500U); diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/META-INF/MANIFEST.MF index f27183143d..969a862327 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/META-INF/MANIFEST.MF @@ -5,14 +5,10 @@ Bundle-SymbolicName: com.raytheon.uf.edex.plugin.ffmp Bundle-Version: 1.12.1174.qualifier Bundle-Vendor: RAYTHEON Eclipse-RegisterBuddy: com.raytheon.edex.common, com.raytheon.uf.common.serialization, com.raytheon.uf.viz.core -Require-Bundle: org.eclipse.ui, - org.eclipse.core.runtime, - com.raytheon.uf.edex.cpgsrv;bundle-version="1.11.7";resolution:=optional, +Require-Bundle: com.raytheon.uf.edex.cpgsrv;bundle-version="1.11.7";resolution:=optional, com.raytheon.edex.common;bundle-version="1.11.7", com.raytheon.uf.common.monitor;bundle-version="1.11.7", - org.geotools;bundle-version="2.5.2", org.apache.commons.logging;bundle-version="1.0.4", - com.raytheon.uf.common.dataplugin.qpf;bundle-version="1.11.9", com.raytheon.uf.common.mpe;bundle-version="1.0.0", com.raytheon.uf.common.hydro;bundle-version="1.11.11", com.raytheon.uf.common.localization;bundle-version="1.11.26", @@ -21,12 +17,8 @@ Require-Bundle: org.eclipse.ui, com.raytheon.edex.plugin.radar;bundle-version="1.12.1174", com.raytheon.uf.common.dataplugin.radar;bundle-version="1.0.0", com.raytheon.uf.common.cache;bundle-version="1.12.1174" -Import-Package: com.raytheon.edex.plugin.grib, - com.raytheon.uf.common.dataplugin.grib, - com.raytheon.uf.common.dataplugin.scan.data, - com.raytheon.uf.common.gridcoverage, +Import-Package: com.raytheon.uf.common.dataplugin.grid, com.raytheon.uf.common.ohd, - com.raytheon.uf.common.pointdata, com.raytheon.uf.common.status, com.raytheon.uf.edex.dat.utils;resolution:=optional, com.raytheon.uf.edex.plugin.scan.common diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/FFMPGenerator.java b/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/FFMPGenerator.java index bd2084624c..9f49448262 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/FFMPGenerator.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/FFMPGenerator.java @@ -31,6 +31,7 @@ import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executor; import java.util.regex.Pattern; @@ -168,7 +169,7 @@ public class FFMPGenerator extends CompositeProductGenerator implements /** checks for initial load **/ public ArrayList loadedData = new ArrayList(); - + /** thread the productkeys **/ public ConcurrentHashMap> productKeys = new ConcurrentHashMap>(); @@ -678,20 +679,20 @@ public class FFMPGenerator extends CompositeProductGenerator implements sites.add(siteKey); } - + int i = 0; if (sites != null) { // set the latch keys ArrayList lsites = new ArrayList(); - for (String site: sites) { + for (String site : sites) { lsites.add(site); } - + productKeys.put(ffmpProduct.getSourceName(), lsites); } - + for (String productKey : sites) { - + FFMPRecord ffmpRec = new FFMPRecord(); ffmpRec.setSourceName(ffmpProduct.getSourceName()); ffmpRec.setDataKey(dataKey); @@ -704,7 +705,7 @@ public class FFMPGenerator extends CompositeProductGenerator implements ffmpRec.constructDataURI(); if (ffmpRec != null) { - + if (ffmp.isFFTI()) { fftiDone = false; if (!fftiSources.contains(ffmp.getFFTISource())) { @@ -712,22 +713,25 @@ public class FFMPGenerator extends CompositeProductGenerator implements generator, ffmpRec, ffmp.getFFTISource()); fftiSources.add(ffmp.getFFTISource()); - //System.out.println("Adding source to FFTISources!!!!!!!!!!!!"+ffmpRec.getSourceName()); + // System.out.println("Adding source to FFTISources!!!!!!!!!!!!"+ffmpRec.getSourceName()); ffti.processFFTI(); } } // this is a threaded process!!!!!!!!!!! - // Added this to speed the processing of mosaiced sources. - // Before all processing was in line to the source thread. + // Added this to speed the processing of mosaiced + // sources. + // Before all processing was in line to the source + // thread. // This caused slowness in the overall processing. // By allowing the mosaic components to be concurrently - // processed it has drastically sped up overall FFMP performance. + // processed it has drastically sped up overall FFMP + // performance. processDataContainer(ffmpRec, productKey); ffmpRecords.add(ffmpRec); } i++; } - + while (productKeys.size() > 0) { // wait for all threads to finish before returning try { @@ -1049,10 +1053,10 @@ public class FFMPGenerator extends CompositeProductGenerator implements for (String rfc : filter.getRFC()) { // get a hash of the sources and their grib ids - HashMap sources = FFMPUtils.getFFGModelInfo(rfc); + Set sources = FFMPUtils.getFFGParameters(rfc); if (sources != null) { if (sources.size() > 0) { - for (String source : sources.keySet()) { + for (String source : sources) { SourceXML sourceXml = getSourceConfig().getSource( source); @@ -1061,8 +1065,7 @@ public class FFMPGenerator extends CompositeProductGenerator implements String plugin = getSourceConfig().getSource(source) .getPlugin(); - uris.add(FFMPUtils.getFFGDataURI( - sources.get(source), plugin)); + uris.add(FFMPUtils.getFFGDataURI(source, plugin)); } } } @@ -1202,7 +1205,7 @@ public class FFMPGenerator extends CompositeProductGenerator implements filter.setValidTime(new Date(System.currentTimeMillis())); filter.reset(); } - + /** * Process this data container * @@ -1213,9 +1216,10 @@ public class FFMPGenerator extends CompositeProductGenerator implements */ public void processDataContainer(FFMPRecord ffmpRec, String productKey) { - this.getProcessExecutor().execute(new ProcessDataContainer(ffmpRec, productKey)); + this.getProcessExecutor().execute( + new ProcessDataContainer(ffmpRec, productKey)); } - + /** * Inner class to thread writing of BuddyFiles * @@ -1225,6 +1229,7 @@ public class FFMPGenerator extends CompositeProductGenerator implements private class ProcessDataContainer implements Runnable { private FFMPRecord ffmpRec; + private String productKey; public void run() { @@ -1254,7 +1259,7 @@ public class FFMPGenerator extends CompositeProductGenerator implements String sourceSiteDataKey = null; FFMPDataContainer fdc = null; boolean write = true; - + try { // write out the fast loader buddy file @@ -1278,7 +1283,7 @@ public class FFMPGenerator extends CompositeProductGenerator implements .getTime() - (3600 * 1000 * 6)); } - + // deal with setting of needed HUCS ArrayList hucs = template.getTemplateMgr() .getHucLevels(); @@ -1379,7 +1384,7 @@ public class FFMPGenerator extends CompositeProductGenerator implements SOURCE_TYPE.GUIDANCE.getSourceType())) { // only write last one write = false; - + if (!ffmpData.containsKey(sourceSiteDataKey)) { ffmpData.put(sourceSiteDataKey, fdc); } else { @@ -1397,13 +1402,15 @@ public class FFMPGenerator extends CompositeProductGenerator implements "Failed Processing FFMPDataContainer" + e.getMessage()); } finally { - // moved writing here to remain safe from possible race condition between processing threads + // moved writing here to remain safe from possible race + // condition between processing threads if (productKeys != null) { if (productKeys.containsKey(ffmpRec.getSourceName())) { - productKeys.get(ffmpRec.getSourceName()).remove(productKey); - //System.out.println("Removed productKey: "+productKey); + productKeys.get(ffmpRec.getSourceName()).remove( + productKey); + // System.out.println("Removed productKey: "+productKey); if (productKeys.get(ffmpRec.getSourceName()).size() == 0) { - //System.out.println("Removed source: "+ffmpRec.getSourceName()+" now writing"); + // System.out.println("Removed source: "+ffmpRec.getSourceName()+" now writing"); productKeys.remove(ffmpRec.getSourceName()); // last one, allow write write = true; @@ -1417,7 +1424,7 @@ public class FFMPGenerator extends CompositeProductGenerator implements backDate = new Date((System.currentTimeMillis()) - (3600 * 1000 * 6)); } - + fdc.purge(backDate); if (write) { @@ -1487,7 +1494,7 @@ public class FFMPGenerator extends CompositeProductGenerator implements * @param huc * @param wfo * @return - * @throws IOException + * @throws IOException */ private FFMPBasinData readLoaderBuddyFile(String sourceSiteDataKey, String huc, String wfo, Date backDate) throws IOException { @@ -1498,27 +1505,24 @@ public class FFMPGenerator extends CompositeProductGenerator implements BufferedInputStream is = null; try { - is = new BufferedInputStream( - new FileInputStream(file)); + is = new BufferedInputStream(new FileInputStream(file)); DynamicSerializationManager dsm = DynamicSerializationManager .getManager(SerializationType.Thrift); basinData = (FFMPBasinData) dsm.deserialize(is); } catch (SerializationException e) { - statusHandler.handle(Priority.ERROR, - "Serialization Error Reading buddy file: " - + e.getMessage()); + statusHandler + .handle(Priority.ERROR, + "Serialization Error Reading buddy file: " + + e.getMessage()); } catch (IOException e) { statusHandler.handle(Priority.ERROR, - "IO Error Reading buddy file: " - + e.getMessage()); + "IO Error Reading buddy file: " + e.getMessage()); } catch (Exception e) { statusHandler.handle(Priority.ERROR, - "General Error Reading buddy file: " - + e.getMessage()); + "General Error Reading buddy file: " + e.getMessage()); } catch (Throwable t) { statusHandler.handle(Priority.ERROR, - "Bogus Thrift Error Reading buddy file: " - + t.getMessage()); + "Bogus Thrift Error Reading buddy file: " + t.getMessage()); } finally { if (is != null) { is.close(); @@ -1876,8 +1880,8 @@ public class FFMPGenerator extends CompositeProductGenerator implements statusHandler.handle(Priority.ERROR, "Unable to locate file " + f.getName(), fnfe); } catch (SerializationException se) { - statusHandler.handle(Priority.ERROR, - "Unable to serialize file " + f.getName(), se); + statusHandler.handle(Priority.ERROR, "Unable to serialize file " + + f.getName(), se); } catch (IOException ioe) { statusHandler.handle(Priority.ERROR, "IO problem reading file " + f.getName(), ioe); @@ -1926,7 +1930,7 @@ public class FFMPGenerator extends CompositeProductGenerator implements public ConcurrentHashMap getFFTIDataContainer() { return fftiData; } - + /** * the executor runner * diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/common/FFMPConfig.java b/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/common/FFMPConfig.java index 3ad6076b9a..4be04071ce 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/common/FFMPConfig.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/common/FFMPConfig.java @@ -27,7 +27,7 @@ import java.util.Map; import java.util.TimeZone; import com.raytheon.uf.common.dataplugin.PluginException; -import com.raytheon.uf.common.dataplugin.grib.GribRecord; +import com.raytheon.uf.common.dataplugin.grid.GridRecord; import com.raytheon.uf.common.datastorage.records.FloatDataRecord; import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager; import com.raytheon.uf.common.monitor.config.FFMPTemplateConfigurationManager; @@ -152,7 +152,7 @@ public class FFMPConfig { * @param dataUri * @return */ - public float[] getGribData(GribRecord rec) { + public float[] getGribData(GridRecord rec) { return ((FloatDataRecord) rec.getMessageData()).getFloatData(); } @@ -258,10 +258,10 @@ public class FFMPConfig { * * @return */ - public GribRecord getGrib(String uri) { - GribRecord rec = null; + public GridRecord getGrib(String uri) { + GridRecord rec = null; try { - rec = DATUtils.getGribRecord(uri); + rec = DATUtils.getGridRecord(uri); } catch (PluginException e) { e.printStackTrace(); } diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/common/FFMPProcessor.java b/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/common/FFMPProcessor.java index 40cfaeaa4b..2a53947149 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/common/FFMPProcessor.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/common/FFMPProcessor.java @@ -47,7 +47,7 @@ import com.raytheon.uf.common.dataplugin.ffmp.FFMPVirtualGageBasinMetaData; import com.raytheon.uf.common.dataplugin.ffmp.SourceBin; import com.raytheon.uf.common.dataplugin.ffmp.SourceBinEntry; import com.raytheon.uf.common.dataplugin.ffmp.SourceBinList; -import com.raytheon.uf.common.dataplugin.grib.GribRecord; +import com.raytheon.uf.common.dataplugin.grid.GridRecord; import com.raytheon.uf.common.dataplugin.radar.RadarRecord; import com.raytheon.uf.common.dataplugin.radar.util.RadarConstants.DHRValues; import com.raytheon.uf.common.dataplugin.radar.util.RadarDataInterrogator; @@ -123,7 +123,7 @@ public class FFMPProcessor { private FFMPRecord ffmpRec = null; - private GribRecord gribRec = null; + private GridRecord gribRec = null; private float[] gribData = null; @@ -303,7 +303,7 @@ public class FFMPProcessor { recdate = imp.getDataTime().getRefTime(); } else if (type == FFMPSourceConfigurationManager.DATA_TYPE.GRID) { - gribRec = (GribRecord) config.getSourceData( + gribRec = (GridRecord) config.getSourceData( source.getSourceName()).get(dataKey); gribData = config.getGribData(gribRec); recdate = gribRec.getDataTime().getRefTime(); @@ -521,7 +521,7 @@ public class FFMPProcessor { try { - gribRec = (GribRecord) config.getSourceData(source.getSourceName()) + gribRec = (GridRecord) config.getSourceData(source.getSourceName()) .get(dataKey); setGridGeometry(gribRec); gribData = config.getGribData(gribRec); @@ -1364,7 +1364,7 @@ public class FFMPProcessor { /** * Sets up the gridgeometry for FFG */ - public void setGridGeometry(GribRecord rec) { + public void setGridGeometry(GridRecord rec) { ffgNx = rec.getSpatialObject().getNx(); ffgNy = rec.getSpatialObject().getNy(); ffgGeometry = MapUtil.getGridGeometry(rec.getSpatialObject()); diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.qpf/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.plugin.qpf/META-INF/MANIFEST.MF index a8fc6ddddd..f3a7c2645c 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.qpf/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.edex.plugin.qpf/META-INF/MANIFEST.MF @@ -9,22 +9,16 @@ Require-Bundle: com.raytheon.uf.common.monitor;bundle-version="1.0.0", com.raytheon.edex.common;bundle-version="1.11.1", org.apache.commons.logging;bundle-version="1.0.4", com.raytheon.uf.edex.cpgsrv;bundle-version="1.11.1";resolution:=optional, - org.geotools;bundle-version="2.5.2", com.raytheon.uf.common.dataplugin.qpf, - com.raytheon.uf.common.geospatial;bundle-version="1.0.0", com.raytheon.uf.common.dataplugin.binlightning;bundle-version="1.0.0", com.raytheon.uf.common.monitor.cpg;bundle-version="1.0.0", - org.geotools;bundle-version="2.5.2", com.raytheon.uf.common.status;bundle-version="1.12.1152", - com.raytheon.uf.common.dataplugin.level, com.raytheon.uf.common.dataplugin.radar;bundle-version="1.0.0", com.raytheon.uf.common.dataplugin.scan;bundle-version="1.12.1174", com.raytheon.uf.edex.dat.utils;bundle-version="1.12.1174", com.raytheon.uf.edex.plugin.scan;bundle-version="1.12.1174" -Import-Package: com.raytheon.edex.plugin.grib.dao, - com.raytheon.uf.common.dataplugin.grib, - com.raytheon.uf.edex.plugin.scan.common, - javax.measure.unit +Import-Package: com.raytheon.uf.common.dataplugin.grid, + com.raytheon.uf.edex.plugin.scan.common Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy Export-Package: com.raytheon.uf.edex.plugin.qpf, diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.qpf/src/com/raytheon/uf/edex/plugin/qpf/common/QPFConfig.java b/edexOsgi/com.raytheon.uf.edex.plugin.qpf/src/com/raytheon/uf/edex/plugin/qpf/common/QPFConfig.java index 13adfcd0a9..08f76976b7 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.qpf/src/com/raytheon/uf/edex/plugin/qpf/common/QPFConfig.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.qpf/src/com/raytheon/uf/edex/plugin/qpf/common/QPFConfig.java @@ -29,7 +29,7 @@ import java.util.TimeZone; import com.raytheon.edex.urifilter.URIFilter; import com.raytheon.uf.common.dataplugin.binlightning.BinLightningRecord; -import com.raytheon.uf.common.dataplugin.grib.GribRecord; +import com.raytheon.uf.common.dataplugin.grid.GridRecord; import com.raytheon.uf.common.dataplugin.qpf.QPFUtils; import com.raytheon.uf.common.dataplugin.radar.RadarRecord; import com.raytheon.uf.common.dataplugin.radar.RadarStation; @@ -541,10 +541,10 @@ public class QPFConfig { int interval = 1440; - GribRecord modelURec = DATUtils.getMostRecentGribRecord(interval, + GridRecord modelURec = DATUtils.getMostRecentGridRecord(interval, U700Product.getSQL(interval, U700Product.U700), paramXMLU); - GribRecord modelVRec = DATUtils.getMostRecentGribRecord(interval, + GridRecord modelVRec = DATUtils.getMostRecentGridRecord(interval, V700Product.getSQL(interval, V700Product.V700), paramXMLV); if (modelURec != null && modelVRec != null) { diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.scan/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.plugin.scan/META-INF/MANIFEST.MF index 4cfca35953..8b6ba6eafc 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.scan/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.edex.plugin.scan/META-INF/MANIFEST.MF @@ -6,31 +6,21 @@ Bundle-Version: 1.12.1174.qualifier Bundle-Vendor: RAYTHEON Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Eclipse-RegisterBuddy: com.raytheon.edex.common, com.raytheon.uf.common.serialization, com.raytheon.uf.viz.core -Require-Bundle: com.raytheon.uf.common.dataplugin;bundle-version="1.11.26", - com.raytheon.uf.common.dataplugin.binlightning;bundle-version="1.11.26", - com.raytheon.uf.common.dataplugin.bufrua;bundle-version="1.11.26", +Require-Bundle: com.raytheon.uf.common.dataplugin.binlightning;bundle-version="1.11.26", com.raytheon.uf.common.dataplugin.scan;bundle-version="1.11.26", - org.geotools;bundle-version="2.5.8", - com.raytheon.uf.common.geospatial;bundle-version="1.11.26", com.raytheon.uf.common.monitor;bundle-version="1.11.26", com.raytheon.uf.common.monitor.cpg;bundle-version="1.0.0", com.raytheon.uf.edex.cpgsrv;bundle-version="1.11.1";resolution:=optional, - com.raytheon.uf.common.time;bundle-version="1.11.26", - com.raytheon.uf.common.dataplugin.grib;bundle-version="1.11.26", + com.raytheon.uf.common.dataplugin.grid, com.raytheon.edex.common;bundle-version="1.11.26", org.apache.commons.logging, com.raytheon.uf.common.status, - com.raytheon.edex.plugin.grib;bundle-version="1.11.26", com.raytheon.uf.common.dataplugin.level;bundle-version="1.11.31", - com.raytheon.uf.edex.plugin.ffmp;bundle-version="1.11.31", com.raytheon.uf.common.sounding;bundle-version="1.12.1112", - com.raytheon.uf.common.dataplugin.radar;bundle-version="1.0.0", - com.raytheon.edex.plugin.radar;bundle-version="1.12.1174" + com.raytheon.uf.common.dataplugin.radar;bundle-version="1.0.0" Export-Package: com.raytheon.uf.edex.plugin.scan, com.raytheon.uf.edex.plugin.scan.process Import-Package: com.raytheon.uf.common.localization, - com.raytheon.uf.common.menus, - com.raytheon.uf.common.menus.xml, com.raytheon.uf.edex.dat.utils, com.raytheon.uf.edex.plugin.scan.common, javax.measure.converter, diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.scan/res/spring/scan-common.xml b/edexOsgi/com.raytheon.uf.edex.plugin.scan/res/spring/scan-common.xml index 98c9f456cd..affa790ef3 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.scan/res/spring/scan-common.xml +++ b/edexOsgi/com.raytheon.uf.edex.plugin.scan/res/spring/scan-common.xml @@ -18,7 +18,7 @@ + depends-on="radarRegistered,bufruaRegistered,gridRegistered"> diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/ScanURIFilter.java b/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/ScanURIFilter.java index 3be6735acb..cfe48c426e 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/ScanURIFilter.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/ScanURIFilter.java @@ -36,7 +36,7 @@ import com.raytheon.edex.urifilter.URIFilter; import com.raytheon.edex.urifilter.URIGenerateMessage; import com.raytheon.uf.common.dataplugin.PluginException; import com.raytheon.uf.common.dataplugin.binlightning.BinLightningRecord; -import com.raytheon.uf.common.dataplugin.grib.GribRecord; +import com.raytheon.uf.common.dataplugin.grid.GridRecord; import com.raytheon.uf.common.dataplugin.radar.RadarRecord; import com.raytheon.uf.common.dataplugin.scan.data.CellTableData; import com.raytheon.uf.common.dataplugin.scan.data.DMDTableData; @@ -506,7 +506,7 @@ public class ScanURIFilter extends URIFilter { if ((message != null) && (message.getDataURIs().length > 0)) { for (String dataUri : message.getDataURIs()) { // check for the needed data types - if (dataUri.startsWith("/grib") || dataUri.startsWith("/radar") + if (dataUri.startsWith("/grid") || dataUri.startsWith("/radar") || dataUri.startsWith("/binlightning") || dataUri.startsWith("/bufrua")) { // add your pattern checks to the key @@ -763,13 +763,13 @@ public class ScanURIFilter extends URIFilter { * @return * @throws Exception */ - private GribRecord getRecordGrib(String guri) throws Exception { + private GridRecord getRecordGrib(String guri) throws Exception { - GribRecord grib = null; + GridRecord grib = null; try { if (!guri.isEmpty()) { - grib = DATUtils.getGribRecord(guri); + grib = DATUtils.getGridRecord(guri); } } catch (Exception e) { @@ -827,13 +827,13 @@ public class ScanURIFilter extends URIFilter { /** * Set Grib Record in Model Data */ - public void setGribRecord(String prodType, String guri) { + public void setGridRecord(String prodType, String guri) { String modelName = site.getModelParameter(prodType).getModelName(); try { scan.getCache().getModelData() - .setGribRecord(modelName, prodType, getRecordGrib(guri)); + .setGridRecord(modelName, prodType, getRecordGrib(guri)); } catch (Exception e) { logger.debug("Grib record setter failed....."); } @@ -842,13 +842,13 @@ public class ScanURIFilter extends URIFilter { /** * Set Grib Record in Model Data */ - public void setGribRecord(String prodType, GribRecord rec) { + public void setGridRecord(String prodType, GridRecord rec) { String modelName = site.getModelParameter(prodType).getModelName(); try { scan.getCache().getModelData() - .setGribRecord(modelName, prodType, rec); + .setGridRecord(modelName, prodType, rec); } catch (Exception e) { logger.debug("Grib record setter failed....."); } @@ -866,50 +866,50 @@ public class ScanURIFilter extends URIFilter { /** * Set Grib Record in Model Data */ - public void setGribRecords() { + public void setGridRecords() { try { - GribRecord[] records = { null, null, null, null, null, null, null, + GridRecord[] records = { null, null, null, null, null, null, null, null }; - records = getGribRecords(); + records = getGridRecords(); scan.getCache() .getModelData() - .setGribRecord( + .setGridRecord( site.getModelParameter(CAPEProduct.cape) .getModelName(), CAPEProduct.cape, records[0]); scan.getCache() .getModelData() - .setGribRecord( + .setGridRecord( site.getModelParameter(HELIProduct.heli) .getModelName(), HELIProduct.heli, records[1]); scan.getCache() .getModelData() - .setGribRecord( + .setGridRecord( site.getModelParameter(U500Product.U500) .getModelName(), U500Product.U500, records[2]); scan.getCache() .getModelData() - .setGribRecord( + .setGridRecord( site.getModelParameter(U700Product.U700) .getModelName(), U700Product.U700, records[3]); scan.getCache() .getModelData() - .setGribRecord( + .setGridRecord( site.getModelParameter(V700Product.V700) .getModelName(), V700Product.V700, records[4]); scan.getCache() .getModelData() - .setGribRecord( + .setGridRecord( site.getModelParameter(GH500Product.GH500) .getModelName(), GH500Product.GH500, records[5]); scan.getCache() .getModelData() - .setGribRecord( + .setGridRecord( site.getModelParameter(GH1000Product.GH1000) .getModelName(), GH1000Product.GH1000, records[6]); @@ -921,12 +921,12 @@ public class ScanURIFilter extends URIFilter { /** * Get Grib Record from Model Data */ - public GribRecord getGribRecord(String prodType) { - GribRecord rec = null; + public GridRecord getGridRecord(String prodType) { + GridRecord rec = null; String modelName = site.getModelParameter(prodType).getModelName(); try { rec = scan.getCache().getModelData() - .getGribRecord(modelName, prodType); + .getGridRecord(modelName, prodType); } catch (Exception e) { logger.debug("No Grib Data available....."); } @@ -1022,7 +1022,7 @@ public class ScanURIFilter extends URIFilter { * to retrieve the data from a database. */ public void init() { - setGribRecords(); + setGridRecords(); setSoundingRecord(ScanProduct.UA, ""); } @@ -1101,25 +1101,25 @@ public class ScanURIFilter extends URIFilter { * * @return */ - public GribRecord[] getGribRecords() throws PluginException { + public GridRecord[] getGridRecords() throws PluginException { - GribRecord[] records = { null, null, null, null, null, null, null, null }; + GridRecord[] records = { null, null, null, null, null, null, null, null }; try { String[] modelUris = getModelSQL(); // CAPE - records[0] = DATUtils.getGribRecord(modelUris[0]); + records[0] = DATUtils.getGridRecord(modelUris[0]); // HELI - records[1] = DATUtils.getGribRecord(modelUris[1]); + records[1] = DATUtils.getGridRecord(modelUris[1]); // U500 - records[2] = DATUtils.getGribRecord(modelUris[2]); + records[2] = DATUtils.getGridRecord(modelUris[2]); // U700 - records[3] = DATUtils.getGribRecord(modelUris[3]); + records[3] = DATUtils.getGridRecord(modelUris[3]); // V700 - records[4] = DATUtils.getGribRecord(modelUris[4]); + records[4] = DATUtils.getGridRecord(modelUris[4]); // GH500 - records[5] = DATUtils.getGribRecord(modelUris[5]); + records[5] = DATUtils.getGridRecord(modelUris[5]); // GH1000 - records[6] = DATUtils.getGribRecord(modelUris[6]); + records[6] = DATUtils.getGridRecord(modelUris[6]); } catch (Exception e) { logger.error("No Grib record(s) found....."); } diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/CAPEProduct.java b/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/CAPEProduct.java index 85e23f7d1e..47810616ea 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/CAPEProduct.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/CAPEProduct.java @@ -22,7 +22,7 @@ package com.raytheon.uf.edex.plugin.scan.process; import java.util.regex.Pattern; import com.raytheon.uf.common.dataplugin.PluginException; -import com.raytheon.uf.common.dataplugin.grib.GribRecord; +import com.raytheon.uf.common.dataplugin.grid.GridRecord; import com.raytheon.uf.common.dataplugin.level.Level; import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject; import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject; @@ -31,7 +31,7 @@ import com.raytheon.uf.common.monitor.config.SCANRunSiteConfigurationManager; import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables; import com.raytheon.uf.edex.plugin.scan.ScanURIFilter; -public class CAPEProduct extends ScanProduct { +public class CAPEProduct extends GridProduct { /** * @@ -59,10 +59,10 @@ public class CAPEProduct extends ScanProduct { @Override public PersistablePluginDataObject getRecord() throws PluginException, Exception { - GribRecord grib = null; + GridRecord grib = null; try { - filter.setGribRecord(CAPEProduct.cape, uri); - grib = filter.getGribRecord(CAPEProduct.cape); + filter.setGridRecord(CAPEProduct.cape, uri); + grib = filter.getGridRecord(CAPEProduct.cape); } catch (Exception e) { e.printStackTrace(); } @@ -72,20 +72,20 @@ public class CAPEProduct extends ScanProduct { @Override public void process() throws Exception { - GribRecord rec = null; + GridRecord rec = null; try { - rec = (GribRecord) getRecord(); + rec = (GridRecord) getRecord(); } catch (Exception pe) { pe.printStackTrace(); } if (rec != null) { - filter.setGribRecord(cape, rec); + filter.setGridRecord(cape, rec); } } @Override public void setDataType() { - this.dataType = GRIB; + this.dataType = GRID; } @@ -108,11 +108,8 @@ public class CAPEProduct extends ScanProduct { * @return */ public static Pattern getPattern(String model) { - return Pattern.compile(uriSeparator + GRIB + uriSeparator + wildCard - + uriSeparator + model + uriSeparator + cape + uriSeparator - + "SFC" + uriSeparator + "0.0" + uriSeparator - + Level.getInvalidLevelValueAsString() + uriSeparator + "null" - + uriSeparator + "null" + uriSeparator + "0"); + return getGridPattern(model, cape, "SFC", "0.0", + Level.getInvalidLevelValueAsString()); } /** @@ -122,16 +119,7 @@ public class CAPEProduct extends ScanProduct { * @return */ public static String getSQL(int interval, String model) { - return "select datauri from grib where modelinfo_id = (select id from grib_models where parameterabbreviation = \'" - + "CAPE" - + "\' and modelname = \'" - + model - + "\' and level_id = (select id from level where masterlevel_name = 'SFC' and levelonevalue = '0.0' and leveltwovalue = " - + "\'" - + Level.getInvalidLevelValueAsString() - + "\'" - + ")) and reftime > (now()- interval \'" - + interval - + " minutes\') order by forecasttime desc limit 1"; + return getGridSQL(interval, model, cape, "SFC", "0.0", + Level.getInvalidLevelValueAsString()); } } diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/GH1000Product.java b/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/GH1000Product.java index a687682681..4d7ad4a5cc 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/GH1000Product.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/GH1000Product.java @@ -22,7 +22,7 @@ package com.raytheon.uf.edex.plugin.scan.process; import java.util.regex.Pattern; import com.raytheon.uf.common.dataplugin.PluginException; -import com.raytheon.uf.common.dataplugin.grib.GribRecord; +import com.raytheon.uf.common.dataplugin.grid.GridRecord; import com.raytheon.uf.common.dataplugin.level.Level; import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject; import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject; @@ -47,7 +47,7 @@ import com.raytheon.uf.edex.plugin.scan.ScanURIFilter; * @version 1.0 */ -public class GH1000Product extends ScanProduct { +public class GH1000Product extends GridProduct { private static final long serialVersionUID = 1L; @@ -72,12 +72,12 @@ public class GH1000Product extends ScanProduct { @Override public PersistablePluginDataObject getRecord() throws PluginException, Exception { - GribRecord grib = null; + GridRecord grib = null; try { - filter.setGribRecord(GH1000, uri); + filter.setGridRecord(GH1000, uri); // statusHandler.handle(Priority.INFO, "MATCHED " + GH1000 // + " MODEL URI: " + uri); - grib = filter.getGribRecord(GH1000); + grib = filter.getGridRecord(GH1000); } catch (Exception e) { e.printStackTrace(); } @@ -87,20 +87,20 @@ public class GH1000Product extends ScanProduct { @Override public void process() throws Exception { - GribRecord rec = null; + GridRecord rec = null; try { - rec = (GribRecord) getRecord(); + rec = (GridRecord) getRecord(); } catch (Exception pe) { pe.printStackTrace(); } if (rec != null) { - filter.setGribRecord(GH1000, rec); + filter.setGridRecord(GH1000, rec); } } @Override public void setDataType() { - this.dataType = GRIB; + this.dataType = GRID; } @@ -129,11 +129,8 @@ public class GH1000Product extends ScanProduct { * @return */ public static Pattern getPattern(String model) { - return Pattern.compile("^" + uriSeparator + GRIB + uriSeparator - + wildCard + uriSeparator + model + uriSeparator + "GH" - + uriSeparator + "MB" + uriSeparator + "1000.0" + uriSeparator - + Level.getInvalidLevelValueAsString() + uriSeparator + "null" - + uriSeparator + "null" + uriSeparator + "0"); + return getGridPattern(model, "GH", "MB", "1000.0", + Level.getInvalidLevelValueAsString()); } /** @@ -142,17 +139,8 @@ public class GH1000Product extends ScanProduct { * @return */ public static String getSQL(int interval, String model) { - return "select datauri from grib where modelinfo_id = (select id from grib_models where parameterabbreviation = \'" - + "GH" - + "\' and modelname = \'" - + model - + "\' and level_id = (select id from level where masterlevel_name = 'MB' and levelonevalue = '1000.0' and leveltwovalue = " - + "\'" - + Level.getInvalidLevelValueAsString() - + "\'" - + ")) and reftime > (now()- interval \'" - + interval - + " minutes\') order by forecasttime desc" + " limit 1"; + return getGridSQL(interval, model, "GH", "MB", "1000.0", + Level.getInvalidLevelValueAsString()); } } diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/GH500Product.java b/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/GH500Product.java index 6e7660855b..ac41d746db 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/GH500Product.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/GH500Product.java @@ -22,7 +22,7 @@ package com.raytheon.uf.edex.plugin.scan.process; import java.util.regex.Pattern; import com.raytheon.uf.common.dataplugin.PluginException; -import com.raytheon.uf.common.dataplugin.grib.GribRecord; +import com.raytheon.uf.common.dataplugin.grid.GridRecord; import com.raytheon.uf.common.dataplugin.level.Level; import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject; import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject; @@ -47,7 +47,7 @@ import com.raytheon.uf.edex.plugin.scan.ScanURIFilter; * @version 1.0 */ -public class GH500Product extends ScanProduct { +public class GH500Product extends GridProduct { private static final long serialVersionUID = 1L; @@ -72,12 +72,12 @@ public class GH500Product extends ScanProduct { @Override public PersistablePluginDataObject getRecord() throws PluginException, Exception { - GribRecord grib = null; + GridRecord grib = null; try { - filter.setGribRecord(GH500, uri); + filter.setGridRecord(GH500, uri); // statusHandler.handle(Priority.INFO, "MATCHED " + GH500 // + " MODEL URI: " + uri); - grib = filter.getGribRecord(GH500); + grib = filter.getGridRecord(GH500); } catch (Exception e) { e.printStackTrace(); } @@ -87,20 +87,20 @@ public class GH500Product extends ScanProduct { @Override public void process() throws Exception { - GribRecord rec = null; + GridRecord rec = null; try { - rec = (GribRecord) getRecord(); + rec = (GridRecord) getRecord(); } catch (Exception pe) { pe.printStackTrace(); } if (rec != null) { - filter.setGribRecord(GH500, rec); + filter.setGridRecord(GH500, rec); } } @Override public void setDataType() { - this.dataType = GRIB; + this.dataType = GRID; } @@ -129,11 +129,8 @@ public class GH500Product extends ScanProduct { * @return */ public static Pattern getPattern(String model) { - return Pattern.compile("^" + uriSeparator + GRIB + uriSeparator - + wildCard + uriSeparator + model + uriSeparator + "GH" - + uriSeparator + "MB" + uriSeparator + "500.0" + uriSeparator - + Level.getInvalidLevelValueAsString() + uriSeparator + "null" - + uriSeparator + "null" + uriSeparator + "0"); + return getGridPattern(model, "GH", "MB", "500.0", + Level.getInvalidLevelValueAsString()); } /** @@ -142,17 +139,8 @@ public class GH500Product extends ScanProduct { * @return */ public static String getSQL(int interval, String model) { - return "select datauri from grib where modelinfo_id = (select id from grib_models where parameterabbreviation = \'" - + "GH" - + "\' and modelname = \'" - + model - + "\' and level_id = (select id from level where masterlevel_name = 'MB' and levelonevalue = '500.0' and leveltwovalue = " - + "\'" - + Level.getInvalidLevelValueAsString() - + "\'" - + ")) and reftime > (now()- interval \'" - + interval - + " minutes\') order by forecasttime desc" + " limit 1"; + return getGridSQL(interval, model, "GH", "MB", "500.0", + Level.getInvalidLevelValueAsString()); } } diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/GridProduct.java b/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/GridProduct.java new file mode 100644 index 0000000000..f6416befcc --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/GridProduct.java @@ -0,0 +1,124 @@ +/** + * 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.edex.plugin.scan.process; + +import java.util.regex.Pattern; + +import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables; +import com.raytheon.uf.edex.plugin.scan.ScanURIFilter; + +/** + * + * TODO Add Description + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Mar 2, 2012            bsteffen     Initial creation
+ * 
+ * 
+ * + * @author bsteffen + * @version 1.0 + */ +public abstract class GridProduct extends ScanProduct { + + private static final long serialVersionUID = 1L; + + public static String GRID = "grid"; + + public GridProduct(String uri, ScanTables tableType, ScanURIFilter filter) { + super(uri, tableType, filter); + } + + protected static Pattern getGridPattern(String dataset, String parameter, + String levelName, String levelOne, String levelTwo) { + // Format = + // /pluginName/time/datasetId/secondaryId/locationName/parameterAbbr/levelName/levelOne/levelTwo/perturbation + StringBuilder pattern = new StringBuilder("^"); + // pluginName + pattern.append(uriSeparator); + pattern.append(GRID); + // dataTime + pattern.append(uriSeparator); + pattern.append(wildCard); + // datasetId + pattern.append(uriSeparator); + pattern.append(dataset); + // secondaryId + pattern.append(uriSeparator); + pattern.append(".*"); + // locationName + pattern.append(uriSeparator); + pattern.append(".*"); + // parameterAbbr + pattern.append(uriSeparator); + pattern.append(parameter); + // levelName + pattern.append(uriSeparator); + pattern.append(levelName); + // levelOne + pattern.append(uriSeparator); + pattern.append(levelOne); + // levelTwo + pattern.append(uriSeparator); + pattern.append(levelTwo); + // perturbation + pattern.append(uriSeparator); + pattern.append("null"); + return Pattern.compile(pattern.toString()); + + } + + /** + * The SQL for MODEL 500 thickness + * + * @return + */ + public static String getGridSQL(int interval, String dataset, + String parameter, String levelName, String levelOne, String levelTwo) { + StringBuilder sql = new StringBuilder( + "select grid.datauri from grid, grid_info, level where"); + sql.append(" grid.info_id = grid_info.id"); + sql.append(" and"); + // datasetId + sql.append(" grid_info.datasetId = \'" + dataset + "\'"); + sql.append(" and"); + // parameterAbbreviation + sql.append(" grid_info.parameter_abbreviation = \'" + parameter + "\'"); + sql.append(" and"); + // level + sql.append(" level.id = grid_info.level_id"); + sql.append(" and"); + sql.append(" level.masterlevel_name = \'" + levelName + "\'"); + sql.append(" and"); + sql.append(" level.levelonevalue = \'" + levelOne + "\'"); + sql.append(" and"); + sql.append(" level.leveltwovalue = \'" + levelTwo + "\'"); + // interval + sql.append("and reftime > (now()- interval \'" + interval + + " minutes\')"); + sql.append(" order by forecasttime desc" + " limit 1"); + return sql.toString(); + } +} diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/HELIProduct.java b/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/HELIProduct.java index 35a955ffe2..d321836cc4 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/HELIProduct.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/HELIProduct.java @@ -22,7 +22,7 @@ package com.raytheon.uf.edex.plugin.scan.process; import java.util.regex.Pattern; import com.raytheon.uf.common.dataplugin.PluginException; -import com.raytheon.uf.common.dataplugin.grib.GribRecord; +import com.raytheon.uf.common.dataplugin.grid.GridRecord; import com.raytheon.uf.common.dataplugin.level.Level; import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject; import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject; @@ -47,7 +47,7 @@ import com.raytheon.uf.edex.plugin.scan.ScanURIFilter; * @version 1.0 */ -public class HELIProduct extends ScanProduct { +public class HELIProduct extends GridProduct { /** * */ @@ -74,12 +74,12 @@ public class HELIProduct extends ScanProduct { @Override public PersistablePluginDataObject getRecord() throws PluginException, Exception { - GribRecord grib = null; + GridRecord grib = null; try { - filter.setGribRecord(HELIProduct.heli, uri); + filter.setGridRecord(HELIProduct.heli, uri); // statusHandler.handle(Priority.INFO, "MATCHED " + heli // + " MODEL URI: " + uri); - grib = filter.getGribRecord(HELIProduct.heli); + grib = filter.getGridRecord(HELIProduct.heli); } catch (Exception e) { e.printStackTrace(); } @@ -89,20 +89,20 @@ public class HELIProduct extends ScanProduct { @Override public void process() throws Exception { - GribRecord rec = null; + GridRecord rec = null; try { - rec = (GribRecord) getRecord(); + rec = (GridRecord) getRecord(); } catch (Exception pe) { pe.printStackTrace(); } if (rec != null) { - filter.setGribRecord(heli, rec); + filter.setGridRecord(heli, rec); } } @Override public void setDataType() { - this.dataType = GRIB; + this.dataType = GRID; } @@ -125,11 +125,8 @@ public class HELIProduct extends ScanProduct { * @return */ public static Pattern getPattern(String model) { - return Pattern.compile("^" + uriSeparator + GRIB + uriSeparator - + wildCard + uriSeparator + model + uriSeparator + "Heli" - + uriSeparator + "SFC" + uriSeparator + "0.0" + uriSeparator - + Level.getInvalidLevelValueAsString() + uriSeparator + "null" - + uriSeparator + "null" + uriSeparator + "0"); + return getGridPattern(model, "Heli", "SFC", "0.0", + Level.getInvalidLevelValueAsString()); } /** @@ -139,16 +136,7 @@ public class HELIProduct extends ScanProduct { * @return */ public static String getSQL(int interval, String model) { - return "select datauri from grib where modelinfo_id = (select id from grib_models where parameterabbreviation = \'" - + "Heli" - + "\' and modelname = \'" - + model - + "\' and level_id = (select id from level where masterlevel_name = 'SFC' and levelonevalue = '0.0' and leveltwovalue = " - + "\'" - + Level.getInvalidLevelValueAsString() - + "\'" - + ")) and reftime > (now()- interval \'" - + interval - + " minutes\') order by forecasttime desc limit 1"; + return getGridSQL(interval, model, "Heli", "SFC", "0.0", + Level.getInvalidLevelValueAsString()); } } diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/ScanProduct.java b/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/ScanProduct.java index 3b3c1cb93d..10e5aeea04 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/ScanProduct.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/ScanProduct.java @@ -27,11 +27,10 @@ import java.util.List; import org.geotools.referencing.GeodeticCalculator; -import com.raytheon.edex.plugin.grib.dao.GribDao; import com.raytheon.uf.common.dataplugin.PluginException; import com.raytheon.uf.common.dataplugin.binlightning.BinLightningRecord; import com.raytheon.uf.common.dataplugin.binlightning.impl.LtgStrikeType; -import com.raytheon.uf.common.dataplugin.grib.GribRecord; +import com.raytheon.uf.common.dataplugin.grid.GridRecord; import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject; import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject; import com.raytheon.uf.common.dataplugin.radar.RadarRecord; @@ -50,6 +49,7 @@ import com.raytheon.uf.common.monitor.scan.ScanUtils; import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; +import com.raytheon.uf.edex.database.plugin.PluginDao; import com.raytheon.uf.edex.database.plugin.PluginFactory; import com.raytheon.uf.edex.plugin.scan.ScanURIFilter; import com.vividsolutions.jts.geom.Coordinate; @@ -93,8 +93,6 @@ public abstract class ScanProduct implements Serializable { public static String BINLIGHTNING = "binlightning"; - public static String GRIB = "grib"; - public static String UA = "bufrua"; public static GeometryFactory factory = new GeometryFactory(); @@ -252,12 +250,12 @@ public abstract class ScanProduct implements Serializable { * @param uri * @return */ - public static GribRecord getGribRecord(String uri) throws PluginException { + public static GridRecord getGridRecord(String uri) throws PluginException { - GribRecord gr = new GribRecord(uri); - GribDao gd = (GribDao) PluginFactory.getInstance().getPluginDao( + GridRecord gr = new GridRecord(uri); + PluginDao gd = PluginFactory.getInstance().getPluginDao( gr.getPluginName()); - gr = (GribRecord) gd.getMetadata(uri); + gr = (GridRecord) gd.getMetadata(uri); IDataStore dataStore = gd.getDataStore(gr); try { @@ -283,8 +281,7 @@ public abstract class ScanProduct implements Serializable { * @param table */ public static void processLightning(ScanURIFilter filter, - RadarRecord radarRecord, - Date startTime, Date stopTime, + RadarRecord radarRecord, Date startTime, Date stopTime, ScanTableData table) { if (table.getTableData().size() > 0) { @@ -308,9 +305,9 @@ public abstract class ScanProduct implements Serializable { for (BinLightningRecord rec : recs) { for (int i = 0; i < rec.getLatitudes().length; i++) { // check the time first - long obsTime = rec.getObsTimes()[i]; - if (obsTime >= startTime.getTime() && - obsTime < stopTime.getTime()) { + long obsTime = rec.getObsTimes()[i]; + if (obsTime >= startTime.getTime() + && obsTime < stopTime.getTime()) { Coordinate strikeCoor = new Coordinate( rec.getLongitudes()[i], rec.getLatitudes()[i], 0.0); diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/U500Product.java b/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/U500Product.java index 991bb7121c..64249d530e 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/U500Product.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/U500Product.java @@ -22,7 +22,7 @@ package com.raytheon.uf.edex.plugin.scan.process; import java.util.regex.Pattern; import com.raytheon.uf.common.dataplugin.PluginException; -import com.raytheon.uf.common.dataplugin.grib.GribRecord; +import com.raytheon.uf.common.dataplugin.grid.GridRecord; import com.raytheon.uf.common.dataplugin.level.Level; import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject; import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject; @@ -47,7 +47,7 @@ import com.raytheon.uf.edex.plugin.scan.ScanURIFilter; * @version 1.0 */ -public class U500Product extends ScanProduct { +public class U500Product extends GridProduct { private static final long serialVersionUID = 1L; @@ -72,12 +72,12 @@ public class U500Product extends ScanProduct { @Override public PersistablePluginDataObject getRecord() throws PluginException, Exception { - GribRecord grib = null; + GridRecord grib = null; try { - filter.setGribRecord(U500, uri); + filter.setGridRecord(U500, uri); // statusHandler.handle(Priority.INFO, "MATCHED " + U500 // + " MODEL URI: " + uri); - grib = filter.getGribRecord(U500); + grib = filter.getGridRecord(U500); } catch (Exception e) { e.printStackTrace(); } @@ -87,20 +87,20 @@ public class U500Product extends ScanProduct { @Override public void process() throws Exception { - GribRecord rec = null; + GridRecord rec = null; try { - rec = (GribRecord) getRecord(); + rec = (GridRecord) getRecord(); } catch (Exception pe) { pe.printStackTrace(); } if (rec != null) { - filter.setGribRecord(U500, rec); + filter.setGridRecord(U500, rec); } } @Override public void setDataType() { - this.dataType = GRIB; + this.dataType = GRID; } @@ -129,11 +129,8 @@ public class U500Product extends ScanProduct { * @return */ public static Pattern getPattern(String model) { - return Pattern.compile("^" + uriSeparator + GRIB + uriSeparator - + wildCard + uriSeparator + model + uriSeparator + "uW" - + uriSeparator + "MB" + uriSeparator + "500.0" + uriSeparator - + Level.getInvalidLevelValueAsString() + uriSeparator + "null" - + uriSeparator + "null" + uriSeparator + "0"); + return getGridPattern(model, "uW", "MB", "500.0", + Level.getInvalidLevelValueAsString()); } /** @@ -143,17 +140,8 @@ public class U500Product extends ScanProduct { * @return */ public static String getSQL(int interval, String model) { - return "select datauri from grib where modelinfo_id = (select id from grib_models where parameterabbreviation = \'" - + "uW" - + "\' and modelname = \'" - + model - + "\' and level_id = (select id from level where masterlevel_name = 'MB' and levelonevalue = '500.0' and leveltwovalue = " - + "\'" - + Level.getInvalidLevelValueAsString() - + "\'" - + ")) and reftime > (now()- interval \'" - + interval - + " minutes\') order by forecasttime desc" + " limit 1"; + return getGridSQL(interval, model, "uW", "MB", "500.0", + Level.getInvalidLevelValueAsString()); } } diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/U700Product.java b/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/U700Product.java index 2503735634..ef2cb01b6e 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/U700Product.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/U700Product.java @@ -22,7 +22,7 @@ package com.raytheon.uf.edex.plugin.scan.process; import java.util.regex.Pattern; import com.raytheon.uf.common.dataplugin.PluginException; -import com.raytheon.uf.common.dataplugin.grib.GribRecord; +import com.raytheon.uf.common.dataplugin.grid.GridRecord; import com.raytheon.uf.common.dataplugin.level.Level; import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject; import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject; @@ -47,7 +47,7 @@ import com.raytheon.uf.edex.plugin.scan.ScanURIFilter; * @version 1.0 */ -public class U700Product extends ScanProduct { +public class U700Product extends GridProduct { private static final long serialVersionUID = 1L; @@ -72,12 +72,12 @@ public class U700Product extends ScanProduct { @Override public PersistablePluginDataObject getRecord() throws PluginException, Exception { - GribRecord grib = null; + GridRecord grib = null; try { - filter.setGribRecord(U700, uri); + filter.setGridRecord(U700, uri); // statusHandler.handle(Priority.INFO, "MATCHED " + U700 // + " MODEL URI: " + uri); - grib = filter.getGribRecord(U700); + grib = filter.getGridRecord(U700); } catch (Exception e) { e.printStackTrace(); } @@ -87,20 +87,20 @@ public class U700Product extends ScanProduct { @Override public void process() throws Exception { - GribRecord rec = null; + GridRecord rec = null; try { - rec = (GribRecord) getRecord(); + rec = (GridRecord) getRecord(); } catch (Exception pe) { pe.printStackTrace(); } if (rec != null) { - filter.setGribRecord(U700, rec); + filter.setGridRecord(U700, rec); } } @Override public void setDataType() { - this.dataType = GRIB; + this.dataType = GRID; } @@ -129,11 +129,8 @@ public class U700Product extends ScanProduct { * @return */ public static Pattern getPattern(String model) { - return Pattern.compile("^" + uriSeparator + GRIB + uriSeparator - + wildCard + uriSeparator + model + uriSeparator + "uW" - + uriSeparator + "MB" + uriSeparator + "700.0" + uriSeparator - + Level.getInvalidLevelValueAsString() + uriSeparator + "null" - + uriSeparator + "null" + uriSeparator + "0"); + return getGridPattern(model, "uW", "MB", "700.0", + Level.getInvalidLevelValueAsString()); } /** @@ -142,17 +139,8 @@ public class U700Product extends ScanProduct { * @return */ public static String getSQL(int interval, String model) { - return "select datauri from grib where modelinfo_id = (select id from grib_models where parameterabbreviation = \'" - + "uW" - + "\' and modelname = \'" - + model - + "\' and level_id = (select id from level where masterlevel_name = 'MB' and levelonevalue = '700.0' and leveltwovalue = " - + "\'" - + Level.getInvalidLevelValueAsString() - + "\'" - + ")) and reftime > (now()- interval \'" - + interval - + " minutes\') order by forecasttime desc" + " limit 1"; + return getGridSQL(interval, model, "uW", "MB", "700.0", + Level.getInvalidLevelValueAsString()); } } diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/V700Product.java b/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/V700Product.java index 268dcb1714..6ac5e2709a 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/V700Product.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.scan/src/com/raytheon/uf/edex/plugin/scan/process/V700Product.java @@ -22,7 +22,7 @@ package com.raytheon.uf.edex.plugin.scan.process; import java.util.regex.Pattern; import com.raytheon.uf.common.dataplugin.PluginException; -import com.raytheon.uf.common.dataplugin.grib.GribRecord; +import com.raytheon.uf.common.dataplugin.grid.GridRecord; import com.raytheon.uf.common.dataplugin.level.Level; import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject; import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject; @@ -47,7 +47,7 @@ import com.raytheon.uf.edex.plugin.scan.ScanURIFilter; * @version 1.0 */ -public class V700Product extends ScanProduct { +public class V700Product extends GridProduct { private static final long serialVersionUID = 1L; @@ -72,12 +72,12 @@ public class V700Product extends ScanProduct { @Override public PersistablePluginDataObject getRecord() throws PluginException, Exception { - GribRecord grib = null; + GridRecord grib = null; try { - filter.setGribRecord(V700, uri); + filter.setGridRecord(V700, uri); // statusHandler.handle(Priority.INFO, "MATCHED " + V700 // + " MODEL URI: " + uri); - grib = filter.getGribRecord(V700); + grib = filter.getGridRecord(V700); } catch (Exception e) { e.printStackTrace(); } @@ -87,20 +87,20 @@ public class V700Product extends ScanProduct { @Override public void process() throws Exception { - GribRecord rec = null; + GridRecord rec = null; try { - rec = (GribRecord) getRecord(); + rec = (GridRecord) getRecord(); } catch (Exception pe) { pe.printStackTrace(); } if (rec != null) { - filter.setGribRecord(V700, rec); + filter.setGridRecord(V700, rec); } } @Override public void setDataType() { - this.dataType = GRIB; + this.dataType = GRID; } @@ -129,11 +129,8 @@ public class V700Product extends ScanProduct { * @return */ public static Pattern getPattern(String model) { - return Pattern.compile("^" + uriSeparator + GRIB + uriSeparator - + wildCard + uriSeparator + model + uriSeparator + "vW" - + uriSeparator + "MB" + uriSeparator + "700.0" + uriSeparator - + Level.getInvalidLevelValueAsString() + uriSeparator + "null" - + uriSeparator + "null" + uriSeparator + "0"); + return getGridPattern(model, "vW", "MB", "700.0", + Level.getInvalidLevelValueAsString()); } /** @@ -143,17 +140,8 @@ public class V700Product extends ScanProduct { * @return */ public static String getSQL(int interval, String model) { - return "select datauri from grib where modelinfo_id = (select id from grib_models where parameterabbreviation = \'" - + "vW" - + "\' and modelname = \'" - + model - + "\' and level_id = (select id from level where masterlevel_name = 'MB' and levelonevalue = '700.0' and leveltwovalue = " - + "\'" - + Level.getInvalidLevelValueAsString() - + "\'" - + ")) and reftime > (now()- interval \'" - + interval - + " minutes\') order by forecasttime desc" + " limit 1"; + return getGridSQL(interval, model, "vW", "MB", "700.0", + Level.getInvalidLevelValueAsString()); } } diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.vil/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.plugin.vil/META-INF/MANIFEST.MF index 1a964e3e30..ca2692fb21 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.vil/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.edex.plugin.vil/META-INF/MANIFEST.MF @@ -9,16 +9,11 @@ Require-Bundle: com.raytheon.uf.common.monitor;bundle-version="1.0.0", com.raytheon.edex.common;bundle-version="1.11.1", org.apache.commons.logging;bundle-version="1.0.4", com.raytheon.uf.edex.cpgsrv;bundle-version="1.11.1";resolution:=optional, - org.geotools;bundle-version="2.5.2", com.raytheon.uf.common.dataplugin.vil, - com.raytheon.uf.common.geospatial;bundle-version="1.0.0", com.raytheon.uf.common.monitor.cpg;bundle-version="1.0.0", com.raytheon.uf.common.status;bundle-version="1.12.1152", com.raytheon.uf.common.dataplugin.radar;bundle-version="1.0.0" -Import-Package: com.raytheon.edex.plugin.grib.dao, - com.raytheon.uf.common.dataplugin.grib, - com.raytheon.uf.edex.plugin.scan.common, - javax.measure.unit +Import-Package: com.raytheon.uf.edex.plugin.scan.common Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy Export-Package: com.raytheon.uf.edex.plugin.vil,