Omaha #4383: EDEX support for alternate ISC databases with non-standard masking.

Change-Id: Ife4cae92aa1b097f2606396f9e11a7d17dc06d2a

Former-commit-id: aac0b3bd84a1753e816bd102cec8336e32aa0db9
This commit is contained in:
David Gillingham 2015-04-08 16:11:20 -05:00
parent 2c0ed92ce6
commit 192069c88d
7 changed files with 236 additions and 51 deletions

View file

@ -20,8 +20,10 @@
package com.raytheon.edex.plugin.gfe.config;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@ -56,6 +58,7 @@ import com.raytheon.uf.common.dataplugin.gfe.weather.WxDefinition;
* 06/24/13 #2044 randerso Renamed satdirs to satdata to match serverConfig.py
* 08/14/2013 #1571 randerso Changed to use ProjectionType enum
* 03/05/2015 #4169 randerso Changed model name mappings to return null if no mapping
* 04/09/2015 #4383 dgilling Support FireWx ISC.
*
* </pre>
*
@ -164,6 +167,8 @@ public class IFPServerConfig {
private long _protocolVersion = 20080905;
private Collection<ISCRoutingConfig> iscRoutingConfig;
private String convertToString(final DatabaseID id) {
return id.getModelId();
}
@ -194,6 +199,7 @@ public class IFPServerConfig {
_desiredDbVersions = new HashMap<String, Integer>();
_gridPurgeAge = new HashMap<String, Integer>();
_gridDbConfig = new HashMap<String, GridDbConfig>();
iscRoutingConfig = Collections.emptyList();
}
protected IFPServerConfig(final SimpleServerConfig config) {
@ -554,6 +560,8 @@ public class IFPServerConfig {
DatabaseID.NO_MODEL_TIME);
setDesiredDbVersions(dbid, versions);
}
iscRoutingConfig = config.iscRoutingConfig;
}
/**
@ -844,4 +852,12 @@ public class IFPServerConfig {
+ _officialDatabases + "\n" + "Sites: " + _siteID + "\n"
+ "TimeZones: " + _timeZones + "\n";
}
public Collection<String> alternateISCEditAreaMasks() {
Collection<String> retVal = new HashSet<>();
for (ISCRoutingConfig entry : iscRoutingConfig) {
retVal.add(entry.getEditAreaPrefix());
}
return retVal;
}
}

View file

@ -0,0 +1,69 @@
/**
* 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.config;
import java.util.Collection;
/**
* Routing configuration data objection for supplemental ISC databases. Allows
* the list of defined weather elements to be additional mosaicked into the
* specified database name using the specified edit area type.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 09, 2015 #4383 dgilling Initial creation
*
* </pre>
*
* @author dgilling
* @version 1.0
*/
public final class ISCRoutingConfig {
private final Collection<String> parmNames;
private final String dbName;
private final String editAreaPrefix;
public ISCRoutingConfig(Collection<String> parmNames, String dbName,
String editAreaPrefix) {
this.parmNames = parmNames;
this.dbName = dbName;
this.editAreaPrefix = editAreaPrefix;
}
public Collection<String> getParmNames() {
return parmNames;
}
public String getDbName() {
return dbName;
}
public String getEditAreaPrefix() {
return editAreaPrefix;
}
}

View file

@ -20,6 +20,7 @@
package com.raytheon.edex.plugin.gfe.config;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@ -34,6 +35,7 @@ import com.raytheon.uf.common.dataplugin.gfe.config.ProjectionData;
* ------------ ---------- ----------- --------------------------
* 03/13/08 #1030 randerso Initial port
* 06/24/13 #2044 randerso Renamed satdirs to satdata to match serverConfig.py
* 04/09/15 #4383 dgilling Added addedISCRoutingConfig.
*
* </pre>
*
@ -110,6 +112,8 @@ public class SimpleServerConfig {
public List<String> officeTypes;
public Collection<ISCRoutingConfig> iscRoutingConfig;
public SimpleServerConfig() {
allowedNodes = new ArrayList<String>();
rpcPort = 0;

View file

@ -32,6 +32,7 @@ import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
@ -61,6 +62,7 @@ import com.raytheon.uf.common.dataplugin.gfe.reference.ReferenceData.CoordinateT
import com.raytheon.uf.common.dataplugin.gfe.reference.ReferenceID;
import com.raytheon.uf.common.dataplugin.gfe.sample.SampleData;
import com.raytheon.uf.common.dataplugin.gfe.sample.SampleId;
import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse;
import com.raytheon.uf.common.geospatial.MapUtil;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
@ -109,6 +111,9 @@ import com.vividsolutions.jts.simplify.TopologyPreservingSimplifier;
* Aug 27, 2014 #3563 randerso Fix issue where edit areas are regenerated unnecessarily
* Oct 20, 2014 #3685 randerso Changed structure of editAreaAttrs to keep zones from different maps separated
* Feb 19, 2015 #4125 rjpeter Fix jaxb performance issue
* Apr 08, 2015 #4383 dgilling Change ISC_Send_Area to be union of
* areas ISC_XXX and FireWxAOR_XXX.
*
* </pre>
*
* @author randerso
@ -417,6 +422,7 @@ public class MapManager {
i++;
}
writeISCMarker();
writeSpecialISCEditAreas();
long t1 = System.currentTimeMillis();
statusHandler.info("EditArea generation time: " + (t1 - t0) + " ms");
@ -480,6 +486,65 @@ public class MapManager {
}
}
private void writeSpecialISCEditAreas() {
statusHandler.debug("Creating: ISC_Tool_Area and ISC_Send_Area.");
ReferenceMgr refDataMgr = new ReferenceMgr(_config);
String thisSite = _config.getSiteID().get(0);
List<ReferenceData> areas = new ArrayList<>();
List<String> editAreaNames = new ArrayList<>();
ReferenceData iscSendArea = null;
ReferenceID iscAreaName = new ReferenceID("ISC_" + thisSite);
ServerResponse<List<ReferenceData>> sr = refDataMgr.getData(Arrays
.asList(iscAreaName));
if (sr.isOkay()) {
iscSendArea = new ReferenceData(sr.getPayload().get(0));
iscSendArea.setId(new ReferenceID("ISC_Send_Area"));
areas.add(iscSendArea);
editAreaNames.add(iscSendArea.getId().getName());
ReferenceData toolArea = createSwathArea("ISC_Tool_Area",
iscSendArea, 4);
if (toolArea != null) {
areas.add(toolArea);
editAreaNames.add(toolArea.getId().getName());
}
} else {
String errorMsg = String.format(
"Could not retrieve ISC edit area for site %s: %s",
thisSite, sr.message());
statusHandler.error(errorMsg);
return;
}
Collection<String> altISCEditAreas = _config
.alternateISCEditAreaMasks();
for (String altISCEditArea : altISCEditAreas) {
ReferenceID editAreaName = new ReferenceID(altISCEditArea
+ thisSite);
sr = refDataMgr.getData(Arrays.asList(editAreaName));
if (sr.isOkay()) {
ReferenceData refData = sr.getPayload().get(0);
iscSendArea.orEquals(refData);
} else {
String errorMsg = String
.format("Could not retrieve additional ISC edit area %s for site %s: %s. It will not be included in ISC_Send_Area defintion.",
editAreaName.getName(), thisSite, sr.message());
statusHandler.warn(errorMsg);
}
}
ReferenceData swath = createSwathArea("ISC_Swath", iscSendArea, 4);
if (swath != null) {
iscSendArea.orEquals(swath);
}
saveEditAreas(areas);
saveGroupList("ISC", editAreaNames);
}
/**
* Based on the supplied map configuration, creates edit areas, saves them,
* and updates group names. Handles special creation for ISC edit areas,
@ -517,36 +582,10 @@ public class MapManager {
List<String> knownSites = _config.allSites();
boolean anySites = false;
if (groupName.equals("ISC")) {
String thisSite = _config.getSiteID().get(0);
for (int i = 0; i < data.size(); i++) {
String n = data.get(i).getId().getName();
if ((n.length() == 7) && n.startsWith("ISC_")) {
String cwa = n.substring(4, 7);
if (cwa.equals(thisSite)) {
statusHandler
.debug("creating: ISC_Tool_Area and ISC_Send_Area"
+ " from "
+ data.get(i).getId().getName());
List<ReferenceData> areas = new ArrayList<ReferenceData>();
ReferenceData swath = createSwathArea(
"ISC_Tool_Area", data.get(i), 4);
if (swath != null) {
areas.add(swath);
list.add(swath.getId().getName());
}
ReferenceData extend = new ReferenceData(
data.get(i));
extend.setId(new ReferenceID("ISC_Send_Area"));
if (swath != null) {
extend.orEquals(swath);
}
areas.add(extend);
list.add(extend.getId().getName());
saveEditAreas(areas);
}
// Need some special sample sets for ISC
// Create ISC_Marker_Set if any CWA, use ISC_cwa areas

View file

@ -32,7 +32,8 @@
# ProjectionType enumeration
# 07/09/2014 #3146 randerso Added check for duplicate smartInit
# rferrel Corrected log to alertviz.
# 11/18/2014 #4953 randerso Added check for empty unit string
# 11/18/2014 #4953 randerso Added check for empty unit string
# 04/09/2015 #4383 dgilling Added support for FireWx ISC.
#
########################################################################
import types
@ -521,3 +522,22 @@ def otherParse(serverhost, mhsid, port,
autoConfigureNotifyTextProd, \
iscRoutingTableAddress, reqISCsites, requestISC, sendiscOnSave, \
sendiscOnPublish, reqISCparms, transmitScript
def parseAdditionalISCRouting(iscRoutingData):
from com.raytheon.edex.plugin.gfe.config import ISCRoutingConfig
retVal = ArrayList()
if iscRoutingData:
try:
iter(iscRoutingData)
except TypeError:
raise TypeError("AdditionalISCRouting should be a list or tuple.")
for entry in iscRoutingData:
(pyParms, dbName, editAreaPrefix) = check(entry, (list, str, str), "AdditionalISCRouting entry not in correct format.")
javaParms = ArrayList()
for parm in pyParms:
javaParms.add(str(parm[0]))
retVal.add(ISCRoutingConfig(javaParms, dbName, editAreaPrefix))
return retVal

View file

@ -54,7 +54,8 @@
# 01/19/2015 #4014 dgilling Added ETSS.
# 02/24/2015 #16692 byin Added RTMA. Removed gfsLR and GWW233
# 03/19/2015 #4300 randerso Remove GUMa as it is obsolete (per Shannon White)
# 04/08/2015 #4383 dgilling Define FireWX ISC configuration parameters.
#
########################################################################
#----------------------------------------------------------------------------
@ -1806,6 +1807,13 @@ localISCExtraParms = []
myOfficeType = SITES[GFESUITE_SITEID][5]
AdditionalISCRouting = [
# Configure by adding entries to this list in the form of:
# ([WeatherElements], ModelName, EditAreaPrefix)
# Example:
# ([Hazards, LAL, CWR], "ISCFire", "FireWxAOR_"),
]
if not BASELINE and siteImport('localConfig'):
#ensure office type is set properly in localConfig SITES[]
if len(SITES[GFESUITE_SITEID]) == 5:
@ -2180,6 +2188,14 @@ ISCPARMS.append(([Topo], Persistent))
DATABASES.append((Restore, RESTOREPARMS))
DATABASES.append((ISC, ISCPARMS))
for entry in AdditionalISCRouting:
(parmList, dbName, editAreaPrefix) = entry
parmList = list(parmList)
addedIscDbDefinition = (dbName, ) + ISC[1:]
addedIscParms = [(parmList, TC1)]
DATABASES.append((addedIscDbDefinition, addedIscParms))
#---------------------------------------------------------------------------
#
# General server configuration section
@ -2260,5 +2276,6 @@ def doIt():
IFPConfigServer.sendiscOnPublish = sendiscOnPublish
IFPConfigServer.requestedISCparms = requestedISCparms
IFPConfigServer.transmitScript = transmitScript
IFPConfigServer.iscRoutingConfig = doConfig.parseAdditionalISCRouting(AdditionalISCRouting)
doIt()

View file

@ -45,6 +45,7 @@ from java.util import ArrayList
# 01/24/14 2504 randerso removed obsolete A1 comments
# 12/08/2014 4953 randerso Added support for sending/receiving TCV files
# Additional code cleanup
# 04/08/2015 4383 dgilling Support FireWx ISC.
#
##
@ -198,29 +199,12 @@ def execIscDataRec(MSGID,SUBJECT,FILES):
elif SUBJECT == 'GET_ACTIVE_TABLE2':
IrtServer.getVTECActiveTable(dataFile, xmlFileBuf)
elif SUBJECT in ['ISCGRIDS', 'ISCGRIDS2']:
args = {"siteID": siteConfig.GFESUITE_SITEID,
"userID": 'SITE',
"databaseID": siteConfig.GFESUITE_SITEID+"_GRID__ISC_00000000_0000",
"parmsToProcess": [],
"blankOtherPeriods": True,
"startTime": None,
"endTime": None,
"altMask": None,
"replaceOnly": False,
"eraseFirst": False,
"announce": "ISC: ",
"renameWE": True,
"iscSends": False,
"inFiles": [dataFile],
"ignoreMask": False,
"adjustTranslate": True,
"deleteInput": True,
"parmsToIgnore": [],
"gridDelay": 0.0,
"logFileName": None}
mosaic = iscMosaic.IscMosaic(args)
mosaic.execute()
import localConfig
additionalISCRouting = []
if localConfig.AdditionalISCRouting:
additionalISCRouting = localConfig.AdditionalISCRouting
putISCGrids(dataFile, siteConfig.GFESUITE_SITEID, srcServer.get('site'), additionalISCRouting)
elif SUBJECT == 'ISCREQUEST':
IrtServer.serviceISCRequest(dataFile)
elif SUBJECT == 'PUT_TCV_FILES':
@ -241,6 +225,42 @@ def execIscDataRec(MSGID,SUBJECT,FILES):
# cleanup
purgeFiles(MSGID, FILES)
def putISCGrids(dataFile, destSite, srcSite, additionalISCRouting):
# iscMosaic now executes multiple times--once for the primary ISC database,
# and once more for each additional ISC database defined in the localConfig
args = {"siteID": destSite,
"userID": 'SITE',
"databaseID": destSite+"_GRID__ISC_00000000_0000",
"parmsToProcess": [],
"blankOtherPeriods": True,
"startTime": None,
"endTime": None,
"altMask": None,
"replaceOnly": False,
"eraseFirst": False,
"announce": "ISC: ",
"renameWE": True,
"iscSends": False,
"inFiles": [dataFile],
"ignoreMask": False,
"adjustTranslate": True,
"deleteInput": False,
"parmsToIgnore": [],
"gridDelay": 0.0,
"logFileName": None}
mosaic = iscMosaic.IscMosaic(args)
mosaic.execute()
for entry in additionalISCRouting:
(parms, dbName, editAreaPrefix) = entry
parmNameList = [parm[0] + "_SFC" for parm in parms]
args['parmsToProcess'] = parmNameList
args['databaseID'] = destSite + "_GRID__" + dbName + "_00000000_0000"
args['altMask'] = editAreaPrefix + srcSite
mosaic = iscMosaic.IscMosaic(args)
mosaic.execute()
#--------------------------------------------------------------------
# Main Routine
#--------------------------------------------------------------------