From 394d54bf0aeac88fc68832048658e5cc29856be2 Mon Sep 17 00:00:00 2001 From: Slav Korolev Date: Wed, 1 Oct 2014 16:45:33 -0400 Subject: [PATCH 01/11] Issue #3659 - Enabled to display HFR-EAST_6KM or HFR-WEST_6KM data as a Time Series Former-commit-id: bc95211ea0d0a940c91608f33789665b7c739e93 [formerly 5aa180c0cc8a14c8c5f7578058856cdee8aef2ae] [formerly 05a7f534bfdca3b61f9917022a5918fadfc2eab1] [formerly 05a7f534bfdca3b61f9917022a5918fadfc2eab1 [formerly f7bcb8101017a562781a2a9d2a594e59777c2362]] [formerly ad4bae10c95cf535864ba0a84dd28470e4bb68ad [formerly 05a7f534bfdca3b61f9917022a5918fadfc2eab1 [formerly f7bcb8101017a562781a2a9d2a594e59777c2362] [formerly ad4bae10c95cf535864ba0a84dd28470e4bb68ad [formerly 2a03c64bb098a141c82aac4bab42d7d9f4a6296f]]]] Former-commit-id: ad4bae10c95cf535864ba0a84dd28470e4bb68ad Former-commit-id: dc545a5beb55a816a870a7f57af3cdae00b6df8f [formerly 4099421dd0042e01b8c5c609db7d9dffd96bd658] [formerly c00a8eb707c5930eee0bc2fa902b3abbb71fdb26 [formerly 8fddad1cd176d3bbb29f90e34df1bd49b8c1a1ae]] Former-commit-id: c00a8eb707c5930eee0bc2fa902b3abbb71fdb26 Former-commit-id: 784a84a7d18bf08bd52f3b77e8571c0e796ef461 --- .../localization/volumebrowser/VbSources.xml | 50 ++++++++++++------- ...HFR-EAST1_6KM.xml => gridHFR-EAST_6KM.xml} | 2 +- ...-EAST2_6KM.xml => gridHFR-EAST_PR_6KM.xml} | 4 +- ...EST2_6KM.xml => gridHFR-US_HAWAII_6KM.xml} | 4 +- ...HFR-WEST1_6KM.xml => gridHFR-WEST_6KM.xml} | 2 +- .../base/grib/models/gribModels_HFR-9.xml | 12 ++--- .../base/grib/thinnedModels/UkmetHR-NH.xml | 2 +- 7 files changed, 46 insertions(+), 30 deletions(-) rename edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/{gridHFR-EAST1_6KM.xml => gridHFR-EAST_6KM.xml} (97%) rename edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/{gridHFR-EAST2_6KM.xml => gridHFR-EAST_PR_6KM.xml} (90%) rename edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/{gridHFR-WEST2_6KM.xml => gridHFR-US_HAWAII_6KM.xml} (90%) rename edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/{gridHFR-WEST1_6KM.xml => gridHFR-WEST_6KM.xml} (97%) diff --git a/cave/com.raytheon.viz.volumebrowser/localization/volumebrowser/VbSources.xml b/cave/com.raytheon.viz.volumebrowser/localization/volumebrowser/VbSources.xml index 55c62ca255..9728dfb130 100644 --- a/cave/com.raytheon.viz.volumebrowser/localization/volumebrowser/VbSources.xml +++ b/cave/com.raytheon.viz.volumebrowser/localization/volumebrowser/VbSources.xml @@ -36,6 +36,8 @@ + - - + + + @@ -71,7 +77,7 @@ - + @@ -100,12 +106,13 @@ - + - - + + - - + + + subCategory="Column" + views="CROSSSECTION TIMEHEIGHT VARVSHGT SOUNDING TIMESERIES" /> + subCategory="Column" + views="CROSSSECTION TIMEHEIGHT VARVSHGT SOUNDING TIMESERIES" /> + subCategory="Column" + views="CROSSSECTION TIMEHEIGHT VARVSHGT SOUNDING TIMESERIES" /> + subCategory="Column" + views="CROSSSECTION TIMEHEIGHT VARVSHGT SOUNDING TIMESERIES" /> + subCategory="Column" + views="CROSSSECTION TIMEHEIGHT VARVSHGT SOUNDING TIMESERIES" /> - + - \ No newline at end of file diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-EAST1_6KM.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-EAST_6KM.xml similarity index 97% rename from edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-EAST1_6KM.xml rename to edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-EAST_6KM.xml index b8be73e955..9da255684d 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-EAST1_6KM.xml +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-EAST_6KM.xml @@ -19,7 +19,7 @@ further_licensing_information. --> - gridHFR-EAST1_6KM + gridHFR-EAST_6KM High Frequency Radar (EAST_6KM) total vector velocity (TVV) Lon/Lat Resolution diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-EAST2_6KM.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-EAST_PR_6KM.xml similarity index 90% rename from edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-EAST2_6KM.xml rename to edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-EAST_PR_6KM.xml index 5ca706b6ad..54243ffc14 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-EAST2_6KM.xml +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-EAST_PR_6KM.xml @@ -19,8 +19,8 @@ further_licensing_information. --> - gridHFR-EAST2_6KM - High Frequency Radar (EAST_6KM) total vector velocity (TVV) + gridHFR-EAST_PR_6KM + High Frequency Radar (PUERTO RICO_6KM) total vector velocity (TVV) Lon/Lat Resolution 14.5 diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-WEST2_6KM.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_HAWAII_6KM.xml similarity index 90% rename from edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-WEST2_6KM.xml rename to edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_HAWAII_6KM.xml index f3b54b6923..3f9dda70d4 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-WEST2_6KM.xml +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-US_HAWAII_6KM.xml @@ -19,8 +19,8 @@ further_licensing_information. --> - gridHFR-WEST2_6KM - High Frequency Radar (WEST_6KM) total vector velocity (TVV) + gridHFR-US_HAWAII_6KM + High Frequency Radar (US_WEST_HAWAII_6KM) total vector velocity (TVV) Lon/Lat Resolution 16.2204 diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-WEST1_6KM.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-WEST_6KM.xml similarity index 97% rename from edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-WEST1_6KM.xml rename to edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-WEST_6KM.xml index d3625d69ad..1fafaa7c9a 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-WEST1_6KM.xml +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/gridHFR-WEST_6KM.xml @@ -19,7 +19,7 @@ further_licensing_information. --> - gridHFR-WEST1_6KM + gridHFR-WEST_6KM High Frequency Radar (WEST_6KM) total vector velocity (TVV) Lon/Lat Resolution diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/models/gribModels_HFR-9.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/models/gribModels_HFR-9.xml index e3083aca2e..df942c5d73 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/models/gribModels_HFR-9.xml +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/models/gribModels_HFR-9.xml @@ -138,17 +138,17 @@ HFR-EAST_6KM
9
0 - gridHFR-EAST1_6KM + gridHFR-EAST_6KM 255 - HFR-EAST_6KM + HFR-EAST_PR_6KM
9
0 - gridHFR-EAST2_6KM + gridHFR-EAST_PR_6KM 255 @@ -168,17 +168,17 @@ HFR-WEST_6KM
9
0 - gridHFR-WEST1_6KM + gridHFR-WEST_6KM 255
- HFR-WEST_6KM + HFR-US_HAWAII_6KM
9
0 - gridHFR-WEST2_6KM + gridHFR-US_HAWAII_6KM 255 diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/thinnedModels/UkmetHR-NH.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/thinnedModels/UkmetHR-NH.xml index 5325335d6b..964db69089 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/thinnedModels/UkmetHR-NH.xml +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/thinnedModels/UkmetHR-NH.xml @@ -1,4 +1,4 @@ - + + + + ${edex.home}/logs/edex-${edex.run.mode}-activeTableChange-%d{yyyyMMdd}.log + 30 + + + + %-5p %d [%t] %c{0}: %m%n + + + + + + + + + + + diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/config/GFESiteActivation.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/config/GFESiteActivation.java index 0f6e90ccdc..e1b7d363aa 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/config/GFESiteActivation.java +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/config/GFESiteActivation.java @@ -73,6 +73,7 @@ import com.raytheon.uf.edex.site.notify.SendSiteActivationNotifications; * May 02, 2013 #1969 randerso Moved updateDbs method into IFPGridDatabase * Jun 13, 2013 #2044 randerso Refactored to use IFPServer * Oct 16, 2013 #2475 dgilling Better error handling for IRT activation. + * Oct 07, 2014 #3684 randerso Restructured IFPServer start up * * * @author njensen @@ -297,7 +298,7 @@ public class GFESiteActivation implements ISiteActivationListener { statusHandler.info("IFPServerConfigManager initializing..."); config = IFPServerConfigManager.initializeSite(siteID); statusHandler.info("Activating IFPServer..."); - IFPServer ifpServer = IFPServer.activateServer(siteID, config); + IFPServer.activateServer(siteID, config); } finally { statusHandler .handle(Priority.INFO, diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/GridParmManager.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/GridParmManager.java index 18a9ea5f9b..c0f39b727a 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/GridParmManager.java +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/GridParmManager.java @@ -39,6 +39,8 @@ import com.raytheon.edex.plugin.gfe.server.database.D2DSatDatabase; import com.raytheon.edex.plugin.gfe.server.database.GridDatabase; import com.raytheon.edex.plugin.gfe.server.database.IFPGridDatabase; import com.raytheon.edex.plugin.gfe.server.database.NetCDFDatabaseManager; +import com.raytheon.edex.plugin.gfe.server.database.TopoDatabase; +import com.raytheon.edex.plugin.gfe.server.database.TopoDatabaseManager; import com.raytheon.edex.plugin.gfe.server.database.VGridDatabase; import com.raytheon.edex.plugin.gfe.server.lock.LockManager; import com.raytheon.edex.plugin.gfe.smartinit.SmartInitQueue; @@ -124,6 +126,9 @@ import com.raytheon.uf.edex.database.purge.PurgeLogger; * Cleaned up commented code. * 07/21/2014 #3415 randerso Fixed d2dGridDataPurged to not purge NetCDF databases. * 09/21/2014 #3648 randerso Changed to do version purging when new databases are added + * 10/07/2014 #3684 randerso Restructured IFPServer start up. + * Reordered handling of DbInvChangeNotification + * Don't process GFENotifications sent by this JVM * * * @author bphillip @@ -155,6 +160,8 @@ public class GridParmManager { private LockManager lockMgr; + private TopoDatabaseManager topoMgr; + private Map dbMap = new ConcurrentHashMap(); /** @@ -162,18 +169,16 @@ public class GridParmManager { * * @param siteID * @param config - * @param lockMgr * @throws PluginException * @throws DataAccessLayerException * @throws GfeException */ - public GridParmManager(String siteID, IFPServerConfig config, - LockManager lockMgr) throws PluginException, - DataAccessLayerException, GfeException { + public GridParmManager(String siteID, IFPServerConfig config) + throws PluginException, DataAccessLayerException, GfeException { this.siteID = siteID; this.config = config; - this.lockMgr = lockMgr; - this.lockMgr.setGridParmMgr(this); + this.lockMgr = new LockManager(siteID, config, this); + this.topoMgr = new TopoDatabaseManager(siteID, config); initializeManager(); } @@ -185,6 +190,20 @@ public class GridParmManager { NetCDFDatabaseManager.removeDatabases(siteID); } + /** + * @return the lockMgr + */ + public LockManager getLockMgr() { + return lockMgr; + } + + /** + * @return the topoMgr + */ + public TopoDatabaseManager getTopoMgr() { + return topoMgr; + } + private GridParm gridParm(ParmID id) { GridDatabase db = getDatabase(id.getDbId()); if (db != null) { @@ -1102,6 +1121,13 @@ public class GridParmManager { private void initializeManager() throws GfeException, DataAccessLayerException, PluginException { + + // add the topo database + TopoDatabase topoDb = topoMgr.getTopoDatabase(); + if (topoDb != null) { + this.addDB(topoDb); + } + // get existing list (of just GRIDs) GFEDao gfeDao = new GFEDao(); List inventory = gfeDao.getDatabaseInventory(siteID); @@ -1146,7 +1172,9 @@ public class GridParmManager { boolean clearTime = false; try { for (DatabaseID dbId : this.dbMap.keySet()) { - if (dbId.getDbType().equals("D2D")) { + if (dbId.getDbType().equals("D2D") + && !config.initModels(dbId.getModelName()) + .isEmpty()) { statusHandler.info("Firing smartinit for: " + dbId); VGridDatabase db = (VGridDatabase) getDatabase(dbId); SortedSet validTimes = db.getValidTimes(); @@ -1169,7 +1197,7 @@ public class GridParmManager { } } - private void initD2DDbs() throws GfeException { + private void initD2DDbs() { for (String d2dModelName : config.getD2dModels()) { try { // get dbId to get desiredDbVersions (date doesn't matter) @@ -1181,7 +1209,7 @@ public class GridParmManager { d2dModelName, desiredVersions)) { dbId = D2DGridDatabase.getDbId(d2dModelName, refTime, config); - getDatabase(dbId, false); + getDatabase(dbId, true); } } catch (Exception e) { statusHandler.error("Error initializing D2D model: " @@ -1237,7 +1265,7 @@ public class GridParmManager { public void filterSatelliteRecords(List records) { DatabaseID dbId = D2DSatDatabase.getDbId(siteID); - D2DSatDatabase db = (D2DSatDatabase) getDatabase(dbId); + D2DSatDatabase db = (D2DSatDatabase) getDatabase(dbId, true); List guns = new LinkedList(); for (SatelliteRecord record : records) { @@ -1333,7 +1361,7 @@ public class GridParmManager { } else if (req.isDatabaseRequest()) { // get the parm list for this database - GridDatabase db = this.getDatabase(req.getDbId()); + GridDatabase db = this.getDatabase(req.getDbId(), true); if (db != null) { List parmList = db.getParmList().getPayload(); for (ParmID pid : parmList) { @@ -1399,30 +1427,33 @@ public class GridParmManager { * @param notif */ public void handleGfeNotification(GfeNotification notif) { - // TODO: add UUID or some other identifier (hostname/process id?) to - // notif so we can recognize - // and not process notifications sent by this GridParmManager instance + // Don't handle notifications sent by this JVM + if (notif.isLocal()) { + return; + } + if (notif instanceof DBInvChangeNotification) { DBInvChangeNotification invChanged = (DBInvChangeNotification) notif; + // handle additions first to try to get old out-of-synch versions + // are purged sooner + for (DatabaseID dbId : invChanged.getAdditions()) { + this.getDatabase(dbId, false); + } + for (DatabaseID dbId : invChanged.getDeletions()) { deallocateDb(dbId, false); } - - ServerResponse sr = new ServerResponse(); - for (DatabaseID dbId : invChanged.getAdditions()) { - this.getDatabase(dbId, false); - } - if (!sr.isOkay()) { - statusHandler.error("Error updating GridParmManager: " - + sr.message()); - } } else if (notif instanceof GridUpdateNotification) { - DatabaseID satDbId = D2DSatDatabase.getDbId(siteID); GridUpdateNotification gun = (GridUpdateNotification) notif; - if (gun.getParmId().getDbId().equals(satDbId)) { - D2DSatDatabase db = (D2DSatDatabase) this.dbMap.get(satDbId); - db.update(gun); + DatabaseID dbid = gun.getParmId().getDbId(); + + // get the database as an extra attempt to + // keep the IFPServers in sync + GridDatabase db = getDatabase(dbid, false); + + if (db instanceof D2DSatDatabase) { + ((D2DSatDatabase) db).update(gun); } } } @@ -1430,7 +1461,7 @@ public class GridParmManager { /** * @param db */ - public void addDB(GridDatabase db) { + private void addDB(GridDatabase db) { DatabaseID dbId = db.getDbId(); statusHandler.info("addDB called, adding " + dbId); this.dbMap.put(dbId, db); diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/IFPServer.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/IFPServer.java index f417b02a63..3239670d8b 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/IFPServer.java +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/IFPServer.java @@ -60,8 +60,9 @@ import com.raytheon.uf.edex.database.DataAccessLayerException; * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * May 30, 2013 2044 randerso Initial creation - * Nov 20, 2013 #2331 randerso Added getTopoData method + * May 30, 2013 #2044 randerso Initial creation + * Nov 20, 2013 #2331 randerso Added getTopoData method + * Oct 07, 2014 #3684 randerso Restructured IFPServer start up * * * @@ -191,26 +192,21 @@ public class IFPServer { return activeServers.get(siteID); } - String siteId; + private String siteId; - IFPServerConfig config; + private IFPServerConfig config; - GridParmManager gridParmMgr; - - LockManager lockMgr; - - TopoDatabaseManager topoMgr; // TODO do we need this? + private GridParmManager gridParmMgr; private IFPServer(String siteId, IFPServerConfig config) throws DataAccessLayerException, PluginException, GfeException { this.siteId = siteId; this.config = config; - this.lockMgr = new LockManager(siteId, config); - this.gridParmMgr = new GridParmManager(siteId, config, lockMgr); - this.topoMgr = new TopoDatabaseManager(siteId, config, gridParmMgr); statusHandler.info("MapManager initializing..."); new MapManager(config); + + this.gridParmMgr = new GridParmManager(siteId, config); } private void dispose() { @@ -258,14 +254,14 @@ public class IFPServer { * @return the lockMgr */ public LockManager getLockMgr() { - return lockMgr; + return this.gridParmMgr.getLockMgr(); } /** * @return the topoMgr */ public TopoDatabaseManager getTopoMgr() { - return topoMgr; + return this.gridParmMgr.getTopoMgr(); } /** @@ -317,8 +313,6 @@ public class IFPServer { */ public static void filterDataURINotifications( DataURINotificationMessage message) throws Exception { - // ITimer timer = TimeUtil.getTimer(); - // timer.start(); List gridRecords = new LinkedList(); List satRecords = new LinkedList(); @@ -332,26 +326,12 @@ public class IFPServer { for (IFPServer ifpServer : getActiveServers()) { if (!gridRecords.isEmpty()) { - // TODO: remove this info before check in - String msg = "Processing " + gridRecords.size() - + " grid DataURINotifications"; - statusHandler.info(msg); - ifpServer.getGridParmMgr().filterGridRecords(gridRecords); } if (!satRecords.isEmpty()) { - // TODO: remove this info before check in - String msg = "Processing " + satRecords.size() - + " satellite DataURINotifications"; - statusHandler.info(msg); - ifpServer.getGridParmMgr().filterSatelliteRecords(satRecords); } } - // timer.stop(); - // perfLog.logDuration( - // "GfeIngestNotificationFilter: processing DataURINotificationMessage", - // timer.getElapsedTime()); } /** @@ -362,7 +342,7 @@ public class IFPServer { * @return topo gridslice */ public ServerResponse getTopoData(GridLocation gloc) { - return this.topoMgr.getTopoData(gloc); + return getTopoMgr().getTopoData(gloc); } } diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/database/TopoDatabaseManager.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/database/TopoDatabaseManager.java index c4409b0789..bcd035cec2 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/database/TopoDatabaseManager.java +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/database/TopoDatabaseManager.java @@ -30,7 +30,6 @@ import javax.measure.unit.NonSI; import javax.measure.unit.SI; import com.raytheon.edex.plugin.gfe.config.IFPServerConfig; -import com.raytheon.edex.plugin.gfe.server.GridParmManager; import com.raytheon.uf.common.dataplugin.gfe.GridDataHistory; import com.raytheon.uf.common.dataplugin.gfe.GridDataHistory.OriginType; import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID; @@ -75,6 +74,7 @@ import com.raytheon.uf.common.topo.TopoQuery; * code cleanup * Nov 20, 2013 #2331 randerso Changed return type of getTopoData * Feb 11, 2014 #2788 randerso Set missing data points to 0 to match A1 + * Oct 07, 2014 #3684 randerso Restructured IFPServer start up * * * @@ -100,10 +100,8 @@ public class TopoDatabaseManager { * * @param siteID * @param config - * @param gridMgr */ - public TopoDatabaseManager(String siteID, IFPServerConfig config, - GridParmManager gridMgr) { + public TopoDatabaseManager(String siteID, IFPServerConfig config) { this.config = config; statusHandler.info("Topography Manager started for " + siteID); @@ -118,15 +116,20 @@ public class TopoDatabaseManager { // create the disk cache createDiskCache(gloc); - // Add the topo database. + statusHandler.info("Topography Manager ready for " + siteID); + } + + /** + * @return the topo database + */ + public TopoDatabase getTopoDatabase() { TopoDatabase tdb = new TopoDatabase(this.config, this); if (tdb.databaseIsValid()) { - gridMgr.addDB(tdb); + return tdb; } else { statusHandler.error("Invalid Topo database"); } - - statusHandler.info("Topography Manager ready for " + siteID); + return null; } /** diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/lock/LockManager.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/lock/LockManager.java index ce19cd4fda..2c02cb033d 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/lock/LockManager.java +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/lock/LockManager.java @@ -67,6 +67,7 @@ import com.raytheon.uf.edex.database.DataAccessLayerException; * fixed inefficiencies in querying/merging * 06/13/13 #2044 randerso Converted from singleton to instance per * site managed by IFPServer + * 10/07/2014 #3684 randerso Restructured IFPServer start up * * * @author bphillip @@ -91,21 +92,12 @@ public class LockManager { * * @param siteId * @param config - */ - public LockManager(String siteId, IFPServerConfig config) { - this.siteId = siteId; - this.config = config; - } - - /** - * Sets the GridParmManager instance to be used by this LockManager. - * - * Done post construction since GridParmManager and LockManager have - * references to each other - * * @param gridParmMgr */ - public void setGridParmMgr(GridParmManager gridParmMgr) { + public LockManager(String siteId, IFPServerConfig config, + GridParmManager gridParmMgr) { + this.siteId = siteId; + this.config = config; this.gridParmMgr = gridParmMgr; } diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/server/notify/GfeNotification.java b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/server/notify/GfeNotification.java index 46021c4981..362fde8d48 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/server/notify/GfeNotification.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/server/notify/GfeNotification.java @@ -26,21 +26,56 @@ import java.util.Map; import com.raytheon.uf.common.message.IMessage; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; +import com.raytheon.uf.common.util.SystemUtil; +/** + * Base class for GFE Notifications + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Oct 7, 2014   #3684     randerso    Added sourceId field
+ * 
+ * 
+ * + * @author randerso + * @version 1.0 + */ @DynamicSerialize public class GfeNotification implements IMessage { + private static final String localSourceID; + static { + String host = SystemUtil.getHostName(); + int pid = SystemUtil.getPid(); + localSourceID = host + ":" + pid; + } @DynamicSerializeElement protected String siteID; - public GfeNotification() { + @DynamicSerializeElement + protected String sourceID; + public GfeNotification() { + this.sourceID = localSourceID; } public GfeNotification(String siteId) { + this(); this.siteID = siteId; } + public String getSourceID() { + return sourceID; + } + + public void setSourceID(String sourceId) { + this.sourceID = sourceId; + } + public String getSiteID() { return siteID; } @@ -49,6 +84,15 @@ public class GfeNotification implements IMessage { this.siteID = siteID; } + /** + * + * + * @return + */ + public boolean isLocal() { + return localSourceID.equals(this.sourceID); + } + /* * (non-Javadoc) * diff --git a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/GfeNotification.py b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/GfeNotification.py index 7e75d961e5..40361214bb 100644 --- a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/GfeNotification.py +++ b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/notify/GfeNotification.py @@ -22,6 +22,7 @@ class GfeNotification: def __init__(self): self.siteID = None + self.sourceID = None def getSiteID(self): return self.siteID @@ -29,3 +30,9 @@ class GfeNotification: def setSiteID(self, siteID): self.siteID = siteID + + def getSourceID(self): + return self.sourceID + + def setSourceID(self, sourceID): + self.sourceID = sourceID From 7bef790747a4f45380407374d89b252f01b55a3e Mon Sep 17 00:00:00 2001 From: Ron Anderson Date: Wed, 8 Oct 2014 18:05:27 -0500 Subject: [PATCH 05/11] Issue #3684 Fix some issues found after #3684 with certain GFE configurations Change-Id: I92b45588d9d4fe9169708c07119767017426d468 Former-commit-id: c8133ac38f01d9a48df820b5401b3b2f851d9a3a [formerly 0463c1c7a266cbd9f43502ca9f8d4143f8d8de2f] [formerly 8225700629914cd234ab758b746e61a77e7d0139] [formerly 8225700629914cd234ab758b746e61a77e7d0139 [formerly 4a1a3aef82e1ce6900b7e213ca1cc59e2b27a83e]] [formerly a64a36d18267aded2aa40d64290add354ec8dfc4 [formerly 8225700629914cd234ab758b746e61a77e7d0139 [formerly 4a1a3aef82e1ce6900b7e213ca1cc59e2b27a83e] [formerly a64a36d18267aded2aa40d64290add354ec8dfc4 [formerly 6dc55b51414414aa416c9ad0c688d1d34ba08c17]]]] Former-commit-id: a64a36d18267aded2aa40d64290add354ec8dfc4 Former-commit-id: 775f837ccde4ca0857b312b9f32f6565fd2e1415 [formerly d950f26f985b56f69811d1aac22ecbc4772319dc] [formerly 99d72fd9626c7c94df2b64f6e7e0679710ba9462 [formerly 12c80fbe38925670c5b203ee7fc65d41169b679c]] Former-commit-id: 99d72fd9626c7c94df2b64f6e7e0679710ba9462 Former-commit-id: e89cfb128c82949b96e8837bee49c77a432be469 --- .../res/spring/gfe-common.xml | 17 ---- .../plugin/gfe/server/GridParmManager.java | 97 +++++++++++++------ .../server/notify/GfeNotificationFilter.java | 53 ---------- .../edex/plugin/gfe/smartinit/InitClient.java | 12 +-- .../plugin/gfe/util/SendNotifications.java | 12 ++- .../edex_static/base/smartinit/Init.py | 18 +++- .../dataplugin/gfe/db/objects/DatabaseID.java | 19 ++++ .../common/dataplugin/gfe/util/GfeUtil.java | 3 +- 8 files changed, 117 insertions(+), 114 deletions(-) delete mode 100644 edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/notify/GfeNotificationFilter.java diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/res/spring/gfe-common.xml b/edexOsgi/com.raytheon.edex.plugin.gfe/res/spring/gfe-common.xml index 3fc55ea83a..e9c6931aee 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/res/spring/gfe-common.xml +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/res/spring/gfe-common.xml @@ -31,27 +31,10 @@ depends-on="commonTimeRegistered, gfeRegistered"> - - - - - - - - - - - - java.lang.Throwable - - - - - diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/GridParmManager.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/GridParmManager.java index c0f39b727a..ef2b251a95 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/GridParmManager.java +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/GridParmManager.java @@ -129,6 +129,10 @@ import com.raytheon.uf.edex.database.purge.PurgeLogger; * 10/07/2014 #3684 randerso Restructured IFPServer start up. * Reordered handling of DbInvChangeNotification * Don't process GFENotifications sent by this JVM + * Prevent createDB from creating databases that are immediately purged + * Send DBInvChangeNotifications at site activation so new D2D data + * ingested while deactivated gets recognized + * * * * @author bphillip @@ -890,6 +894,10 @@ public class GridParmManager { if (notify) { createDbNotification(Arrays.asList(dbId), purged); } + // always notify on purges + else if (!purged.isEmpty()) { + createDbNotification(null, purged); + } } } @@ -913,7 +921,10 @@ public class GridParmManager { GridDatabase db = this.getDatabase(dbId); if (db != null) { + sr.setPayload(db); return sr; // database already exists + } else { + sr.addMessage("Unable to create database: " + dbId); } // is it a singleton database? @@ -1051,42 +1062,64 @@ public class GridParmManager { return sr; } - private ServerResponse createDB(DatabaseID id) { + private ServerResponse createDB(DatabaseID dbId) { // TODO: consider merging this into getDatabase() ServerResponse status = new ServerResponse(); - if (!id.isValid() || !id.getFormat().equals(DataType.GRID)) { + if (!dbId.isValid() || !dbId.getFormat().equals(DataType.GRID)) { status.addMessage("Database id " - + id + + dbId + " is not valid, or is not a grid-type. Cannot create database."); return status; } - // create the grid database + // get the dbConfig IFPGridDatabase db = null; - GridDbConfig dbConfig = this.config.gridDbConfig(id); + GridDbConfig dbConfig = this.config.gridDbConfig(dbId); if (dbConfig == null) { status.addMessage("Unable to obtain GridDbConfig information for creation" - + " in createDB() for " + id); + + " in createDB() for " + dbId); } else { + // don't create if this version would be immediately purgeable + List existing = new ArrayList(); + for (DatabaseID id : this.dbMap.keySet()) { + if (id.sameModel(dbId)) { + existing.add(id); + } + } + + if (!existing.contains(dbId)) { + existing.add(dbId); + } + + // sort by model time (most recent first) + Collections.sort(existing); + + int desiredVersions = this.config.desiredDbVersions(dbId); + if (existing.indexOf(dbId) >= desiredVersions) { + status.addMessage("Unable to create " + dbId + + " as it would exceed the desired number of versions"); + return status; + } + // attempt to create the GridDatabase - db = new IFPGridDatabase(id, dbConfig); + db = new IFPGridDatabase(dbId, dbConfig); if (db.databaseIsValid()) { // get databaseID object from database - DatabaseID dbId = db.getDbId(); + DatabaseID id = db.getDbId(); - if (dbId.getRemovedDate() != null) { + if (id.getRemovedDate() != null) { // mark database as not removed try { GFEDao gfeDao = new GFEDao(); - gfeDao.setDatabaseRemovedDate(dbId, null); - statusHandler.info("Database " + dbId + " restored"); + gfeDao.setDatabaseRemovedDate(id, null); + statusHandler.info("Database " + id + " restored"); } catch (Exception e) { statusHandler.handle(Priority.PROBLEM, - "Unable to mark database restored: " + dbId, e); + "Unable to mark database restored: " + id, e); } } } else { - status.addMessage("Database " + id + " is not valid."); + status.addMessage("Database " + dbId + " is not valid."); db = null; } } @@ -1095,12 +1128,13 @@ public class GridParmManager { // mark database as removed try { GFEDao gfeDao = new GFEDao(); - gfeDao.setDatabaseRemovedDate(id, new Date()); - statusHandler.warn("Database " + id + " marked for removal in " + gfeDao.setDatabaseRemovedDate(dbId, new Date()); + statusHandler.warn("Database " + dbId + + " marked for removal in " + GFEDao.REMOVED_DB_PURGE_TIME + " days."); } catch (Exception e) { statusHandler.handle(Priority.PROBLEM, - "Unable to mark database removed: " + id, e); + "Unable to mark database removed: " + dbId, e); } } @@ -1142,8 +1176,12 @@ public class GridParmManager { } // create the databases (the list should now only contain GRID dbs) + List added = new ArrayList(inventory.size()); for (DatabaseID dbId : inventory) { - getDatabase(dbId, false); + GridDatabase db = getDatabase(dbId, false); + if (db != null) { + added.add(db.getDbId()); + } } NetCDFDatabaseManager.initializeNetCDFDatabases(config); @@ -1156,7 +1194,8 @@ public class GridParmManager { D2DSatDatabase satDb = new D2DSatDatabase(config); addDB(satDb); - initD2DDbs(); + added.addAll(initD2DDbs()); + createDbNotification(added, null); // only fire smartInits if queue is instantiated SmartInitQueue queue = SmartInitQueue.getQueue(); @@ -1197,7 +1236,8 @@ public class GridParmManager { } } - private void initD2DDbs() { + private List initD2DDbs() { + List added = new ArrayList(); for (String d2dModelName : config.getD2dModels()) { try { // get dbId to get desiredDbVersions (date doesn't matter) @@ -1209,13 +1249,17 @@ public class GridParmManager { d2dModelName, desiredVersions)) { dbId = D2DGridDatabase.getDbId(d2dModelName, refTime, config); - getDatabase(dbId, true); + GridDatabase db = getDatabase(dbId, false); + if (db != null) { + added.add(db.getDbId()); + } } } catch (Exception e) { statusHandler.error("Error initializing D2D model: " + d2dModelName, e); } } + return (added); } /** @@ -1236,6 +1280,9 @@ public class GridParmManager { } D2DGridDatabase db = (D2DGridDatabase) getDatabase(dbId, true); + if (db == null) { + continue; + } GridUpdateNotification gun = db.update(record); if (gun != null) { @@ -1416,7 +1463,8 @@ public class GridParmManager { private void createDbNotification(List additions, List deletions) { - if (!additions.isEmpty() || !deletions.isEmpty()) { + if ((additions != null && !additions.isEmpty()) + || (deletions != null && !deletions.isEmpty())) { DBInvChangeNotification notify = new DBInvChangeNotification( additions, deletions, siteID); SendNotifications.send(notify); @@ -1550,14 +1598,9 @@ public class GridParmManager { // process the inventory looking for "old" unwanted databases List purged = new ArrayList(); - String model = modelToPurge.getModelName(); - String site = modelToPurge.getSiteId(); - String type = modelToPurge.getDbType(); int count = 0; for (DatabaseID dbId : currentInv) { - // new series? - if (dbId.getSiteId().equals(site) && dbId.getDbType().equals(type) - && dbId.getModelName().equals(model)) { + if (dbId.sameModel(modelToPurge)) { // process the id and determine whether it should be purged count++; diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/notify/GfeNotificationFilter.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/notify/GfeNotificationFilter.java deleted file mode 100644 index 1896056e5e..0000000000 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/notify/GfeNotificationFilter.java +++ /dev/null @@ -1,53 +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.edex.plugin.gfe.server.notify; - -import java.util.List; - -import com.raytheon.uf.common.dataplugin.gfe.server.notify.GfeNotification; - -/** - * TODO Add Description - * - *
- * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Dec 3, 2008            njensen     Initial creation
- * 
- * - * @author njensen - * @version 1.0 - */ - -public class GfeNotificationFilter { - - public boolean isGfeNotification(Object body) { - Object obj = body; - if (body instanceof List) { - List list = (List) body; - if (list.size() > 0) { - obj = list.get(0); - } - } - return obj instanceof GfeNotification; - } - -} diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/smartinit/InitClient.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/smartinit/InitClient.java index cff2bd5eb1..c8db1a71ad 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/smartinit/InitClient.java +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/smartinit/InitClient.java @@ -25,6 +25,7 @@ import com.raytheon.edex.plugin.gfe.config.IFPServerConfig; import com.raytheon.edex.plugin.gfe.config.IFPServerConfigManager; import com.raytheon.edex.plugin.gfe.reference.ReferenceMgr; import com.raytheon.edex.plugin.gfe.server.IFPServer; +import com.raytheon.edex.plugin.gfe.server.database.GridDatabase; import com.raytheon.edex.plugin.gfe.util.SendNotifications; import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID; import com.raytheon.uf.common.dataplugin.gfe.db.objects.GridLocation; @@ -49,6 +50,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority; * Jul 25, 2012 #957 dgilling Implement getEditAreaNames(). * Jun 13, 2013 #2044 randerso Refactored to use IFPServer * Nov 20, 2013 #2331 randerso Changed return type of getTopoData + * Oct 08, 2014 #3684 randerso Changed createDB to return status * * * @@ -98,13 +100,11 @@ public class InitClient { * * @param key */ - public void createDB(String key) { + public ServerResponse createDB(String key) { DatabaseID id = new DatabaseID(key); - ServerResponse sr = ifpServer.getGridParmMgr().createNewDb(id); - if (!sr.isOkay()) { - statusHandler.error("Error creating database " + id + ": " - + sr.message()); - } + ServerResponse sr = ifpServer.getGridParmMgr() + .createNewDb(id); + return sr; } /** diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/util/SendNotifications.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/util/SendNotifications.java index 76cce585ff..7c7686a421 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/util/SendNotifications.java +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/util/SendNotifications.java @@ -28,9 +28,8 @@ import org.apache.commons.logging.LogFactory; import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse; import com.raytheon.uf.common.dataplugin.gfe.server.notify.GfeNotification; -import com.raytheon.uf.common.dataplugin.gfe.util.GfeUtil; +import com.raytheon.uf.common.serialization.SerializationUtil; import com.raytheon.uf.edex.core.EDEXUtil; -import com.raytheon.uf.edex.core.EdexException; /** * Sends GFE notifications to the GFE notify JMS topic. @@ -43,6 +42,8 @@ import com.raytheon.uf.edex.core.EdexException; * 09/22/09 3058 rjpeter changed to utility. * 06/12/13 2099 dgilling Remove error when passed empty list of * notifications. + * 10/08/14 #3684 randerso Changed to send directly to JMS topic + * * * * @author bphillip @@ -66,11 +67,12 @@ public class SendNotifications { } try { - EDEXUtil.getMessageProducer().sendAsync(GfeUtil.NOTIFY, - notifications); + EDEXUtil.getMessageProducer().sendAsyncUri( + "jms-generic:topic:edex.alerts.gfe?timeToLive=60000", + SerializationUtil.transformToThrift(notifications)); // logger.info("Sending " + notifications.size() + " " // + notifications.get(0).getClass().getSimpleName()); - } catch (EdexException e) { + } catch (Exception e) { logger.error("Error sending gfe notification", e); sr.addMessage("Error sending gfe notification"); } diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/smartinit/Init.py b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/smartinit/Init.py index bb8c4fd59e..c8d5a40b37 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/smartinit/Init.py +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/smartinit/Init.py @@ -325,7 +325,9 @@ class Forecaster(GridUtilities): msg = "No databases for " + self._srcName LogStream.logProblem(msg) return - #sys.exit(1) + + if self.newdb() is None: + return self.__topo = self.getTopo() * .3048 srcdbkeys = self.srcdb().getKeys() @@ -547,6 +549,9 @@ class Forecaster(GridUtilities): start = time.time() self.__init() + if self.newdb() is None: + return + msgDest = "Destination database:" + self.newdb().getModelIdentifier() if validTime is not None: @@ -643,10 +648,15 @@ class Forecaster(GridUtilities): break if singletonNeeded: newdb = newdb[:-13] + '00000000_0000' + newdb = self.getDb(newdb) else: - client.createDB(newdb) - - newdb = self.getDb(newdb) + sr = client.createDB(newdb) + if sr.isOkay(): + newdb = self.getDb(newdb) + else: + msg = "Unable to create database for " + str(newdb) + LogStream.logProblem(msg) + newdb = None return srcdb, newdb diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/db/objects/DatabaseID.java b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/db/objects/DatabaseID.java index 6f49908cf8..ec1cf3bf09 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/db/objects/DatabaseID.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/db/objects/DatabaseID.java @@ -67,6 +67,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeTypeAdap * 06/20/13 2127 rjpeter Removed unused bidirectional relationship. * 06/13/13 2044 randerso Code cleanup * 07/31/13 2057 randerso Added removedDate + * 10/08/14 #3684 randerso Added sameModel() + * * * * @author bphillip @@ -598,6 +600,23 @@ public class DatabaseID implements Comparable { return cal.getTime(); } + public boolean sameModel(DatabaseID other) { + + if (!this.siteId.equals(other.getSiteId())) { + return false; + } + + if (!this.format.equals(other.getFormat())) { + return false; + } + + if (!this.dbType.equals(other.getDbType())) { + return false; + } + + return this.modelName.equals(other.getModelName()); + } + /* * (non-Javadoc) * diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/util/GfeUtil.java b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/util/GfeUtil.java index 2a42ebcc99..391da4b188 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/util/GfeUtil.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/util/GfeUtil.java @@ -67,6 +67,7 @@ import com.vividsolutions.jts.operation.polygonize.Polygonizer; * favor of new GridLocation constructor * 06/24/13 #2044 randerso Changed format of hdf5 group to include * minutes for satellite data + * 10/08/14 #3684 randerso Removed NOTIFY * * * @@ -105,8 +106,6 @@ public class GfeUtil { public static final String HAZARDS_KEY = "Hazards"; - public static final String NOTIFY = "gfeNotify"; - private static Pattern DISCRETE_PATTERN = Pattern .compile("'[\\w<>+/^\\[\\]\\.,:-]*'"); From 639ffe6ef88f0ec692e5724a1299f91ae230f377 Mon Sep 17 00:00:00 2001 From: Ron Anderson Date: Wed, 8 Oct 2014 18:39:56 -0500 Subject: [PATCH 06/11] Issue #3684 Fix NPE in GridParmManager Change-Id: I9b40e8cbf0032ca531723ff782b77e1ac9750c84 Former-commit-id: 77022c5f7836d8710dda947e8e0d9a7fcd42fea0 [formerly 7da4bc1b56c817d75a60b1ad104ee6fdd52acb46] [formerly e059bf4927f74edc387e2956179d091ab33e8e58] [formerly e059bf4927f74edc387e2956179d091ab33e8e58 [formerly 4d0c1b315126d26c9126800898f2f1123df7ba41]] [formerly a1445715660beba31c3165a42d04da8676b62563 [formerly e059bf4927f74edc387e2956179d091ab33e8e58 [formerly 4d0c1b315126d26c9126800898f2f1123df7ba41] [formerly a1445715660beba31c3165a42d04da8676b62563 [formerly bcc256c7c4a737a822ac30d0de8d3378818917da]]]] Former-commit-id: a1445715660beba31c3165a42d04da8676b62563 Former-commit-id: 5952933ecd21c8552a6779d860b6e5f7f19d1bcb [formerly 65da306e8bdffb3e16d32e6e1ab3d38b82dfa209] [formerly a1ff4e85a45ca5128b6664c19f1bd6cbbf97c403 [formerly cdb9971dd689c668c8201a5a290c40e6293de5a7]] Former-commit-id: a1ff4e85a45ca5128b6664c19f1bd6cbbf97c403 Former-commit-id: acc8010adcfbc1b6a16288803f8640fc26ee8309 --- .../com/raytheon/edex/plugin/gfe/server/GridParmManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/GridParmManager.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/GridParmManager.java index ef2b251a95..225e07ca00 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/GridParmManager.java +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/GridParmManager.java @@ -895,7 +895,7 @@ public class GridParmManager { createDbNotification(Arrays.asList(dbId), purged); } // always notify on purges - else if (!purged.isEmpty()) { + else { createDbNotification(null, purged); } } From d080d139112797d04ae183364cab3a83c7eff5f4 Mon Sep 17 00:00:00 2001 From: Ron Anderson Date: Thu, 9 Oct 2014 09:21:29 -0500 Subject: [PATCH 07/11] Issue #3684 Fix GFE notification sending Change-Id: I3b2ab7f454cb9454a9827ef994002d1b2348f462 Former-commit-id: 5be8b0a3769a0b49227b6c2a9d6371a41881017e [formerly cd518b18afbc2665881097bc0924c8ad852f319b] [formerly 95b1633c25ca8ccbf45fe171986036c6bd008548] [formerly 95b1633c25ca8ccbf45fe171986036c6bd008548 [formerly c7bf8189897cf965be2a4e6ac6afd1318f810497]] [formerly 53681076157e3c7b2b2e7e227e08aed6298a1524 [formerly 95b1633c25ca8ccbf45fe171986036c6bd008548 [formerly c7bf8189897cf965be2a4e6ac6afd1318f810497] [formerly 53681076157e3c7b2b2e7e227e08aed6298a1524 [formerly b538cd55c0662d3d593522817986109c7e03625a]]]] Former-commit-id: 53681076157e3c7b2b2e7e227e08aed6298a1524 Former-commit-id: 7a9070a59da8972ca08346dd577010643e7e05fd [formerly 777f2917d6251c365e002df07602e6dc681f0259] [formerly df266c342fd3d7d4134a678bdec398fb21d931eb [formerly a65682953c583d9fcd04aaf9fe43c7908a4730f6]] Former-commit-id: df266c342fd3d7d4134a678bdec398fb21d931eb Former-commit-id: e32c76f88c53e07beffed5f7e6a9c019c6785209 --- .../viz/gfe/core/internal/ParmManager.java | 3 +- .../plugin/gfe/util/SendNotifications.java | 18 +++++------- .../uf/edex/core/IMessageProducer.java | 28 ++++++++++++++++++ .../uf/edex/esb/camel/MessageProducer.java | 29 +++++++++++++++++-- 4 files changed, 64 insertions(+), 14 deletions(-) diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/ParmManager.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/ParmManager.java index 2e8a40b35f..87f7dcf539 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/ParmManager.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/ParmManager.java @@ -143,6 +143,7 @@ import com.raytheon.viz.gfe.types.MutableInteger; * 04/02/2014 #2969 randerso Fix error when Toop parm is unloaded. * 05/01/2014 #3105 dgilling Ensure mutable db gets into availableServerDatabases * if it has to be created during ParmManager construction. + * 10/08/14 #3684 randerso Minor code optimization * * * @author chammack @@ -2925,7 +2926,7 @@ public class ParmManager implements IParmManager, IMessageClient { List newAdditions = new ArrayList(additions); newAdditions.removeAll(availableDatabases); - availableDatabases.addAll(additions); + availableDatabases.addAll(newAdditions); availableDatabases.removeAll(deletions); List toDelete = new ArrayList(); diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/util/SendNotifications.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/util/SendNotifications.java index 7c7686a421..a5124c948f 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/util/SendNotifications.java +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/util/SendNotifications.java @@ -23,12 +23,10 @@ package com.raytheon.edex.plugin.gfe.util; import java.util.ArrayList; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse; import com.raytheon.uf.common.dataplugin.gfe.server.notify.GfeNotification; -import com.raytheon.uf.common.serialization.SerializationUtil; +import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.edex.core.EDEXUtil; /** @@ -50,8 +48,8 @@ import com.raytheon.uf.edex.core.EDEXUtil; * @version 1.0 */ public class SendNotifications { - protected static final transient Log logger = LogFactory - .getLog(SendNotifications.class); + private static final transient IUFStatusHandler statusHandler = UFStatus + .getHandler(SendNotifications.class); public static ServerResponse send(GfeNotification notification) { List notifications = new ArrayList(); @@ -67,13 +65,11 @@ public class SendNotifications { } try { - EDEXUtil.getMessageProducer().sendAsyncUri( + EDEXUtil.getMessageProducer().sendAsyncThriftUri( "jms-generic:topic:edex.alerts.gfe?timeToLive=60000", - SerializationUtil.transformToThrift(notifications)); - // logger.info("Sending " + notifications.size() + " " - // + notifications.get(0).getClass().getSimpleName()); + notifications); } catch (Exception e) { - logger.error("Error sending gfe notification", e); + statusHandler.error("Error sending gfe notification", e); sr.addMessage("Error sending gfe notification"); } return sr; diff --git a/edexOsgi/com.raytheon.uf.edex.core/src/com/raytheon/uf/edex/core/IMessageProducer.java b/edexOsgi/com.raytheon.uf.edex.core/src/com/raytheon/uf/edex/core/IMessageProducer.java index 72b7d28bf7..baca2f3f24 100644 --- a/edexOsgi/com.raytheon.uf.edex.core/src/com/raytheon/uf/edex/core/IMessageProducer.java +++ b/edexOsgi/com.raytheon.uf.edex.core/src/com/raytheon/uf/edex/core/IMessageProducer.java @@ -19,7 +19,24 @@ **/ package com.raytheon.uf.edex.core; +import com.raytheon.uf.common.serialization.SerializationException; +/** + * Message Producer Interface + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * 10/08/14     #3684      randerso    Added sendAsyncThriftUri
+ * 
+ * 
+ * + * @author randerso + * @version 1.0 + */ public interface IMessageProducer { /** @@ -57,4 +74,15 @@ public interface IMessageProducer { */ public void sendAsyncUri(String uri, Object message) throws EdexException; + /** + * Sends a message asynchronously using Thrift serialization. + * + * @param uri + * the uri to send the message to + * @param message + * the message to send + */ + public void sendAsyncThriftUri(String uri, Object message) + throws EdexException, SerializationException; + } \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.esb.camel/src/com/raytheon/uf/edex/esb/camel/MessageProducer.java b/edexOsgi/com.raytheon.uf.edex.esb.camel/src/com/raytheon/uf/edex/esb/camel/MessageProducer.java index 3e590f25bf..8acee59431 100644 --- a/edexOsgi/com.raytheon.uf.edex.esb.camel/src/com/raytheon/uf/edex/esb/camel/MessageProducer.java +++ b/edexOsgi/com.raytheon.uf.edex.esb.camel/src/com/raytheon/uf/edex/esb/camel/MessageProducer.java @@ -34,6 +34,8 @@ import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import com.raytheon.uf.common.message.IMessage; +import com.raytheon.uf.common.serialization.SerializationException; +import com.raytheon.uf.common.serialization.SerializationUtil; import com.raytheon.uf.edex.core.EDEXUtil; import com.raytheon.uf.edex.core.EdexException; import com.raytheon.uf.edex.core.IMessageProducer; @@ -46,6 +48,7 @@ import com.raytheon.uf.edex.core.IMessageProducer; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Nov 14, 2008 njensen Initial creation + * Oct 08, 2014 #3684 randerso Added sendAsyncThriftUri * * * @author njensen @@ -72,6 +75,7 @@ public class MessageProducer implements ApplicationContextAware, * com.raytheon.uf.edex.esb.camel.IMessageProducer#sendAsync(java.lang.String * , java.lang.Object) */ + @Override public void sendAsync(String endpoint, Object message) throws EdexException { CamelContext camelContext = getCamelContext(endpoint); ProducerTemplate template = getProducerTemplate(camelContext); @@ -97,6 +101,7 @@ public class MessageProducer implements ApplicationContextAware, * com.raytheon.uf.edex.esb.camel.IMessageProducer#sendSync(java.lang.String * , java.lang.Object) */ + @Override public Object sendSync(String endpoint, Object message) throws EdexException { CamelContext camelContext = getCamelContext(endpoint); @@ -202,8 +207,28 @@ public class MessageProducer implements ApplicationContextAware, template.sendBody(uri, ExchangePattern.InOnly, message); } } catch (CamelExecutionException e) { - throw new EdexException("Error sending asynchronous message: " + message - + " to uri: " + uri, e); + throw new EdexException("Error sending asynchronous message: " + + message + " to uri: " + uri, e); + } + } + + @Override + public void sendAsyncThriftUri(String uri, Object message) + throws EdexException, SerializationException { + CamelContext ctx = getCamelContextList().get(0); + ProducerTemplate template = getProducerTemplate(ctx); + Map headers = getHeaders(message); + try { + if (headers != null) { + template.sendBodyAndHeaders(uri, ExchangePattern.InOnly, + SerializationUtil.transformToThrift(message), headers); + } else { + template.sendBody(uri, ExchangePattern.InOnly, + SerializationUtil.transformToThrift(message)); + } + } catch (CamelExecutionException e) { + throw new EdexException("Error sending asynchronous message: " + + message + " to uri: " + uri, e); } } From 1dad7312fc337fef20e8e2fb1945f9da87a8cc3d Mon Sep 17 00:00:00 2001 From: Ron Anderson Date: Mon, 27 Oct 2014 18:40:15 -0500 Subject: [PATCH 08/11] Issue #3766 Fixed return type of GridParmManager.createNewDb Change-Id: Ib76bf614b09895ef08065da86d3af8d59f490f4c Former-commit-id: 3de491db23be847f79bfc1d40857b262bd2508a1 [formerly cf13947cf2c2665194f30dc0c09fb33ba02e7720] [formerly c8ff5af7b6b3733cebe7ea9d3e32cab2cda05fa1] [formerly c8ff5af7b6b3733cebe7ea9d3e32cab2cda05fa1 [formerly ebe43e22d3a937390054d99c7f8401c9eb21cde8]] [formerly 8362946f0e7b2c8382cbd81ffa1367c249ddf403 [formerly c8ff5af7b6b3733cebe7ea9d3e32cab2cda05fa1 [formerly ebe43e22d3a937390054d99c7f8401c9eb21cde8] [formerly 8362946f0e7b2c8382cbd81ffa1367c249ddf403 [formerly 2e2f83952a6ef00b17d9f4504133c85e93e0126e]]]] Former-commit-id: 8362946f0e7b2c8382cbd81ffa1367c249ddf403 Former-commit-id: 245c4ae0d286eff8145a1445f060848b2f5d874c [formerly 0f94dcbc6b9abb1b964811a8f6615846f87e6483] [formerly 63f599abc8efead1f653974d8d00e6a4024b3e94 [formerly 673344e5966a303061a00961ac6f194f4a8fa2fe]] Former-commit-id: 63f599abc8efead1f653974d8d00e6a4024b3e94 Former-commit-id: 2b42f118d707ced5d47264de143040417cf69e8d --- .../raytheon/edex/plugin/gfe/server/GridParmManager.java | 8 ++++---- .../raytheon/edex/plugin/gfe/smartinit/InitClient.java | 7 +++---- .../utility/edex_static/base/smartinit/Init.py | 6 ++++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/GridParmManager.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/GridParmManager.java index 225e07ca00..c74451506c 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/GridParmManager.java +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/GridParmManager.java @@ -132,6 +132,7 @@ import com.raytheon.uf.edex.database.purge.PurgeLogger; * Prevent createDB from creating databases that are immediately purged * Send DBInvChangeNotifications at site activation so new D2D data * ingested while deactivated gets recognized + * 10/27/2014 #3766 randerso Fixed return type and javadoc for createNewDb * * * @@ -908,11 +909,11 @@ public class GridParmManager { * Create a new database * * @param dbId - * @return ServerResponse containing the created database + * @return ServerResponse containing status only */ - public ServerResponse createNewDb(DatabaseID dbId) { + public ServerResponse createNewDb(DatabaseID dbId) { - ServerResponse sr = new ServerResponse(); + ServerResponse sr = new ServerResponse(); if (!dbId.getFormat().equals(DataType.GRID)) { sr.addMessage("Invalid database id for createNewDb(): " + dbId); @@ -921,7 +922,6 @@ public class GridParmManager { GridDatabase db = this.getDatabase(dbId); if (db != null) { - sr.setPayload(db); return sr; // database already exists } else { sr.addMessage("Unable to create database: " + dbId); diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/smartinit/InitClient.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/smartinit/InitClient.java index c8db1a71ad..41b75630f3 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/smartinit/InitClient.java +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/smartinit/InitClient.java @@ -25,7 +25,6 @@ import com.raytheon.edex.plugin.gfe.config.IFPServerConfig; import com.raytheon.edex.plugin.gfe.config.IFPServerConfigManager; import com.raytheon.edex.plugin.gfe.reference.ReferenceMgr; import com.raytheon.edex.plugin.gfe.server.IFPServer; -import com.raytheon.edex.plugin.gfe.server.database.GridDatabase; import com.raytheon.edex.plugin.gfe.util.SendNotifications; import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID; import com.raytheon.uf.common.dataplugin.gfe.db.objects.GridLocation; @@ -51,6 +50,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority; * Jun 13, 2013 #2044 randerso Refactored to use IFPServer * Nov 20, 2013 #2331 randerso Changed return type of getTopoData * Oct 08, 2014 #3684 randerso Changed createDB to return status + * Oct 27, 2014 #3766 randerso Fixed return type for createDB * * * @@ -100,10 +100,9 @@ public class InitClient { * * @param key */ - public ServerResponse createDB(String key) { + public ServerResponse createDB(String key) { DatabaseID id = new DatabaseID(key); - ServerResponse sr = ifpServer.getGridParmMgr() - .createNewDb(id); + ServerResponse sr = ifpServer.getGridParmMgr().createNewDb(id); return sr; } diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/smartinit/Init.py b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/smartinit/Init.py index c8d5a40b37..17dcf11f8b 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/smartinit/Init.py +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/smartinit/Init.py @@ -28,7 +28,8 @@ # 04/04/13 #1787 randerso fix validTime check to work with accumulative parms # fix logging so you can actually determine why # a smartInit is not calculating a parameter -# Oct 29, 2013 2476 njensen Improved getting wx/discrete keys when retrieving data +# 10/29/2013 #2476 njensen Improved getting wx/discrete keys when retrieving data +# 10/27/2014 #3766 randerso Changed _getLatest to include error text returned from InitClient.createDB() # ## import string, sys, re, time, types, getopt, fnmatch, LogStream, DatabaseID, JUtil, AbsTime, TimeRange @@ -654,7 +655,8 @@ class Forecaster(GridUtilities): if sr.isOkay(): newdb = self.getDb(newdb) else: - msg = "Unable to create database for " + str(newdb) + msg = "Unable to create database for " + str(newdb) + ":\n" + \ + str(sr.message()) LogStream.logProblem(msg) newdb = None From dfa78c6672e84d0221fb2ae37b23c445ce5a451b Mon Sep 17 00:00:00 2001 From: Ron Anderson Date: Wed, 29 Oct 2014 14:45:21 -0500 Subject: [PATCH 09/11] Issue #3776 Cache SWT fill patterns used in history mode. Change-Id: Ibb48a997fd0b9c2308ae9f492c7837a10db7285d Former-commit-id: f0ae7134be08490a0bbd61c5d136b2f542a4fcb6 [formerly 96ea0c0f1b3a3af53f0ddabb7001cbe622f177aa] [formerly 8f220702f91d6c3ba0c30030080c1ec9ff3abd5a] [formerly 8f220702f91d6c3ba0c30030080c1ec9ff3abd5a [formerly 0c3e19449f6e5a724c3f9715460cb2ab48c307df]] [formerly 53144f55f0b6e7623a1063610c14761afb8ed770 [formerly 8f220702f91d6c3ba0c30030080c1ec9ff3abd5a [formerly 0c3e19449f6e5a724c3f9715460cb2ab48c307df] [formerly 53144f55f0b6e7623a1063610c14761afb8ed770 [formerly baefc78796f3d4826d32e5324dd88fa01d242ed5]]]] Former-commit-id: 53144f55f0b6e7623a1063610c14761afb8ed770 Former-commit-id: 9442922337bdb94839966be99240e6e1b2d5c123 [formerly 2fff32fdc3fc2fecdf03b053f430293af5005b48] [formerly e946ac633eb31f34c82816463d1285408b0f6770 [formerly 5f83ca27f14e4a2bcac4af7544db494f808274bf]] Former-commit-id: e946ac633eb31f34c82816463d1285408b0f6770 Former-commit-id: a097c88c8230d3cd56ad00afab56f47a1316e809 --- .../raytheon/viz/gfe/gridmanager/GridBar.java | 86 ++++++++++++------- .../AbstractTemporalEditorBar.java | 11 +-- 2 files changed, 61 insertions(+), 36 deletions(-) diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/gridmanager/GridBar.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/gridmanager/GridBar.java index f738e338d8..75cbbf39b8 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/gridmanager/GridBar.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/gridmanager/GridBar.java @@ -85,6 +85,8 @@ import com.raytheon.viz.gfe.rsc.GFEFonts; * 02/19/2008 dfitch Initial creation. * Apr 7, 2009 #2212 randerso Reimplemented * Jun 23, 2011 #9897 ryu Update static variables on new GFE config + * Oct 29, 2014 #3776 randerso Cached fill patterns used in history mode + * Renamed static variables to match AWIPS standards * * * @@ -108,18 +110,22 @@ public class GridBar implements IMessageClient, IParmInventoryChangedListener, private static final Date BASE_DATE = new Date(0); - private static Color DEFAULT_COLOR = new Color(null, + private static final Color DEFAULT_COLOR = new Color(null, RGBColors.getRGBColor("gray75")); - protected static Pattern LockedByMe; + protected static Pattern lockedByMe; - public static Pattern LockedByOther; + public static Pattern lockedByOther; - protected static Color TimeBlockVisible_color; + protected static Map modifiedByMe = new HashMap(); - protected static Color TimeBlockActive_color; + protected static Map modifiedByOther = new HashMap(); - protected static Color TimeBlockInvisible_color; + protected static Color timeBlockVisible_color; + + protected static Color timeBlockActive_color; + + protected static Color timeBlockInvisible_color; protected static boolean showEditorTimeLines; @@ -140,10 +146,10 @@ public class GridBar implements IMessageClient, IParmInventoryChangedListener, if ((pattern = prefs.getString("LockedByMe_pattern")).isEmpty()) { pattern = "WHOLE"; } - if (LockedByMe != null) { - LockedByMe.dispose(); + if (lockedByMe != null) { + lockedByMe.dispose(); } - LockedByMe = FillPatterns.getSWTPattern( + lockedByMe = FillPatterns.getSWTPattern( RGBColors.getRGBColor(color), pattern); if ((color = prefs.getString("LockedByOther_color")).isEmpty()) { @@ -153,40 +159,50 @@ public class GridBar implements IMessageClient, IParmInventoryChangedListener, .isEmpty()) { pattern = "WHOLE"; } - if (LockedByOther != null) { - LockedByOther.dispose(); + if (lockedByOther != null) { + lockedByOther.dispose(); } - LockedByOther = FillPatterns.getSWTPattern( + lockedByOther = FillPatterns.getSWTPattern( RGBColors.getRGBColor(color), pattern); + for (RGB key : modifiedByMe.keySet()) { + Pattern pat = modifiedByMe.remove(key); + pat.dispose(); + } + + for (RGB key : modifiedByOther.keySet()) { + Pattern pat = modifiedByOther.remove(key); + pat.dispose(); + } + if ((color = prefs.getString("TimeBlockVisible_color")) .isEmpty()) { color = "White"; } - if (TimeBlockVisible_color != null) { - TimeBlockVisible_color.dispose(); + if (timeBlockVisible_color != null) { + timeBlockVisible_color.dispose(); } - TimeBlockVisible_color = new Color(Display.getDefault(), + timeBlockVisible_color = new Color(Display.getDefault(), RGBColors.getRGBColor(color)); if ((color = prefs.getString("TimeBlockActive_color")) .isEmpty()) { color = "Yellow"; } - if (TimeBlockActive_color != null) { - TimeBlockActive_color.dispose(); + if (timeBlockActive_color != null) { + timeBlockActive_color.dispose(); } - TimeBlockActive_color = new Color(Display.getDefault(), + timeBlockActive_color = new Color(Display.getDefault(), RGBColors.getRGBColor(color)); if ((color = prefs.getString("TimeBlockInvisible_color")) .isEmpty()) { color = "Gray50"; } - if (TimeBlockInvisible_color != null) { - TimeBlockInvisible_color.dispose(); + if (timeBlockInvisible_color != null) { + timeBlockInvisible_color.dispose(); } - TimeBlockInvisible_color = new Color(Display.getDefault(), + timeBlockInvisible_color = new Color(Display.getDefault(), RGBColors.getRGBColor(color)); showEditorTimeLines = true; @@ -496,7 +512,7 @@ public class GridBar implements IMessageClient, IParmInventoryChangedListener, LockTable lockTable = parm.getLockTable(); - gc.setBackgroundPattern(LockedByMe); + gc.setBackgroundPattern(lockedByMe); for (TimeRange timeRange : lockTable.lockedByMe()) { if (timeRange.overlaps(this.gridManager.getVisibleTimeRange())) { Rectangle rect = computeLockRect(timeRange); @@ -505,7 +521,7 @@ public class GridBar implements IMessageClient, IParmInventoryChangedListener, } - gc.setBackgroundPattern(LockedByOther); + gc.setBackgroundPattern(lockedByOther); for (TimeRange timeRange : lockTable.lockedByOther()) { if (timeRange.overlaps(this.gridManager.getVisibleTimeRange())) { Rectangle rect = computeLockRect(timeRange); @@ -519,7 +535,7 @@ public class GridBar implements IMessageClient, IParmInventoryChangedListener, TimeRange dataTR[]) { GC gc = event.gc; TimeRange visibleRange = gridManager.getVisibleTimeRange(); - gc.setForeground(TimeBlockInvisible_color); + gc.setForeground(timeBlockInvisible_color); gc.setLineStyle(DATA_BLOCK_LINE_STYLE); gc.setLineWidth(0); @@ -684,18 +700,18 @@ public class GridBar implements IMessageClient, IParmInventoryChangedListener, } if (!active && !visible) { - gc.setBackground(TimeBlockInvisible_color); + gc.setBackground(timeBlockInvisible_color); gc.fillRectangle(rect); } else if (!active && visible) { - gc.setBackground(TimeBlockVisible_color); + gc.setBackground(timeBlockVisible_color); gc.fillRectangle(rect); } else if (active && visible) { - gc.setBackground(TimeBlockActive_color); + gc.setBackground(timeBlockActive_color); gc.fillRectangle(rect); } else { - gc.setBackground(TimeBlockInvisible_color); + gc.setBackground(timeBlockInvisible_color); gc.fillRectangle(rect); - gc.setForeground(TimeBlockActive_color); + gc.setForeground(timeBlockActive_color); gc.drawRectangle(rect); } } @@ -760,13 +776,21 @@ public class GridBar implements IMessageClient, IParmInventoryChangedListener, patt = Activator.getDefault().getPreferenceStore() .getString("HistoryUserModPattern_Me"); if (!patt.isEmpty()) { - fp = FillPatterns.getSWTPattern(color.getRGB(), patt); + fp = modifiedByMe.get(color.getRGB()); + if (fp == null) { + fp = FillPatterns.getSWTPattern(color.getRGB(), patt); + modifiedByMe.put(color.getRGB(), fp); + } } } else { patt = Activator.getDefault().getPreferenceStore() .getString("HistoryUserModPattern_Other"); if (!patt.isEmpty()) { - fp = FillPatterns.getSWTPattern(color.getRGB(), patt); + fp = modifiedByOther.get(color.getRGB()); + if (fp == null) { + fp = FillPatterns.getSWTPattern(color.getRGB(), patt); + modifiedByOther.put(color.getRGB(), fp); + } } } } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/temporaleditor/AbstractTemporalEditorBar.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/temporaleditor/AbstractTemporalEditorBar.java index cd60db04d2..66221fbdf1 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/temporaleditor/AbstractTemporalEditorBar.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/temporaleditor/AbstractTemporalEditorBar.java @@ -52,9 +52,7 @@ import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.time.TimeRange; import com.raytheon.uf.viz.core.VizApp; -import com.raytheon.viz.gfe.Activator; import com.raytheon.viz.gfe.GFEPreference; -import com.raytheon.viz.gfe.constants.StatusConstants; import com.raytheon.viz.gfe.core.griddata.IGridData; import com.raytheon.viz.gfe.core.msgs.IParmInventoryChangedListener; import com.raytheon.viz.gfe.core.parm.Parm; @@ -78,6 +76,7 @@ import com.raytheon.viz.gfe.temporaleditor.mousehandler.TitleBarMouseHandler; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Apr 30, 2009 2159 rjpeter Initial creation. + * Oct 29, 2014 #3776 randerso Renamed static variables to match AWIPS standards * * * @author rjpeter @@ -85,7 +84,9 @@ import com.raytheon.viz.gfe.temporaleditor.mousehandler.TitleBarMouseHandler; */ public abstract class AbstractTemporalEditorBar implements Comparable { - private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(AbstractTemporalEditorBar.class); + private static final transient IUFStatusHandler statusHandler = UFStatus + .getHandler(AbstractTemporalEditorBar.class); + protected static final Color DEFAULT_COLOR = Display.getDefault() .getSystemColor(SWT.COLOR_GRAY); @@ -552,7 +553,7 @@ public abstract class AbstractTemporalEditorBar implements for (Parm parm : parmList) { LockTable lockTable = parm.getLockTable(); - gc.setBackgroundPattern(GridBar.LockedByOther); + gc.setBackgroundPattern(GridBar.lockedByOther); for (TimeRange timeRange : lockTable.lockedByOther()) { if (timeRange.overlaps(range)) { Rectangle rect = teUtil.timeRangeToPixels(timeRange); @@ -643,7 +644,7 @@ public abstract class AbstractTemporalEditorBar implements scaleCanvas.redraw(); editorCanvas.redraw(); bottomLabel.redraw(); - } + } } /** From 7e4fe3893f06b029f899d9f44b4b56da1588f790 Mon Sep 17 00:00:00 2001 From: "Shawn.Hooper" Date: Thu, 30 Oct 2014 14:47:26 -0400 Subject: [PATCH 10/11] ASM #16800 - Add HRRR under D2D in Weather Element Browser Change-Id: I829cd7357ccd37e389e88567a4159d0efde9aa41 Former-commit-id: eb4c06fd5a5ca84ac6f3ebe19a618b1ec279bbee [formerly b291c1a96a8bebc6adde65d99b2fe732c5db4b0f] [formerly 733d5ff94dcee690ac4c5f4ece15061532257c5c] [formerly 733d5ff94dcee690ac4c5f4ece15061532257c5c [formerly a44d775a27adef99ac232e04c9f8e49ab9e4de4c]] [formerly ec3b831987b7e1869ec0c41821e65f08175458fa [formerly 733d5ff94dcee690ac4c5f4ece15061532257c5c [formerly a44d775a27adef99ac232e04c9f8e49ab9e4de4c] [formerly ec3b831987b7e1869ec0c41821e65f08175458fa [formerly 99807ddc4810c08635d5462357dc29e661686e33]]]] Former-commit-id: ec3b831987b7e1869ec0c41821e65f08175458fa Former-commit-id: f1ddf2ead4fa403bd92b093317965b08ed7978db [formerly be5468f1d13cacafbf19dea2b4bcf79e6e8ff9c4] [formerly 3af096ae410ac0642b9619087a6e6bea1c08e7e1 [formerly 2f2bb733a4e3c435edebfa60b21d271c888d7369]] Former-commit-id: 3af096ae410ac0642b9619087a6e6bea1c08e7e1 Former-commit-id: e0bb02328be033bc33647ed03b6565a781e85d3a --- .../utility/edex_static/base/config/gfe/serverConfig.py | 1 + 1 file changed, 1 insertion(+) diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/config/gfe/serverConfig.py b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/config/gfe/serverConfig.py index d60323a2d4..763a70423f 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/config/gfe/serverConfig.py +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/config/gfe/serverConfig.py @@ -1184,6 +1184,7 @@ else: #######DCS3501 WEST_CONUS ('HPCqpf', 'HPCQPF'), ('HPCqpfNDFD', 'HPCERP'), ('RFCqpf', 'RFCQPF'), + ('HRRR', 'HRRR'), #DR3511 'HPCdelta', 'GLERL', 'WNAWAVE238', From c4aca4e320616576a33c4d76c76aae16cf1ba949 Mon Sep 17 00:00:00 2001 From: Ron Anderson Date: Tue, 4 Nov 2014 11:03:42 -0600 Subject: [PATCH 11/11] Issue #3775 Fix db does not exist for getParmList() error when runProcedure creates new mutable db. Change-Id: I28eef61e4eea77278efe3cbf8828c3357c856785 Former-commit-id: 08922cc07942dd36e86eafb222f2aad3a80aec69 [formerly ae81f91f32793b2b969c941d5c3eb12015ed4782] [formerly af9fd16f7374f959d703b5088129196b3884b50c] [formerly af9fd16f7374f959d703b5088129196b3884b50c [formerly b508a7134cac2a9f5c0e25c229ef1cc9a5d33c46]] [formerly dd230d9f01c83a4aa402c468aa942aa5c65b87f5 [formerly af9fd16f7374f959d703b5088129196b3884b50c [formerly b508a7134cac2a9f5c0e25c229ef1cc9a5d33c46] [formerly dd230d9f01c83a4aa402c468aa942aa5c65b87f5 [formerly de45da45f39169e3924122a7baf68ab6762e74e2]]]] Former-commit-id: dd230d9f01c83a4aa402c468aa942aa5c65b87f5 Former-commit-id: 02a0e7eb653e2bcd359dfe70603525adb603e463 [formerly 5febd9ef9398e24dbc4f577ed60f3401628379a1] [formerly 3b2b59689bdd932144cb9fc85613a5cffad127cb [formerly 47aadc52c15a12fecff784c8b8f749def9dd66aa]] Former-commit-id: 3b2b59689bdd932144cb9fc85613a5cffad127cb Former-commit-id: 8dd8a3852f5cc5068dde884061a06f949a6e63ca --- .../raytheon/viz/gfe/core/DataManager.java | 3 +- .../gfe/core/internal/DataMgrInitStatus.java | 14 +++- .../core/internal/GFEParmCacheInitJob.java | 12 ++-- .../viz/gfe/core/internal/ParmManager.java | 68 ++++++++----------- 4 files changed, 52 insertions(+), 45 deletions(-) diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/DataManager.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/DataManager.java index a2e37e09f6..95af921ba0 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/DataManager.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/DataManager.java @@ -101,6 +101,7 @@ import com.raytheon.viz.gfe.textformatter.TextProductManager; * 09/16/2013 2033 dgilling Remove unused IToolController. * 12/09/2013 2367 dgilling Instantiate ProcedureJobPool here. * 09/09/2014 3592 randerso Added call to SampleSetManager.dispose() + * 10/30/2014 3775 randerso Added parmCacheInit to initStatus * * * @@ -221,7 +222,7 @@ public class DataManager { this.router = new NotificationRouter(this.getSiteID()); this.parmManager = new ParmManager(this); - GFEParmCacheInitJob cacheJob = new GFEParmCacheInitJob(this.parmManager); + GFEParmCacheInitJob cacheJob = new GFEParmCacheInitJob(this); cacheJob.setSystem(true); cacheJob.schedule(); this.refManager = new ReferenceSetManager(this); diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/DataMgrInitStatus.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/DataMgrInitStatus.java index dc6495cf13..af8301a28b 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/DataMgrInitStatus.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/DataMgrInitStatus.java @@ -29,6 +29,7 @@ package com.raytheon.viz.gfe.core.internal; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Jan 25, 2011 njensen Initial creation + * Oct 30, 2014 #3775 randerso Added parmCacheInit to initStatus * * * @@ -38,12 +39,22 @@ package com.raytheon.viz.gfe.core.internal; public class DataMgrInitStatus { + private boolean parmCacheInitDone = false; + private boolean iscInitDone = false; private boolean selectTRMgrDone = false; private boolean sampleSetMgrDone = false; + public boolean isParmCacheInitDone() { + return parmCacheInitDone; + } + + public void setParmCacheInitDone(boolean parmCacheInitDone) { + this.parmCacheInitDone = parmCacheInitDone; + } + public boolean isIscInitDone() { return iscInitDone; } @@ -69,7 +80,8 @@ public class DataMgrInitStatus { } public boolean isDone() { - return iscInitDone && sampleSetMgrDone && selectTRMgrDone; + return parmCacheInitDone && iscInitDone && sampleSetMgrDone + && selectTRMgrDone; } } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/GFEParmCacheInitJob.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/GFEParmCacheInitJob.java index 9c6d34c368..c451e6f11a 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/GFEParmCacheInitJob.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/GFEParmCacheInitJob.java @@ -24,7 +24,7 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; -import com.raytheon.viz.gfe.core.IParmManager; +import com.raytheon.viz.gfe.core.DataManager; /** * Job for initializing a cache in memory of all available parms. @@ -36,6 +36,7 @@ import com.raytheon.viz.gfe.core.IParmManager; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Jan 19, 2011 njensen Initial creation + * Oct 30, 2014 #3775 randerso Added parmCacheInit to initStatus * * * @@ -45,11 +46,11 @@ import com.raytheon.viz.gfe.core.IParmManager; public class GFEParmCacheInitJob extends Job { - private IParmManager parmMgr; + private DataManager dataMgr; - public GFEParmCacheInitJob(IParmManager pm) { + public GFEParmCacheInitJob(DataManager dataMgr) { super("Parm Cache Initialization"); - this.parmMgr = pm; + this.dataMgr = dataMgr; } /* @@ -61,7 +62,8 @@ public class GFEParmCacheInitJob extends Job { @Override protected IStatus run(IProgressMonitor monitor) { long t0 = System.currentTimeMillis(); - this.parmMgr.getAllAvailableParms(); + this.dataMgr.getParmManager().getAllAvailableParms(); + this.dataMgr.getInitStatus().setParmCacheInitDone(true); System.out.println("GFEParmCacheInitJob took: " + (System.currentTimeMillis() - t0) + "ms"); diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/ParmManager.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/ParmManager.java index f7b5e7528d..91448340d1 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/ParmManager.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/ParmManager.java @@ -144,6 +144,7 @@ import com.raytheon.viz.gfe.types.MutableInteger; * 05/01/2014 #3105 dgilling Ensure mutable db gets into availableServerDatabases * if it has to be created during ParmManager construction. * 09/08/2104 #3592 randerso Changed to use new pm listStaticFiles() + * 10/30/2014 #3775 randerso Changed to createMutableDb before getting initial database inventory * * * @author chammack @@ -360,9 +361,6 @@ public class ParmManager implements IParmManager, IMessageClient { dbCategories = Arrays.asList(prefs.getStringArray("dbTypes")); - this.availableDatabases = new HashSet( - getDatabaseInventory()); - this.dbInvChangeListener = new AbstractGFENotificationObserver( DBInvChangeNotification.class) { @@ -1283,6 +1281,20 @@ public class ParmManager implements IParmManager, IMessageClient { } private void updateDatabaseLists() throws GFEServerException { + boolean containsMutable = false; + DatabaseID mutableDbId = getMutableDatabase(); + if (mutableDbId.isValid()) { + // createMutableDb is it doesn't already exist + ServerResponse sr = this.dataManager.getClient().createNewDb( + mutableDbId); + containsMutable = sr.isOkay(); + } + + if (this.availableDatabases == null) { + this.availableDatabases = new HashSet( + getDatabaseInventory()); + } + this.availableServerDatabases = new ArrayList( availableDatabases); this.availableVCParmDatabases = determineVCParmDatabases(vcModules); @@ -1308,44 +1320,24 @@ public class ParmManager implements IParmManager, IMessageClient { } Collections.sort(this.availableServerDatabases); - DatabaseID mutableDbId = getMutableDatabase(); - if (mutableDbId.isValid()) { - boolean containsMutable = availableServerDatabases - .contains(mutableDbId); - - if (!containsMutable) { - ServerResponse sr = this.dataManager.getClient() - .createNewDb(mutableDbId); - containsMutable = sr.isOkay(); - - if (containsMutable) { - this.availableServerDatabases.add(mutableDbId); - Collections.sort(this.availableServerDatabases); + if (containsMutable) { + // order of isc databases is important, since ISCDataAccess will + // look for the first match. That's why we don't use + // availableDbs() + // and simplify the three loops into one. + for (DatabaseID dbid : availableVCParmDatabases) { + if (dbid.getModelName().equals("ISC") && !iscDbs.contains(dbid)) { + iscDbs.add(dbid); } } - - if (containsMutable) { - // order of isc databases is important, since ISCDataAccess will - // look for the first match. That's why we don't use - // availableDbs() - // and simplify the three loops into one. - for (DatabaseID dbid : availableVCParmDatabases) { - if (dbid.getModelName().equals("ISC") - && !iscDbs.contains(dbid)) { - iscDbs.add(dbid); - } + for (DatabaseID dbid : availableVParmDatabases) { + if (dbid.getModelName().equals("ISC") && !iscDbs.contains(dbid)) { + iscDbs.add(dbid); } - for (DatabaseID dbid : availableVParmDatabases) { - if (dbid.getModelName().equals("ISC") - && !iscDbs.contains(dbid)) { - iscDbs.add(dbid); - } - } - for (DatabaseID dbid : availableServerDatabases) { - if (dbid.getModelName().equals("ISC") - && !iscDbs.contains(dbid)) { - iscDbs.add(dbid); - } + } + for (DatabaseID dbid : availableServerDatabases) { + if (dbid.getModelName().equals("ISC") && !iscDbs.contains(dbid)) { + iscDbs.add(dbid); } } }