VLab Issue #4953 Added support for managing JSON files in practice mode.
Change-Id: I081a11bd2ed9370c32354a0c5728400561f3d7f8 Former-commit-id: e8ac81c5850b8565ea1e375857cf9dfe531848a0
This commit is contained in:
parent
e54f3305d8
commit
9104023408
24 changed files with 532 additions and 728 deletions
|
@ -1,7 +1,7 @@
|
||||||
import GenericHazards
|
import GenericHazards
|
||||||
import JsonSupport
|
import JsonSupport
|
||||||
import string, time, os, re, types, copy, LogStream, collections
|
import string, time, os, errno, re, types, copy, collections
|
||||||
import ModuleAccessor, SampleAnalysis, EditAreaUtils
|
import LogStream, ModuleAccessor, SampleAnalysis, EditAreaUtils
|
||||||
import math
|
import math
|
||||||
|
|
||||||
|
|
||||||
|
@ -734,8 +734,14 @@ FORECASTER STEWART"""
|
||||||
|
|
||||||
def _getLocalAdvisoryDirectoryPath(self):
|
def _getLocalAdvisoryDirectoryPath(self):
|
||||||
file = self._synchronizeAdvisories()
|
file = self._synchronizeAdvisories()
|
||||||
|
|
||||||
path = file.getPath()
|
path = file.getPath()
|
||||||
|
|
||||||
|
try:
|
||||||
|
os.makedirs(path)
|
||||||
|
except OSError as exception:
|
||||||
|
if exception.errno != errno.EEXIST:
|
||||||
|
raise
|
||||||
|
|
||||||
return path
|
return path
|
||||||
|
|
||||||
def _loadLastTwoAdvisories(self):
|
def _loadLastTwoAdvisories(self):
|
||||||
|
@ -758,13 +764,14 @@ FORECASTER STEWART"""
|
||||||
|
|
||||||
def _loadAdvisory(self, advisoryName):
|
def _loadAdvisory(self, advisoryName):
|
||||||
self._synchronizeAdvisories()
|
self._synchronizeAdvisories()
|
||||||
|
fileName = self._getAdvisoryFilename(advisoryName)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
pythonDict = JsonSupport.loadFromJson(LocalizationType.CAVE_STATIC,
|
pythonDict = JsonSupport.loadFromJson(LocalizationType.CAVE_STATIC,
|
||||||
self._site,
|
self._site,
|
||||||
self._getAdvisoryFilename(advisoryName))
|
fileName)
|
||||||
|
|
||||||
print "SARAH: File contents for", self._getAdvisoryFilename(advisoryName), ":"
|
print "SARAH: File contents for", fileName, ":"
|
||||||
print pythonDict
|
print pythonDict
|
||||||
|
|
||||||
# Only use transmitted advisories
|
# Only use transmitted advisories
|
||||||
|
@ -773,23 +780,20 @@ FORECASTER STEWART"""
|
||||||
else:
|
else:
|
||||||
return pythonDict
|
return pythonDict
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print "SARAH Load Exception for %s : %s" % (self._getAdvisoryFilename(advisoryName), e)
|
print "SARAH Load Exception for %s : %s" % (fileName, e)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def _getAdvisoryPath(self):
|
def _getAdvisoryPath(self):
|
||||||
return "gfe/tcvAdvisories/"
|
dataMgr = self._argDict["dataMgr"]
|
||||||
|
gfeMode = dataMgr.getOpMode().name()
|
||||||
def _getLocalizationFile(self, loctype, siteID, filename):
|
if gfeMode == "PRACTICE":
|
||||||
pathManager = PathManagerFactory.getPathManager()
|
return os.path.join("gfe", "tcvAdvisories", "practice")
|
||||||
context = pathManager.getContextForSite(loctype, siteID)
|
else:
|
||||||
localizationFile = pathManager.getLocalizationFile(context, filename)
|
return os.path.join("gfe", "tcvAdvisories")
|
||||||
|
|
||||||
return localizationFile
|
|
||||||
|
|
||||||
def _getAdvisoryFilename(self, advisoryName):
|
def _getAdvisoryFilename(self, advisoryName):
|
||||||
advisoryFilename = self._getAdvisoryPath() + \
|
advisoryFilename = os.path.join(self._getAdvisoryPath(),
|
||||||
advisoryName + \
|
advisoryName+".json")
|
||||||
".json"
|
|
||||||
return advisoryFilename
|
return advisoryFilename
|
||||||
|
|
||||||
###############################################################
|
###############################################################
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.text.SimpleDateFormat;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
|
@ -38,7 +39,6 @@ import org.eclipse.swt.widgets.ProgressBar;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
import com.raytheon.uf.common.activetable.PracticeProductOfftimeRequest;
|
|
||||||
import com.raytheon.uf.common.activetable.SendPracticeProductRequest;
|
import com.raytheon.uf.common.activetable.SendPracticeProductRequest;
|
||||||
import com.raytheon.uf.common.activetable.response.GetNextEtnResponse;
|
import com.raytheon.uf.common.activetable.response.GetNextEtnResponse;
|
||||||
import com.raytheon.uf.common.dissemination.OUPRequest;
|
import com.raytheon.uf.common.dissemination.OUPRequest;
|
||||||
|
@ -84,6 +84,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
* Dec 18, 2013 2641 dgilling Support changes to GFEVtecUtil.getVtecLinesThatNeedEtn().
|
* Dec 18, 2013 2641 dgilling Support changes to GFEVtecUtil.getVtecLinesThatNeedEtn().
|
||||||
* Jan 06, 2014 2649 dgilling Make ETN assignment process optional.
|
* Jan 06, 2014 2649 dgilling Make ETN assignment process optional.
|
||||||
* Feb 17, 2014 2774 dgilling Merge changes from 14.1 baseline to 14.2.
|
* Feb 17, 2014 2774 dgilling Merge changes from 14.1 baseline to 14.2.
|
||||||
|
* Nov 14, 2014 4953 randerso Cleaned up practice product requests
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -541,26 +542,27 @@ public class StoreTransmitDlg extends CaveSWTDialog implements
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to transmit the product.
|
* Method to transmit the product.
|
||||||
|
*
|
||||||
|
* @param practice
|
||||||
|
* true if we are transmitting a practice product
|
||||||
*/
|
*/
|
||||||
private void transmitProduct(boolean decode) {
|
private void transmitProduct(boolean practice) {
|
||||||
IServerRequest req = null;
|
IServerRequest req = null;
|
||||||
if (decode) {
|
if (practice) {
|
||||||
if (SimulatedTime.getSystemTime().isRealTime()) {
|
SendPracticeProductRequest practiceReq = new SendPracticeProductRequest();
|
||||||
req = new SendPracticeProductRequest();
|
practiceReq.setNotifyGFE(true);
|
||||||
((SendPracticeProductRequest) req).setProductText(productText);
|
practiceReq.setProductText(productText);
|
||||||
} else {
|
|
||||||
req = new PracticeProductOfftimeRequest();
|
if (!SimulatedTime.getSystemTime().isRealTime()) {
|
||||||
((PracticeProductOfftimeRequest) req)
|
|
||||||
.setProductText(productText);
|
|
||||||
((PracticeProductOfftimeRequest) req).setNotifyGFE(true);
|
|
||||||
SimpleDateFormat dateFormatter = new SimpleDateFormat(
|
SimpleDateFormat dateFormatter = new SimpleDateFormat(
|
||||||
"yyyyMMdd_HHmm");
|
"yyyyMMdd_HHmm");
|
||||||
((PracticeProductOfftimeRequest) req)
|
dateFormatter.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||||
.setDrtString(dateFormatter.format(SimulatedTime
|
practiceReq.setDrtString(dateFormatter.format(SimulatedTime
|
||||||
.getSystemTime().getTime()));
|
.getSystemTime().getTime()));
|
||||||
}
|
}
|
||||||
|
req = practiceReq;
|
||||||
} else {
|
} else {
|
||||||
req = new OUPRequest();
|
OUPRequest oupReq = new OUPRequest();
|
||||||
OfficialUserProduct oup = new OfficialUserProduct();
|
OfficialUserProduct oup = new OfficialUserProduct();
|
||||||
// make sure the awipsWanPil is exactly 10 characters space-padded
|
// make sure the awipsWanPil is exactly 10 characters space-padded
|
||||||
// long
|
// long
|
||||||
|
@ -580,8 +582,10 @@ public class StoreTransmitDlg extends CaveSWTDialog implements
|
||||||
// oup.setAddress(parentEditor.getAutoSendAddress());
|
// oup.setAddress(parentEditor.getAutoSendAddress());
|
||||||
oup.setNeedsWmoHeader(false);
|
oup.setNeedsWmoHeader(false);
|
||||||
oup.setSource("GFE");
|
oup.setSource("GFE");
|
||||||
((OUPRequest) req).setProduct(oup);
|
oupReq.setProduct(oup);
|
||||||
((OUPRequest) req).setUser(UserController.getUserObject());
|
oupReq.setUser(UserController.getUserObject());
|
||||||
|
|
||||||
|
req = oupReq;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -66,6 +66,7 @@ import com.raytheon.uf.edex.core.props.PropertiesFactory;
|
||||||
* Nov 03, 2013 2511 mnash Fix issue where if name occurs in path
|
* Nov 03, 2013 2511 mnash Fix issue where if name occurs in path
|
||||||
* file won't be returned correctly
|
* file won't be returned correctly
|
||||||
* Feb 13, 2014 mnash Add region level to localization
|
* Feb 13, 2014 mnash Add region level to localization
|
||||||
|
* Nov 13, 2014 4953 randerso Changed delete() to also remove .md5 file
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author jelkins
|
* @author jelkins
|
||||||
|
@ -335,11 +336,19 @@ public class EDEXLocalizationAdapter implements ILocalizationAdapter {
|
||||||
@Override
|
@Override
|
||||||
public boolean delete(ModifiableLocalizationFile file)
|
public boolean delete(ModifiableLocalizationFile file)
|
||||||
throws LocalizationOpFailedException {
|
throws LocalizationOpFailedException {
|
||||||
|
boolean status = true;
|
||||||
File localFile = file.getLocalFile();
|
File localFile = file.getLocalFile();
|
||||||
if (localFile.exists()) {
|
if (localFile.exists()) {
|
||||||
return localFile.delete();
|
status = localFile.delete();
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
|
File md5File = new File(localFile.getAbsolutePath() + ".md5");
|
||||||
|
if (md5File.exists()) {
|
||||||
|
if (!md5File.delete()) {
|
||||||
|
handler.error("Unable to delete: " + md5File.getAbsolutePath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -349,8 +358,8 @@ public class EDEXLocalizationAdapter implements ILocalizationAdapter {
|
||||||
String contextName = null;
|
String contextName = null;
|
||||||
if (level == LocalizationLevel.BASE) {
|
if (level == LocalizationLevel.BASE) {
|
||||||
// nothing to add
|
// nothing to add
|
||||||
} else if (level == LocalizationLevel.SITE
|
} else if ((level == LocalizationLevel.SITE)
|
||||||
|| level == LocalizationLevel.CONFIGURED) {
|
|| (level == LocalizationLevel.CONFIGURED)) {
|
||||||
// fill in site name
|
// fill in site name
|
||||||
contextName = getSiteName();
|
contextName = getSiteName();
|
||||||
} else if (level == LocalizationLevel.REGION) {
|
} else if (level == LocalizationLevel.REGION) {
|
||||||
|
|
|
@ -33,6 +33,7 @@ import jep.JepException;
|
||||||
import com.raytheon.uf.common.activetable.VTECPartners;
|
import com.raytheon.uf.common.activetable.VTECPartners;
|
||||||
import com.raytheon.uf.common.dataplugin.gfe.python.GfePyIncludeUtil;
|
import com.raytheon.uf.common.dataplugin.gfe.python.GfePyIncludeUtil;
|
||||||
import com.raytheon.uf.common.dataplugin.warning.AbstractWarningRecord;
|
import com.raytheon.uf.common.dataplugin.warning.AbstractWarningRecord;
|
||||||
|
import com.raytheon.uf.common.dataplugin.warning.PracticeWarningRecord;
|
||||||
import com.raytheon.uf.common.localization.IPathManager;
|
import com.raytheon.uf.common.localization.IPathManager;
|
||||||
import com.raytheon.uf.common.localization.LocalizationContext;
|
import com.raytheon.uf.common.localization.LocalizationContext;
|
||||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||||
|
@ -42,7 +43,9 @@ import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||||
import com.raytheon.uf.common.localization.exception.LocalizationOpFailedException;
|
import com.raytheon.uf.common.localization.exception.LocalizationOpFailedException;
|
||||||
import com.raytheon.uf.common.python.PyUtil;
|
import com.raytheon.uf.common.python.PyUtil;
|
||||||
import com.raytheon.uf.common.python.PythonScript;
|
import com.raytheon.uf.common.python.PythonScript;
|
||||||
|
import com.raytheon.uf.common.site.SiteMap;
|
||||||
import com.raytheon.uf.common.util.FileUtil;
|
import com.raytheon.uf.common.util.FileUtil;
|
||||||
|
import com.raytheon.uf.common.util.file.FilenameFilters;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Watches ingested warnings for WOU products from the SPC (Storm Prediction
|
* Watches ingested warnings for WOU products from the SPC (Storm Prediction
|
||||||
|
@ -60,6 +63,8 @@ import com.raytheon.uf.common.util.FileUtil;
|
||||||
* subclasses to handle all watches if desired.
|
* subclasses to handle all watches if desired.
|
||||||
* Added hooks for TCVAdvisory creation
|
* Added hooks for TCVAdvisory creation
|
||||||
* Changed to use Python to store TCVAdvisory files
|
* Changed to use Python to store TCVAdvisory files
|
||||||
|
* Added code to keep practice and operational
|
||||||
|
* advisory files separated
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -68,6 +73,11 @@ import com.raytheon.uf.common.util.FileUtil;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public final class TPCWatchSrv extends AbstractWatchNotifierSrv {
|
public final class TPCWatchSrv extends AbstractWatchNotifierSrv {
|
||||||
|
private static final String TCV_ADVISORY_PATH = FileUtil.join("gfe",
|
||||||
|
"tcvAdvisories");
|
||||||
|
|
||||||
|
private static final String PRACTICE_PATH = FileUtil.join(
|
||||||
|
TCV_ADVISORY_PATH, "practice");
|
||||||
|
|
||||||
private static final String TPC_WATCH_TYPE = "TPC";
|
private static final String TPC_WATCH_TYPE = "TPC";
|
||||||
|
|
||||||
|
@ -149,29 +159,31 @@ public final class TPCWatchSrv extends AbstractWatchNotifierSrv {
|
||||||
public void handleWatch(List<AbstractWarningRecord> warningRecs) {
|
public void handleWatch(List<AbstractWarningRecord> warningRecs) {
|
||||||
super.handleWatch(warningRecs);
|
super.handleWatch(warningRecs);
|
||||||
|
|
||||||
// FIXME: This marks the pending.json file as Transmitted when ANY TCV
|
/*
|
||||||
// is decoded not the one just sent by this office. You need to look and
|
* Since all records originate from a single TCV product the issuing
|
||||||
// the warningRecs for a match to the issuing site and ETN or something
|
* office and record type will be the same we only need to look at the
|
||||||
// like that.
|
* first record.
|
||||||
|
*/
|
||||||
|
AbstractWarningRecord record = warningRecs.get(0);
|
||||||
|
boolean practiceMode = (record instanceof PracticeWarningRecord);
|
||||||
|
String issuingOffice = record.getOfficeid();
|
||||||
|
|
||||||
// FIXME: The python created dicts are storing CreationTime and EndTime
|
|
||||||
// (but not StartTime for some reason)
|
|
||||||
// as python floats. These values are converted to Java floats which are
|
|
||||||
// single precision 32-bit floats causing a possible loss of precision.
|
|
||||||
// These should be stored a integer values or datetime objects to ensure
|
|
||||||
// no precision loss. I have fixed a couple of places where endTime may
|
|
||||||
// have been set to a float but we need to ensure we've got them all.
|
|
||||||
for (String siteId : getActiveSites()) {
|
for (String siteId : getActiveSites()) {
|
||||||
this.saveTCVAdvisories(siteId);
|
String site4 = SiteMap.getInstance().getSite4LetterId(siteId);
|
||||||
|
if (issuingOffice.equals(site4)) {
|
||||||
|
this.saveTCVAdvisories(siteId, practiceMode);
|
||||||
|
break; // found matching officeId so we're done
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveTCVAdvisories(String siteId) {
|
private void saveTCVAdvisories(String siteId, boolean practiceMode) {
|
||||||
File advisoriesDirectory = this.synchronizeTCVAdvisories(siteId);
|
File advisoriesDirectory = this.synchronizeTCVAdvisories(siteId,
|
||||||
|
practiceMode);
|
||||||
|
|
||||||
String pendingFilename = "pending.json";
|
String pendingFilename = "pending.json";
|
||||||
LocalizationFile pendingFile = this.getLocalizationFile(siteId,
|
LocalizationFile pendingFile = this.getLocalizationFile(siteId,
|
||||||
pendingFilename);
|
pendingFilename, practiceMode);
|
||||||
|
|
||||||
Map<String, Object> pendingDict = this.loadJSONDictionary(pendingFile);
|
Map<String, Object> pendingDict = this.loadJSONDictionary(pendingFile);
|
||||||
if (pendingDict == null) {
|
if (pendingDict == null) {
|
||||||
|
@ -185,7 +197,7 @@ public final class TPCWatchSrv extends AbstractWatchNotifierSrv {
|
||||||
String transmittedFilename = stormName + advisoryNumber + ".json";
|
String transmittedFilename = stormName + advisoryNumber + ".json";
|
||||||
|
|
||||||
LocalizationFile transmittedFile = this.getLocalizationFile(siteId,
|
LocalizationFile transmittedFile = this.getLocalizationFile(siteId,
|
||||||
transmittedFilename);
|
transmittedFilename, practiceMode);
|
||||||
this.saveJSONDictionary(transmittedFile, pendingDict);
|
this.saveJSONDictionary(transmittedFile, pendingDict);
|
||||||
|
|
||||||
boolean transmittedFileSaved = false;
|
boolean transmittedFileSaved = false;
|
||||||
|
@ -200,11 +212,13 @@ public final class TPCWatchSrv extends AbstractWatchNotifierSrv {
|
||||||
if (transmittedFileSaved) {
|
if (transmittedFileSaved) {
|
||||||
boolean allCAN = (Boolean) pendingDict.get("AllCAN");
|
boolean allCAN = (Boolean) pendingDict.get("AllCAN");
|
||||||
if (allCAN) {
|
if (allCAN) {
|
||||||
for (File advisory : advisoriesDirectory.listFiles()) {
|
for (File advisory : advisoriesDirectory
|
||||||
|
.listFiles(FilenameFilters.byFileExtension(".json"))) {
|
||||||
String advisoryName = advisory.getName();
|
String advisoryName = advisory.getName();
|
||||||
if (advisoryName.startsWith(stormName)) {
|
if (advisoryName.startsWith(stormName)) {
|
||||||
LocalizationFile advisoryFile = this
|
LocalizationFile advisoryFile = this
|
||||||
.getLocalizationFile(siteId, advisoryName);
|
.getLocalizationFile(siteId, advisoryName,
|
||||||
|
practiceMode);
|
||||||
try {
|
try {
|
||||||
advisoryFile.delete();
|
advisoryFile.delete();
|
||||||
} catch (LocalizationOpFailedException e) {
|
} catch (LocalizationOpFailedException e) {
|
||||||
|
@ -220,34 +234,35 @@ public final class TPCWatchSrv extends AbstractWatchNotifierSrv {
|
||||||
} catch (LocalizationOpFailedException e) {
|
} catch (LocalizationOpFailedException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.synchronizeTCVAdvisories(siteId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private File synchronizeTCVAdvisories(String siteId) {
|
private File synchronizeTCVAdvisories(String siteId, boolean practiceMode) {
|
||||||
IPathManager pathMgr = PathManagerFactory.getPathManager();
|
IPathManager pathMgr = PathManagerFactory.getPathManager();
|
||||||
LocalizationContext context = pathMgr.getContextForSite(
|
LocalizationContext context = pathMgr.getContextForSite(
|
||||||
LocalizationType.CAVE_STATIC, siteId);
|
LocalizationType.CAVE_STATIC, siteId);
|
||||||
|
|
||||||
// Retrieving a directory causes synching to occur
|
// Retrieving a directory causes synching to occur
|
||||||
File file = pathMgr.getLocalizationFile(context,
|
File file = pathMgr.getLocalizationFile(context,
|
||||||
this.getTCVAdvisoryPath()).getFile();
|
getTCVAdvisoryPath(practiceMode)).getFile();
|
||||||
|
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
private LocalizationFile getLocalizationFile(String siteId, String filename) {
|
private LocalizationFile getLocalizationFile(String siteId,
|
||||||
|
String filename, boolean practiceMode) {
|
||||||
IPathManager pathMgr = PathManagerFactory.getPathManager();
|
IPathManager pathMgr = PathManagerFactory.getPathManager();
|
||||||
LocalizationContext context = pathMgr.getContextForSite(
|
LocalizationContext context = pathMgr.getContextForSite(
|
||||||
LocalizationType.CAVE_STATIC, siteId);
|
LocalizationType.CAVE_STATIC, siteId);
|
||||||
|
|
||||||
LocalizationFile localizationFile = pathMgr.getLocalizationFile(
|
LocalizationFile localizationFile = pathMgr.getLocalizationFile(
|
||||||
context, this.getTCVAdvisoryPath() + filename);
|
context,
|
||||||
|
FileUtil.join(getTCVAdvisoryPath(practiceMode), filename));
|
||||||
|
|
||||||
return localizationFile;
|
return localizationFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getTCVAdvisoryPath() {
|
private String getTCVAdvisoryPath(boolean practiceMode) {
|
||||||
return "gfe/tcvAdvisories/";
|
return practiceMode ? PRACTICE_PATH : TCV_ADVISORY_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, Object> loadJSONDictionary(LocalizationFile lf) {
|
private Map<String, Object> loadJSONDictionary(LocalizationFile lf) {
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<endpointType>VM</endpointType>
|
<endpointType>VM</endpointType>
|
||||||
<metadataMap>
|
<metadataMap>
|
||||||
<mapping key="pluginName">
|
<mapping key="pluginName">
|
||||||
<constraint constraintValue="warning" constraintType="EQUALS"/>
|
<constraint constraintValue="warning,practicewarning" constraintType="IN"/>
|
||||||
</mapping>
|
</mapping>
|
||||||
<mapping key="pil">
|
<mapping key="pil">
|
||||||
<constraint constraintValue="TCV" constraintType="EQUALS"/>
|
<constraint constraintValue="TCV" constraintType="EQUALS"/>
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
# ProjectionType enumeration
|
# ProjectionType enumeration
|
||||||
# 07/09/2014 #3146 randerso Added check for duplicate smartInit
|
# 07/09/2014 #3146 randerso Added check for duplicate smartInit
|
||||||
# rferrel Corrected log to alertviz.
|
# rferrel Corrected log to alertviz.
|
||||||
|
# 11/18/2014 #4953 randerso Added check for empty unit string
|
||||||
#
|
#
|
||||||
########################################################################
|
########################################################################
|
||||||
import types
|
import types
|
||||||
|
@ -209,7 +210,10 @@ def createParm(parminfo, domain, tc):
|
||||||
|
|
||||||
#don't add parms with your own office type in the name.
|
#don't add parms with your own office type in the name.
|
||||||
if name.find(officeType) != -1:
|
if name.find(officeType) != -1:
|
||||||
return None #skip this one
|
return None #skip this one
|
||||||
|
|
||||||
|
if len(units) == 0:
|
||||||
|
raise Exception, 'Unit string must not be empty. For unitless quantities enter "1"'
|
||||||
|
|
||||||
updateProjections(projection)
|
updateProjections(projection)
|
||||||
start, repeat, duration = tc
|
start, repeat, duration = tc
|
||||||
|
|
|
@ -311,7 +311,7 @@ FloodingRainThreat = ("FloodingRainThreat", DISCRETE, "Cat", "Flooding Rain Thre
|
||||||
StormSurgeThreat = ("StormSurgeThreat", DISCRETE, "Cat", "Storm Surge Threat", NO, Threat4Keys,2)
|
StormSurgeThreat = ("StormSurgeThreat", DISCRETE, "Cat", "Storm Surge Threat", NO, Threat4Keys,2)
|
||||||
WindThreat = ("WindThreat", DISCRETE, "Cat", "Wind Threat", NO, Threat4Keys,2)
|
WindThreat = ("WindThreat", DISCRETE, "Cat", "Wind Threat", NO, Threat4Keys,2)
|
||||||
TornadoThreat = ("TornadoThreat", DISCRETE, "Cat", "Tornado Threat", NO, Threat4Keys,2)
|
TornadoThreat = ("TornadoThreat", DISCRETE, "Cat", "Tornado Threat", NO, Threat4Keys,2)
|
||||||
QPFtoFFGRatio = ("QPFtoFFGRatio", SCALAR, "", "QPF to FFG Ratio", 8.0, 0.0, 0, NO)
|
QPFtoFFGRatio = ("QPFtoFFGRatio", SCALAR, "1", "QPF to FFG Ratio", 8.0, 0.0, 0, NO)
|
||||||
|
|
||||||
# Hazards
|
# Hazards
|
||||||
HazardKeys = []
|
HazardKeys = []
|
||||||
|
@ -478,7 +478,7 @@ BLWGDUST = ('BD', 'Blowing Dust',
|
||||||
[INTEN_NONE],
|
[INTEN_NONE],
|
||||||
[PRIMARY, MENTION])
|
[PRIMARY, MENTION])
|
||||||
FROST = ('FR','Frost',
|
FROST = ('FR','Frost',
|
||||||
[PATCHY, AREAS, DEFN],
|
[PATCHY, AREAS, WIDE],
|
||||||
[INTEN_NONE],
|
[INTEN_NONE],
|
||||||
[PRIMARY, MENTION, OUTLYNG])
|
[PRIMARY, MENTION, OUTLYNG])
|
||||||
FRZSPRAY = ('ZY','Freezing Spray',
|
FRZSPRAY = ('ZY','Freezing Spray',
|
||||||
|
|
|
@ -33,8 +33,7 @@
|
||||||
# Jul 24, 2012 #944 dgilling Refactored to support separate
|
# Jul 24, 2012 #944 dgilling Refactored to support separate
|
||||||
# generation of products and utilities.
|
# generation of products and utilities.
|
||||||
# Sep 07, 2012 #1150 dgilling Ensure all necessary dirs get created.
|
# Sep 07, 2012 #1150 dgilling Ensure all necessary dirs get created.
|
||||||
# Oct 20, 2014 #4953 randerso Changed how SiteInfo is loaded.
|
# Oct 20, 2014 #4953 randerso Fixed logging to log to a file
|
||||||
# Fixed logging to log to a file
|
|
||||||
# Cleaned up how protected file updates are returned
|
# Cleaned up how protected file updates are returned
|
||||||
#
|
#
|
||||||
# @author: jelkins
|
# @author: jelkins
|
||||||
|
@ -68,6 +67,7 @@ from sys import path
|
||||||
path.append(join(LIBRARY_DIR,"../"))
|
path.append(join(LIBRARY_DIR,"../"))
|
||||||
path.append(join(PREFERENCE_DIR,"../"))
|
path.append(join(PREFERENCE_DIR,"../"))
|
||||||
|
|
||||||
|
from library.SiteInfo import SiteInfo as SITE_INFO
|
||||||
from preferences.configureTextProducts import NWSProducts as NWS_PRODUCTS
|
from preferences.configureTextProducts import NWSProducts as NWS_PRODUCTS
|
||||||
|
|
||||||
from os.path import basename
|
from os.path import basename
|
||||||
|
@ -108,17 +108,6 @@ ProcessDirectories = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
# This will "load" SiteInfo in a more complicated way
|
|
||||||
# than 'from SiteCFG import SiteInfo'.
|
|
||||||
from LockingFile import File
|
|
||||||
|
|
||||||
pathManager = PathManagerFactory.getPathManager()
|
|
||||||
lf = pathManager.getStaticLocalizationFile(LocalizationType.COMMON_STATIC, "python/gfe/SiteCFG.py")
|
|
||||||
with File(lf.getFile(), lf.getName(), 'r') as file:
|
|
||||||
fileContents = file.read()
|
|
||||||
|
|
||||||
exec fileContents
|
|
||||||
|
|
||||||
|
|
||||||
class Generator():
|
class Generator():
|
||||||
"""Generates site specific text products from base template files.
|
"""Generates site specific text products from base template files.
|
||||||
|
@ -141,7 +130,7 @@ class Generator():
|
||||||
|
|
||||||
@raise LookupError: when the site ID is invalid
|
@raise LookupError: when the site ID is invalid
|
||||||
"""
|
"""
|
||||||
if siteId in SiteInfo.keys():
|
if siteId in SITE_INFO.keys():
|
||||||
self.__siteId = siteId
|
self.__siteId = siteId
|
||||||
else:
|
else:
|
||||||
raise LookupError, ' unknown WFO: ' + siteId
|
raise LookupError, ' unknown WFO: ' + siteId
|
||||||
|
@ -241,11 +230,11 @@ class Generator():
|
||||||
|
|
||||||
LOG.debug("PIL Information for all sites Begin.......")
|
LOG.debug("PIL Information for all sites Begin.......")
|
||||||
|
|
||||||
for site in SiteInfo.keys():
|
for site in SITE_INFO.keys():
|
||||||
LOG.info("--------------------------------------------")
|
LOG.info("--------------------------------------------")
|
||||||
LOG.info("%s %s %s" % (site,
|
LOG.info("%s %s %s" % (site,
|
||||||
SiteInfo[site]['fullStationID'],
|
SITE_INFO[site]['fullStationID'],
|
||||||
SiteInfo[site]['wfoCityState']))
|
SITE_INFO[site]['wfoCityState']))
|
||||||
pils = self.__createPilDictionary(site)
|
pils = self.__createPilDictionary(site)
|
||||||
self.__printPilDictionary(pils)
|
self.__printPilDictionary(pils)
|
||||||
found += len(pils)
|
found += len(pils)
|
||||||
|
@ -328,11 +317,11 @@ class Generator():
|
||||||
|
|
||||||
subDict = {}
|
subDict = {}
|
||||||
subDict['<site>'] = siteid.strip()
|
subDict['<site>'] = siteid.strip()
|
||||||
subDict['<region>'] = SiteInfo[siteid]['region'].strip()
|
subDict['<region>'] = SITE_INFO[siteid]['region'].strip()
|
||||||
subDict['<wfoCityState>'] = SiteInfo[siteid]['wfoCityState'].strip()
|
subDict['<wfoCityState>'] = SITE_INFO[siteid]['wfoCityState'].strip()
|
||||||
subDict['<wfoCity>'] = SiteInfo[siteid]['wfoCity'].strip()
|
subDict['<wfoCity>'] = SITE_INFO[siteid]['wfoCity'].strip()
|
||||||
subDict['<fullStationID>'] = SiteInfo[siteid]['fullStationID'].strip()
|
subDict['<fullStationID>'] = SITE_INFO[siteid]['fullStationID'].strip()
|
||||||
subDict['<state>'] = SiteInfo[siteid]['state'].strip()
|
subDict['<state>'] = SITE_INFO[siteid]['state'].strip()
|
||||||
if product is not None:
|
if product is not None:
|
||||||
subDict['<product>'] = product.strip()
|
subDict['<product>'] = product.strip()
|
||||||
if ProductToStandardMapping.has_key(product):
|
if ProductToStandardMapping.has_key(product):
|
||||||
|
@ -367,7 +356,7 @@ class Generator():
|
||||||
|
|
||||||
subDict = {}
|
subDict = {}
|
||||||
subDict['Site'] = siteid.strip()
|
subDict['Site'] = siteid.strip()
|
||||||
subDict['Region'] = SiteInfo[siteid]['region'].strip()
|
subDict['Region'] = SITE_INFO[siteid]['region'].strip()
|
||||||
if product is not None:
|
if product is not None:
|
||||||
subDict['Product'] = product.strip()
|
subDict['Product'] = product.strip()
|
||||||
if pilInfo is not None and pilInfo.has_key("pil") and multiPilFlag:
|
if pilInfo is not None and pilInfo.has_key("pil") and multiPilFlag:
|
||||||
|
@ -403,10 +392,10 @@ class Generator():
|
||||||
LOG.info("%s %s" % (p,pillist[p]))
|
LOG.info("%s %s" % (p,pillist[p]))
|
||||||
|
|
||||||
def __createPilDictionary(self, siteid):
|
def __createPilDictionary(self, siteid):
|
||||||
"""Update the SiteInfo with a PIL dictionary
|
"""Update the SITE_INFO with a PIL dictionary
|
||||||
|
|
||||||
Read the a2a data from the database, create PIL information, and add the information
|
Read the a2a data from the database, create PIL information, and add the information
|
||||||
to the SiteInfo dictionary.
|
to the SITE_INFO dictionary.
|
||||||
|
|
||||||
@param site: the site for which PIL information is created
|
@param site: the site for which PIL information is created
|
||||||
@type site: string
|
@type site: string
|
||||||
|
@ -415,7 +404,7 @@ class Generator():
|
||||||
@rtype: dictionary
|
@rtype: dictionary
|
||||||
"""
|
"""
|
||||||
|
|
||||||
siteD = SiteInfo[siteid]
|
siteD = SITE_INFO[siteid]
|
||||||
stationID4 = siteD['fullStationID']
|
stationID4 = siteD['fullStationID']
|
||||||
|
|
||||||
from com.raytheon.edex.plugin.text.dao import AfosToAwipsDao
|
from com.raytheon.edex.plugin.text.dao import AfosToAwipsDao
|
||||||
|
@ -460,7 +449,7 @@ class Generator():
|
||||||
e['textdbPil'] = pil
|
e['textdbPil'] = pil
|
||||||
e['awipsWANPil'] = site4 + pil[3:]
|
e['awipsWANPil'] = site4 + pil[3:]
|
||||||
d.append(e)
|
d.append(e)
|
||||||
siteD[nnn] = d #store the pil dictionary back into the SiteInfo
|
siteD[nnn] = d #store the pil dictionary back into the SITE_INFO
|
||||||
|
|
||||||
return pillist
|
return pillist
|
||||||
|
|
||||||
|
@ -597,8 +586,8 @@ class Generator():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# extract out the pil information from the dictionary
|
# extract out the pil information from the dictionary
|
||||||
if SiteInfo[siteid].has_key(pilNames[0]):
|
if SITE_INFO[siteid].has_key(pilNames[0]):
|
||||||
pils = SiteInfo[siteid][pilNames[0]]
|
pils = SITE_INFO[siteid][pilNames[0]]
|
||||||
else:
|
else:
|
||||||
#set pils to empty list if none defined
|
#set pils to empty list if none defined
|
||||||
pils = [{'awipsWANPil': 'kssscccnnn',
|
pils = [{'awipsWANPil': 'kssscccnnn',
|
||||||
|
|
|
@ -843,18 +843,19 @@ class TextProduct(HLSTCV_Common.TextProduct):
|
||||||
|
|
||||||
def _saveAdvisory(self, advisoryName, advisoryDict):
|
def _saveAdvisory(self, advisoryName, advisoryDict):
|
||||||
self._synchronizeAdvisories()
|
self._synchronizeAdvisories()
|
||||||
|
fileName = self._getAdvisoryFilename(advisoryName)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
JsonSupport.saveToJson(LocalizationType.CAVE_STATIC,
|
JsonSupport.saveToJson(LocalizationType.CAVE_STATIC,
|
||||||
self._site,
|
self._site,
|
||||||
self._getAdvisoryFilename(advisoryName),
|
fileName,
|
||||||
advisoryDict)
|
advisoryDict)
|
||||||
|
|
||||||
print "SARAH: Wrote file contents for", self._getAdvisoryFilename(advisoryName)
|
print "SARAH: Wrote file contents for", fileName
|
||||||
|
|
||||||
self._synchronizeAdvisories()
|
self._synchronizeAdvisories()
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print "SARAH Save Exception for", self._getAdvisoryFilename(advisoryName), ":", e
|
print "SARAH Save Exception for", fileName, ":", e
|
||||||
|
|
||||||
def _getHazardsForHLS(self):
|
def _getHazardsForHLS(self):
|
||||||
hazardTable = self._argDict["hazards"]
|
hazardTable = self._argDict["hazards"]
|
||||||
|
|
|
@ -1,48 +1,43 @@
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
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">
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
|
|
||||||
|
|
||||||
<bean id="warningProperties" class="com.raytheon.uf.common.dataplugin.PluginProperties">
|
<bean id="warningProperties" class="com.raytheon.uf.common.dataplugin.PluginProperties">
|
||||||
<property name="pluginName" value="warning" />
|
<property name="pluginName" value="warning"/>
|
||||||
<property name="pluginFQN" value="com.raytheon.uf.common.dataplugin.warning" />
|
<property name="pluginFQN" value="com.raytheon.uf.common.dataplugin.warning"/>
|
||||||
<property name="record"
|
<property name="record" value="com.raytheon.uf.common.dataplugin.warning.WarningRecord"/>
|
||||||
value="com.raytheon.uf.common.dataplugin.warning.WarningRecord" />
|
<property name="initialRetentionTime" value="144"/>
|
||||||
<property name="initialRetentionTime" value="144" />
|
</bean>
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean factory-bean="pluginRegistry" factory-method="register">
|
<bean factory-bean="pluginRegistry" factory-method="register">
|
||||||
<constructor-arg value="warning" />
|
<constructor-arg value="warning"/>
|
||||||
<constructor-arg ref="warningProperties" />
|
<constructor-arg ref="warningProperties"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="warningDecoder" class="com.raytheon.uf.edex.python.decoder.PythonDecoder">
|
<bean id="warningDecoder" class="com.raytheon.uf.edex.python.decoder.PythonDecoder">
|
||||||
<property name="pluginName" value="warning" />
|
<property name="pluginName" value="warning"/>
|
||||||
<property name="pluginFQN" value="com.raytheon.edex.plugin.warning" />
|
<property name="pluginFQN" value="com.raytheon.edex.plugin.warning"/>
|
||||||
<property name="moduleName" value="WarningDecoder" />
|
<property name="moduleName" value="WarningDecoder"/>
|
||||||
<property name="cache" value="true" />
|
<property name="cache" value="true"/>
|
||||||
<property name="recordClassname"
|
<property name="recordClassname" value="com.raytheon.uf.common.dataplugin.warning.WarningRecord"/>
|
||||||
value="com.raytheon.uf.common.dataplugin.warning.WarningRecord" />
|
</bean>
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="practiceWarningProperties" class="com.raytheon.uf.common.dataplugin.PluginProperties">
|
<bean id="practiceWarningProperties" class="com.raytheon.uf.common.dataplugin.PluginProperties">
|
||||||
<property name="pluginName" value="practicewarning" />
|
<property name="pluginName" value="practicewarning"/>
|
||||||
<property name="pluginFQN" value="com.raytheon.uf.common.dataplugin.warning" />
|
<property name="pluginFQN" value="com.raytheon.uf.common.dataplugin.warning"/>
|
||||||
<property name="record"
|
<property name="record" value="com.raytheon.uf.common.dataplugin.warning.PracticeWarningRecord"/>
|
||||||
value="com.raytheon.uf.common.dataplugin.warning.PracticeWarningRecord" />
|
<property name="initialRetentionTime" value="144"/>
|
||||||
<property name="initialRetentionTime" value="144" />
|
</bean>
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean factory-bean="pluginRegistry" factory-method="register">
|
<bean factory-bean="pluginRegistry" factory-method="register">
|
||||||
<constructor-arg value="practicewarning" />
|
<constructor-arg value="practicewarning"/>
|
||||||
<constructor-arg ref="practiceWarningProperties" />
|
<constructor-arg ref="practiceWarningProperties"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="practiceWarningDecoder" class="com.raytheon.uf.edex.python.decoder.PythonDecoder">
|
<bean id="practiceWarningDecoder" class="com.raytheon.uf.edex.python.decoder.PythonDecoder">
|
||||||
<property name="pluginName" value="practicewarning" />
|
<property name="pluginName" value="practicewarning"/>
|
||||||
<property name="pluginFQN" value="com.raytheon.edex.plugin.warning" />
|
<property name="pluginFQN" value="com.raytheon.edex.plugin.warning"/>
|
||||||
<property name="moduleName" value="WarningDecoder" />
|
<property name="moduleName" value="WarningDecoder"/>
|
||||||
<property name="cache" value="true" />
|
<property name="cache" value="true"/>
|
||||||
<property name="recordClassname"
|
<property name="recordClassname" value="com.raytheon.uf.common.dataplugin.warning.PracticeWarningRecord"/>
|
||||||
value="com.raytheon.uf.common.dataplugin.warning.PracticeWarningRecord" />
|
</bean>
|
||||||
</bean>
|
|
||||||
</beans>
|
</beans>
|
|
@ -1,66 +1,49 @@
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
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
|
||||||
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">
|
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
|
||||||
|
|
||||||
<bean id="vtecFilter" class="com.raytheon.edex.plugin.warning.util.WarningHasVTECFilter" />
|
|
||||||
|
|
||||||
<bean id="warningDistRegistry" factory-bean="distributionSrv"
|
<bean id="vtecFilter" class="com.raytheon.edex.plugin.warning.util.WarningHasVTECFilter"/>
|
||||||
factory-method="register">
|
|
||||||
<constructor-arg value="warning" />
|
|
||||||
<constructor-arg value="jms-durable:queue:Ingest.Warning"/>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="warningHandleoupDistRegistry" factory-bean="handleoupDistributionSrv"
|
|
||||||
factory-method="register">
|
|
||||||
<constructor-arg value="warning" />
|
|
||||||
<constructor-arg value="jms-durable:queue:Ingest.Warning"/>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<camelContext id="warning-camel"
|
<bean id="warningDistRegistry" factory-bean="distributionSrv" factory-method="register">
|
||||||
xmlns="http://camel.apache.org/schema/spring"
|
<constructor-arg value="warning"/>
|
||||||
errorHandlerRef="errorHandler">
|
<constructor-arg value="jms-durable:queue:Ingest.Warning"/>
|
||||||
<!--
|
</bean>
|
||||||
<endpoint id="warningEndpoint"
|
|
||||||
uri="file:${edex.home}/data/sbn/warning?noop=true&idempotent=false" />
|
|
||||||
|
|
||||||
<route id="warningFileConsumerRoute">
|
<bean id="warningHandleoupDistRegistry" factory-bean="handleoupDistributionSrv" factory-method="register">
|
||||||
<from ref="warningEndpoint" />
|
<constructor-arg value="warning"/>
|
||||||
<bean ref="fileToString" />
|
<constructor-arg value="jms-durable:queue:Ingest.Warning"/>
|
||||||
<setHeader headerName="pluginName">
|
</bean>
|
||||||
<constant>warning</constant>
|
|
||||||
</setHeader>
|
|
||||||
<to uri="jms-durable:queue:Ingest.Warning" />
|
|
||||||
</route>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!--
|
<camelContext id="warning-camel" xmlns="http://camel.apache.org/schema/spring" errorHandlerRef="errorHandler">
|
||||||
Warning routes
|
<!-- <endpoint id="warningEndpoint" uri="file:${edex.home}/data/sbn/warning?noop=true&idempotent=false" /> <route
|
||||||
-->
|
id="warningFileConsumerRoute"> <from ref="warningEndpoint" /> <bean ref="fileToString" /> <setHeader headerName="pluginName">
|
||||||
<route id="warningIngestRoute">
|
<constant>warning</constant> </setHeader> <to uri="jms-durable:queue:Ingest.Warning" /> </route> -->
|
||||||
<from uri="jms-durable:queue:Ingest.Warning"/>
|
|
||||||
<setHeader headerName="pluginName">
|
<!-- Warning routes -->
|
||||||
<constant>warning</constant>
|
<route id="warningIngestRoute">
|
||||||
</setHeader>
|
<from uri="jms-durable:queue:Ingest.Warning"/>
|
||||||
<doTry>
|
<setHeader headerName="pluginName">
|
||||||
<pipeline>
|
<constant>warning</constant>
|
||||||
<bean ref="stringToFile" />
|
</setHeader>
|
||||||
<bean ref="warningDecoder" method="decode" />
|
<doTry>
|
||||||
<bean ref="index" method="index" />
|
<pipeline>
|
||||||
<bean ref="processUtil" method="log" />
|
<bean ref="stringToFile"/>
|
||||||
<multicast parallelProcessing="false">
|
<bean ref="warningDecoder" method="decode"/>
|
||||||
<to uri="direct-vm:stageNotification" />
|
<bean ref="index" method="index"/>
|
||||||
<filter>
|
<bean ref="processUtil" method="log"/>
|
||||||
<method bean="vtecFilter" method="hasVTEC" />
|
<multicast parallelProcessing="false">
|
||||||
<to uri="jms-durable:queue:activeTablePending"/>
|
<to uri="direct-vm:stageNotification"/>
|
||||||
</filter>
|
<filter>
|
||||||
</multicast>
|
<method bean="vtecFilter" method="hasVTEC"/>
|
||||||
</pipeline>
|
<to uri="jms-durable:queue:activeTablePending"/>
|
||||||
<doCatch>
|
</filter>
|
||||||
<exception>java.lang.Throwable</exception>
|
</multicast>
|
||||||
<to uri="log:warning?level=ERROR&showBody=true" />
|
</pipeline>
|
||||||
</doCatch>
|
<doCatch>
|
||||||
</doTry>
|
<exception>java.lang.Throwable</exception>
|
||||||
</route>
|
<to uri="log:warning?level=ERROR&showBody=true"/>
|
||||||
</camelContext>
|
</doCatch>
|
||||||
|
</doTry>
|
||||||
|
</route>
|
||||||
|
</camelContext>
|
||||||
</beans>
|
</beans>
|
||||||
|
|
|
@ -1,124 +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.uf.common.activetable;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.raytheon.uf.common.message.IMessage;
|
|
||||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
|
||||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A SendPracticeProductRequest with the addition of an offset time string.
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
*
|
|
||||||
* SOFTWARE HISTORY
|
|
||||||
*
|
|
||||||
* Date Ticket# Engineer Description
|
|
||||||
* ------------ ---------- ----------- --------------------------
|
|
||||||
* Jun 27, 2011 wldougher Initial creation
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @author wldougher
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
@DynamicSerialize
|
|
||||||
public class PracticeProductOfftimeRequest extends SendPracticeProductRequest
|
|
||||||
implements IMessage {
|
|
||||||
|
|
||||||
@DynamicSerializeElement
|
|
||||||
private String drtString;
|
|
||||||
|
|
||||||
@DynamicSerializeElement
|
|
||||||
private boolean notifyGFE;
|
|
||||||
|
|
||||||
private int offsetSeconds;
|
|
||||||
|
|
||||||
private Map<String, Object> headers;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the drtString
|
|
||||||
*/
|
|
||||||
public String getDrtString() {
|
|
||||||
return drtString;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param drtString
|
|
||||||
* the drtString to set
|
|
||||||
*/
|
|
||||||
public void setDrtString(String drtString) {
|
|
||||||
this.drtString = drtString;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param offsetSeconds
|
|
||||||
* the offsetSeconds to set
|
|
||||||
*/
|
|
||||||
public void setOffsetSeconds(int offsetSeconds) {
|
|
||||||
this.offsetSeconds = offsetSeconds;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the offsetSeconds
|
|
||||||
*/
|
|
||||||
public int getOffsetSeconds() {
|
|
||||||
return offsetSeconds;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see com.raytheon.uf.common.message.IMessage#getHeaders()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> getHeaders() {
|
|
||||||
return headers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param headers
|
|
||||||
* the headers to set
|
|
||||||
*/
|
|
||||||
public void setHeaders(Map<String, Object> headers) {
|
|
||||||
this.headers = headers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the flag value that tells whether GFE notifications should be sent.
|
|
||||||
*
|
|
||||||
* @param notifyGFE
|
|
||||||
* the notifyGFE to set
|
|
||||||
*/
|
|
||||||
public void setNotifyGFE(boolean notifyGFE) {
|
|
||||||
this.notifyGFE = notifyGFE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the notifyGFE
|
|
||||||
*/
|
|
||||||
public boolean isNotifyGFE() {
|
|
||||||
return notifyGFE;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -19,38 +19,102 @@
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.common.activetable;
|
package com.raytheon.uf.common.activetable;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.message.IMessage;
|
||||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||||
import com.raytheon.uf.common.serialization.comm.IServerRequest;
|
import com.raytheon.uf.common.serialization.comm.IServerRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Add Description
|
* A SendPracticeProductRequest with an optional offset time string.
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Feb 10, 2010 njensen Initial creation
|
* Jun 27, 2011 wldougher Initial creation
|
||||||
|
* Nov 14, 2014 4953 randerso Merged PracticeProductOfftimeRequest with this
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author njensen
|
* @author wldougher
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@DynamicSerialize
|
@DynamicSerialize
|
||||||
public class SendPracticeProductRequest implements IServerRequest {
|
public class SendPracticeProductRequest implements IServerRequest, IMessage {
|
||||||
|
|
||||||
@DynamicSerializeElement
|
@DynamicSerializeElement
|
||||||
private String productText;
|
private String productText;
|
||||||
|
|
||||||
|
@DynamicSerializeElement
|
||||||
|
private String drtString;
|
||||||
|
|
||||||
|
@DynamicSerializeElement
|
||||||
|
private boolean notifyGFE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the productText
|
||||||
|
*/
|
||||||
public String getProductText() {
|
public String getProductText() {
|
||||||
return productText;
|
return productText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param productText
|
||||||
|
* the productText to set
|
||||||
|
*/
|
||||||
public void setProductText(String productText) {
|
public void setProductText(String productText) {
|
||||||
this.productText = productText;
|
this.productText = productText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the drtString
|
||||||
|
*/
|
||||||
|
public String getDrtString() {
|
||||||
|
return drtString;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param drtString
|
||||||
|
* the drtString to set
|
||||||
|
*/
|
||||||
|
public void setDrtString(String drtString) {
|
||||||
|
this.drtString = drtString;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the flag value that tells whether GFE notifications should be sent.
|
||||||
|
*
|
||||||
|
* @param notifyGFE
|
||||||
|
* the notifyGFE to set
|
||||||
|
*/
|
||||||
|
public void setNotifyGFE(boolean notifyGFE) {
|
||||||
|
this.notifyGFE = notifyGFE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the notifyGFE
|
||||||
|
*/
|
||||||
|
public boolean isNotifyGFE() {
|
||||||
|
return notifyGFE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.raytheon.uf.common.message.IMessage#getHeaders()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getHeaders() {
|
||||||
|
Map<String, Object> headers = new HashMap<String, Object>(2, 1.0f);
|
||||||
|
headers.put("drtstring", getDrtString());
|
||||||
|
headers.put("notifygfe", isNotifyGFE());
|
||||||
|
return headers;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -242,7 +242,7 @@ public class GridParmInfo implements Cloneable {
|
||||||
this.rateParm = rateParm;
|
this.rateParm = rateParm;
|
||||||
|
|
||||||
if (!validCheck()) {
|
if (!validCheck()) {
|
||||||
statusHandler.warn(this.errorMessage);
|
statusHandler.error(this.errorMessage);
|
||||||
setDefaultValues();
|
setDefaultValues();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,86 +1,25 @@
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
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
|
||||||
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">
|
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
|
||||||
|
|
||||||
<bean id="vtecFilter" class="com.raytheon.edex.plugin.warning.util.WarningHasVTECFilter" />
|
<bean id="vtecFilter" class="com.raytheon.edex.plugin.warning.util.WarningHasVTECFilter"/>
|
||||||
|
|
||||||
<bean id="activeTableSrv" class="com.raytheon.uf.edex.activetable.ActiveTableSrv" />
|
<bean id="activeTableSrv" class="com.raytheon.uf.edex.activetable.ActiveTableSrv"/>
|
||||||
<bean id="activeTable" class="com.raytheon.uf.edex.activetable.ActiveTable" />
|
<bean id="activeTable" class="com.raytheon.uf.edex.activetable.ActiveTable"/>
|
||||||
<bean id="activeTableDatabaseProperties" class="com.raytheon.uf.edex.database.DatabasePluginProperties">
|
<bean id="activeTableDatabaseProperties" class="com.raytheon.uf.edex.database.DatabasePluginProperties">
|
||||||
<property name="pluginFQN" value="com.raytheon.uf.common.activetable" />
|
<property name="pluginFQN" value="com.raytheon.uf.common.activetable"/>
|
||||||
<property name="database" value="metadata" />
|
<property name="database" value="metadata"/>
|
||||||
</bean>
|
</bean>
|
||||||
<bean factory-bean="dbPluginRegistry" factory-method="register">
|
<bean factory-bean="dbPluginRegistry" factory-method="register">
|
||||||
<constructor-arg value="com.raytheon.uf.common.activetable"/>
|
<constructor-arg value="com.raytheon.uf.common.activetable"/>
|
||||||
<constructor-arg ref="activeTableDatabaseProperties"/>
|
<constructor-arg ref="activeTableDatabaseProperties"/>
|
||||||
</bean>
|
</bean>
|
||||||
<bean id="timeOffsetDecoder" class="com.raytheon.uf.edex.python.decoder.TimeOffsetDecoder">
|
|
||||||
<property name="pluginName" value="warning" />
|
<camelContext id="activetable-camel" xmlns="http://camel.apache.org/schema/spring" errorHandlerRef="errorHandler">
|
||||||
<property name="pluginFQN" value="com.raytheon.edex.plugin.warning" />
|
|
||||||
<property name="moduleName" value="WarningDecoder" />
|
|
||||||
<property name="cache" value="false"/>
|
|
||||||
<property name="recordClassname"
|
|
||||||
value="com.raytheon.uf.common.dataplugin.warning.WarningRecord" />
|
|
||||||
</bean>
|
|
||||||
<bean id="practiceProductOfftimeHandler" class="com.raytheon.uf.edex.activetable.PracticeProductOfftimeHandler"/>
|
|
||||||
<bean id="toDataURI" class="com.raytheon.uf.edex.ingest.notification.ToDataURI" />
|
|
||||||
<camelContext id="activetable-camel"
|
|
||||||
xmlns="http://camel.apache.org/schema/spring"
|
|
||||||
errorHandlerRef="errorHandler">
|
|
||||||
<route id="vtecNotify">
|
<route id="vtecNotify">
|
||||||
<from uri="vm:edex.vtecAlert" />
|
<from uri="vm:edex.vtecAlert"/>
|
||||||
<bean ref="serializationUtil" method="transformToThrift" />
|
<bean ref="serializationUtil" method="transformToThrift"/>
|
||||||
<to uri="jms-generic:topic:edex.alerts.vtec?timeToLive=60000" />
|
<to uri="jms-generic:topic:edex.alerts.vtec?timeToLive=60000"/>
|
||||||
</route>
|
</route>
|
||||||
<route id="practiceVtecRoute">
|
</camelContext>
|
||||||
<from uri="jms-generic:queue:practiceActiveTable" />
|
|
||||||
<doTry>
|
|
||||||
<bean ref="activeTable" method="dumpProductToTempFile" />
|
|
||||||
<bean ref="practiceWarningDecoder" method="decode" />
|
|
||||||
<bean ref="index" method="index" />
|
|
||||||
<filter>
|
|
||||||
<method bean="vtecFilter" method="hasVTEC" />
|
|
||||||
<bean ref="activeTableSrv" method="practiceVtecArrived" />
|
|
||||||
<bean ref="toDataURI" method="toPracticeNotificationMsg"/>
|
|
||||||
<bean ref="serializationUtil" method="transformToThrift" />
|
|
||||||
<to uri="jms-generic:topic:edex.alerts.practicewarning?timeToLive=60000&deliveryPersistent=false"/>
|
|
||||||
</filter>
|
|
||||||
<doCatch>
|
|
||||||
<exception>java.lang.Throwable</exception>
|
|
||||||
<to uri="log:practiceActiveTable?level=ERROR"/>
|
|
||||||
</doCatch>
|
|
||||||
</doTry>
|
|
||||||
</route>
|
|
||||||
<route id="practiceVtecOffsetRoute">
|
|
||||||
<from uri="vm:edex.vtecDecoder" />
|
|
||||||
<doTry>
|
|
||||||
<pipeline>
|
|
||||||
<setHeader headerName="drtstring">
|
|
||||||
<simple>${body?.drtString}</simple>
|
|
||||||
</setHeader>
|
|
||||||
<setHeader headerName="offsetseconds">
|
|
||||||
<simple>${body?.offsetSeconds}</simple>
|
|
||||||
</setHeader>
|
|
||||||
<setHeader headerName="notifygfe">
|
|
||||||
<simple>${body?.notifyGFE}</simple>
|
|
||||||
</setHeader>
|
|
||||||
<bean ref="practiceProductOfftimeHandler" method="process"/>
|
|
||||||
<bean ref="activeTable" method="dumpProductToTempFile"/>
|
|
||||||
<bean ref="timeOffsetDecoder" method="decode"/>
|
|
||||||
<multicast parallelProcessing="false">
|
|
||||||
<bean ref="activeTableSrv" method="practiceVtecArrived"/>
|
|
||||||
<filter>
|
|
||||||
<simple>${header?.notifygfe.booleanValue}</simple>
|
|
||||||
<to uri="jms-generic:queue:practiceNotify"/>
|
|
||||||
</filter>
|
|
||||||
</multicast>
|
|
||||||
</pipeline>
|
|
||||||
<doCatch>
|
|
||||||
<exception>java.lang.Throwable</exception>
|
|
||||||
<to uri="log:practiceActiveTable?level=ERROR"/>
|
|
||||||
</doCatch>
|
|
||||||
</doTry>
|
|
||||||
</route>
|
|
||||||
</camelContext>
|
|
||||||
</beans>
|
</beans>
|
||||||
|
|
|
@ -1,40 +1,66 @@
|
||||||
<beans
|
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xmlns="http://www.springframework.org/schema/beans"
|
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
|
||||||
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">
|
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
|
||||||
<camelContext id="clusteredActiveTableContext"
|
|
||||||
xmlns="http://camel.apache.org/schema/spring"
|
|
||||||
errorHandlerRef="errorHandler">
|
|
||||||
|
|
||||||
<route id="activeTablePendingRoute">
|
<bean id="toDataURI" class="com.raytheon.uf.edex.ingest.notification.ToDataURI"/>
|
||||||
<from uri="jms-durable:queue:activeTablePending"/>
|
|
||||||
|
<bean id="practiceVtecDecoder" class="com.raytheon.uf.edex.activetable.decoder.PracticeVtecDecoder">
|
||||||
|
<property name="pluginName" value="practicewarning"/>
|
||||||
|
<property name="pluginFQN" value="com.raytheon.edex.plugin.warning"/>
|
||||||
|
<property name="moduleName" value="WarningDecoder"/>
|
||||||
|
<property name="cache" value="false"/>
|
||||||
|
<property name="recordClassname" value="com.raytheon.uf.common.dataplugin.warning.PracticeWarningRecord"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<camelContext id="clusteredActiveTableContext" xmlns="http://camel.apache.org/schema/spring"
|
||||||
|
errorHandlerRef="errorHandler">
|
||||||
|
|
||||||
|
<route id="activeTablePendingRoute">
|
||||||
|
<from uri="jms-durable:queue:activeTablePending"/>
|
||||||
<doTry>
|
<doTry>
|
||||||
<bean ref="activeTableSrv" method="vtecArrived" />
|
<bean ref="activeTableSrv" method="vtecArrived"/>
|
||||||
<doCatch>
|
<doCatch>
|
||||||
<exception>java.lang.Throwable</exception>
|
<exception>java.lang.Throwable</exception>
|
||||||
<to uri="log:activeTable?level=ERROR"/>
|
<to uri="log:activeTable?level=ERROR"/>
|
||||||
</doCatch>
|
</doCatch>
|
||||||
</doTry>
|
</doTry>
|
||||||
</route>
|
</route>
|
||||||
|
</camelContext>
|
||||||
<route id="practiceNotifyRoute">
|
|
||||||
<from uri="jms-generic:queue:practiceNotify" />
|
<camelContext id="activetable-ingest" xmlns="http://camel.apache.org/schema/spring" errorHandlerRef="errorHandler">
|
||||||
|
<route id="practiceVtecRoute">
|
||||||
|
<from uri="jms-generic:queue:practiceVtec"/>
|
||||||
<doTry>
|
<doTry>
|
||||||
<multicast parallelProcessing="false">
|
<pipeline>
|
||||||
<to uri="jms-durable:queue:edex.spcWatch" />
|
<bean ref="serializationUtil" method="transformFromThrift"/>
|
||||||
<to uri="jms-durable:queue:edex.tpcWatch" />
|
<setHeader headerName="notifygfe">
|
||||||
</multicast>
|
<simple>${body?.notifyGFE}</simple>
|
||||||
|
</setHeader>
|
||||||
|
<bean ref="practiceVtecDecoder" method="decode"/>
|
||||||
|
<bean ref="index" method="index"/>
|
||||||
|
<multicast parallelProcessing="false">
|
||||||
|
<filter>
|
||||||
|
<simple>${header?.notifygfe.booleanValue}</simple>
|
||||||
|
<to uri="direct-vm:stageNotification"/>
|
||||||
|
</filter>
|
||||||
|
<filter>
|
||||||
|
<method bean="vtecFilter" method="hasVTEC"/>
|
||||||
|
<bean ref="activeTableSrv" method="practiceVtecArrived"/>
|
||||||
|
<bean ref="toDataURI" method="toPracticeNotificationMsg"/>
|
||||||
|
<bean ref="serializationUtil" method="transformToThrift"/>
|
||||||
|
<to uri="jms-generic:topic:edex.alerts.practicewarning?timeToLive=60000&deliveryPersistent=false"/>
|
||||||
|
</filter>
|
||||||
|
</multicast>
|
||||||
|
</pipeline>
|
||||||
<doCatch>
|
<doCatch>
|
||||||
<exception>java.lang.Throwable</exception>
|
<exception>java.lang.Throwable</exception>
|
||||||
<to uri="log:practiceActiveTable?level=ERROR"/>
|
<to uri="log:practiceActiveTable?level=ERROR"/>
|
||||||
</doCatch>
|
</doCatch>
|
||||||
</doTry>
|
</doTry>
|
||||||
</route>
|
</route>
|
||||||
|
</camelContext>
|
||||||
|
|
||||||
</camelContext>
|
<bean factory-bean="contextManager" factory-method="registerClusteredContext">
|
||||||
|
<constructor-arg ref="clusteredActiveTableContext"/>
|
||||||
<bean factory-bean="contextManager" factory-method="registerClusteredContext">
|
</bean>
|
||||||
<constructor-arg ref="clusteredActiveTableContext" />
|
|
||||||
</bean>
|
|
||||||
</beans>
|
</beans>
|
|
@ -1,6 +1,5 @@
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
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
|
||||||
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">
|
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
|
||||||
|
|
||||||
<bean id="clearTableHandler" class="com.raytheon.uf.edex.activetable.handler.ClearPracticeVTECTableHandler"/>
|
<bean id="clearTableHandler" class="com.raytheon.uf.edex.activetable.handler.ClearPracticeVTECTableHandler"/>
|
||||||
|
@ -8,101 +7,94 @@
|
||||||
<constructor-arg value="com.raytheon.uf.common.activetable.request.ClearPracticeVTECTableRequest"/>
|
<constructor-arg value="com.raytheon.uf.common.activetable.request.ClearPracticeVTECTableRequest"/>
|
||||||
<constructor-arg ref="clearTableHandler"/>
|
<constructor-arg ref="clearTableHandler"/>
|
||||||
</bean>
|
</bean>
|
||||||
<bean id="getActiveTableHandler" class="com.raytheon.uf.edex.activetable.GetActiveTableHandler"/>
|
<bean id="getActiveTableHandler" class="com.raytheon.uf.edex.activetable.GetActiveTableHandler"/>
|
||||||
<bean factory-bean="handlerRegistry" factory-method="register">
|
<bean factory-bean="handlerRegistry" factory-method="register">
|
||||||
<constructor-arg value="com.raytheon.uf.common.activetable.GetActiveTableRequest"/>
|
<constructor-arg value="com.raytheon.uf.common.activetable.GetActiveTableRequest"/>
|
||||||
<constructor-arg ref="getActiveTableHandler"/>
|
<constructor-arg ref="getActiveTableHandler"/>
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="getActiveTableDictHandler" class="com.raytheon.uf.edex.activetable.GetActiveTableDictHandler"/>
|
|
||||||
<bean factory-bean="handlerRegistry" factory-method="register">
|
|
||||||
<constructor-arg value="com.raytheon.uf.common.activetable.GetActiveTableDictRequest"/>
|
|
||||||
<constructor-arg ref="getActiveTableDictHandler"/>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="getFourCharSitesHandler" class="com.raytheon.uf.edex.activetable.GetFourCharSitesHandler"/>
|
|
||||||
<bean factory-bean="handlerRegistry" factory-method="register">
|
|
||||||
<constructor-arg value="com.raytheon.uf.common.activetable.GetFourCharSitesRequest"/>
|
|
||||||
<constructor-arg ref="getFourCharSitesHandler"/>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="getVtecAttributeHandler" class="com.raytheon.uf.edex.activetable.GetVtecAttributeHandler"/>
|
|
||||||
<bean factory-bean="handlerRegistry" factory-method="register">
|
|
||||||
<constructor-arg value="com.raytheon.uf.common.activetable.GetVtecAttributeRequest"/>
|
|
||||||
<constructor-arg ref="getVtecAttributeHandler"/>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="dumpActiveTableHandler" class="com.raytheon.uf.edex.activetable.DumpActiveTableHandler"/>
|
|
||||||
<bean factory-bean="handlerRegistry" factory-method="register">
|
|
||||||
<constructor-arg value="com.raytheon.uf.common.activetable.DumpActiveTableRequest"/>
|
|
||||||
<constructor-arg ref="dumpActiveTableHandler"/>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="practiceVtecHandler" class="com.raytheon.uf.edex.activetable.PracticeVtecHandler"/>
|
|
||||||
<bean factory-bean="handlerRegistry" factory-method="register">
|
|
||||||
<constructor-arg value="com.raytheon.uf.common.activetable.SendPracticeProductRequest"/>
|
|
||||||
<constructor-arg ref="practiceVtecHandler"/>
|
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- practiceProductOfftimeHandler declared in activetable-common -->
|
<bean id="getActiveTableDictHandler" class="com.raytheon.uf.edex.activetable.GetActiveTableDictHandler"/>
|
||||||
<bean factory-bean="handlerRegistry" factory-method="register">
|
<bean factory-bean="handlerRegistry" factory-method="register">
|
||||||
<constructor-arg value="com.raytheon.uf.common.activetable.PracticeProductOfftimeRequest"/>
|
<constructor-arg value="com.raytheon.uf.common.activetable.GetActiveTableDictRequest"/>
|
||||||
<constructor-arg ref="practiceProductOfftimeHandler"/>
|
<constructor-arg ref="getActiveTableDictHandler"/>
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="getNextEtnHandler" class="com.raytheon.uf.edex.activetable.GetNextEtnHandler" />
|
|
||||||
<bean factory-bean="handlerRegistry" factory-method="register">
|
|
||||||
<constructor-arg value="com.raytheon.uf.common.activetable.GetNextEtnRequest"/>
|
|
||||||
<constructor-arg ref="getNextEtnHandler"/>
|
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<bean id="getFourCharSitesHandler" class="com.raytheon.uf.edex.activetable.GetFourCharSitesHandler"/>
|
||||||
|
<bean factory-bean="handlerRegistry" factory-method="register">
|
||||||
|
<constructor-arg value="com.raytheon.uf.common.activetable.GetFourCharSitesRequest"/>
|
||||||
|
<constructor-arg ref="getFourCharSitesHandler"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="getVtecAttributeHandler" class="com.raytheon.uf.edex.activetable.GetVtecAttributeHandler"/>
|
||||||
|
<bean factory-bean="handlerRegistry" factory-method="register">
|
||||||
|
<constructor-arg value="com.raytheon.uf.common.activetable.GetVtecAttributeRequest"/>
|
||||||
|
<constructor-arg ref="getVtecAttributeHandler"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="dumpActiveTableHandler" class="com.raytheon.uf.edex.activetable.DumpActiveTableHandler"/>
|
||||||
|
<bean factory-bean="handlerRegistry" factory-method="register">
|
||||||
|
<constructor-arg value="com.raytheon.uf.common.activetable.DumpActiveTableRequest"/>
|
||||||
|
<constructor-arg ref="dumpActiveTableHandler"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="practiceVtecHandler" class="com.raytheon.uf.edex.activetable.handler.SendPracticeProductHandler"/>
|
||||||
|
<bean factory-bean="handlerRegistry" factory-method="register">
|
||||||
|
<constructor-arg value="com.raytheon.uf.common.activetable.SendPracticeProductRequest"/>
|
||||||
|
<constructor-arg ref="practiceVtecHandler"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="getNextEtnHandler" class="com.raytheon.uf.edex.activetable.GetNextEtnHandler"/>
|
||||||
|
<bean factory-bean="handlerRegistry" factory-method="register">
|
||||||
|
<constructor-arg value="com.raytheon.uf.common.activetable.GetNextEtnRequest"/>
|
||||||
|
<constructor-arg ref="getNextEtnHandler"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
<bean id="requestATHandler" class="com.raytheon.uf.edex.activetable.handler.RetrieveRemoteActiveTableHandler"/>
|
<bean id="requestATHandler" class="com.raytheon.uf.edex.activetable.handler.RetrieveRemoteActiveTableHandler"/>
|
||||||
<bean factory-bean="handlerRegistry" factory-method="register">
|
<bean factory-bean="handlerRegistry" factory-method="register">
|
||||||
<constructor-arg value="com.raytheon.uf.common.activetable.request.RetrieveRemoteActiveTableRequest"/>
|
<constructor-arg value="com.raytheon.uf.common.activetable.request.RetrieveRemoteActiveTableRequest"/>
|
||||||
<constructor-arg ref="requestATHandler"/>
|
<constructor-arg ref="requestATHandler"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="sendATHandler" class="com.raytheon.uf.edex.activetable.handler.SendActiveTableHandler"/>
|
<bean id="sendATHandler" class="com.raytheon.uf.edex.activetable.handler.SendActiveTableHandler"/>
|
||||||
<bean factory-bean="handlerRegistry" factory-method="register">
|
<bean factory-bean="handlerRegistry" factory-method="register">
|
||||||
<constructor-arg value="com.raytheon.uf.common.activetable.request.SendActiveTableRequest"/>
|
<constructor-arg value="com.raytheon.uf.common.activetable.request.SendActiveTableRequest"/>
|
||||||
<constructor-arg ref="sendATHandler"/>
|
<constructor-arg ref="sendATHandler"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="ingestATHandler" class="com.raytheon.uf.edex.activetable.handler.MergeActiveTableHandler"/>
|
<bean id="ingestATHandler" class="com.raytheon.uf.edex.activetable.handler.MergeActiveTableHandler"/>
|
||||||
<bean factory-bean="handlerRegistry" factory-method="register">
|
<bean factory-bean="handlerRegistry" factory-method="register">
|
||||||
<constructor-arg value="com.raytheon.uf.common.activetable.request.MergeActiveTableRequest"/>
|
<constructor-arg value="com.raytheon.uf.common.activetable.request.MergeActiveTableRequest"/>
|
||||||
<constructor-arg ref="ingestATHandler"/>
|
<constructor-arg ref="ingestATHandler"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="lockAndGetEtnHandler" class="com.raytheon.uf.edex.activetable.handler.LockAndGetNextEtnHandler"/>
|
<bean id="lockAndGetEtnHandler" class="com.raytheon.uf.edex.activetable.handler.LockAndGetNextEtnHandler"/>
|
||||||
<bean factory-bean="handlerRegistry" factory-method="register">
|
<bean factory-bean="handlerRegistry" factory-method="register">
|
||||||
<constructor-arg value="com.raytheon.uf.common.activetable.request.LockAndGetNextEtnRequest"/>
|
<constructor-arg value="com.raytheon.uf.common.activetable.request.LockAndGetNextEtnRequest"/>
|
||||||
<constructor-arg ref="lockAndGetEtnHandler"/>
|
<constructor-arg ref="lockAndGetEtnHandler"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="setAndUnlockEtnHandler" class="com.raytheon.uf.edex.activetable.handler.UnlockActiveTablePhenSigHandler"/>
|
<bean id="setAndUnlockEtnHandler" class="com.raytheon.uf.edex.activetable.handler.UnlockActiveTablePhenSigHandler"/>
|
||||||
<bean factory-bean="handlerRegistry" factory-method="register">
|
<bean factory-bean="handlerRegistry" factory-method="register">
|
||||||
<constructor-arg value="com.raytheon.uf.common.activetable.request.UnlockAndSetNextEtnRequest"/>
|
<constructor-arg value="com.raytheon.uf.common.activetable.request.UnlockAndSetNextEtnRequest"/>
|
||||||
<constructor-arg ref="setAndUnlockEtnHandler"/>
|
<constructor-arg ref="setAndUnlockEtnHandler"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="fetchATSrv" class="com.raytheon.uf.edex.activetable.vtecsharing.FetchActiveTableSrv"/>
|
<bean id="fetchATSrv" class="com.raytheon.uf.edex.activetable.vtecsharing.FetchActiveTableSrv"/>
|
||||||
<camelContext id="activeTableSharingRoutes"
|
<camelContext id="activeTableSharingRoutes" xmlns="http://camel.apache.org/schema/spring"
|
||||||
xmlns="http://camel.apache.org/schema/spring"
|
errorHandlerRef="errorHandler">
|
||||||
errorHandlerRef="errorHandler">
|
|
||||||
|
<route id="activeSiteForFetchATSrv">
|
||||||
<route id="activeSiteForFetchATSrv">
|
<from uri="jms-generic:queue:gfeSiteActivated"/>
|
||||||
<from uri="jms-generic:queue:gfeSiteActivated" />
|
<doTry>
|
||||||
<doTry>
|
<bean ref="fetchATSrv" method="addSite"/>
|
||||||
<bean ref="fetchATSrv" method="addSite" />
|
<doCatch>
|
||||||
<doCatch>
|
<exception>java.lang.Throwable</exception>
|
||||||
<exception>java.lang.Throwable</exception>
|
<to uri="log:fetchATSrv?level=ERROR"/>
|
||||||
<to uri="log:fetchATSrv?level=ERROR"/>
|
</doCatch>
|
||||||
</doCatch>
|
|
||||||
</doTry>
|
</doTry>
|
||||||
</route>
|
</route>
|
||||||
</camelContext>
|
</camelContext>
|
||||||
<bean factory-bean="contextManager" factory-method="registerClusteredContext">
|
<bean factory-bean="contextManager" factory-method="registerClusteredContext">
|
||||||
<constructor-arg ref="activeTableSharingRoutes" />
|
<constructor-arg ref="activeTableSharingRoutes"/>
|
||||||
</bean>
|
</bean>
|
||||||
</beans>
|
</beans>
|
|
@ -33,7 +33,6 @@ import jep.JepException;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.raytheon.edex.site.SiteUtil;
|
import com.raytheon.edex.site.SiteUtil;
|
||||||
import com.raytheon.edex.util.Util;
|
|
||||||
import com.raytheon.uf.common.activetable.ActiveTableMode;
|
import com.raytheon.uf.common.activetable.ActiveTableMode;
|
||||||
import com.raytheon.uf.common.activetable.ActiveTableRecord;
|
import com.raytheon.uf.common.activetable.ActiveTableRecord;
|
||||||
import com.raytheon.uf.common.activetable.MergeResult;
|
import com.raytheon.uf.common.activetable.MergeResult;
|
||||||
|
@ -55,9 +54,9 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
import com.raytheon.uf.common.status.PerformanceStatus;
|
import com.raytheon.uf.common.status.PerformanceStatus;
|
||||||
import com.raytheon.uf.common.status.UFStatus;
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
import com.raytheon.uf.common.util.CollectionUtil;
|
|
||||||
import com.raytheon.uf.common.time.util.ITimer;
|
import com.raytheon.uf.common.time.util.ITimer;
|
||||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||||
|
import com.raytheon.uf.common.util.CollectionUtil;
|
||||||
import com.raytheon.uf.common.util.FileUtil;
|
import com.raytheon.uf.common.util.FileUtil;
|
||||||
import com.raytheon.uf.edex.core.EDEXUtil;
|
import com.raytheon.uf.edex.core.EDEXUtil;
|
||||||
import com.raytheon.uf.edex.database.DataAccessLayerException;
|
import com.raytheon.uf.edex.database.DataAccessLayerException;
|
||||||
|
@ -91,6 +90,8 @@ import com.raytheon.uf.edex.database.query.DatabaseQuery;
|
||||||
* Jun 17, 2014 3296 randerso Cached PythonScript. Moved active table
|
* Jun 17, 2014 3296 randerso Cached PythonScript. Moved active table
|
||||||
* backup and purging to a separate thread.
|
* backup and purging to a separate thread.
|
||||||
* Added performance logging
|
* Added performance logging
|
||||||
|
* Nov 14, 2014 4953 randerso Moved dumpProductToTempFile into PracticeVtecDecoder
|
||||||
|
* since it had no reason to be in this class
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -220,9 +221,9 @@ public class ActiveTable {
|
||||||
ActiveTableMode mode, String phensigList, String act, String etn,
|
ActiveTableMode mode, String phensigList, String act, String etn,
|
||||||
String[] wfos) {
|
String[] wfos) {
|
||||||
|
|
||||||
if (wfos == null || !Arrays.asList(wfos).contains("all")) {
|
if ((wfos == null) || !Arrays.asList(wfos).contains("all")) {
|
||||||
|
|
||||||
if (wfos == null || wfos.length == 0) {
|
if ((wfos == null) || (wfos.length == 0)) {
|
||||||
// default to WFOs from VTECPartners
|
// default to WFOs from VTECPartners
|
||||||
|
|
||||||
Set<String> wfoSet = getDecoderSites(siteId);
|
Set<String> wfoSet = getDecoderSites(siteId);
|
||||||
|
@ -352,14 +353,14 @@ public class ActiveTable {
|
||||||
PythonScript python = threadLocalPythonScript.get();
|
PythonScript python = threadLocalPythonScript.get();
|
||||||
try {
|
try {
|
||||||
result = (MergeResult) python.execute("mergeFromJava", args);
|
result = (MergeResult) python.execute("mergeFromJava", args);
|
||||||
} catch (JepException e) {
|
} catch (JepException e) {
|
||||||
statusHandler.handle(Priority.PROBLEM,
|
|
||||||
"Error updating active table", e);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
statusHandler.handle(Priority.PROBLEM,
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
"Error initializing active table python", e);
|
"Error updating active table", e);
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
|
"Error initializing active table python", e);
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -419,11 +420,11 @@ public class ActiveTable {
|
||||||
query.addQueryParam("etn", etn, "in");
|
query.addQueryParam("etn", etn, "in");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (requestValidTimes && currentTime != null) {
|
if (requestValidTimes && (currentTime != null)) {
|
||||||
// Current Time
|
// Current Time
|
||||||
query.addQueryParam("endTime", currentTime, "greater_than");
|
query.addQueryParam("endTime", currentTime, "greater_than");
|
||||||
}
|
}
|
||||||
if (latestEtn && currentTime != null) {
|
if (latestEtn && (currentTime != null)) {
|
||||||
Calendar yearStart = Calendar.getInstance();
|
Calendar yearStart = Calendar.getInstance();
|
||||||
yearStart.set(currentTime.get(Calendar.YEAR), Calendar.JANUARY,
|
yearStart.set(currentTime.get(Calendar.YEAR), Calendar.JANUARY,
|
||||||
0, 0, 0);
|
0, 0, 0);
|
||||||
|
@ -623,19 +624,6 @@ public class ActiveTable {
|
||||||
dao.executeNativeSql(sql);
|
dao.executeNativeSql(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Dump product text to temp file
|
|
||||||
*
|
|
||||||
* @param productText
|
|
||||||
* product text
|
|
||||||
* @return the temp file
|
|
||||||
*/
|
|
||||||
public static File dumpProductToTempFile(String productText) {
|
|
||||||
File file = Util.createTempFile(productText.getBytes(), "vtec");
|
|
||||||
file.deleteOnExit();
|
|
||||||
return file;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the last assigned ETN for the specified site and phensig combination.
|
* Get the last assigned ETN for the specified site and phensig combination.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,138 +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.uf.edex.activetable;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import jep.JepException;
|
|
||||||
|
|
||||||
import com.raytheon.uf.common.activetable.PracticeProductOfftimeRequest;
|
|
||||||
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.PathManagerFactory;
|
|
||||||
import com.raytheon.uf.common.python.PythonScript;
|
|
||||||
import com.raytheon.uf.common.serialization.comm.IRequestHandler;
|
|
||||||
import com.raytheon.uf.edex.core.EDEXUtil;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO Add Description
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
*
|
|
||||||
* SOFTWARE HISTORY
|
|
||||||
*
|
|
||||||
* Date Ticket# Engineer Description
|
|
||||||
* ------------ ---------- ----------- --------------------------
|
|
||||||
* Jun 27, 2011 wldougher Initial creation
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @author wldougher
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class PracticeProductOfftimeHandler implements
|
|
||||||
IRequestHandler<PracticeProductOfftimeRequest> {
|
|
||||||
|
|
||||||
private static String timeUtil;
|
|
||||||
|
|
||||||
private static String includePath;
|
|
||||||
static {
|
|
||||||
IPathManager pathMgr = PathManagerFactory.getPathManager();
|
|
||||||
LocalizationContext commonCx = pathMgr.getContext(
|
|
||||||
LocalizationType.COMMON_STATIC, LocalizationLevel.BASE);
|
|
||||||
timeUtil = pathMgr.getFile(commonCx,
|
|
||||||
"python" + File.separator + "TimeUtil.py").getPath();
|
|
||||||
includePath = pathMgr.getFile(commonCx, "python").getPath();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object handleRequest(PracticeProductOfftimeRequest request)
|
|
||||||
throws Exception {
|
|
||||||
String drtString = request.getDrtString();
|
|
||||||
request.setOffsetSeconds(offsetSecs(drtString));
|
|
||||||
request.setHeaders(new HashMap<String, Object>());
|
|
||||||
EDEXUtil.getMessageProducer().sendAsync("practiceVtecOffsetRoute",
|
|
||||||
request);
|
|
||||||
|
|
||||||
return null;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param request
|
|
||||||
* @return The product text of the request
|
|
||||||
*/
|
|
||||||
public String process(PracticeProductOfftimeRequest request) {
|
|
||||||
return request.getProductText();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Call determineDrtOffset() (in Python) to determine the offset in seconds
|
|
||||||
* for a particular string.
|
|
||||||
*
|
|
||||||
* @param drtString
|
|
||||||
* The string to convert
|
|
||||||
* @return the offset in seconds
|
|
||||||
* @throws Exception
|
|
||||||
* if the Python call fails
|
|
||||||
*/
|
|
||||||
protected int offsetSecs(String drtString) throws Exception {
|
|
||||||
int rtnVal = 0;
|
|
||||||
|
|
||||||
if (drtString != null) {
|
|
||||||
|
|
||||||
Map<String, Object> args = new HashMap<String, Object>();
|
|
||||||
args.put("timeStr", drtString);
|
|
||||||
|
|
||||||
PythonScript python = null;
|
|
||||||
Object obj = null;
|
|
||||||
try {
|
|
||||||
python = new PythonScript(timeUtil, includePath, getClass()
|
|
||||||
.getClassLoader());
|
|
||||||
obj = python.execute("determineDrtOffset", args);
|
|
||||||
} catch (JepException e) {
|
|
||||||
throw new Exception("Python exception:" + e.getMessage(), e);
|
|
||||||
} finally {
|
|
||||||
if (python != null) {
|
|
||||||
python.dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// determineDrtOffset returns a tuple.
|
|
||||||
// In the current implementation, it comes back as a String:
|
|
||||||
// "( -12345678, ...)", but it might change in the future.
|
|
||||||
if (obj instanceof String) {
|
|
||||||
String objStr = (String) obj;
|
|
||||||
String intStr = objStr.substring(1, objStr.indexOf(","));
|
|
||||||
rtnVal = Integer.parseInt(intStr);
|
|
||||||
} else if (obj instanceof List) {
|
|
||||||
rtnVal = (Integer) ((List<?>) obj).get(0);
|
|
||||||
} else if (obj.getClass().isArray()) {
|
|
||||||
rtnVal = (Integer) ((Object[]) obj)[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return rtnVal;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -17,14 +17,16 @@
|
||||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
* further licensing information.
|
* further licensing information.
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.edex.python.decoder;
|
package com.raytheon.uf.edex.activetable.decoder;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.raytheon.edex.esb.Headers;
|
import com.raytheon.edex.util.Util;
|
||||||
|
import com.raytheon.uf.common.activetable.SendPracticeProductRequest;
|
||||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||||
|
import com.raytheon.uf.edex.python.decoder.PythonDecoder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A PythonDecoder, modified to allow a time offset string (as passed in -z
|
* A PythonDecoder, modified to allow a time offset string (as passed in -z
|
||||||
|
@ -40,6 +42,10 @@ import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||||
* ------------- -------- ----------- --------------------------
|
* ------------- -------- ----------- --------------------------
|
||||||
* Jun 27, 2011 wldougher Initial creation
|
* Jun 27, 2011 wldougher Initial creation
|
||||||
* Oct 03, 2013 2402 bsteffen Make PythonDecoder more extendable.
|
* Oct 03, 2013 2402 bsteffen Make PythonDecoder more extendable.
|
||||||
|
* Nov 14, 2014 4953 randerso Renamed to PracticeVtecDecoder since it is now
|
||||||
|
* used for all practice VTEC products
|
||||||
|
* Changed to take in the SendPracticeProductRequest
|
||||||
|
* to simplify spring wiring
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -47,40 +53,51 @@ import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class TimeOffsetDecoder extends PythonDecoder {
|
public class PracticeVtecDecoder extends PythonDecoder {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
public TimeOffsetDecoder() {
|
public PracticeVtecDecoder() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decode a file with an offset time.
|
* Dump product text to temp file
|
||||||
*
|
*
|
||||||
* @param file
|
* @param productText
|
||||||
* The file to decode
|
* product text
|
||||||
* @param drtString
|
* @return the temp file
|
||||||
* The time offset string as used by
|
*/
|
||||||
* TimeUtil.py::determineDrtOffset()
|
public static File dumpProductToTempFile(String productText) {
|
||||||
|
File file = Util.createTempFile(productText.getBytes(), "vtec");
|
||||||
|
file.deleteOnExit();
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decode a practice VTEC product with a time offset.
|
||||||
|
*
|
||||||
|
* @param req
|
||||||
* @return An array of decoded records, which may be zero-length, but is not
|
* @return An array of decoded records, which may be zero-length, but is not
|
||||||
* null.
|
* null.
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* if anything goes wrong, typically in Python or converting
|
* if anything goes wrong, typically in Python or converting
|
||||||
* Python structures to Java
|
* Python structures to Java
|
||||||
*/
|
*/
|
||||||
public PluginDataObject[] decode(File file, Headers headers)
|
public PluginDataObject[] decode(SendPracticeProductRequest req)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
|
File file = dumpProductToTempFile(req.getProductText());
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder("cmd -f ");
|
StringBuilder sb = new StringBuilder("cmd -f ");
|
||||||
sb.append(file.getPath());
|
sb.append(file.getPath());
|
||||||
Boolean notifyGFE = (Boolean) headers.get("notifygfe");
|
Boolean notifyGFE = req.isNotifyGFE();
|
||||||
if (Boolean.TRUE.equals(notifyGFE)) {
|
if (Boolean.TRUE.equals(notifyGFE)) {
|
||||||
sb.append(" -g");
|
sb.append(" -g");
|
||||||
}
|
}
|
||||||
String drtString = (String) headers.get("drtstring");
|
String drtString = req.getDrtString();
|
||||||
if (drtString != null && !"".equals(drtString)) {
|
if ((drtString != null) && !drtString.isEmpty()) {
|
||||||
sb.append(" -z ").append(drtString);
|
sb.append(" -z ").append(drtString);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,14 +17,14 @@
|
||||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
* further licensing information.
|
* further licensing information.
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.edex.activetable;
|
package com.raytheon.uf.edex.activetable.handler;
|
||||||
|
|
||||||
import com.raytheon.uf.common.activetable.SendPracticeProductRequest;
|
import com.raytheon.uf.common.activetable.SendPracticeProductRequest;
|
||||||
import com.raytheon.uf.common.serialization.comm.IRequestHandler;
|
import com.raytheon.uf.common.serialization.comm.IRequestHandler;
|
||||||
import com.raytheon.uf.edex.core.EDEXUtil;
|
import com.raytheon.uf.edex.core.EDEXUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Add Description
|
* Send Practice VTEC Product
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
|
@ -32,6 +32,8 @@ import com.raytheon.uf.edex.core.EDEXUtil;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Feb 10, 2010 njensen Initial creation
|
* Feb 10, 2010 njensen Initial creation
|
||||||
|
* Nov 14, 2014 4953 randerso Changed to use sendAsyncThriftUri so headers
|
||||||
|
* are not lost
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -39,14 +41,14 @@ import com.raytheon.uf.edex.core.EDEXUtil;
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class PracticeVtecHandler implements
|
public class SendPracticeProductHandler implements
|
||||||
IRequestHandler<SendPracticeProductRequest> {
|
IRequestHandler<SendPracticeProductRequest> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object handleRequest(SendPracticeProductRequest request)
|
public Object handleRequest(SendPracticeProductRequest request)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
EDEXUtil.getMessageProducer().sendAsync("practiceVtecRoute",
|
EDEXUtil.getMessageProducer().sendAsyncThriftUri(
|
||||||
request.getProductText());
|
"jms-generic:queue:practiceVtec", request);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,27 +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.
|
|
||||||
##
|
|
||||||
|
|
||||||
from ufpy import TimeUtil
|
|
||||||
|
|
||||||
def determineDrtOffset(timeStr):
|
|
||||||
return TimeUtil.determineDrtOffset(timeStr)
|
|
||||||
|
|
||||||
def makeTime(timeStr):
|
|
||||||
return TimeUtil.makeTime(timeStr)
|
|
|
@ -19,7 +19,24 @@
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.edex.core;
|
package com.raytheon.uf.edex.core;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.serialization.SerializationException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Message Producer Interface
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* 10/08/14 #3684 randerso Added sendAsyncThriftUri
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author randerso
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
public interface IMessageProducer {
|
public interface IMessageProducer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -57,4 +74,15 @@ public interface IMessageProducer {
|
||||||
*/
|
*/
|
||||||
public void sendAsyncUri(String uri, Object message) throws EdexException;
|
public void sendAsyncUri(String uri, Object message) throws EdexException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends a message asynchronously using Thrift serialization.
|
||||||
|
*
|
||||||
|
* @param uri
|
||||||
|
* the uri to send the message to
|
||||||
|
* @param message
|
||||||
|
* the message to send
|
||||||
|
*/
|
||||||
|
public void sendAsyncThriftUri(String uri, Object message)
|
||||||
|
throws EdexException, SerializationException;
|
||||||
|
|
||||||
}
|
}
|
|
@ -41,6 +41,8 @@ import org.apache.camel.model.ProcessorDefinition;
|
||||||
import org.apache.camel.spi.InterceptStrategy;
|
import org.apache.camel.spi.InterceptStrategy;
|
||||||
|
|
||||||
import com.raytheon.uf.common.message.IMessage;
|
import com.raytheon.uf.common.message.IMessage;
|
||||||
|
import com.raytheon.uf.common.serialization.SerializationException;
|
||||||
|
import com.raytheon.uf.common.serialization.SerializationUtil;
|
||||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
import com.raytheon.uf.common.status.UFStatus;
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
import com.raytheon.uf.common.util.Pair;
|
import com.raytheon.uf.common.util.Pair;
|
||||||
|
@ -63,6 +65,7 @@ import com.raytheon.uf.edex.esb.camel.context.ContextManager;
|
||||||
* Nov 14, 2008 njensen Initial creation.
|
* Nov 14, 2008 njensen Initial creation.
|
||||||
* Mar 27, 2014 2726 rjpeter Modified for graceful shutdown changes,
|
* Mar 27, 2014 2726 rjpeter Modified for graceful shutdown changes,
|
||||||
* added tracking of endpoints by context.
|
* added tracking of endpoints by context.
|
||||||
|
* Oct 08, 2014 #3684 randerso Added sendAsyncThriftUri
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author njensen
|
* @author njensen
|
||||||
|
@ -173,6 +176,33 @@ public class MessageProducer implements IMessageProducer, InterceptStrategy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendAsyncThriftUri(String uri, Object message)
|
||||||
|
throws EdexException, SerializationException {
|
||||||
|
if (!started
|
||||||
|
&& queueWaitingMessage(WaitingType.THRIFT_URI, uri, message)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Pair<ProducerTemplate, Endpoint> ctxAndTemplate = getProducerTemplateAndEndpointForUri(uri);
|
||||||
|
Map<String, Object> headers = getHeaders(message);
|
||||||
|
ProducerTemplate template = ctxAndTemplate.getFirst();
|
||||||
|
Endpoint ep = ctxAndTemplate.getSecond();
|
||||||
|
|
||||||
|
if (headers != null) {
|
||||||
|
template.sendBodyAndHeaders(ep, ExchangePattern.InOnly,
|
||||||
|
SerializationUtil.transformToThrift(message), headers);
|
||||||
|
} else {
|
||||||
|
template.sendBody(ep, ExchangePattern.InOnly,
|
||||||
|
SerializationUtil.transformToThrift(message));
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new EdexException("Error sending asynchronous message: "
|
||||||
|
+ message + " to uri: " + uri, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
@ -350,6 +380,9 @@ public class MessageProducer implements IMessageProducer, InterceptStrategy {
|
||||||
case URI:
|
case URI:
|
||||||
sendAsyncUri(wm.dest, wm.msg);
|
sendAsyncUri(wm.dest, wm.msg);
|
||||||
break;
|
break;
|
||||||
|
case THRIFT_URI:
|
||||||
|
sendAsyncThriftUri(wm.dest, wm.msg);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
statusHandler
|
statusHandler
|
||||||
|
@ -419,7 +452,7 @@ public class MessageProducer implements IMessageProducer, InterceptStrategy {
|
||||||
* Enum for handling whether the waiting type was uri or msg.
|
* Enum for handling whether the waiting type was uri or msg.
|
||||||
*/
|
*/
|
||||||
private enum WaitingType {
|
private enum WaitingType {
|
||||||
ID, URI
|
ID, URI, THRIFT_URI
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue