diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/parm/DbParm.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/parm/DbParm.java
index 927d92ce30..f392d9c32e 100644
--- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/parm/DbParm.java
+++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/parm/DbParm.java
@@ -83,6 +83,7 @@ import com.raytheon.viz.gfe.core.griddata.IGridData;
* 02/12/13 #1597 randerso Made save threshold a configurable value. Added detailed
* logging for save performance
* 04/23/13 #1949 rjpeter Added logging of number of records.
+ * 06/26/13 #2044 randerso Fixed error message priority
*
*
* @author chammack
@@ -313,8 +314,8 @@ public class DbParm extends Parm {
// failure
else {
- statusHandler.handle(Priority.EVENTA, "Unable to get grid for "
- + getParmID() + " tr=" + grid.getGridTime()
+ statusHandler.error("Unable to get grid for " + getParmID()
+ + " tr=" + grid.getGridTime()
+ ". Temporarily using default data");
IGridData g = makeEmptyGrid();
g.changeValidTime(grid.getGridTime(), false);
diff --git a/deltaScripts/13.6.1/UpdateGfeH5GroupFormat.py b/deltaScripts/13.6.1/UpdateGfeH5GroupFormat.py
new file mode 100644
index 0000000000..93af169580
--- /dev/null
+++ b/deltaScripts/13.6.1/UpdateGfeH5GroupFormat.py
@@ -0,0 +1,135 @@
+#!/usr/bin/env python
+##
+# 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.
+##
+
+#
+# Update GFE HDF5 Group format to include minutes
+#
+#
+#
+# SOFTWARE HISTORY
+#
+# Date Ticket# Engineer Description
+# ------------ ---------- ----------- --------------------------
+# 11/18/10 njensen Initial Creation.
+# 06/13/13 #2044 randerso Fixed to use correct python
+#
+#
+#
+import h5py
+import os
+import re
+import subprocess
+import traceback
+
+hdf5loc = "/awips2/edex/data/hdf5/gfe"
+# T::SFC::2013_07_04_06--2013_07_04_07
+oldGroupFormat = re.compile("(.+::.+::)(\d{4})_(\d\d)_(\d\d)_(\d\d)--(\d{4})_(\d\d)_(\d\d)_(\d\d)")
+
+# T::SFC::20130704_0600--20130704_0700
+newGroupFormat = re.compile("(.+::.+::)(\d{4})(\d\d)(\d\d)_(\d\d)(\d\d)--(\d{4})(\d\d)(\d\d)_(\d\d)(\d\d)")
+
+
+def updateFile(filePath):
+ print "Updating",filePath
+ h5File = h5py.File(filePath)
+ origGroups = h5File.keys()
+ for groupName in origGroups:
+ newMatch = newGroupFormat.match(groupName)
+ oldMatch = oldGroupFormat.match(groupName)
+ if newMatch:
+ #print "Found new format:", groupName
+ pass
+ elif oldMatch:
+ #print "Found old format:", groupName
+ (nameAndLevel, startYear, startMonth, startDay, startHour, endYear, endMonth, endDay, endHour)= oldMatch.groups()
+ newGroupName = nameAndLevel+startYear+startMonth+startDay+"_"+startHour+"00--"+endYear+endMonth+endDay+"_"+endHour+"00"
+ #print " New format:", newGroupName
+
+ # if new group already exists (partial conversion)
+ if newGroupName in origGroups:
+ newGroup = h5File[newGroupName]
+ # else create new group
+ else:
+ newGroup = h5File.create_group(newGroupName)
+
+ # move datasets from old group to new group
+ oldGroup = h5File[groupName]
+ dataSets = oldGroup.keys()
+ for dataSet in dataSets:
+ #print " Moving dataSet:",dataSet
+ newGroup[dataSet] = oldGroup[dataSet]
+ del oldGroup[dataSet]
+
+ # remove old group
+ del h5File[groupName]
+ else:
+ print "Unrecognized group found:",groupName
+
+ h5File.close()
+
+def repack(dir):
+ files = os.listdir(dir)
+ for file in files:
+ filePath = os.path.join(dir, file)
+ if os.path.isfile(filePath) and \
+ str(filePath).endswith(".h5") and \
+ not str(filePath).endswith("_GridParm.h5"):
+ repackFilePath = filePath+".repack"
+ try:
+ subprocess.check_call(("/awips2/tools/bin/h5repack", filePath, repackFilePath))
+ except:
+ print "h5repack failed:", filePath
+ continue
+
+ try:
+ os.remove(filePath)
+ os.rename(repackFilePath, filePath)
+ except:
+ print "error renaming repacked file:", repackFilePath
+ continue
+
+
+def processDir(dir):
+ singleton = False
+ for file in os.listdir(dir):
+ filePath = os.path.join(dir, file)
+ if os.path.isfile(filePath) and \
+ str(filePath).endswith(".h5"):
+ if str(filePath).endswith("_GridParm.h5"):
+ if (str(filePath).endswith("_00000000_0000_GridParm.h5")):
+ singleton = True
+ else:
+ updateFile(filePath)
+
+ elif os.path.isdir(filePath):
+ # skip the Topo and climo directories (climo is obsolete and should be removed)
+ if str(file) != 'Topo' and str(file) != 'climo':
+ processDir(filePath)
+
+ if singleton:
+ print "repacking singleton database:", dir
+ repack(dir)
+
+def main():
+ processDir(hdf5loc)
+
+if __name__ == '__main__':
+ main()
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 9035319bc5..139cafdda7 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
@@ -3,110 +3,65 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
+
+
+
+
-
-
-
+
+
+
+
-
-
+
+
-
+
-
+
-
+
-
-
-
-
-
-
- java.lang.Throwable
-
-
-
-
-
-
-
+
+
-
-
-
-
-
+
+
+
+
+
java.lang.Throwable
-
+
-
-
-
-
-
-
-
-
-
-
- java.lang.Throwable
-
-
-
-
-
-
-
+
+
-
-
+
+
java.lang.Throwable
-
+
-
+
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/res/spring/gfe-request.xml b/edexOsgi/com.raytheon.edex.plugin.gfe/res/spring/gfe-request.xml
index b1b68a4994..1f309ec22d 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/res/spring/gfe-request.xml
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/res/spring/gfe-request.xml
@@ -1,667 +1,533 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
+
-
-
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
-
-
-
-
+
+
+
+
+
-
+
-
+
-
-
-
-
-
+
+
+
+
+
-
+
-
-
-
+
-
+
-
+
-
-
-
+
-
-
-
-
-
-
-
-
-
- java.lang.Throwable
-
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- java.lang.Throwable
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- java.lang.Throwable
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- java.lang.Throwable
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
+ java.lang.Throwable
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ java.lang.Throwable
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ java.lang.Throwable
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ java.lang.Throwable
+
+
+
+
+
+
+
+
+
+
+
+
+
+
java.lang.Throwable
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/res/spring/gfe-spring.xml b/edexOsgi/com.raytheon.edex.plugin.gfe/res/spring/gfe-spring.xml
index d62b84fe78..a5af413870 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/res/spring/gfe-spring.xml
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/res/spring/gfe-spring.xml
@@ -2,31 +2,34 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -37,144 +40,171 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- java.lang.Throwable
-
-
-
-
-
-
-
-
-
-
- java.lang.Throwable
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+ java.lang.Throwable
+
+
+
+
+
+
+
+
+
+
+ java.lang.Throwable
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
-
-
+
+
java.lang.Throwable
-
+
-
-
-
-
+
+
-
+
java.lang.Throwable
-
+
-
+
-
-
-
-
-
-
- java.lang.Throwable
-
-
-
-
-
-
-
-
-
-
-
- java.lang.Throwable
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+ java.lang.Throwable
+
+
+
+
+
+
+
+
+
+
+
+ java.lang.Throwable
+
+
+
+
+
+
+
+
+
+
+
+ java.lang.Throwable
+
+
+
+
+
+
+
+
+
+
+
+ java.lang.Throwable
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/cache/d2dparms/D2DParmIdCache.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/cache/d2dparms/D2DParmIdCache.java
deleted file mode 100644
index f56c8d9a14..0000000000
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/cache/d2dparms/D2DParmIdCache.java
+++ /dev/null
@@ -1,393 +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.cache.d2dparms;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-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.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import com.raytheon.edex.plugin.gfe.config.IFPServerConfig;
-import com.raytheon.edex.plugin.gfe.config.IFPServerConfigManager;
-import com.raytheon.edex.plugin.gfe.exception.GfeConfigurationException;
-import com.raytheon.edex.plugin.gfe.server.GridParmManager;
-import com.raytheon.edex.plugin.gfe.server.database.D2DGridDatabase;
-import com.raytheon.edex.plugin.gfe.server.database.D2DSatDatabase;
-import com.raytheon.edex.plugin.gfe.server.database.D2DSatDatabaseManager;
-import com.raytheon.edex.plugin.gfe.server.database.GridDatabase;
-import com.raytheon.edex.plugin.gfe.server.notify.GfeIngestNotificationFilter;
-import com.raytheon.edex.plugin.gfe.util.SendNotifications;
-import com.raytheon.uf.common.dataplugin.PluginException;
-import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID;
-import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID;
-import com.raytheon.uf.common.dataplugin.gfe.exception.GfeException;
-import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse;
-import com.raytheon.uf.common.dataplugin.gfe.server.notify.DBInvChangeNotification;
-import com.raytheon.uf.common.dataplugin.gfe.server.notify.GridUpdateNotification;
-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.edex.database.DataAccessLayerException;
-import com.raytheon.uf.edex.site.SiteAwareRegistry;
-
-/**
- * This class stores D2D parmIDs for quick and efficient access.
- *
- *
- * SOFTWARE HISTORY
- * Date Ticket# Engineer Description
- * ------------ ---------- ----------- --------------------------
- * 01/08/09 1674 bphillip Initial creation
- * 11/05/12 #1310 dgilling Modify cache to listen to plugin
- * purged topic.
- * 01/18/13 #1504 randerso Moved D2D to GFE parameter name translation from
- * D2DParmIdCache toGfeIngestNotificationFilter.
- * Added code to match wind components and send
- * GridUpdateNotifications.
- * Mar 20, 2013 #1774 randerso Changed to use GFDD2DDao
- * Apr 01, 2013 #1774 randerso Moved wind component checking to GfeIngestNotificaionFilter
- * May 14, 2013 #2004 randerso Added DBInvChangeNotifications when D2D data is purged
- *
- *
- *
- * @author bphillip
- * @version 1.0
- */
-public class D2DParmIdCache {
- private static final transient IUFStatusHandler statusHandler = UFStatus
- .getHandler(D2DParmIdCache.class);
-
- /** The name this cache uses when being stored in the SharedObjectProvider */
- public static transient final String CACHE_NAME = "D2DParmIds";
-
- private static final Pattern RangeFilter = Pattern
- .compile("(.*?)\\d{1,2}hr");
-
- /** Map containing the ParmIDs */
- private Map> parmIds;
-
- private static D2DParmIdCache instance;
-
- public static synchronized D2DParmIdCache getInstance() {
- if (instance == null) {
- instance = new D2DParmIdCache();
- }
- return instance;
- }
-
- /**
- * Constructs a new D2DParmIdCache
- */
- public D2DParmIdCache() {
- parmIds = new HashMap>();
- }
-
- /**
- * Places a parmId into the cache
- *
- * @param parmId
- * The ParmID to add to the cache
- */
- public void putParmID(ParmID parmId) {
-
- D2DGridDatabase db = null;
- try {
-
- GridDatabase gridDb = GridParmManager.getDb(parmId.getDbId());
- if (gridDb instanceof D2DSatDatabase) {
- putParmIDInternal(parmId);
- return;
- } else if (gridDb instanceof D2DGridDatabase) {
- db = (D2DGridDatabase) gridDb;
- } else {
- putParmIDInternal(parmId);
- return;
- }
- } catch (GfeException e) {
- statusHandler.error("Error getting D2DGridDatabase for "
- + parmId.getDbId());
- putParmIDInternal(parmId);
- return;
- }
-
- if (!db.isParmInfoDefined(parmId)) {
- String abbrev = parmId.getParmName();
- Matcher matcher = RangeFilter.matcher(abbrev);
- if (matcher.matches()) {
- abbrev = matcher.group(1);
- ParmID tempParmID = new ParmID(abbrev, parmId.getDbId(),
- parmId.getParmLevel());
- if (db.isParmInfoDefined(tempParmID)) {
- parmId = tempParmID;
- }
- }
- }
- putParmIDInternal(parmId);
- }
-
- private void putParmIDInternal(ParmID parmId) {
- DatabaseID dbId = parmId.getDbId();
- synchronized (parmIds) {
- Set dbParms = parmIds.get(dbId);
- // Add the database entry to the map if it does not exist
- if (dbParms == null) {
- dbParms = new HashSet();
- parmIds.put(dbId, dbParms);
- }
-
- // Insert the ParmID into the map
- dbParms.add(parmId);
- }
- }
-
- /**
- * Places a collection of ParmIDs into the cache
- *
- * @param parmIds
- * The parmIDs to add
- */
- public void putParmIDList(Collection parmIds) {
- for (ParmID id : parmIds) {
- putParmID(id);
- }
- }
-
- /**
- * Retrieves all the ParmIDs for a given DatabaseID
- *
- * @param dbId
- * The DatabaseID to retrieve the ParmIDs for
- * @return The ParmIDs in the given DatabaseID
- */
- public List getParmIDs(DatabaseID dbId) {
- List parms = Collections.emptyList();
- synchronized (parmIds) {
- if (parmIds.containsKey(dbId)) {
- parms = new ArrayList(parmIds.get(dbId));
- }
- }
- return parms;
- }
-
- /**
- * Retrieves all the ParmIDs for a given DatabaseID
- *
- * @param dbId
- * The String representation of the DatabaseID to retrieve the
- * ParmIDs for
- * @return The ParmIDs in the given DatabaseID
- */
- public List getParmIDs(String dbId) {
- return getParmIDs(new DatabaseID(dbId));
- }
-
- /**
- * Retrieves all DatabaseIDs
- *
- * @return The list of DatabaseIDs
- */
- public List getDatabaseIDs() {
- List dbIds = null;
- synchronized (parmIds) {
- dbIds = new ArrayList(parmIds.keySet());
- }
- return dbIds;
- }
-
- public void removeSiteDbs(String siteID) {
-
- statusHandler.handle(Priority.EVENTA, "Purging " + siteID
- + " parmIDs from d2d parmID cache...");
-
- List dbInv;
-
- if (UFStatus.getHandler().isPriorityEnabled(Priority.DEBUG)) {
- StringBuffer msg = new StringBuffer();
- msg.append("\nRemoving site information from D2DParmIdCache\nInitial Database Inventory:\n");
- dbInv = getDatabaseIDs();
- for (DatabaseID dbId : dbInv) {
- msg.append(dbId.toString()).append("\n");
- }
- statusHandler.handle(Priority.DEBUG, msg.toString());
- }
-
- List dbsToRemove = new ArrayList();
- dbInv = getDatabaseIDs();
- for (DatabaseID dbId : dbInv) {
- if (dbId.getSiteId().equalsIgnoreCase(siteID)) {
- dbsToRemove.add(dbId);
- }
- }
-
- synchronized (this.parmIds) {
- for (DatabaseID dbId : dbsToRemove) {
- this.parmIds.remove(dbId);
- if (UFStatus.getHandler().isPriorityEnabled(Priority.DEBUG)) {
- statusHandler.handle(Priority.DEBUG,
- "D2dParmIdCache Removed " + dbId);
- }
- }
- }
-
- if (UFStatus.getHandler().isPriorityEnabled(Priority.DEBUG)) {
- StringBuffer msg = new StringBuffer();
- msg.append("\nD2DParmIdCache Post-Purge Database Inventory:\n");
- dbInv = getDatabaseIDs();
- for (DatabaseID dbId : dbInv) {
- msg.append(dbId.toString()).append("\n");
- }
- statusHandler.handle(Priority.DEBUG, msg.toString());
- }
-
- statusHandler.handle(Priority.EVENTA, "Successfully purged all "
- + siteID + " parmIDs from d2d parmID cache...");
- }
-
- /**
- * Refreshes the cache for the given site. This is called upon site
- * activation. Also, the cache is rebuilt when the grib plugin purges its
- * data. The grib plugin will put a message on a topic so all members of the
- * cluster will know to rebuild their caches with the updated grib
- * inventory.
- *
- * @param site
- * The site to rebuild the cache for. If this is null, then that
- * means this method is being fired off as the result of a grib
- * purge
- * @throws PluginException
- * If errors occur when interacting with the database.
- * @throws GfeConfigurationException
- * If errors occur while retrieving the server config for the
- * given site
- */
- public void buildCache(String site) throws PluginException,
- GfeConfigurationException {
- String[] activeSites = null;
- if (site == null || site.isEmpty()) {
- activeSites = SiteAwareRegistry.getInstance().getActiveSites();
- } else {
- activeSites = new String[] { site };
- }
- for (String siteID : activeSites) {
- List dbsToRemove = this.getDatabaseIDs();
- statusHandler.handle(Priority.EVENTA,
- "Building D2DParmIdCache for " + siteID + "...");
- IFPServerConfig config = IFPServerConfigManager
- .getServerConfig(siteID);
- Set parmIds = new HashSet();
- long start = System.currentTimeMillis();
- List d2dModels = config.getD2dModels();
- for (String d2dModelName : d2dModels) {
- String gfeModel = config.gfeModelNameMapping(d2dModelName);
-
- if ((d2dModelName != null) && (gfeModel != null)) {
- List dbIds = null;
- try {
- dbIds = D2DGridDatabase.getD2DDatabaseIdsFromDb(config,
- d2dModelName);
- } catch (DataAccessLayerException e) {
- throw new PluginException(
- "Unable to get D2D Database Ids from database!",
- e);
- }
-
- if (!dbIds.isEmpty()) {
- int versions = Math.min(
- config.desiredDbVersions(dbIds.get(0)),
- dbIds.size());
-
- for (int i = 0; i < versions; i++) {
- try {
- D2DGridDatabase db = (D2DGridDatabase) GridParmManager
- .getDb(dbIds.get(i));
- ServerResponse> sr = db
- .getParmList();
- if (sr.isOkay()) {
- parmIds.addAll(sr.getPayload());
- }
- } catch (GfeException e) {
- throw new PluginException(
- "Error adding parmIds to D2DParmIdCache!!",
- e);
- }
- }
- }
-
- }
- }
- parmIds.addAll(D2DSatDatabaseManager.getSatDatabase(siteID)
- .getParmList().getPayload());
- removeSiteDbs(siteID);
- putParmIDList(parmIds);
- List currentDbInventory = this.getDatabaseIDs();
- dbsToRemove.removeAll(currentDbInventory);
- List invChgList = new ArrayList(
- dbsToRemove.size());
- for (DatabaseID dbId : dbsToRemove) {
- invChgList.add(new DBInvChangeNotification(null, Arrays
- .asList(dbId), siteID));
- }
- SendNotifications.send(invChgList);
-
- // inform GfeIngestNotificationFilter of removed dbs
- GfeIngestNotificationFilter.purgeDbs(dbsToRemove);
-
- statusHandler.handle(Priority.EVENTA,
- "Total time to build D2DParmIdCache for " + siteID
- + " took " + (System.currentTimeMillis() - start)
- + " ms");
- }
- }
-
- /**
- * Counts the number of parmIds currently in the cache
- *
- * @return The number of parmIds currently in the cache
- */
- public long getSize() {
- long size = 0;
- synchronized (parmIds) {
- for (Set parms : parmIds.values()) {
- size += parms.size();
- }
- }
- return size;
- }
-
- public void pluginPurged(String pluginName)
- throws GfeConfigurationException, PluginException {
- if (pluginName.equals("grid")) {
- buildCache(null);
- }
- }
-
- public void processGridUpdateNotification(GridUpdateNotification gun) {
- ParmID parmId = gun.getParmId();
- putParmID(parmId);
- }
-}
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/cache/d2dparms/D2DParmIdFilter.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/cache/d2dparms/D2DParmIdFilter.java
deleted file mode 100644
index c7096adedb..0000000000
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/cache/d2dparms/D2DParmIdFilter.java
+++ /dev/null
@@ -1,63 +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.cache.d2dparms;
-
-import java.util.List;
-
-import com.raytheon.uf.common.dataplugin.gfe.server.notify.GfeNotification;
-import com.raytheon.uf.common.dataplugin.gfe.server.notify.GridUpdateNotification;
-
-/**
- * Extracts a ParmID from a GribRecord. This class is used as part of the ESB
- * route which updates the D2DParmIdCache as products arrive.
- *
- *
- * SOFTWARE HISTORY
- * Date Ticket# Engineer Description
- * ------------ ---------- ----------- --------------------------
- * 1/10/09 1674 bphillip Initial creation
- * 10/06/09 3172 njensen Based on grib notification
- * 01/18/13 #1504 randerso Changed to send full GridUpdateNotification
- * to D2DParmIdCache
- *
- *
- *
- * @author bphillip
- * @version 1.0
- */
-public class D2DParmIdFilter {
-
- /**
- * Extracts ParmIDs and insert times from a list of messages in the
- * container.
- *
- * @param container
- * the container of messages
- */
- public void updateParmIdCache(List extends GfeNotification> notifications) {
- for (GfeNotification notify : notifications) {
- if (notify instanceof GridUpdateNotification) {
- D2DParmIdCache.getInstance().processGridUpdateNotification(
- (GridUpdateNotification) notify);
- }
- }
- }
-}
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/cache/ifpparms/IFPParmIdCache.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/cache/ifpparms/IFPParmIdCache.java
deleted file mode 100644
index 647fe6a7dc..0000000000
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/cache/ifpparms/IFPParmIdCache.java
+++ /dev/null
@@ -1,119 +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.cache.ifpparms;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import com.raytheon.edex.plugin.gfe.config.GridDbConfig;
-import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID;
-import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID;
-import com.raytheon.uf.common.status.IUFStatusHandler;
-import com.raytheon.uf.common.status.UFStatus;
-import com.raytheon.uf.common.status.UFStatus.Priority;
-
-public class IFPParmIdCache {
- private static final transient IUFStatusHandler statusHandler = UFStatus
- .getHandler(IFPParmIdCache.class);
-
- private static IFPParmIdCache instance;
-
- private Map> parmIds;
-
- public synchronized static IFPParmIdCache getInstance() {
- if (instance == null) {
- instance = new IFPParmIdCache();
- }
- return instance;
- }
-
- private IFPParmIdCache() {
- parmIds = new HashMap>();
- }
-
- public void removeSiteDbs(String siteID) {
- statusHandler.handle(Priority.EVENTA, "Purging " + siteID
- + " parmIDs from IFP parmID cache.");
-
- if (UFStatus.getHandler().isPriorityEnabled(Priority.DEBUG)) {
- StringBuffer msg = new StringBuffer();
- msg.append("\nRemoving site information from IFPParmIdCache\nInitial Database Inventory:\n");
- for (DatabaseID dbId : parmIds.keySet()) {
- msg.append(dbId.toString()).append("\n");
- }
- statusHandler.handle(Priority.DEBUG, msg.toString());
- }
-
- List dbsToRemove = new ArrayList();
- for (DatabaseID dbId : parmIds.keySet()) {
- if (dbId.getSiteId().equalsIgnoreCase(siteID)) {
- dbsToRemove.add(dbId);
- }
- }
-
- for (DatabaseID db : dbsToRemove) {
- parmIds.remove(db);
- if (UFStatus.getHandler().isPriorityEnabled(Priority.DEBUG)) {
- statusHandler.handle(Priority.DEBUG, "IFPParmIdCache Removed "
- + db);
- }
- }
-
- if (UFStatus.getHandler().isPriorityEnabled(Priority.DEBUG)) {
- StringBuffer msg = new StringBuffer();
- msg.append("\nIFPParmIdCache Post-Purge Database Inventory:\n");
- for (DatabaseID dbId : parmIds.keySet()) {
- msg.append(dbId.toString()).append("\n");
- }
- statusHandler.handle(Priority.DEBUG, msg.toString());
- }
-
- statusHandler.handle(Priority.EVENTA, "Successfully purged all "
- + siteID + " parmIDs from IFP parmID cache...");
-
- }
-
- public List getParmIds(GridDbConfig gridConfig, DatabaseID dbId) {
- synchronized (parmIds) {
- if (!parmIds.containsKey(dbId)) {
- addParmIds(gridConfig, dbId);
- }
- }
- return parmIds.get(dbId);
-
- }
-
- private void addParmIds(GridDbConfig gridConfig, DatabaseID dbId) {
- String key = null;
- List parmIdList = new ArrayList();
- for (Iterator iterator = gridConfig.get_gridInfoDict().keySet()
- .iterator(); iterator.hasNext();) {
- key = iterator.next();
- String[] nameLevel = key.split("_");
- parmIdList.add(new ParmID(nameLevel[0], dbId, nameLevel[1]));
- }
- synchronized (parmIds) {
- parmIds.put(dbId, parmIdList);
- }
- }
-}
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 ac19cd6994..0b393256f8 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
@@ -21,9 +21,7 @@ package com.raytheon.edex.plugin.gfe.config;
import java.net.InetAddress;
import java.net.UnknownHostException;
-import java.util.ArrayList;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ExecutorService;
@@ -31,26 +29,12 @@ import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
import com.google.common.util.concurrent.MoreExecutors;
-import com.raytheon.edex.plugin.gfe.cache.d2dparms.D2DParmIdCache;
-import com.raytheon.edex.plugin.gfe.cache.gridlocations.GridLocationCache;
-import com.raytheon.edex.plugin.gfe.cache.ifpparms.IFPParmIdCache;
-import com.raytheon.edex.plugin.gfe.db.dao.IscSendRecordDao;
import com.raytheon.edex.plugin.gfe.exception.GfeConfigurationException;
import com.raytheon.edex.plugin.gfe.exception.GfeMissingConfigurationException;
import com.raytheon.edex.plugin.gfe.isc.IRTManager;
-import com.raytheon.edex.plugin.gfe.reference.MapManager;
-import com.raytheon.edex.plugin.gfe.server.GridParmManager;
-import com.raytheon.edex.plugin.gfe.server.database.D2DGridDatabase;
-import com.raytheon.edex.plugin.gfe.server.database.D2DSatDatabaseManager;
-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.TopoDatabaseManager;
-import com.raytheon.edex.plugin.gfe.smartinit.SmartInitRecord;
+import com.raytheon.edex.plugin.gfe.server.IFPServer;
import com.raytheon.edex.site.SiteUtil;
import com.raytheon.uf.common.dataplugin.PluginException;
-import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID;
-import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID.DataType;
import com.raytheon.uf.common.dataplugin.gfe.exception.GfeException;
import com.raytheon.uf.common.site.notify.SiteActivationNotification;
import com.raytheon.uf.common.site.notify.SiteActivationNotification.ACTIVATIONSTATUS;
@@ -60,7 +44,6 @@ import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.edex.core.EDEXUtil;
import com.raytheon.uf.edex.core.EdexException;
-import com.raytheon.uf.edex.core.IMessageProducer;
import com.raytheon.uf.edex.database.DataAccessLayerException;
import com.raytheon.uf.edex.database.cluster.ClusterLockUtils;
import com.raytheon.uf.edex.database.cluster.ClusterLockUtils.LockState;
@@ -88,6 +71,7 @@ import com.raytheon.uf.edex.site.notify.SendSiteActivationNotifications;
* activation.
* Mar 20, 2013 #1774 randerso Changed to use GFED2DDao
* May 02, 2013 #1969 randerso Moved updateDbs method into IFPGridDatabase
+ * Jun 13, 2013 #2044 randerso Refactored to use IFPServer
*
*
*
@@ -111,7 +95,7 @@ public class GFESiteActivation implements ISiteActivationListener {
// minutes
private static final int SMART_INIT_TIMEOUT = 1800000;
- private static GFESiteActivation instance;
+ private static GFESiteActivation instance = new GFESiteActivation();
private boolean intialized = false;
@@ -119,13 +103,19 @@ public class GFESiteActivation implements ISiteActivationListener {
.getExitingExecutorService((ThreadPoolExecutor) Executors
.newCachedThreadPool());
- public static synchronized GFESiteActivation getInstance() {
- if (instance == null) {
- instance = new GFESiteActivation();
- }
+ /**
+ * @return the singleton instance
+ */
+ public static GFESiteActivation getInstance() {
return instance;
}
+ /**
+ * private constructor for singleton class
+ */
+ private GFESiteActivation() {
+ }
+
@Override
public void registered() {
this.intialized = true;
@@ -257,23 +247,17 @@ public class GFESiteActivation implements ISiteActivationListener {
} catch (GfeMissingConfigurationException e) {
sendActivationFailedNotification(siteID);
// Stack trace is not printed per requirement for DR14360
- statusHandler.handle(Priority.PROBLEM, siteID
- + " will not be activated: " + e.getLocalizedMessage());
+ statusHandler.warn(siteID + " will not be activated: "
+ + e.getLocalizedMessage());
throw e;
} catch (Exception e) {
sendActivationFailedNotification(siteID);
- statusHandler.handle(Priority.PROBLEM, siteID
- + " Error activating site " + siteID, e);
+ statusHandler.error(siteID + " Error activating site " + siteID, e);
throw e;
}
sendActivationCompleteNotification(siteID);
}
- public void cycleSite(String siteID) throws Exception {
- this.deactivateSite(siteID);
- this.activateSite(siteID);
- }
-
/**
* Activate site routine for internal use.
*
@@ -308,59 +292,12 @@ public class GFESiteActivation implements ISiteActivationListener {
IFPServerConfig config = null;
try {
- statusHandler.handle(Priority.EVENTA, "Activating " + siteID
- + "...");
+ statusHandler.info("Activating " + siteID + "...");
- statusHandler.handle(Priority.EVENTA,
- "IFPServerConfigManager initializing...");
+ statusHandler.info("IFPServerConfigManager initializing...");
config = IFPServerConfigManager.initializeSite(siteID);
- statusHandler.handle(Priority.EVENTA,
- "TopoDatabaseManager initializing...");
- TopoDatabaseManager.initializeTopoDatabase(siteID);
- // statusHandler.handle(Priority.EVENTA,
- // "ClimoDatabaseManager initializing...");
- // ClimoDatabaseManager.initializeClimoDatabase(siteID);
- // statusHandler.handle(Priority.EVENTA,
- // "HLSDatabaseManager initializing...");
- // HLSTopoDatabaseManager.initializeHLSTopoDatabase(siteID);
- // statusHandler.handle(Priority.EVENTA,
- // "D2DSatDatabaseManager initializing...");
- D2DSatDatabaseManager.initializeD2DSatDatabase(siteID, config);
-
- statusHandler.handle(Priority.EVENTA,
- "NetCDFDatabaseManager initializing...");
- NetCDFDatabaseManager.initializeNetCDFDatabases(config);
-
- statusHandler.handle(Priority.EVENTA, "MapManager initializing...");
- // should be cluster locked
- new MapManager(config);
-
- statusHandler
- .handle(Priority.EVENTA, "Getting GFE db inventory...");
- List inventory = GridParmManager.getDbInventory(siteID)
- .getPayload();
- Map> ifpInventory = new HashMap>();
- for (DatabaseID dbId : inventory) {
- if (!dbId.getDbType().equals("D2D")) {
- if (!ifpInventory.keySet().contains(dbId.getSiteId())) {
- ifpInventory.put(dbId.getSiteId(),
- new ArrayList());
- }
- ifpInventory.get(dbId.getSiteId()).add(dbId);
- }
- }
- statusHandler.handle(Priority.EVENTA,
- "Checking for IFPGridDatabase updates...");
- for (String site : ifpInventory.keySet()) {
- for (DatabaseID dbid : ifpInventory.get(site)) {
- GridDatabase db = GridParmManager.getDb(dbid);
- // cluster locked since IFPGridDatabase can modify the grids
- // based on changes to grid size, etc
- if (db instanceof IFPGridDatabase && db.databaseIsValid()) {
- ((IFPGridDatabase) db).updateDbs();
- }
- }
- }
+ statusHandler.info("Activating IFPServer...");
+ IFPServer ifpServer = IFPServer.activateServer(siteID, config);
} finally {
statusHandler
.handle(Priority.INFO,
@@ -369,7 +306,7 @@ public class GFESiteActivation implements ISiteActivationListener {
}
// Doesn't need to be cluster locked
- statusHandler.handle(Priority.EVENTA, "Checking ISC configuration...");
+ statusHandler.info("Checking ISC configuration...");
if (config.requestISC()) {
String host = InetAddress.getLocalHost().getCanonicalHostName();
String gfeHost = config.getServerHost();
@@ -381,116 +318,20 @@ public class GFESiteActivation implements ISiteActivationListener {
// but don't hard code request
if (host.contains(hostNameToCompare)
&& System.getProperty("edex.run.mode").equals("request")) {
- statusHandler.handle(Priority.EVENTA, "Enabling ISC...");
- IRTManager.getInstance().enableISC(siteID, config.getMhsid());
+ statusHandler.info("Enabling ISC...");
+ IRTManager.getInstance().enableISC(siteID, config);
} else {
statusHandler.handle(Priority.EVENTA,
"ISC Enabled but will use another EDEX instance");
}
} else {
- statusHandler.handle(Priority.EVENTA, "ISC is not enabled.");
+ statusHandler.info("ISC is not enabled.");
}
// doesn't need to be cluster locked
- statusHandler.handle(Priority.EVENTA, "Building the D2DParmIDCache...");
- D2DParmIdCache.getInstance().buildCache(siteID);
final IFPServerConfig configRef = config;
- // TODO: should only be done once at
- // initial start of the configuration, or at least only once per
- // startup, use a separate cluster lock that won't run if lock
- // within last 5 minutes, move outside of site activation as this
- // just need to be done, doesn't matter that site isn't fully
- // activated, in fact would be best to only be done once site is
- // fully activated.
- Runnable smartInit = new Runnable() {
- @Override
- public void run() {
- long startTime = System.currentTimeMillis();
- // wait for system startup or at least 3 minutes
- while (!EDEXUtil.isRunning()
- || System.currentTimeMillis() > startTime + 180000) {
- try {
- Thread.sleep(15000);
- } catch (InterruptedException e) {
-
- }
- }
-
- ClusterTask ct = ClusterLockUtils.lookupLock(TASK_NAME,
- SMART_INIT_TASK_DETAILS + siteID);
- if (ct.getLastExecution() + SMART_INIT_TIMEOUT < System
- .currentTimeMillis()) {
- ct = ClusterLockUtils.lock(TASK_NAME,
- SMART_INIT_TASK_DETAILS + siteID,
- SMART_INIT_TIMEOUT, false);
- if (LockState.SUCCESSFUL.equals(ct.getLockState())) {
- boolean clearTime = false;
- try {
- List d2dModels = configRef.getD2dModels();
- List> idsByVersion = new ArrayList>(
- 5);
- for (String d2dModelName : d2dModels) {
-
- String gfeModel = configRef
- .gfeModelNameMapping(d2dModelName);
-
- if ((d2dModelName != null)
- && (gfeModel != null)) {
- int versions = configRef
- .desiredDbVersions(new DatabaseID(
- siteID, DataType.GRID, "",
- gfeModel));
- List dbIds = D2DGridDatabase
- .getD2DDatabaseIdsFromDb(configRef,
- d2dModelName, versions);
-
- while (versions > idsByVersion.size()) {
- idsByVersion.add(new ArrayList(
- d2dModels.size()));
- }
-
- int index = 0;
- for (DatabaseID id : dbIds) {
- List ids = idsByVersion
- .get(index++);
- ids.add(id.toString());
- }
- }
- }
- IMessageProducer producer = EDEXUtil
- .getMessageProducer();
- for (List ids : idsByVersion) {
- for (String id : ids) {
- statusHandler.handle(Priority.EVENTA,
- "Firing smartinit for " + id);
- try {
- producer.sendAsyncUri(
- "jms-generic:queue:manualSmartInit",
- id
- + ":0::"
- + SmartInitRecord.SITE_ACTIVATION_INIT_PRIORITY);
- } catch (EdexException e) {
- statusHandler.handle(Priority.PROBLEM,
- "Failed to fire smart init for: "
- + id);
- }
- }
- }
- } catch (Exception e) {
- statusHandler.handle(Priority.ERROR,
- "Error occurred firing Smart Inits", e);
- clearTime = true;
- } finally {
- ClusterLockUtils.unlock(ct, clearTime);
- }
- }
- }
- }
- };
- postActivationTaskExecutor.submit(smartInit);
-
if (config.tableFetchTime() > 0) {
Runnable activateFetchAT = new Runnable() {
@@ -499,7 +340,7 @@ public class GFESiteActivation implements ISiteActivationListener {
long startTime = System.currentTimeMillis();
// wait for system startup or at least 3 minutes
while (!EDEXUtil.isRunning()
- || System.currentTimeMillis() > startTime + 180000) {
+ || (System.currentTimeMillis() > (startTime + 180000))) {
try {
Thread.sleep(15000);
} catch (InterruptedException e) {
@@ -536,11 +377,9 @@ public class GFESiteActivation implements ISiteActivationListener {
postActivationTaskExecutor.submit(activateFetchAT);
}
- statusHandler.handle(Priority.EVENTA, "Adding " + siteID
- + " to active sites list.");
+ statusHandler.info("Adding " + siteID + " to active sites list.");
IFPServerConfigManager.addActiveSite(siteID);
- statusHandler.handle(Priority.EVENTA, siteID
- + " successfully activated");
+ statusHandler.info(siteID + " successfully activated");
}
/**
@@ -552,7 +391,7 @@ public class GFESiteActivation implements ISiteActivationListener {
public void deactivateSite(String siteID) throws Exception {
sendDeactivationBeginNotification(siteID);
- if (!IFPServerConfigManager.getActiveSites().contains(siteID)) {
+ if (!IFPServer.getActiveSites().contains(siteID)) {
statusHandler.handle(Priority.DEBUG, "Site [" + siteID
+ "] not active. Cannot deactivate.");
sendDeactivationCompleteNotification(siteID);
@@ -572,37 +411,13 @@ public class GFESiteActivation implements ISiteActivationListener {
}
- IFPServerConfig config = IFPServerConfigManager
- .getServerConfig(siteID);
- if (config.requestISC()) {
- IRTManager.getInstance().disableISC(config.getMhsid(), siteID);
- }
-
- try {
- new IscSendRecordDao().deleteForSite(siteID);
- } catch (DataAccessLayerException e) {
- statusHandler.handle(Priority.PROBLEM,
- "Could not clear IscSendRecords for site " + siteID
- + " from queue.", e);
- }
-
- TopoDatabaseManager.removeTopoDatabase(siteID);
- // for (String source : ClimoDatabaseManager.getClimoSources()) {
- // ClimoDatabaseManager.removeClimoDatabase(siteID, source);
- // }
-
- NetCDFDatabaseManager.removeDatabases(siteID);
-
- D2DSatDatabaseManager.removeSatDatabase(siteID);
- D2DParmIdCache.getInstance().removeSiteDbs(siteID);
- IFPParmIdCache.getInstance().removeSiteDbs(siteID);
- GridParmManager.purgeDbCache(siteID);
- GridLocationCache.removeGridLocationsForSite(siteID);
- statusHandler.handle(Priority.EVENTA, siteID
- + " successfully deactivated");
+ IFPServer.deactivateServer(siteID);
+ statusHandler.info(siteID + " successfully deactivated");
+ // TODO eventually this should go away
IFPServerConfigManager.removeSite(siteID);
IFPServerConfigManager.removeActiveSite(siteID);
+
} catch (GfeConfigurationException e) {
statusHandler.handle(Priority.PROBLEM,
"Unable to get server config for site [" + siteID + "]", e);
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/config/IFPServerConfig.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/config/IFPServerConfig.java
index 7485d4bd0f..c58e3ed5da 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/config/IFPServerConfig.java
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/config/IFPServerConfig.java
@@ -53,6 +53,7 @@ import com.raytheon.uf.common.dataplugin.gfe.weather.WxDefinition;
* 04/08/08 #875 bphillip Changed exception handling
* 06/24/08 #1160 randerso Added a method to get the Topo dbId
* 07/09/09 #2590 njensen No longer singleton
+ * 06/24/13 #2044 randerso Renamed satdirs to satdata to match serverConfig.py
*
*
*
@@ -139,7 +140,7 @@ public class IFPServerConfig {
private Map _netCDFDirs;
- private Map _satDirs;
+ private Map _satData;
private int _tableFetchTime;
@@ -433,7 +434,7 @@ public class IFPServerConfig {
_mhsid = config.mhsid;
_tableFetchTime = config.tableFetchTime;
- _satDirs = config.satDirs;
+ _satData = config.satData;
_netCDFDirs = config.netCDFDirs;
_prdDir = config.prdDir;
_logFilePurgeAfter = config.logFilePurgeAfter;
@@ -760,8 +761,8 @@ public class IFPServerConfig {
_iscPort = p;
}
- public Map satDirs() {
- return _satDirs;
+ public Map satData() {
+ return _satData;
}
public Map netCDFDirs() {
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/config/SimpleServerConfig.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/config/SimpleServerConfig.java
index 1f4fdd9cc8..2b9d317226 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/config/SimpleServerConfig.java
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/config/SimpleServerConfig.java
@@ -33,6 +33,7 @@ import com.raytheon.uf.common.dataplugin.gfe.config.ProjectionData;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 03/13/08 #1030 randerso Initial port
+ * 06/24/13 #2044 randerso Renamed satdirs to satdata to match serverConfig.py
*
*
*
@@ -63,7 +64,7 @@ public class SimpleServerConfig {
public Map netCDFDirs;
- public Map satDirs;
+ public Map satData;
public boolean allowTopoBelowZero;
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/db/dao/GFED2DDao.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/db/dao/GFED2DDao.java
index be7fe5a742..9dca291adf 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/db/dao/GFED2DDao.java
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/db/dao/GFED2DDao.java
@@ -56,6 +56,7 @@ import com.raytheon.uf.edex.plugin.grid.dao.GridDao;
* suffix first.
* 05/22/13 #1974 randerso Fix bug introduced by the previous fix where query for
* T (T%hr) returned TP6hr
+ * 06/13/13 #2044 randerso Cleaned up JavaDoc
*
*
*
@@ -64,16 +65,18 @@ import com.raytheon.uf.edex.plugin.grid.dao.GridDao;
*/
// **********************************************************************
-// TODO: this was moved out of GFEDao and needs to be cleaned up to better
-// use the inherited GridDao functionality and hibernate instead of
-// SQL/HQL queries. Some parts of the queries could be pushed up to
-// GridDao
+// TODO: Can this be merged into GridDao/D2DGridDatabase?
// **********************************************************************
public class GFED2DDao extends GridDao {
private static final String FCST_TIME = "dataTime.fcstTime";
private static final String REF_TIME = "dataTime.refTime";
+ /**
+ * Constructor
+ *
+ * @throws PluginException
+ */
public GFED2DDao() throws PluginException {
super();
}
@@ -81,8 +84,9 @@ public class GFED2DDao extends GridDao {
/**
* Retrieves a list of available forecast times
*
- * @param dbId
- * The database ID to get the times for
+ * @param d2dModelName
+ * @param refTime
+ *
* @return The list of forecast times associated with the specified
* DatabaseID
* @throws DataAccessLayerException
@@ -105,10 +109,12 @@ public class GFED2DDao extends GridDao {
* Retrieves a GridRecord from the grib metadata database based on a ParmID,
* TimeRange, and GridParmInfo.
*
- * @param id
- * The parmID of the desired GridRecord
+ * @param d2dModelName
+ * @param refTime
+ * @param d2dParmName
+ * @param d2dLevel
* @param forecastTime
- * The foreCast time of the desired GridRecord, null for any
+ * The forecast time of the desired GridRecord, null for any
* record
* @param info
* The GridParmInfo for the requested d2d grid.
@@ -155,8 +161,10 @@ public class GFED2DDao extends GridDao {
* database which match the given ParmID. Session passed to allow reuse
* across multiple calls.
*
- * @param id
- * The ParmID to search with
+ * @param d2dModelName
+ * @param refTime
+ * @param d2dParmName
+ * @param d2dLevel
* @param s
* The database session to use
* @return The list of GridRecords from the grib metadata database which
@@ -256,8 +264,11 @@ public class GFED2DDao extends GridDao {
/**
* Retrieve the available Forecast Hours by D2D parm id.
*
- * @param id
- * @return the list of forecast hours
+ * @param d2dModelName
+ * @param refTime
+ * @param d2dParmName
+ * @param d2dLevel
+ * @return the list of forecast hours, empty if none
* @throws DataAccessLayerException
*/
public List queryFcstHourByParmId(String d2dModelName,
@@ -293,7 +304,7 @@ public class GFED2DDao extends GridDao {
*
* @param d2dModelName
* @param maxRecords
- * @return
+ * @return list of model run times, empty if none
* @throws DataAccessLayerException
*/
public List getModelRunTimes(String d2dModelName, int maxRecords)
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/db/dao/GFEDao.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/db/dao/GFEDao.java
index 82b419ab1d..987e28e24b 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/db/dao/GFEDao.java
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/db/dao/GFEDao.java
@@ -30,7 +30,6 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import org.hibernate.LockOptions;
import org.hibernate.Query;
@@ -42,8 +41,8 @@ import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.TransactionCallback;
import com.raytheon.edex.db.dao.DefaultPluginDao;
-import com.raytheon.edex.plugin.gfe.config.GFESiteActivation;
import com.raytheon.edex.plugin.gfe.server.GridParmManager;
+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.PluginException;
@@ -93,6 +92,7 @@ import com.raytheon.uf.edex.database.query.DatabaseQuery;
* 05/22/13 #2025 dgilling Re-implement functions needed by
* GetLatestDbTimeRequest and GetLatestModelDbIdRequest.
* 05/20/13 #2127 rjpeter Set session's to read only and switched to stateless where possible.
+ * 06/13/13 #2044 randerso Refactored to use IFPServer, code cleanup
*
*
* @author bphillip
@@ -102,6 +102,9 @@ public class GFEDao extends DefaultPluginDao {
// Number of retries on insert of a new DatabaseID
private static final int QUERY_RETRY = 2;
+ /**
+ * @throws PluginException
+ */
public GFEDao() throws PluginException {
super("gfe");
}
@@ -109,6 +112,8 @@ public class GFEDao extends DefaultPluginDao {
/**
* Creates a new GFE Dao
*
+ * @param pluginName
+ *
* @throws PluginException
*/
public GFEDao(String pluginName) throws PluginException {
@@ -120,7 +125,8 @@ public class GFEDao extends DefaultPluginDao {
* the row will be created.
*
* @param dbId
- * @return
+ * @return a DatabaseID with id field initialized
+ * @throws DataAccessLayerException
*/
public DatabaseID getDatabaseId(DatabaseID dbId)
throws DataAccessLayerException {
@@ -208,10 +214,9 @@ public class GFEDao extends DefaultPluginDao {
* Retrieves all known parm ids for the given database id.
*
* @param dbId
- * @return
+ * @return the list of ParmIDs for the database
* @throws DataAccessLayerException
*/
- @SuppressWarnings("unchecked")
public List getParmIds(final DatabaseID dbId)
throws DataAccessLayerException {
Session sess = null;
@@ -229,6 +234,7 @@ public class GFEDao extends DefaultPluginDao {
Query query = sess.createQuery("FROM ParmID WHERE dbId = ?");
query.setParameter(0, dbId);
+ @SuppressWarnings("unchecked")
List list = query.list();
tx.commit();
return list;
@@ -260,8 +266,9 @@ public class GFEDao extends DefaultPluginDao {
* Returns the database row for the passed parmId. If the row does not
* exist, the row will be created.
*
- * @param dbId
- * @return
+ * @param parmId
+ * @return the ParmID from the database with id field initialized
+ * @throws DataAccessLayerException
*/
public ParmID getParmId(final ParmID parmId)
throws DataAccessLayerException {
@@ -352,15 +359,15 @@ public class GFEDao extends DefaultPluginDao {
@Override
public void purgeExpiredData() throws PluginException {
- Set sites = GFESiteActivation.getInstance().getActiveSites();
- for (String siteID : sites) {
+ List ifpServers = IFPServer.getActiveServers();
+ for (IFPServer ifpServer : ifpServers) {
List gridNotifcations = new ArrayList();
List lockNotifications = new ArrayList();
try {
- GridParmManager.versionPurge(siteID);
- GridParmManager.gridsPurge(gridNotifcations, lockNotifications,
- siteID);
+ GridParmManager gridParmMgr = ifpServer.getGridParmMgr();
+ gridParmMgr.versionPurge();
+ gridParmMgr.gridsPurge(gridNotifcations, lockNotifications);
PurgeLogger.logInfo(
"Purging Expired pending isc send requests...", "gfe");
int requestsPurged = new IscSendRecordDao()
@@ -377,9 +384,16 @@ public class GFEDao extends DefaultPluginDao {
}
}
+ /**
+ * Purge all DatabaseIDs for a site
+ *
+ * @param siteID
+ * @return number of rows purged
+ * @throws DataAccessLayerException
+ */
public int purgeDatabaseForSite(final String siteID)
throws DataAccessLayerException {
- return (Integer) txTemplate.execute(new TransactionCallback() {
+ return txTemplate.execute(new TransactionCallback() {
@Override
public Integer doInTransaction(TransactionStatus status) {
return getHibernateTemplate().bulkUpdate(
@@ -391,20 +405,12 @@ public class GFEDao extends DefaultPluginDao {
/**
*
* @param records
- * @return
+ * @throws DataAccessLayerException
*/
public void save(final Collection records)
throws DataAccessLayerException {
// validate fields
for (GFERecord rec : records) {
- if (rec.getIdentifier() == null) {
- try {
- rec.constructDataURI();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
if (rec.getInsertTime() == null) {
rec.setInsertTime(Calendar.getInstance());
}
@@ -455,6 +461,7 @@ public class GFEDao extends DefaultPluginDao {
* the record, update all existing histories, and insert all new histories.
*
* @param existingRecords
+ * @throws DataAccessLayerException
*/
public void update(final Collection existingRecords)
throws DataAccessLayerException {
@@ -540,19 +547,21 @@ public class GFEDao extends DefaultPluginDao {
*
* @return The list of all database IDs currently being stored in the
* database
+ * @throws DataAccessLayerException
*/
- @SuppressWarnings("unchecked")
public List getDatabaseInventory(final String siteId)
throws DataAccessLayerException {
- // TODO: Should this be done from GridParmManager?
try {
- return (List) txTemplate
- .execute(new TransactionCallback() {
+ return txTemplate
+ .execute(new TransactionCallback>() {
@Override
public List doInTransaction(
TransactionStatus status) {
- return getHibernateTemplate().find(
- "FROM DatabaseID WHERE siteId = ?", siteId);
+ @SuppressWarnings("unchecked")
+ List result = getHibernateTemplate()
+ .find("FROM DatabaseID WHERE siteId = ?",
+ siteId);
+ return result;
}
});
} catch (Exception e) {
@@ -571,7 +580,6 @@ public class GFEDao extends DefaultPluginDao {
* @throws DataAccessLayerException
* If errors occur during the query
*/
- @SuppressWarnings("unchecked")
public List queryByParmID(final ParmID parmId)
throws DataAccessLayerException {
Session sess = null;
@@ -588,6 +596,7 @@ public class GFEDao extends DefaultPluginDao {
Query query = sess.createQuery("FROM GFERecord WHERE parmId = ?");
query.setParameter(0, parmId);
+ @SuppressWarnings("unchecked")
List list = query.list();
tx.commit();
return list;
@@ -615,10 +624,11 @@ public class GFEDao extends DefaultPluginDao {
}
/**
+ * Get all GFERecords whose time ranges overlap the specificed time range
*
* @param parmId
* @param tr
- * @return
+ * @return map of TimeRanges to GFERecords
* @throws DataAccessLayerException
*/
@SuppressWarnings("unchecked")
@@ -765,18 +775,19 @@ public class GFEDao extends DefaultPluginDao {
* @return The list of times for a given parm name and level
* @throws DataAccessLayerException
*/
- @SuppressWarnings("unchecked")
public List getTimes(final ParmID parmId)
throws DataAccessLayerException {
try {
- return (List) txTemplate
- .execute(new TransactionCallback() {
+ return txTemplate
+ .execute(new TransactionCallback>() {
@Override
public List doInTransaction(
TransactionStatus status) {
- return getHibernateTemplate()
+ @SuppressWarnings("unchecked")
+ List result = getHibernateTemplate()
.find("SELECT dataTime.validPeriod FROM GFERecord WHERE parmId = ? ORDER BY dataTime.validPeriod.start",
parmId);
+ return result;
}
});
} catch (Exception e) {
@@ -796,15 +807,15 @@ public class GFEDao extends DefaultPluginDao {
* @return The list of times for a given parm name and level
* @throws DataAccessLayerException
*/
- @SuppressWarnings("unchecked")
public List getOverlappingTimes(final ParmID parmId,
final TimeRange tr) throws DataAccessLayerException {
try {
- return (List) txTemplate
- .execute(new TransactionCallback() {
+ return txTemplate
+ .execute(new TransactionCallback>() {
@Override
public List doInTransaction(
TransactionStatus status) {
+ @SuppressWarnings("unchecked")
List rval = getHibernateTemplate()
.find("SELECT dataTime.validPeriod"
+ " FROM GFERecord WHERE parmId = ?"
@@ -896,6 +907,11 @@ public class GFEDao extends DefaultPluginDao {
return history;
}
+ /**
+ * Remove all GFE records for a particular DatabaseID
+ *
+ * @param dbId
+ */
public void purgeGFEGrids(final DatabaseID dbId) {
delete(dbId);
}
@@ -1003,7 +1019,8 @@ public class GFEDao extends DefaultPluginDao {
* @param parmId
* @param tr
* @param sentTime
- * @return
+ * @return the histories that were updated
+ * @throws DataAccessLayerException
*/
@SuppressWarnings("unchecked")
public Map> updateSentTime(
@@ -1081,6 +1098,13 @@ public class GFEDao extends DefaultPluginDao {
return history;
}
+ /**
+ * Delete a list of records from the database
+ *
+ * @param records
+ * @return number of records deleted
+ * @throws DataAccessLayerException
+ */
public int deleteRecords(Collection records)
throws DataAccessLayerException {
List ids = new ArrayList(records.size());
@@ -1122,7 +1146,13 @@ public class GFEDao extends DefaultPluginDao {
}
}
- @SuppressWarnings("unchecked")
+ /**
+ * Return the latest insert time for a database
+ *
+ * @param dbId
+ * @return latest insert time or null if no database has no records
+ * @throws DataAccessLayerException
+ */
public Date getMaxInsertTimeByDbId(final DatabaseID dbId)
throws DataAccessLayerException {
DatabaseQuery query = new DatabaseQuery(this.daoClass);
@@ -1132,6 +1162,7 @@ public class GFEDao extends DefaultPluginDao {
query.addOrder("insertTime", false);
query.setMaxResults(1);
+ @SuppressWarnings("unchecked")
List result = (List) this.queryByCriteria(query);
if (!result.isEmpty()) {
return result.get(0).getTime();
@@ -1140,21 +1171,31 @@ public class GFEDao extends DefaultPluginDao {
}
}
- @SuppressWarnings("unchecked")
+ /**
+ * Find DatabaseID of latest model run
+ *
+ * @param siteId
+ * @param modelName
+ * the name of the desired model
+ * @return the DatabaseID or null if none found
+ * @throws DataAccessLayerException
+ */
public DatabaseID getLatestDbIdByModelName(final String siteId,
final String modelName) throws DataAccessLayerException {
// TODO: Should this be done from GridParmManager?
List results = Collections.emptyList();
try {
final String[] queryParams = { siteId, modelName };
- results = (List) txTemplate
- .execute(new TransactionCallback() {
+ results = txTemplate
+ .execute(new TransactionCallback>() {
@Override
public List doInTransaction(
TransactionStatus status) {
- return getHibernateTemplate()
+ @SuppressWarnings("unchecked")
+ List result = getHibernateTemplate()
.find("FROM DatabaseID WHERE siteId = ? AND modelName = ? ORDER BY modelTime DESC LIMIT 1",
- queryParams);
+ (Object[]) queryParams);
+ return result;
}
});
} catch (Exception e) {
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/isc/GfeIRT.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/isc/GfeIRT.java
index c723397310..ae835c32b4 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/isc/GfeIRT.java
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/isc/GfeIRT.java
@@ -32,8 +32,7 @@ import jep.JepException;
import com.raytheon.edex.plugin.gfe.config.GridDbConfig;
import com.raytheon.edex.plugin.gfe.config.IFPServerConfig;
-import com.raytheon.edex.plugin.gfe.config.IFPServerConfigManager;
-import com.raytheon.edex.plugin.gfe.server.GridParmManager;
+import com.raytheon.edex.plugin.gfe.server.IFPServer;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GridLocation;
import com.raytheon.uf.common.dataplugin.gfe.exception.GfeException;
@@ -60,6 +59,7 @@ import com.raytheon.uf.common.util.FileUtil;
* ------------ ---------- ----------- --------------------------
* 07/14/09 1995 bphillip Initial creation
* Mar 14, 2013 1794 djohnson FileUtil.listFiles now returns List.
+ * 06/13/13 2044 randerso Refactored to use IFPServer
*
*
*
@@ -75,6 +75,8 @@ public class GfeIRT extends Thread {
/** The site ID associated with this IRT thread */
private final String siteID;
+ private final IFPServerConfig config;
+
/** The MHS ID associated with this IRT thread */
private final String mhsID;
@@ -96,10 +98,11 @@ public class GfeIRT extends Thread {
* The site ID to create the GfeIRT object for
* @throws GfeException
*/
- public GfeIRT(String mhsid, String siteid) throws GfeException {
+ public GfeIRT(String siteid, IFPServerConfig config) throws GfeException {
this.setDaemon(true);
this.siteID = siteid;
- this.mhsID = mhsid;
+ this.config = config;
+ this.mhsID = config.getMhsid();
IPathManager pathMgr = PathManagerFactory.getPathManager();
LocalizationContext cx = pathMgr.getContext(
LocalizationType.EDEX_STATIC, LocalizationLevel.BASE);
@@ -118,7 +121,7 @@ public class GfeIRT extends Thread {
}
};
java.lang.Runtime.getRuntime().addShutdownHook(hook);
- shutdownHooks.put(mhsid + siteid, hook);
+ shutdownHooks.put(mhsID + siteID, hook);
}
@Override
@@ -132,11 +135,8 @@ public class GfeIRT extends Thread {
script = new PythonScript(scriptFile, includePath);
Map args = new HashMap();
- IFPServerConfig config = IFPServerConfigManager
- .getServerConfig(siteID);
GridLocation domain = config.dbDomain();
- String site = config.getSiteID().get(0);
List gridDims = new ArrayList();
gridDims.add(domain.getNy());
gridDims.add(domain.getNx());
@@ -150,13 +150,15 @@ public class GfeIRT extends Thread {
// determine which parms are wanted
List parmsWanted = config.requestedISCparms();
if (parmsWanted.isEmpty()) {
- List dbs = GridParmManager.getDbInventory(site)
- .getPayload();
+ // TODO gridParmMgr should be passed in when GFEIRT created
+ // whole class needs clean up
+ List dbs = IFPServer.getActiveServer(siteID)
+ .getGridParmMgr().getDbInventory().getPayload();
for (int i = 0; i < dbs.size(); i++) {
if (dbs.get(i).getModelName().equals("ISC")
&& dbs.get(i).getDbType().equals("")
- && dbs.get(i).getSiteId().equals(site)) {
+ && dbs.get(i).getSiteId().equals(siteID)) {
GridDbConfig gdc = config.gridDbConfig(dbs.get(i));
parmsWanted = gdc.parmAndLevelList();
}
@@ -177,7 +179,7 @@ public class GfeIRT extends Thread {
LocalizationContext commonStaticConfig = pathMgr.getContext(
LocalizationType.COMMON_STATIC,
LocalizationLevel.CONFIGURED);
- commonStaticConfig.setContextName(site);
+ commonStaticConfig.setContextName(siteID);
File editAreaDir = pathMgr.getFile(commonStaticConfig,
"gfe/editAreas");
@@ -187,8 +189,8 @@ public class GfeIRT extends Thread {
return name.trim().matches("ISC_\\p{Alnum}{3}\\.xml");
}
};
- List editAreas = FileUtil.listFiles(editAreaDir,
- filter, false);
+ List editAreas = FileUtil.listFiles(editAreaDir, filter,
+ false);
String name = "";
for (File f : editAreas) {
@@ -206,7 +208,7 @@ public class GfeIRT extends Thread {
args.put("serverHost", config.getServerHost());
args.put("serverPort", config.getRpcPort());
args.put("serverProtocol", config.getProtocolVersion());
- args.put("site", site);
+ args.put("site", siteID);
args.put("parmsWanted", config.requestedISCparms());
args.put("gridDims", gridDims);
args.put("gridProj", domain.getProjection().getProjectionID()
@@ -224,10 +226,6 @@ public class GfeIRT extends Thread {
statusHandler
.fatal("Error starting GFE ISC. ISC functionality will be unavailable!!",
e);
- } catch (GfeException e) {
- statusHandler
- .fatal("Unable to get Mhs ID. ISC functionality will be unavailable!!",
- e);
} finally {
if (script != null) {
script.dispose();
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/isc/IRTManager.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/isc/IRTManager.java
index ac092a4dfe..b9885bf38a 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/isc/IRTManager.java
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/isc/IRTManager.java
@@ -27,6 +27,7 @@ import java.util.concurrent.ConcurrentHashMap;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import com.raytheon.edex.plugin.gfe.config.IFPServerConfig;
import com.raytheon.uf.common.dataplugin.gfe.exception.GfeException;
/**
@@ -39,6 +40,7 @@ import com.raytheon.uf.common.dataplugin.gfe.exception.GfeException;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 08/10/09 1995 bphillip Initial creation
+ * 06/13/13 2044 randerso Refactored to use IFPServer
*
*
*
@@ -81,13 +83,17 @@ public class IRTManager {
*
* @param siteID
* The site to activate ISC functionality for
+ * @param config
+ * server configuration
* @throws GfeException
* If the ISC functionality cannot be activated
*/
- public void enableISC(String siteID, String mhsID) throws GfeException {
+ public void enableISC(String siteID, IFPServerConfig config)
+ throws GfeException {
+ String mhsID = config.getMhsid();
if (!irtMap.containsKey(mhsID + "--" + siteID)) {
- irtMap.put(mhsID + "--" + siteID, new GfeIRT(mhsID, siteID));
+ irtMap.put(mhsID + "--" + siteID, new GfeIRT(siteID, config));
}
logger.info("Starting IRT registration thread for site [" + siteID
diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/isc/IscSendJob.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/isc/IscSendJob.java
index 6e8c94dd2f..e96d5562ad 100644
--- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/isc/IscSendJob.java
+++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/isc/IscSendJob.java
@@ -35,10 +35,11 @@ import com.raytheon.edex.plugin.gfe.config.GFESiteActivation;
import com.raytheon.edex.plugin.gfe.config.IFPServerConfig;
import com.raytheon.edex.plugin.gfe.config.IFPServerConfigManager;
import com.raytheon.edex.plugin.gfe.exception.GfeConfigurationException;
-import com.raytheon.edex.plugin.gfe.server.GridParmManager;
+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.GridDataHistory;
+import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID;
import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse;
import com.raytheon.uf.common.dataplugin.gfe.server.notify.GridHistoryUpdateNotification;
@@ -62,6 +63,7 @@ import com.raytheon.uf.edex.core.EDEXUtil;
* from queue into run().
* 04/23/13 #1949 rjpeter Move setting of lastSentTime to dao
* and removed initial delay.
+ * 06/13/13 2044 randerso Refactored to use IFPServer
*
*
* @author bphillip
@@ -198,24 +200,44 @@ public class IscSendJob implements Runnable {
}
try {
- GridDatabase gridDb = GridParmManager.getDb(id.getDbId());
- ServerResponse