From 945fe1db2f241901097dd47da8e7fe8bca7a7ec0 Mon Sep 17 00:00:00 2001 From: Ben Steffensmeier Date: Tue, 6 May 2014 16:15:37 -0500 Subject: [PATCH] Issue #3117 update satellite inventory for new sectors or elements. Former-commit-id: bbbf957ba88bada655413a58c6f3bf0a860dbced [formerly 35845fa63be35661893d31510f83e2d9ab6f60af] Former-commit-id: 70df0ee87ea89c8354eedbd30df661d625814436 --- .../META-INF/MANIFEST.MF | 3 +- .../inventory/SatelliteInventory.java | 33 ++++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/cave/com.raytheon.viz.satellite/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.satellite/META-INF/MANIFEST.MF index 3186ca34c3..7b2a3d75be 100644 --- a/cave/com.raytheon.viz.satellite/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.viz.satellite/META-INF/MANIFEST.MF @@ -28,7 +28,8 @@ Require-Bundle: org.eclipse.ui, com.raytheon.uf.viz.datacube;bundle-version="1.14.0", com.raytheon.uf.common.dataplugin.level, com.raytheon.uf.common.comm, - com.raytheon.uf.common.numeric + com.raytheon.uf.common.numeric, + com.raytheon.viz.alerts Bundle-ActivationPolicy: lazy Export-Package: com.raytheon.viz.satellite, com.raytheon.viz.satellite.rsc diff --git a/cave/com.raytheon.viz.satellite/src/com/raytheon/viz/satellite/inventory/SatelliteInventory.java b/cave/com.raytheon.viz.satellite/src/com/raytheon/viz/satellite/inventory/SatelliteInventory.java index 6bfda8f9f8..3f94381331 100644 --- a/cave/com.raytheon.viz.satellite/src/com/raytheon/viz/satellite/inventory/SatelliteInventory.java +++ b/cave/com.raytheon.viz.satellite/src/com/raytheon/viz/satellite/inventory/SatelliteInventory.java @@ -53,6 +53,9 @@ import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.time.DataTime; +import com.raytheon.uf.viz.core.alerts.AlertMessage; +import com.raytheon.viz.alerts.IAlertObserver; +import com.raytheon.viz.alerts.observers.ProductAlertObserver; /** * Inventory of available satellite data. sectorID is used for source and @@ -65,13 +68,15 @@ import com.raytheon.uf.common.time.DataTime; * Date Ticket# Engineer Description * ------------- -------- ----------- -------------------------- * Apr 09, 2014 2947 bsteffen Initial creation + * May 06, 2014 3117 bsteffen Update for new data. * * * * @author bsteffen * @version 1.0 */ -public class SatelliteInventory extends AbstractInventory { +public class SatelliteInventory extends AbstractInventory implements + IAlertObserver { private static final IUFStatusHandler statusHandler = UFStatus .getHandler(SatelliteInventory.class); @@ -88,6 +93,10 @@ public class SatelliteInventory extends AbstractInventory { private Level level; + public SatelliteInventory() { + ProductAlertObserver.addObserver(SATELLITE, this); + } + @Override public List timeAgnosticQuery(Map query) { /* Returning null means no data will be time agnostic. */ @@ -226,4 +235,26 @@ public class SatelliteInventory extends AbstractInventory { } } + @Override + public void alertArrived(Collection alertMessages) { + if (dataTree == null) { + return; + } + for (AlertMessage message : alertMessages) { + String sector = message.decodedAlert.get(SECTOR_ID).toString(); + String pe = message.decodedAlert.get(PHYSICALELEMENT).toString(); + if (dataTree.getParameterNode(sector, pe) == null) { + /* + * When a sector or element arrives that is not known reinit the + * tree to ensure no nodes are missing. + */ + try { + initTree(derParLibrary); + } catch (DataCubeException e) { + statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); + } + return; + } + } + } }