Merge branch '9-Wes2Bridge' into development

Former-commit-id: 522a35f61b [formerly 732d7b77d80e7647bc79de5df072f37a2449b0cf]
Former-commit-id: e1addfad12
This commit is contained in:
Bryan Kowal 2012-06-13 15:29:38 -05:00
commit cb8b3f37b1
275 changed files with 32237 additions and 27259 deletions

1
.gitignore vendored
View file

@ -9,3 +9,4 @@ bin-test/
*.pyo *.pyo
*.o *.o
*.orig *.orig

View file

@ -42,6 +42,7 @@ import com.raytheon.uf.common.pointdata.PointDataDescription.Type;
import com.raytheon.uf.common.pointdata.PointDataView; import com.raytheon.uf.common.pointdata.PointDataView;
import com.raytheon.uf.common.time.BinOffset; import com.raytheon.uf.common.time.BinOffset;
import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.viz.core.catalog.DirectDbQuery; import com.raytheon.uf.viz.core.catalog.DirectDbQuery;
import com.raytheon.uf.viz.core.catalog.LayerProperty; import com.raytheon.uf.viz.core.catalog.LayerProperty;
import com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter; import com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter;
@ -127,6 +128,7 @@ public class CoopPrecipDataCubeAdapter implements IDataCubeAdapter {
List<List<DataTime>> results = new ArrayList<List<DataTime>>( List<List<DataTime>> results = new ArrayList<List<DataTime>>(
requests.size()); requests.size());
for (TimeQueryRequest request : requests) { for (TimeQueryRequest request : requests) {
request.setSimDate(SimulatedTime.getSystemTime().getTime());
DataTime[] result = timeQuery(request.getQueryTerms(), DataTime[] result = timeQuery(request.getQueryTerms(),
request.isMaxQuery(), request.getBinOffset()); request.isMaxQuery(), request.getBinOffset());
if (result != null) { if (result != null) {

View file

@ -36,6 +36,7 @@ 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.time.BinOffset; import com.raytheon.uf.common.time.BinOffset;
import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.viz.core.comm.Connector; import com.raytheon.uf.viz.core.comm.Connector;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.requests.ThriftClient; import com.raytheon.uf.viz.core.requests.ThriftClient;
@ -232,7 +233,9 @@ public class CatalogQuery {
req.setMaxQuery(max); req.setMaxQuery(max);
req.setPluginName(pluginName); req.setPluginName(pluginName);
req.setBinOffset(binOffset); req.setBinOffset(binOffset);
req.setSimDate(SimulatedTime.getSystemTime().getTime());
req.setQueryTerms(constraintMap); req.setQueryTerms(constraintMap);
return req; return req;
} }
@ -251,6 +254,7 @@ public class CatalogQuery {
* @return the available times that meet the constraints * @return the available times that meet the constraints
* @throws VizException * @throws VizException
*/ */
@SuppressWarnings("unchecked")
public static DataTime[] performTimeQuery( public static DataTime[] performTimeQuery(
Map<String, RequestConstraint> constraintMap, boolean max, Map<String, RequestConstraint> constraintMap, boolean max,
BinOffset binOffset) throws VizException { BinOffset binOffset) throws VizException {

View file

@ -31,6 +31,7 @@ import com.raytheon.uf.common.datastorage.Request;
import com.raytheon.uf.common.datastorage.records.IDataRecord; import com.raytheon.uf.common.datastorage.records.IDataRecord;
import com.raytheon.uf.common.pointdata.PointDataContainer; import com.raytheon.uf.common.pointdata.PointDataContainer;
import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.viz.core.catalog.LayerProperty; import com.raytheon.uf.viz.core.catalog.LayerProperty;
import com.raytheon.uf.viz.core.catalog.ScriptCreator; import com.raytheon.uf.viz.core.catalog.ScriptCreator;
import com.raytheon.uf.viz.core.comm.Loader; import com.raytheon.uf.viz.core.comm.Loader;
@ -87,6 +88,11 @@ public class DefaultDataCubeAdapter implements IDataCubeAdapter {
throws VizException { throws VizException {
TimeQueryRequestSet set = new TimeQueryRequestSet(); TimeQueryRequestSet set = new TimeQueryRequestSet();
set.setRequests(requests.toArray(new TimeQueryRequest[0])); set.setRequests(requests.toArray(new TimeQueryRequest[0]));
// boundary for time queries
for (TimeQueryRequest req: set.getRequests()) {
req.setSimDate(SimulatedTime.getSystemTime().getTime());
}
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
List<List<DataTime>> result = (List<List<DataTime>>) ThriftClient List<List<DataTime>> result = (List<List<DataTime>>) ThriftClient
.sendRequest(set); .sendRequest(set);

View file

@ -245,8 +245,14 @@ public class RemoteDataStore implements IDataStore {
} }
@Override @Override
public void repack(String dirName, Compression compression) public void repack(Compression compression) throws StorageException {
throws StorageException { throw new StorageException("Operation not supported", null);
}
@Override
public void copy(String outputDir, Compression compression,
String timestampCheck, int minMillisSinceLastChange,
int maxMillisSinceLastChange) throws StorageException {
throw new StorageException("Operation not supported", null); throw new StorageException("Operation not supported", null);
} }

View file

@ -43,6 +43,7 @@ import com.raytheon.uf.common.datastorage.Request;
import com.raytheon.uf.common.datastorage.records.IDataRecord; import com.raytheon.uf.common.datastorage.records.IDataRecord;
import com.raytheon.uf.common.pointdata.PointDataContainer; import com.raytheon.uf.common.pointdata.PointDataContainer;
import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.viz.core.catalog.LayerProperty; import com.raytheon.uf.viz.core.catalog.LayerProperty;
import com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter; import com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter;
import com.raytheon.uf.viz.core.datastructure.VizDataCubeException; import com.raytheon.uf.viz.core.datastructure.VizDataCubeException;
@ -108,6 +109,7 @@ public abstract class AbstractDataCubeAdapter implements IDataCubeAdapter {
for (TimeQueryRequest request : requests) { for (TimeQueryRequest request : requests) {
List<AbstractRequestableLevelNode> requestNodes = evaluateRequestConstraints(request List<AbstractRequestableLevelNode> requestNodes = evaluateRequestConstraints(request
.getQueryTerms()); .getQueryTerms());
request.setSimDate(SimulatedTime.getSystemTime().getTime());
// pull out time queries and bulk submit // pull out time queries and bulk submit
for (AbstractRequestableLevelNode requestNode : requestNodes) { for (AbstractRequestableLevelNode requestNode : requestNodes) {
getTimeQuery(request, requestNode, false, queries, cache, null); getTimeQuery(request, requestNode, false, queries, cache, null);

View file

@ -39,6 +39,7 @@ import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.serialization.SerializationUtil; 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.time.SimulatedTime;
import com.raytheon.uf.common.util.FileUtil; import com.raytheon.uf.common.util.FileUtil;
import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.monitor.ffmp.FFMPMonitor; import com.raytheon.uf.viz.monitor.ffmp.FFMPMonitor;
@ -474,7 +475,7 @@ public class FFMPDataLoader extends Thread {
FFMPBasinData basinData = null; FFMPBasinData basinData = null;
if (file.exists()) { if (file.exists() && SimulatedTime.getSystemTime().isRealTime()) {
System.out.println("File path: " + file.getName()); System.out.println("File path: " + file.getName());

View file

@ -11,6 +11,8 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import com.raytheon.uf.common.util.FileUtil;
/** /**
* Utility to populate EDEX with Data for DAT tools * Utility to populate EDEX with Data for DAT tools
* *
@ -281,7 +283,8 @@ public class ScanTestDataPopulator {
*/ */
private void copyFile(File file) { private void copyFile(File file) {
File outfile = new File(MANUAL_INGEST_DIR + "/" + file.getName()); File outfile = new File(FileUtil.join(MANUAL_INGEST_DIR,
file.getName()));
InputStream in = null; InputStream in = null;
try { try {
in = new FileInputStream(file); in = new FileInputStream(file);

View file

@ -24,6 +24,8 @@ import java.util.Collection;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.alerts.AlertMessage; import com.raytheon.uf.viz.core.alerts.AlertMessage;
import com.raytheon.uf.viz.core.catalog.DirectDbQuery; import com.raytheon.uf.viz.core.catalog.DirectDbQuery;
@ -67,14 +69,18 @@ public abstract class Monitor implements IMonitor, IMonitorThresholdListener,
private ArrayList<IMonitorListener> monitorListeners = new ArrayList<IMonitorListener>(); private ArrayList<IMonitorListener> monitorListeners = new ArrayList<IMonitorListener>();
@Override @Override
public void alertArrived(Collection<AlertMessage> alertMessages) { public void alertArrived(Collection<AlertMessage> alertMessages) {
// knock down messages we don't want // knock down messages we don't want
for (AlertMessage msg : alertMessages) { for (AlertMessage msg : alertMessages) {
if (filterProductMessage(msg)) { DataTime dataTime = (DataTime) msg.decodedAlert.get("dataTime");
processProductMessage(msg); if (dataTime.getRefTime().before(
} SimulatedTime.getSystemTime().getTime())) {
} if (filterProductMessage(msg)) {
} processProductMessage(msg);
}
}
}
}
@Override @Override
public void notificationArrived(NotificationMessage[] notifyMessages) { public void notificationArrived(NotificationMessage[] notifyMessages) {

View file

@ -46,6 +46,7 @@ import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.data.ObConst; import com.raytheon.uf.common.monitor.data.ObConst;
import com.raytheon.uf.viz.monitor.data.ObMultiHrsReports; import com.raytheon.uf.viz.monitor.data.ObMultiHrsReports;
import com.raytheon.uf.viz.monitor.data.ObTrendDataSet; import com.raytheon.uf.viz.monitor.data.ObTrendDataSet;
import com.raytheon.uf.viz.monitor.util.ObUtil;
/** /**
* The Trend Canvas * The Trend Canvas
@ -75,7 +76,7 @@ public class TrendPlotCanvas {
private Canvas canvas; private Canvas canvas;
Calendar curdate; private Calendar curdate;
private SortedMap<Date, Float> trendData; private SortedMap<Date, Float> trendData;
@ -200,7 +201,8 @@ public class TrendPlotCanvas {
if (!Float.isNaN(thresholds[1])) { if (!Float.isNaN(thresholds[1])) {
yellowThreshold = thresholds[1]; yellowThreshold = thresholds[1];
} }
curdate = Calendar.getInstance(); curdate = ObUtil.getTimeNow(); // Calendar.getInstance();
if (trendDataSet.getYAxisMinMaxIncrement() != null) { if (trendDataSet.getYAxisMinMaxIncrement() != null) {
float[] minMaxIncr = trendDataSet.getYAxisMinMaxIncrement(); float[] minMaxIncr = trendDataSet.getYAxisMinMaxIncrement();
if (!Float.isNaN(minMaxIncr[0])) { if (!Float.isNaN(minMaxIncr[0])) {

View file

@ -68,6 +68,7 @@ import com.raytheon.uf.viz.monitor.listeners.IMonitorListener;
import com.raytheon.uf.viz.monitor.trendplot.TrendPlotDlg; import com.raytheon.uf.viz.monitor.trendplot.TrendPlotDlg;
import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants; import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants;
import com.raytheon.viz.ui.EditorUtil; import com.raytheon.viz.ui.EditorUtil;
import com.raytheon.uf.viz.monitor.util.ObUtil;
/** /**
* Abstrct Zone table dialog that is the foundation for all Zone dialogs. * Abstrct Zone table dialog that is the foundation for all Zone dialogs.
@ -760,7 +761,7 @@ public abstract class ZoneTableDlg extends Dialog implements IMonitorListener,
HodographDlg hodographDlg = new HodographDlg(shell, HodographDlg hodographDlg = new HodographDlg(shell,
varName.name(), station, "METAR"); varName.name(), station, "METAR");
hodographDlg.setCurrentTime(Calendar.getInstance()); hodographDlg.setCurrentTime(ObUtil.getTimeNow()); //Calendar.getInstance());
if (thresholds[0] == Float.NaN || thresholds[1] == Float.NaN if (thresholds[0] == Float.NaN || thresholds[1] == Float.NaN
|| thresholds[2] == Float.NaN || thresholds[2] == Float.NaN
|| thresholds[3] == Float.NaN) { || thresholds[3] == Float.NaN) {

View file

@ -82,6 +82,19 @@ public final class ObUtil {
dropTime.add(Calendar.HOUR, -(ObConst.THREAT_INTERVAL_HOURS)); dropTime.add(Calendar.HOUR, -(ObConst.THREAT_INTERVAL_HOURS));
return dropTime.getTime(); return dropTime.getTime();
} }
/**
* Method that gets the current time.
*
* @return current time.
*/
public static Calendar getTimeNow() {
Date now = SimulatedTime.getSystemTime().getTime();
Calendar nowTime = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
nowTime.setTime(now);
return nowTime;
}
/** /**
* Checks for the existence of a localization-created flag file which * Checks for the existence of a localization-created flag file which

View file

@ -384,13 +384,26 @@ public class CachingDataStore implements IDataStore {
* (non-Javadoc) * (non-Javadoc)
* *
* @see * @see
* com.raytheon.uf.common.datastorage.IDataStore#repack(java.lang.String, * com.raytheon.uf.common.datastorage.IDataStore#repack(com.raytheon.uf.
* com.raytheon.uf.common.datastorage.StorageProperties.Compression) * common.datastorage.StorageProperties.Compression)
*/ */
@Override @Override
public void repack(String dirName, Compression compression) public void repack(Compression compression) throws StorageException {
throws StorageException { delegate.repack(compression);
delegate.repack(dirName, compression);
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.common.datastorage.IDataStore#copy(java.lang.String,
* com.raytheon.uf.common.datastorage.StorageProperties.Compression,
* java.lang.String, int, int)
*/
@Override
public void copy(String outputDir, Compression compression,
String timestampCheck, int minMillisSinceLastChange,
int maxMillisSinceLastChange) throws StorageException {
delegate.copy(outputDir, compression, timestampCheck,
minMillisSinceLastChange, maxMillisSinceLastChange);
}
} }

View file

@ -35,6 +35,7 @@ import com.raytheon.uf.common.dataquery.requests.TimeQueryRequest;
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.time.DataTime; import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.viz.core.datastructure.DataCubeContainer; import com.raytheon.uf.viz.core.datastructure.DataCubeContainer;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.URICatalog; import com.raytheon.uf.viz.core.rsc.URICatalog;
@ -122,6 +123,7 @@ public class ThinClientURICatalog extends URICatalog implements
TimeQueryRequest request = new TimeQueryRequest(); TimeQueryRequest request = new TimeQueryRequest();
request.setPluginName(pluginName); request.setPluginName(pluginName);
request.setMaxQuery(true); request.setMaxQuery(true);
request.setSimDate(SimulatedTime.getSystemTime().getTime());
request.setQueryTerms(map); request.setQueryTerms(map);
List<TimeQueryRequest> requestList = requests.get(pluginName); List<TimeQueryRequest> requestList = requests.get(pluginName);
if (requestList == null) { if (requestList == null) {

View file

@ -54,7 +54,6 @@ 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.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.localization.LocalizationConstants;
import com.raytheon.uf.viz.core.localization.LocalizationManager; import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.ui.menus.xml.IncludeMenuItem; import com.raytheon.uf.viz.ui.menus.xml.IncludeMenuItem;
@ -76,6 +75,9 @@ import com.raytheon.uf.viz.ui.menus.xml.IncludeMenuItem;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Mar 12, 2009 chammack Initial creation * Mar 12, 2009 chammack Initial creation
* Apr 27, 2012 #562 dgilling Ensure call to MenuCreationJob
* uses proper method to retrieve
* localized site.
* *
* </pre> * </pre>
* *
@ -105,13 +107,13 @@ public class DiscoverMenuContributions {
public static synchronized void discoverContributions( public static synchronized void discoverContributions(
final String[] menuArray, boolean scheduleJob) { final String[] menuArray, boolean scheduleJob) {
if (ran) if (ran) {
return; return;
}
if (scheduleJob) { if (scheduleJob) {
MenuCreationJob job = new MenuCreationJob(LocalizationManager MenuCreationJob job = new MenuCreationJob(LocalizationManager
.getInstance().getLocalizationStore() .getInstance().getSite());
.getString(LocalizationConstants.P_LOCALIZATION_SITE_NAME));
job.schedule(); job.schedule();
try { try {

View file

@ -33,6 +33,8 @@ import com.raytheon.uf.common.dataplugin.PluginDataObject;
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.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.viz.core.IDisplayPane; import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.IDisplayPaneContainer; import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.uf.viz.core.RecordFactory; import com.raytheon.uf.viz.core.RecordFactory;
@ -105,100 +107,106 @@ public class AutoUpdater implements IAlertObserver {
public AutoUpdater() { public AutoUpdater() {
} }
@Override @Override
public void alertArrived(Collection<AlertMessage> alertMessages) { public void alertArrived(Collection<AlertMessage> alertMessages) {
Set<IDescriptor> displayList = new HashSet<IDescriptor>(); Set<IDescriptor> displayList = new HashSet<IDescriptor>();
Map<AbstractRequestableResourceData, List<Object>> pdoSendMap = new IdentityHashMap<AbstractRequestableResourceData, List<Object>>(); Map<AbstractRequestableResourceData, List<Object>> pdoSendMap = new IdentityHashMap<AbstractRequestableResourceData, List<Object>>();
int errors = 0; int errors = 0;
for (AlertMessage message : alertMessages) { for (AlertMessage message : alertMessages) {
Map<String, Object> attribs = message.decodedAlert; Map<String, Object> attribs = message.decodedAlert;
try { DataTime dataTime = (DataTime) attribs.get("dataTime");
// System.out.println("extract took: " + (tZ1 - tZ0)); if (dataTime.getRefTime().before(
java.util.List<AbstractVizResource<?, ?>> rscList = DataUpdateTree SimulatedTime.getSystemTime().getTime())) {
.getInstance().searchTree(attribs); try {
// System.out.println("AutoUpdater found: " + rscList); // System.out.println("extract took: " + (tZ1 - tZ0));
java.util.List<AbstractVizResource<?, ?>> rscList = DataUpdateTree
.getInstance().searchTree(attribs);
// System.out.println("AutoUpdater found: " + rscList);
if (rscList != null && rscList.size() > 0) { if (rscList != null && rscList.size() > 0) {
for (AbstractVizResource<?, ?> r1 : rscList) { for (AbstractVizResource<?, ?> r1 : rscList) {
IDescriptor md = r1.getDescriptor(); IDescriptor md = r1.getDescriptor();
AbstractResourceData resourceData = r1 AbstractResourceData resourceData = r1
.getResourceData(); .getResourceData();
if (!(resourceData instanceof AbstractRequestableResourceData) if (!(resourceData instanceof AbstractRequestableResourceData)
|| resourceData.isFrozen()) || resourceData.isFrozen())
continue; continue;
AbstractRequestableResourceData reqResourceData = (AbstractRequestableResourceData) resourceData; AbstractRequestableResourceData reqResourceData = (AbstractRequestableResourceData) resourceData;
AbstractAlertMessageParser parserToUse = null; AbstractAlertMessageParser parserToUse = null;
if ((parserToUse = reqResourceData.getAlertParser()) == null) { if ((parserToUse = reqResourceData.getAlertParser()) == null) {
parserToUse = defaultParser; parserToUse = defaultParser;
} }
Object objectToSend = parserToUse.parseAlertMessage( Object objectToSend = parserToUse
message, reqResourceData); .parseAlertMessage(message, reqResourceData);
if (objectToSend != null) { if (objectToSend != null) {
if (md.getTimeMatcher() != null) { if (md.getTimeMatcher() != null) {
md.getTimeMatcher().redoTimeMatching(r1); md.getTimeMatcher().redoTimeMatching(r1);
} }
displayList.add(md); displayList.add(md);
List<Object> list = pdoSendMap.get(reqResourceData); List<Object> list = pdoSendMap
if (list == null) { .get(reqResourceData);
list = new ArrayList<Object>(); if (list == null) {
pdoSendMap.put(reqResourceData, list); list = new ArrayList<Object>();
} pdoSendMap.put(reqResourceData, list);
list.add(objectToSend); }
list.add(objectToSend);
if (list.size() > 100) { if (list.size() > 100) {
// update with objects // update with objects
Class<?> componentType = list.get(0).getClass(); Class<?> componentType = list.get(0)
reqResourceData.update(list .getClass();
.toArray((Object[]) Array.newInstance( reqResourceData.update(list
componentType, list.size()))); .toArray((Object[]) Array
list.clear(); .newInstance(componentType,
} list.size())));
} list.clear();
}
}
} }
} }
} catch (final Throwable e) { } catch (final Throwable e) {
if (errors < MAX_ERRORS) { if (errors < MAX_ERRORS) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"Error performing autoupdate", e); "Error performing autoupdate", e);
} }
errors++; errors++;
} }
}
} for (AbstractRequestableResourceData arrd : pdoSendMap.keySet()) {
List<Object> pdos = pdoSendMap.get(arrd);
if (pdos == null || pdos.size() < 1) {
continue;
}
Class<?> componentType = pdos.get(0).getClass();
arrd.update(pdos.toArray((Object[]) Array.newInstance(
componentType, pdos.size())));
}
for (AbstractRequestableResourceData arrd : pdoSendMap.keySet()) { List<IDescriptor> refreshedDescriptors = new ArrayList<IDescriptor>();
List<Object> pdos = pdoSendMap.get(arrd); // Now do redo time matching, and refresh displays
if (pdos == null || pdos.size() < 1) { for (IDescriptor disp : displayList) {
continue; if (disp != null && disp.getRenderableDisplay() != null) {
} IDisplayPaneContainer container = disp
Class<?> componentType = pdos.get(0).getClass(); .getRenderableDisplay().getContainer();
arrd.update(pdos.toArray((Object[]) Array.newInstance( for (IDisplayPane pane : container.getDisplayPanes()) {
componentType, pdos.size()))); IDescriptor desc = pane.getDescriptor();
}
List<IDescriptor> refreshedDescriptors = new ArrayList<IDescriptor>(); if (refreshedDescriptors.contains(desc)) {
// Now do redo time matching, and refresh displays continue;
for (IDescriptor disp : displayList) { }
if (disp != null && disp.getRenderableDisplay() != null) { TimeMatchingJob.scheduleTimeMatch(desc);
IDisplayPaneContainer container = disp.getRenderableDisplay() }
.getContainer(); }
for (IDisplayPane pane : container.getDisplayPanes()) { }
IDescriptor desc = pane.getDescriptor(); }
}
if (refreshedDescriptors.contains(desc)) {
continue;
}
TimeMatchingJob.scheduleTimeMatch(desc);
}
}
}
}
} }

View file

@ -26,6 +26,7 @@ import java.util.Map;
import com.raytheon.edex.util.Util; import com.raytheon.edex.util.Util;
import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.viz.core.alerts.AlertMessage; import com.raytheon.uf.viz.core.alerts.AlertMessage;
import com.raytheon.uf.viz.core.rsc.URICatalog; import com.raytheon.uf.viz.core.rsc.URICatalog;
import com.raytheon.uf.viz.core.rsc.URICatalog.IURIRefreshCallback; import com.raytheon.uf.viz.core.rsc.URICatalog.IURIRefreshCallback;
@ -65,25 +66,29 @@ public class MenuUpdater implements IAlertObserver {
Map<String, Object> attribs = new HashMap<String, Object>( Map<String, Object> attribs = new HashMap<String, Object>(
message.decodedAlert); message.decodedAlert);
DataTime dataTimeStr = (DataTime) attribs.get("dataTime"); DataTime dataTimeStr = (DataTime) attribs.get("dataTime");
if (dataTimeStr.getRefTime().before(
SimulatedTime.getSystemTime().getTime())) {
if (dataTimeStr != null) { if (dataTimeStr != null) {
// Update the date catalog // Update the date catalog
List<List<IURIRefreshCallback>> dataTimeList = URICatalog List<List<IURIRefreshCallback>> dataTimeList = URICatalog
.getInstance().searchTree(attribs); .getInstance().searchTree(attribs);
// If we found listeners, update them // If we found listeners, update them
if (dataTimeList != null) { if (dataTimeList != null) {
DataTime dataTime = dataTimeStr.clone(); DataTime dataTime = dataTimeStr.clone();
for (List<IURIRefreshCallback> refreshList : dataTimeList) { for (List<IURIRefreshCallback> refreshList : dataTimeList) {
for (IURIRefreshCallback callback : refreshList) { for (IURIRefreshCallback callback : refreshList) {
if (callback != null) { if (callback != null) {
callback.updateTime(dataTime); callback.updateTime(dataTime);
} }
} }
} }
} }
} }
}
} }
} }

View file

@ -137,7 +137,7 @@ public class RestoreFileSelectDlg extends Dialog {
StdTextProduct tmp = ((StdTextProduct) (obj)); StdTextProduct tmp = ((StdTextProduct) (obj));
Calendar createTime = Calendar.getInstance(TimeZone Calendar createTime = Calendar.getInstance(TimeZone
.getTimeZone("GMT")); .getTimeZone("GMT"));
createTime.setTimeInMillis(tmp.getCreatetime()); createTime.setTimeInMillis(tmp.getRefTime());
String label = tmp.getCccid() + tmp.getNnnid() + tmp.getXxxid() String label = tmp.getCccid() + tmp.getNnnid() + tmp.getXxxid()
+ " - " + createTime.getTime().toString(); + " - " + createTime.getTime().toString();
fileList.add(label); fileList.add(label);

View file

@ -22,6 +22,8 @@ package com.raytheon.viz.aviation.monitor;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.viz.core.alerts.AlertMessage; import com.raytheon.uf.viz.core.alerts.AlertMessage;
import com.raytheon.viz.alerts.IAlertObserver; import com.raytheon.viz.alerts.IAlertObserver;
import com.raytheon.viz.aviation.guidance.EtaViewer; import com.raytheon.viz.aviation.guidance.EtaViewer;
@ -64,18 +66,23 @@ public class EtaBufMonitorObserver extends MonitorObserver implements
public void alertArrived(Collection<AlertMessage> alertMessages) { public void alertArrived(Collection<AlertMessage> alertMessages) {
ArrayList<String> siteIDs = new ArrayList<String>(); ArrayList<String> siteIDs = new ArrayList<String>();
for (AlertMessage alert : alertMessages) { for (AlertMessage alert : alertMessages) {
String siteID = (String) alert.decodedAlert DataTime dataTime = (DataTime) alert.decodedAlert.get("dataTime");
.get("location.stationId"); if (dataTime.getRefTime().before(
if (!siteIDs.contains(siteID)) { SimulatedTime.getSystemTime().getTime())) {
for (TafSiteComp tsc : dialog.getTafSiteComps()) {
if (tsc.getStationName().equals(siteID)) { String siteID = (String) alert.decodedAlert
siteIDs.add(siteID); .get("location.stationId");
break; if (!siteIDs.contains(siteID)) {
} for (TafSiteComp tsc : dialog.getTafSiteComps()) {
} if (tsc.getStationName().equals(siteID)) {
} siteIDs.add(siteID);
} break;
}
}
}
}
}
if (siteIDs.size() > 0) { if (siteIDs.size() > 0) {
for (ViewerTab tab : dialog.getViewerTabList()) { for (ViewerTab tab : dialog.getViewerTabList()) {

View file

@ -22,6 +22,8 @@ package com.raytheon.viz.aviation.monitor;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.viz.core.alerts.AlertMessage; import com.raytheon.uf.viz.core.alerts.AlertMessage;
import com.raytheon.viz.alerts.IAlertObserver; import com.raytheon.viz.alerts.IAlertObserver;
import com.raytheon.viz.aviation.guidance.MosViewer; import com.raytheon.viz.aviation.guidance.MosViewer;
@ -64,18 +66,22 @@ public class EtaMonitorObserver extends MonitorObserver implements
public void alertArrived(Collection<AlertMessage> alertMessages) { public void alertArrived(Collection<AlertMessage> alertMessages) {
ArrayList<String> siteIDs = new ArrayList<String>(); ArrayList<String> siteIDs = new ArrayList<String>();
for (AlertMessage alert : alertMessages) { for (AlertMessage alert : alertMessages) {
String siteID = (String) alert.decodedAlert DataTime dataTime = (DataTime) alert.decodedAlert.get("dataTime");
.get("location.stationId"); if (dataTime.getRefTime().before(
if (!siteIDs.contains(siteID)) { SimulatedTime.getSystemTime().getTime())) {
for (TafSiteComp tsc : dialog.getTafSiteComps()) { String siteID = (String) alert.decodedAlert
if (tsc.getStationName().equals(siteID)) { .get("location.stationId");
siteIDs.add(siteID); if (!siteIDs.contains(siteID)) {
break; for (TafSiteComp tsc : dialog.getTafSiteComps()) {
} if (tsc.getStationName().equals(siteID)) {
} siteIDs.add(siteID);
} break;
} }
}
}
}
}
if (siteIDs.size() > 0) { if (siteIDs.size() > 0) {
for (ViewerTab tab : dialog.getViewerTabList()) { for (ViewerTab tab : dialog.getViewerTabList()) {

View file

@ -22,6 +22,8 @@ package com.raytheon.viz.aviation.monitor;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.viz.core.alerts.AlertMessage; import com.raytheon.uf.viz.core.alerts.AlertMessage;
import com.raytheon.viz.alerts.IAlertObserver; import com.raytheon.viz.alerts.IAlertObserver;
import com.raytheon.viz.aviation.guidance.MosViewer; import com.raytheon.viz.aviation.guidance.MosViewer;
@ -65,18 +67,22 @@ public class GfsLampMonitorObserver extends MonitorObserver implements
public void alertArrived(Collection<AlertMessage> alertMessages) { public void alertArrived(Collection<AlertMessage> alertMessages) {
ArrayList<String> siteIDs = new ArrayList<String>(); ArrayList<String> siteIDs = new ArrayList<String>();
for (AlertMessage alert : alertMessages) { for (AlertMessage alert : alertMessages) {
String siteID = (String) alert.decodedAlert DataTime dataTime = (DataTime) alert.decodedAlert.get("dataTime");
.get("location.stationId"); if (dataTime.getRefTime().before(
if (!siteIDs.contains(siteID)) { SimulatedTime.getSystemTime().getTime())) {
for (TafSiteComp tsc : dialog.getTafSiteComps()) { String siteID = (String) alert.decodedAlert
if (tsc.getStationName().equals(siteID)) { .get("location.stationId");
siteIDs.add(siteID); if (!siteIDs.contains(siteID)) {
break; for (TafSiteComp tsc : dialog.getTafSiteComps()) {
} if (tsc.getStationName().equals(siteID)) {
} siteIDs.add(siteID);
} break;
} }
}
}
}
}
if (siteIDs.size() > 0) { if (siteIDs.size() > 0) {
for (ViewerTab tab : dialog.getViewerTabList()) { for (ViewerTab tab : dialog.getViewerTabList()) {

View file

@ -22,6 +22,8 @@ package com.raytheon.viz.aviation.monitor;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.viz.core.alerts.AlertMessage; import com.raytheon.uf.viz.core.alerts.AlertMessage;
import com.raytheon.viz.alerts.IAlertObserver; import com.raytheon.viz.alerts.IAlertObserver;
import com.raytheon.viz.aviation.guidance.MosViewer; import com.raytheon.viz.aviation.guidance.MosViewer;
@ -64,18 +66,22 @@ public class GfsMonitorObserver extends MonitorObserver implements
public void alertArrived(Collection<AlertMessage> alertMessages) { public void alertArrived(Collection<AlertMessage> alertMessages) {
ArrayList<String> siteIDs = new ArrayList<String>(); ArrayList<String> siteIDs = new ArrayList<String>();
for (AlertMessage alert : alertMessages) { for (AlertMessage alert : alertMessages) {
String siteID = (String) alert.decodedAlert DataTime dataTime = (DataTime) alert.decodedAlert.get("dataTime");
.get("location.stationId"); if (dataTime.getRefTime().before(
if (!siteIDs.contains(siteID)) { SimulatedTime.getSystemTime().getTime())) {
for (TafSiteComp tsc : dialog.getTafSiteComps()) { String siteID = (String) alert.decodedAlert
if (tsc.getStationName().equals(siteID)) { .get("location.stationId");
siteIDs.add(siteID); if (!siteIDs.contains(siteID)) {
break; for (TafSiteComp tsc : dialog.getTafSiteComps()) {
} if (tsc.getStationName().equals(siteID)) {
} siteIDs.add(siteID);
} break;
} }
}
}
}
}
if (siteIDs.size() > 0) { if (siteIDs.size() > 0) {
for (ViewerTab tab : dialog.getViewerTabList()) { for (ViewerTab tab : dialog.getViewerTabList()) {

View file

@ -24,6 +24,8 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import com.raytheon.uf.common.dataplugin.grib.GribRecord; import com.raytheon.uf.common.dataplugin.grib.GribRecord;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.viz.core.alerts.AlertMessage; import com.raytheon.uf.viz.core.alerts.AlertMessage;
import com.raytheon.viz.alerts.IAlertObserver; import com.raytheon.viz.alerts.IAlertObserver;
import com.raytheon.viz.alerts.observers.ProductAlertObserver; import com.raytheon.viz.alerts.observers.ProductAlertObserver;
@ -85,7 +87,11 @@ public class GribRequestableDataFactory implements IAlertObserver {
@Override @Override
public void alertArrived(Collection<AlertMessage> alertMessages) { public void alertArrived(Collection<AlertMessage> alertMessages) {
for (AlertMessage mess : alertMessages) { for (AlertMessage mess : alertMessages) {
requestableDataMap.remove(mess.dataURI); DataTime dataTime = (DataTime) mess.decodedAlert.get("dataTime");
} if (dataTime.getRefTime().before(
} SimulatedTime.getSystemTime().getTime())) {
requestableDataMap.remove(mess.dataURI);
}
}
}
} }

View file

@ -39,6 +39,7 @@ 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.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.viz.core.alerts.AlertMessage; import com.raytheon.uf.viz.core.alerts.AlertMessage;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.derivparam.library.DerivParamMethod; import com.raytheon.uf.viz.derivparam.library.DerivParamMethod;
@ -206,98 +207,107 @@ public class GridUpdater implements IAlertObserver {
* .core.alerts.AlertMessage[]) * .core.alerts.AlertMessage[])
*/ */
@Override @Override
public synchronized void alertArrived(Collection<AlertMessage> alertMessages) { public synchronized void alertArrived(Collection<AlertMessage> alertMessages) {
Set<String> datauris = new HashSet<String>(); Set<String> datauris = new HashSet<String>();
for (AlertMessage alert : alertMessages) { for (AlertMessage alert : alertMessages) {
if (myUpdates.remove(alert.dataURI)) { DataTime dataTime = (DataTime) alert.decodedAlert.get("dataTime");
// This updater triggered this alert, if it processes it now we if (dataTime.getRefTime().before(
// could do this forever SimulatedTime.getSystemTime().getTime())) {
continue;
}
GribMapKey updateKey = new GribMapKey(alert.decodedAlert);
GribTimeCache.getInstance().clearTimes(updateKey);
LevelNode lNode = null;
try {
Level level = LevelFactory.getInstance().getLevel(
updateKey.masterLevel, updateKey.levelone,
updateKey.leveltwo);
lNode = inventory.getNode(updateKey.modelName,
updateKey.parameter, level);
} catch (CommunicationException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
e);
}
if (lNode == null) { if (myUpdates.remove(alert.dataURI)) {
inventory.reinitTree(); // This updater triggered this alert, if it processes it now
// System.out.println(alert.dataURI); // we
// System.out.println("LevelId=" + level.getId()); // could do this forever
} else if (!(lNode instanceof GribRequestableLevelNode)) { continue;
if (lNode instanceof OrLevelNode) { }
DerivParamMethod method = ((OrLevelNode) lNode).getMethod(); GribMapKey updateKey = new GribMapKey(alert.decodedAlert);
// Null means it is an alias model and supplement means GribTimeCache.getInstance().clearTimes(updateKey);
// there exists a true GribNode buried under the or LevelNode lNode = null;
// node try {
if (method == null Level level = LevelFactory.getInstance().getLevel(
|| !method.getName().equals("Supplement")) { updateKey.masterLevel, updateKey.levelone,
inventory.reinitTree(); updateKey.leveltwo);
// System.out.println(((AbstractDerivedLevelNode) lNode) lNode = inventory.getNode(updateKey.modelName,
// .getModelName()); updateKey.parameter, level);
} } catch (CommunicationException e) {
} else { statusHandler.handle(Priority.PROBLEM,
inventory.reinitTree(); e.getLocalizedMessage(), e);
// System.out.println(alert.dataURI); }
// System.out.println(lNode.getClass());
}
}
Set<UpdateValue> set = updateMap.get(updateKey);
if (set == null) {
continue;
}
for (UpdateValue value : set) {
GribRecord fakeRec = new GribRecord();
fakeRec.setPluginName("grib");
Object obj = alert.decodedAlert.get("dataTime");
if (!(obj instanceof DataTime)) {
throw new IllegalArgumentException(
"Error processing Alerts: "
+ obj.toString()
+ " cannot be cast to a DataTime because it is a "
+ obj.getClass().getSimpleName());
}
DataTime time = (DataTime) obj;
fakeRec.setDataTime(new DataTime(time.getRefTime(), time
.getFcstTime() - value.timeOffset));
GribModel modelInfo = new GribModel();
modelInfo.setModelName(value.node.getModelName());
modelInfo.setParameterAbbreviation(value.node.getDesc()
.getAbbreviation());
modelInfo.setLevel(value.node.getLevel());
if (value.node instanceof GatherLevelNode) {
modelInfo.setPerturbationNumber(null);
} else {
modelInfo
.setPerturbationNumber((Integer) alert.decodedAlert
.get(GridInventory.PERT_QUERY));
}
// do I need to set this?
modelInfo.setTypeEnsemble(null);
fakeRec.setModelInfo(modelInfo);
try {
fakeRec.constructDataURI();
datauris.add(fakeRec.getDataURI());
} catch (PluginException e) {
statusHandler
.handle(Priority.PROBLEM,
"Unable to generate updates for derived product",
e);
}
} if (lNode == null) {
} inventory.reinitTree();
myUpdates.addAll(datauris); // System.out.println(alert.dataURI);
ProductAlertObserver.processDerivedAlerts(datauris); // System.out.println("LevelId=" + level.getId());
} } else if (!(lNode instanceof GribRequestableLevelNode)) {
if (lNode instanceof OrLevelNode) {
DerivParamMethod method = ((OrLevelNode) lNode)
.getMethod();
// Null means it is an alias model and supplement means
// there exists a true GribNode buried under the or
// node
if (method == null
|| !method.getName().equals("Supplement")) {
inventory.reinitTree();
// System.out.println(((AbstractDerivedLevelNode)
// lNode)
// .getModelName());
}
} else {
inventory.reinitTree();
// System.out.println(alert.dataURI);
// System.out.println(lNode.getClass());
}
}
Set<UpdateValue> set = updateMap.get(updateKey);
if (set == null) {
continue;
}
for (UpdateValue value : set) {
GribRecord fakeRec = new GribRecord();
fakeRec.setPluginName("grib");
Object obj = alert.decodedAlert.get("dataTime");
if (!(obj instanceof DataTime)) {
throw new IllegalArgumentException(
"Error processing Alerts: "
+ obj.toString()
+ " cannot be cast to a DataTime because it is a "
+ obj.getClass().getSimpleName());
}
DataTime time = (DataTime) obj;
fakeRec.setDataTime(new DataTime(time.getRefTime(), time
.getFcstTime() - value.timeOffset));
GribModel modelInfo = new GribModel();
modelInfo.setModelName(value.node.getModelName());
modelInfo.setParameterAbbreviation(value.node.getDesc()
.getAbbreviation());
modelInfo.setLevel(value.node.getLevel());
if (value.node instanceof GatherLevelNode) {
modelInfo.setPerturbationNumber(null);
} else {
modelInfo
.setPerturbationNumber((Integer) alert.decodedAlert
.get(GridInventory.PERT_QUERY));
}
// do I need to set this?
modelInfo.setTypeEnsemble(null);
fakeRec.setModelInfo(modelInfo);
try {
fakeRec.constructDataURI();
datauris.add(fakeRec.getDataURI());
} catch (PluginException e) {
statusHandler
.handle(Priority.PROBLEM,
"Unable to generate updates for derived product",
e);
}
}
} else {
System.out.println("Grid after SIMULATED TIME: "+dataTime);
}
}
myUpdates.addAll(datauris);
ProductAlertObserver.processDerivedAlerts(datauris);
}
/** /**
* *

View file

@ -20,6 +20,7 @@ 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.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.viz.core.alerts.AlertMessage; import com.raytheon.uf.viz.core.alerts.AlertMessage;
import com.raytheon.viz.alerts.IAlertObserver; import com.raytheon.viz.alerts.IAlertObserver;
import com.raytheon.viz.alerts.observers.ProductAlertObserver; import com.raytheon.viz.alerts.observers.ProductAlertObserver;
@ -128,60 +129,68 @@ public class RadarUpdater implements IAlertObserver {
return; return;
} }
Set<String> datauris = new HashSet<String>(); Set<String> datauris = new HashSet<String>();
for (AlertMessage alertMessage : alertMessages) { for (AlertMessage alertMessage : alertMessages) {
String icao = alertMessage.decodedAlert DataTime dataTime = (DataTime) alertMessage.decodedAlert
.get(RadarAdapter.ICAO_QUERY).toString(); .get("dataTime");
if (icao == null if (dataTime.getRefTime().before(
|| !icao.equalsIgnoreCase(configuredRadar.getRdaId())) { SimulatedTime.getSystemTime().getTime())) {
continue; String icao = alertMessage.decodedAlert.get(
} RadarAdapter.ICAO_QUERY).toString();
globalTimes = null; if (icao == null
Object obj = alertMessage.decodedAlert || !icao.equalsIgnoreCase(configuredRadar.getRdaId())) {
.get(RadarAdapter.PRODUCT_CODE_QUERY); continue;
if (obj == null || !(obj instanceof Integer)) { }
continue; globalTimes = null;
} Object obj = alertMessage.decodedAlert
Integer productCode = (Integer) obj; .get(RadarAdapter.PRODUCT_CODE_QUERY);
String paramAbbrev = RadarProductCodeMapping.getInstance() if (obj == null || !(obj instanceof Integer)) {
.getParameterAbbrev(productCode); continue;
if (paramAbbrev == null) { }
continue; Integer productCode = (Integer) obj;
} String paramAbbrev = RadarProductCodeMapping.getInstance()
obj = alertMessage.decodedAlert.get("dataTime"); .getParameterAbbrev(productCode);
if (obj == null || !(obj instanceof DataTime)) { if (paramAbbrev == null) {
continue; continue;
} }
DataTime time = (DataTime) obj; obj = alertMessage.decodedAlert.get("dataTime");
obj = alertMessage.decodedAlert.get(RadarAdapter.TILT_QUERY); if (obj == null || !(obj instanceof DataTime)) {
if (obj == null || !(obj instanceof Double)) { continue;
continue; }
} DataTime time = (DataTime) obj;
Double elevationAngle = (Double) obj; obj = alertMessage.decodedAlert.get(RadarAdapter.TILT_QUERY);
cache.remove(new CacheKey(productCode, elevationAngle)); if (obj == null || !(obj instanceof Double)) {
Level level = null; continue;
try { }
level = LevelFactory.getInstance().getLevel( Double elevationAngle = (Double) obj;
RadarAdapter.CUBE_MASTER_LEVEL_NAME, elevationAngle); cache.remove(new CacheKey(productCode, elevationAngle));
} catch (CommunicationException e1) { Level level = null;
statusHandler.handle(Priority.PROBLEM, try {
e1.getLocalizedMessage(), e1); level = LevelFactory.getInstance()
} .getLevel(RadarAdapter.CUBE_MASTER_LEVEL_NAME,
GribRecord fakeRec = new GribRecord(); elevationAngle);
fakeRec.setPluginName("grib"); } catch (CommunicationException e1) {
fakeRec.setDataTime(time); statusHandler.handle(Priority.PROBLEM,
GribModel modelInfo = new GribModel(); e1.getLocalizedMessage(), e1);
modelInfo.setModelName(RadarAdapter.RADAR_SOURCE); }
modelInfo.setParameterAbbreviation(paramAbbrev); GribRecord fakeRec = new GribRecord();
modelInfo.setLevel(level); fakeRec.setPluginName("grib");
modelInfo.setTypeEnsemble(null); fakeRec.setDataTime(time);
fakeRec.setModelInfo(modelInfo); GribModel modelInfo = new GribModel();
try { modelInfo.setModelName(RadarAdapter.RADAR_SOURCE);
fakeRec.constructDataURI(); modelInfo.setParameterAbbreviation(paramAbbrev);
datauris.add(fakeRec.getDataURI()); modelInfo.setLevel(level);
} catch (PluginException e) { modelInfo.setTypeEnsemble(null);
statusHandler.handle(Priority.PROBLEM, fakeRec.setModelInfo(modelInfo);
"Unable to generate updates for derived product", e); try {
} fakeRec.constructDataURI();
datauris.add(fakeRec.getDataURI());
} catch (PluginException e) {
statusHandler
.handle(Priority.PROBLEM,
"Unable to generate updates for derived product",
e);
}
}
} }
ProductAlertObserver.processDerivedAlerts(datauris); ProductAlertObserver.processDerivedAlerts(datauris);
} }

View file

@ -41,6 +41,7 @@ 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.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.viz.core.RecordFactory; import com.raytheon.uf.viz.core.RecordFactory;
import com.raytheon.uf.viz.core.catalog.LayerProperty; import com.raytheon.uf.viz.core.catalog.LayerProperty;
import com.raytheon.uf.viz.core.catalog.ScriptCreator; import com.raytheon.uf.viz.core.catalog.ScriptCreator;
@ -369,6 +370,10 @@ public class PointDataCubeAdapter implements IDataCubeAdapter {
throws VizException { throws VizException {
TimeQueryRequestSet set = new TimeQueryRequestSet(); TimeQueryRequestSet set = new TimeQueryRequestSet();
set.setRequests(requests.toArray(new TimeQueryRequest[0])); set.setRequests(requests.toArray(new TimeQueryRequest[0]));
// boundary for time queries
for (TimeQueryRequest req: set.getRequests()) {
req.setSimDate(SimulatedTime.getSystemTime().getTime());
}
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
List<List<DataTime>> result = (List<List<DataTime>>) ThriftClient List<List<DataTime>> result = (List<List<DataTime>>) ThriftClient
.sendRequest(set); .sendRequest(set);

View file

@ -31,6 +31,8 @@ import com.raytheon.uf.common.pointdata.GetPointDataTreeRequest;
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.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.viz.core.alerts.AlertMessage; import com.raytheon.uf.viz.core.alerts.AlertMessage;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.requests.ThriftClient; import com.raytheon.uf.viz.core.requests.ThriftClient;
@ -101,25 +103,30 @@ public class PointDataInventory extends AbstractPointDataInventory implements
} }
@Override @Override
public void alertArrived(Collection<AlertMessage> alertMessages) { public void alertArrived(Collection<AlertMessage> alertMessages) {
for (AlertMessage message : alertMessages) { for (AlertMessage message : alertMessages) {
String pluginName = message.decodedAlert.get(PLUGIN_NAME) DataTime dataTime = (DataTime) message.decodedAlert.get("dataTime");
.toString(); if (dataTime.getRefTime().before(
String source = pluginName; SimulatedTime.getSystemTime().getTime())) {
String typeKey = getTypeKey(pluginName); String pluginName = message.decodedAlert.get(PLUGIN_NAME)
if (!PLUGIN_NAME.equals(typeKey)) { .toString();
source += message.decodedAlert.get(typeKey).toString(); String source = pluginName;
} String typeKey = getTypeKey(pluginName);
if (!PLUGIN_NAME.equals(typeKey)) {
source += message.decodedAlert.get(typeKey).toString();
}
if (getAllSources() != null && !getAllSources().contains(source)) { if (getAllSources() != null
try { && !getAllSources().contains(source)) {
initTree(derParLibrary); try {
} catch (VizException e) { initTree(derParLibrary);
statusHandler.handle(Priority.PROBLEM, } catch (VizException e) {
e.getLocalizedMessage(), e); statusHandler.handle(Priority.PROBLEM,
} e.getLocalizedMessage(), e);
} }
} }
} }
}
}
} }

View file

@ -40,6 +40,7 @@ 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.time.BinOffset; import com.raytheon.uf.common.time.BinOffset;
import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.requests.ThriftClient; import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.uf.viz.derivparam.library.DerivedParameterGenerator; import com.raytheon.uf.viz.derivparam.library.DerivedParameterGenerator;
@ -120,22 +121,24 @@ public class RadarDataCubeAdapter extends PointDataCubeAdapter {
DbQueryResponse response, boolean latestOnly, BinOffset binOffset) { DbQueryResponse response, boolean latestOnly, BinOffset binOffset) {
String dataTimefield = DATA_TIME_FIELD; String dataTimefield = DATA_TIME_FIELD;
if (latestOnly) { if (latestOnly) {
dataTimefield = LATEST_DATA_TIME_FIELD; dataTimefield = LATEST_DATA_TIME_FIELD;
} }
Collection<DataTime> results = new HashSet<DataTime>(); Collection<DataTime> results = new HashSet<DataTime>();
int i = 0; int i = 0;
for (Map<String, Object> map : response.getResults()) { for (Map<String, Object> map : response.getResults()) {
DataTime time = null; DataTime time = null;
if (latestOnly) { if (latestOnly) {
time = new DataTime((Date) map.get(dataTimefield), 0); time = new DataTime((Date) map.get(dataTimefield), 0);
} else { } else {
time = (DataTime) map.get(dataTimefield); time = (DataTime) map.get(dataTimefield);
time.setLevelValue((Double) map.get(LEVEL_FIELD)); time.setLevelValue((Double) map.get(LEVEL_FIELD));
} }
// Best res requests need this because they span a time period
results.add(time); if (time.getRefTime().before(SimulatedTime.getSystemTime().getTime())) {
++i; results.add(time);
} ++i;
}
}
if (binOffset != null) { if (binOffset != null) {
Set<DataTime> scaledDates = new TreeSet<DataTime>(); Set<DataTime> scaledDates = new TreeSet<DataTime>();
@ -170,6 +173,7 @@ public class RadarDataCubeAdapter extends PointDataCubeAdapter {
List<DbQueryRequest> dbRequests = new ArrayList<DbQueryRequest>( List<DbQueryRequest> dbRequests = new ArrayList<DbQueryRequest>(
requests.size()); requests.size());
for (TimeQueryRequest request : requests) { for (TimeQueryRequest request : requests) {
request.setSimDate(SimulatedTime.getSystemTime().getTime());
dbRequests.add(getTimeQueryRequest(request.getQueryTerms(), dbRequests.add(getTimeQueryRequest(request.getQueryTerms(),
request.isMaxQuery())); request.isMaxQuery()));
} }
@ -184,6 +188,9 @@ public class RadarDataCubeAdapter extends PointDataCubeAdapter {
TimeQueryRequest request = requests.get(i); TimeQueryRequest request = requests.get(i);
Collection<DataTime> times = processTimeQueryResponse(response, Collection<DataTime> times = processTimeQueryResponse(response,
request.isMaxQuery(), request.getBinOffset()); request.isMaxQuery(), request.getBinOffset());
result.add(new ArrayList<DataTime>(times)); result.add(new ArrayList<DataTime>(times));
} }
return result; return result;

View file

@ -58,6 +58,7 @@ import com.raytheon.uf.common.geospatial.MapUtil;
import com.raytheon.uf.common.pointdata.PointDataContainer; import com.raytheon.uf.common.pointdata.PointDataContainer;
import com.raytheon.uf.common.time.BinOffset; import com.raytheon.uf.common.time.BinOffset;
import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.viz.core.HDF5Util; import com.raytheon.uf.viz.core.HDF5Util;
import com.raytheon.uf.viz.core.catalog.CatalogQuery; import com.raytheon.uf.viz.core.catalog.CatalogQuery;
import com.raytheon.uf.viz.core.catalog.LayerProperty; import com.raytheon.uf.viz.core.catalog.LayerProperty;
@ -464,6 +465,7 @@ public class SatelliteDataCubeAdapter implements IDataCubeAdapter {
List<TimeQueryRequest> baseRequests = new ArrayList<TimeQueryRequest>( List<TimeQueryRequest> baseRequests = new ArrayList<TimeQueryRequest>(
requests.size()); requests.size());
for (TimeQueryRequest request : requests) { for (TimeQueryRequest request : requests) {
request.setSimDate(SimulatedTime.getSystemTime().getTime());
if (!request.getQueryTerms().containsKey("DERIVED")) { if (!request.getQueryTerms().containsKey("DERIVED")) {
baseRequests.add(request); baseRequests.add(request);
} else { } else {
@ -541,6 +543,7 @@ public class SatelliteDataCubeAdapter implements IDataCubeAdapter {
DerivParamField field = (DerivParamField) ifield; DerivParamField field = (DerivParamField) ifield;
TimeQueryRequest newRequest = new TimeQueryRequest(); TimeQueryRequest newRequest = new TimeQueryRequest();
newRequest.setBinOffset(binOffset); newRequest.setBinOffset(binOffset);
newRequest.setSimDate(SimulatedTime.getSystemTime().getTime());
newRequest.setMaxQuery(false); newRequest.setMaxQuery(false);
newRequest.setQueryTerms(modifyQuery(queryParams, field)); newRequest.setQueryTerms(modifyQuery(queryParams, field));
newRequest.setPluginName("satellite"); newRequest.setPluginName("satellite");

View file

@ -39,6 +39,13 @@
version="0.0.0" version="0.0.0"
unpack="false"/> unpack="false"/>
<plugin
id="com.raytheon.uf.edex.maintenance"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin <plugin
id="com.raytheon.edex.plugin.text" id="com.raytheon.edex.plugin.text"
download-size="0" download-size="0"

View file

@ -308,14 +308,14 @@ public final class TextDisplayModel {
* Getter/Accessor of Create Time. * Getter/Accessor of Create Time.
*/ */
public long getCreateTime(String token) { public long getCreateTime(String token) {
return getStdTextProduct(token, true).getCreatetime(); return getStdTextProduct(token, true).getRefTime();
} }
/** /**
* Setter/Mutator of Create Time. * Setter/Mutator of Create Time.
*/ */
public void setCreateTime(String token, long ct) { public void setCreateTime(String token, long ct) {
getStdTextProduct(token, true).setCreatetime(ct); getStdTextProduct(token, true).setRefTime(ct);
} }
/** /**
@ -472,7 +472,7 @@ public final class TextDisplayModel {
tmpProduct.setXxxid(xxxid); tmpProduct.setXxxid(xxxid);
tmpProduct.setHdrtime(hdrtime); tmpProduct.setHdrtime(hdrtime);
tmpProduct.setBbbid(bbbid); tmpProduct.setBbbid(bbbid);
tmpProduct.setCreatetime(createtime); tmpProduct.setRefTime(createtime);
tmpProduct.setProduct(product); tmpProduct.setProduct(product);
stdTxtProd.put(token, tmpProduct); stdTxtProd.put(token, tmpProduct);
} }

View file

@ -448,7 +448,7 @@ public class RemoteSiteRequestDlg extends CaveSWTDialog {
if (latest != null && latest.size() > 0) { if (latest != null && latest.size() > 0) {
Calendar c = new GregorianCalendar(TimeZone Calendar c = new GregorianCalendar(TimeZone
.getTimeZone("GMT")); .getTimeZone("GMT"));
c.setTimeInMillis(latest.get(0).getCreatetime()); c.setTimeInMillis(latest.get(0).getRefTime());
req.setMostRecentTime(c.getTimeInMillis()); // default req.setMostRecentTime(c.getTimeInMillis()); // default
try { try {
WMOHeader wmo = new WMOHeader(latest.get(0).getProduct().getBytes()); WMOHeader wmo = new WMOHeader(latest.get(0).getProduct().getBytes());

View file

@ -4636,7 +4636,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
updateTextEditor(body.toString()); updateTextEditor(body.toString());
} }
storedProduct.setHdrtime(currentDate); storedProduct.setHdrtime(currentDate);
storedProduct.setCreatetime(System.currentTimeMillis()); storedProduct.setRefTime(System.currentTimeMillis());
if (productText.contains(AFOSParser.DRAFT_PIL)) { if (productText.contains(AFOSParser.DRAFT_PIL)) {
int start = productText.indexOf(AFOSParser.DRAFT_PIL); int start = productText.indexOf(AFOSParser.DRAFT_PIL);
productText = productText.replace(productText.substring(start, productText = productText.replace(productText.substring(start,
@ -4808,7 +4808,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
request.setBbbid(product.getBbbid()); request.setBbbid(product.getBbbid());
request.setCccid(product.getCccid()); request.setCccid(product.getCccid());
request.setCreatetime(product.getCreatetime()); request.setCreatetime(product.getRefTime());
request.setDataCrc(product.getDataCrc()); request.setDataCrc(product.getDataCrc());
request.setHdrtime(product.getHdrtime()); request.setHdrtime(product.getHdrtime());
request.setNnnid(product.getNnnid()); request.setNnnid(product.getNnnid());
@ -4816,7 +4816,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
request.setWmoid(product.getWmoid()); request.setWmoid(product.getWmoid());
request.setSite(product.getSite()); request.setSite(product.getSite());
request.setXxxid(product.getXxxid()); request.setXxxid(product.getXxxid());
request.setCreatetime(product.getCreatetime()); request.setCreatetime(product.getRefTime());
CAVEMode mode = CAVEMode.getMode(); CAVEMode mode = CAVEMode.getMode();
boolean result = (CAVEMode.OPERATIONAL.equals(mode) boolean result = (CAVEMode.OPERATIONAL.equals(mode)
|| CAVEMode.TEST.equals(mode) ? true : false); || CAVEMode.TEST.equals(mode) ? true : false);

View file

@ -118,7 +118,7 @@ public class AviationTextUtility implements IAviationObserver {
tmpProd.setXxxid("TAF"); tmpProd.setXxxid("TAF");
tmpProd.setHdrtime(currentDate); tmpProd.setHdrtime(currentDate);
tmpProd.setBbbid("NOR"); tmpProd.setBbbid("NOR");
tmpProd.setCreatetime(System.currentTimeMillis()); tmpProd.setRefTime(System.currentTimeMillis());
tmpProd.setProduct(currentHeader + "\n" + tmpStr); tmpProd.setProduct(currentHeader + "\n" + tmpStr);
RequestConstraint rcRow; RequestConstraint rcRow;

View file

@ -139,7 +139,7 @@ public class RadarTextUtility implements IRadarObserver {
tmpProd.setXxxid(designator); tmpProd.setXxxid(designator);
tmpProd.setHdrtime(currentDate); tmpProd.setHdrtime(currentDate);
tmpProd.setBbbid("NOR"); tmpProd.setBbbid("NOR");
tmpProd.setCreatetime(System.currentTimeMillis()); tmpProd.setRefTime(System.currentTimeMillis());
tmpProd.setProduct(currentHeader + "\n" + strBldr.toString()); tmpProd.setProduct(currentHeader + "\n" + strBldr.toString());
RequestConstraint rcRow; RequestConstraint rcRow;

View file

@ -5,7 +5,13 @@
<projects> <projects>
</projects> </projects>
<buildSpec> <buildSpec>
<buildCommand>
<name>org.python.pydev.PyDevBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec> </buildSpec>
<natures> <natures>
<nature>org.python.pydev.pythonNature</nature>
</natures> </natures>
</projectDescription> </projectDescription>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?eclipse-pydev version="1.0"?>
<pydev_project>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property>
</pydev_project>

View file

@ -0,0 +1,18 @@
#!/bin/sh
# This script should be run on dx1 as part of next delivery to update the definitions for
# the stdtextproducts and practicestdtextproducts tables.
psql -U awips -d fxa -c "ALTER TABLE stdtextproducts RENAME COLUMN createtime to reftime;"
psql -U awips -d fxa -c "ALTER TABLE practicestdtextproducts RENAME COLUMN createtime to reftime;"
psql -U awips -d fxa -c "ALTER TABLE stdtextproducts ADD COLUMN inserttime timestamp without time zone;"
psql -U awips -d fxa -c "ALTER TABLE practicestdtextproducts ADD COLUMN inserttime timestamp without time zone;"
psql -U awips -d fxa -c "CREATE INDEX stdtextproductsinserttimeindex ON stdtextproducts USING btree (inserttime);"
psql -U awips -d fxa -c "CREATE INDEX practicestdtextproductsinserttimeindex ON practicestdtextproducts USING btree (inserttime);"
psql -U awips -d fxa -c "UPDATE stdtextproducts SET inserttime = CURRENT_TIMESTAMP AT TIME ZONE 'GMT' WHERE inserttime IS NULL;"
psql -U awips -d fxa -c "UPDATE practicestdtextproducts SET inserttime = CURRENT_TIMESTAMP AT TIME ZONE 'GMT' WHERE inserttime IS NULL;"
psql -U awips -d fxa -c "ALTER TABLE stdtextproducts ALTER COLUMN inserttime SET NOT NULL;"
psql -U awips -d fxa -c "ALTER TABLE practicestdtextproducts ALTER COLUMN inserttime SET NOT NULL;"

View file

@ -0,0 +1,82 @@
import os, subprocess, re, stat, sys, time
import h5py
matchRe = re.compile('.*?(-{1,2}\\d{6,}).h5')
def findEachGroup(group, datasetList):
if type(group) is h5py.highlevel.Group:
for g in group.keys():
findEachGroup(group[g], datasetList)
elif type(group) is h5py.highlevel.Dataset:
datasetList.append(group.name)
def processFile(filename, match):
startIndex = filename.find(match.groups()[0])
endIndex = filename.find('.h5')
reducedFilename = filename[0:startIndex] + filename[endIndex:]
if not os.path.exists(reducedFilename):
# this is the first one, just rename it
try:
os.rename(filename, reducedFilename)
except OSError, e:
print e
else:
# open the file, find the datasets
datasetList = []
hfile = None
try:
hfile = h5py.File(filename, 'r')
findEachGroup(hfile['/'], datasetList)
finally:
if hfile:
hfile.close()
fileSuccess = True
# for each dataset in the file, run h5copy it into the output file
for dataset in datasetList:
if not copy(filename, dataset, reducedFilename):
fileSuccess = False
# remove original file
if True: #if fileSuccess:
os.remove(filename)
def fileWalk(pth):
if os.path.isdir(pth):
innerFiles = os.listdir(pth)
for f in innerFiles:
fileWalk(pth + '/' + f)
else:
match = matchRe.match(pth)
if match:
processFile(pth, match)
def copy(filename, dataset, reducedFilename):
# note that this copies links as if they were real datasets, increasing the size of the output file
cmd = ['h5copy', '-p', '-i', filename, '-o', reducedFilename, '-s', dataset, '-d', dataset]
ret = subprocess.call(cmd)
success = (ret == 0)
if success:
os.chmod(reducedFilename, stat.S_IWUSR | stat.S_IWGRP | stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
#print "Successfully copied filename:", filename, "dataset:", dataset
return True
else:
print "Failed to copy filename:", filename, "dataset:", dataset
return False
def main():
if len(sys.argv) < 2:
print "Please provide full path to input directory"
else:
inputDir = sys.argv[1]
t0 = time.time()
fileWalk(inputDir)
t1 = time.time()
print "Total copy time for directory", inputDir, (t1-t0), "seconds"
if __name__ == '__main__':
main()

View file

@ -0,0 +1,10 @@
#!/bin/sh
# This script should be run on dx1 as part of next delivery to remove the hdfFileId columns
tablesToUpdate=`psql -U awips -d metadata -t -c "select table_name from information_schema.columns where table_catalog='metadata' and table_schema='awips' and column_name = 'hdffileid';"`
for table in $tablesToUpdate
do
psql -U awips -d metadata -t -c "ALTER TABLE $table DROP COLUMN hdffileid"
done

1
edexOsgi/build.edex/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/tmp

View file

@ -118,6 +118,9 @@ wrapper.java.additional.39=-DHighMem=%HIGH_MEM_FLAG%
wrapper.java.additional.40=-Dmanagement.port=%MGMT_PORT% wrapper.java.additional.40=-Dmanagement.port=%MGMT_PORT%
wrapper.java.additional.41=-Dqpid.dest_syntax=BURL wrapper.java.additional.41=-Dqpid.dest_syntax=BURL
wrapper.java.additional.42=-Dweb.port=8080
wrapper.java.additional.43=-Dconfidential.port=8443
wrapper.java.additional.44=-Dhttp.port=%HTTP_PORT%
# Initial Java Heap Size (in MB) # Initial Java Heap Size (in MB)
wrapper.java.initmemory=%INIT_MEM% wrapper.java.initmemory=%INIT_MEM%

View file

@ -24,7 +24,8 @@ export PYPIES_SERVER=http://localhost:9582
# moved here from environment.xml # moved here from environment.xml
# these values are returned to clients that contact the localization service # these values are returned to clients that contact the localization service
export HTTP_SERVER=http://localhost:9581/services export HTTP_PORT=9581
export HTTP_SERVER=http://localhost:${HTTP_PORT}/services
export JMS_SERVER=tcp://localhost:5672 export JMS_SERVER=tcp://localhost:5672
export RADAR_SERVER=tcp://localhost:8813 export RADAR_SERVER=tcp://localhost:8813

View file

@ -52,7 +52,7 @@
</layout> </layout>
</appender> </appender>
<!-- Purge log --> <!-- Purge log -->
<appender name="PurgeLog" class="org.apache.log4j.rolling.RollingFileAppender"> <appender name="PurgeLog" class="org.apache.log4j.rolling.RollingFileAppender">
<rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
<param name="FileNamePattern" value="${edex.home}/logs/edex-${edex.run.mode}-purge-%d{yyyyMMdd}.log"/> <param name="FileNamePattern" value="${edex.home}/logs/edex-${edex.run.mode}-purge-%d{yyyyMMdd}.log"/>
@ -62,6 +62,17 @@
<param name="ConversionPattern" value="%-5p %d [%t] %c{1}: %m%n"/> <param name="ConversionPattern" value="%-5p %d [%t] %c{1}: %m%n"/>
</layout> </layout>
</appender> </appender>
<!-- Archive log -->
<appender name="ArchiveLog" class="org.apache.log4j.rolling.RollingFileAppender">
<rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
<param name="FileNamePattern" value="${edex.home}/logs/edex-${edex.run.mode}-archive-%d{yyyyMMdd}.log"/>
</rollingPolicy>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %d [%t] %c{1}: %m%n"/>
</layout>
</appender>
<!-- RouteFailedLog log --> <!-- RouteFailedLog log -->
<appender name="RouteFailedLog" class="org.apache.log4j.rolling.RollingFileAppender"> <appender name="RouteFailedLog" class="org.apache.log4j.rolling.RollingFileAppender">
@ -218,6 +229,11 @@
<level value="INFO"/> <level value="INFO"/>
<appender-ref ref="PurgeLog"/> <appender-ref ref="PurgeLog"/>
</logger> </logger>
<logger name="com.raytheon.uf.edex.maintenance.archive" additivity="false">
<level value="INFO"/>
<appender-ref ref="ArchiveLog"/>
</logger>
<logger name="RouteFailedLog" additivity="false"> <logger name="RouteFailedLog" additivity="false">
<level value="WARN"/> <level value="WARN"/>

View file

@ -48,7 +48,7 @@
<svcBackupDir>${env:edex.home}/../GFESuite/</svcBackupDir> <svcBackupDir>${env:edex.home}/../GFESuite/</svcBackupDir>
<mhsData>/data/fxa/mhs</mhsData> <mhsData>/data/fxa/mhs</mhsData>
<requestTimeLogFilter>1000</requestTimeLogFilter> <requestTimeLogFilter>1000</requestTimeLogFilter>
<requestSizeLogFilter>8</requestSizeLogFilter> <responseSizeLogFilter>8</responseSizeLogFilter>
</properties> </properties>

View file

@ -22,6 +22,8 @@ qc.cron=0+2,7,12,17,22,27,32,37,42,47,52,57+*+*+*+?
acarssounding.cron=00+10,30,50+*+*+*+? acarssounding.cron=00+10,30,50+*+*+*+?
gfe.cron=0+15+*+*+*+? gfe.cron=0+15+*+*+*+?
repack.cron=0+20+*+*+*+? repack.cron=0+20+*+*+*+?
# runs database and hdf5 archive for archive server to pull data from
archive.cron=0+40+*+*+*+?
###purge configuration ###purge configuration
# Interval at which the purge job kicks off # Interval at which the purge job kicks off

View file

@ -1,19 +1,19 @@
## ##
# This software was developed and / or modified by Raytheon Company, # This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government. # pursuant to Contract DG133W-05-CQ-1067 with the US Government.
# #
# U.S. EXPORT CONTROLLED TECHNICAL DATA # U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose # This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination # export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non-U.S. persons whether in the United States or abroad requires # to non-U.S. persons whether in the United States or abroad requires
# an export license or other authorization. # an export license or other authorization.
# #
# Contractor Name: Raytheon Company # Contractor Name: Raytheon Company
# Contractor Address: 6825 Pine Street, Suite 340 # Contractor Address: 6825 Pine Street, Suite 340
# Mail Stop B8 # Mail Stop B8
# Omaha, NE 68106 # Omaha, NE 68106
# 402.291.0100 # 402.291.0100
# #
# 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.
## ##
@ -62,7 +62,8 @@ class ObsRequest(PointDataQuery.PointDataQuery):
self._pdq.setParameters(MetarPointDataTransform.ALL_PARAMS_LIST) self._pdq.setParameters(MetarPointDataTransform.ALL_PARAMS_LIST)
self.queryResults = self._pdq.execute() self.queryResults = self._pdq.execute()
if self.queryResults is None: if self.queryResults is None:
return self.makeNullResponse() response = ArrayList()
return response
else: else:
records = MetarPointDataTransform.toMetarRecords(self.queryResults) records = MetarPointDataTransform.toMetarRecords(self.queryResults)
size = len(records) size = len(records)

View file

@ -1,87 +0,0 @@
## Core includes file generated on 2012-01-20 17:08:45 GMT
com.raytheon.edex.rpgenvdata/component-deploy.xml
com.raytheon.uf.common.jms/component-deploy.xml
com.raytheon.uf.edex.database/component-deploy.xml
com.raytheon.uf.common.cache/component-deploy.xml
com.raytheon.uf.edex.pointdata/component-deploy.xml
com.raytheon.uf.edex.esb.camel.launcher/component-deploy.xml
com.raytheon.uf.common.dissemination/component-deploy.xml
com.raytheon.uf.edex.bufrtools/component-deploy.xml
com.raytheon.edex.uengine/component-deploy.xml
com.raytheon.uf.common.pointdata/component-deploy.xml
com.raytheon.uf.common.serialization/component-deploy.xml
com.raytheon.uf.common.datastorage.remote/component-deploy.xml
com.raytheon.uf.common.awipstools/component-deploy.xml
com.raytheon.edex.ingestsrv/component-deploy.xml
com.raytheon.uf.common.alertviz/component-deploy.xml
com.raytheon.uf.common.serialization.comm/component-deploy.xml
com.raytheon.uf.tools.gfesuite.servicebackup/component-deploy.xml
com.raytheon.uf.common.auth/component-deploy.xml
com.raytheon.uf.common.menus/component-deploy.xml
com.raytheon.uf.edex.distribution/component-deploy.xml
com.raytheon.uf.common.hydro/component-deploy.xml
com.raytheon.uf.edex.core/component-deploy.xml
com.raytheon.edex.common/component-deploy.xml
com.raytheon.uf.edex.management/component-deploy.xml
com.raytheon.uf.common.datastorage.hdf5/component-deploy.xml
com.raytheon.uf.edex.cpgsrv/component-deploy.xml
com.raytheon.uf.edex.python.decoder/component-deploy.xml
gov.noaa.nws.ncep.edex.uengine/component-deploy.xml
com.raytheon.uf.common.status/component-deploy.xml
com.raytheon.uf.common.sounding/component-deploy.xml
com.raytheon.edex.autobldsrv/component-deploy.xml
gov.noaa.nws.ncep.edex.ingest.util/component-deploy.xml
com.raytheon.uf.common.climo/component-deploy.xml
com.raytheon.uf.common.localization/component-deploy.xml
gov.noaa.nws.ncep.common/component-deploy.xml
com.raytheon.uf.common.message/component-deploy.xml
com.raytheon.rcm.lib/component-deploy.xml
com.raytheon.uf.common.datastorage/component-deploy.xml
com.raytheon.uf.common.topo/component-deploy.xml
com.raytheon.edex.notifysrv/component-deploy.xml
gov.noaa.nws.ncep.edex.gempak.jna/component-deploy.xml
com.raytheon.edex.utilitysrv/component-deploy.xml
com.raytheon.uf.common.geospatial/component-deploy.xml
com.raytheon.uf.common.python/component-deploy.xml
gov.noaa.nws.ncep.edex.purgeutil/component-deploy.xml
com.raytheon.uf.edex.metartohmdbsrv/component-deploy.xml
com.raytheon.uf.common.time/component-deploy.xml
com.raytheon.uf.common.pypies/component-deploy.xml
com.raytheon.uf.common.monitor/component-deploy.xml
com.raytheon.uf.common.comm/component-deploy.xml
com.raytheon.edex.productsrv/component-deploy.xml
com.raytheon.uf.common.mpe/component-deploy.xml
com.raytheon.edex.adaptersrv/component-deploy.xml
com.raytheon.uf.edex.textdbsrv/component-deploy.xml
com.raytheon.uf.common.util/component-deploy.xml
com.raytheon.uf.edex.dat.utils/component-deploy.xml
com.raytheon.uf.common.ohd/component-deploy.xml
com.raytheon.uf.common.site/component-deploy.xml
gov.noaa.nws.ncep.edex.ingest.grib.util/component-deploy.xml
gov.noaa.nws.ncep.edex.common/component-deploy.xml
com.raytheon.uf.edex.log/component-deploy.xml
com.raytheon.uf.edex.ohd/component-deploy.xml
com.raytheon.uf.edex.awipstools/component-deploy.xml
com.raytheon.uf.edex.esb.camel/component-deploy.xml
com.raytheon.uf.common.dataquery/component-deploy.xml
com.raytheon.uf.edex.decodertools/component-deploy.xml
com.raytheon.uf.edex.topo/component-deploy.xml
com.raytheon.uf.common.alertmonitor/component-deploy.xml
com.raytheon.uf.common.activetable/component-deploy.xml
com.raytheon.uf.edex.alertviz/component-deploy.xml
com.raytheon.uf.common.management/component-deploy.xml
com.raytheon.uf.common.derivparam/component-deploy.xml
com.raytheon.uf.edex.dissemination/component-deploy.xml
com.raytheon.edex.kml/component-deploy.xml
com.raytheon.messaging.mhs/component-deploy.xml
com.raytheon.uf.common.colormap/component-deploy.xml
com.raytheon.uf.common.monitor.cpg/component-deploy.xml
gov.noaa.nws.ncep.common.log/component-deploy.xml
com.raytheon.edex.monitorsrv/component-deploy.xml
com.raytheon.edex.textdb/component-deploy.xml
com.raytheon.uf.edex.purgesrv/component-deploy.xml
com.raytheon.uf.edex.auth/component-deploy.xml
com.raytheon.uf.edex.site/component-deploy.xml
com.raytheon.uf.edex.maintenance/component-deploy.xml
com.raytheon.uf.edex.activetable/component-deploy.xml
com.raytheon.uf.common.hlstopo/component-deploy.xml

View file

@ -1,51 +0,0 @@
## Cots includes file generated on 2012-01-20 17:08:45 GMT
com.sun.jndi.nis/*.jar
net.sf.ehcache/*.jar
javax.persistence/*.jar
org.eclipse.jetty/*.jar
net.sf.cglib/*.jar
org.apache.commons.logging/*.jar
org.apache.commons.codec/*.jar
org.apache.commons.lang/*.jar
org.apache.commons.digester/*.jar
org.dom4j/*.jar
org.apache.tools.bzip2/*.jar
org.slf4j/*.jar
org.springframework/*.jar
uk.ltd.getahead/*.jar
org.objectweb/*.jar
org.apache.activemq/*.jar
org.apache.mina/*.jar
org.postgres/postgis.jar
org.postgres/postgresql-8.3-603.jdbc3.jar
javax.vecmath/*.jar
javax.mail/*.jar
org.apache.commons.configuration/*.jar
org.apache.commons.beanutils/*.jar
com.facebook.thrift/*.jar
org.apache.camel/*.jar
org.apache.commons.pool/*.jar
org.apache.log4j/*.jar
org.jep/*.jar
ncsa.hdf5/jhdf5.jar
com.sun.jna/*.jar
edu.wisc.ssec.mcidas/*.jar
org.apache.commons.management/*.jar
com.opensymphony.ognl/*.jar
javax.jms/*.jar
org.apache.commons.collections/*.jar
org.jboss.cache/*.jar
javax.measure/*.jar
org.apache.http/*.jar
org.apache.commons.cli/*.jar
ucar.nc2/*.jar
org.apache.tomcat.nativ/*.jar
org.hibernate/*.jar
org.apache.velocity/velocity-1.5.jar
org.apache.velocity/velocity-tools-generic-1.3.jar
org.apache.commons.validator/*.jar
com.mchange/*.jar
org.apache.qpid/*.jar
org.geotools/*.jar
javax.media.opengl/gluegen-rt.jar
javax.activation/*.jar

View file

@ -1,154 +0,0 @@
## Plug-in includes file generated on 2012-01-20 17:08:45 GMT
com.raytheon.uf.edex.plugin.satellite.mcidas/component-deploy.xml
com.raytheon.edex.plugin.ldadhydro/component-deploy.xml
com.raytheon.uf.edex.plugin.loctables/component-deploy.xml
gov.noaa.nws.ncep.common.dataplugin.intlsigmet/component-deploy.xml
com.raytheon.uf.edex.plugin.acars/component-deploy.xml
com.raytheon.uf.edex.plugin.npp.viirs/component-deploy.xml
gov.noaa.nws.ncep.edex.plugin.intlsigmet/component-deploy.xml
com.raytheon.edex.plugin.ldadprofiler/component-deploy.xml
com.raytheon.edex.plugin.binlightning/component-deploy.xml
com.raytheon.edex.plugin.textlightning/component-deploy.xml
com.raytheon.uf.edex.plugin.svrwx/component-deploy.xml
gov.noaa.nws.ncep.edex.plugin.convsigmet/component-deploy.xml
gov.noaa.nws.ncep.edex.plugin.bufrsgwh/component-deploy.xml
gov.noaa.nws.ncep.common.dataplugin.scd/component-deploy.xml
com.raytheon.edex.plugin.shef/component-deploy.xml
com.raytheon.uf.common.dataplugin.cwa/component-deploy.xml
com.raytheon.uf.common.dataplugin.level/component-deploy.xml
gov.noaa.nws.ncep.common.dataplugin.airmet/component-deploy.xml
com.raytheon.uf.edex.plugin.mesowest/component-deploy.xml
com.raytheon.uf.common.dataplugin.ldadmesonet/component-deploy.xml
com.raytheon.uf.common.dataplugin.gfe/component-deploy.xml
com.raytheon.edex.plugin.radar/component-deploy.xml
gov.noaa.nws.ncep.common.dataplugin.pafm/component-deploy.xml
com.raytheon.uf.edex.plugin.tcs/component-deploy.xml
com.raytheon.uf.common.dataplugin.binlightning/component-deploy.xml
com.raytheon.edex.plugin.airep/component-deploy.xml
gov.noaa.nws.ncep.edex.plugin.aww/component-deploy.xml
gov.noaa.nws.ncep.edex.plugin.airmet/component-deploy.xml
com.raytheon.uf.common.dataplugin.bufrquikscat/component-deploy.xml
com.raytheon.uf.common.dataplugin.preciprate/component-deploy.xml
com.raytheon.uf.edex.plugin.level.handler/component-deploy.xml
com.raytheon.uf.common.dataplugin.bufrsigwx/component-deploy.xml
com.raytheon.uf.common.dataplugin.ffmp/component-deploy.xml
com.raytheon.uf.common.dataplugin.cwat/component-deploy.xml
gov.noaa.nws.ncep.edex.plugin.atcf/component-deploy.xml
com.raytheon.edex.plugin.ldad/component-deploy.xml
com.raytheon.uf.edex.plugin.manualIngest/component-deploy.xml
gov.noaa.nws.ncep.common.dataplugin.bufrsgwhv/component-deploy.xml
gov.noaa.nws.ncep.common.dataplugin.ncccfp/component-deploy.xml
com.raytheon.uf.common.dataplugin.radar/component-deploy.xml
gov.noaa.nws.ncep.edex.plugin.nctext/component-deploy.xml
com.raytheon.uf.edex.plugin.cwa/component-deploy.xml
gov.noaa.nws.ncep.common.dataplugin.tcm/component-deploy.xml
com.raytheon.edex.plugin.grib/component-deploy.xml
com.raytheon.edex.plugin.warning/component-deploy.xml
com.raytheon.edex.plugin.profiler/component-deploy.xml
com.raytheon.uf.common.dataplugin.scan/component-deploy.xml
gov.noaa.nws.ncep.common.dataplugin.aww/component-deploy.xml
com.raytheon.edex.plugin.pirep/component-deploy.xml
com.raytheon.uf.common.dataplugin.bufrua/component-deploy.xml
com.raytheon.uf.common.dataplugin.obs/component-deploy.xml
com.raytheon.uf.common.dataplugin.goessounding/component-deploy.xml
com.raytheon.uf.common.dataplugin.bufrssmi/component-deploy.xml
com.raytheon.edex.plugin.bufrua/component-deploy.xml
com.raytheon.uf.common.plugin.nwsauth/component-deploy.xml
com.raytheon.edex.plugin.goessounding/component-deploy.xml
com.raytheon.uf.common.dataplugin.fog/component-deploy.xml
gov.noaa.nws.ncep.common.dataplugin.wcp/component-deploy.xml
com.raytheon.edex.plugin.sfcobs/component-deploy.xml
gov.noaa.nws.ncep.common.dataplugin.bufrsgwh/component-deploy.xml
com.raytheon.edex.plugin.poessounding/component-deploy.xml
gov.noaa.nws.ncep.edex.plugin.ncscat/component-deploy.xml
com.raytheon.uf.common.dataplugin.warning/component-deploy.xml
gov.noaa.nws.ncep.common.dataplugin.ffg/component-deploy.xml
com.raytheon.uf.edex.plugin.bufrhdw/component-deploy.xml
com.raytheon.uf.common.dataplugin.bufrascat/component-deploy.xml
com.raytheon.uf.common.dataplugin.shef/component-deploy.xml
com.raytheon.edex.plugin.ccfp/component-deploy.xml
gov.noaa.nws.ncep.edex.plugin.bufrssha/component-deploy.xml
gov.noaa.nws.ncep.edex.plugin.ffg/component-deploy.xml
com.raytheon.uf.common.dataplugin.vil/component-deploy.xml
com.raytheon.edex.plugin.ldadmanual/component-deploy.xml
com.raytheon.uf.edex.plugin.bufrquikscat/component-deploy.xml
gov.noaa.nws.ncep.common.dataplugin.nonconvsigmet/component-deploy.xml
com.raytheon.uf.edex.plugin.vil/component-deploy.xml
com.raytheon.uf.common.dataplugin.tcg/component-deploy.xml
com.raytheon.uf.common.dataplugin.lsr/component-deploy.xml
com.raytheon.edex.plugin.redbook/component-deploy.xml
com.raytheon.edex.plugin.obs/component-deploy.xml
com.raytheon.uf.edex.plugin.nwsauth/component-deploy.xml
com.raytheon.uf.common.dataplugin.sfcobs/component-deploy.xml
gov.noaa.nws.ncep.common.dataplugin.h5scd/component-deploy.xml
com.raytheon.uf.common.dataplugin.tcs/component-deploy.xml
gov.noaa.nws.ncep.edex.plugin.ncccfp/component-deploy.xml
com.raytheon.edex.plugin.bufrmos/component-deploy.xml
com.raytheon.uf.edex.plugin.ffmp/component-deploy.xml
com.raytheon.uf.edex.plugin.scan.common/component-deploy.xml
gov.noaa.nws.ncep.edex.plugin.mcidas/component-deploy.xml
com.raytheon.uf.common.dataplugin/component-deploy.xml
com.raytheon.uf.edex.plugin.fssobs/component-deploy.xml
com.raytheon.uf.common.dataplugin.profiler/component-deploy.xml
com.raytheon.uf.common.dataplugin.text/component-deploy.xml
gov.noaa.nws.ncep.common.dataplugin.ncgrib/component-deploy.xml
com.raytheon.uf.common.dataplugin.satellite/component-deploy.xml
gov.noaa.nws.ncep.common.dataplugin.mcidas/component-deploy.xml
com.raytheon.uf.edex.plugin.lsr/component-deploy.xml
gov.noaa.nws.ncep.edex.plugin.uair/component-deploy.xml
com.raytheon.uf.edex.plugin.cwat/component-deploy.xml
gov.noaa.nws.ncep.common.dataplugin.idft/component-deploy.xml
com.raytheon.uf.common.dataplugin.ldadhydro/component-deploy.xml
com.raytheon.uf.common.dataplugin.grib/component-deploy.xml
com.raytheon.uf.common.dataplugin.acars/component-deploy.xml
com.raytheon.uf.edex.plugin.scan/component-deploy.xml
com.raytheon.uf.edex.plugin.bufrncwf/component-deploy.xml
com.raytheon.uf.common.dataplugin.pirep/component-deploy.xml
gov.noaa.nws.ncep.common.dataplugin.convsigmet/component-deploy.xml
com.raytheon.uf.edex.plugin.fog/component-deploy.xml
com.raytheon.uf.common.dataplugin.airep/component-deploy.xml
com.raytheon.edex.plugin.modelsounding/component-deploy.xml
com.raytheon.edex.plugin.taf/component-deploy.xml
com.raytheon.uf.edex.plugin.preciprate/component-deploy.xml
com.raytheon.uf.common.dataplugin.npp.viirs/component-deploy.xml
gov.noaa.nws.ncep.edex.plugin.nonconvsigmet/component-deploy.xml
gov.noaa.nws.ncep.edex.plugin.idft/component-deploy.xml
com.raytheon.uf.edex.plugin.bufrascat/component-deploy.xml
com.raytheon.uf.common.dataplugin.vaa/component-deploy.xml
gov.noaa.nws.ncep.common.dataplugin.uair/component-deploy.xml
gov.noaa.nws.ncep.common.dataplugin.atcf/component-deploy.xml
com.raytheon.uf.common.dataplugin.svrwx/component-deploy.xml
gov.noaa.nws.ncep.edex.plugin.pafm/component-deploy.xml
gov.noaa.nws.ncep.edex.plugin.h5uair/component-deploy.xml
com.raytheon.uf.common.dataplugin.qc/component-deploy.xml
gov.noaa.nws.ncep.edex.plugin.ncgrib/component-deploy.xml
com.raytheon.uf.common.dataplugin.qpf/component-deploy.xml
com.raytheon.uf.common.dataplugin.bufrhdw/component-deploy.xml
com.raytheon.edex.plugin.gfe/component-deploy.xml
com.raytheon.uf.edex.plugin.qc/component-deploy.xml
com.raytheon.uf.common.dataplugin.fssobs/component-deploy.xml
com.raytheon.uf.common.dataplugin.bufrncwf/component-deploy.xml
gov.noaa.nws.ncep.common.dataplugin.ncscat/component-deploy.xml
com.raytheon.uf.edex.plugin.level/component-deploy.xml
com.raytheon.uf.edex.plugin.bufrmthdw/component-deploy.xml
com.raytheon.uf.common.dataplugin.acarssounding/component-deploy.xml
com.raytheon.edex.plugin.text/component-deploy.xml
com.raytheon.uf.edex.plugin.tcg/component-deploy.xml
com.raytheon.uf.edex.plugin.qpf/component-deploy.xml
gov.noaa.nws.ncep.edex.plugin.mosaic/component-deploy.xml
gov.noaa.nws.ncep.edex.plugin.bufrsgwhv/component-deploy.xml
com.raytheon.uf.edex.plugin.bufrsigwx/component-deploy.xml
com.raytheon.uf.edex.plugin.ldadmesonet/component-deploy.xml
com.raytheon.uf.common.dataplugin.bufrmthdw/component-deploy.xml
com.raytheon.uf.edex.plugin.acarssounding/component-deploy.xml
gov.noaa.nws.ncep.edex.plugin.tcm/component-deploy.xml
com.raytheon.edex.plugin.satellite/component-deploy.xml
com.raytheon.edex.plugin.recco/component-deploy.xml
com.raytheon.uf.edex.plugin.vaa/component-deploy.xml
gov.noaa.nws.ncep.edex.plugin.h5scd/component-deploy.xml
gov.noaa.nws.ncep.edex.plugin.scd/component-deploy.xml
gov.noaa.nws.ncep.edex.plugin.wcp/component-deploy.xml
com.raytheon.uf.common.dataplugin.poessounding/component-deploy.xml
gov.noaa.nws.ncep.common.dataplugin.bufrssha/component-deploy.xml
com.raytheon.uf.edex.plugin.bufrssmi/component-deploy.xml
gov.noaa.nws.ncep.common.dataplugin.h5uair/component-deploy.xml

View file

@ -10,9 +10,12 @@
<camelContext id="subscription-camel" <camelContext id="subscription-camel"
xmlns="http://camel.apache.org/schema/spring" xmlns="http://camel.apache.org/schema/spring"
errorHandlerRef="errorHandler"> errorHandlerRef="errorHandler">
<endpoint id="subscriptionHTTP_from"
uri="jetty:http://0.0.0.0:${http.port}/services/subscribe?disableStreamCache=true" />
<!-- SubscriptionSrv routes --> <!-- SubscriptionSrv routes -->
<route id="subscriptionHTTP"> <route id="subscriptionHTTP">
<from uri="jetty:http://0.0.0.0:9581/services/subscribe?disableStreamCache=true" /> <from uri="ref:subscriptionHTTP_from" />
<bean ref="subscription" method="processRequest"/> <bean ref="subscription" method="processRequest"/>
<bean ref="serializationUtil" method="marshalToXml" /> <bean ref="serializationUtil" method="marshalToXml" />
</route> </route>

View file

@ -22,6 +22,7 @@ package com.raytheon.edex.plugin.airep;
import java.util.Calendar; import java.util.Calendar;
import java.util.Map; import java.util.Map;
import com.raytheon.edex.esb.Headers;
import com.raytheon.edex.exception.DecoderException; import com.raytheon.edex.exception.DecoderException;
import com.raytheon.edex.plugin.AbstractDecoder; import com.raytheon.edex.plugin.AbstractDecoder;
import com.raytheon.edex.plugin.airep.decoder.AIREPWeather; import com.raytheon.edex.plugin.airep.decoder.AIREPWeather;
@ -46,7 +47,7 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
* } * }
* </code> * </code>
* *
* *
* <pre> * <pre>
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
@ -89,7 +90,7 @@ public class AirepDecoder extends AbstractDecoder {
* @throws DecoderException * @throws DecoderException
* Thrown if no data is available. * Thrown if no data is available.
*/ */
public PluginDataObject[] decode(AirepDecoderInput input) public PluginDataObject[] decode(AirepDecoderInput input, Headers header)
throws DecoderException { throws DecoderException {
PluginDataObject[] reports = null; PluginDataObject[] reports = null;
@ -100,9 +101,14 @@ public class AirepDecoder extends AbstractDecoder {
try { try {
// traceId = getTraceId(hdrMap); // traceId = getTraceId(hdrMap);
logger.debug(traceId + "- AirepDecoder.decode()"); logger.debug(traceId + "- AirepDecoder.decode()");
WMOHeader wmoHeader = input.wmoHeader;
report = populateRecord(new AirepParser(input.report, if(wmoHeader != null) {
input.wmoHeader), input.wmoHeader); Calendar refTime = TimeTools.findDataTime(
wmoHeader.getYYGGgg(), header);
if(refTime != null) {
report = populateRecord(new AirepParser(input.report, refTime));
}
}
if (report != null) { if (report != null) {
report.setTraceId(traceId); report.setTraceId(traceId);
report.setPluginName(PLUGIN_NAME); report.setPluginName(PLUGIN_NAME);
@ -130,7 +136,7 @@ public class AirepDecoder extends AbstractDecoder {
* The reccon parser that contains the decoded data. * The reccon parser that contains the decoded data.
* @return The populated record. * @return The populated record.
*/ */
private AirepRecord populateRecord(AirepParser parser, WMOHeader wmoHeader) { private AirepRecord populateRecord(AirepParser parser) {
AirepRecord record = null; AirepRecord record = null;
AircraftObsLocation location = null; AircraftObsLocation location = null;

View file

@ -19,14 +19,17 @@
**/ **/
package com.raytheon.edex.plugin.airep.decoder; package com.raytheon.edex.plugin.airep.decoder;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import java.util.TimeZone;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import com.raytheon.edex.esb.Headers;
import com.raytheon.uf.edex.decodertools.aircraft.AircraftFlightLevel; import com.raytheon.uf.edex.decodertools.aircraft.AircraftFlightLevel;
import com.raytheon.uf.edex.decodertools.aircraft.AircraftLatitude; import com.raytheon.uf.edex.decodertools.aircraft.AircraftLatitude;
import com.raytheon.uf.edex.decodertools.aircraft.AircraftLongitude; import com.raytheon.uf.edex.decodertools.aircraft.AircraftLongitude;
@ -121,7 +124,8 @@ public class AirepParser {
private AircraftRemarks rptRemarks = null; private AircraftRemarks rptRemarks = null;
private WMOHeader wmoHeader; private Calendar refTime;
/** /**
* Create the parser for and decode an observation from a String. * Create the parser for and decode an observation from a String.
@ -129,21 +133,20 @@ public class AirepParser {
* @param anObservation * @param anObservation
* A string containing the observation. * A string containing the observation.
*/ */
public AirepParser(String anObservation, WMOHeader wmoHeader) { public AirepParser(String anObservation, Calendar refTime) {
this.wmoHeader = wmoHeader; this.refTime = refTime;
reportData = anObservation; reportData = anObservation;
parseElements(); parseElements();
} // AirepParser() } // AirepParser()
/** /**
* Create the parser for and decode an observation from a String. * Create the parser for and decode an observation from a byte array.
* *
* @param anObservation * @param anObservation
* A string containing the observation. * A string containing the observation.
*/ */
public AirepParser(byte[] anObservation) { public AirepParser(byte[] anObservation, Calendar refTime) {
reportData = new String(anObservation); this(new String(anObservation), refTime);
parseElements();
} // AirepParser() } // AirepParser()
/** /**
@ -263,11 +266,10 @@ public class AirepParser {
for (int i = 0; i < theElements.size(); i++) { for (int i = 0; i < theElements.size(); i++) {
Object o = theElements.get(i); Object o = theElements.get(i);
if (o instanceof String) { if (o instanceof String) {
String[] latLon = null; // AircraftLatitude.splitLatLon((String) String[] latLon = AircraftLatitude.splitLatLon((String) o);
// o); if ((latLon != null)&&(latLon.length ==2)) {
if (latLon != null) {
theElements.set(i, latLon[1]);
theElements.add(i, latLon[0]); theElements.add(i, latLon[0]);
theElements.set(i, latLon[1]);
break; break;
} }
} }
@ -329,23 +331,25 @@ public class AirepParser {
if (o instanceof String) { if (o instanceof String) {
String s = (String) o; String s = (String) o;
if (TIME.matcher(s).matches()) { if (TIME.matcher(s).matches()) {
int hour = Integer.parseInt(s.substring(0, 2)); int hour = Integer.parseInt(s.substring(0, 2));
int minute = Integer.parseInt(s.substring(2)); int minute = Integer.parseInt(s.substring(2));
Calendar oTime = TimeTools.getSystemCalendar(
wmoHeader.getYear(), wmoHeader.getMonth(),
wmoHeader.getDay());
observationTime = TimeTools.copy(oTime); if (refTime != null) {
observationTime.set(Calendar.HOUR_OF_DAY, hour);
observationTime.set(Calendar.MINUTE, minute); observationTime = TimeTools.copy(refTime);
observationTime.set(Calendar.SECOND, 0); observationTime.set(Calendar.HOUR_OF_DAY, hour);
observationTime.set(Calendar.MILLISECOND, 0); observationTime.set(Calendar.MINUTE, minute);
observationTime.set(Calendar.SECOND, 0);
observationTime.set(Calendar.MILLISECOND, 0);
// If the observation time ends up greater than
// the reference time, back up a day.
if (observationTime.compareTo(refTime) > 0) {
observationTime.add(Calendar.DAY_OF_MONTH, -1);
}
if (observationTime.compareTo(oTime) > 0) { theElements.set(i, observationTime);
observationTime.add(Calendar.DAY_OF_MONTH, -1);
} }
theElements.set(i, observationTime);
break; break;
} }
} }
@ -679,4 +683,24 @@ public class AirepParser {
return (rptRemarks != null) ? rptRemarks.toString() : ""; return (rptRemarks != null) ? rptRemarks.toString() : "";
} // getRemarks() } // getRemarks()
public static void main(String [] args) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
sdf.setTimeZone(TimeZone.getTimeZone("ZULU"));
Calendar refTime = TimeTools.getBaseCalendar(2011, 12, 14);
refTime.set(Calendar.HOUR_OF_DAY, 17);
refTime.set(Calendar.MINUTE, 15);
refTime.set(Calendar.SECOND, 00);
refTime.set(Calendar.MILLISECOND, 0);
String data = "ARP UAL121 4400N 05700W 1640 F390 MS00 000/099KT TB MOD SK CLEAR=";
AirepParser p = new AirepParser(data,refTime);
System.out.println(sdf.format(p.getObservationTime().getTime()));
data = "ARP UAL121 4400N 05700W 1840 F390 MS00 000/099KT TB MOD SK CLEAR=";
p = new AirepParser(data,refTime);
System.out.println(sdf.format(p.getObservationTime().getTime()));
}
} // AirepParser } // AirepParser

View file

@ -13,12 +13,12 @@
<constructor-arg value="jms-dist:queue:Ingest.binlightning?destinationResolver=#qpidDurableResolver" /> <constructor-arg value="jms-dist:queue:Ingest.binlightning?destinationResolver=#qpidDurableResolver" />
</bean> </bean>
<bean id="binlightningCamelRegistered" factory-bean="contextManager" <bean id="binlightningCamelRegistered" factory-bean="clusteredCamelContextMgr"
factory-method="register" depends-on="persistCamelRegistered"> factory-method="register" depends-on="persistCamelRegistered">
<constructor-arg ref="binlightning-camel"/> <constructor-arg ref="clusteredBinLightningRoutes" />
</bean> </bean>
<camelContext id="binlightning-camel" <camelContext id="clusteredBinLightningRoutes"
xmlns="http://camel.apache.org/schema/spring" xmlns="http://camel.apache.org/schema/spring"
errorHandlerRef="errorHandler" errorHandlerRef="errorHandler"
autoStartup="false"> autoStartup="false">

View file

@ -30,7 +30,6 @@ import org.apache.commons.logging.LogFactory;
import com.raytheon.edex.esb.Headers; import com.raytheon.edex.esb.Headers;
import com.raytheon.edex.exception.DecoderException; import com.raytheon.edex.exception.DecoderException;
import com.raytheon.edex.plugin.AbstractDecoder; import com.raytheon.edex.plugin.AbstractDecoder;
import com.raytheon.edex.plugin.IBinaryDecoder;
import com.raytheon.edex.plugin.binlightning.impl.BinLightningFactory; import com.raytheon.edex.plugin.binlightning.impl.BinLightningFactory;
import com.raytheon.edex.plugin.binlightning.impl.IBinLightningDecoder; import com.raytheon.edex.plugin.binlightning.impl.IBinLightningDecoder;
import com.raytheon.edex.plugin.binlightning.impl.LightningDataSource; import com.raytheon.edex.plugin.binlightning.impl.LightningDataSource;
@ -92,6 +91,8 @@ public class BinLightningDecoder extends AbstractDecoder {
// Allow ingest up to 10 minutes into the future. // Allow ingest up to 10 minutes into the future.
private static final long TEN_MINUTES = 10 * 60 * 1000L; private static final long TEN_MINUTES = 10 * 60 * 1000L;
private SimpleDateFormat SDF;
private Log logger = LogFactory.getLog(getClass()); private Log logger = LogFactory.getLog(getClass());
/** /**
@ -107,6 +108,8 @@ public class BinLightningDecoder extends AbstractDecoder {
* will return false, decode() will return a null. * will return false, decode() will return a null.
*/ */
public BinLightningDecoder() { public BinLightningDecoder() {
SDF = new SimpleDateFormat("yyyyMMddHHmmss");
SDF.setTimeZone(TimeZone.getTimeZone("Zulu"));
} }
/** /**
@ -125,8 +128,12 @@ public class BinLightningDecoder extends AbstractDecoder {
traceId = (String) headers.get(DecoderTools.INGEST_FILE_NAME); traceId = (String) headers.get(DecoderTools.INGEST_FILE_NAME);
WMOHeader header = new WMOHeader(data); WMOHeader wmoHdr = new WMOHeader(data);
if (header.isValid()) { if (wmoHdr.isValid()) {
Calendar baseTime = TimeTools.findDataTime(wmoHdr.getYYGGgg(),
headers);
byte[] pdata = DecoderTools.stripWMOHeader(data, SFUS_PATTERN); byte[] pdata = DecoderTools.stripWMOHeader(data, SFUS_PATTERN);
if (pdata == null) { if (pdata == null) {
pdata = DecoderTools.stripWMOHeader(data, SFPA_PATTERN); pdata = DecoderTools.stripWMOHeader(data, SFPA_PATTERN);
@ -174,21 +181,19 @@ public class BinLightningDecoder extends AbstractDecoder {
return new PluginDataObject[0]; return new PluginDataObject[0];
} }
Calendar c = TimeTools.getSystemCalendar(); Calendar c = TimeTools.copy(baseTime);
if (c == null) { if (c == null) {
throw new DecoderException(traceId throw new DecoderException(traceId
+ "-Error decoding times"); + "-Error decoding times");
} }
report.setInsertTime(c);
Calendar cStart = report.getStartTime(); Calendar cStart = report.getStartTime();
if (cStart.getTimeInMillis() > c.getTimeInMillis() if (cStart.getTimeInMillis() > c.getTimeInMillis()
+ TEN_MINUTES) { + TEN_MINUTES) {
SimpleDateFormat sdf = new SimpleDateFormat( synchronized (SDF) {
"yyyyMMddHHmmss"); logger.info("Discarding future data for " + traceId
sdf.setTimeZone(TimeZone.getTimeZone("Zulu")); + " at " + SDF.format(cStart.getTime()));
logger.info("Discarding future data for " + traceId }
+ " at " + sdf.format(cStart.getTime()));
} else { } else {
Calendar cStop = report.getStopTime(); Calendar cStop = report.getStopTime();
@ -206,8 +211,7 @@ public class BinLightningDecoder extends AbstractDecoder {
report.constructDataURI(); report.constructDataURI();
reports = new PluginDataObject[] { report }; reports = new PluginDataObject[] { report };
} catch (PluginException e) { } catch (PluginException e) {
throw new DecoderException( logger.error("Error constructing datauri", e);
"Error constructing datauri", e);
} }
} }
} }

View file

@ -69,180 +69,181 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@DynamicSerialize @DynamicSerialize
@DataURIConfig(persistentIndex = 2) @DataURIConfig(persistentIndex = 2)
public abstract class BufrMosData extends PersistablePluginDataObject implements public abstract class BufrMosData extends PersistablePluginDataObject implements
IDecoderGettable, IPersistable, IPointData { IDecoderGettable, IPersistable, IPointData {
public static enum MOSType { public static enum MOSType {
ETA, GFS, AVN, LAMP, HPC, MRF, NGM ETA, GFS, AVN, LAMP, HPC, MRF, NGM
}; };
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public static final String MOS_DATA = "Data"; public static final String MOS_DATA = "Data";
// Text of the WMO header // Text of the WMO header
@Transient @Transient
@XmlAttribute @XmlAttribute
@DynamicSerializeElement @DynamicSerializeElement
private String wmoHeader; private String wmoHeader;
@Embedded @Embedded
private PointDataView pdv = null; @DynamicSerializeElement
private PointDataView pointDataView = null;
@ManyToOne(cascade = { CascadeType.REFRESH }) @ManyToOne(cascade = { CascadeType.REFRESH })
@PrimaryKeyJoinColumn @PrimaryKeyJoinColumn
@DataURI(position = 1, embedded = true) @DataURI(position = 1, embedded = true)
@XmlElement @XmlElement
@DynamicSerializeElement @DynamicSerializeElement
private BufrMosDataLocation location; private BufrMosDataLocation location;
/** /**
* Create an empty MOSData object. * Create an empty MOSData object.
*/ */
public BufrMosData() { public BufrMosData() {
this.pluginName = "bufrmos" + getType(); this.pluginName = "bufrmos" + getType();
} }
/** /**
* Constructor for DataURI construction through base class. This is used by * Constructor for DataURI construction through base class. This is used by
* the notification service. * the notification service.
* *
* @param uri * @param uri
* A data uri applicable to this class. * A data uri applicable to this class.
* @param tableDef * @param tableDef
* The table definitions for this class. * The table definitions for this class.
*/ */
public BufrMosData(String uri) { public BufrMosData(String uri) {
super(uri); super(uri);
} }
/** /**
* Get the geometry latitude. * Get the geometry latitude.
* *
* @return The geometry latitude. * @return The geometry latitude.
*/ */
public double getLatitude() { public double getLatitude() {
return location.getLatitude(); return location.getLatitude();
} }
/** /**
* Get the geometry longitude. * Get the geometry longitude.
* *
* @return The geometry longitude. * @return The geometry longitude.
*/ */
public double getLongitude() { public double getLongitude() {
return location.getLongitude(); return location.getLongitude();
} }
/** /**
* Get the station identifier for this observation. * Get the station identifier for this observation.
* *
* @return the stationId * @return the stationId
*/ */
public String getStationId() { public String getStationId() {
return location.getStationId(); return location.getStationId();
} }
/** /**
* @return the type * @return the type
*/ */
public abstract MOSType getType(); public abstract MOSType getType();
/** /**
* @return the wmoHeader * @return the wmoHeader
*/ */
public String getWmoHeader() { public String getWmoHeader() {
return wmoHeader; return wmoHeader;
} }
/** /**
* @param wmoHeader * @param wmoHeader
* the wmoHeader to set * the wmoHeader to set
*/ */
public void setWmoHeader(String wmoHeader) { public void setWmoHeader(String wmoHeader) {
this.wmoHeader = wmoHeader; this.wmoHeader = wmoHeader;
} }
/** /**
* *
* @param dataURI * @param dataURI
*/ */
@Override @Override
public void setDataURI(String dataURI) { public void setDataURI(String dataURI) {
identifier = dataURI; identifier = dataURI;
} }
/** /**
* @see com.raytheon.uf.common.dataplugin.PluginDataObject#getDecoderGettable() * @see com.raytheon.uf.common.dataplugin.PluginDataObject#getDecoderGettable()
*/ */
@Override @Override
public IDecoderGettable getDecoderGettable() { public IDecoderGettable getDecoderGettable() {
return null; return null;
} }
/** /**
* @see com.raytheon.uf.common.dataplugin.IDecoderGettable#getString(java.lang.String) * @see com.raytheon.uf.common.dataplugin.IDecoderGettable#getString(java.lang.String)
*/ */
@Override @Override
public String getString(String paramName) { public String getString(String paramName) {
return null; return null;
} }
/** /**
* @see com.raytheon.uf.common.dataplugin.IDecoderGettable#getStrings(java.lang.String) * @see com.raytheon.uf.common.dataplugin.IDecoderGettable#getStrings(java.lang.String)
*/ */
@Override @Override
public String[] getStrings(String paramName) { public String[] getStrings(String paramName) {
return null; return null;
} }
/** /**
* @see com.raytheon.uf.common.dataplugin.IDecoderGettable#getValue(java.lang.String) * @see com.raytheon.uf.common.dataplugin.IDecoderGettable#getValue(java.lang.String)
*/ */
@Override @Override
public Amount getValue(String paramName) { public Amount getValue(String paramName) {
Amount retValue = null; Amount retValue = null;
// Object element = elementMap.get(paramName); // Object element = elementMap.get(paramName);
// TODO: // TODO:
// if (element != null) { // if (element != null) {
// Unit<?> units = BUFRTableB.mapUnits(element.getUnits()); // Unit<?> units = BUFRTableB.mapUnits(element.getUnits());
// if (units != null) { // if (units != null) {
// if ("FLOAT".equals(element.getElementType())) { // if ("FLOAT".equals(element.getElementType())) {
// retValue = new Amount(element.getDoubleVal(), units); // retValue = new Amount(element.getDoubleVal(), units);
// } else if ("INTEGER".equals(element.getElementType())) { // } else if ("INTEGER".equals(element.getElementType())) {
// retValue = new Amount(element.getIntegerVal(), units); // retValue = new Amount(element.getIntegerVal(), units);
// } // }
// } // }
// } // }
return retValue; return retValue;
} }
/** /**
* @see com.raytheon.uf.common.dataplugin.IDecoderGettable#getValues(java.lang.String) * @see com.raytheon.uf.common.dataplugin.IDecoderGettable#getValues(java.lang.String)
*/ */
@Override @Override
public Collection<Amount> getValues(String paramName) { public Collection<Amount> getValues(String paramName) {
return null; return null;
} }
public BufrMosDataLocation getLocation() { public BufrMosDataLocation getLocation() {
return location; return location;
} }
public void setLocation(BufrMosDataLocation mosLocation) { public void setLocation(BufrMosDataLocation mosLocation) {
this.location = mosLocation; this.location = mosLocation;
} }
@Override @Override
public PointDataView getPointDataView() { public PointDataView getPointDataView() {
return this.pdv; return this.pointDataView;
} }
@Override @Override
public void setPointDataView(PointDataView pdv) { public void setPointDataView(PointDataView pointDataView) {
this.pdv = pdv; this.pointDataView = pointDataView;
} }
} }

View file

@ -24,6 +24,7 @@ import java.util.Calendar;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import com.raytheon.edex.esb.Headers;
import com.raytheon.edex.exception.DecoderException; import com.raytheon.edex.exception.DecoderException;
import com.raytheon.edex.plugin.AbstractDecoder; import com.raytheon.edex.plugin.AbstractDecoder;
import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.PluginDataObject;
@ -31,6 +32,7 @@ import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.TimeRange; import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.uf.edex.decodertools.time.TimeTools; import com.raytheon.uf.edex.decodertools.time.TimeTools;
import com.raytheon.uf.edex.wmo.message.WMOHeader;
import com.vividsolutions.jts.io.WKTReader; import com.vividsolutions.jts.io.WKTReader;
/** /**
@ -84,6 +86,7 @@ public class CcfpDecoder extends AbstractDecoder {
private static final String SPACE = " "; private static final String SPACE = " ";
private static final PluginDataObject [] EMPTY_PDO = new PluginDataObject [0];
/** /**
* Constructor * Constructor
* *
@ -92,9 +95,18 @@ public class CcfpDecoder extends AbstractDecoder {
public CcfpDecoder() throws DecoderException { public CcfpDecoder() throws DecoderException {
} }
public PluginDataObject[] decode(String msg) throws DecoderException, public PluginDataObject[] decode(String msg, Headers headers) throws PluginException {
PluginException {
PluginDataObject [] data = null;
Calendar baseTime = null;
WMOHeader wmoHdr = new WMOHeader(msg.getBytes());
if (wmoHdr.isValid()) {
baseTime = TimeTools.findDataTime(wmoHdr.getYYGGgg(), headers);
} else {
baseTime = TimeTools.getSystemCalendar();
}
CcfpRecord record = new CcfpRecord(); CcfpRecord record = new CcfpRecord();
record.setMessageData(msg); record.setMessageData(msg);
CcfpLocation location = new CcfpLocation(); CcfpLocation location = new CcfpLocation();
@ -124,7 +136,7 @@ public class CcfpDecoder extends AbstractDecoder {
} else { } else {
record.setCanadaflag(Boolean.FALSE); record.setCanadaflag(Boolean.FALSE);
} }
record.setInsertTime(TimeTools.getSystemCalendar()); record.setInsertTime(baseTime);
} }
if (record.getProducttype().equals("AREA")) { if (record.getProducttype().equals("AREA")) {
matcher = AREA_PATTERN.matcher(msg); matcher = AREA_PATTERN.matcher(msg);
@ -205,15 +217,20 @@ public class CcfpDecoder extends AbstractDecoder {
} }
} }
} catch (Exception e) { } catch (Exception e) {
throw new DecoderException("Unable to decode CCFP", e); record = null;
logger.error("Unable to decode CCFP", e);
} }
if (record != null) { data = EMPTY_PDO;
if(record != null) {
record.setPluginName(PLUGIN_NAME); record.setPluginName(PLUGIN_NAME);
record.constructDataURI(); try {
return new PluginDataObject[] { record }; record.constructDataURI();
} else { record.setInsertTime(baseTime);
return new PluginDataObject[0]; data = new PluginDataObject[] { record };
} catch (PluginException e) {
logger.error("Error constructing datauri", e);
}
} }
return data;
} }
} }

View file

@ -136,7 +136,6 @@ public class GOESSoundingDecoder extends AbstractDecoder implements
WMOHeader wmoHeader = input.getWmoHeader(); WMOHeader wmoHeader = input.getWmoHeader();
if ((wmoHeader != null) && (wmoHeader.isValid())) { if ((wmoHeader != null) && (wmoHeader.isValid())) {
try { try {
byte[] messageData = input.getDocumentData(); byte[] messageData = input.getDocumentData();

View file

@ -211,8 +211,7 @@ public class GOESSoundingDataAdapter {
// seconds = (dp.getValue() != null) ? ((Double) dp.getValue()) // seconds = (dp.getValue() != null) ? ((Double) dp.getValue())
// .intValue() : null; // .intValue() : null;
Calendar baseTime = TimeTools.getSystemCalendar(); Calendar baseTime = TimeTools.getBaseCalendar(year, 1, 1);
baseTime.set(Calendar.YEAR, year);
baseTime.set(Calendar.DAY_OF_YEAR, day); baseTime.set(Calendar.DAY_OF_YEAR, day);
baseTime.set(Calendar.HOUR_OF_DAY, hour); baseTime.set(Calendar.HOUR_OF_DAY, hour);
baseTime.set(Calendar.MINUTE, minute); baseTime.set(Calendar.MINUTE, minute);

View file

@ -34,7 +34,6 @@ import ucar.unidata.io.RandomAccessFile;
import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.grib.GribRecord; import com.raytheon.uf.common.dataplugin.grib.GribRecord;
import com.raytheon.uf.common.dataplugin.grib.StatusConstants;
import com.raytheon.uf.common.dataplugin.grib.exception.GribException; import com.raytheon.uf.common.dataplugin.grib.exception.GribException;
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;
@ -109,7 +108,7 @@ public class GribDecoder {
// manual ingest endpoint // manual ingest endpoint
if (recordLengths.size() > 1) { if (recordLengths.size() > 1) {
raf.seek(0); raf.seek(0);
splitFile(file.getName(), raf, recordLengths); splitFile(file.getName(), raf, recordLengths, edition);
return new GribRecord[] {}; return new GribRecord[] {};
} }
} }
@ -165,7 +164,7 @@ public class GribDecoder {
* @throws IOException * @throws IOException
*/ */
private void splitFile(String fileName, RandomAccessFile raf, private void splitFile(String fileName, RandomAccessFile raf,
List<Long> sizes) throws IOException { List<Long> sizes, int edition) throws IOException {
FileOutputStream out = null; FileOutputStream out = null;
byte[] transfer = null; byte[] transfer = null;
for (int i = 0; i < sizes.size(); i++) { for (int i = 0; i < sizes.size(); i++) {
@ -175,7 +174,7 @@ public class GribDecoder {
try { try {
out = new FileOutputStream(System.getProperty("edex.home") out = new FileOutputStream(System.getProperty("edex.home")
+ "/data/manual/" + fileName + "_record_" + (i + 1)); + "/data/manual/grib/grib" + edition + "LargeSplit/" + fileName + "_record_" + (i + 1));
out.write(transfer); out.write(transfer);
out.close(); out.close();
} finally { } finally {

View file

@ -75,297 +75,298 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@XmlAccessorType(XmlAccessType.NONE) @XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize @DynamicSerialize
public class ProfilerLdadObs extends PersistablePluginDataObject implements public class ProfilerLdadObs extends PersistablePluginDataObject implements
ISpatialEnabled, IDecoderGettable, IPointData, IPersistable { ISpatialEnabled, IDecoderGettable, IPointData, IPersistable {
public static final String PLUGIN_NAME = "ldadprofiler"; public static final String PLUGIN_NAME = "ldadprofiler";
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public static final Unit<Angle> LOCATION_UNIT = NonSI.DEGREE_ANGLE; public static final Unit<Angle> LOCATION_UNIT = NonSI.DEGREE_ANGLE;
public static final Unit<Velocity> WIND_SPEED_UNIT = SI.METERS_PER_SECOND; public static final Unit<Velocity> WIND_SPEED_UNIT = SI.METERS_PER_SECOND;
public static final Unit<Angle> WIND_DIR_UNIT = NonSI.DEGREE_ANGLE; public static final Unit<Angle> WIND_DIR_UNIT = NonSI.DEGREE_ANGLE;
private static final HashMap<String, String> PARM_MAP = new HashMap<String, String>(); private static final HashMap<String, String> PARM_MAP = new HashMap<String, String>();
static { static {
PARM_MAP.put("NLAT", STA_LAT); PARM_MAP.put("NLAT", STA_LAT);
PARM_MAP.put("NLON", STA_LON); PARM_MAP.put("NLON", STA_LON);
PARM_MAP.put("WS", SFC_WNDSPD); PARM_MAP.put("WS", SFC_WNDSPD);
PARM_MAP.put("WD", SFC_WNDDIR); PARM_MAP.put("WD", SFC_WNDDIR);
} }
private static final String PRESS = "PRESS"; private static final String PRESS = "PRESS";
private static final String AGL = "AGL"; private static final String AGL = "AGL";
public static final String PRESS_PARAM_PTRN = ".*:" + PRESS + "=\\d{2,4}"; public static final String PRESS_PARAM_PTRN = ".*:" + PRESS + "=\\d{2,4}";
public static final String AGL_PARAM_PTRN = ".*:" + AGL + "=\\d{2,4}"; public static final String AGL_PARAM_PTRN = ".*:" + AGL + "=\\d{2,4}";
@Transient @Transient
private String parameterName = null; private String parameterName = null;
@DataURI(position = 1) @DataURI(position = 1)
@XmlAttribute @XmlAttribute
@DynamicSerializeElement @DynamicSerializeElement
private Integer reportType; private Integer reportType;
// Location // Location
@Embedded @Embedded
@DataURI(position = 2, embedded = true) @DataURI(position = 2, embedded = true)
@XmlElement @XmlElement
@DynamicSerializeElement @DynamicSerializeElement
private SurfaceObsLocation location; // latitude, longitude, elevation, private SurfaceObsLocation location; // latitude, longitude, elevation,
// stationId // stationId
// Base time in Epoch "seconds since 1970-01-01 00:00:00 UTC" // Base time in Epoch "seconds since 1970-01-01 00:00:00 UTC"
@Column @Column
@DynamicSerializeElement @DynamicSerializeElement
@XmlElement @XmlElement
int base_time; int base_time;
// Consensus start time offset from base_time // Consensus start time offset from base_time
// "seconds since 2009/10/07 00:00:00 UTC" // "seconds since 2009/10/07 00:00:00 UTC"
@Column @Column
@DynamicSerializeElement @DynamicSerializeElement
@XmlElement @XmlElement
double start_time_offset; double start_time_offset;
// Consensus end time offset from base_time // Consensus end time offset from base_time
// "seconds since 2009/10/07 00:00:00 UTC" // "seconds since 2009/10/07 00:00:00 UTC"
@Column @Column
@DynamicSerializeElement @DynamicSerializeElement
@XmlElement @XmlElement
double end_time_offset; double end_time_offset;
// nhts Number of heights? // nhts Number of heights?
@Column @Column
@DynamicSerializeElement @DynamicSerializeElement
@XmlElement @XmlElement
int nhts; int nhts;
// the level data // the level data
@XmlElement @XmlElement
@DynamicSerializeElement @DynamicSerializeElement
@Transient @Transient
private List<ProfilerLdadLevel> levels; private List<ProfilerLdadLevel> levels;
// The profiler observation time. // The profiler observation time.
@Column @Column
@XmlAttribute @XmlAttribute
@DynamicSerializeElement @DynamicSerializeElement
private Calendar timeObs; private Calendar timeObs;
@Column @Column
@XmlAttribute @XmlAttribute
@DynamicSerializeElement @DynamicSerializeElement
private String stationName; private String stationName;
@Embedded @Embedded
private PointDataView pdv; @DynamicSerializeElement
private PointDataView pointDataView;
/** /**
* @return the base_time * @return the base_time
*/ */
public int getBase_time() { public int getBase_time() {
return base_time; return base_time;
} }
/** /**
* @param base_time * @param base_time
* the base_time to set * the base_time to set
*/ */
public void setBase_time(int base_time) { public void setBase_time(int base_time) {
this.base_time = base_time; this.base_time = base_time;
} }
public Calendar getTimeObs() { public Calendar getTimeObs() {
return timeObs; return timeObs;
} }
public void setTimeObs(Calendar timeObs) { public void setTimeObs(Calendar timeObs) {
this.timeObs = timeObs; this.timeObs = timeObs;
} }
/** /**
* @return the start_time_offset * @return the start_time_offset
*/ */
public double getStart_time_offset() { public double getStart_time_offset() {
return start_time_offset; return start_time_offset;
} }
/** /**
* @param start_time_offset * @param start_time_offset
* the start_time_offset to set * the start_time_offset to set
*/ */
public void setStart_time_offset(double start_time_offset) { public void setStart_time_offset(double start_time_offset) {
this.start_time_offset = start_time_offset; this.start_time_offset = start_time_offset;
} }
/** /**
* @return the end_time_offset * @return the end_time_offset
*/ */
public double getEnd_time_offset() { public double getEnd_time_offset() {
return end_time_offset; return end_time_offset;
} }
/** /**
* @param end_time_offset * @param end_time_offset
* the end_time_offset to set * the end_time_offset to set
*/ */
public void setEnd_time_offset(double end_time_offset) { public void setEnd_time_offset(double end_time_offset) {
this.end_time_offset = end_time_offset; this.end_time_offset = end_time_offset;
} }
/** /**
* @return the nhts * @return the nhts
*/ */
public int getNhts() { public int getNhts() {
return nhts; return nhts;
} }
/** /**
* @param nhts * @param nhts
* the nhts to set * the nhts to set
*/ */
public void setNhts(int nhts) { public void setNhts(int nhts) {
this.nhts = nhts; this.nhts = nhts;
} }
/** /**
* @return the levels * @return the levels
*/ */
public List<ProfilerLdadLevel> getLevels() { public List<ProfilerLdadLevel> getLevels() {
return levels; return levels;
} }
/** /**
* @param levels * @param levels
* the levels to set * the levels to set
*/ */
public void setLevels(List<ProfilerLdadLevel> levels) { public void setLevels(List<ProfilerLdadLevel> levels) {
this.levels = levels; this.levels = levels;
} }
/** /**
* @return the pdv * @return the pointDataView
*/ */
@Override @Override
public PointDataView getPointDataView() { public PointDataView getPointDataView() {
return pdv; return pointDataView;
} }
public ProfilerLdadObs() { public ProfilerLdadObs() {
} }
/** /**
* @param pdv * @param pointDataView
* the pdv to set * the pointDataView to set
*/ */
@Override @Override
public void setPointDataView(PointDataView pdv) { public void setPointDataView(PointDataView pointDataView) {
this.pdv = pdv; this.pointDataView = pointDataView;
} }
// ---------------------------------------------------- // ----------------------------------------------------
@Override @Override
public IDecoderGettable getDecoderGettable() { public IDecoderGettable getDecoderGettable() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public ISpatialObject getSpatialObject() { public ISpatialObject getSpatialObject() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public String getString(String paramName) { public String getString(String paramName) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public String[] getStrings(String paramName) { public String[] getStrings(String paramName) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public Amount getValue(String paramName) { public Amount getValue(String paramName) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public Collection<Amount> getValues(String paramName) { public Collection<Amount> getValues(String paramName) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
/** /**
* @param location * @param location
* the location to set * the location to set
*/ */
public void setLocation(SurfaceObsLocation location) { public void setLocation(SurfaceObsLocation location) {
this.location = location; this.location = location;
} }
/** /**
* @return the location * @return the location
*/ */
public SurfaceObsLocation getLocation() { public SurfaceObsLocation getLocation() {
return location; return location;
} }
/** /**
* @param stationName * @param stationName
* the stationName to set * the stationName to set
*/ */
public void setStationName(String stationName) { public void setStationName(String stationName) {
this.stationName = stationName; this.stationName = stationName;
} }
/** /**
* @return the stationName * @return the stationName
*/ */
public String getStationName() { public String getStationName() {
return stationName; return stationName;
} }
/** /**
* @param parameterName * @param parameterName
* the parameterName to set * the parameterName to set
*/ */
public void setParameterName(String parameterName) { public void setParameterName(String parameterName) {
this.parameterName = parameterName; this.parameterName = parameterName;
} }
/** /**
* @return the parameterName * @return the parameterName
*/ */
public String getParameterName() { public String getParameterName() {
return parameterName; return parameterName;
} }
/** /**
* @param reportType * @param reportType
* the reportType to set * the reportType to set
*/ */
public void setReportType(Integer reportType) { public void setReportType(Integer reportType) {
this.reportType = reportType; this.reportType = reportType;
} }
/** /**
* @return the reportType * @return the reportType
*/ */
public Integer getReportType() { public Integer getReportType() {
return reportType; return reportType;
} }
} }

View file

@ -42,6 +42,7 @@ import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.edex.decodertools.core.DecoderTools; import com.raytheon.uf.edex.decodertools.core.DecoderTools;
import com.raytheon.uf.edex.decodertools.core.IDecoderConstants; import com.raytheon.uf.edex.decodertools.core.IDecoderConstants;
import com.raytheon.uf.edex.decodertools.time.TimeTools; import com.raytheon.uf.edex.decodertools.time.TimeTools;
import com.raytheon.uf.edex.wmo.message.WMOHeader;
import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.GeometryFactory; import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.Point; import com.vividsolutions.jts.geom.Point;
@ -210,8 +211,19 @@ public class MetarDecoder extends AbstractDecoder {
throws DecoderException { throws DecoderException {
MetarSeparator sep = MetarSeparator.separate(inputData, headers); MetarSeparator sep = MetarSeparator.separate(inputData, headers);
List<PluginDataObject> retVal = new ArrayList<PluginDataObject>(); List<PluginDataObject> retVal = new ArrayList<PluginDataObject>();
Calendar baseTime = TimeTools.getSystemCalendar();
WMOHeader wmoHdr = sep.getWMOHeader();
if(TimeTools.allowArchive()) {
if((wmoHdr != null)&&(wmoHdr.isValid())) {
baseTime = TimeTools.findDataTime(wmoHdr.getYYGGgg(), headers);
} else {
logger.error("ARCHIVE MODE-No WMO Header found in file" + headers.get(WMOHeader.INGEST_FILE_NAME));
}
}
while (sep.hasNext()) { while (sep.hasNext()) {
byte[] messageData = sep.next(); byte[] messageData = sep.next();
Pattern thePattern; Pattern thePattern;
@ -278,17 +290,26 @@ public class MetarDecoder extends AbstractDecoder {
traceId, icao)); traceId, icao));
continue; continue;
} }
String fileName = null;
if (headers != null) {
fileName = (String) headers Calendar obsTime = null;
.get(DecoderTools.INGEST_FILE_NAME); Integer da = DecoderTools.getInt(timeGroup, 0, 2);
} Integer hr = DecoderTools.getInt(timeGroup, 2, 4);
Calendar obsTime = TimeTools.findCurrentTime( Integer mi = DecoderTools.getInt(timeGroup, 4, 6);
matcher.group(3), fileName); if ((da != null) && (hr != null) && (mi != null)) {
obsTime = TimeTools.copy(baseTime);
obsTime.set(Calendar.DAY_OF_MONTH, da);
obsTime.set(Calendar.HOUR_OF_DAY, hr);
obsTime.set(Calendar.MINUTE, mi);
}
if (obsTime != null) { if (obsTime != null) {
record.setTimeObs(obsTime); record.setTimeObs(obsTime);
record.setDataTime(new DataTime(obsTime)); record.setDataTime(new DataTime(obsTime));
record.setRefHour(Util.findReferenceHour(timeGroup)); Calendar refHour = TimeTools.copyToNearestHour(obsTime);
if(mi >= 45) {
refHour.add(Calendar.HOUR_OF_DAY, 1);
}
record.setRefHour(refHour);
// TODO : // TODO :
} else { } else {
// couldn't find observation time so exit. // couldn't find observation time so exit.
@ -301,7 +322,16 @@ public class MetarDecoder extends AbstractDecoder {
// into the future // into the future
Calendar obsTime = record.getTimeObs(); Calendar obsTime = record.getTimeObs();
if (obsTime != null) { if (obsTime != null) {
Calendar currTime = TimeTools.getSystemCalendar(); Calendar currTime = TimeTools.copy(baseTime);
// Do this only for archive mode!!! Otherwise valid data will not pass if the WMO header
// date/time is much less than the obstime. For instance
// WMO Header time = dd1200
// Observed time = dd1235
// To solve this will require greater precision in the file timestamp.
if(TimeTools.allowArchive()) {
currTime.add(Calendar.HOUR, 1);
}
currTime.add(Calendar.MINUTE, METAR_FUTURE_LIMIT); currTime.add(Calendar.MINUTE, METAR_FUTURE_LIMIT);
long diff = currTime.getTimeInMillis() long diff = currTime.getTimeInMillis()

View file

@ -475,9 +475,7 @@ public class MetarPointDataTransform {
mr.setPkWndSpd(pdv.getNumber(PK_WND_SPD).intValue()); mr.setPkWndSpd(pdv.getNumber(PK_WND_SPD).intValue());
long t = pdv.getNumber(PK_WND_TIME).longValue(); long t = pdv.getNumber(PK_WND_TIME).longValue();
if (t >= 0) { if (t >= 0) {
Calendar c = TimeTools.getSystemCalendar(); mr.setPkWndTime(TimeTools.newCalendar(t));
c.setTimeInMillis(t);
mr.setPkWndTime(c);
} }
return mr; return mr;

View file

@ -25,5 +25,6 @@ Import-Package: com.raytheon.uf.common.comm,
com.raytheon.uf.common.menus, com.raytheon.uf.common.menus,
com.raytheon.uf.common.menus.xml, com.raytheon.uf.common.menus.xml,
com.raytheon.uf.common.site.ingest, com.raytheon.uf.common.site.ingest,
com.raytheon.uf.common.dataplugin.text.db,
org.apache.commons.logging, org.apache.commons.logging,
org.apache.tools.bzip2 org.apache.tools.bzip2

View file

@ -33,6 +33,7 @@ import com.raytheon.edex.plugin.AbstractDecoder;
import com.raytheon.edex.plugin.radar.dao.RadarStationDao; import com.raytheon.edex.plugin.radar.dao.RadarStationDao;
import com.raytheon.edex.plugin.radar.level2.Level2BaseRadar; import com.raytheon.edex.plugin.radar.level2.Level2BaseRadar;
import com.raytheon.edex.plugin.radar.level3.Level3BaseRadar; import com.raytheon.edex.plugin.radar.level3.Level3BaseRadar;
import com.raytheon.edex.plugin.radar.util.RadarEdexTextProductUtil;
import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.PluginException; import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.dataplugin.radar.RadarRecord; import com.raytheon.uf.common.dataplugin.radar.RadarRecord;
@ -165,8 +166,10 @@ public class RadarDecoder extends AbstractDecoder {
AFOSProductId afos = new AFOSProductId("WSR", "ROB", AFOSProductId afos = new AFOSProductId("WSR", "ROB",
siteId); siteId);
// store the product ROB that is barely do-able // store the product ROB that is barely do-able
RadarTextProductUtil.storeTextProduct(afos, header, Calendar cal = (TimeTools.allowArchive() ? header
dataString, true, Calendar.getInstance()); .getHeaderDate() : Calendar.getInstance());
RadarEdexTextProductUtil.storeTextProduct(afos, header,
dataString, true, cal);
return new PluginDataObject[0]; return new PluginDataObject[0];
} }
} }
@ -491,8 +494,10 @@ public class RadarDecoder extends AbstractDecoder {
RadarTextProductUtil.createAfosId(75, splits[1].substring(1))); RadarTextProductUtil.createAfosId(75, splits[1].substring(1)));
// store the product to the text database // store the product to the text database
RadarTextProductUtil.storeTextProduct(afos, header, temp, true, Calendar cal = (TimeTools.allowArchive() ? header.getHeaderDate()
Calendar.getInstance()); : Calendar.getInstance());
RadarEdexTextProductUtil
.storeTextProduct(afos, header, temp, true, cal);
// send message to alertviz // send message to alertviz
EDEXUtil.sendMessageAlertViz(Priority.VERBOSE, EDEXUtil.sendMessageAlertViz(Priority.VERBOSE,

View file

@ -38,6 +38,7 @@ import org.apache.tools.bzip2.CBZip2InputStream;
import com.raytheon.edex.esb.Headers; import com.raytheon.edex.esb.Headers;
import com.raytheon.edex.plugin.radar.dao.RadarStationDao; import com.raytheon.edex.plugin.radar.dao.RadarStationDao;
import com.raytheon.edex.plugin.radar.util.RadarEdexTextProductUtil;
import com.raytheon.uf.common.dataplugin.radar.RadarStation; import com.raytheon.uf.common.dataplugin.radar.RadarStation;
import com.raytheon.uf.common.dataplugin.radar.level3.AlertAdaptationParameters; import com.raytheon.uf.common.dataplugin.radar.level3.AlertAdaptationParameters;
import com.raytheon.uf.common.dataplugin.radar.level3.AlertMessage; import com.raytheon.uf.common.dataplugin.radar.level3.AlertMessage;
@ -54,6 +55,7 @@ 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.time.DataTime; import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.edex.database.DataAccessLayerException; import com.raytheon.uf.edex.database.DataAccessLayerException;
import com.raytheon.uf.edex.decodertools.time.TimeTools;
import com.raytheon.uf.edex.wmo.message.AFOSProductId; import com.raytheon.uf.edex.wmo.message.AFOSProductId;
import com.raytheon.uf.edex.wmo.message.WMOHeader; import com.raytheon.uf.edex.wmo.message.WMOHeader;
@ -822,9 +824,10 @@ public class Level3BaseRadar {
AFOSProductId afos = new AFOSProductId(afosId); AFOSProductId afos = new AFOSProductId(afosId);
if (afos.isFilled()) { if (afos.isFilled()) {
try { try {
RadarTextProductUtil.storeTextProduct(afos, header, Calendar cal = (TimeTools.allowArchive() ? theMsgTimestamp
tabularBlock.getString(), true, : Calendar.getInstance());
Calendar.getInstance()); RadarEdexTextProductUtil.storeTextProduct(afos, header,
tabularBlock.getString(), true, cal);
} catch (Exception e) { } catch (Exception e) {
theHandler.handle(Priority.ERROR, theHandler.handle(Priority.ERROR,
"Could not store text product", e); "Could not store text product", e);
@ -913,9 +916,10 @@ public class Level3BaseRadar {
AFOSProductId afos = new AFOSProductId(afosId); AFOSProductId afos = new AFOSProductId(afosId);
if (afos.isFilled()) { if (afos.isFilled()) {
try { try {
RadarTextProductUtil.storeTextProduct(afos, header, Calendar cal = (TimeTools.allowArchive() ? theMsgTimestamp
tabularBlock.getString(), true, : Calendar.getInstance());
Calendar.getInstance()); RadarEdexTextProductUtil.storeTextProduct(afos, header,
tabularBlock.getString(), true, cal);
} catch (Exception e) { } catch (Exception e) {
theHandler.handle(Priority.ERROR, theHandler.handle(Priority.ERROR,
"Could not store text product", e); "Could not store text product", e);

View file

@ -0,0 +1,112 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.edex.plugin.radar.util;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import com.raytheon.uf.common.dataplugin.text.db.OperationalStdTextProduct;
import com.raytheon.uf.common.dataplugin.text.db.PracticeStdTextProduct;
import com.raytheon.uf.common.dataplugin.text.db.StdTextProduct;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.edex.core.EDEXUtil;
import com.raytheon.uf.edex.wmo.message.AFOSProductId;
import com.raytheon.uf.edex.wmo.message.WMOHeader;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 18, 2012 dgilling Initial creation
*
* </pre>
*
* @author dgilling
* @version 1.0
*/
public class RadarEdexTextProductUtil {
private static final transient IUFStatusHandler theHandler = UFStatus
.getHandler(RadarEdexTextProductUtil.class);
private static final String TEXT_ENDPOINT = "textDirectDecodedIngestRoute";
/**
* A private constructor so that Java does not attempt to create one for us.
* As this class should not be instantiated, do not attempt to ever call
* this constructor; it will simply throw an AssertionError.
*
*/
private RadarEdexTextProductUtil() {
throw new AssertionError();
}
public static void storeTextProduct(AFOSProductId afosId, WMOHeader wmoId,
String text, boolean operationalMode, Calendar cal) {
SimpleDateFormat sdf = new SimpleDateFormat("MMM dd yyyy HH:mm:ss");
String temp = "";
if (wmoId != null && wmoId.isValid()) {
temp = sdf.format(wmoId.getHeaderDate().getTime());
} else {
temp = sdf.format(cal.getTime());
}
if (!text.contains("Message Date:")) {
text = "Message Date: " + temp + "\n\n" + text;
}
text = text.replaceAll("Page \\d+", "");
boolean isValid = wmoId.isValid();
try {
if (afosId != null && text != null && !afosId.toString().isEmpty()
&& !text.isEmpty()) {
StdTextProduct textProd = (operationalMode == true ? new OperationalStdTextProduct()
: new PracticeStdTextProduct());
if (!isValid) {
textProd.setWmoid(" ");
textProd.setSite(" ");
textProd.setBbbid(" ");
textProd.setHdrtime(" ");
} else {
textProd.setWmoid(wmoId.getTtaaii());
textProd.setSite(wmoId.getCccc());
textProd.setHdrtime(wmoId.getYYGGgg());
textProd.setBbbid(wmoId.getBBBIndicator());
}
textProd.setRefTime(cal.getTimeInMillis());
textProd.setCccid(afosId.getCcc());
textProd.setNnnid(afosId.getNnn());
textProd.setXxxid(afosId.getXxx());
textProd.setProduct(text);
EDEXUtil.getMessageProducer()
.sendAsync(TEXT_ENDPOINT, textProd);
}
} catch (Exception e) {
theHandler.handle(Priority.ERROR,
"Unable to store product to text database", e);
}
}
}

View file

@ -19,19 +19,18 @@
**/ **/
package com.raytheon.edex.plugin.redbook; package com.raytheon.edex.plugin.redbook;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import com.raytheon.edex.esb.Headers; import com.raytheon.edex.esb.Headers;
import com.raytheon.edex.exception.DecoderException; import com.raytheon.edex.exception.DecoderException;
import com.raytheon.edex.plugin.AbstractDecoder; import com.raytheon.edex.plugin.AbstractDecoder;
import com.raytheon.uf.edex.database.plugin.PluginFactory;
import com.raytheon.edex.plugin.redbook.common.RedbookRecord; import com.raytheon.edex.plugin.redbook.common.RedbookRecord;
import com.raytheon.edex.plugin.redbook.dao.RedbookDao; import com.raytheon.edex.plugin.redbook.dao.RedbookDao;
import com.raytheon.edex.plugin.redbook.decoder.RedbookParser; import com.raytheon.edex.plugin.redbook.decoder.RedbookParser;
import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.PluginException; import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.edex.database.plugin.PluginFactory;
import com.raytheon.uf.edex.wmo.message.WMOHeader; import com.raytheon.uf.edex.wmo.message.WMOHeader;
/** /**
@ -48,6 +47,8 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
* 20080529 1131 jkorman Added new Separator constructor. * 20080529 1131 jkorman Added new Separator constructor.
* 11/11/08 1684 chammack Refactored to camel * 11/11/08 1684 chammack Refactored to camel
* 20090327 2019 jkorman Added code to check for non-redbook data. * 20090327 2019 jkorman Added code to check for non-redbook data.
* 20120524 #647 dgilling Update persistence time in
* createdBackDatedVersionIfNeeded.
* </pre> * </pre>
* *
* @author jkorman * @author jkorman
@ -157,60 +158,71 @@ public class RedbookDecoder extends AbstractDecoder {
return reports; return reports;
} }
private PluginDataObject[] createMergedRecordList(RedbookRecord report) throws PluginException {
ArrayList<PluginDataObject> listResult = new ArrayList<PluginDataObject>(); private PluginDataObject[] createMergedRecordList(RedbookRecord report)
throws PluginException {
RedbookRecord newRecord = report; ArrayList<PluginDataObject> listResult = new ArrayList<PluginDataObject>();
while (newRecord != null) {
// Note that this newRecord may be modified by createdBackDatedVersionIfNeeded. RedbookRecord newRecord = report;
listResult.add(newRecord); while (newRecord != null) {
// Note that this newRecord may be modified by
newRecord = createdBackDatedVersionIfNeeded(newRecord); // createdBackDatedVersionIfNeeded.
} listResult.add(newRecord);
return listResult.toArray(new PluginDataObject[listResult.size()]);
} newRecord = createdBackDatedVersionIfNeeded(newRecord);
}
private RedbookRecord createdBackDatedVersionIfNeeded(RedbookRecord record) { return listResult.toArray(new PluginDataObject[listResult.size()]);
RedbookDao dao; }
RedbookRecord existingRecord;
private RedbookRecord createdBackDatedVersionIfNeeded(RedbookRecord record) {
try { RedbookDao dao;
dao = (RedbookDao) PluginFactory.getInstance().getPluginDao(PLUGIN_NAME); RedbookRecord existingRecord;
existingRecord = (RedbookRecord) dao.getMetadata(record.getDataURI());
} catch (PluginException e) { try {
logger.error(traceId + "Could not create back-dated copy of " + dao = (RedbookDao) PluginFactory.getInstance().getPluginDao(
record.getDataURI(), e); PLUGIN_NAME);
return null; existingRecord = (RedbookRecord) dao.getMetadata(record
} .getDataURI());
} catch (PluginException e) {
if (existingRecord != null) { logger.error(traceId + "Could not create back-dated copy of "
try { + record.getDataURI(), e);
existingRecord = dao.getFullRecord((RedbookRecord) existingRecord); return null;
} catch (Exception e) { }
logger.error(traceId + "Could not retrieve existing " +
record.getDataURI(), e); if (existingRecord != null) {
return null; try {
} existingRecord = dao.getFullRecord(existingRecord);
RedbookRecord backDatedRecord; } catch (Exception e) {
try { logger.error(
backDatedRecord = existingRecord.createBackdatedVersion(); traceId + "Could not retrieve existing "
backDatedRecord.setPluginName(PLUGIN_NAME); + record.getDataURI(), e);
backDatedRecord.constructDataURI(); return null;
} catch (PluginException e) { }
logger.error(traceId + "Could not create back-dated copy of " + RedbookRecord backDatedRecord;
record.getDataURI(), e); try {
return null; backDatedRecord = existingRecord.createBackdatedVersion();
} // this must be updated so that the insert time is updated
record.setOverwriteAllowed(true); // and the Wes2Bridge archiver properly finds these backdated
dao.delete(existingRecord); // replace op does not update metadata ?! // records
logger.info("Storing new version of " + record.getDataURI()); backDatedRecord.setPersistenceTime(new Date());
backDatedRecord.setPluginName(PLUGIN_NAME);
return backDatedRecord; backDatedRecord.constructDataURI();
} else { } catch (PluginException e) {
return null; logger.error(traceId + "Could not create back-dated copy of "
} + record.getDataURI(), e);
} return null;
}
record.setOverwriteAllowed(true);
dao.delete(existingRecord); // replace op does not update metadata
// ?!
logger.info("Storing new version of " + record.getDataURI());
return backDatedRecord;
} else {
return null;
}
}
/** /**
* Check here to see if we have non-redbook data. It's hard to determine * Check here to see if we have non-redbook data. It's hard to determine
* that we actually have valid redbook, so we check for the signatures of * that we actually have valid redbook, so we check for the signatures of

View file

@ -21,7 +21,6 @@ package com.raytheon.edex.plugin.redbook.common;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.TimeZone;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
@ -37,7 +36,7 @@ import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.PluginException; import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.dataplugin.annotations.DataURI; import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.persist.IPersistable; import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject; import com.raytheon.uf.common.dataplugin.persist.ServerSpecificPersistablePluginDataObject;
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.time.DataTime; import com.raytheon.uf.common.time.DataTime;
@ -67,8 +66,8 @@ import com.raytheon.uf.common.time.DataTime;
@XmlRootElement @XmlRootElement
@XmlAccessorType(XmlAccessType.NONE) @XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize @DynamicSerialize
public class RedbookRecord extends PersistablePluginDataObject implements public class RedbookRecord extends ServerSpecificPersistablePluginDataObject
IPersistable, Cloneable { implements IPersistable, Cloneable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -322,30 +321,6 @@ public class RedbookRecord extends PersistablePluginDataObject implements
return null; return null;
} }
/**
*
*/
@Override
public Date getPersistenceTime() {
Calendar c = getInsertTime();
if (c == null)
return null;
return c.getTime();
}
/**
* Set the time to be used for the persistence time for this object.
*
* @param persistTime
* The persistence time to be used.
*/
public void setPersistenceTime(Date persistTime) {
Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
c.setTime(persistTime);
setInsertTime(c);
}
/** /**
* @return a mostly shallow copy of the RedbookRecord with the reference * @return a mostly shallow copy of the RedbookRecord with the reference
* time set back one minute. Clears the id and dataURI fields of the * time set back one minute. Clears the id and dataURI fields of the
@ -362,10 +337,11 @@ public class RedbookRecord extends PersistablePluginDataObject implements
other.dataURI = null; other.dataURI = null;
Date newRefTime = new Date(dataTime.getRefTime().getTime() - 60 * 1000); Date newRefTime = new Date(dataTime.getRefTime().getTime() - 60 * 1000);
if (dataTime.getUtilityFlags().contains(DataTime.FLAG.FCST_USED)) if (dataTime.getUtilityFlags().contains(DataTime.FLAG.FCST_USED)) {
other.dataTime = new DataTime(newRefTime, dataTime.getFcstTime()); other.dataTime = new DataTime(newRefTime, dataTime.getFcstTime());
else } else {
other.dataTime = new DataTime(newRefTime); other.dataTime = new DataTime(newRefTime);
}
return other; return other;
} }

View file

@ -19,7 +19,6 @@
**/ **/
package com.raytheon.edex.plugin.shef; package com.raytheon.edex.plugin.shef;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
@ -34,7 +33,6 @@ import com.raytheon.edex.plugin.shef.database.PurgeText;
import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.ohd.AppsDefaults; import com.raytheon.uf.common.ohd.AppsDefaults;
import com.raytheon.uf.edex.decodertools.core.DecoderTools; import com.raytheon.uf.edex.decodertools.core.DecoderTools;
import com.raytheon.uf.edex.wmo.message.WMOHeader;
/** /**
* Decoder implementation for SHEF data * Decoder implementation for SHEF data
@ -91,6 +89,8 @@ public class ShefDecoder {
* @return * @return
*/ */
public PluginDataObject[] decode(byte[] data, Headers headers) { public PluginDataObject[] decode(byte[] data, Headers headers) {
boolean archiveMode = AppsDefaults.getInstance().getBoolean("ALLOW_ARCHIVE_DATA",false);
String traceId = null; String traceId = null;
if (headers != null) { if (headers != null) {
@ -108,8 +108,15 @@ public class ShefDecoder {
separator = null; separator = null;
} }
if (separator != null) { if (separator != null) {
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
Date postDate = getPostTime(startTime);
Date postDate = null;
if(archiveMode) {
postDate = getPostTime(separator.getWmoHeader().getHeaderDate().getTimeInMillis());
} else {
postDate = getPostTime(startTime);
}
PostShef postShef = new PostShef(postDate); PostShef postShef = new PostShef(postDate);
if(separator.hasNext()) { if(separator.hasNext()) {
@ -181,10 +188,6 @@ public class ShefDecoder {
private void doDecode(ShefSeparator separator, String traceId, PostShef postShef) { private void doDecode(ShefSeparator separator, String traceId, PostShef postShef) {
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
long endTime;
// Force time to nearest second.
long t = startTime - (startTime % 1000);
AppsDefaults appDefaults = AppsDefaults.getInstance(); AppsDefaults appDefaults = AppsDefaults.getInstance();
boolean logSHEFOut = appDefaults.getBoolean("shef_out", false); boolean logSHEFOut = appDefaults.getBoolean("shef_out", false);
@ -226,8 +229,7 @@ public class ShefDecoder {
} }
} // while() } // while()
if(dataProcessed) { if(dataProcessed) {
endTime = System.currentTimeMillis(); postShef.logStats(traceId, System.currentTimeMillis() - startTime);
postShef.logStats(traceId, endTime - startTime);
} }
} }
@ -236,14 +238,15 @@ public class ShefDecoder {
* @param startTime * @param startTime
* @return * @return
*/ */
private Date getPostTime(long startTime) { private static Date getPostTime(long startTime) {
// Force time to nearest second. // Force time to nearest second.
long t = startTime - (startTime % 1000); return new Date(startTime - (startTime % 1000));
return new Date(t);
} }
/*
*
*/
public static final void main(String [] args) { public static final void main(String [] args) {
long t = System.currentTimeMillis(); long t = System.currentTimeMillis();

View file

@ -152,6 +152,7 @@ public class ShefSeparator extends AbstractRecordSeparator {
traceId = wmoHeader.getWmoHeader(); traceId = wmoHeader.getWmoHeader();
log.info("TraceId set to WMOHeader = " + traceId); log.info("TraceId set to WMOHeader = " + traceId);
} }
// TODO: DR 14 - Shef time changes.
Calendar c = wmoHeader.getHeaderDate(); Calendar c = wmoHeader.getHeaderDate();
if (c != null) { if (c != null) {
productTime = c.getTime(); productTime = c.getTime();

View file

@ -27,15 +27,13 @@ import com.raytheon.uf.common.ohd.AppsDefaults;
public class ShefDao extends DefaultPluginDao { public class ShefDao extends DefaultPluginDao {
/**
private AppsDefaults appsDefaults; *
* @param pluginName
* @throws PluginException
*/
public ShefDao(String pluginName) throws PluginException { public ShefDao(String pluginName) throws PluginException {
super(pluginName); super(pluginName);
appsDefaults = AppsDefaults.getInstance();
} }
@Override @Override
@ -50,7 +48,7 @@ public class ShefDao extends DefaultPluginDao {
* Purge the file system * Purge the file system
*/ */
logger.info("Purging Hydro file system..."); logger.info("Purging Hydro file system...");
File metarInputFile = new File(appsDefaults File metarInputFile = new File(AppsDefaults.getInstance()
.getToken("whfs_local_data_dir") .getToken("whfs_local_data_dir")
+ "/metar_input"); + "/metar_input");
if (!metarInputFile.exists()) { if (!metarInputFile.exists()) {

View file

@ -25,7 +25,6 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.TimeZone; import java.util.TimeZone;
@ -37,6 +36,12 @@ import org.apache.commons.logging.LogFactory;
import com.raytheon.edex.plugin.shef.data.ShefData; import com.raytheon.edex.plugin.shef.data.ShefData;
import com.raytheon.edex.plugin.shef.data.ShefRecord; import com.raytheon.edex.plugin.shef.data.ShefRecord;
import com.raytheon.edex.plugin.shef.util.BitUtils;
import com.raytheon.edex.plugin.shef.util.SHEFDate;
import com.raytheon.edex.plugin.shef.util.ShefStats;
import com.raytheon.edex.plugin.shef.util.ShefUtil;
import com.raytheon.edex.plugin.shef.util.StoreDisposition;
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
import com.raytheon.uf.common.dataplugin.shef.tables.Alertalarmval; import com.raytheon.uf.common.dataplugin.shef.tables.Alertalarmval;
import com.raytheon.uf.common.dataplugin.shef.tables.AlertalarmvalId; import com.raytheon.uf.common.dataplugin.shef.tables.AlertalarmvalId;
import com.raytheon.uf.common.dataplugin.shef.tables.Arealfcst; import com.raytheon.uf.common.dataplugin.shef.tables.Arealfcst;
@ -61,24 +66,17 @@ import com.raytheon.uf.common.dataplugin.shef.tables.Stnclass;
import com.raytheon.uf.common.dataplugin.shef.tables.Unkstn; import com.raytheon.uf.common.dataplugin.shef.tables.Unkstn;
import com.raytheon.uf.common.dataplugin.shef.tables.Unkstnvalue; import com.raytheon.uf.common.dataplugin.shef.tables.Unkstnvalue;
import com.raytheon.uf.common.dataplugin.shef.tables.UnkstnvalueId; import com.raytheon.uf.common.dataplugin.shef.tables.UnkstnvalueId;
import com.raytheon.uf.common.dataplugin.shef.util.ParameterCode;
import com.raytheon.edex.plugin.shef.util.BitUtils;
import com.raytheon.uf.common.dataplugin.shef.util.ParameterCode.DataType; import com.raytheon.uf.common.dataplugin.shef.util.ParameterCode.DataType;
import com.raytheon.uf.common.dataplugin.shef.util.ParameterCode.Duration; import com.raytheon.uf.common.dataplugin.shef.util.ParameterCode.Duration;
import com.raytheon.uf.common.dataplugin.shef.util.ParameterCode.Extremum; import com.raytheon.uf.common.dataplugin.shef.util.ParameterCode.Extremum;
import com.raytheon.uf.common.dataplugin.shef.util.ParameterCode.PhysicalElement; import com.raytheon.uf.common.dataplugin.shef.util.ParameterCode.PhysicalElement;
import com.raytheon.uf.common.dataplugin.shef.util.ParameterCode.PhysicalElementCategory; import com.raytheon.uf.common.dataplugin.shef.util.ParameterCode.PhysicalElementCategory;
import com.raytheon.uf.common.dataplugin.shef.util.ParameterCode.TypeSource; import com.raytheon.uf.common.dataplugin.shef.util.ParameterCode.TypeSource;
import com.raytheon.uf.common.dataplugin.shef.util.ParameterCode;
import com.raytheon.uf.common.dataplugin.shef.util.SHEFTimezone; import com.raytheon.uf.common.dataplugin.shef.util.SHEFTimezone;
import com.raytheon.edex.plugin.shef.util.SHEFDate;
import com.raytheon.edex.plugin.shef.util.ShefStats;
import com.raytheon.edex.plugin.shef.util.ShefUtil;
import com.raytheon.edex.plugin.shef.util.StoreDisposition;
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
import com.raytheon.uf.common.dataplugin.shef.util.ShefConstants; import com.raytheon.uf.common.dataplugin.shef.util.ShefConstants;
import com.raytheon.uf.common.dataplugin.shef.util.ShefQC;
import com.raytheon.uf.common.dataplugin.shef.util.ShefConstants.IngestSwitch; import com.raytheon.uf.common.dataplugin.shef.util.ShefConstants.IngestSwitch;
import com.raytheon.uf.common.dataplugin.shef.util.ShefQC;
import com.raytheon.uf.common.ohd.AppsDefaults; import com.raytheon.uf.common.ohd.AppsDefaults;
import com.raytheon.uf.edex.database.dao.CoreDao; import com.raytheon.uf.edex.database.dao.CoreDao;
import com.raytheon.uf.edex.database.dao.DaoConfig; import com.raytheon.uf.edex.database.dao.DaoConfig;
@ -130,6 +128,11 @@ public class PostShef {
QC_DEFAULT, QC_GROSSRANGE_FAILED, QC_REASONRANGE_FAILED, QC_ROC_FAILED, QC_ROC_PASSED, QC_OUTLIER_FAILED, QC_OUTLIER_PASSED, QC_SCC_FAILED, QC_SCC_PASSED, QC_MSC_FAILED, QC_MSC_PASSED, QC_EXTERN_FAILED, QC_EXTERN_QUEST, QC_MANUAL_PASSED, QC_MANUAL_QUEST, QC_MANUAL_FAILED, QC_MANUAL_NEW, QC_PASSED, QC_QUESTIONABLE, QC_FAILED, QC_NOT_PASSED, QC_NOT_FAILED QC_DEFAULT, QC_GROSSRANGE_FAILED, QC_REASONRANGE_FAILED, QC_ROC_FAILED, QC_ROC_PASSED, QC_OUTLIER_FAILED, QC_OUTLIER_PASSED, QC_SCC_FAILED, QC_SCC_PASSED, QC_MSC_FAILED, QC_MSC_PASSED, QC_EXTERN_FAILED, QC_EXTERN_QUEST, QC_MANUAL_PASSED, QC_MANUAL_QUEST, QC_MANUAL_FAILED, QC_MANUAL_NEW, QC_PASSED, QC_QUESTIONABLE, QC_FAILED, QC_NOT_PASSED, QC_NOT_FAILED
}; };
private static final SimpleDateFormat DB_TIMESTAMP = new SimpleDateFormat(ShefConstants.POSTGRES_DATE_FORMAT.toPattern());
static {
DB_TIMESTAMP.setTimeZone(TimeZone.getTimeZone(ShefConstants.GMT));
}
private static final Pattern Q_CODES = Pattern.compile("Q[^BEF]"); private static final Pattern Q_CODES = Pattern.compile("Q[^BEF]");
private static final String POST_START_MSG = "Posting process started for LID [%s] PEDTSEP [%s] value [%s]"; private static final String POST_START_MSG = "Posting process started for LID [%s] PEDTSEP [%s] value [%s]";
@ -203,6 +206,8 @@ public class PostShef {
private boolean perfLog = false; private boolean perfLog = false;
private boolean archiveMode = false;
private HashMap<String, Location> idLocations = new HashMap<String, Location>(); private HashMap<String, Location> idLocations = new HashMap<String, Location>();
/** /**
@ -256,6 +261,8 @@ public class PostShef {
dataLog = appDefaults.getBoolean(ShefConstants.SHEF_DATA_LOG, false); dataLog = appDefaults.getBoolean(ShefConstants.SHEF_DATA_LOG, false);
// TODO need to implement this token and the performance logging // TODO need to implement this token and the performance logging
perfLog = appDefaults.getBoolean(ShefConstants.SHEF_PERFLOG, false); perfLog = appDefaults.getBoolean(ShefConstants.SHEF_PERFLOG, false);
archiveMode = appDefaults.getBoolean("ALLOW_ARCHIVE_DATA",false);
} }
/** /**
@ -648,7 +655,7 @@ public class PostShef {
start = System.currentTimeMillis(); start = System.currentTimeMillis();
// Identifier has been set from the awipsHeader. // Identifier has been set from the awipsHeader.
postProductLink(locId, identifier, obsTime, postDate); postProductLink(locId, identifier, obsTime);
// postProductLink(locId, shefRecord.getIdentifier(), obsTime); // postProductLink(locId, shefRecord.getIdentifier(), obsTime);
stats.addElapsedTimeIngest(System.currentTimeMillis() - start); stats.addElapsedTimeIngest(System.currentTimeMillis() - start);
@ -1108,9 +1115,13 @@ public class PostShef {
String pe = null; String pe = null;
String ts = null; String ts = null;
String query = "select lid,pe,ts " + "from " + tableName + " " // String query = "select lid,pe,ts " + "from " + tableName + " "
+ "where validtime > CURRENT_TIMESTAMP and " // + "where validtime > CURRENT_TIMESTAMP and "
+ "probability < 0.0"; // + "probability < 0.0";
String query = String
.format("select lid,pe,ts from %s where validtime > '%s' and probability < 0.0",
tableName, toTimeStamp(postDate));
try { try {
dao = new CoreDao(DaoConfig.forDatabase(ShefConstants.IHFS)); dao = new CoreDao(DaoConfig.forDatabase(ShefConstants.IHFS));
@ -2549,8 +2560,7 @@ public class PostShef {
* @param obsTime * @param obsTime
* - The observation time * - The observation time
*/ */
private void postProductLink(String locId, String productId, Date obsTime, private void postProductLink(String locId, String productId, Date obsTime) {
Date postDate) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("PostShef.postProductLink() called..."); log.debug("PostShef.postProductLink() called...");
} }
@ -3004,8 +3014,6 @@ public class PostShef {
basisTime = new Date(); basisTime = new Date();
} }
// TODO fix the duplicate code below:
if (dataValue == "") { if (dataValue == "") {
dataValue = "-9999"; dataValue = "-9999";
} }
@ -3247,6 +3255,29 @@ public class PostShef {
return dataObj; return dataObj;
} }
/**
*
* @param c
* @return
*/
private static String toTimeStamp(Date d) {
String timeStamp = null;
if(d != null) {
timeStamp = DB_TIMESTAMP.format(d);
}
return timeStamp;
}
/**
*
* @param c
* @return
*/
private static String toTimeStamp(Calendar c) {
return toTimeStamp(c.getTime());
}
public static final void main(String[] args) { public static final void main(String[] args) {
Calendar postDate = TimeTools.getBaseCalendar(2011, 1, 12); Calendar postDate = TimeTools.getBaseCalendar(2011, 1, 12);

View file

@ -28,7 +28,8 @@ import java.util.List;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.hibernate.Session; import org.hibernate.connection.ConnectionProvider;
import org.hibernate.engine.SessionFactoryImplementor;
import com.raytheon.edex.plugin.shef.data.ShefData; import com.raytheon.edex.plugin.shef.data.ShefData;
import com.raytheon.edex.plugin.shef.data.ShefRecord; import com.raytheon.edex.plugin.shef.data.ShefRecord;
@ -1037,15 +1038,16 @@ public class PostTables {
CoreDao dao = null; CoreDao dao = null;
Connection conn = null; Connection conn = null;
CallableStatement cs = null; CallableStatement cs = null;
Session ses = null;
int status = -1; int status = -1;
if (dataValue == "") { if (dataValue == "") {
dataValue = ShefConstants.SHEF_MISSING; dataValue = ShefConstants.SHEF_MISSING;
} }
try { try {
dao = new CoreDao(DaoConfig.forDatabase(ShefConstants.IHFS)); dao = new CoreDao(DaoConfig.forDatabase(ShefConstants.IHFS));
ses = dao.getSessionFactory().openSession(); SessionFactoryImplementor impl = (SessionFactoryImplementor) dao.getSessionFactory();
conn = ses.connection(); ConnectionProvider cp = impl.getConnectionProvider();
conn = cp.getConnection();
cs = conn.prepareCall("{call " + functionName cs = conn.prepareCall("{call " + functionName
+ "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)}"); + "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)}");
cs.setString(1, locId); cs.setString(1, locId);
@ -1129,14 +1131,8 @@ public class PostTables {
} catch (Exception e) { } catch (Exception e) {
// Intentionally empty // Intentionally empty
} }
try {
ses.close();
} catch (Exception e) {
// Intentionally empty
}
cs = null; cs = null;
conn = null; conn = null;
ses = null;
} }
return status; return status;
} }
@ -1160,7 +1156,6 @@ public class PostTables {
} }
CoreDao dao = null; CoreDao dao = null;
Connection conn = null; Connection conn = null;
Session ses = null;
CallableStatement cs = null; CallableStatement cs = null;
int status = -1; int status = -1;
if (dataValue == "") { if (dataValue == "") {
@ -1168,8 +1163,10 @@ public class PostTables {
} }
try { try {
dao = new CoreDao(DaoConfig.forDatabase(ShefConstants.IHFS)); dao = new CoreDao(DaoConfig.forDatabase(ShefConstants.IHFS));
ses = dao.getSessionFactory().openSession(); SessionFactoryImplementor impl = (SessionFactoryImplementor) dao.getSessionFactory();
conn = ses.connection(); ConnectionProvider cp = impl.getConnectionProvider();
conn = cp.getConnection();
cs = conn.prepareCall("{call " + functionName cs = conn.prepareCall("{call " + functionName
+ "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)}"); + "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)}");
cs.setString(1, locId); cs.setString(1, locId);
@ -1259,11 +1256,6 @@ public class PostTables {
} catch (Exception e) { } catch (Exception e) {
// Intentionally empty // Intentionally empty
} }
try {
ses.close();
} catch (Exception e) {
// Intentionally empty
}
cs = null; cs = null;
conn = null; conn = null;
} }
@ -1287,7 +1279,6 @@ public class PostTables {
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
CoreDao dao = null; CoreDao dao = null;
Connection conn = null; Connection conn = null;
Session ses = null;
CallableStatement cs = null; CallableStatement cs = null;
java.sql.Timestamp timeStamp = null; java.sql.Timestamp timeStamp = null;
int status = -1; int status = -1;
@ -1297,8 +1288,10 @@ public class PostTables {
try { try {
dao = new CoreDao(DaoConfig.forDatabase(ShefConstants.IHFS)); dao = new CoreDao(DaoConfig.forDatabase(ShefConstants.IHFS));
ses = dao.getSessionFactory().openSession(); SessionFactoryImplementor impl = (SessionFactoryImplementor) dao.getSessionFactory();
conn = ses.connection(); ConnectionProvider cp = impl.getConnectionProvider();
conn = cp.getConnection();
cs = conn.prepareCall("{call " + functionName cs = conn.prepareCall("{call " + functionName
+ "(?, ?, ?, ?, ?, cast(? as real), ?, ?, ?, ?," + "(?, ?, ?, ?, ?, cast(? as real), ?, ?, ?, ?,"
+ " ?, ?, ?, ?, ?, ?, ?)}"); + " ?, ?, ?, ?, ?, ?, ?)}");
@ -1421,11 +1414,6 @@ public class PostTables {
} catch (Exception e) { } catch (Exception e) {
// Intentionally empty // Intentionally empty
} }
try {
ses.close();
} catch (Exception e) {
// Intentionally empty
}
cs = null; cs = null;
conn = null; conn = null;
} }
@ -1490,7 +1478,6 @@ public class PostTables {
CoreDao dao = null; CoreDao dao = null;
Connection conn = null; Connection conn = null;
Session ses = null;
PreparedStatement ps = null; PreparedStatement ps = null;
java.sql.Timestamp timeStamp = null; java.sql.Timestamp timeStamp = null;
java.sql.Timestamp timeStamp2 = null; java.sql.Timestamp timeStamp2 = null;
@ -1508,8 +1495,12 @@ public class PostTables {
try { try {
dao = new CoreDao(DaoConfig.forDatabase(ShefConstants.IHFS)); dao = new CoreDao(DaoConfig.forDatabase(ShefConstants.IHFS));
ses = dao.getSessionFactory().openSession();
conn = ses.connection(); SessionFactoryImplementor impl = (SessionFactoryImplementor) dao.getSessionFactory();
ConnectionProvider cp = impl.getConnectionProvider();
conn = cp.getConnection();
if (updateFlag) { if (updateFlag) {
ps = conn.prepareCall(updateQuery); ps = conn.prepareCall(updateQuery);
} else { } else {
@ -1618,11 +1609,6 @@ public class PostTables {
} catch (Exception e) { } catch (Exception e) {
// Intentionally empty // Intentionally empty
} }
try {
ses.close();
} catch (Exception e) {
// Intentionally empty
}
ps = null; ps = null;
conn = null; conn = null;
} }

View file

@ -89,8 +89,6 @@ public class GagePP {
private static Log logger = LogFactory.getLog(GagePP.class); private static Log logger = LogFactory.getLog(GagePP.class);
private SimpleDateFormat minSDF = new SimpleDateFormat("mm");
private GagePPWrite gagePPWrite = null; private GagePPWrite gagePPWrite = null;
private char pOffsetCode; private char pOffsetCode;
@ -100,10 +98,6 @@ public class GagePP {
private short p6HourSlot; private short p6HourSlot;
public GagePP() { public GagePP() {
// used_value_count = 0;
// ignored_value_count = 0;
// // total_value_count = 0;
// group_count = 0;
} }
/** /**
@ -135,7 +129,6 @@ public class GagePP {
// double elapsed_time; // double elapsed_time;
int prev_dur = 0; int prev_dur = 0;
// String prev_key = null;
int use_value; int use_value;
short precip_val; short precip_val;
short hour = 1; short hour = 1;
@ -151,11 +144,8 @@ public class GagePP {
int status = GPP_OK; int status = GPP_OK;
logger.info("Processing records at " + btime); logger.info("Processing records at " + btime);
Calendar dt = TimeTools.newCalendar(rec.getObsTime().getTime());
Calendar dt = Calendar.getInstance(SHEFTimezone.GMT_TIMEZONE);
dt.setTime(rec.getObsTime());
HourlyppId id = new HourlyppId(rec.getLocationId(), rec.getTypeSource() HourlyppId id = new HourlyppId(rec.getLocationId(), rec.getTypeSource()
.getCode(), btime); .getCode(), btime);
@ -545,8 +535,8 @@ public class GagePP {
private void gage_pp_1hour_slot(final GagePPOptions pOptions, private void gage_pp_1hour_slot(final GagePPOptions pOptions,
final String pPE, PrecipRecord rec) { final String pPE, PrecipRecord rec) {
Calendar dt = Calendar.getInstance(SHEFTimezone.GMT_TIMEZONE); Calendar dt = Calendar.getInstance(SHEFTimezone.GMT_TIMEZONE);
Date datetime = rec.getObsTime(); dt.setTime(rec.getObsTime());
dt.setTime(datetime);
int hour = dt.get(Calendar.HOUR_OF_DAY); int hour = dt.get(Calendar.HOUR_OF_DAY);
int minute = dt.get(Calendar.MINUTE); int minute = dt.get(Calendar.MINUTE);
@ -656,34 +646,30 @@ public class GagePP {
final Calendar ansi_obstime_year_sec, String ansi_date_year_day, final Calendar ansi_obstime_year_sec, String ansi_date_year_day,
short [] p6HourSlot, char[] p6HourOffsetCode) { short [] p6HourSlot, char[] p6HourOffsetCode) {
float ppq_window; float ppq_window = pOptions.getIntppq();
ppq_window *= SECONDS_PER_HOUR;
int bottom_6_hour_period; int bottom_6_hour_period;
int diff1; int diff1;
int diff2; int diff2;
int hour; int hour = ansi_obstime_year_sec.get(Calendar.HOUR_OF_DAY);
int minute; int minute = ansi_obstime_year_sec.get(Calendar.MINUTE);
int num_periods; int num_periods;
int remainder; int remainder;
int top_6_hour_period; int top_6_hour_period;
Calendar num_seconds_since_00z = Calendar // Calendar num_seconds_since_00z = Calendar
.getInstance(SHEFTimezone.GMT_TIMEZONE); // .getInstance(SHEFTimezone.GMT_TIMEZONE);
ppq_window = pOptions.getIntppq(); int num_seconds_since_00z = (hour * SECONDS_PER_HOUR)
ppq_window *= SECONDS_PER_HOUR; + (minute * SECONDS_PER_MINUTE);
bottom_6_hour_period = num_seconds_since_00z / SECONDS_IN_6HOUR_PERIOD;
hour = ansi_obstime_year_sec.get(Calendar.HOUR_OF_DAY);
minute = ansi_obstime_year_sec.get(Calendar.MINUTE);
num_seconds_since_00z.setTimeInMillis((hour * SECONDS_PER_HOUR)
+ (minute * SECONDS_PER_MINUTE));
bottom_6_hour_period = (int) (num_seconds_since_00z.getTimeInMillis() / SECONDS_IN_6HOUR_PERIOD);
top_6_hour_period = bottom_6_hour_period + 1; top_6_hour_period = bottom_6_hour_period + 1;
diff1 = (int) (num_seconds_since_00z.getTimeInMillis() - (bottom_6_hour_period * SECONDS_IN_6HOUR_PERIOD)); diff1 = num_seconds_since_00z
- (bottom_6_hour_period * SECONDS_IN_6HOUR_PERIOD);
diff2 = (top_6_hour_period * SECONDS_IN_6HOUR_PERIOD) diff2 = (top_6_hour_period * SECONDS_IN_6HOUR_PERIOD)
- (int) num_seconds_since_00z.getTimeInMillis(); - num_seconds_since_00z;
if (diff1 < diff2) { if (diff1 < diff2) {
/* /*

View file

@ -28,6 +28,8 @@ import java.util.List;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import com.raytheon.edex.plugin.shef.ohdlib.GagePPOptions.upd_action;
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
import com.raytheon.uf.common.dataplugin.shef.tables.Dailypp; import com.raytheon.uf.common.dataplugin.shef.tables.Dailypp;
import com.raytheon.uf.common.dataplugin.shef.tables.DailyppId; import com.raytheon.uf.common.dataplugin.shef.tables.DailyppId;
import com.raytheon.uf.common.dataplugin.shef.tables.Hourlypc; import com.raytheon.uf.common.dataplugin.shef.tables.Hourlypc;
@ -35,11 +37,8 @@ import com.raytheon.uf.common.dataplugin.shef.tables.HourlypcId;
import com.raytheon.uf.common.dataplugin.shef.tables.Hourlypp; import com.raytheon.uf.common.dataplugin.shef.tables.Hourlypp;
import com.raytheon.uf.common.dataplugin.shef.tables.HourlyppId; import com.raytheon.uf.common.dataplugin.shef.tables.HourlyppId;
import com.raytheon.uf.common.dataplugin.shef.tables.IHourlyTS; import com.raytheon.uf.common.dataplugin.shef.tables.IHourlyTS;
import com.raytheon.edex.plugin.shef.ohdlib.GagePPOptions.upd_action;
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
import com.raytheon.uf.common.dataplugin.shef.util.SHEFTimezone; import com.raytheon.uf.common.dataplugin.shef.util.SHEFTimezone;
import com.raytheon.uf.common.dataplugin.shef.util.ShefConstants; import com.raytheon.uf.common.dataplugin.shef.util.ShefConstants;
import com.raytheon.uf.common.dataplugin.shef.util.ShefQC;
import com.raytheon.uf.edex.database.dao.CoreDao; import com.raytheon.uf.edex.database.dao.CoreDao;
import com.raytheon.uf.edex.database.dao.DaoConfig; import com.raytheon.uf.edex.database.dao.DaoConfig;
import com.raytheon.uf.edex.decodertools.time.TimeTools; import com.raytheon.uf.edex.decodertools.time.TimeTools;
@ -63,10 +62,6 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools;
public final class GagePPWrite { public final class GagePPWrite {
private static Log logger = LogFactory.getLog(GagePPWrite.class); private static Log logger = LogFactory.getLog(GagePPWrite.class);
private static final float MISSING_PRECIP = -9999f;
private Date datetime;
private char hourly_qc[] = new char[PrecipUtils.NUM_HOURLY_SLOTS]; private char hourly_qc[] = new char[PrecipUtils.NUM_HOURLY_SLOTS];
private char minute_offset[] = new char[PrecipUtils.NUM_HOURLY_SLOTS]; private char minute_offset[] = new char[PrecipUtils.NUM_HOURLY_SLOTS];
@ -81,8 +76,6 @@ public final class GagePPWrite {
* Empty constructor. * Empty constructor.
*/ */
public GagePPWrite() { public GagePPWrite() {
// sdf = new SimpleDateFormat(ShefConstants.POSTGRES_DATE_STRING); // sdf = new SimpleDateFormat(ShefConstants.POSTGRES_DATE_STRING);
sdf = new SimpleDateFormat("yyyy-MM-dd"); sdf = new SimpleDateFormat("yyyy-MM-dd");
sdf.setTimeZone(SHEFTimezone.GMT_TIMEZONE); sdf.setTimeZone(SHEFTimezone.GMT_TIMEZONE);
@ -106,9 +99,7 @@ public final class GagePPWrite {
char manual_qc_code) { char manual_qc_code) {
datetime = dtime; Calendar dt = TimeTools.newCalendar(dtime.getTime());
Calendar dt = TimeTools.getSystemCalendar();
dt.setTime(datetime);
int hour_slot = dt.get(Calendar.HOUR_OF_DAY); int hour_slot = dt.get(Calendar.HOUR_OF_DAY);
Arrays.fill(hourly_qc, '-'); Arrays.fill(hourly_qc, '-');

View file

@ -45,8 +45,6 @@ public abstract class PrecipUtils {
private static final char ZERO_OFFSET = '0'; private static final char ZERO_OFFSET = '0';
private static final AppsDefaults APPS_DEFAULTS = AppsDefaults.getInstance();
public static final int NUM_HOURLY_SLOTS = 24; public static final int NUM_HOURLY_SLOTS = 24;
public static final int NUM_6HOURLY_SLOTS = 4; public static final int NUM_6HOURLY_SLOTS = 4;
@ -71,6 +69,7 @@ public abstract class PrecipUtils {
* @param options * @param options
*/ */
public static void get_precip_window(GagePPOptions options) { public static void get_precip_window(GagePPOptions options) {
AppsDefaults APPS_DEFAULTS = AppsDefaults.getInstance();
options.setIntpc(APPS_DEFAULTS.getInt("intpc",10)); options.setIntpc(APPS_DEFAULTS.getInt("intpc",10));
options.setIntlppp(APPS_DEFAULTS.getInt("intlppp",10)); options.setIntlppp(APPS_DEFAULTS.getInt("intlppp",10));
options.setIntuppp(APPS_DEFAULTS.getInt("intuppp",10)); options.setIntuppp(APPS_DEFAULTS.getInt("intuppp",10));
@ -109,7 +108,7 @@ public abstract class PrecipUtils {
* @return * @return
*/ */
public static float get_6hour_precip_window() { public static float get_6hour_precip_window() {
return APPS_DEFAULTS.getFloat("intppq", 2.0f); return AppsDefaults.getInstance().getFloat("intppq", 2.0f);
} }
/** /**
@ -771,7 +770,7 @@ public abstract class PrecipUtils {
*/ */
/* Get the search window around local 7 AM. */ /* Get the search window around local 7 AM. */
int local_7am_window = APPS_DEFAULTS.getInt("ppp_ppd_local_7am_window", 3); int local_7am_window = AppsDefaults.getInstance().getInt("ppp_ppd_local_7am_window", 3);
Calendar c = new GregorianCalendar(SHEFTimezone.GMT_TIMEZONE); Calendar c = new GregorianCalendar(SHEFTimezone.GMT_TIMEZONE);
c.setTime(time12z); c.setTime(time12z);

View file

@ -35,6 +35,7 @@ import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.ohd.AppsDefaults; import com.raytheon.uf.common.ohd.AppsDefaults;
import com.raytheon.uf.edex.decodertools.core.DecoderTools; import com.raytheon.uf.edex.decodertools.core.DecoderTools;
import com.raytheon.uf.edex.decodertools.time.TimeTools; import com.raytheon.uf.edex.decodertools.time.TimeTools;
import com.raytheon.uf.edex.wmo.message.WMOHeader;
/** /**
* Base class for observation data to SHEF conversions. * Base class for observation data to SHEF conversions.
@ -142,7 +143,6 @@ public abstract class AbstractShefTransformer<T extends PluginDataObject>
* @param objects * @param objects
* @return * @return
*/ */
@SuppressWarnings("unchecked")
public static Iterator<?> iterate(PluginDataObject[] objects) { public static Iterator<?> iterate(PluginDataObject[] objects) {
Iterator<PluginDataObject> it = null; Iterator<PluginDataObject> it = null;
if (objects != null) { if (objects != null) {
@ -203,11 +203,15 @@ public abstract class AbstractShefTransformer<T extends PluginDataObject>
* @return * @return
*/ */
protected StringBuilder makeWMOHeader(StringBuilder buffer, protected StringBuilder makeWMOHeader(StringBuilder buffer,
String stationId, Headers headers) { String stationId, Headers headers, WMOHeader hdr) {
Calendar c = TimeTools.getSystemCalendar((String) headers
.get(DecoderTools.INGEST_FILE_NAME));
Calendar c = null;
if((hdr != null)&&(headers != null)) {
c = TimeTools.findDataTime(hdr.getYYGGgg(), headers);
} else {
c = TimeTools.getSystemCalendar();
}
buffer.append(String.format(WMO_HEADER_FMT, stationId, c)); buffer.append(String.format(WMO_HEADER_FMT, stationId, c));
return buffer; return buffer;

View file

@ -116,7 +116,7 @@ public class MetarToShefTransformer extends
String stnId = rec.getStationId(); String stnId = rec.getStationId();
place = 2; place = 2;
StringBuilder sb = makeWMOHeader(openWMOMessage(0, 200), StringBuilder sb = makeWMOHeader(openWMOMessage(0, 200),
stnId, headers); stnId, headers, hdr);
place = 3; place = 3;
startMessageLine(sb); startMessageLine(sb);
@ -414,6 +414,14 @@ public class MetarToShefTransformer extends
newobs = writeObs(newobs,sb.toString()); newobs = writeObs(newobs,sb.toString());
System.out.println(newobs); System.out.println(newobs);
Calendar c = TimeTools.getBaseCalendar(2011, 11, 30);
c.set(Calendar.HOUR_OF_DAY, 16);
c.set(Calendar.MINUTE, 21);
System.out.println(String.format(WMO_HEADER_FMT, "KOMA", c));
} }
} }

View file

@ -30,6 +30,7 @@ import com.raytheon.uf.common.dataplugin.sfcobs.ObsCommon;
import com.raytheon.uf.edex.decodertools.core.DecoderTools; import com.raytheon.uf.edex.decodertools.core.DecoderTools;
import com.raytheon.uf.edex.decodertools.core.IDecoderConstants; import com.raytheon.uf.edex.decodertools.core.IDecoderConstants;
import com.raytheon.uf.edex.decodertools.time.TimeTools; import com.raytheon.uf.edex.decodertools.time.TimeTools;
import com.raytheon.uf.edex.wmo.message.WMOHeader;
/** /**
* Transforms a decoded synoptic observation into a series of SHEF encoded data * Transforms a decoded synoptic observation into a series of SHEF encoded data
@ -84,8 +85,10 @@ public class SMToShefTransformer extends AbstractShefTransformer<ObsCommon> {
// Currently returns false, so nothing is encoded at this time. // Currently returns false, so nothing is encoded at this time.
if (encodeThisStation(rec)) { if (encodeThisStation(rec)) {
WMOHeader hdr = new WMOHeader(rec.getObsText().getBytes());
StringBuilder sb = makeWMOHeader(openWMOMessage(0, 200), StringBuilder sb = makeWMOHeader(openWMOMessage(0, 200),
"KWOH", headers); "KWOH", headers, hdr);
startMessageLine(sb) startMessageLine(sb)
.append(":SHEF derived data created by SMToShefTransformer"); .append(":SHEF derived data created by SMToShefTransformer");

View file

@ -19,4 +19,5 @@ Export-Package: com.raytheon.edex.plugin.text,
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: com.raytheon.uf.common.dataplugin.text, Import-Package: com.raytheon.uf.common.dataplugin.text,
com.raytheon.uf.common.dataplugin.text.db, com.raytheon.uf.common.dataplugin.text.db,
com.raytheon.uf.common.dataplugin.text.request com.raytheon.uf.common.dataplugin.text.request,
com.raytheon.uf.edex.maintenance.archive

View file

@ -40,6 +40,14 @@
<property name="corePoolSize" value="2" /> <property name="corePoolSize" value="2" />
<property name="maxPoolSize" value="2" /> <property name="maxPoolSize" value="2" />
</bean> </bean>
<!-- Special handler for text plugin archives that bases filenames off
creation time-->
<bean id="textArchiveNamer" class="com.raytheon.edex.plugin.text.maintenance.archiver.TextArchiveFileNameFormatter" />
<bean factory-bean="databaseArchiver" factory-method="registerPluginArchiveFormatter" depends-on="databaseArchiver">
<constructor-arg value="text" />
<constructor-arg ref="textArchiveNamer" />
</bean>
<camelContext id="text-camel" <camelContext id="text-camel"

View file

@ -144,7 +144,7 @@ public class TextDecoder extends AbstractDecoder {
pdo.setProductId(textProduct.getCccid() pdo.setProductId(textProduct.getCccid()
+ textProduct.getNnnid() + textProduct.getXxxid()); + textProduct.getNnnid() + textProduct.getXxxid());
DataTime dt = new DataTime( DataTime dt = new DataTime(
TimeTools.newCalendar(textProduct.getCreatetime())); TimeTools.newCalendar(textProduct.getRefTime()));
pdo.setDataTime(dt); pdo.setDataTime(dt);
} else { } else {
// throw new Exception("product already exists"); // throw new Exception("product already exists");

View file

@ -20,11 +20,18 @@
package com.raytheon.edex.plugin.text.dao; package com.raytheon.edex.plugin.text.dao;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date;
import java.util.List;
import com.raytheon.edex.db.dao.DefaultPluginDao; import com.raytheon.edex.db.dao.DefaultPluginDao;
import com.raytheon.edex.textdb.dao.StdTextProductDao;
import com.raytheon.edex.textdb.dbapi.impl.TextDB; import com.raytheon.edex.textdb.dbapi.impl.TextDB;
import com.raytheon.uf.common.dataplugin.PluginException; import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
import com.raytheon.uf.common.dataquery.db.QueryParam.QueryOperand;
import com.raytheon.uf.edex.database.DataAccessLayerException;
import com.raytheon.uf.edex.database.purge.PurgeLogger; import com.raytheon.uf.edex.database.purge.PurgeLogger;
import com.raytheon.uf.edex.database.query.DatabaseQuery;
/** /**
* DAO for text products * DAO for text products
@ -57,6 +64,7 @@ public class TextDao extends DefaultPluginDao {
// no op // no op
} }
@Override
public void purgeExpiredData() throws PluginException { public void purgeExpiredData() throws PluginException {
int deletedRecords = 0; int deletedRecords = 0;
@ -68,5 +76,42 @@ public class TextDao extends DefaultPluginDao {
PurgeLogger.logInfo("Purged " + deletedRecords + " items total.", PurgeLogger.logInfo("Purged " + deletedRecords + " items total.",
"text"); "text");
}
@SuppressWarnings("unchecked")
@Override
public List<PersistableDataObject> getRecordsToArchive(
Calendar insertStartTime, Calendar insertEndTime)
throws DataAccessLayerException {
StdTextProductDao dao = new StdTextProductDao(true);
DatabaseQuery dbQuery = new DatabaseQuery(dao.getDaoClass());
dbQuery.addQueryParam("insertTime", insertStartTime,
QueryOperand.GREATERTHANEQUALS);
dbQuery.addQueryParam("insertTime", insertEndTime,
QueryOperand.LESSTHAN);
dbQuery.addOrder("insertTime", true);
return (List<PersistableDataObject>) dao.queryByCriteria(dbQuery);
}
@Override
public Date getMinInsertTime(String productKey)
throws DataAccessLayerException {
StdTextProductDao dao = new StdTextProductDao(true);
DatabaseQuery query = new DatabaseQuery(dao.getDaoClass());
List<String[]> keys = this.getProductKeyParameters(productKey);
for (String[] key : keys) {
query.addQueryParam(key[0], key[1]);
}
query.addReturnedField("insertTime");
query.addOrder("insertTime", true);
query.setMaxResults(1);
@SuppressWarnings("unchecked")
List<Calendar> result = (List<Calendar>) dao.queryByCriteria(query);
if (result.isEmpty()) {
return null;
} else {
return result.get(0).getTime();
}
} }
} }

View file

@ -95,7 +95,7 @@ public class StdTextProductRequestHandler implements
if (createtime == null) { if (createtime == null) {
createtime = new Date().getTime(); createtime = new Date().getTime();
} }
text.setCreatetime(createtime); text.setRefTime(createtime);
text.setProduct(product); text.setProduct(product);
boolean success = dao.writeProduct(text); boolean success = dao.writeProduct(text);

View file

@ -0,0 +1,126 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.edex.plugin.text.maintenance.archiver;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.raytheon.uf.common.dataplugin.persist.DefaultPathProvider;
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
import com.raytheon.uf.common.dataplugin.text.db.StdTextProduct;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.edex.database.DataAccessLayerException;
import com.raytheon.uf.edex.database.plugin.PluginDao;
import com.raytheon.uf.edex.maintenance.archive.IPluginArchiveFileNameFormatter;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 20, 2012 dgilling Initial creation
*
* </pre>
*
* @author dgilling
* @version 1.0
*/
public class TextArchiveFileNameFormatter implements
IPluginArchiveFileNameFormatter {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(TextArchiveFileNameFormatter.class);
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.edex.maintenance.archive.IPluginArchiveFileNameFormatter
* #getPdosByFile(java.lang.String,
* com.raytheon.uf.edex.database.plugin.PluginDao, java.util.Map,
* java.util.Calendar, java.util.Calendar)
*/
@Override
public Map<String, List<PersistableDataObject>> getPdosByFile(
String pluginName, PluginDao dao,
Map<String, List<PersistableDataObject>> pdoMap,
Calendar startTime, Calendar endTime)
throws DataAccessLayerException {
List<PersistableDataObject> pdos = dao.getRecordsToArchive(startTime,
endTime);
Set<String> newFileEntries = new HashSet<String>();
if (pdos != null && !pdos.isEmpty()) {
if (pdos.get(0) instanceof StdTextProduct) {
for (PersistableDataObject pdo : pdos) {
StdTextProduct casted = (StdTextProduct) pdo;
// no refTime to use, so we use creation time
Date time = new Date(casted.getRefTime());
String timeString = null;
synchronized (DefaultPathProvider.fileNameFormat) {
timeString = DefaultPathProvider.fileNameFormat
.format(time);
}
String path = pluginName + timeString;
newFileEntries.add(path);
List<PersistableDataObject> list = pdoMap.get(path);
if (list == null) {
list = new ArrayList<PersistableDataObject>(pdos.size());
pdoMap.put(path, list);
}
list.add(pdo);
}
} else {
statusHandler.error("Invalid PersistableDataObject class "
+ pdos.get(0).getClass()
+ "sent to TextArchiveFileNameFormatter to archive");
}
}
Iterator<String> iter = pdoMap.keySet().iterator();
Map<String, List<PersistableDataObject>> pdosToSave = new HashMap<String, List<PersistableDataObject>>(
pdoMap.size() - newFileEntries.size());
while (iter.hasNext()) {
String key = iter.next();
if (!newFileEntries.contains(key)) {
pdosToSave.put(key, pdoMap.get(key));
iter.remove();
}
}
return pdosToSave;
}
}

View file

@ -22,10 +22,10 @@
<property name="connectors"> <property name="connectors">
<list> <list>
<bean id="Connector" class="org.eclipse.jetty.server.nio.SelectChannelConnector"> <bean id="Connector" class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<property name="port" value="8080"/> <property name="port" value="${web.port}"/>
<property name="maxIdleTime" value="30000"/> <property name="maxIdleTime" value="30000"/>
<property name="acceptors" value="2"/> <property name="acceptors" value="2"/>
<property name="confidentialPort" value="8443"/> <property name="confidentialPort" value="${confidential.port}"/>
</bean> </bean>
</list> </list>
</property> </property>
@ -61,18 +61,22 @@
</bean> </bean>
<camelContext id="uengine-camel" xmlns="http://camel.apache.org/schema/spring" errorHandlerRef="errorHandler"> <camelContext id="uengine-camel" xmlns="http://camel.apache.org/schema/spring" errorHandlerRef="errorHandler">
<endpoint id="uEngineHttpThrift_from"
uri="jetty:http://0.0.0.0:${http.port}/services/pyproductthrift?disableStreamCache=true&amp;chunked=false&amp;httpBindingRef=#binaryHttpBinding" />
<endpoint id="uEngineHttpJaxb_from"
uri="jetty:http://0.0.0.0:${http.port}/services/pyproductjaxb" />
<!-- UEngine routes --> <!-- UEngine routes -->
<route id="uEngineHttpThrift"> <route id="uEngineHttpThrift">
<from uri="jetty:http://0.0.0.0:9581/services/pyproductthrift?disableStreamCache=true&amp;chunked=false&amp;httpBindingRef=#binaryHttpBinding" /> <from uri="ref:uEngineHttpThrift_from" />
<bean ref="uEngine" method="executePython" /> <bean ref="uEngine" method="executePython" />
<bean ref="serializationUtil" method="transformToThrift" /> <bean ref="serializationUtil" method="transformToThrift" />
</route> </route>
<route id="uEngineHttpJaxb"> <route id="uEngineHttpJaxb">
<from uri="jetty:http://0.0.0.0:9581/services/pyproductjaxb" /> <from uri="ref:uEngineHttpJaxb_from" />
<bean ref="uEngine" method="executePython" /> <bean ref="uEngine" method="executePython" />
<bean ref="serializationUtil" method="marshalToXml" /> <bean ref="serializationUtil" method="marshalToXml" />
</route> </route>
</camelContext> </camelContext>
</beans> </beans>

View file

@ -106,7 +106,9 @@ public class StdTextProductDao extends CoreDao {
private static final String CCC_ID = "cccid"; private static final String CCC_ID = "cccid";
private static final String CREATETIME = "createtime"; private static final String REFTIME = "refTime";
private static final String INSERTTIME = "insertTime";
private static final String ProdHDRTIME = "prodId.hdrtime"; private static final String ProdHDRTIME = "prodId.hdrtime";
@ -128,7 +130,7 @@ public class StdTextProductDao extends CoreDao {
private static final String PRACTICE_TABLE = "practicestdtextproducts"; private static final String PRACTICE_TABLE = "practicestdtextproducts";
private static final String TM_QUERY_FMT = "select createtime from table_name where cccid='%s' and nnnid='%s' and xxxid='%s';"; private static final String TM_QUERY_FMT = "select refTime from table_name where cccid='%s' and nnnid='%s' and xxxid='%s';";
private static final String AFOS_QUERY_STMT = "from StdTextProduct prod where " private static final String AFOS_QUERY_STMT = "from StdTextProduct prod where "
+ ProdCCC_ID + ProdCCC_ID
@ -143,7 +145,7 @@ public class StdTextProductDao extends CoreDao {
+ " = :" + " = :"
+ XXX_ID + XXX_ID
+ " order by " + " order by "
+ CREATETIME + " desc"; + REFTIME + " desc" + ", " + INSERTTIME + " desc";
private Log logger = LogFactory.getLog(getClass()); private Log logger = LogFactory.getLog(getClass());
@ -183,7 +185,7 @@ public class StdTextProductDao extends CoreDao {
prodId.setXxxid(xxx); prodId.setXxxid(xxx);
try { try {
Query query = this.getSession().createQuery( Query query = this.getSession().createQuery(
"SELECT createtime from " "SELECT refTime from "
+ textProduct.getClass().getSimpleName() + textProduct.getClass().getSimpleName()
+ " where prodId = :prodid"); + " where prodId = :prodid");
query.setParameter("prodid", prodId); query.setParameter("prodid", prodId);
@ -391,11 +393,12 @@ public class StdTextProductDao extends CoreDao {
Criteria criteria = session Criteria criteria = session
.createCriteria(getStdTextProductInstance().getClass()); .createCriteria(getStdTextProductInstance().getClass());
criteria.add(Restrictions.allEq(tmp)); criteria.add(Restrictions.allEq(tmp));
criteria.add(Restrictions.gt(CREATETIME, new Long(searchTime))); criteria.add(Restrictions.gt(REFTIME, new Long(searchTime)));
criteria.addOrder(Order.asc(ProdCCC_ID)); criteria.addOrder(Order.asc(ProdCCC_ID));
criteria.addOrder(Order.asc(ProdNNN_ID)); criteria.addOrder(Order.asc(ProdNNN_ID));
criteria.addOrder(Order.asc(ProdXXX_ID)); criteria.addOrder(Order.asc(ProdXXX_ID));
criteria.addOrder(Order.desc(CREATETIME)); criteria.addOrder(Order.desc(REFTIME));
criteria.addOrder(Order.desc(INSERTTIME));
criteria.addOrder(Order.desc(ProdHDRTIME)); criteria.addOrder(Order.desc(ProdHDRTIME));
Iterator<?> iter = criteria.list().iterator(); Iterator<?> iter = criteria.list().iterator();
@ -467,7 +470,7 @@ public class StdTextProductDao extends CoreDao {
Criteria criteria = sess.createCriteria(getStdTextProductInstance() Criteria criteria = sess.createCriteria(getStdTextProductInstance()
.getClass()); .getClass());
criteria.setProjection(Projections.max(CREATETIME)); criteria.setProjection(Projections.max(REFTIME));
criteria.add(Restrictions.allEq(tmp)); criteria.add(Restrictions.allEq(tmp));
List<?> list = criteria.list(); List<?> list = criteria.list();
@ -602,8 +605,8 @@ public class StdTextProductDao extends CoreDao {
} }
/** /**
* Simple purge routine. Deletes all data that has a createtime older than * Simple purge routine. Deletes all data that has a refTime older than that
* that specified. * specified.
*/ */
public int versionPurge() { public int versionPurge() {
return versionPurge(null); return versionPurge(null);
@ -650,20 +653,21 @@ public class StdTextProductDao extends CoreDao {
String nnnid = null; String nnnid = null;
String xxxid = null; String xxxid = null;
String cTimeQueryString = null; String refTimeQueryString = null;
{ {
StringBuilder cTimeQueryBuilder = new StringBuilder(200); StringBuilder refTimeQueryBuilder = new StringBuilder(200);
cTimeQueryBuilder.append("SELECT createtime FROM "); refTimeQueryBuilder.append("SELECT refTime FROM ");
cTimeQueryBuilder.append(getStdTextProductInstance() refTimeQueryBuilder.append(getStdTextProductInstance()
.getClass().getSimpleName()); .getClass().getSimpleName());
cTimeQueryBuilder.append(" WHERE "); refTimeQueryBuilder.append(" WHERE ");
cTimeQueryBuilder.append(ProdCCC_ID).append(" = :cccid") refTimeQueryBuilder.append(ProdCCC_ID).append(" = :cccid")
.append(" AND "); .append(" AND ");
cTimeQueryBuilder.append(ProdNNN_ID).append(" = :nnnid") refTimeQueryBuilder.append(ProdNNN_ID).append(" = :nnnid")
.append(" AND "); .append(" AND ");
cTimeQueryBuilder.append(ProdXXX_ID).append(" = :xxxid"); refTimeQueryBuilder.append(ProdXXX_ID).append(" = :xxxid");
cTimeQueryBuilder.append(" ORDER BY createtime DESC"); refTimeQueryBuilder.append(" ORDER BY refTime DESC");
cTimeQueryString = cTimeQueryBuilder.toString(); refTimeQueryBuilder.append(", insertTime DESC");
refTimeQueryString = refTimeQueryBuilder.toString();
} }
String delQueryString = null; String delQueryString = null;
@ -679,7 +683,7 @@ public class StdTextProductDao extends CoreDao {
.append(" AND "); .append(" AND ");
delQueryBuilder.append(ProdXXX_ID).append(" = :xxxid") delQueryBuilder.append(ProdXXX_ID).append(" = :xxxid")
.append(" AND "); .append(" AND ");
delQueryBuilder.append("createtime < :createtime"); delQueryBuilder.append("refTime < :refTime");
delQueryString = delQueryBuilder.toString(); delQueryString = delQueryBuilder.toString();
} }
@ -693,29 +697,29 @@ public class StdTextProductDao extends CoreDao {
try { try {
tx = session.beginTransaction(); tx = session.beginTransaction();
Query cTimeQuery = session Query refTimeQuery = session
.createQuery(cTimeQueryString); .createQuery(refTimeQueryString);
cTimeQuery.setString("cccid", cccid); refTimeQuery.setString("cccid", cccid);
cTimeQuery.setString("nnnid", nnnid); refTimeQuery.setString("nnnid", nnnid);
cTimeQuery.setString("xxxid", xxxid); refTimeQuery.setString("xxxid", xxxid);
cTimeQuery.setMaxResults(prodInfo.getVersionstokeep()); refTimeQuery
List<?> createTimes = cTimeQuery.list(); .setMaxResults(prodInfo.getVersionstokeep());
if (createTimes.size() >= prodInfo.getVersionstokeep()) { List<?> refTimes = refTimeQuery.list();
long createTime = ((Number) createTimes if (refTimes.size() >= prodInfo.getVersionstokeep()) {
.get(prodInfo.getVersionstokeep() - 1)) long refTime = ((Number) refTimes.get(prodInfo
.longValue(); .getVersionstokeep() - 1)).longValue();
Query delQuery = session Query delQuery = session
.createQuery(delQueryString); .createQuery(delQueryString);
delQuery.setString("cccid", cccid); delQuery.setString("cccid", cccid);
delQuery.setString("nnnid", nnnid); delQuery.setString("nnnid", nnnid);
delQuery.setString("xxxid", xxxid); delQuery.setString("xxxid", xxxid);
delQuery.setLong("createtime", createTime); delQuery.setLong("refTime", refTime);
if (PurgeLogger.isDebugEnabled()) { if (PurgeLogger.isDebugEnabled()) {
PurgeLogger.logDebug("Purging records for [" PurgeLogger.logDebug("Purging records for ["
+ cccid + nnnid + xxxid + cccid + nnnid + xxxid
+ "] before createTime [" + createTime + "] before refTime [" + refTime + "]",
+ "]", PLUGIN_NAME); PLUGIN_NAME);
} }
int rowsDeleted = delQuery.executeUpdate(); int rowsDeleted = delQuery.executeUpdate();
@ -876,7 +880,7 @@ public class StdTextProductDao extends CoreDao {
ProjectionList projectionList = Projections.projectionList(); ProjectionList projectionList = Projections.projectionList();
projectionList.add(Projections.distinct(Projections projectionList.add(Projections.distinct(Projections
.property(ProdWMO_ID))); .property(ProdWMO_ID)));
projectionList.add(Projections.max(CREATETIME)); projectionList.add(Projections.max(REFTIME));
projectionList.add(Projections.groupProperty(ProdWMO_ID)); projectionList.add(Projections.groupProperty(ProdWMO_ID));
projectionList.add(Projections.groupProperty(ProdSITE)); projectionList.add(Projections.groupProperty(ProdSITE));
projectionList.add(Projections.groupProperty(ProdCCC_ID)); projectionList.add(Projections.groupProperty(ProdCCC_ID));
@ -894,24 +898,18 @@ public class StdTextProductDao extends CoreDao {
List<StdTextProduct> tmpProducts = new ArrayList<StdTextProduct>(); List<StdTextProduct> tmpProducts = new ArrayList<StdTextProduct>();
for (int i = 0; i < products.size(); i++) { for (int i = 0; i < products.size(); i++) {
StdTextProduct stdTextProduct = getStdTextProductInstance(); StdTextProduct stdTextProduct = getStdTextProductInstance();
stdTextProduct.setWmoid((String) ((Object[]) (products
.toArray())[i])[0]);
stdTextProduct.setRefTime((Long) ((Object[]) (products
.toArray())[i])[1]);
stdTextProduct stdTextProduct
.setWmoid((String) ((Object[]) ((Object[]) products .setSite((String) ((Object[]) (products.toArray())[i])[3]);
.toArray())[i])[0]); stdTextProduct.setCccid((String) ((Object[]) (products
stdTextProduct .toArray())[i])[4]);
.setCreatetime((Long) ((Object[]) ((Object[]) products stdTextProduct.setNnnid((String) ((Object[]) (products
.toArray())[i])[1]); .toArray())[i])[5]);
stdTextProduct stdTextProduct.setXxxid((String) ((Object[]) (products
.setSite((String) ((Object[]) ((Object[]) products .toArray())[i])[6]);
.toArray())[i])[3]);
stdTextProduct
.setCccid((String) ((Object[]) ((Object[]) products
.toArray())[i])[4]);
stdTextProduct
.setNnnid((String) ((Object[]) ((Object[]) products
.toArray())[i])[5]);
stdTextProduct
.setXxxid((String) ((Object[]) ((Object[]) products
.toArray())[i])[6]);
tmpProducts.add(stdTextProduct); tmpProducts.add(stdTextProduct);
} }
@ -949,7 +947,7 @@ public class StdTextProductDao extends CoreDao {
projectionList.add(Projections.distinct(Projections projectionList.add(Projections.distinct(Projections
.property(BBB_ID))); .property(BBB_ID)));
projectionList.add(Projections.property(ProdWMO_ID)); projectionList.add(Projections.property(ProdWMO_ID));
projectionList.add(Projections.property(CREATETIME)); projectionList.add(Projections.property(REFTIME));
projectionList.add(Projections.property(ProdSITE)); projectionList.add(Projections.property(ProdSITE));
projectionList.add(Projections.property(ProdCCC_ID)); projectionList.add(Projections.property(ProdCCC_ID));
projectionList.add(Projections.property(ProdNNN_ID)); projectionList.add(Projections.property(ProdNNN_ID));
@ -961,10 +959,10 @@ public class StdTextProductDao extends CoreDao {
.createCriteria(getStdTextProductInstance().getClass()); .createCriteria(getStdTextProductInstance().getClass());
if (readAllVersions && startTimeMillis != null) { if (readAllVersions && startTimeMillis != null) {
criteria.add(Restrictions.and(Restrictions.allEq(map), criteria.add(Restrictions.and(Restrictions.allEq(map),
Restrictions.ge(CREATETIME, startTimeMillis))); Restrictions.ge(REFTIME, startTimeMillis)));
} else { } else {
criteria.add(Restrictions.and(Restrictions.allEq(map), criteria.add(Restrictions.and(Restrictions.allEq(map),
Restrictions.eq(CREATETIME, p.getCreatetime()))); Restrictions.eq(REFTIME, p.getRefTime())));
} }
criteria.setProjection(projectionList); criteria.setProjection(projectionList);
@ -977,33 +975,24 @@ public class StdTextProductDao extends CoreDao {
List<StdTextProduct> tmpProducts = new ArrayList<StdTextProduct>(); List<StdTextProduct> tmpProducts = new ArrayList<StdTextProduct>();
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
StdTextProduct stdTextProduct = getStdTextProductInstance(); StdTextProduct stdTextProduct = getStdTextProductInstance();
stdTextProduct.setBbbid((String) ((Object[]) (list
.toArray())[i])[0]);
stdTextProduct.setWmoid((String) ((Object[]) (list
.toArray())[i])[1]);
stdTextProduct.setRefTime((Long) ((Object[]) (list
.toArray())[i])[2]);
stdTextProduct stdTextProduct
.setBbbid((String) ((Object[]) ((Object[]) list .setSite((String) ((Object[]) (list.toArray())[i])[3]);
.toArray())[i])[0]); stdTextProduct.setCccid((String) ((Object[]) (list
stdTextProduct .toArray())[i])[4]);
.setWmoid((String) ((Object[]) ((Object[]) list stdTextProduct.setNnnid((String) ((Object[]) (list
.toArray())[i])[1]); .toArray())[i])[5]);
stdTextProduct stdTextProduct.setXxxid((String) ((Object[]) (list
.setCreatetime((Long) ((Object[]) ((Object[]) list .toArray())[i])[6]);
.toArray())[i])[2]); stdTextProduct.setHdrtime((String) ((Object[]) (list
stdTextProduct .toArray())[i])[7]);
.setSite((String) ((Object[]) ((Object[]) list stdTextProduct.setProduct((String) ((Object[]) (list
.toArray())[i])[3]); .toArray())[i])[8]);
stdTextProduct
.setCccid((String) ((Object[]) ((Object[]) list
.toArray())[i])[4]);
stdTextProduct
.setNnnid((String) ((Object[]) ((Object[]) list
.toArray())[i])[5]);
stdTextProduct
.setXxxid((String) ((Object[]) ((Object[]) list
.toArray())[i])[6]);
stdTextProduct
.setHdrtime((String) ((Object[]) ((Object[]) list
.toArray())[i])[7]);
stdTextProduct
.setProduct((String) ((Object[]) ((Object[]) list
.toArray())[i])[8]);
tmpProducts.add(stdTextProduct); tmpProducts.add(stdTextProduct);
} }
list.clear(); list.clear();
@ -1053,11 +1042,11 @@ public class StdTextProductDao extends CoreDao {
int version = 0; int version = 0;
final String query1 = "SELECT DISTINCT site FROM stdTextProducts " final String query1 = "SELECT DISTINCT site FROM stdTextProducts "
+ "WHERE wmoId = ? ORDER BY site ASC"; + "WHERE wmoId = ? ORDER BY site ASC";
final String query2 = "SELECT MAX(createTime) FROM stdTextProducts " final String query2 = "SELECT MAX(refTime) FROM stdTextProducts "
+ "WHERE site = ? and wmoId = ?"; + "WHERE site = ? and wmoId = ?";
final String query3 = "SELECT cccId, nnnId, xxxId, hdrTime, bbbId, version " final String query3 = "SELECT cccId, nnnId, xxxId, hdrTime, bbbId, version "
+ "FROM stdTextProducts " + "FROM stdTextProducts "
+ "WHERE site = ? AND wmoId = ? AND createTime = ? " + "WHERE site = ? AND wmoId = ? AND refTime = ? "
+ "ORDER BY cccId ASC, nnnId ASC, xxxId ASC, hdrTime DESC, bbbId DESC"; + "ORDER BY cccId ASC, nnnId ASC, xxxId ASC, hdrTime DESC, bbbId DESC";
List<String> retVal = new ArrayList<String>(); List<String> retVal = new ArrayList<String>();
@ -1077,10 +1066,10 @@ public class StdTextProductDao extends CoreDao {
rs2 = ps2.executeQuery(); rs2 = ps2.executeQuery();
if (rs2.next()) { if (rs2.next()) {
int createTime = rs2.getInt("createTime"); int refTime = rs2.getInt("refTime");
ps3.setString(1, site); ps3.setString(1, site);
ps3.setString(2, wmoId); ps3.setString(2, wmoId);
ps3.setInt(3, createTime); ps3.setInt(3, refTime);
rs3 = ps3.executeQuery(); rs3 = ps3.executeQuery();
while (rs3.next()) { while (rs3.next()) {
@ -1158,7 +1147,7 @@ public class StdTextProductDao extends CoreDao {
*/ */
public List<String> read_wh(String site, long startTimeMillis) { public List<String> read_wh(String site, long startTimeMillis) {
return read_wh(site, return read_wh(site,
(int) (Math.round(startTimeMillis / (float) MILLIS_PER_SECOND))); (Math.round(startTimeMillis / (float) MILLIS_PER_SECOND)));
} }
/* /*
@ -1181,8 +1170,8 @@ public class StdTextProductDao extends CoreDao {
ResultSet rs1 = null; ResultSet rs1 = null;
String product = null; String product = null;
final String query = "SELECT product " final String query = "SELECT product "
+ "FROM stdTextProducts WHERE wmoId = ? AND createTime >= ? " + "FROM stdTextProducts WHERE wmoId = ? AND refTime >= ? "
+ "ORDER BY createTime DESC"; + "ORDER BY refTime DESC, insertTime DESC";
List<String> retVal = new ArrayList<String>(); List<String> retVal = new ArrayList<String>();
try { try {
@ -1244,11 +1233,11 @@ public class StdTextProductDao extends CoreDao {
int version = 0; int version = 0;
final String query1 = "SELECT DISTINCT wmoId " final String query1 = "SELECT DISTINCT wmoId "
+ "FROM stdTextProducts WHERE site = ? " + "ORDER BY wmoId ASC"; + "FROM stdTextProducts WHERE site = ? " + "ORDER BY wmoId ASC";
final String query2 = "SELECT MAX(createTime) " final String query2 = "SELECT MAX(refTime) "
+ "FROM stdTextProducts WHERE site = ? and wmoId = ?"; + "FROM stdTextProducts WHERE site = ? and wmoId = ?";
final String query3 = "SELECT cccId, nnnId, xxxId, hdrTime, bbbId, version " final String query3 = "SELECT cccId, nnnId, xxxId, hdrTime, bbbId, version "
+ "FROM stdTextProducts " + "FROM stdTextProducts "
+ "WHERE site = ? AND wmoId = ? AND createTime = ? " + "WHERE site = ? AND wmoId = ? AND refTime = ? "
+ "ORDER BY cccId ASC, nnnId ASC, xxxId ASC, hdrTime DESC, bbbId DESC"; + "ORDER BY cccId ASC, nnnId ASC, xxxId ASC, hdrTime DESC, bbbId DESC";
List<String> retVal = new ArrayList<String>(); List<String> retVal = new ArrayList<String>();
@ -1268,11 +1257,11 @@ public class StdTextProductDao extends CoreDao {
rs2 = ps2.executeQuery(); rs2 = ps2.executeQuery();
if (rs2.next()) { if (rs2.next()) {
int createTime = rs2.getInt("createTime"); int refTime = rs2.getInt("refTime");
ps3 = c.prepareStatement(query3); ps3 = c.prepareStatement(query3);
ps3.setString(1, site); ps3.setString(1, site);
ps3.setString(2, wmoId); ps3.setString(2, wmoId);
ps3.setInt(3, createTime); ps3.setInt(3, refTime);
rs3 = ps3.executeQuery(); rs3 = ps3.executeQuery();
while (rs3.next()) { while (rs3.next()) {
@ -1349,7 +1338,7 @@ public class StdTextProductDao extends CoreDao {
*/ */
public List<String> read_sh(String site, long startTimeMillis) { public List<String> read_sh(String site, long startTimeMillis) {
return read_sh(site, return read_sh(site,
(int) (Math.round(startTimeMillis / (float) MILLIS_PER_SECOND))); (Math.round(startTimeMillis / (float) MILLIS_PER_SECOND)));
} }
/* /*
@ -1372,8 +1361,8 @@ public class StdTextProductDao extends CoreDao {
ResultSet rs1 = null; ResultSet rs1 = null;
String product = null; String product = null;
final String query = "SELECT product " final String query = "SELECT product "
+ "FROM stdTextProducts WHERE site = ? AND createTime >= ? " + "FROM stdTextProducts WHERE site = ? AND refTime >= ? "
+ "ORDER BY createTime DESC"; + "ORDER BY refTime DESC, insertTime DESC";
List<String> retVal = new ArrayList<String>(); List<String> retVal = new ArrayList<String>();
try { try {
@ -1441,7 +1430,7 @@ public class StdTextProductDao extends CoreDao {
final String query2 = "SELECT cccId, hdrTime, bbbId, version " final String query2 = "SELECT cccId, hdrTime, bbbId, version "
+ "FROM stdTextProducts " + "FROM stdTextProducts "
+ "WHERE site = ? AND wmoId = ? AND nnnId = ? AND xxxId = ? " + "WHERE site = ? AND wmoId = ? AND nnnId = ? AND xxxId = ? "
+ "ORDER BY cccId ASC, createTime DESC"; + "ORDER BY cccId ASC, refTime DESC, insertTime DESC";
try { try {
session = getSession(); session = getSession();
@ -1519,10 +1508,9 @@ public class StdTextProductDao extends CoreDao {
* *
* PDL: Read the version that matches the input Return * PDL: Read the version that matches the input Return
* *
* Note: The MAX function was used just in case createTimes are same. Since * Note: The MAX function was used just in case refTimes are same. Since the
* the product createTime is the UNIX time which has the unit of * product refTime is the UNIX time which has the unit of microseconds, it
* microseconds, it is assumed there should not have two products with the * is assumed there should not have two products with the same refTime.
* same createTime.
* ==================================================================== * ====================================================================
*/ */
public int readLatestIntr(String wmoId, String site) { public int readLatestIntr(String wmoId, String site) {
@ -1533,12 +1521,12 @@ public class StdTextProductDao extends CoreDao {
ResultSet rs1 = null; ResultSet rs1 = null;
ResultSet rs2 = null; ResultSet rs2 = null;
int version = -1; int version = -1;
final String query1 = "SELECT MAX(createTime) " final String query1 = "SELECT MAX(refTime) "
+ "FROM stdTextProducts " + "FROM stdTextProducts "
+ "WHERE wmoId = ? AND site = ? AND cccId = 'NOA' AND nnnId = 'FOS' AND xxxId = 'PIL'"; + "WHERE wmoId = ? AND site = ? AND cccId = 'NOA' AND nnnId = 'FOS' AND xxxId = 'PIL'";
final String query2 = "SELECT MAX(version) " final String query2 = "SELECT MAX(version) "
+ "FROM stdTextProducts " + "FROM stdTextProducts "
+ "WHERE wmoId = ? AND site = ? AND cccId = 'NOA' AND nnnId = 'FOS' AND xxxId = 'PIL' AND createTime = ?"; + "WHERE wmoId = ? AND site = ? AND cccId = 'NOA' AND nnnId = 'FOS' AND xxxId = 'PIL' AND refTime = ?";
try { try {
session = getSession(); session = getSession();
@ -1549,11 +1537,11 @@ public class StdTextProductDao extends CoreDao {
rs1 = ps1.executeQuery(); rs1 = ps1.executeQuery();
if (rs1.next()) { if (rs1.next()) {
int createTime = rs1.getInt("createTime"); int refTime = rs1.getInt("refTime");
ps2 = c.prepareStatement(query2); ps2 = c.prepareStatement(query2);
ps2.setString(1, site); ps2.setString(1, site);
ps2.setString(2, wmoId); ps2.setString(2, wmoId);
ps2.setInt(3, createTime); ps2.setInt(3, refTime);
rs2 = ps2.executeQuery(); rs2 = ps2.executeQuery();
if (rs2.next()) { if (rs2.next()) {
@ -1586,10 +1574,9 @@ public class StdTextProductDao extends CoreDao {
* *
* PDL: Read the version that matches the input Return * PDL: Read the version that matches the input Return
* *
* Note: The MAX function was used just in case createTimes are same. Since * Note: The MAX function was used just in case refTimes are same. Since the
* the product createTime is the UNIX time which has the unit of * product refTime is the UNIX time which has the unit of microseconds, it
* microseconds, it is assumed there should not have two products with the * is assumed there should not have two products with the same createTim
* same createTim
* ==================================================================== * ====================================================================
*/ */
public int readLatest(String wmoId, String site, String cccId, public int readLatest(String wmoId, String site, String cccId,
@ -1601,12 +1588,12 @@ public class StdTextProductDao extends CoreDao {
ResultSet rs1 = null; ResultSet rs1 = null;
ResultSet rs2 = null; ResultSet rs2 = null;
int version = -1; int version = -1;
final String query1 = "SELECT MAX(createTime) " final String query1 = "SELECT MAX(refTime) "
+ "FROM stdTextProducts " + "FROM stdTextProducts "
+ "WHERE wmoId = ? AND site = ? AND cccId = ? AND nnnId = ? AND xxxId = ? AND hdrTime = ?"; + "WHERE wmoId = ? AND site = ? AND cccId = ? AND nnnId = ? AND xxxId = ? AND hdrTime = ?";
final String query2 = "SELECT MAX(version) " final String query2 = "SELECT MAX(version) "
+ "FROM stdTextProducts " + "FROM stdTextProducts "
+ "WHERE wmoId = ? AND site = ? AND cccId = ? AND nnnId = ? AND xxxId = ? AND hdrTime = ? AND createTime = ?"; + "WHERE wmoId = ? AND site = ? AND cccId = ? AND nnnId = ? AND xxxId = ? AND hdrTime = ? AND refTime = ?";
try { try {
session = getSession(); session = getSession();
@ -1621,7 +1608,7 @@ public class StdTextProductDao extends CoreDao {
rs1 = ps1.executeQuery(); rs1 = ps1.executeQuery();
if (rs1.next()) { if (rs1.next()) {
int createTime = rs1.getInt("createTime"); int refTime = rs1.getInt("refTime");
ps2 = c.prepareStatement(query2); ps2 = c.prepareStatement(query2);
ps2.setString(1, wmoId); ps2.setString(1, wmoId);
ps2.setString(2, site); ps2.setString(2, site);
@ -1629,7 +1616,7 @@ public class StdTextProductDao extends CoreDao {
ps2.setString(4, nnnId); ps2.setString(4, nnnId);
ps2.setString(5, xxxId); ps2.setString(5, xxxId);
ps2.setString(6, hdrTime); ps2.setString(6, hdrTime);
ps2.setInt(7, createTime); ps2.setInt(7, refTime);
rs2 = ps2.executeQuery(); rs2 = ps2.executeQuery();
if (rs2.next()) { if (rs2.next()) {
@ -1696,10 +1683,10 @@ public class StdTextProductDao extends CoreDao {
final String abbrIdQuery = "SELECT DISTINCT nnnId, xxxId " final String abbrIdQuery = "SELECT DISTINCT nnnId, xxxId "
+ "FROM stdTextProducts " + "FROM stdTextProducts "
+ "WHERE wmoId = ? AND site = ? ORDER BY nnnId ASC, xxxId ASC"; + "WHERE wmoId = ? AND site = ? ORDER BY nnnId ASC, xxxId ASC";
final String hdrQuery = "SELECT DISTINCT cccId, hdrTime, bbbId, version, createTime " final String hdrQuery = "SELECT DISTINCT cccId, hdrTime, bbbId, version, refTime "
+ "FROM stdTextProducts " + "FROM stdTextProducts "
+ "WHERE wmoId = ? AND site = ? AND nnnId = ? AND xxxId = ? " + "WHERE wmoId = ? AND site = ? AND nnnId = ? AND xxxId = ? "
+ "ORDER by cccId ASC, createTime DESC"; + "ORDER by cccId ASC, refTime DESC, insertTime DESC";
try { try {
session = getSession(); session = getSession();
@ -1767,10 +1754,12 @@ public class StdTextProductDao extends CoreDao {
bbbId = rs2.getString("bbbId"); bbbId = rs2.getString("bbbId");
version = rs2.getInt("version"); version = rs2.getInt("version");
if (bbbId == null || bbbId.length() > 0) if (bbbId == null || bbbId.length() > 0) {
bbbId = "-"; bbbId = "-";
if (cccId == null) }
if (cccId == null) {
cccId = ""; cccId = "";
}
retVal.add(generateHeader(wmoId, site, hdrTime, bbbId, retVal.add(generateHeader(wmoId, site, hdrTime, bbbId,
cccId, nnnId, xxxId)); cccId, nnnId, xxxId));
@ -1821,7 +1810,7 @@ public class StdTextProductDao extends CoreDao {
*/ */
public List<String> read_wsh(String wmoId, String site, long startTimeMillis) { public List<String> read_wsh(String wmoId, String site, long startTimeMillis) {
return read_wsh(wmoId, site, return read_wsh(wmoId, site,
(int) (Math.round(startTimeMillis / (float) MILLIS_PER_SECOND))); (Math.round(startTimeMillis / (float) MILLIS_PER_SECOND)));
} }
/* /*
@ -1844,8 +1833,8 @@ public class StdTextProductDao extends CoreDao {
ResultSet rs1 = null; ResultSet rs1 = null;
String product = null; String product = null;
final String query = "SELECT product FROM stdTextProducts " final String query = "SELECT product FROM stdTextProducts "
+ "WHERE wmoId = ? site = ? AND createTime >= ? " + "WHERE wmoId = ? site = ? AND refTime >= ? "
+ "ORDER BY createTime DESC"; + "ORDER BY refTime DESC, insertTime DESC";
List<String> retVal = new ArrayList<String>(); List<String> retVal = new ArrayList<String>();
try { try {
@ -1903,7 +1892,7 @@ public class StdTextProductDao extends CoreDao {
final String hdrQuery = "SELECT cccId, nnnId, xxxId, hdrTime, bbbId, version " final String hdrQuery = "SELECT cccId, nnnId, xxxId, hdrTime, bbbId, version "
+ "FROM stdTextProducts " + "FROM stdTextProducts "
+ "WHERE wmoId = ? AND site = ? " + "WHERE wmoId = ? AND site = ? "
+ "ORDER BY cccId ASC, nnnId ASC, xxxId ASC, createTime DESC"; + "ORDER BY cccId ASC, nnnId ASC, xxxId ASC, refTime DESC, insertTime DESC";
List<String> retVal = new ArrayList<String>(); List<String> retVal = new ArrayList<String>();
try { try {
@ -1922,14 +1911,18 @@ public class StdTextProductDao extends CoreDao {
bbbId = rs1.getString("bbbId"); bbbId = rs1.getString("bbbId");
version = rs1.getInt("version"); version = rs1.getInt("version");
if (bbbId == null || bbbId.length() > 0) if (bbbId == null || bbbId.length() > 0) {
bbbId = "-"; bbbId = "-";
if (cccId == null) }
if (cccId == null) {
cccId = ""; cccId = "";
if (nnnId == null || nnnId.length() > 0) }
if (nnnId == null || nnnId.length() > 0) {
nnnId = "-"; nnnId = "-";
if (xxxId == null) }
if (xxxId == null) {
xxxId = ""; xxxId = "";
}
retVal.add(generateHeader(wmoId, site, hdrTime, bbbId, cccId, retVal.add(generateHeader(wmoId, site, hdrTime, bbbId, cccId,
nnnId, xxxId)); nnnId, xxxId));
@ -1990,7 +1983,7 @@ public class StdTextProductDao extends CoreDao {
final String hdrQuery = "SELECT cccId, hdrTime, bbbId, version " final String hdrQuery = "SELECT cccId, hdrTime, bbbId, version "
+ "FROM stdTextProducts " + "FROM stdTextProducts "
+ "WHERE wmoId = ? AND site = ? AND nnnId = ? AND xxxId = ? " + "WHERE wmoId = ? AND site = ? AND nnnId = ? AND xxxId = ? "
+ "ORDER BY cccId ASC, createTime DESC"; + "ORDER BY cccId ASC, refTime DESC, insertTime DESC";
try { try {
session = getSession(); session = getSession();
@ -2008,10 +2001,12 @@ public class StdTextProductDao extends CoreDao {
bbbId = rs1.getString("bbbId"); bbbId = rs1.getString("bbbId");
version = rs1.getInt("version"); version = rs1.getInt("version");
if (bbbId == null || bbbId.length() > 0) if (bbbId == null || bbbId.length() > 0) {
bbbId = "-"; bbbId = "-";
if (cccId == null) }
if (cccId == null) {
cccId = ""; cccId = "";
}
retVal.add(generateHeader(wmoId, site, hdrTime, bbbId, retVal.add(generateHeader(wmoId, site, hdrTime, bbbId,
cccId, nnnId, xxxId)); cccId, nnnId, xxxId));
@ -2076,12 +2071,12 @@ public class StdTextProductDao extends CoreDao {
final String hdrQuery = "SELECT cccId, hdrTime, bbbId, version " final String hdrQuery = "SELECT cccId, hdrTime, bbbId, version "
+ "FROM stdTextProducts " + "FROM stdTextProducts "
+ "WHERE wmoId = ? AND site = ? AND nnnId = ? AND xxxId = ? " + "WHERE wmoId = ? AND site = ? AND nnnId = ? AND xxxId = ? "
+ "ORDER BY cccId ASC, createTime DESC"; + "ORDER BY cccId ASC, refTime DESC, insertTime DESC";
final String noXxxQuery = "SELECT cccId, xxxId hdrTime, bbbId, version " final String noXxxQuery = "SELECT cccId, xxxId hdrTime, bbbId, version "
+ "FROM stdTextProducts " + "FROM stdTextProducts "
+ "WHERE wmoId = ? AND site = ? AND nnnId = ? " + "WHERE wmoId = ? AND site = ? AND nnnId = ? "
+ "ORDER BY cccId ASC, xxxId ASC, createTime DESC"; + "ORDER BY cccId ASC, xxxId ASC, refTime DESC, insertTime DESC";
if (abbrId.length() > 3) { if (abbrId.length() > 3) {
xxxId = abbrId.substring(3); xxxId = abbrId.substring(3);
@ -2115,10 +2110,12 @@ public class StdTextProductDao extends CoreDao {
xxxId = rs1.getString("xxxId"); xxxId = rs1.getString("xxxId");
} }
if (bbbId == null || bbbId.length() > 0) if (bbbId == null || bbbId.length() > 0) {
bbbId = "-"; bbbId = "-";
if (cccId == null) }
if (cccId == null) {
cccId = ""; cccId = "";
}
retVal.add(generateHeader(wmoId, site, hdrTime, bbbId, retVal.add(generateHeader(wmoId, site, hdrTime, bbbId,
cccId, nnnId, xxxId)); cccId, nnnId, xxxId));
@ -2184,7 +2181,7 @@ public class StdTextProductDao extends CoreDao {
final String hdrQuery = "SELECT cccId, bbbId, version " final String hdrQuery = "SELECT cccId, bbbId, version "
+ "FROM stdTextProducts " + "FROM stdTextProducts "
+ "WHERE wmoId = ? AND site = ? AND nnnId = ? AND xxxId = ? AND hdrTime = ?" + "WHERE wmoId = ? AND site = ? AND nnnId = ? AND xxxId = ? AND hdrTime = ?"
+ "ORDER BY cccId ASC, createTime DESC, version DESC"; + "ORDER BY cccId ASC, refTime DESC, insertTime DESC, version DESC";
try { try {
session = getSession(); session = getSession();
@ -2204,15 +2201,17 @@ public class StdTextProductDao extends CoreDao {
bbbId = rs1.getString("bbbId"); bbbId = rs1.getString("bbbId");
version = rs1.getInt("version"); version = rs1.getInt("version");
if (bbbId == null || bbbId.length() > 0) if (bbbId == null || bbbId.length() > 0) {
bbbId = "-"; bbbId = "-";
if (cccId == null) }
if (cccId == null) {
cccId = ""; cccId = "";
}
String hdr = generateHeader(wmoId, site, hdrTime, bbbId, String hdr = generateHeader(wmoId, site, hdrTime, bbbId,
cccId, nnnId, xxxId); cccId, nnnId, xxxId);
// order by ensures MAX(createTime) and MAX(version) is // order by ensures MAX(refTime) and MAX(version) is
// loaded first // loaded first
if (retVal.size() > 0) { if (retVal.size() > 0) {
if (!retVal.get(retVal.size() - 1).equals(hdr)) { if (!retVal.get(retVal.size() - 1).equals(hdr)) {
@ -2279,7 +2278,7 @@ public class StdTextProductDao extends CoreDao {
final String hdrQuery = "SELECT cccId, version " final String hdrQuery = "SELECT cccId, version "
+ "FROM stdTextProducts " + "FROM stdTextProducts "
+ "WHERE wmoId = ? AND site = ? AND nnnId = ? AND xxxId = ? AND hdrTime = ? AND bbbId = ? " + "WHERE wmoId = ? AND site = ? AND nnnId = ? AND xxxId = ? AND hdrTime = ? AND bbbId = ? "
+ "ORDER BY cccId ASC, createTime DESC, version DESC"; + "ORDER BY cccId ASC, refTime DESC, insertTime DESC, version DESC";
try { try {
session = getSession(); session = getSession();
@ -2299,13 +2298,14 @@ public class StdTextProductDao extends CoreDao {
cccId = rs1.getString("cccId"); cccId = rs1.getString("cccId");
version = rs1.getInt("version"); version = rs1.getInt("version");
if (cccId == null) if (cccId == null) {
cccId = ""; cccId = "";
}
String hdr = generateHeader(wmoId, site, hdrTime, bbbId, String hdr = generateHeader(wmoId, site, hdrTime, bbbId,
cccId, nnnId, xxxId); cccId, nnnId, xxxId);
// order by ensures MAX(createTime) and MAX(version) is // order by ensures MAX(refTime) and MAX(version) is
// loaded first // loaded first
if (retVal.size() > 0) { if (retVal.size() > 0) {
if (!retVal.get(retVal.size() - 1).equals(hdr)) { if (!retVal.get(retVal.size() - 1).equals(hdr)) {
@ -2390,7 +2390,7 @@ public class StdTextProductDao extends CoreDao {
final String hdrQuery = "SELECT cccId, nnnId, xxxId, bbbId, version " final String hdrQuery = "SELECT cccId, nnnId, xxxId, bbbId, version "
+ "FROM stdTextProducts " + "FROM stdTextProducts "
+ "WHERE wmoId = ? AND site = ? AND hdrTime = ? AND cccId IS NOT NULL AND nnnId IS NOT NULL AND xxxId IS NOT NULL " + "WHERE wmoId = ? AND site = ? AND hdrTime = ? AND cccId IS NOT NULL AND nnnId IS NOT NULL AND xxxId IS NOT NULL "
+ "ORDER BY cccId ASC, nnnId ASC, xxxId ASC, bbbId DESC, createTime DESC, version DESC"; + "ORDER BY cccId ASC, nnnId ASC, xxxId ASC, bbbId DESC, refTime DESC, insertTime DESC, version DESC";
ps1 = c.prepareStatement(hdrQuery); ps1 = c.prepareStatement(hdrQuery);
break; break;
} }
@ -2398,7 +2398,7 @@ public class StdTextProductDao extends CoreDao {
final String hdrQuery = "SELECT version " final String hdrQuery = "SELECT version "
+ "FROM stdTextProducts " + "FROM stdTextProducts "
+ "WHERE wmoId = ? AND site = ? AND hdrTime = ? AND cccId = 'NOA' AND nnnId = 'FOS' AND xxxId = 'PIL' " + "WHERE wmoId = ? AND site = ? AND hdrTime = ? AND cccId = 'NOA' AND nnnId = 'FOS' AND xxxId = 'PIL' "
+ "ORDER BY createTime DESC, version DESC"; + "ORDER BY refTime DESC, insertTime DESC, version DESC";
ps1 = c.prepareStatement(hdrQuery); ps1 = c.prepareStatement(hdrQuery);
break; break;
} }
@ -2406,7 +2406,7 @@ public class StdTextProductDao extends CoreDao {
final String hdrQuery = "SELECT version " final String hdrQuery = "SELECT version "
+ "FROM stdTextProducts " + "FROM stdTextProducts "
+ "WHERE wmoId = ? AND site = ? AND hdrTime = ? AND cccId = 'NOA' AND nnnId = 'FOS' AND xxxId = 'PIL' " + "WHERE wmoId = ? AND site = ? AND hdrTime = ? AND cccId = 'NOA' AND nnnId = 'FOS' AND xxxId = 'PIL' "
+ "ORDER BY createTime DESC, version DESC"; + "ORDER BY refTime DESC, insertTime DESC, version DESC";
ps1 = c.prepareStatement(hdrQuery); ps1 = c.prepareStatement(hdrQuery);
break; break;
} }
@ -2440,7 +2440,7 @@ public class StdTextProductDao extends CoreDao {
String hdr = generateHeader(wmoId, site, hdrTime, bbbId, cccId, String hdr = generateHeader(wmoId, site, hdrTime, bbbId, cccId,
nnnId, xxxId); nnnId, xxxId);
// order by ensures MAX(createTime) and MAX(version) is // order by ensures MAX(refTime) and MAX(version) is
// loaded first // loaded first
if (retVal.size() > 0) { if (retVal.size() > 0) {
if (!retVal.get(retVal.size() - 1).equals(hdr)) { if (!retVal.get(retVal.size() - 1).equals(hdr)) {
@ -2514,7 +2514,7 @@ public class StdTextProductDao extends CoreDao {
final String hdrQuery = "SELECT cccId, nnnId, xxxId, version " final String hdrQuery = "SELECT cccId, nnnId, xxxId, version "
+ "FROM stdTextProducts " + "FROM stdTextProducts "
+ "WHERE wmoId = ? AND site = ? AND hdrTime = ? AND bbbId = ? AND cccId IS NOT NULL AND nnnId IS NOT NULL AND xxxId IS NOT NULL " + "WHERE wmoId = ? AND site = ? AND hdrTime = ? AND bbbId = ? AND cccId IS NOT NULL AND nnnId IS NOT NULL AND xxxId IS NOT NULL "
+ "ORDER BY cccId ASC, nnnId ASC, xxxId ASC, createTime DESC"; + "ORDER BY cccId ASC, nnnId ASC, xxxId ASC, refTime DESC, insertTime DESC";
ps1 = c.prepareStatement(hdrQuery); ps1 = c.prepareStatement(hdrQuery);
break; break;
} }
@ -2522,7 +2522,7 @@ public class StdTextProductDao extends CoreDao {
final String hdrQuery = "SELECT version " final String hdrQuery = "SELECT version "
+ "FROM stdTextProducts " + "FROM stdTextProducts "
+ "WHERE wmoId = ? AND site = ? AND hdrTime = ? AND bbbId = ? AND cccId = 'NOA' AND nnnId = 'FOS' AND xxxId = 'PIL' " + "WHERE wmoId = ? AND site = ? AND hdrTime = ? AND bbbId = ? AND cccId = 'NOA' AND nnnId = 'FOS' AND xxxId = 'PIL' "
+ "ORDER BY createTime DESC"; + "ORDER BY refTime DESC, insertTime DESC";
ps1 = c.prepareStatement(hdrQuery); ps1 = c.prepareStatement(hdrQuery);
break; break;
} }
@ -2530,7 +2530,7 @@ public class StdTextProductDao extends CoreDao {
final String hdrQuery = "SELECT version " final String hdrQuery = "SELECT version "
+ "FROM stdTextProducts " + "FROM stdTextProducts "
+ "WHERE wmoId = ? AND site = ? AND hdrTime = ? AND bbbId = ? AND cccId = 'NOA' AND nnnId = 'FOS' AND xxxId = 'PIL' " + "WHERE wmoId = ? AND site = ? AND hdrTime = ? AND bbbId = ? AND cccId = 'NOA' AND nnnId = 'FOS' AND xxxId = 'PIL' "
+ "ORDER BY createTime DESC"; + "ORDER BY refTime DESC, insertTime DESC";
ps1 = c.prepareStatement(hdrQuery); ps1 = c.prepareStatement(hdrQuery);
break; break;
} }
@ -2560,7 +2560,7 @@ public class StdTextProductDao extends CoreDao {
String hdr = generateHeader(wmoId, site, hdrTime, bbbId, cccId, String hdr = generateHeader(wmoId, site, hdrTime, bbbId, cccId,
nnnId, xxxId); nnnId, xxxId);
// order by ensures MAX(createTime) and MAX(version) is // order by ensures MAX(refTime) and MAX(version) is
// loaded first // loaded first
if (retVal.size() > 0) { if (retVal.size() > 0) {
if (!retVal.get(retVal.size() - 1).equals(hdr)) { if (!retVal.get(retVal.size() - 1).equals(hdr)) {
@ -2769,7 +2769,7 @@ public class StdTextProductDao extends CoreDao {
public static final void main(String[] args) { public static final void main(String[] args) {
long time = System.currentTimeMillis() / 1000L; long time = System.currentTimeMillis() / 1000L;
final String TM_QUERY_FMT = "delete from table_name where createtime < %d;"; final String TM_QUERY_FMT = "delete from table_name where refTime < %d;";
Matcher m = Pattern.compile("table_name").matcher(TM_QUERY_FMT); Matcher m = Pattern.compile("table_name").matcher(TM_QUERY_FMT);
String tempQuery = m.replaceAll(TM_QUERY_FMT); String tempQuery = m.replaceAll(TM_QUERY_FMT);

View file

@ -50,6 +50,7 @@ import com.raytheon.uf.common.message.Header;
import com.raytheon.uf.common.serialization.SerializationUtil; import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.site.SiteMap; import com.raytheon.uf.common.site.SiteMap;
import com.raytheon.uf.edex.core.props.PropertiesFactory; import com.raytheon.uf.edex.core.props.PropertiesFactory;
import com.raytheon.uf.edex.decodertools.time.TimeTools;
import com.raytheon.uf.edex.wmo.message.AFOSProductId; import com.raytheon.uf.edex.wmo.message.AFOSProductId;
import com.raytheon.uf.edex.wmo.message.WMOHeader; import com.raytheon.uf.edex.wmo.message.WMOHeader;
@ -808,9 +809,11 @@ public class TextDB {
StdTextProductDao dao = new StdTextProductDao(operationalMode); StdTextProductDao dao = new StdTextProductDao(operationalMode);
boolean success = false; boolean success = false;
try { try {
if (textProduct.getCreatetime() == null) { if (textProduct.getRefTime() == null) {
textProduct.setCreatetime(System.currentTimeMillis()); textProduct.setRefTime(System.currentTimeMillis());
} }
textProduct.setInsertTime(Calendar.getInstance(TimeZone
.getTimeZone("GMT")));
success = dao.write(textProduct); success = dao.write(textProduct);
} catch (Exception e) { } catch (Exception e) {
logger.error(e); logger.error(e);
@ -866,7 +869,13 @@ public class TextDB {
} }
product.append(reportData); product.append(reportData);
long writeTime = System.currentTimeMillis();
Long writeTime = new Long(System.currentTimeMillis());
if (TimeTools.allowArchive()) {
Calendar c = header.getHeaderDate();
writeTime = new Long(c.getTimeInMillis());
}
StdTextProduct textProduct = (operationalMode ? new OperationalStdTextProduct() StdTextProduct textProduct = (operationalMode ? new OperationalStdTextProduct()
: new PracticeStdTextProduct()); : new PracticeStdTextProduct());
@ -877,7 +886,7 @@ public class TextDB {
textProduct.setNnnid(prodId.getNnn()); textProduct.setNnnid(prodId.getNnn());
textProduct.setHdrtime(hdrTime); textProduct.setHdrtime(hdrTime);
textProduct.setBbbid(bbbIndicator); textProduct.setBbbid(bbbIndicator);
textProduct.setCreatetime(writeTime); textProduct.setRefTime(writeTime);
textProduct.setProduct(product.toString()); textProduct.setProduct(product.toString());
boolean success = writeProduct(textProduct); boolean success = writeProduct(textProduct);
if (success) { if (success) {
@ -958,8 +967,9 @@ public class TextDB {
boolean operationalMode, Headers headers) { boolean operationalMode, Headers headers) {
// Look for a WMO heading on the first line // Look for a WMO heading on the first line
String[] pieces = reportData.split("\r*\n", 2); String[] pieces = reportData.split("\r*\n", 2);
if (pieces.length > 1) if (pieces.length > 1) {
pieces[0] += "\n"; // WMOHeader expects this pieces[0] += "\n"; // WMOHeader expects this
}
WMOHeader header = new WMOHeader(pieces[0].getBytes(), headers); WMOHeader header = new WMOHeader(pieces[0].getBytes(), headers);
// Need to construct an AFOSProductId from the productId // Need to construct an AFOSProductId from the productId

View file

@ -19,6 +19,10 @@
**/ **/
package com.raytheon.uf.common.dataplugin.airep; package com.raytheon.uf.common.dataplugin.airep;
import java.math.RoundingMode;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
@ -62,6 +66,8 @@ import com.vividsolutions.jts.geom.Geometry;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 20080103 384 jkorman Initial Coding. * 20080103 384 jkorman Initial Coding.
* 20080107 720 jkorman remove default assignments from attributes. * 20080107 720 jkorman remove default assignments from attributes.
* 20120405 435 dgilling Prevent NullPointerExceptions in
* buildMessageData().
* </pre> * </pre>
* *
* @author jkorman * @author jkorman
@ -82,17 +88,19 @@ public class AirepRecord extends PluginDataObject implements ISpatialEnabled,
public static final Unit<Velocity> WIND_SPEED_UNIT = NonSI.KNOT; public static final Unit<Velocity> WIND_SPEED_UNIT = NonSI.KNOT;
public static final Unit<Angle> WIND_DIR_UNIT = NonSI.DEGREE_ANGLE; public static final Unit<Angle> WIND_DIR_UNIT = NonSI.DEGREE_ANGLE;
public static final Unit<Length> ALTITUDE_UNIT = NonSI.FOOT; public static final Unit<Length> ALTITUDE_UNIT = NonSI.FOOT;
public static final Unit<Angle> LOCATION_UNIT = NonSI.DEGREE_ANGLE; public static final Unit<Angle> LOCATION_UNIT = NonSI.DEGREE_ANGLE;
private static UnitConverter ftToHft = NonSI.FOOT.getConverterTo(SI.HECTO(NonSI.FOOT)); private static UnitConverter ftToHft = NonSI.FOOT.getConverterTo(SI
.HECTO(NonSI.FOOT));
private static final HashMap<String, String> PARM_MAP = new HashMap<String, String>(); private static final HashMap<String, String> PARM_MAP = new HashMap<String, String>();
//private static final HashMap<Integer, String> WX_MAP = new HashMap<Integer, String>(); // private static final HashMap<Integer, String> WX_MAP = new
// HashMap<Integer, String>();
static { static {
PARM_MAP.put("T", SFC_TEMP); PARM_MAP.put("T", SFC_TEMP);
PARM_MAP.put("WS", SFC_WNDSPD); PARM_MAP.put("WS", SFC_WNDSPD);
@ -100,17 +108,17 @@ public class AirepRecord extends PluginDataObject implements ISpatialEnabled,
PARM_MAP.put("NLAT", STA_LAT); PARM_MAP.put("NLAT", STA_LAT);
PARM_MAP.put("NLON", STA_LON); PARM_MAP.put("NLON", STA_LON);
PARM_MAP.put("FLT_LVL", UA_FLTLVL); PARM_MAP.put("FLT_LVL", UA_FLTLVL);
// WX_MAP.put(0, "CLR"); // WX_MAP.put(0, "CLR");
// WX_MAP.put(1, "SCT"); // WX_MAP.put(1, "SCT");
// WX_MAP.put(2, "BKN"); // WX_MAP.put(2, "BKN");
// WX_MAP.put(3, "CONT"); // WX_MAP.put(3, "CONT");
// WX_MAP.put(4, "LIGHTNING"); // WX_MAP.put(4, "LIGHTNING");
// WX_MAP.put(5, "DZRA"); // WX_MAP.put(5, "DZRA");
// WX_MAP.put(6, "CONT RA"); // WX_MAP.put(6, "CONT RA");
// WX_MAP.put(7, "CONT SN"); // WX_MAP.put(7, "CONT SN");
// WX_MAP.put(8, "SH"); // WX_MAP.put(8, "SH");
// WX_MAP.put(9, "TSRA"); // WX_MAP.put(9, "TSRA");
} }
@Column @Column
@ -130,7 +138,7 @@ public class AirepRecord extends PluginDataObject implements ISpatialEnabled,
@XmlAttribute @XmlAttribute
private Calendar refHour; private Calendar refHour;
// //
@DataURI(position = 1) @DataURI(position = 1)
@Column @Column
@DynamicSerializeElement @DynamicSerializeElement
@ -523,7 +531,7 @@ public class AirepRecord extends PluginDataObject implements ISpatialEnabled,
a = new Amount(this.getLongitude(), LOCATION_UNIT); a = new Amount(this.getLongitude(), LOCATION_UNIT);
} else if (UA_FLTLVL.equals(pName) && getFlightLevel() != null) { } else if (UA_FLTLVL.equals(pName) && getFlightLevel() != null) {
a = new Amount(this.getFlightLevel().intValue(), ALTITUDE_UNIT); a = new Amount(this.getFlightLevel().intValue(), ALTITUDE_UNIT);
} }
return a; return a;
} }
@ -543,8 +551,8 @@ public class AirepRecord extends PluginDataObject implements ISpatialEnabled,
@Override @Override
public String[] getStrings(String paramName) { public String[] getStrings(String paramName) {
if ("FLT_HZD".matches(paramName) && flightHazard != null) { if ("FLT_HZD".matches(paramName) && flightHazard != null) {
String[] flightHazards = {flightHazard.toString()}; String[] flightHazards = { flightHazard.toString() };
return flightHazards; return flightHazards;
} }
return null; return null;
@ -561,78 +569,89 @@ public class AirepRecord extends PluginDataObject implements ISpatialEnabled,
public void setLocation(AircraftObsLocation location) { public void setLocation(AircraftObsLocation location) {
this.location = location; this.location = location;
} }
@Override @Override
public String getMessageData() { public String getMessageData() {
return getReportData(); return getReportData();
} }
private String buildMessageData(){ private String buildMessageData() {
String s = ""; boolean validLocation = (location != null);
String lat = String.valueOf(location.getLatitude()); StringBuilder messageData = new StringBuilder("ARP ");
String lon = String.valueOf(location.getLongitude()); if (validLocation && getStationId() != null) {
String latDir = location.getLatitude() > 0 ? "N" : "S"; messageData.append(getStationId());
String lonDir = location.getLongitude() > 0 ? "E" : "W";
String hour = "";
String minute = "";
if(timeObs != null){
hour = String.valueOf(timeObs.get(Calendar.HOUR_OF_DAY));
minute = String.valueOf(timeObs.get(Calendar.MINUTE));
} }
String flightLevel = String.valueOf((int)ftToHft.convert(location.getFlightLevel())); messageData.append(' ');
String wind = windDirection != null?
String.valueOf(windDirection.intValue()) + "/" if ((validLocation) && (!Double.isNaN(getLatitude()))
+ String.valueOf(windSpeed.intValue()) + "KT": ""; && (!Double.isNaN(getLongitude()))) {
//String wx = flightWeather != null? WX_MAP.get(flightWeather) : ""; messageData.append(formatLatLon(getLatitude(), true));
lat = formatLatLon(lat); messageData.append(' ');
lon = formatLatLon(lon); messageData.append(formatLatLon(getLongitude(), false));
String temperature = ""; messageData.append(' ');
}
if (timeObs != null) {
DateFormat df = new SimpleDateFormat("HHmm");
messageData.append(df.format(timeObs.getTime()));
}
messageData.append(" F");
if (validLocation && getFlightLevel() != null) {
int flightLevel = (int) ftToHft.convert(getFlightLevel());
messageData.append(flightLevel);
}
messageData.append(' ');
if (temp != null) { if (temp != null) {
if (temp > 0) { if (temp > 0) {
temperature = "P" + temp.intValue(); messageData.append('P');
} else { } else {
temperature = "M" + String.valueOf(temp.intValue()).substring(1); messageData.append('M');
} }
messageData.append(Math.abs(temp.intValue()));
} }
if (hour.length() < 2) { messageData.append(' ');
hour = "0" + hour;
if ((windDirection != null) && (windSpeed != null)) {
messageData.append(windDirection.intValue());
messageData.append('/');
messageData.append(windSpeed.intValue());
messageData.append("KT");
} }
if (minute.length() < 2) { messageData.append("TB");
minute = "0" + minute;
} return messageData.toString();
s = "ARP " + location.getStationId() + " "
+ lat + latDir + " " + lon + lonDir + " "
+ hour + minute + " F" + flightLevel
+ " " + temperature + " " + wind
+ "TB";
return s;
} }
private String formatLatLon(String str){ private String formatLatLon(double value, boolean isLatitude) {
str = str.startsWith("-")? str.substring(1) : str; char dir;
if (isLatitude) {
int decimalIndex = str.indexOf("."); if (value > 0) {
dir = 'N';
if(decimalIndex != -1){ } else {
String temp = str.substring(decimalIndex + 1); dir = 'S';
if(temp.length() > 3){ }
temp = temp.substring(0, 3); } else {
} else if (temp.length() != 3) { if (value > 0) {
while(temp.length() != 3){ dir = 'E';
temp += "0"; } else {
} dir = 'W';
} }
str = str.substring(0,decimalIndex) + temp;
} }
return str; DecimalFormat df = new DecimalFormat("###.000");
df.setRoundingMode(RoundingMode.DOWN);
return df.format(Math.abs(value)) + dir;
} }
/** /**
* Returns the hashCode for this object. This implementation * Returns the hashCode for this object. This implementation returns the
* returns the hashCode of the generated dataURI. * hashCode of the generated dataURI.
*
* @see java.lang.Object#hashCode() * @see java.lang.Object#hashCode()
*/ */
@Override @Override
@ -645,26 +664,31 @@ public class AirepRecord extends PluginDataObject implements ISpatialEnabled,
} }
/** /**
* Checks if this record is equal to another by checking the * Checks if this record is equal to another by checking the generated
* generated dataURI. * dataURI.
* @param obj *
* @param obj
* @see java.lang.Object#equals(java.lang.Object) * @see java.lang.Object#equals(java.lang.Object)
*/ */
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) if (this == obj) {
return true; return true;
if (obj == null) }
if (obj == null) {
return false; return false;
if (getClass() != obj.getClass()) }
if (getClass() != obj.getClass()) {
return false; return false;
}
AirepRecord other = (AirepRecord) obj; AirepRecord other = (AirepRecord) obj;
if (getDataURI() == null) { if (getDataURI() == null) {
if (other.getDataURI() != null) { if (other.getDataURI() != null) {
return false; return false;
} }
} else if (!getDataURI().equals(other.getDataURI())) } else if (!getDataURI().equals(other.getDataURI())) {
return false; return false;
}
return true; return true;
} }

View file

@ -20,8 +20,6 @@
package com.raytheon.uf.common.dataplugin.binlightning; package com.raytheon.uf.common.dataplugin.binlightning;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
@ -37,7 +35,7 @@ import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.annotations.DataURI; import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.binlightning.impl.LightningStrikePoint; import com.raytheon.uf.common.dataplugin.binlightning.impl.LightningStrikePoint;
import com.raytheon.uf.common.dataplugin.persist.IPersistable; import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject; import com.raytheon.uf.common.dataplugin.persist.ServerSpecificPersistablePluginDataObject;
import com.raytheon.uf.common.datastorage.IDataStore; import com.raytheon.uf.common.datastorage.IDataStore;
import com.raytheon.uf.common.datastorage.StorageException; import com.raytheon.uf.common.datastorage.StorageException;
import com.raytheon.uf.common.datastorage.records.ByteDataRecord; import com.raytheon.uf.common.datastorage.records.ByteDataRecord;
@ -80,8 +78,8 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools;
@XmlRootElement @XmlRootElement
@DynamicSerialize @DynamicSerialize
@XmlAccessorType(XmlAccessType.NONE) @XmlAccessorType(XmlAccessType.NONE)
public class BinLightningRecord extends PersistablePluginDataObject implements public class BinLightningRecord extends
IPersistable { ServerSpecificPersistablePluginDataObject implements IPersistable {
/** Serializable id * */ /** Serializable id * */
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -187,33 +185,6 @@ public class BinLightningRecord extends PersistablePluginDataObject implements
// super(message); // super(message);
// } // }
/**
* Get the time to use for persisting this data.
*
* @return The persistence time for this data. Returns null if either start
* or stop time are not valid.
*/
@Override
public Date getPersistenceTime() {
Calendar c = getInsertTime();
if (c == null)
return null;
return c.getTime();
}
/**
* Set the time to be used for the persistence time for this object.
*
* @param persistTime
* The persistence time to be used.
*/
public void setPersistenceTime(Date persistTime) {
Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
c.setTime(persistTime);
setInsertTime(c);
}
/** /**
* Track the current persistence time for the data set. * Track the current persistence time for the data set.
*/ */
@ -239,8 +210,8 @@ public class BinLightningRecord extends PersistablePluginDataObject implements
if (insertIndex < obsTimes.length) { if (insertIndex < obsTimes.length) {
long t1 = startTimeMillis; long t1 = startTimeMillis;
Calendar c = TimeTools.getBaseCalendar(strike.getYear(), strike Calendar c = TimeTools.getBaseCalendar(strike.getYear(),
.getMonth(), strike.getDay()); strike.getMonth(), strike.getDay());
c.set(Calendar.HOUR_OF_DAY, strike.getHour()); c.set(Calendar.HOUR_OF_DAY, strike.getHour());
c.set(Calendar.MINUTE, strike.getMinute()); c.set(Calendar.MINUTE, strike.getMinute());

View file

@ -68,307 +68,308 @@ import com.vividsolutions.jts.geom.Geometry;
@XmlAccessorType(XmlAccessType.NONE) @XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize @DynamicSerialize
public class AScatObs extends PersistablePluginDataObject implements public class AScatObs extends PersistablePluginDataObject implements
ISpatialEnabled, IDecoderGettable, IPointData, IPersistable { ISpatialEnabled, IDecoderGettable, IPointData, IPersistable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Embedded @Embedded
private PointDataView pdv; @DynamicSerializeElement
private PointDataView pointDataView;
@DataURI(position = 1) @DataURI(position = 1)
@XmlAttribute @XmlAttribute
@DynamicSerializeElement @DynamicSerializeElement
private Integer satId; private Integer satId;
@Embedded @Embedded
@DataURI(position = 2, embedded = true) @DataURI(position = 2, embedded = true)
@XmlElement @XmlElement
@DynamicSerializeElement @DynamicSerializeElement
private SurfaceObsLocation location; private SurfaceObsLocation location;
// Text of the WMO header // Text of the WMO header
@Column(length = 32) @Column(length = 32)
@DynamicSerializeElement @DynamicSerializeElement
@XmlElement @XmlElement
private String wmoHeader; private String wmoHeader;
@XmlAttribute @XmlAttribute
@DynamicSerializeElement @DynamicSerializeElement
@Transient @Transient
private Integer orbitNumber; private Integer orbitNumber;
// The observation time. // The observation time.
@XmlAttribute @XmlAttribute
@DynamicSerializeElement @DynamicSerializeElement
@Transient @Transient
private Calendar validTime; private Calendar validTime;
@XmlAttribute @XmlAttribute
@DynamicSerializeElement @DynamicSerializeElement
@Transient @Transient
private Double windDir; private Double windDir;
@DataURI(position = 3) @DataURI(position = 3)
@XmlAttribute @XmlAttribute
@DynamicSerializeElement @DynamicSerializeElement
private Float windSpd; private Float windSpd;
@XmlAttribute @XmlAttribute
@DynamicSerializeElement @DynamicSerializeElement
@Transient @Transient
private Double probRain; private Double probRain;
@XmlAttribute @XmlAttribute
@DynamicSerializeElement @DynamicSerializeElement
@Transient @Transient
private Integer rainIndex; private Integer rainIndex;
/** /**
* Empty constructor. * Empty constructor.
*/ */
public AScatObs() { public AScatObs() {
} }
/** /**
* Constructor for DataURI construction through base class. This is used by * Constructor for DataURI construction through base class. This is used by
* the notification service. * the notification service.
* *
* @param uri * @param uri
* A data uri applicable to this class. * A data uri applicable to this class.
* @param tableDef * @param tableDef
* The table definitions for this class. * The table definitions for this class.
*/ */
public AScatObs(String uri) { public AScatObs(String uri) {
super(uri); super(uri);
} }
/** /**
* Get this observation's geometry. * Get this observation's geometry.
* *
* @return The geometry for this observation. * @return The geometry for this observation.
*/ */
public Geometry getGeometry() { public Geometry getGeometry() {
return location.getGeometry(); return location.getGeometry();
} }
/** /**
* Get the geometry latitude. * Get the geometry latitude.
* *
* @return The geometry latitude. * @return The geometry latitude.
*/ */
public double getLatitude() { public double getLatitude() {
return location.getLatitude(); return location.getLatitude();
} }
/** /**
* Get the geometry longitude. * Get the geometry longitude.
* *
* @return The geometry longitude. * @return The geometry longitude.
*/ */
public double getLongitude() { public double getLongitude() {
return location.getLongitude(); return location.getLongitude();
} }
/** /**
* Get the elevation, in meters, of the observing platform or location. * Get the elevation, in meters, of the observing platform or location.
* *
* @return The observation elevation, in meters. * @return The observation elevation, in meters.
*/ */
public Integer getElevation() { public Integer getElevation() {
return location.getElevation(); return location.getElevation();
} }
/** /**
* Was this location defined from the station catalog? False if not. * Was this location defined from the station catalog? False if not.
* *
* @return Was this location defined from the station catalog? * @return Was this location defined from the station catalog?
*/ */
public Boolean getLocationDefined() { public Boolean getLocationDefined() {
return location.getLocationDefined(); return location.getLocationDefined();
} }
/** /**
* @return the location * @return the location
*/ */
public SurfaceObsLocation getLocation() { public SurfaceObsLocation getLocation() {
return location; return location;
} }
/** /**
* @param location * @param location
* the location to set * the location to set
*/ */
public void setLocation(SurfaceObsLocation location) { public void setLocation(SurfaceObsLocation location) {
this.location = location; this.location = location;
} }
/** /**
* @return the satId * @return the satId
*/ */
public Integer getSatId() { public Integer getSatId() {
return satId; return satId;
} }
/** /**
* @param satId * @param satId
* the satId to set * the satId to set
*/ */
public void setSatId(Integer satId) { public void setSatId(Integer satId) {
this.satId = satId; this.satId = satId;
} }
/** /**
* @return the orbitNumber * @return the orbitNumber
*/ */
public Integer getOrbitNumber() { public Integer getOrbitNumber() {
return orbitNumber; return orbitNumber;
} }
/** /**
* @param orbitNumber * @param orbitNumber
* the orbitNumber to set * the orbitNumber to set
*/ */
public void setOrbitNumber(Integer orbitNumber) { public void setOrbitNumber(Integer orbitNumber) {
this.orbitNumber = orbitNumber; this.orbitNumber = orbitNumber;
} }
/** /**
* @return the wmoHeader * @return the wmoHeader
*/ */
public String getWmoHeader() { public String getWmoHeader() {
return wmoHeader; return wmoHeader;
} }
/** /**
* @param wmoHeader * @param wmoHeader
* the wmoHeader to set * the wmoHeader to set
*/ */
public void setWmoHeader(String wmoHeader) { public void setWmoHeader(String wmoHeader) {
this.wmoHeader = wmoHeader; this.wmoHeader = wmoHeader;
} }
/** /**
* @return the windDir * @return the windDir
*/ */
public Double getWindDir() { public Double getWindDir() {
return windDir; return windDir;
} }
/** /**
* @param windDir * @param windDir
* the windDir to set * the windDir to set
*/ */
public void setWindDir(Double windDir) { public void setWindDir(Double windDir) {
this.windDir = windDir; this.windDir = windDir;
} }
/** /**
* @return the windSpd * @return the windSpd
*/ */
public Float getWindSpd() { public Float getWindSpd() {
return windSpd; return windSpd;
} }
/** /**
* @param windSpd * @param windSpd
* the windSpd to set * the windSpd to set
*/ */
public void setWindSpd(Float windSpd) { public void setWindSpd(Float windSpd) {
this.windSpd = windSpd; this.windSpd = windSpd;
} }
/** /**
* @return the probRain * @return the probRain
*/ */
public Double getProbRain() { public Double getProbRain() {
return probRain; return probRain;
} }
/** /**
* @param probRain * @param probRain
* the probRain to set * the probRain to set
*/ */
public void setProbRain(Double probRain) { public void setProbRain(Double probRain) {
this.probRain = probRain; this.probRain = probRain;
} }
/** /**
* @return the rainIndex * @return the rainIndex
*/ */
public Integer getRainIndex() { public Integer getRainIndex() {
return rainIndex; return rainIndex;
} }
/** /**
* @param rainIndex * @param rainIndex
* the rainIndex to set * the rainIndex to set
*/ */
public void setRainIndex(Integer rainIndex) { public void setRainIndex(Integer rainIndex) {
this.rainIndex = rainIndex; this.rainIndex = rainIndex;
} }
/** /**
* Get the observation time for this data. * Get the observation time for this data.
* *
* @return The data observation time. * @return The data observation time.
*/ */
public Calendar getValidTime() { public Calendar getValidTime() {
return validTime; return validTime;
} }
/** /**
* Set the observation time for this data. * Set the observation time for this data.
* *
* @param timeObs * @param timeObs
* The data observation time. * The data observation time.
*/ */
public void setValidTime(Calendar time) { public void setValidTime(Calendar time) {
validTime = time; validTime = time;
} }
@Override @Override
public IDecoderGettable getDecoderGettable() { public IDecoderGettable getDecoderGettable() {
return null; return null;
} }
@Override @Override
public ISpatialObject getSpatialObject() { public ISpatialObject getSpatialObject() {
return location; return location;
} }
@Override @Override
public String getString(String paramName) { public String getString(String paramName) {
return null; return null;
} }
@Override @Override
public String[] getStrings(String paramName) { public String[] getStrings(String paramName) {
return null; return null;
} }
@Override @Override
public Amount getValue(String paramName) { public Amount getValue(String paramName) {
return null; return null;
} }
@Override @Override
public Collection<Amount> getValues(String paramName) { public Collection<Amount> getValues(String paramName) {
return null; return null;
} }
/** /**
* *
*/ */
@Override @Override
public PointDataView getPointDataView() { public PointDataView getPointDataView() {
return pdv; return pointDataView;
} }
/** /**
* *
*/ */
@Override @Override
public void setPointDataView(PointDataView pdv) { public void setPointDataView(PointDataView pointDataView) {
this.pdv = pdv; this.pointDataView = pointDataView;
} }
} }

View file

@ -65,211 +65,197 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@XmlAccessorType(XmlAccessType.NONE) @XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize @DynamicSerialize
public class BUFRncwf extends PersistablePluginDataObject implements public class BUFRncwf extends PersistablePluginDataObject implements
ISpatialEnabled, IDecoderGettable, IPointData, IPersistable { ISpatialEnabled, IDecoderGettable, IPointData, IPersistable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Embedded @Embedded
private PointDataView pdv; @DynamicSerializeElement
private PointDataView pointDataView;
@Embedded @Embedded
@DataURI(position = 1, embedded = true) @DataURI(position = 1, embedded = true)
@XmlElement @XmlElement
@DynamicSerializeElement @DynamicSerializeElement
private SurfaceObsLocation location; private SurfaceObsLocation location;
@Transient @Transient
@XmlElement @XmlElement
@DynamicSerializeElement @DynamicSerializeElement
private NCWFFeature detection; private NCWFFeature detection;
@Transient @Transient
@XmlElement @XmlElement
@DynamicSerializeElement @DynamicSerializeElement
private NCWFFeature forecast; private NCWFFeature forecast;
@Transient @Transient
@XmlAttribute @XmlAttribute
@DynamicSerializeElement @DynamicSerializeElement
private Double stormDir; private Double stormDir;
@Transient @Transient
@XmlAttribute @XmlAttribute
@DynamicSerializeElement @DynamicSerializeElement
private Double stormSpeed; private Double stormSpeed;
@Transient @Transient
@XmlAttribute @XmlAttribute
@DynamicSerializeElement @DynamicSerializeElement
private Double stormTop; private Double stormTop;
/** /**
* Empty constructor. * Empty constructor.
*/ */
public BUFRncwf() { public BUFRncwf() {
} }
/** /**
* Constructor for DataURI construction through base class. This is used by * Constructor for DataURI construction through base class. This is used by
* the notification service. * the notification service.
* *
* @param uri * @param uri
* A data uri applicable to this class. * A data uri applicable to this class.
* @param tableDef * @param tableDef
* The table definitions for this class. * The table definitions for this class.
*/ */
public BUFRncwf(String uri) { public BUFRncwf(String uri) {
super(uri); super(uri);
} }
/** /**
* @return the location * @return the location
*/ */
public SurfaceObsLocation getLocation() { public SurfaceObsLocation getLocation() {
return location; return location;
} }
/** /**
* @param location * @param location
* the location to set * the location to set
*/ */
public void setLocation(SurfaceObsLocation location) { public void setLocation(SurfaceObsLocation location) {
this.location = location; this.location = location;
} }
/** /**
* @return the detection * @return the detection
*/ */
public NCWFFeature getDetection() { public NCWFFeature getDetection() {
return detection; return detection;
} }
/** /**
* @param detection * @param detection
* the detection to set * the detection to set
*/ */
public void setDetection(NCWFFeature detection) { public void setDetection(NCWFFeature detection) {
this.detection = detection; this.detection = detection;
} }
/** /**
* @return the forecast * @return the forecast
*/ */
public NCWFFeature getForecast() { public NCWFFeature getForecast() {
return forecast; return forecast;
} }
/** /**
* @param forecast * @param forecast
* the forecast to set * the forecast to set
*/ */
public void setForecast(NCWFFeature forecast) { public void setForecast(NCWFFeature forecast) {
this.forecast = forecast; this.forecast = forecast;
} }
/** /**
* @return the stormDir * @return the stormDir
*/ */
public Double getStormDir() { public Double getStormDir() {
return stormDir; return stormDir;
} }
/** /**
* @param stormDir * @param stormDir
* the stormDir to set * the stormDir to set
*/ */
public void setStormDir(Double stormDir) { public void setStormDir(Double stormDir) {
this.stormDir = stormDir; this.stormDir = stormDir;
} }
/** /**
* @return the stormSpeed * @return the stormSpeed
*/ */
public Double getStormSpeed() { public Double getStormSpeed() {
return stormSpeed; return stormSpeed;
} }
/** /**
* @param stormSpeed * @param stormSpeed
* the stormSpeed to set * the stormSpeed to set
*/ */
public void setStormSpeed(Double stormSpeed) { public void setStormSpeed(Double stormSpeed) {
this.stormSpeed = stormSpeed; this.stormSpeed = stormSpeed;
} }
/** /**
* @return the stormTop * @return the stormTop
*/ */
public Double getStormTop() { public Double getStormTop() {
return stormTop; return stormTop;
} }
/** /**
* @param stormTop * @param stormTop
* the stormTop to set * the stormTop to set
*/ */
public void setStormTop(Double stormTop) { public void setStormTop(Double stormTop) {
this.stormTop = stormTop; this.stormTop = stormTop;
} }
@Override @Override
public IDecoderGettable getDecoderGettable() { public IDecoderGettable getDecoderGettable() {
return null; return null;
} }
@Override @Override
public ISpatialObject getSpatialObject() { public ISpatialObject getSpatialObject() {
return location; return location;
} }
@Override @Override
public String getString(String paramName) { public String getString(String paramName) {
return null; return null;
} }
@Override @Override
public String[] getStrings(String paramName) { public String[] getStrings(String paramName) {
return null; return null;
} }
@Override @Override
public Amount getValue(String paramName) { public Amount getValue(String paramName) {
return null; return null;
} }
@Override @Override
public Collection<Amount> getValues(String paramName) { public Collection<Amount> getValues(String paramName) {
return null; return null;
} }
/** /**
* *
*/ */
@Override @Override
public PointDataView getPointDataView() { public PointDataView getPointDataView() {
return pdv; return pointDataView;
} }
/** /**
* @return the pdv
*/
public PointDataView getPdv() {
return pdv;
}
/**
* @param pdv
* the pdv to set
*/
public void setPdv(PointDataView pdv) {
this.pdv = pdv;
}
/**
* *
*/ */
@Override @Override
public void setPointDataView(PointDataView pdv) { public void setPointDataView(PointDataView pointDataView) {
this.pdv = pdv; this.pointDataView = pointDataView;
} }
} }

View file

@ -68,307 +68,308 @@ import com.vividsolutions.jts.geom.Geometry;
@XmlAccessorType(XmlAccessType.NONE) @XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize @DynamicSerialize
public class QUIKScatObs extends PersistablePluginDataObject implements public class QUIKScatObs extends PersistablePluginDataObject implements
ISpatialEnabled, IDecoderGettable, IPointData, IPersistable { ISpatialEnabled, IDecoderGettable, IPointData, IPersistable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Embedded @Embedded
private PointDataView pdv; @DynamicSerializeElement
private PointDataView pointDataView;
@DataURI(position = 1) @DataURI(position = 1)
@XmlAttribute @XmlAttribute
@DynamicSerializeElement @DynamicSerializeElement
private Integer satId; private Integer satId;
@Embedded @Embedded
@DataURI(position = 2, embedded = true) @DataURI(position = 2, embedded = true)
@XmlElement @XmlElement
@DynamicSerializeElement @DynamicSerializeElement
private SurfaceObsLocation location; private SurfaceObsLocation location;
// Text of the WMO header // Text of the WMO header
@Column(length = 32) @Column(length = 32)
@DynamicSerializeElement @DynamicSerializeElement
@XmlElement @XmlElement
private String wmoHeader; private String wmoHeader;
@XmlAttribute @XmlAttribute
@DynamicSerializeElement @DynamicSerializeElement
@Transient @Transient
private Integer orbitNumber; private Integer orbitNumber;
// The observation time. // The observation time.
@XmlAttribute @XmlAttribute
@DynamicSerializeElement @DynamicSerializeElement
@Transient @Transient
private Calendar timeObs; private Calendar timeObs;
@XmlAttribute @XmlAttribute
@DynamicSerializeElement @DynamicSerializeElement
@Transient @Transient
private Double windDir; private Double windDir;
@XmlAttribute @XmlAttribute
@DynamicSerializeElement @DynamicSerializeElement
@Transient @Transient
private Double windSpd; private Double windSpd;
@XmlAttribute @XmlAttribute
@DynamicSerializeElement @DynamicSerializeElement
@Transient @Transient
private Double probRain; private Double probRain;
@XmlAttribute @XmlAttribute
@DynamicSerializeElement @DynamicSerializeElement
@Transient @Transient
private Integer rainIndex; private Integer rainIndex;
/** /**
* Empty constructor. * Empty constructor.
*/ */
public QUIKScatObs() { public QUIKScatObs() {
} }
/** /**
* Constructor for DataURI construction through base class. This is used by * Constructor for DataURI construction through base class. This is used by
* the notification service. * the notification service.
* *
* @param uri * @param uri
* A data uri applicable to this class. * A data uri applicable to this class.
* @param tableDef * @param tableDef
* The table definitions for this class. * The table definitions for this class.
*/ */
public QUIKScatObs(String uri) { public QUIKScatObs(String uri) {
super(uri); super(uri);
} }
/** /**
* Get this observation's geometry. * Get this observation's geometry.
* *
* @return The geometry for this observation. * @return The geometry for this observation.
*/ */
public Geometry getGeometry() { public Geometry getGeometry() {
return location.getGeometry(); return location.getGeometry();
} }
/** /**
* Get the geometry latitude. * Get the geometry latitude.
* *
* @return The geometry latitude. * @return The geometry latitude.
*/ */
public double getLatitude() { public double getLatitude() {
return location.getLatitude(); return location.getLatitude();
} }
/** /**
* Get the geometry longitude. * Get the geometry longitude.
* *
* @return The geometry longitude. * @return The geometry longitude.
*/ */
public double getLongitude() { public double getLongitude() {
return location.getLongitude(); return location.getLongitude();
} }
/** /**
* Get the elevation, in meters, of the observing platform or location. * Get the elevation, in meters, of the observing platform or location.
* *
* @return The observation elevation, in meters. * @return The observation elevation, in meters.
*/ */
public Integer getElevation() { public Integer getElevation() {
return location.getElevation(); return location.getElevation();
} }
/** /**
* Was this location defined from the station catalog? False if not. * Was this location defined from the station catalog? False if not.
* *
* @return Was this location defined from the station catalog? * @return Was this location defined from the station catalog?
*/ */
public Boolean getLocationDefined() { public Boolean getLocationDefined() {
return location.getLocationDefined(); return location.getLocationDefined();
} }
/** /**
* @return the location * @return the location
*/ */
public SurfaceObsLocation getLocation() { public SurfaceObsLocation getLocation() {
return location; return location;
} }
/** /**
* @param location * @param location
* the location to set * the location to set
*/ */
public void setLocation(SurfaceObsLocation location) { public void setLocation(SurfaceObsLocation location) {
this.location = location; this.location = location;
} }
/** /**
* @return the satId * @return the satId
*/ */
public Integer getSatId() { public Integer getSatId() {
return satId; return satId;
} }
/** /**
* @param satId * @param satId
* the satId to set * the satId to set
*/ */
public void setSatId(Integer satId) { public void setSatId(Integer satId) {
this.satId = satId; this.satId = satId;
} }
/** /**
* @return the orbitNumber * @return the orbitNumber
*/ */
public Integer getOrbitNumber() { public Integer getOrbitNumber() {
return orbitNumber; return orbitNumber;
} }
/** /**
* @param orbitNumber * @param orbitNumber
* the orbitNumber to set * the orbitNumber to set
*/ */
public void setOrbitNumber(Integer orbitNumber) { public void setOrbitNumber(Integer orbitNumber) {
this.orbitNumber = orbitNumber; this.orbitNumber = orbitNumber;
} }
/** /**
* @return the wmoHeader * @return the wmoHeader
*/ */
public String getWmoHeader() { public String getWmoHeader() {
return wmoHeader; return wmoHeader;
} }
/** /**
* @param wmoHeader * @param wmoHeader
* the wmoHeader to set * the wmoHeader to set
*/ */
public void setWmoHeader(String wmoHeader) { public void setWmoHeader(String wmoHeader) {
this.wmoHeader = wmoHeader; this.wmoHeader = wmoHeader;
} }
/** /**
* @return the windDir * @return the windDir
*/ */
public Double getWindDir() { public Double getWindDir() {
return windDir; return windDir;
} }
/** /**
* @param windDir * @param windDir
* the windDir to set * the windDir to set
*/ */
public void setWindDir(Double windDir) { public void setWindDir(Double windDir) {
this.windDir = windDir; this.windDir = windDir;
} }
/** /**
* @return the windSpd * @return the windSpd
*/ */
public Double getWindSpd() { public Double getWindSpd() {
return windSpd; return windSpd;
} }
/** /**
* @param windSpd * @param windSpd
* the windSpd to set * the windSpd to set
*/ */
public void setWindSpd(Double windSpd) { public void setWindSpd(Double windSpd) {
this.windSpd = windSpd; this.windSpd = windSpd;
} }
/** /**
* @return the probRain * @return the probRain
*/ */
public Double getProbRain() { public Double getProbRain() {
return probRain; return probRain;
} }
/** /**
* @param probRain * @param probRain
* the probRain to set * the probRain to set
*/ */
public void setProbRain(Double probRain) { public void setProbRain(Double probRain) {
this.probRain = probRain; this.probRain = probRain;
} }
/** /**
* @return the rainIndex * @return the rainIndex
*/ */
public Integer getRainIndex() { public Integer getRainIndex() {
return rainIndex; return rainIndex;
} }
/** /**
* @param rainIndex * @param rainIndex
* the rainIndex to set * the rainIndex to set
*/ */
public void setRainIndex(Integer rainIndex) { public void setRainIndex(Integer rainIndex) {
this.rainIndex = rainIndex; this.rainIndex = rainIndex;
} }
/** /**
* Get the observation time for this data. * Get the observation time for this data.
* *
* @return The data observation time. * @return The data observation time.
*/ */
public Calendar getTimeObs() { public Calendar getTimeObs() {
return timeObs; return timeObs;
} }
/** /**
* Set the observation time for this data. * Set the observation time for this data.
* *
* @param timeObs * @param timeObs
* The data observation time. * The data observation time.
*/ */
public void setTimeObs(Calendar timeObs) { public void setTimeObs(Calendar timeObs) {
this.timeObs = timeObs; this.timeObs = timeObs;
} }
@Override @Override
public IDecoderGettable getDecoderGettable() { public IDecoderGettable getDecoderGettable() {
return null; return null;
} }
@Override @Override
public ISpatialObject getSpatialObject() { public ISpatialObject getSpatialObject() {
return location; return location;
} }
@Override @Override
public String getString(String paramName) { public String getString(String paramName) {
return null; return null;
} }
@Override @Override
public String[] getStrings(String paramName) { public String[] getStrings(String paramName) {
return null; return null;
} }
@Override @Override
public Amount getValue(String paramName) { public Amount getValue(String paramName) {
return null; return null;
} }
@Override @Override
public Collection<Amount> getValues(String paramName) { public Collection<Amount> getValues(String paramName) {
return null; return null;
} }
/** /**
* *
*/ */
@Override @Override
public PointDataView getPointDataView() { public PointDataView getPointDataView() {
return pdv; return pointDataView;
} }
/** /**
* *
*/ */
@Override @Override
public void setPointDataView(PointDataView pdv) { public void setPointDataView(PointDataView pointDataView) {
this.pdv = pdv; this.pointDataView = pointDataView;
} }
} }

View file

@ -66,248 +66,234 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@XmlRootElement @XmlRootElement
@XmlAccessorType(XmlAccessType.NONE) @XmlAccessorType(XmlAccessType.NONE)
public class SigWxData extends PersistablePluginDataObject implements public class SigWxData extends PersistablePluginDataObject implements
IDecoderGettable, IPointData, IPersistable { IDecoderGettable, IPointData, IPersistable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Column @Column
@DataURI(position = 1) @DataURI(position = 1)
@XmlElement @XmlElement
@DynamicSerializeElement @DynamicSerializeElement
private SigWxLayer wxLayer; private SigWxLayer wxLayer;
@Column @Column
@DataURI(position = 2) @DataURI(position = 2)
@XmlElement @XmlElement
@DynamicSerializeElement @DynamicSerializeElement
private SigWxType wxType; private SigWxType wxType;
@Column @Column
@DataURI(position = 3) @DataURI(position = 3)
@XmlAttribute @XmlAttribute
@DynamicSerializeElement @DynamicSerializeElement
private Integer key; private Integer key;
@Column @Column
@XmlAttribute @XmlAttribute
@DynamicSerializeElement @DynamicSerializeElement
private Integer baseHeight; private Integer baseHeight;
@Column @Column
@XmlAttribute @XmlAttribute
@DynamicSerializeElement @DynamicSerializeElement
private Integer topHeight; private Integer topHeight;
@Embedded @Embedded
private PointDataView pdv; @DynamicSerializeElement
private PointDataView pointDataView;
// Text of the WMO header // Text of the WMO header
@Column(length = 32) @Column(length = 32)
@DynamicSerializeElement @DynamicSerializeElement
@XmlElement @XmlElement
private String wmoHeader; private String wmoHeader;
@Transient @Transient
@DynamicSerializeElement @DynamicSerializeElement
@XmlElement @XmlElement
private TropopauseLayerData tropData; private TropopauseLayerData tropData;
/** /**
* Empty constructor. * Empty constructor.
*/ */
public SigWxData() { public SigWxData() {
} }
/** /**
* Constructor for DataURI construction through base class. This is used by * Constructor for DataURI construction through base class. This is used by
* the notification service. * the notification service.
* *
* @param uri * @param uri
* A data uri applicable to this class. * A data uri applicable to this class.
* @param tableDef * @param tableDef
* The table definitions for this class. * The table definitions for this class.
*/ */
public SigWxData(String uri) { public SigWxData(String uri) {
super(uri); super(uri);
} }
/** /**
* @return the wxLayer * @return the wxLayer
*/ */
public SigWxLayer getWxLayer() { public SigWxLayer getWxLayer() {
return wxLayer; return wxLayer;
} }
/** /**
* @param wxLayer * @param wxLayer
* the wxLayer to set * the wxLayer to set
*/ */
public void setWxLayer(SigWxLayer wxLayer) { public void setWxLayer(SigWxLayer wxLayer) {
this.wxLayer = wxLayer; this.wxLayer = wxLayer;
} }
/** /**
* @return the wxType * @return the wxType
*/ */
public SigWxType getWxType() { public SigWxType getWxType() {
return wxType; return wxType;
} }
/** /**
* @param wxType * @param wxType
* the wxType to set * the wxType to set
*/ */
public void setWxType(SigWxType wxType) { public void setWxType(SigWxType wxType) {
this.wxType = wxType; this.wxType = wxType;
} }
/** /**
* @return the baseHeight * @return the baseHeight
*/ */
public Integer getBaseHeight() { public Integer getBaseHeight() {
return baseHeight; return baseHeight;
} }
/** /**
* @param baseHeight * @param baseHeight
* the baseHeight to set * the baseHeight to set
*/ */
public void setBaseHeight(Integer baseHeight) { public void setBaseHeight(Integer baseHeight) {
this.baseHeight = baseHeight; this.baseHeight = baseHeight;
} }
/** /**
* @return the topHeight * @return the topHeight
*/ */
public Integer getTopHeight() { public Integer getTopHeight() {
return topHeight; return topHeight;
} }
/** /**
* @param topHeight * @param topHeight
* the topHeight to set * the topHeight to set
*/ */
public void setTopHeight(Integer topHeight) { public void setTopHeight(Integer topHeight) {
this.topHeight = topHeight; this.topHeight = topHeight;
} }
/** /**
* @return the wmoHeader * @return the wmoHeader
*/ */
public String getWmoHeader() { public String getWmoHeader() {
return wmoHeader; return wmoHeader;
} }
/** /**
* @param wmoHeader * @param wmoHeader
* the wmoHeader to set * the wmoHeader to set
*/ */
public void setWmoHeader(String wmoHeader) { public void setWmoHeader(String wmoHeader) {
this.wmoHeader = wmoHeader; this.wmoHeader = wmoHeader;
} }
/** /**
* @return the tropData * @return the tropData
*/ */
public TropopauseLayerData getTropData() { public TropopauseLayerData getTropData() {
return tropData; return tropData;
} }
/** /**
* @param tropData * @param tropData
* the tropData to set * the tropData to set
*/ */
public void setTropData(TropopauseLayerData tropData) { public void setTropData(TropopauseLayerData tropData) {
this.tropData = tropData; this.tropData = tropData;
} }
/** /**
* @return the key * @return the key
*/ */
public Integer getKey() { public Integer getKey() {
return key; return key;
} }
/** /**
* @param key * @param key
* the key to set * the key to set
*/ */
public void setKey(Integer key) { public void setKey(Integer key) {
this.key = key; this.key = key;
} }
/** @Override
* @return the pdv public IDecoderGettable getDecoderGettable() {
*/ return null;
public PointDataView getPdv() { }
return pdv;
}
/** @Override
* @param pdv public String getString(String paramName) {
* the pdv to set return null;
*/ }
public void setPdv(PointDataView pdv) {
this.pdv = pdv;
}
@Override @Override
public IDecoderGettable getDecoderGettable() { public String[] getStrings(String paramName) {
return null; return null;
} }
@Override @Override
public String getString(String paramName) { public Amount getValue(String paramName) {
return null; return null;
} }
@Override @Override
public String[] getStrings(String paramName) { public Collection<Amount> getValues(String paramName) {
return null; return null;
} }
@Override /**
public Amount getValue(String paramName) {
return null;
}
@Override
public Collection<Amount> getValues(String paramName) {
return null;
}
/**
* *
*/ */
@Override @Override
public PointDataView getPointDataView() { public PointDataView getPointDataView() {
return pdv; return pointDataView;
} }
/** /**
* *
*/ */
@Override @Override
public void setPointDataView(PointDataView pdv) { public void setPointDataView(PointDataView pointDataView) {
this.pdv = pdv; this.pointDataView = pointDataView;
} }
/** /**
* *
* @return * @return
*/ */
public final SigWxData copyObs() { public final SigWxData copyObs() {
SigWxData obs = new SigWxData(); SigWxData obs = new SigWxData();
obs.dataTime = dataTime.clone(); obs.dataTime = dataTime.clone();
obs.pluginName = pluginName; obs.pluginName = pluginName;
obs.baseHeight = baseHeight; obs.baseHeight = baseHeight;
obs.topHeight = topHeight; obs.topHeight = topHeight;
obs.wxLayer = wxLayer; obs.wxLayer = wxLayer;
obs.wxType = wxType; obs.wxType = wxType;
obs.wmoHeader = wmoHeader; obs.wmoHeader = wmoHeader;
return obs; return obs;
} }
} }

Some files were not shown because too many files have changed in this diff Show more