diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/textproducts/AreaDictionaryMaker.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/textproducts/AreaDictionaryMaker.java
index 125638bc4e..1215abd40d 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/textproducts/AreaDictionaryMaker.java
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/textproducts/AreaDictionaryMaker.java
@@ -34,13 +34,14 @@ import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
+import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.python.PyUtil;
import com.raytheon.uf.common.python.PythonScript;
import com.raytheon.uf.common.util.FileUtil;
/**
- * TODO Add Description
+ * Area Dictionary Maker
*
*
*
@@ -49,6 +50,7 @@ import com.raytheon.uf.common.util.FileUtil;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 4, 2011 wldougher Moved from MapManager
+ * Oct 8, 2014 #4953 randerso Added hooks for TCVAreaDictionary creation
*
*
*
@@ -66,21 +68,21 @@ public class AreaDictionaryMaker {
* Generate the AreaDictionary.py and CityLocation.py scripts for site,
* using editAreaAttrs.
*
- * @param site
+ * @param siteID
* The site for which the area dictionary file and city location
* file should be generated.
* @param editAreaAttrs
* A Map from edit area names to shape file attributes
*/
- public void genAreaDictionary(String site,
+ public void genAreaDictionary(String siteID,
Map> editAreaAttrs) {
theLogger.info("Area Dictionary generation phase");
- if (site == null) {
+ if (siteID == null) {
throw new IllegalArgumentException("site is null");
}
- if ("".equals(site)) {
+ if ("".equals(siteID)) {
throw new IllegalArgumentException("site is an empty string");
}
@@ -102,7 +104,7 @@ public class AreaDictionaryMaker {
LocalizationContext caveStaticConfig = pathMgr.getContext(
LocalizationContext.LocalizationType.CAVE_STATIC,
LocalizationContext.LocalizationLevel.CONFIGURED);
- caveStaticConfig.setContextName(site);
+ caveStaticConfig.setContextName(siteID);
File outputDirFile = pathMgr.getLocalizationFile(caveStaticConfig,
FileUtil.join("gfe", "userPython", "textUtilities", "regular"))
.getFile();
@@ -119,6 +121,19 @@ public class AreaDictionaryMaker {
// createCityLocation uses script globals modified by
// createAreaDictionary()
pyScript.execute("createCityLocation", argMap);
+
+ // check to see if Hazard_TCV was configured for this site
+ LocalizationFile lf = pathMgr.getLocalizationFile(caveStaticConfig,
+ FileUtil.join("gfe", "userPython", "textProducts",
+ "Hazard_TCV.py"));
+ if (lf.exists()) {
+ // TODO: Sarah add your TCVAreaDictionary creation code here
+ // if you add your code as a new method in
+ // createAreaDictionary.py which is probably the easiest way to
+ // do it, you can run it with the following line:
+ // pyScript.execute("createTCVAreaDictionary", argMap);
+ }
+
} catch (JepException e) {
theLogger.error("Error generating area dictionary", e);
} finally {
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/watch/AbstractWatchNotifierSrv.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/watch/AbstractWatchNotifierSrv.java
index 3760e764aa..c8c123aa9b 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/watch/AbstractWatchNotifierSrv.java
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/watch/AbstractWatchNotifierSrv.java
@@ -19,14 +19,13 @@
**/
package com.raytheon.edex.plugin.gfe.watch;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import java.util.Set;
-import com.raytheon.edex.plugin.gfe.config.GFESiteActivation;
+import com.raytheon.edex.plugin.gfe.server.IFPServer;
import com.raytheon.edex.plugin.gfe.util.SendNotifications;
import com.raytheon.uf.common.activetable.VTECPartners;
-import com.raytheon.uf.common.dataplugin.PluginDataObject;
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.server.notify.UserMessageNotification;
@@ -46,7 +45,9 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
- * Jun 10, 2014 #3268 dgilling Initial creation
+ * Jun 10, 2014 #3268 dgilling Initial creation
+ * Oct 08, 2014 #4953 randerso Refactored AbstractWatchNotifierSrv to allow
+ * subclasses to handle all watches if desired.
*
*
*
@@ -61,31 +62,19 @@ public abstract class AbstractWatchNotifierSrv {
protected final String watchType;
- protected final String supportedPIL;
-
- protected AbstractWatchNotifierSrv(String watchType, String supportedPIL) {
+ protected AbstractWatchNotifierSrv(String watchType) {
this.watchType = watchType;
- this.supportedPIL = supportedPIL;
}
/**
* Processes the warning records and generates a notification for each
* currently activated GFE site if the storm affects the site.
*
- * @param pdos
- * A list of {@code PluginDataObject}s that are assumed to be
- * {@code AbstractWarningRecord}s all decoded from a common
- * warning product.
+ * @param warningRecs
+ * A list of {@code AbstractWarningRecord}s all decoded from a
+ * common warning product.
*/
- public final void handleWatch(List pdos) {
- List warningRecs = filterIncomingRecordsByPIL(pdos);
- if (warningRecs.isEmpty()) {
- String logMsg = String.format("%s notification: not %s product",
- watchType, supportedPIL);
- statusHandler.debug(logMsg);
- return;
- }
-
+ public void handleWatch(List warningRecs) {
/*
* We are making an assumption that all PDOs came from the same source
* product. This is a safe assumption because WarningDecoder processes
@@ -98,7 +87,7 @@ public abstract class AbstractWatchNotifierSrv {
String productText = warningRecs.get(0).getRawmessage();
Collection wfos = WatchProductUtil.findAttnWFOs(productText);
- for (String siteid : GFESiteActivation.getInstance().getActiveSites()) {
+ for (String siteid : getActiveSites()) {
if (!wfos.contains(siteid)) {
String logMsg = String.format(
"%s notification: my site %s not in ATTN list",
@@ -116,28 +105,8 @@ public abstract class AbstractWatchNotifierSrv {
}
}
- /**
- * Given a list of {@code PluginDataObject}s that are actually
- * {@code AbstractWarningRecord}s, filters the list for only those records
- * which have the right PIL code.
- *
- * @param pdos
- * List of {@code AbstractWarningRecord}s to filter.
- * @return The list of supported {@code AbstractWarningRecord}s as defined
- * by {@code getSupportedPIL}.
- */
- protected List filterIncomingRecordsByPIL(
- List pdos) {
- List warningRecords = new ArrayList();
- for (PluginDataObject pdo : pdos) {
- AbstractWarningRecord warning = (AbstractWarningRecord) pdo;
-
- if (warning.getPil().startsWith(supportedPIL)) {
- warningRecords.add(warning);
- }
- }
-
- return warningRecords;
+ protected Set getActiveSites() {
+ return IFPServer.getActiveSites();
}
/**
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/watch/SPCWatchSrv.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/watch/SPCWatchSrv.java
index b23010b10a..04255914c9 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/watch/SPCWatchSrv.java
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/watch/SPCWatchSrv.java
@@ -36,9 +36,11 @@ import com.raytheon.uf.common.dataplugin.warning.AbstractWarningRecord;
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
- * Oct 03, 2008 njensen Initial creation
- * Jul 10, 2009 #2590 njensen Added multiple site support
- * Jun 10, 2014 #3268 dgilling Re-factor based on AbstractWatchNotifierSrv.
+ * Oct 03, 2008 njensen Initial creation
+ * Jul 10, 2009 #2590 njensen Added multiple site support
+ * Jun 10, 2014 #3268 dgilling Re-factor based on AbstractWatchNotifierSrv.
+ * Oct 08, 2014 #4953 randerso Refactored AbstractWatchNotifierSrv to allow
+ * subclasses to handle all watches if desired.
*
*
* @author njensen
@@ -49,8 +51,6 @@ public final class SPCWatchSrv extends AbstractWatchNotifierSrv {
private static final String SPC_WATCH_TYPE = "SPC";
- private static final String SPC_SUPPORTED_PIL = "WOU";
-
private static final String SPC_SITE_ATTRIBUTE = "VTEC_SPC_SITE";
private static final String DEFAULT_SPC_SITE = "KNHC";
@@ -71,8 +71,11 @@ public final class SPCWatchSrv extends AbstractWatchNotifierSrv {
phenTextMap = Collections.unmodifiableMap(phenTextMapTemp);
}
+ /**
+ * Constructor
+ */
public SPCWatchSrv() {
- super(SPC_WATCH_TYPE, SPC_SUPPORTED_PIL);
+ super(SPC_WATCH_TYPE);
}
/*
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/watch/TPCWatchSrv.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/watch/TPCWatchSrv.java
index ac8cc6de15..4756d4abf8 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/watch/TPCWatchSrv.java
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/watch/TPCWatchSrv.java
@@ -39,9 +39,13 @@ import com.raytheon.uf.common.dataplugin.warning.AbstractWarningRecord;
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
- * Oct 03, 2008 njensen Initial creation
- * Jul 10, 2009 #2590 njensen Added multiple site support
- * Jun 10, 2014 #3268 dgilling Re-factor based on AbstractWatchNotifierSrv.
+ * Oct 03, 2008 njensen Initial creation
+ * Jul 10, 2009 #2590 njensen Added multiple site support
+ * Jun 10, 2014 #3268 dgilling Re-factor based on AbstractWatchNotifierSrv.
+ * Oct 08, 2014 #4953 randerso Refactored AbstractWatchNotifierSrv to allow
+ * subclasses to handle all watches if desired.
+ * Added hooks for TCVAdvisory creation
+ *
*
*
* @author njensen
@@ -52,13 +56,11 @@ public final class TPCWatchSrv extends AbstractWatchNotifierSrv {
private static final String TPC_WATCH_TYPE = "TPC";
- private static final String TPC_SUPPORTED_PIL = "TCV";
-
private static final String TPC_SITE_ATTRIBUTE = "VTEC_TPC_SITE";
private static final String DEFAULT_TPC_SITE = "KNHC";
- private static final String ALERT_TXT = "Alert: %s has arrived from TPC. "
+ private static final String ALERT_TXT = "Alert: TCV has arrived from TPC. "
+ "Check for 'red' locks (owned by others) on your Hazard grid and resolve them. "
+ "If hazards are separated into temporary grids, please run Mergehazards. "
+ "Next...save Hazards grid. Finally, select PlotTPCEvents from Hazards menu.";
@@ -83,8 +85,31 @@ public final class TPCWatchSrv extends AbstractWatchNotifierSrv {
actMap = Collections.unmodifiableMap(actMapTemp);
}
+ /**
+ * Constructor
+ */
public TPCWatchSrv() {
- super(TPC_WATCH_TYPE, TPC_SUPPORTED_PIL);
+ super(TPC_WATCH_TYPE);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.raytheon.edex.plugin.gfe.watch.AbstractWatchNotifierSrv#handleWatch
+ * (java.util.List)
+ */
+ @Override
+ public void handleWatch(List warningRecs) {
+ super.handleWatch(warningRecs);
+
+ for (String siteId : getActiveSites()) {
+ for (AbstractWarningRecord record : warningRecs) {
+ // TODO: Sarah, add a call to your method that
+ // handles the TCV here:
+ // example: processTCV(siteID, record);
+ }
+ }
}
/*
@@ -123,8 +148,7 @@ public final class TPCWatchSrv extends AbstractWatchNotifierSrv {
}
// create the message
- StringBuilder msg = new StringBuilder(String.format(ALERT_TXT,
- supportedPIL));
+ StringBuilder msg = new StringBuilder(ALERT_TXT);
for (String phensigStorm : phensigStormAct.keySet()) {
Collection acts = phensigStormAct.get(phensigStorm);
String[] splitKey = phensigStorm.split(":");
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/common_static/base/notification/gfe-watch.xml b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/common_static/base/notification/gfe-watch.xml
index 18ab30e28c..0174ddc52c 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/common_static/base/notification/gfe-watch.xml
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/common_static/base/notification/gfe-watch.xml
@@ -7,6 +7,9 @@
+
+
+
@@ -17,6 +20,9 @@
+
+
+