Issue #826: Fix TCG and Warning decoders to properly respect ALLOW_ARCHIVE_DATA env variable, fix broken GFE

VTEC notification route.

Change-Id: I48550b9023cc7f251462f0c6620cff352f4512be

Former-commit-id: 151515b52d [formerly 151515b52d [formerly 151a2069e3bf46f08bc636cf1bd4974b07e65da3]]
Former-commit-id: 1df1bbbf9e
Former-commit-id: 617400bc30
This commit is contained in:
David Gillingham 2012-06-29 10:23:05 -05:00
parent bd58025a99
commit 522b0037bb
4 changed files with 61 additions and 51 deletions

View file

@ -122,6 +122,7 @@
<route id="gfeVtecChangeNotification">
<from uri="jms-generic:topic:edex.alerts.vtec"/>
<doTry>
<bean ref="serializationUtil" method="transformFromThrift" />
<bean ref="vtecChangeListener" method="handleNotification" />
<doCatch>
<exception>java.lang.Throwable</exception>

View file

@ -84,7 +84,7 @@ class StdWarningDecoder():
#base time for decoder
self._time = time.time() + self._timeOffset #present time
allowArchive = os.getenv("ALLOW_ARCHIVE_DATA")
if (allowArchive == "true" and re.match(".*\\.\\d{8}$", self._incomingFilename) ):
if allowArchive.lower() == "true" and re.match(".*\\.\\d{8}$", self._incomingFilename):
m = re.search('(.*\\.)(\\d{8}$)', self._incomingFilename)
yyyymmdd = m.group(2)
timeTuple = time.strptime(yyyymmdd, "%Y%m%d")

View file

@ -21,7 +21,6 @@ package com.raytheon.uf.edex.plugin.tcg.decoder;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.TimeZone;
@ -31,6 +30,7 @@ import com.raytheon.uf.common.dataplugin.tcg.dao.TropicalCycloneGuidanceDao;
import com.raytheon.uf.common.pointdata.PointDataDescription;
import com.raytheon.uf.common.pointdata.spatial.SurfaceObsLocation;
import com.raytheon.uf.common.time.DataTime;
/**
* TODO Add Description
*
@ -41,6 +41,10 @@ import com.raytheon.uf.common.time.DataTime;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 26, 2009 jsanchez Initial creation
* Jun 28, 2012 #826 dgilling Use wmoHeader headerDate to
* set refTime so times are set
* correctly when processing archive
* data.
*
* </pre>
*
@ -67,10 +71,12 @@ public class QLMData extends TCGDataAdapter{
private static final int MAX_FORECASTS = 22;
public QLMData(PointDataDescription pdd, TropicalCycloneGuidanceDao dao, String pluginName) {
public QLMData(PointDataDescription pdd, TropicalCycloneGuidanceDao dao,
String pluginName) {
super(pdd, dao, pluginName);
}
@Override
public List<TropicalCycloneGuidance> findReports(byte[] message) {
List<TropicalCycloneGuidance> reports = new ArrayList<TropicalCycloneGuidance>();
List<InternalReport> parts = InternalReport.identifyMessage(message);
@ -87,11 +93,13 @@ public class QLMData extends TCGDataAdapter{
parseInitTimeInfo(s);
} else if (InternalType.FORECAST_POSITION_INFO.equals(t)) {
parseForecastPositionInfo(s);
} else if(InternalType.STORM_DISSIPATED.equals(t) || list.size() == MAX_FORECASTS){
} else if (InternalType.STORM_DISSIPATED.equals(t)
|| list.size() == MAX_FORECASTS) {
boolean firstValue = true;
for (ForecastPosition fp : list) {
TropicalCycloneGuidance rpt = new TropicalCycloneGuidance();
SurfaceObsLocation location = new SurfaceObsLocation(stationId);
SurfaceObsLocation location = new SurfaceObsLocation(
stationId);
location.setLongitude(fp.longitude);
location.setLatitude(fp.latitude);
@ -102,13 +110,15 @@ public class QLMData extends TCGDataAdapter{
rpt.setType(stormType);
rpt.setProductType(productType);
rpt.setLocation(location);
rpt.setInsertTime(Calendar.getInstance(TimeZone.getTimeZone("GMT")));
rpt.setInsertTime(Calendar.getInstance(TimeZone
.getTimeZone("GMT")));
DataTime dt;
if (firstValue) {
firstValue = false;
dt = new DataTime(refTime.getRefTimeAsCalendar());
} else {
dt = new DataTime(refTime.getRefTimeAsCalendar(), fp.hour * 3600);
dt = new DataTime(refTime.getRefTimeAsCalendar(),
fp.hour * 3600);
}
rpt.setDataTime(dt);
reports.add(rpt);
@ -129,16 +139,13 @@ public class QLMData extends TCGDataAdapter{
}
private void parseInitTimeInfo(String initTimeInfo) {
String data[] = getParts(initTimeInfo.substring(12), 3);
int hour = Integer.valueOf(data[0].substring(0, data[0].length() - 1));
int minute = 0;
int month = MONTH_MAP.get(data[1]);
int day = Integer.valueOf(data[2]);
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
cal.setTime(new Date());
Calendar cal = wmoHeader.getHeaderDate();
int year = cal.get(Calendar.YEAR);
refTime = getDataTime(year, month, day, hour, minute, "GMT");
@ -154,6 +161,7 @@ public class QLMData extends TCGDataAdapter{
list.add(new ForecastPosition(hour, lat, lon));
}
@Override
public void clearData() {
list.clear();
stationId = null;

View file

@ -50,6 +50,8 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 26, 2009 jsanchez Initial creation
* Jun 28, 2012 #826 dgilling Ensure getDataTime properly
* handles time zones.
*
* </pre>
*
@ -271,7 +273,7 @@ public abstract class TCGDataAdapter {
protected DataTime getDataTime(int year, int month, int day, int hour,
int minute, String timeZone) {
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone(timeZone));
cal.set(Calendar.YEAR, year);
cal.set(Calendar.MONTH, month - 1);
cal.set(Calendar.DAY_OF_MONTH, day);
@ -279,7 +281,6 @@ public abstract class TCGDataAdapter {
cal.set(Calendar.MINUTE, minute);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
cal.setTimeZone(TimeZone.getTimeZone(timeZone));
return new DataTime(cal);
}