Issue #2277 Removed more ScriptCreator references, fixed profiler data from last commit

Change-Id: I703d877c72df3cc561495b6c58de5cebe745ee09

Former-commit-id: 8ada70e372 [formerly a9d39a209f6e315ddc60d5000fdcf9c40d59f8eb]
Former-commit-id: 3471f4cb46
This commit is contained in:
Max Schenkelberg 2013-09-09 13:46:25 -05:00
parent 8a500677d3
commit b584c11d77
12 changed files with 198 additions and 320 deletions

View file

@ -20,23 +20,16 @@
package com.raytheon.uf.viz.core.catalog;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataquery.requests.DbQueryRequest;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.dataquery.requests.TimeQueryRequest;
import com.raytheon.uf.common.message.Message;
import com.raytheon.uf.common.message.response.AbstractResponseMessage;
import com.raytheon.uf.common.message.response.ResponseMessageCatalog;
import com.raytheon.uf.common.message.response.ResponseMessageError;
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.common.dataquery.responses.DbQueryResponse;
import com.raytheon.uf.common.time.BinOffset;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.comm.Connector;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.requests.ThriftClient;
@ -52,32 +45,13 @@ import com.raytheon.uf.viz.core.requests.ThriftClient;
* ------------ ---------- ----------- --------------------------
* 11/20/2006 #7 brockwoo Initial creation
* 08/19/2009 2586 rjpeter Added error handling
* 09/09/2013 2277 mschenke Got rid of ScriptCreator references
* </pre>
*
* @author brockwoo
* @version 1.0
*/
public class CatalogQuery {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(CatalogQuery.class);
/**
* Sets a query to return only distinct values from the index.
*/
public static final int DISTINCTVALUES = 0;
/**
* Sets a query to return all values from the index.
*/
public static final int ALLVALUES = 1;
private static final int REQUESTTIMEOUT = 60000;
private static final int LATEST_TIME_QUERY_TIMEOUT = 90000;
public static enum Mode {
DISTINCT, MAX
};
/**
* Will search for the fieldName within the catalog that meets the query
@ -94,147 +68,17 @@ public class CatalogQuery {
*/
public static String[] performQuery(String fieldName,
Map<String, RequestConstraint> queryTerms) throws VizException {
String query = assembleQuery(fieldName, queryTerms, Mode.DISTINCT);
// System.out.println("Query: " + query);
Connector value = Connector.getInstance();
Object[] catalogValues = value.connect(query, null, REQUESTTIMEOUT);
if (catalogValues == null || catalogValues.length == 0)
return null;
return (String[]) catalogValues[0];
DbQueryRequest request = new DbQueryRequest(queryTerms);
request.addRequestField(fieldName);
request.setDistinct(true);
DbQueryResponse response = (DbQueryResponse) ThriftClient
.sendRequest(request);
Object[] results = response.getFieldObjects(fieldName, Object.class);
String[] fieldResults = new String[results.length];
for (int i = 0; i < fieldResults.length; ++i) {
fieldResults[i] = String.valueOf(results[i]);
}
/**
* Will search for the fieldName within the catalog that meets the query
* terms specified by the hash map. Will return the max value
*
* @param fieldName
* The fieldname to search for
* @param queryTerms
* A hashmap containing the parameter name/value to search for
* @return A string array containing the found values or null if nothing is
* found
* @throws VizException
*/
@Deprecated
public static String[] performMaxQuery(String fieldName,
Map<String, RequestConstraint> queryTerms) throws VizException {
String query = assembleQuery(fieldName, queryTerms, Mode.MAX);
Connector value = Connector.getInstance();
Object[] catalogValues = value.connect(query, null, REQUESTTIMEOUT);
if (catalogValues == null || catalogValues.length == 0)
return null;
String[] msg = (String[]) catalogValues[0];
return msg;
}
private static String assembleQuery(String fieldName,
Map<String, RequestConstraint> queryTerms, Mode mode)
throws VizException {
HashMap<String, RequestConstraint> map = new HashMap<String, RequestConstraint>(
queryTerms);
if (mode == Mode.DISTINCT) {
map.put("distinctFieldName", new RequestConstraint(fieldName));
} else if (mode == Mode.MAX) {
map.put("maxName", new RequestConstraint(fieldName));
} else {
throw new IllegalArgumentException("Unsupported mode: " + mode);
}
return ScriptCreator.createScript(map, 1, "catalog");
}
public static ResponseMessageCatalog performQuery(
Collection<String> uriCollection) throws VizException {
StringBuffer uriList = new StringBuffer();
for (String dataURI : uriCollection) {
if (uriList.length() > 0) {
uriList.append(',');
}
uriList.append(dataURI);
}
Map<String, RequestConstraint> vals = new HashMap<String, RequestConstraint>();
vals.put("uriList", new RequestConstraint(uriList.toString()));
vals.put("pluginName", new RequestConstraint("satellite")); // surrogate
// value
// that gets
// the
// default
// template
String script = ScriptCreator.createScript(vals, 99999, "latestTime");
Connector value = Connector.getInstance();
System.out.println("Starting LatestTimeQuery...");
long t0 = System.currentTimeMillis();
Message response = value.connectMessage(script.toString(), null,
LATEST_TIME_QUERY_TIMEOUT);
long t = System.currentTimeMillis() - t0;
System.out.println("LatestTimeQuery took " + t + " ms");
AbstractResponseMessage[] respMessages = response.getBody()
.getResponses();
ResponseMessageCatalog rmc = null;
if (respMessages.length > 0) {
if (respMessages[0] instanceof ResponseMessageCatalog) {
rmc = (ResponseMessageCatalog) respMessages[0];
} else if (respMessages[0] instanceof ResponseMessageError) {
ResponseMessageError error = (ResponseMessageError) respMessages[0];
statusHandler.handle(
Priority.PROBLEM,
"Error retrieving latest time data ["
+ error.getErrorMsg() + "]");
} else {
statusHandler
.handle(Priority.PROBLEM,
"Error retrieving latest time data, received unhandled ResponseMessage from server ["
+ respMessages[0].getClass() + "]");
}
} else {
statusHandler
.handle(Priority.PROBLEM,
"Error retrieving latest time data, received invalid response from server");
}
return rmc;
}
/**
* Queries for available times based on the constraints
*
* @param pluginName
* the plugin to query
* @param constraintMap
* the constraints to limit the query
* @param max
* whether or not the max time should be requested, or all times
* @param binOffset
* the bin offset to apply to the returned times, or null if it's
* not applicable
* @return the available times that meet the constraints
* @throws VizException
*/
public static TimeQueryRequest getTimeQuery(
Map<String, RequestConstraint> constraintMap, boolean max,
BinOffset binOffset) throws VizException {
RequestConstraint plugin = constraintMap.get("pluginName");
if (plugin == null) {
throw new VizException("pluginName must be provided to query times");
}
String pluginName = plugin.getConstraintValue();
TimeQueryRequest req = new TimeQueryRequest();
req.setMaxQuery(max);
req.setPluginName(pluginName);
req.setBinOffset(binOffset);
req.setQueryTerms(constraintMap);
return req;
return fieldResults.length == 0 ? null : fieldResults;
}
/**
@ -252,12 +96,25 @@ public class CatalogQuery {
* @return the available times that meet the constraints
* @throws VizException
*/
@SuppressWarnings("unchecked")
public static DataTime[] performTimeQuery(
Map<String, RequestConstraint> constraintMap, boolean max,
BinOffset binOffset) throws VizException {
Object result = ThriftClient.sendRequest(getTimeQuery(constraintMap,
max, binOffset));
return ((List<DataTime>) result).toArray(new DataTime[0]);
RequestConstraint plugin = constraintMap
.get(PluginDataObject.PLUGIN_NAME_ID);
if (plugin == null) {
throw new VizException("pluginName must be provided to query times");
}
String pluginName = plugin.getConstraintValue();
TimeQueryRequest req = new TimeQueryRequest();
req.setMaxQuery(max);
req.setPluginName(pluginName);
req.setBinOffset(binOffset);
req.setQueryTerms(constraintMap);
List<?> result = (List<?>) ThriftClient.sendRequest(req);
return result.toArray(new DataTime[0]);
}
}

View file

@ -29,11 +29,13 @@ import org.apache.commons.lang.Validate;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.dataplugin.annotations.DataURIUtil;
import com.raytheon.uf.common.dataquery.requests.DbQueryRequest;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.dataquery.responses.DbQueryResponse;
import com.raytheon.uf.viz.core.catalog.LayerProperty;
import com.raytheon.uf.viz.core.catalog.ScriptCreator;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.ResourceType;
import com.raytheon.uf.viz.core.requests.ThriftClient;
/**
* Loader - Loads data from a script or LayerProperty object.
@ -53,6 +55,7 @@ import com.raytheon.uf.viz.core.rsc.ResourceType;
* Dec 03, 2007 461 bphillip Modified Time Matching to use VizTim
* Aug 19, 2009 2586 rjpeter Updated error handling.
* Jul 05, 2013 1869 bsteffen Fix goes sounding updates.
* Sep 9, 2013 2277 mschenke Got rid of LayerProperty references
* </pre>
*
* @author chammack
@ -149,8 +152,7 @@ public class Loader {
*/
public static PluginDataObject loadData(Map<String, Object> obj)
throws VizException {
LayerProperty lp = new LayerProperty();
HashMap<String, RequestConstraint> vals = new HashMap<String, RequestConstraint>();
Map<String, RequestConstraint> vals = new HashMap<String, RequestConstraint>();
if (!obj.containsKey(DATAURI_COLUMN)
|| !obj.containsKey(PLUGINNAME_COLUMN)) {
@ -165,14 +167,19 @@ public class Loader {
throw new VizException(e);
}
vals.put(PLUGINNAME_COLUMN, new RequestConstraint(obj.get(
PLUGINNAME_COLUMN).toString()));
lp.setDesiredProduct(ResourceType.PLAN_VIEW);
lp.setEntryQueryParameters(vals, false);
List<Object> resp = Loader.loadData(lp, SELECT_MODE, 60000);
if (resp.size() == 0)
vals.put(PLUGINNAME_COLUMN,
new RequestConstraint(obj.get(PLUGINNAME_COLUMN).toString()));
DbQueryRequest request = new DbQueryRequest(vals);
request.setLimit(1);
DbQueryResponse response = (DbQueryResponse) ThriftClient
.sendRequest(request);
PluginDataObject[] pdos = response
.getEntityObjects(PluginDataObject.class);
if (pdos.length == 0) {
return null;
return (PluginDataObject) resp.get(0);
}
return pdos[0];
}
/**

View file

@ -40,9 +40,10 @@ import org.apache.commons.lang.Validate;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.dataplugin.annotations.DataURIUtil;
import com.raytheon.uf.common.dataquery.requests.DbQueryRequest;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.dataquery.requests.RequestableMetadataMarshaller;
import com.raytheon.uf.common.dataquery.requests.TimeQueryRequest;
import com.raytheon.uf.common.dataquery.responses.DbQueryResponse;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
@ -51,7 +52,6 @@ import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.RecordFactory;
import com.raytheon.uf.viz.core.alerts.AbstractAlertMessageParser;
import com.raytheon.uf.viz.core.alerts.AlertMessage;
import com.raytheon.uf.viz.core.comm.Loader;
import com.raytheon.uf.viz.core.datastructure.DataCubeContainer;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.exception.NoDataAvailableException;
@ -86,6 +86,7 @@ import com.raytheon.uf.viz.core.rsc.IResourceDataChanged.ChangeType;
* Mar 29, 2013 1638 mschenke Switched to create PDO from dataURI
* mapping instead of dataURI string
* May 14, 2013 1869 bsteffen Get dataURI map directly from PDO.
* Sep 9, 2013 2277 mschenke Got rid of ScriptCreator references
*
* </pre>
*
@ -117,14 +118,22 @@ public abstract class AbstractRequestableResourceData extends
Object objectToSend = null;
Map<String, Object> attribs = new HashMap<String, Object>(
message.decodedAlert);
attribs.put("dataURI", message.dataURI);
if (reqResourceData.isUpdatingOnMetadataOnly()) {
PluginDataObject record = RecordFactory.getInstance()
.loadRecordFromMap(attribs);
objectToSend = record;
} else {
objectToSend = Loader.loadData(attribs);
DbQueryRequest request = new DbQueryRequest(
RequestConstraint.toConstraintMapping(attribs));
request.setLimit(1);
DbQueryResponse response = (DbQueryResponse) ThriftClient
.sendRequest(request);
PluginDataObject[] pdos = response
.getEntityObjects(PluginDataObject.class);
if (pdos.length > 0) {
objectToSend = pdos[0];
}
}
return objectToSend;
}

View file

@ -36,7 +36,6 @@ import com.raytheon.uf.common.dataquery.responses.DbQueryResponse;
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.catalog.CatalogQuery;
import com.raytheon.uf.viz.core.drawables.ResourcePair;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.requests.ThriftClient;
@ -85,15 +84,20 @@ public class GFEVbDataCatalog extends AbstractDataCatalog {
@Override
public IDataCatalogEntry getCatalogEntry(SelectedData selectedData) {
HashMap<String, RequestConstraint> queryList = new HashMap<String, RequestConstraint>();
queryList.put(GFEDataAccessUtil.PLUGIN_NAME, new RequestConstraint("gfe"));
Map<String, RequestConstraint> queryList = new HashMap<String, RequestConstraint>();
queryList.put(GFEDataAccessUtil.PLUGIN_NAME, new RequestConstraint(
GFERecord.PLUGIN_NAME));
queryList.putAll(getParmIdConstraint(selectedData));
try {
String[] result = CatalogQuery.performQuery(GFEDataAccessUtil.PARM_ID,
queryList);
if (result != null && result.length > 0) {
ParmID sampleId = new ParmID(result[0]);
return new GFECatalogEntry(selectedData, sampleId);
DbQueryRequest request = new DbQueryRequest(queryList);
request.addRequestField(GFEDataAccessUtil.PARM_ID);
request.setLimit(1);
DbQueryResponse response = (DbQueryResponse) ThriftClient
.sendRequest(request);
ParmID[] results = response.getFieldObjects(
GFEDataAccessUtil.PARM_ID, ParmID.class);
if (results.length > 0) {
return new GFECatalogEntry(selectedData, results[0]);
} else {
return null;
}
@ -289,23 +293,22 @@ public class GFEVbDataCatalog extends AbstractDataCatalog {
styleType = StyleManager.StyleType.ARROW;
}
sr = StyleManager.getInstance().getStyleRule(styleType,
criteria);
sr = StyleManager.getInstance().getStyleRule(styleType, criteria);
} catch (VizStyleException e) {
statusHandler
.handle(Priority.PROBLEM,
statusHandler.handle(Priority.PROBLEM,
"Unable to obtain a style rule for"
+ catalogEntry.getSelectedData()
.getUniqueKey(), e);
+ catalogEntry.getSelectedData().getUniqueKey(), e);
}
if (sr != null) {
return sr.getPreferences().getDisplayUnitLabel();
} else {
try {
return UnitFormat.getUCUMInstance().format(
GFEDataAccessUtil.getGridParmInfo(sampleId).getUnitObject());
GFEDataAccessUtil.getGridParmInfo(sampleId)
.getUnitObject());
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM,
statusHandler
.handle(Priority.PROBLEM,
"Unable to obtain a unit information for"
+ catalogEntry.getSelectedData()
.getUniqueKey(), e);
@ -314,7 +317,8 @@ public class GFEVbDataCatalog extends AbstractDataCatalog {
}
}
private Map<String, RequestConstraint> getParmIdConstraint(SelectedData selectedData) {
private Map<String, RequestConstraint> getParmIdConstraint(
SelectedData selectedData) {
String parmName = VbGFEMapping.getGfeParam(selectedData.getFieldsKey());
String parmLevel = VbGFEMapping
.getGfeLevel(selectedData.getPlanesKey());

View file

@ -20,7 +20,10 @@
package com.raytheon.uf.viz.profiler;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
@ -28,6 +31,13 @@ import javax.xml.bind.annotation.XmlType;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.profiler.ProfilerObs;
import com.raytheon.uf.common.dataplugin.profiler.dao.ProfilerDataTransform;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.pointdata.PointDataContainer;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.alerts.AlertMessage;
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.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
@ -44,6 +54,7 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 08Apr2009 2219 dhladky Initial Creation.
* 09Sep2013 2277 mschenke Got rid of ScriptCreator references
*
* </pre>
*
@ -69,6 +80,31 @@ public class ProfilerResourceData extends AbstractRequestableResourceData {
return new ProfilerResource(this, loadProperties);
}
@Override
protected PluginDataObject[] requestPluginDataObjects(
Collection<DataTime> loadSet) throws VizException {
List<String> dataTimes = new ArrayList<String>(loadSet.size());
for (DataTime time : loadSet) {
dataTimes.add(time.toString());
}
Map<String, RequestConstraint> constraints = new HashMap<String, RequestConstraint>(
getMetadataMap());
constraints.put(PluginDataObject.DATATIME_ID, new RequestConstraint(
dataTimes));
PointDataContainer pdc = DataCubeContainer.getPointData(
ProfilerObs.PLUGIN_NAME, ProfilerDataTransform.MAN_PARAMS,
constraints);
if (pdc != null) {
return ProfilerDataTransform.toProfilerRecords(pdc);
}
return null;
}
@Override
protected void update(AlertMessage... messages) {
invalidateAvailableTimesCache();
}
/**
* @return the records
*/

View file

@ -29,6 +29,7 @@ import java.util.Map.Entry;
import java.util.Set;
import com.raytheon.uf.common.comm.CommunicationException;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.level.Level;
import com.raytheon.uf.common.dataplugin.level.mapping.LevelMappingFactory;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
@ -73,7 +74,7 @@ public abstract class AbstractPointDataInventory extends AbstractInventory {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(AbstractPointDataInventory.class);
public static String PLUGIN_NAME = "pluginName";
public static String PLUGIN_NAME = PluginDataObject.PLUGIN_NAME_ID;
protected List<String> plugins;

View file

@ -28,6 +28,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.radar.RadarRecord;
import com.raytheon.uf.common.dataplugin.radar.util.RadarConstants;
import com.raytheon.uf.common.dataplugin.radar.util.RadarConstants.MapValues;
@ -45,8 +46,6 @@ import com.raytheon.uf.common.datastorage.records.LongDataRecord;
import com.raytheon.uf.common.datastorage.records.StringDataRecord;
import com.raytheon.uf.common.pointdata.PointDataContainer;
import com.raytheon.uf.viz.core.HDF5Util;
import com.raytheon.uf.viz.core.catalog.ScriptCreator;
import com.raytheon.uf.viz.core.comm.Loader;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.viz.pointdata.util.AbstractPointDataInventory;
@ -154,21 +153,19 @@ public class VwpInventory extends AbstractPointDataInventory {
List<String> baseParams = new ArrayList<String>(baseParameters);
baseParams.remove(LATITUDE);
baseParams.remove(LONGITUDE);
queryParams.put("pluginName", new RequestConstraint("radar"));
queryParams.put(PluginDataObject.PLUGIN_NAME_ID, new RequestConstraint(
RadarRecord.PLUGIN_NAME));
queryParams.put("productCode", new RequestConstraint(ProductCode));
queryParams.remove("type");
String script = ScriptCreator.createScript(queryParams, 1000, "select");
List<Object> respList = Loader.loadData(script, 60000);
RadarRecord[] records = new RadarRecord[respList.size()];
for (int i = 0; i < records.length; i++) {
if (respList.get(i) instanceof RadarRecord) {
records[i] = (RadarRecord) respList.get(i);
File loc = HDF5Util.findHDF5Location(records[i]);
DbQueryResponse response = (DbQueryResponse) ThriftClient
.sendRequest(new DbQueryRequest(queryParams));
RadarRecord[] records = response.getEntityObjects(RadarRecord.class);
for (RadarRecord record : records) {
File loc = HDF5Util.findHDF5Location(record);
IDataStore dataStore = DataStoreFactory.getDataStore(loc);
try {
RadarDataRetriever.populateRadarRecord(dataStore,
records[i]);
RadarDataRetriever.populateRadarRecord(dataStore, record);
} catch (FileNotFoundException e) {
throw new VizException(
"Error Retrieving VWP Data from Radar Record", e);
@ -177,7 +174,6 @@ public class VwpInventory extends AbstractPointDataInventory {
"Error Retrieving VWP Data from Radar Record", e);
}
}
}
Object[] vals = new Object[baseParams.size()];
for (int i = 0; i < baseParams.size(); i++) {
String parameter = baseParams.get(i);

View file

@ -103,7 +103,7 @@ import com.vividsolutions.jts.geom.Geometry;
*/
@Entity
@SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "bufruaseq")
@Table(name = "bufrua", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) })
@Table(name = UAObs.PLUGIN_NAME, uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) })
/*
* Both refTime and forecastTime are included in the refTimeIndex since
* forecastTime is unlikely to be used.
@ -850,36 +850,6 @@ public class UAObs extends PersistablePluginDataObject implements
return wmoHeader;
}
public static final void main(String[] args) {
List<UAObs> obsList = new ArrayList<UAObs>();
UAObs obsA = new UAObs();
obsA.setWmoHeader("IUSZ42 KWBC 271845 CCA");
obsList.add(obsA);
UAObs obsB = new UAObs();
obsB.setWmoHeader("IUSZ42 KWBC 271835 CCA");
obsList.add(obsB);
UAObs obs = new UAObs();
obs.setWmoHeader("IUSZ42 KWBC 271815");
obsList.add(obs);
obs = new UAObs();
obs.setWmoHeader("IUSZ42 KWBC 271825 CCA");
obsList.add(obs);
System.out.println(obsList);
obsList = sortByCorrection(obsList);
System.out.println(obsList);
int c = UAObs.getCorComparator().compare(obsA, obsB);
System.out.println(c);
UAObs test = new UAObs(
"/bufrua/2011-10-07_00:00:00.0/2022/null/IUSZ52_KWBC_070040/72634/44.90833/-84.71944");
System.out.println(test.dataURI);
}
@Override
@Column
@Access(AccessType.PROPERTY)
@ -889,6 +859,6 @@ public class UAObs extends PersistablePluginDataObject implements
@Override
public String getPluginName() {
return "bufrua";
return PLUGIN_NAME;
}
}

View file

@ -92,7 +92,7 @@ import com.raytheon.uf.common.time.TimeRange;
* Both refTime and forecastTime are included in the refTimeIndex since
* forecastTime is unlikely to be used.
*/
@org.hibernate.annotations.Table(appliesTo = "gfe", indexes = { @Index(name = "gfe_refTimeIndex", columnNames = {
@org.hibernate.annotations.Table(appliesTo = GFERecord.PLUGIN_NAME, indexes = { @Index(name = "gfe_refTimeIndex", columnNames = {
"refTime", "forecastTime" }) })
@DynamicSerialize
@BatchSize(size = 500)
@ -105,6 +105,8 @@ public class GFERecord extends PluginDataObject {
NONE, SCALAR, VECTOR, WEATHER, DISCRETE
};
public static final String PLUGIN_NAME = "gfe";
/**
* The parmID of the associated parm.<br>
*/
@ -279,6 +281,6 @@ public class GFERecord extends PluginDataObject {
@Override
public String getPluginName() {
return "gfe";
return PLUGIN_NAME;
}
}

View file

@ -94,7 +94,7 @@ import com.vividsolutions.jts.geom.Geometry;
* Both refTime and forecastTime are included in the refTimeIndex since
* forecastTime is unlikely to be used.
*/
@org.hibernate.annotations.Table(appliesTo = "profiler", indexes = { @Index(name = "profiler_refTimeIndex", columnNames = {
@org.hibernate.annotations.Table(appliesTo = ProfilerObs.PLUGIN_NAME, indexes = { @Index(name = "profiler_refTimeIndex", columnNames = {
"refTime", "forecastTime" }) })
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@ -105,6 +105,8 @@ public class ProfilerObs extends PersistablePluginDataObject implements
private static final long serialVersionUID = 1L;
public static final String PLUGIN_NAME = "profiler";
private static final HashMap<Integer, Integer> HGT_MAP = new HashMap<Integer, Integer>();
static {
HGT_MAP.put(100, 16180);
@ -700,6 +702,6 @@ public class ProfilerObs extends PersistablePluginDataObject implements
@Override
public String getPluginName() {
return "profiler";
return PLUGIN_NAME;
}
}

View file

@ -20,6 +20,7 @@
package com.raytheon.uf.common.dataplugin.profiler.dao;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@ -34,7 +35,7 @@ import com.raytheon.uf.common.pointdata.spatial.SurfaceObsLocation;
import com.raytheon.uf.edex.decodertools.time.TimeTools;
/**
* TODO Add Description
* Transforms profiler {@link PointDataContainer}s into {@link ProfilerObs}
*
* <pre>
*
@ -54,48 +55,41 @@ public class ProfilerDataTransform {
private static Log logger = LogFactory.getLog(ProfilerDataTransform.class);
public static final String[] HDR_PARAMS = new String[] { "stationId",
"profilerId", "profilerName", "validTime", "latitude", "longitude",
"elevation", "timeObs", "dataURI" };
public static final String HDR_PARAMS_LIST;
static {
StringBuffer sb = new StringBuffer();
sb.append("stationId,");
sb.append("profilerId,");
sb.append("profilerName,");
sb.append("validTime,");
sb.append("latitude,");
sb.append("longitude,");
sb.append("elevation,");
sb.append("timeObs,");
sb.append("dataURI,");
for (int i = 0; i < HDR_PARAMS.length - 1; ++i) {
sb.append(HDR_PARAMS[i]).append(",");
}
sb.append(HDR_PARAMS[HDR_PARAMS.length - 1]);
HDR_PARAMS_LIST = sb.toString();
}
private static final String[] OTHER_PARAMS = new String[] { "windSpeedSfc",
"windDirSfc", "pressure", "temperature", "rainRate", "relHumidity",
"submode", "numProfLvls", "height", "uComponent", "vComponent",
"HorizSpStdDev", "wComponent", "VertSpStdDev", "peakPower",
"levelMode", "uvQualityCode", "consensusNum" };
public static final String[] MAN_PARAMS = Arrays.copyOf(HDR_PARAMS,
HDR_PARAMS.length + OTHER_PARAMS.length);
public static final String MAN_PARAMS_LIST;
static {
StringBuffer sb = new StringBuffer();
sb.append(HDR_PARAMS_LIST);
sb.append("windSpeedSfc,");
sb.append("windDirSfc,");
sb.append("pressure,");
sb.append("temperature,");
sb.append("rainRate,");
sb.append("relHumidity,");
sb.append("submode,");
//-------------------------
sb.append("numProfLvls,");
sb.append("height,");
sb.append("uComponent,");
sb.append("vComponent,");
sb.append("HorizSpStdDev,");
sb.append("wComponent,");
sb.append("VertSpStdDev,");
sb.append(HDR_PARAMS_LIST).append(",");
for (int i = 0; i < OTHER_PARAMS.length - 1; ++i) {
sb.append(OTHER_PARAMS[i]).append(",");
MAN_PARAMS[HDR_PARAMS.length + i] = OTHER_PARAMS[i];
}
sb.append(OTHER_PARAMS[OTHER_PARAMS.length - 1]);
MAN_PARAMS[MAN_PARAMS.length - 1] = OTHER_PARAMS[OTHER_PARAMS.length - 1];
sb.append("peakPower,");
sb.append("levelMode,");
sb.append("uvQualityCode,");
sb.append("consensusNum,");
//-------------------------
MAN_PARAMS_LIST = sb.toString();
}
@ -125,13 +119,12 @@ public class ProfilerDataTransform {
return obs;
}
private static ProfilerObs getProfilerData(PointDataView pdv, ProfilerObs profile) {
if(profile != null) {
private static ProfilerObs getProfilerData(PointDataView pdv,
ProfilerObs profile) {
if (profile != null) {
profile.setSfcWindDir(pdv.getNumber("windDirSfc").doubleValue());
profile.setSfcWindSpeed(pdv.getNumber("windSpeedSfc").doubleValue());
Number[] h = pdv.getNumberAllLevels("height");
Number[] uWind = pdv.getNumberAllLevels("uComponent");
Number[] vWind = pdv.getNumberAllLevels("vComponent");
@ -155,13 +148,12 @@ public class ProfilerDataTransform {
return profile;
}
/**
*
* @param container
* @return
*/
public static ProfilerObs [] toProfilerRecords(PointDataContainer container) {
public static ProfilerObs[] toProfilerRecords(PointDataContainer container) {
List<ProfilerObs> records = new ArrayList<ProfilerObs>();
container.setCurrentSz(container.getAllocatedSz());
@ -169,8 +161,8 @@ public class ProfilerDataTransform {
PointDataView pdv = container.readRandom(i);
ProfilerObs obs = getProfilerObsHdr(pdv);
obs = getProfilerData(pdv,obs);
if(obs != null) {
obs = getProfilerData(pdv, obs);
if (obs != null) {
records.add(obs);
}
}

View file

@ -147,7 +147,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Both refTime and forecastTime are included in the refTimeIndex since
* forecastTime is unlikely to be used.
*/
@org.hibernate.annotations.Table(appliesTo = "radar", indexes = { @Index(name = "radar_refTimeIndex", columnNames = {
@org.hibernate.annotations.Table(appliesTo = RadarRecord.PLUGIN_NAME, indexes = { @Index(name = "radar_refTimeIndex", columnNames = {
"refTime", "forecastTime" }) })
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@ -157,6 +157,8 @@ public class RadarRecord extends PersistablePluginDataObject implements
private static final long serialVersionUID = 1L;
public static final String PLUGIN_NAME = "radar";
@Column
@DataURI(position = 2)
@DynamicSerializeElement
@ -1754,6 +1756,6 @@ public class RadarRecord extends PersistablePluginDataObject implements
@Override
public String getPluginName() {
return "radar";
return PLUGIN_NAME;
}
}