Merge "Issue #176 Change plots to no longer require id in updates. Change thin client updates to request pdo's instead of redoTimeMatching, which grabs any updates, not just new resource times." into 4-Thin_Client

Former-commit-id: b50765ded4 [formerly b50765ded4 [formerly 8df2c8fdd7bdf92806e4c1241083e9969e02ca76]]
Former-commit-id: ec1188f95f
Former-commit-id: 2925a1638f
This commit is contained in:
Nate Jensen 2012-01-30 17:16:47 -06:00 committed by Gerrit Code Review
commit 866b1b79d6
26 changed files with 912 additions and 741 deletions

View file

@ -82,7 +82,7 @@ public class CoopPrecipDataCubeAdapter implements IDataCubeAdapter {
private static final PointDataDescription rtpDescription = new PointDataDescription();
static {
ffgDescription.parameters = new ParameterDescription[8];
ffgDescription.parameters = new ParameterDescription[9];
ffgDescription.parameters[0] = new ParameterDescription("time",
Type.LONG);
ffgDescription.parameters[1] = new ParameterDescription("latitude",
@ -98,8 +98,9 @@ public class CoopPrecipDataCubeAdapter implements IDataCubeAdapter {
ffgDescription.parameters[6] = new ParameterDescription("stationId",
Type.STRING);
ffgDescription.parameters[7] = new ParameterDescription("id", Type.INT);
ffgDescription.parameters[8] = new ParameterDescription("dataURI", Type.STRING);
rtpDescription.parameters = new ParameterDescription[6];
rtpDescription.parameters = new ParameterDescription[7];
rtpDescription.parameters[0] = new ParameterDescription("time",
Type.LONG);
rtpDescription.parameters[1] = new ParameterDescription("latitude",
@ -111,6 +112,8 @@ public class CoopPrecipDataCubeAdapter implements IDataCubeAdapter {
rtpDescription.parameters[4] = new ParameterDescription("stationId",
Type.STRING);
rtpDescription.parameters[5] = new ParameterDescription("id", Type.INT);
rtpDescription.parameters[6] = new ParameterDescription("dataURI", Type.STRING);
}
@Override
@ -238,6 +241,7 @@ public class CoopPrecipDataCubeAdapter implements IDataCubeAdapter {
pdv.setFloat("3hr", Float.valueOf(parts[1]));
pdv.setFloat("6hr", Float.valueOf(parts[2]));
pdv.setString("stationId", station);
pdv.setString("dataURI", "/textPoints/" + station + "/" + time);
// TODO this id is not really guaranteed to be unique
pdv.setInt("id", ((int) time) + station.hashCode());
}
@ -315,6 +319,7 @@ public class CoopPrecipDataCubeAdapter implements IDataCubeAdapter {
pdv.setFloat("latitude", (float) coord.latlon.y);
pdv.setFloat("precip", precip);
pdv.setString("stationId", station);
pdv.setString("dataURI", "/textPoints/" + station + "/" + time);
// TODO this id is not really guaranteed to be unique
pdv.setInt("id", ((int) time) + station.hashCode());
}

View file

@ -69,7 +69,6 @@ public class CoopPrecipPlotInfoRetriever extends AbstractPlotInfoRetriever {
for (int uriCounter = 0; uriCounter < pdc.getCurrentSz(); uriCounter++) {
PointDataView pdv = pdc.readRandom(uriCounter);
PlotInfo stationInfo = new PlotInfo();
stationInfo.id = pdv.getInt("id");
stationInfo.latitude = pdv.getNumber("latitude").doubleValue();
stationInfo.longitude = pdv.getNumber("longitude")
.doubleValue();
@ -80,6 +79,7 @@ public class CoopPrecipPlotInfoRetriever extends AbstractPlotInfoRetriever {
stationInfo.pdv = new PlotData();
}
stationInfo.pdv.addData(pdv);
stationInfo.dataURI = pdv.getString("dataURI");
info.add(stationInfo);
}
}

View file

@ -1,19 +1,19 @@
/**
* 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
* 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
*
* 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.
**/
@ -38,8 +38,6 @@ import java.util.Map;
*/
public class AlertMessage {
/** The id of the alert */
public Integer id;
/** The raw string dataURI */
public String dataURI;

View file

@ -383,7 +383,7 @@ public class DecisionTree<T> {
}
protected List<DataPair> getDataPairs() {
return dataPairs;
return new ArrayList<DecisionTree<T>.DataPair>(dataPairs);
}
private static double calcEntropy(int numExamples, Integer[] values) {

View file

@ -83,7 +83,12 @@ public class URICatalog extends DecisionTree<List<IURIRefreshCallback>> {
}
protected static synchronized void setCustomInstance(URICatalog catalog) {
// TODO what to do if there already is an isntance.
if (instance != null) {
for (DataPair pair : instance.getDataPairs()) {
catalog.insertCriteria(pair.metadata, pair.data, false);
}
catalog.rebuildTree();
}
instance = catalog;
}

View file

@ -1,19 +1,19 @@
/**
* 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
* 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
*
* 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.
**/
@ -50,7 +50,17 @@ public class DataUpdateTree extends DecisionTree<AbstractVizResource<?, ?>> {
return instance;
}
public DataUpdateTree() {
protected static synchronized void setCustomInstance(DataUpdateTree tree) {
if (instance != null) {
for (DataPair pair : instance.getDataPairs()) {
tree.insertCriteria(pair.metadata, pair.data, false);
}
tree.rebuildTree();
}
instance = tree;
}
protected DataUpdateTree() {
super();
}

View file

@ -65,6 +65,8 @@ import com.raytheon.uf.viz.derivparam.library.IDerivParamField;
public class DerivedLevelNode extends AbstractDerivedLevelNode {
private static final int TIME_QUERY_CACHE_TIME = 30000;
private Map<IDerivParamField, AbstractRequestableData> fieldStaticData = null;
private Map<DerivParamField, AbstractRequestableLevelNode> fields = null;
@ -75,6 +77,8 @@ public class DerivedLevelNode extends AbstractDerivedLevelNode {
*/
private Map<DerivParamField, Set<DataTime>> timeCache = null;
private long lastTimeQuery = 0;
private int dt;
public DerivedLevelNode(Level level, DerivParamDesc desc,
@ -149,6 +153,7 @@ public class DerivedLevelNode extends AbstractDerivedLevelNode {
Map<AbstractRequestableLevelNode, Set<DataTime>> cache,
Map<AbstractRequestableLevelNode, Set<DataTime>> latestOnlyCache)
throws VizException {
this.lastTimeQuery = System.currentTimeMillis();
Map<DerivParamField, Set<DataTime>> timeCache = new HashMap<DerivParamField, Set<DataTime>>();
// We have a derived parameter for the requested grid
Set<DataTime> availableDataTimes = null;
@ -277,7 +282,9 @@ public class DerivedLevelNode extends AbstractDerivedLevelNode {
int timeOut,
Map<AbstractRequestableLevelNode, List<AbstractRequestableData>> cache)
throws VizException {
if (this.timeCache == null) {
if (this.timeCache == null
|| this.lastTimeQuery + TIME_QUERY_CACHE_TIME < System
.currentTimeMillis()) {
this.timeQuery(false);
}

View file

@ -20,23 +20,11 @@
package com.raytheon.uf.viz.thinclient.cave.refresh;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
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.viz.core.AbstractTimeMatcher;
import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.thinclient.Activator;
import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants;
import com.raytheon.uf.viz.thinclient.refresh.TimedRefresher.RefreshTimerTask;
import com.raytheon.viz.alerts.jobs.AutoUpdater;
import com.raytheon.viz.ui.editor.AbstractEditor;
import com.raytheon.viz.ui.perspectives.AbstractVizPerspectiveManager;
import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
/**
* Timer task responsible for refreshing IEditorParts that implement
@ -59,11 +47,6 @@ import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
public class DataRefreshTask implements RefreshTimerTask {
private IUFStatusHandler statusHandler = UFStatus
.getHandler(DataRefreshTask.class);
private AutoUpdater autoUpdater = new AutoUpdater();
/*
* (non-Javadoc)
*
@ -72,48 +55,9 @@ public class DataRefreshTask implements RefreshTimerTask {
@Override
public void run() {
IPreferenceStore store = Activator.getDefault().getPreferenceStore();
if (!store.getBoolean(ThinClientPreferenceConstants.P_DISABLE_JMS)) {
return;
}
// For every window open, redo time matching on every descriptor on
// every editor for the window. A bit D2D specific, but it is how the
// AutoUpdater works which is what we are mimicking.
for (IWorkbenchWindow window : PlatformUI.getWorkbench()
.getWorkbenchWindows()) {
// Find listener for window
VizPerspectiveListener listener = VizPerspectiveListener
.getInstance(window);
if (listener != null) {
// Find active perspective manager for listener
AbstractVizPerspectiveManager manager = listener
.getActivePerspectiveManager();
if (manager != null) {
// Process each editor
for (AbstractEditor editor : manager
.getPerspectiveEditors()) {
for (IDisplayPane pane : editor.getDisplayPanes()) {
// Get the time matcher
AbstractTimeMatcher atm = pane.getDescriptor()
.getTimeMatcher();
if (atm != null) {
try {
// Redo time matching. This will trigger
// updates and removal of old data
AbstractVizResource<?, ?> tmb = atm
.getTimeMatchBasis();
if (tmb != null) {
atm.redoTimeMatching(tmb);
}
atm.redoTimeMatching(pane.getDescriptor());
} catch (VizException e) {
statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
}
}
}
}
}
if (store.getBoolean(ThinClientPreferenceConstants.P_DISABLE_JMS)) {
new AutoUpdater().alertArrived(ThinClientDataUpdateTree
.getInstance().updateAllData());
}
}

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.uf.viz.thinclient.cave.refresh;
import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TimeZone;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
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.viz.core.RecordFactory;
import com.raytheon.uf.viz.core.alerts.AlertMessage;
import com.raytheon.uf.viz.core.catalog.LayerProperty;
import com.raytheon.uf.viz.core.datastructure.DataCubeContainer;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
import com.raytheon.uf.viz.core.rsc.updater.DataUpdateTree;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 13, 2011 bsteffen Initial creation
*
* </pre>
*
* @author bsteffen
* @version 1.0
*/
public class ThinClientDataUpdateTree extends DataUpdateTree {
private IUFStatusHandler statusHandler = UFStatus
.getHandler(ThinClientDataUpdateTree.class);
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss.SSS");
private long lastQuery = 0l;
public static synchronized ThinClientDataUpdateTree getInstance() {
DataUpdateTree instance = DataUpdateTree.getInstance();
if (!(instance instanceof ThinClientDataUpdateTree)) {
instance = new ThinClientDataUpdateTree();
setCustomInstance(instance);
}
return (ThinClientDataUpdateTree) instance;
}
private ThinClientDataUpdateTree() {
DATE_FORMAT.setTimeZone(TimeZone.getTimeZone("GMT"));
lastQuery = System.currentTimeMillis();
}
public Collection<AlertMessage> updateAllData() {
String time = DATE_FORMAT.format(new Date(lastQuery));
// put in a 1 second overlap in case insert time is a bit off.
lastQuery = System.currentTimeMillis() - 1000;
Set<AlertMessage> messages = new HashSet<AlertMessage>();
for (DataPair pair : getDataPairs()) {
AbstractResourceData resourceData = pair.data.getResourceData();
if (!(resourceData instanceof AbstractRequestableResourceData)
|| resourceData.isFrozen())
continue;
Map<String, RequestConstraint> metadata = pair.metadata;
metadata = new HashMap<String, RequestConstraint>(metadata);
metadata.put("insertTime", new RequestConstraint(time,
ConstraintType.GREATER_THAN));
LayerProperty property = new LayerProperty();
try {
property.setEntryQueryParameters(metadata, false);
List<Object> records = DataCubeContainer.getData(property,
60000);
if (records != null && !records.isEmpty()) {
for (Object record : records) {
if (record instanceof PluginDataObject) {
PluginDataObject pdo = (PluginDataObject) record;
AlertMessage am = new AlertMessage();
am.dataURI = pdo.getDataURI();
am.decodedAlert = RecordFactory.getInstance()
.loadMapFromUri(am.dataURI);
messages.add(am);
}
}
}
} catch (VizException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
e);
}
}
return messages;
}
}

View file

@ -299,20 +299,16 @@ public class ProductAlertObserver implements INotificationObserver {
if ((payLoad instanceof DataURINotificationMessage)
|| (CAVEMode.getMode().equals(CAVEMode.PRACTICE) && payLoad instanceof PracticeDataURINotificationMessage)) {
String[] dataURIs = null;
int[] ids = null;
if (payLoad instanceof DataURINotificationMessage) {
DataURINotificationMessage uriMsg = (DataURINotificationMessage) payLoad;
dataURIs = uriMsg.getDataURIs();
ids = uriMsg.getIds();
} else {
PracticeDataURINotificationMessage uriMsg = (PracticeDataURINotificationMessage) payLoad;
dataURIs = uriMsg.getDataURIs();
ids = uriMsg.getIds();
}
for (int i = 0; i < dataURIs.length; ++i) {
String str = dataURIs[i];
Integer id = ids[i];
processDataURI(str, id);
processDataURI(str);
}
startWrappers();
@ -338,12 +334,12 @@ public class ProductAlertObserver implements INotificationObserver {
public static void processDerivedAlerts(Collection<String> datauris) {
for (String datauri : datauris) {
getInstance().processDataURI(datauri, 0);
getInstance().processDataURI(datauri);
}
getInstance().startWrappers();
}
private void processDataURI(String datauri, int id) {
private void processDataURI(String datauri) {
if (datauri == null)
return;
try {
@ -363,7 +359,6 @@ public class ProductAlertObserver implements INotificationObserver {
}
AlertMessage am = new AlertMessage();
am.id = id;
am.dataURI = datauri;
am.decodedAlert = Collections.unmodifiableMap(attribs);
List<IAlertObserver> obsList = observers.get(NO_FILTER_CONSTANT);

View file

@ -42,5 +42,5 @@ public interface IPlotModelGeneratorCaller {
public void clearImages();
public void messageGenerated(int id, String message);
public void messageGenerated(String dataURI, String message);
}

View file

@ -1,19 +1,19 @@
/**
* 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
* 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
*
* 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.
**/
@ -54,7 +54,7 @@ public class PlotAlertParser extends AbstractAlertMessageParser {
Double lat = (Double) message.decodedAlert.get("location.latitude");
Double lon = (Double) message.decodedAlert.get("location.longitude");
DataTime dataTime = (DataTime) message.decodedAlert.get("dataTime");
return new PlotInfo(message.id, stationId, lat, lon, dataTime,
return new PlotInfo(stationId, lat, lon, dataTime,
message.dataURI);
}
}

View file

@ -39,8 +39,6 @@ import com.raytheon.uf.common.time.DataTime;
public class PlotInfo {
public Integer id;
public String stationId;
public Double latitude;
@ -68,9 +66,8 @@ public class PlotInfo {
}
public PlotInfo(Integer id, String stationId, Double latitude,
public PlotInfo(String stationId, Double latitude,
Double longitude, DataTime dataTime, String dataURI) {
this.id = id;
this.stationId = stationId;
this.latitude = latitude;
this.longitude = longitude;

View file

@ -166,14 +166,6 @@ public class PlotModelDataRequestJob extends Job {
}
}
// cleanup
for (PlotInfo[] plotInfoArray : stationQuery) {
for (int i = 0; i < plotInfoArray.length; i++) {
// currently the dataUris are never used again, clear
// them to free up as much memory as possible
plotInfoArray[i].dataURI = null;
}
}
} // end of while !stationQueue.isEmpty()
return Status.OK_STATUS;
@ -181,7 +173,7 @@ public class PlotModelDataRequestJob extends Job {
private void requestData(List<PlotInfo[]> stationQuery,
List<PlotModelElement> pme) {
Map<Integer, PlotInfo> plotMap = new HashMap<Integer, PlotInfo>();
Map<String, PlotInfo> plotMap = new HashMap<String, PlotInfo>();
List<String> params = new ArrayList<String>();
for (PlotModelElement p : pme) {
@ -194,6 +186,10 @@ public class PlotModelDataRequestJob extends Job {
}
}
}
if(!params.contains("dataURI")){
params.add("dataURI");
}
Map<String, RequestConstraint> map = new HashMap<String, RequestConstraint>();
map.putAll(this.constraintMap);
@ -202,8 +198,8 @@ public class PlotModelDataRequestJob extends Job {
List<String> str = new ArrayList<String>(stationQuery.size());
for (PlotInfo[] infos : stationQuery) {
for (PlotInfo info : infos) {
str.add(Integer.toString(info.id));
plotMap.put(info.id, info);
str.add(info.dataURI);
plotMap.put(info.dataURI, info);
}
}
@ -217,7 +213,7 @@ public class PlotModelDataRequestJob extends Job {
index++;
j++;
}
map.put("id", rc);
map.put("dataURI", rc);
try {
// Try and get data from datacube
long t0 = System.currentTimeMillis();
@ -241,8 +237,8 @@ public class PlotModelDataRequestJob extends Job {
for (int uriCounter = 0; uriCounter < pdc.getAllocatedSz(); uriCounter++) {
PointDataView pdv = pdc.readRandom(uriCounter);
if (pdv != null) {
int id = pdv.getInt("id");
PlotInfo info = plotMap.get(id);
String dataURI = pdv.getString("dataURI");
PlotInfo info = plotMap.get(dataURI);
// If the id doesn't match, try to match by
// location
if (info == null) {
@ -255,8 +251,6 @@ public class PlotModelDataRequestJob extends Job {
- pdv.getFloat("longitude"));
if (diffLat < 0.01 && diffLon < 0.01) {
info = pi;
pdv.setInt("id", pi.id);
id = pi.id;
}
}
}

View file

@ -569,7 +569,7 @@ public class PlotModelFactory2 {
* @return A buffered image representing the station data
*/
public synchronized BufferedImage getStationPlot(PlotData stationData,
int id, double latitude, double longitude) {
double latitude, double longitude) {
double[] stationLocation = { longitude, latitude };
double[] stationPixelLocation = this.mapDescriptor
.worldToPixel(stationLocation);
@ -701,7 +701,7 @@ public class PlotModelFactory2 {
return null;
}
public synchronized String getStationMessage(PlotData stationData, int id) {
public synchronized String getStationMessage(PlotData stationData, String dataURI) {
PlotPythonScript script = null;
StringBuilder sampleMessage = new StringBuilder();
try {

View file

@ -90,7 +90,7 @@ public class PlotModelGeneratorJob extends Job {
try {
PlotInfo[] infos = taskQueue.poll();
BufferedImage bImage = plotCreator.getStationPlot(infos[0].pdv,
infos[0].id, infos[0].latitude, infos[0].longitude);
infos[0].latitude, infos[0].longitude);
IImage image = null;
if (bImage != null) {
if (imageCache.containsKey(bImage)) {

View file

@ -123,7 +123,7 @@ public class PlotResource2 extends
private JobPool frameRetrievalPool = new JobPool("Retrieving plot frame",
8, true);
private TreeMap<Integer, String> rawMessageMap = new TreeMap<Integer, String>();
private TreeMap<String, String> rawMessageMap = new TreeMap<String, String>();
private class FrameRetriever implements Runnable {
@ -342,7 +342,8 @@ public class PlotResource2 extends
}
boolean dup = false;
for (int i = 0; i < existingStation.info.length; i++) {
if (existingStation.info[i].id.equals(plot.id)) {
if (existingStation.info[i].dataURI
.equals(plot.dataURI)) {
// existingStation.info[i] = plot;
dup = true;
break;
@ -501,15 +502,15 @@ public class PlotResource2 extends
}
if (inspectPlot != null) {
int id = inspectPlot[0].id;
if (rawMessageMap.containsKey(id)) {
if (rawMessageMap.get(id) != null) {
message = rawMessageMap.get(id);
String dataURI = inspectPlot[0].dataURI;
if (rawMessageMap.containsKey(dataURI)) {
if (rawMessageMap.get(dataURI) != null) {
message = rawMessageMap.get(dataURI);
}
} else {
message = "Generating...";
synchronized (rawMessageMap) {
rawMessageMap.put(id, message);
rawMessageMap.put(dataURI, message);
}
List<PlotInfo[]> list = new ArrayList<PlotInfo[]>();
list.add(inspectPlot);
@ -711,9 +712,9 @@ public class PlotResource2 extends
}
@Override
public void messageGenerated(int id, String message) {
public void messageGenerated(String dataURI, String message) {
synchronized (rawMessageMap) {
rawMessageMap.put(id, message);
rawMessageMap.put(dataURI, message);
}
issueRefresh();
}

View file

@ -56,9 +56,6 @@ public class FullDataPlotInfoRetriever extends AbstractPlotInfoRetriever {
@XmlAttribute
private String parameters;
@XmlAttribute
private String id = "id";
@XmlAttribute
private String stationId = null;
@ -77,7 +74,6 @@ public class FullDataPlotInfoRetriever extends AbstractPlotInfoRetriever {
private String[] getParameters() {
List<String> parameters = new ArrayList<String>();
parameters.addAll(Arrays.asList(this.parameters.split(",")));
parameters.add(id);
if (stationId != null) {
parameters.add(stationId);
}
@ -86,7 +82,6 @@ public class FullDataPlotInfoRetriever extends AbstractPlotInfoRetriever {
parameters.add(validTime);
if (fcstTime != null) {
parameters.add(fcstTime);
;
}
parameters.add("dataURI");
return parameters.toArray(new String[0]);
@ -122,7 +117,6 @@ public class FullDataPlotInfoRetriever extends AbstractPlotInfoRetriever {
PointDataView pdv = pdc.readRandom(uriCounter);
PlotInfo info = new PlotInfo();
info.pdv.addData(pdv);
info.id = pdv.getInt(id);
if (stationId != null) {
info.stationId = pdv.getString(stationId);
}

View file

@ -66,7 +66,7 @@ public class PointDataPlotInfoRetriever extends AbstractDbPlotInfoRetriever {
@Override
protected void addColumns(DbQuery dq) {
dq.addColumn("id");
dq.addColumn("dataURI");
dq.addColumn("location.latitude");
dq.addColumn("location.longitude");
dq.addColumn("location.stationId");
@ -81,7 +81,7 @@ public class PointDataPlotInfoRetriever extends AbstractDbPlotInfoRetriever {
@Override
protected PlotInfo getPlotInfo(Object[] data) {
PlotInfo stationInfo = new PlotInfo();
stationInfo.id = (Integer) data[0];
stationInfo.dataURI = (String) data[0];
stationInfo.latitude = (Double) data[1];
stationInfo.longitude = (Double) data[2];
stationInfo.stationId = (String) data[3];

View file

@ -139,8 +139,9 @@ public class ScatterometerPlotInfoRetriever extends PointDataPlotInfoRetriever {
}
if (stations != null && stations.size() == MAX_RESULT_SIZE) {
for (PlotInfo station : stations) {
if (station.id < request.maxId) {
request.maxId = station.id;
int id = Integer.parseInt(station.stationId);
if (id < request.maxId) {
request.maxId = id;
}
}
synchronized (screenQueue) {
@ -197,7 +198,22 @@ public class ScatterometerPlotInfoRetriever extends PointDataPlotInfoRetriever {
dq.setOrderAscending(ResultOrder.DESC);
dq.addOrderBy("id");
super.addColumns(dq);
dq.addColumn("id");
}
/* (non-Javadoc)
* @see com.raytheon.viz.pointdata.rsc.retrieve.PointDataPlotInfoRetriever#getPlotInfo(java.lang.Object[])
*/
@Override
protected PlotInfo getPlotInfo(Object[] data) {
PlotInfo info = super.getPlotInfo(data);
info.stationId = data[data.length - 1].toString();
return info;
}
public void getStations(IResourceDataChanged listener, DataTime time,
HashMap<String, RequestConstraint> metadataMap) throws VizException {

View file

@ -80,9 +80,9 @@ public class PlotSampleGeneratorJob extends Job {
try {
PlotInfo[] infos = queue.poll();
String message = plotFactory.getStationMessage(infos[0].pdv,
infos[0].id);
infos[0].dataURI);
caller.messageGenerated(infos[0].id, message);
caller.messageGenerated(infos[0].dataURI, message);
} catch (Exception e) {
statusHandler.error("Error creating plot", e);
}

View file

@ -1,19 +1,19 @@
/**
* 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
* 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
*
* 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.
**/
@ -48,7 +48,6 @@ public class RadarPlotInfoRetriever extends AbstractDbPlotInfoRetriever {
@Override
protected void addColumns(DbQuery dq) {
dq.addColumn("id");
dq.addColumn("location.lat");
dq.addColumn("location.lon");
dq.addColumn("icao");
@ -59,15 +58,14 @@ public class RadarPlotInfoRetriever extends AbstractDbPlotInfoRetriever {
@Override
protected PlotInfo getPlotInfo(Object[] data) {
PlotInfo stationInfo = new PlotInfo();
stationInfo.id = (Integer) data[0];
stationInfo.latitude = ((Float) data[1]).doubleValue();
stationInfo.longitude = ((Float) data[2]).doubleValue();
stationInfo.stationId = (String) data[3];
stationInfo.latitude = ((Float) data[0]).doubleValue();
stationInfo.longitude = ((Float) data[1]).doubleValue();
stationInfo.stationId = (String) data[2];
if (stationInfo.stationId == null) {
stationInfo.stationId = "" + data[1] + "#" + data[2];
stationInfo.stationId = "" + data[0] + "#" + data[1];
}
stationInfo.dataTime = (DataTime) data[4];
stationInfo.dataURI = (String) data[5];
stationInfo.dataTime = (DataTime) data[3];
stationInfo.dataURI = (String) data[4];
return stationInfo;
}

View file

@ -398,7 +398,7 @@ public class RedbookUpperAirResource extends
float lon = pdv.getFloat(RedbookUpperAirDecoder.P_LONGITUDE);
PlotData pd = new PlotData();
pd.addData(pdv);
BufferedImage bImage = pmf.getStationPlot(pd, -1, lat, lon);
BufferedImage bImage = pmf.getStationPlot(pd, lat, lon);
IImage image = null;
if (bImage != null)
image = target.initializeRaster(new IODataPreparer(bImage,

View file

@ -30,7 +30,7 @@ public class H5UairPlotInfoRetriever extends PointDataPlotInfoRetriever {
@Override
protected void addColumns(DbQuery dq) {
dq.addColumn("id");
dq.addColumn("dataURI");
dq.addColumn("slat");
dq.addColumn("slon");
dq.addColumn("stid");
@ -41,7 +41,7 @@ public class H5UairPlotInfoRetriever extends PointDataPlotInfoRetriever {
@Override
protected PlotInfo getPlotInfo(Object[] data) {
PlotInfo stationInfo = new PlotInfo();
stationInfo.id = (Integer) data[0];
stationInfo.dataURI = (String) data[0];
stationInfo.latitude = ((Float)data[1]).doubleValue();
stationInfo.longitude = ((Float)data[2]).doubleValue();
stationInfo.stationId = (String)data[3];

View file

@ -1074,7 +1074,7 @@ public class PlotResource2 extends AbstractNatlCntrsResource<PlotResourceData, M
}
@Override
public void messageGenerated(int id, String message) {
public void messageGenerated(String dataURI, String message) {
// TODO Auto-generated method stub
}