From e62a756cbc1ebf2e30562c522b76294de0a513a0 Mon Sep 17 00:00:00 2001 From: Nate Jensen Date: Mon, 11 Nov 2013 15:03:19 -0600 Subject: [PATCH] Issue #2361 undo earlier changes that potentially break uengine based local apps Change-Id: Ie3b4cfadc97bd5a95d48986bfae40ad193450d65 Former-commit-id: cf88b536e0c7890410318b17176863068a29bae5 [formerly bb93c18e7daf7dc7d1432757e761388dd6068a89] [formerly 8628b7755e19f964f06ca65f590efb9a0a72f594] [formerly a2935193b50a23109b39e8306d0aa99c3ba98cff [formerly 8628b7755e19f964f06ca65f590efb9a0a72f594 [formerly 110cff66bb2cf847730562570a9415851e0362c2]]] Former-commit-id: a2935193b50a23109b39e8306d0aa99c3ba98cff Former-commit-id: 32cf218a7d8218d000be9f55fd45198a966abf60 [formerly 9dc69e316f9a205f15765d3bf10283c714a2978b] Former-commit-id: e1138809e750970ba962f786649af22d374a6d80 --- ...f.common.serialization.ISerializableObject | 2 + .../uf/common/dataplugin/bufrua/UAObs.java | 269 +++++++++++++++++- .../common/dataplugin/bufrua/UAObsLevel.java | 18 +- ...f.common.serialization.ISerializableObject | 1 + .../dataplugin/fssobs/FSSObsRecord.java | 193 +++++++++++-- ...f.common.serialization.ISerializableObject | 2 + .../dataplugin/profiler/ProfilerLevel.java | 22 +- .../dataplugin/profiler/ProfilerObs.java | 114 +++++++- ...f.common.serialization.ISerializableObject | 8 + .../uf/common/pointdata/Dimension.java | 4 +- .../pointdata/ParameterDescription.java | 3 +- .../common/pointdata/PointDataContainer.java | 70 ++++- .../pointdata/PointDataSerializable.java | 60 ++++ .../elements/AbstractPointDataObject.java | 11 +- .../elements/FloatPointDataObject.java | 9 +- .../elements/IntPointDataObject.java | 10 +- .../elements/LongPointDataObject.java | 10 +- .../elements/StringPointDataObject.java | 10 +- 18 files changed, 768 insertions(+), 48 deletions(-) create mode 100644 edexOsgi/com.raytheon.uf.common.dataplugin.bufrua/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject create mode 100644 edexOsgi/com.raytheon.uf.common.dataplugin.fssobs/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject create mode 100644 edexOsgi/com.raytheon.uf.common.dataplugin.profiler/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject create mode 100644 edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/PointDataSerializable.java diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.bufrua/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject b/edexOsgi/com.raytheon.uf.common.dataplugin.bufrua/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject new file mode 100644 index 0000000000..04aaf6ed76 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.bufrua/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject @@ -0,0 +1,2 @@ +com.raytheon.uf.common.dataplugin.bufrua.UAObs +com.raytheon.uf.common.dataplugin.bufrua.UAObsLevel diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.bufrua/src/com/raytheon/uf/common/dataplugin/bufrua/UAObs.java b/edexOsgi/com.raytheon.uf.common.dataplugin.bufrua/src/com/raytheon/uf/common/dataplugin/bufrua/UAObs.java index 09c4ef931e..afc74a7de2 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.bufrua/src/com/raytheon/uf/common/dataplugin/bufrua/UAObs.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.bufrua/src/com/raytheon/uf/common/dataplugin/bufrua/UAObs.java @@ -20,10 +20,21 @@ package com.raytheon.uf.common.dataplugin.bufrua; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.Comparator; +import java.util.HashMap; import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import javax.measure.quantity.Angle; +import javax.measure.quantity.Length; +import javax.measure.quantity.Temperature; +import javax.measure.quantity.Velocity; +import javax.measure.unit.NonSI; +import javax.measure.unit.SI; +import javax.measure.unit.Unit; import javax.persistence.Access; import javax.persistence.AccessType; import javax.persistence.Column; @@ -33,9 +44,15 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Transient; import javax.persistence.UniqueConstraint; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; import org.hibernate.annotations.Index; +import com.raytheon.uf.common.dataplugin.IDecoderGettable; import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.annotations.DataURI; import com.raytheon.uf.common.dataplugin.persist.IPersistable; @@ -46,6 +63,7 @@ import com.raytheon.uf.common.pointdata.PointDataView; import com.raytheon.uf.common.pointdata.spatial.SurfaceObsLocation; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; +import com.raytheon.uf.edex.decodertools.core.IDecoderConstants; import com.vividsolutions.jts.geom.Geometry; /** @@ -77,7 +95,6 @@ import com.vividsolutions.jts.geom.Geometry; * Jul 19, 2013 1992 bsteffen Remove redundant time columns from * bufrua. * Aug 30, 2013 2298 rjpeter Make getPluginName abstract - * Oct 22, 2013 2361 njensen Remove XML annotations and IDecoderGettable * * * @@ -93,9 +110,11 @@ import com.vividsolutions.jts.geom.Geometry; */ @org.hibernate.annotations.Table(appliesTo = UAObs.PLUGIN_NAME, indexes = { @Index(name = "bufrua_refTimeIndex", columnNames = { "refTime", "forecastTime" }) }) +@XmlRootElement +@XmlAccessorType(XmlAccessType.NONE) @DynamicSerialize public class UAObs extends PersistablePluginDataObject implements - ISpatialEnabled, IPointData, IPersistable { + ISpatialEnabled, IDecoderGettable, IPointData, IPersistable { private static final long serialVersionUID = 1L; @@ -120,6 +139,33 @@ public class UAObs extends PersistablePluginDataObject implements public static final String PLUGIN_NAME = "bufrua"; + public static final Unit DISTANCE_UNIT = SI.METER; + + public static final Unit TEMPERATURE_UNIT = SI.KELVIN; + + public static final Unit WIND_SPEED_UNIT = SI.METERS_PER_SECOND; + + public static final Unit WIND_DIR_UNIT = NonSI.DEGREE_ANGLE; + + public static final Unit LOCATION_UNIT = NonSI.DEGREE_ANGLE; + + private static final HashMap PARM_MAP = new HashMap(); + static { + PARM_MAP.put("GH", UA_GEOHGT); + PARM_MAP.put("Px", UA_PRESSURE); + + PARM_MAP.put("T", SFC_TEMP); + PARM_MAP.put("DpT", SFC_DWPT); + + PARM_MAP.put("WS", SFC_WNDSPD); + PARM_MAP.put("WD", SFC_WNDDIR); + + PARM_MAP.put("NLAT", STA_LAT); + PARM_MAP.put("NLON", STA_LON); + } + + public static final String UA_PARAM_PTRN = ".*:PRESS=\\d{2,4}"; + // Non persisted value. Hold the last requested parameter name. @Transient private String parameterName = null; @@ -131,17 +177,20 @@ public class UAObs extends PersistablePluginDataObject implements // The observation report type. @DataURI(position = 1) @Column + @XmlAttribute @DynamicSerializeElement private Integer reportType; @Embedded @DataURI(position = 4, embedded = true) + @XmlElement @DynamicSerializeElement private SurfaceObsLocation location; // Correction indicator from wmo header @DataURI(position = 2) @Column + @XmlAttribute @DynamicSerializeElement private String corIndicator; @@ -152,40 +201,48 @@ public class UAObs extends PersistablePluginDataObject implements // Text of the WMO header @DataURI(position = 3) @Column + @XmlAttribute @DynamicSerializeElement private String wmoHeader; // Station pressure in Pascals. @Column + @XmlAttribute @DynamicSerializeElement private Integer pressure_station; // The total cloud cover in 1/8s coverage. @Column + @XmlAttribute @DynamicSerializeElement private Integer totalCloudCover; // The platform directio in angular degrees. @Column + @XmlAttribute @DynamicSerializeElement private Integer platformDirection; // The platform movement in meters per second. @Column + @XmlAttribute @DynamicSerializeElement private Double platformMovement; // ICAO of station if known. @Column + @XmlAttribute @DynamicSerializeElement private String stationName; // The level data for this observation. @Transient + @XmlElement @DynamicSerializeElement private List levels; @Column(insertable = false, updatable = false) + @XmlAttribute @DynamicSerializeElement private Integer idx; @@ -486,6 +543,16 @@ public class UAObs extends PersistablePluginDataObject implements identifier = dataURI; } + /** + * Get the IDecoderGettable reference for this record. + * + * @return The IDecoderGettable reference for this record. + */ + @Override + public IDecoderGettable getDecoderGettable() { + return this; + } + /** * */ @@ -502,6 +569,203 @@ public class UAObs extends PersistablePluginDataObject implements this.pointDataView = pointDataView; } + /** + * Get the value of a parameter that is represented as a String. + * + * @param paramName + * The name of the parameter value to retrieve. + * @return The String value of the parameter. If the parameter is unknown, a + * null reference is returned. + */ + @Override + public String getString(String paramName) { + if ("STA".matches(paramName)) { + return this.getStationId(); + } + return null; + } + + /** + * Get the value and units of a named parameter within this observation. The + * parameter name may include level information for these observation data. + * The format for parameter is: + * + *
+     *    "parameterName" may be one of 
+     *        "GH"  geopotential height
+     *        "Px"  pressure
+     *        "T"   temperature
+     *        "DpT" dewpoint
+     *        "WS"  wind speed
+     *        "WD"  wind direction
+     *    followed by a level specification ":PRESS=xxxx" where xxxx is a level
+     *    in hPa (millibars). To retrieve the temperature from the 850hPa level
+     *    use the following getValue("T:PRESS=850");
+     *    
+     *    Some data is specific to the observation, latitude/longitude for
+     *    example. These data may be retrieved using the parameter minus any level
+     *    information as follows
+     *    "NLAT"  station latitude
+     *    "NLON"  station longitude
+     * 
+ * + * If the sounding data defines a surface level, and a request for a level + * below surface is requested, a null value is returned. + * + * @param paramName + * The name of the parameter value to retrieve. + * @return An Amount with value and units. If the parameter is unknown, a + * null reference is returned. + */ + @Override + public Amount getValue(String paramName) { + Amount a = null; + + if (parseParameter(paramName)) { + String pName = PARM_MAP.get(parameterName); + if ((pName != null) && (levels != null) && (levels.size() > 0)) { + + UAObsLevel obsLevel = getLevel(levelId); + if (obsLevel != null) { + Integer iValue = null; + Double dValue = null; + if (UA_GEOHGT.equals(pName)) { + iValue = obsLevel.getGeoHeight(); + if (iValue != null) { + a = new Amount(iValue, DISTANCE_UNIT); + } + } else if (SFC_TEMP.equals(pName)) { + dValue = obsLevel.getTemp(); + if (dValue != null) { + a = new Amount(dValue, TEMPERATURE_UNIT); + } + } else if (SFC_DWPT.equals(pName)) { + dValue = obsLevel.getDwpt(); + if (dValue != null) { + a = new Amount(dValue, TEMPERATURE_UNIT); + } + } else if (SFC_WNDSPD.equals(pName)) { + dValue = obsLevel.getWindSpeed(); + if (dValue != null) { + a = new Amount(dValue, WIND_SPEED_UNIT); + } + } else if (SFC_WNDDIR.equals(pName)) { + iValue = obsLevel.getWindDirection(); + if (iValue != null) { + a = new Amount(iValue, WIND_DIR_UNIT); + } + } + } + } + } else { + // Assume we are trying to get an observation attribute. + String pName = PARM_MAP.get(paramName); + if (STA_LAT.equals(pName)) { + a = new Amount(this.getLatitude(), LOCATION_UNIT); + } else if (STA_LON.equals(pName)) { + a = new Amount(this.getLongitude(), LOCATION_UNIT); + } + } + return a; + } + + /** + * Get the value of a parameter that is represented as a String. + * + * @param paramName + * The name of the parameter value to retrieve. + * @return The String value of the parameter. If the parameter is unknown, a + * null reference is returned. + */ + @Override + public Collection getValues(String paramName) { + return null; + } + + /** + * Determine if the parameter is a level request, and parse out the pressure + * level and parameter name if so. + * + * @param parameter + * The parameter string to parse. + * @return This is a level parameter. + */ + private boolean parseParameter(String parameter) { + boolean goodParse = false; + Pattern p = Pattern.compile(UA_PARAM_PTRN); + Matcher m = p.matcher(parameter); + if (m.find()) { + int start = parameter.indexOf(":PRESS="); + if (start > 0) { + parameterName = parameter.substring(0, start); + start += ":PRESS=".length(); + levelId = Integer.parseInt(parameter.substring(start)); + } + goodParse = true; + } + return goodParse; + } + + /** + * Get a specified pressure level data if it exists. If the specified level + * is below the declared surface pressure a null reference is returned. + * + * @param level + * A pressure level to get. + * @return The requested level, if found, null reference if not. + */ + private UAObsLevel getLevel(Integer level) { + UAObsLevel retValue = null; + if (level != null) { + level = level * 100; + for (UAObsLevel l : levels) { + if (IDecoderConstants.MANPRE_LEVEL.equals(l.getVertSig()) + || IDecoderConstants.SIGPRE_LEVEL + .equals(l.getVertSig())) { + + if (level.equals(l.getPressure())) { + retValue = l; + break; + } + } + } + } + if (retValue != null) { + UAObsLevel sfc = getSurfaceLevel(); + if (sfc != null) { + if (LayerTools.isLowerThan(sfc, retValue)) { + retValue = null; + } + } + } + return retValue; + } + + /** + * Get the defined surface level. If a surface level cannot be found, then + * return null. + * + * @return The surface level found, or null. + */ + private UAObsLevel getSurfaceLevel() { + UAObsLevel retValue = null; + if (levels != null) { + for (UAObsLevel level : levels) { + if (IDecoderConstants.SFC_LEVEL.equals(level.getVertSig())) { + retValue = level; + break; + } + } + } + return retValue; + } + + @Override + public String[] getStrings(String paramName) { + // TODO Auto-generated method stub + return null; + } + @Override public SurfaceObsLocation getSpatialObject() { return location; @@ -586,6 +850,7 @@ public class UAObs extends PersistablePluginDataObject implements return wmoHeader; } + @Override @Column @Access(AccessType.PROPERTY) diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.bufrua/src/com/raytheon/uf/common/dataplugin/bufrua/UAObsLevel.java b/edexOsgi/com.raytheon.uf.common.dataplugin.bufrua/src/com/raytheon/uf/common/dataplugin/bufrua/UAObsLevel.java index 533e285222..2c2fbf5945 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.bufrua/src/com/raytheon/uf/common/dataplugin/bufrua/UAObsLevel.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.bufrua/src/com/raytheon/uf/common/dataplugin/bufrua/UAObsLevel.java @@ -21,6 +21,11 @@ package com.raytheon.uf.common.dataplugin.bufrua; import java.io.Serializable; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; + +import com.raytheon.uf.common.serialization.ISerializableObject; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; @@ -37,14 +42,14 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; * ------------ ---------- ----------- -------------------------- * 20071127 382 jkorman Initial Coding. * 20080630 1215 jkorman Implemented Serializable. - * 20131022 2361 njensen Remove XML annotations * * * @author jkorman * @version 1.0 */ +@XmlAccessorType(XmlAccessType.NONE) @DynamicSerialize -public class UAObsLevel implements Serializable { +public class UAObsLevel implements Serializable, ISerializableObject { private static final long serialVersionUID = 1L; @@ -58,41 +63,50 @@ public class UAObsLevel implements Serializable { // 5 Significant level, temperature and/or relative humidity // 6 Significant level, wind // All 7 Missing value + @XmlAttribute @DynamicSerializeElement private Integer vertSig = null; // Observation pressure in Pascals + @XmlAttribute @DynamicSerializeElement private Integer pressure = null; // Observation geopotential height in meters. + @XmlAttribute @DynamicSerializeElement private Integer geoHeight = null; // Observation dry air temperature in degrees Kelvin. + @XmlAttribute @DynamicSerializeElement private Double temp = null; // Observation dewpoint temperature in degrees Kelvin. + @XmlAttribute @DynamicSerializeElement private Double dwpt = null; // Observation wind direction in angular degrees. Integer + @XmlAttribute @DynamicSerializeElement private Integer windDirection = null; // Observation wind speed in meters per second. // Decimal(5,2) + @XmlAttribute @DynamicSerializeElement private Double windSpeed = null; // Observation 1 KM below level wind shear in meters per second. // Decimal(5,2) + @XmlAttribute @DynamicSerializeElement private Double loShear = null; // Observation 1 KM above level wind shear in meters per second. // Decimal(5,2) + @XmlAttribute @DynamicSerializeElement private Double hiShear = null; diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.fssobs/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject b/edexOsgi/com.raytheon.uf.common.dataplugin.fssobs/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject new file mode 100644 index 0000000000..fe04b603fc --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.fssobs/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject @@ -0,0 +1 @@ +com.raytheon.uf.common.dataplugin.fssobs.FSSObsRecord diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.fssobs/src/com/raytheon/uf/common/dataplugin/fssobs/FSSObsRecord.java b/edexOsgi/com.raytheon.uf.common.dataplugin.fssobs/src/com/raytheon/uf/common/dataplugin/fssobs/FSSObsRecord.java index 9157348555..1726596ce6 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.fssobs/src/com/raytheon/uf/common/dataplugin/fssobs/FSSObsRecord.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.fssobs/src/com/raytheon/uf/common/dataplugin/fssobs/FSSObsRecord.java @@ -1,7 +1,18 @@ package com.raytheon.uf.common.dataplugin.fssobs; import java.util.Calendar; +import java.util.Collection; +import java.util.HashMap; +import javax.measure.quantity.Angle; +import javax.measure.quantity.DataAmount; +import javax.measure.quantity.Length; +import javax.measure.quantity.Pressure; +import javax.measure.quantity.Temperature; +import javax.measure.quantity.Velocity; +import javax.measure.unit.NonSI; +import javax.measure.unit.SI; +import javax.measure.unit.Unit; import javax.persistence.Access; import javax.persistence.AccessType; import javax.persistence.Column; @@ -11,9 +22,14 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Transient; import javax.persistence.UniqueConstraint; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; import org.hibernate.annotations.Index; +import com.raytheon.uf.common.dataplugin.IDecoderGettable; import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.annotations.DataURI; import com.raytheon.uf.common.dataplugin.persist.IPersistable; @@ -26,24 +42,6 @@ import com.raytheon.uf.common.pointdata.spatial.SurfaceObsLocation; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; -/** - * Fog, Safeseas, Snow Observation record - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Dec 13, 2010            skorolev    Initial creation
- * Oct 14, 2013 2361       njensen     Removed XML annotations and IDecoderGettable
- * 
- * 
- * - * @author njensen - * @version 1.0 - */ - @Entity @SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "fssobsseq") @Table(name = FSSObsRecord.PLUGIN_NAME, uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) }) @@ -53,23 +51,69 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; */ @org.hibernate.annotations.Table(appliesTo = FSSObsRecord.PLUGIN_NAME, indexes = { @Index(name = "fssobs_refTimeIndex", columnNames = { "refTime", "forecastTime" }) }) +@XmlRootElement +@XmlAccessorType(XmlAccessType.NONE) @DynamicSerialize public class FSSObsRecord extends PersistablePluginDataObject implements - ISpatialEnabled, IPersistable, IPointData { + ISpatialEnabled, IDecoderGettable, IPersistable, IPointData { private static final long serialVersionUID = 1L; public static final String PLUGIN_NAME = "fssobs"; + private static final int MISSING = -9999; + + // UNITS + + public static final Unit TEMPERATURE_UNIT = SI.CELSIUS; + + public static final Unit WIND_SPEED_UNIT = NonSI.KNOT; + + public static final Unit HEIGHT_UNIT = SI.METER; + + public static final Unit WIND_DIR_UNIT = NonSI.DEGREE_ANGLE; + + public static final Unit LOCATION_UNIT = NonSI.DEGREE_ANGLE; + + public static final Unit PRESSURE_UNIT = SI.HECTO(SI.PASCAL); + + public static final Unit PRECIP_UNIT = NonSI.INCH; + + public static final Unit WAVE_UNIT = SI.METER; + + public static final Unit VISIBILITY_UNIT = NonSI.MILE; + + public static final Unit CLOUD_COVER = NonSI.OCTET; + + /** Metar specific parameter keys */ + public static final class ParameterKey { + public static final String SFC_ALTIMETER = "SFC.PRESS.ALTIMETER"; + + public static final String PRESSURE_CHANGE = "PCHNG"; + + public static final String VISIBILITY = "VIS"; + + public static final String PRECIPITATION_1HR = "PR1HR"; + } + + private static final HashMap PARM_MAP = new HashMap(); + static { + PARM_MAP.put("NLAT", STA_LAT); + PARM_MAP.put("NLON", STA_LON); + PARM_MAP.put("rawMessage", "rawMessage"); + } + /** is feature new **/ @Transient @DynamicSerializeElement + @XmlElement public boolean isNew = true; // Current CWA (WFO) @Column @DataURI(position = 2) @DynamicSerializeElement + @XmlElement(nillable = false) private String cwa; // Monitor which should use this station record @@ -79,15 +123,18 @@ public class FSSObsRecord extends PersistablePluginDataObject implements @Column @DataURI(position = 4) @DynamicSerializeElement + @XmlElement private String monitorUse = ""; // Station name @Column @DynamicSerializeElement + @XmlElement private String stnName; /* From ============ObReport================= */ + @XmlElement @DynamicSerializeElement @Column @DataURI(position = 1) @@ -95,25 +142,30 @@ public class FSSObsRecord extends PersistablePluginDataObject implements @Embedded @DataURI(position = 3, embedded = true) + @XmlElement @DynamicSerializeElement private SurfaceObsLocation location; // Observing platform identifier (same as stationID) @Transient + @XmlElement @DynamicSerializeElement private String platformId; // Indicator of whether observing platform is stationary @Transient @DynamicSerializeElement + @XmlElement private boolean isStationary; // Actual time of the observation @Transient @DynamicSerializeElement + @XmlElement private Calendar timeObs; // Time of the observation to the nearest hour. + @XmlElement @DynamicSerializeElement @Column private Calendar refHour; @@ -121,178 +173,214 @@ public class FSSObsRecord extends PersistablePluginDataObject implements // Raw message @Transient @DynamicSerializeElement + @XmlElement private String rawMessage; // Observed wind speed in knots @Transient @DynamicSerializeElement + @XmlElement private float windSpeed = -9999;; // Wind gust in knots @Transient @DynamicSerializeElement + @XmlElement private float windGust = -9999;; // Observed maximum wind speed in knots @Transient @DynamicSerializeElement + @XmlElement private float maxWindSpeed = -9999; // Observed wind direction in azimuth degrees @Transient @DynamicSerializeElement + @XmlElement private float windDir; // Observed wind chill in Fahrenheit @Transient @DynamicSerializeElement + @XmlElement private float windChill = -9999; // Observed high resolution wave height in @Transient @DynamicSerializeElement + @XmlElement private float highResWaveHeight = -9999; // Observed wave steepness in seconds ??? None @Transient @DynamicSerializeElement + @XmlElement private float waveSteepness = -9999; // Observed visibility in Statute miles @Transient @DynamicSerializeElement + @XmlElement private float visibility = -9999; // Observed visibility in meters for Maritime obs. @Transient @DynamicSerializeElement + @XmlElement private float horzVisibility = -9999; // Observed temperature in degrees in Farenheit @Transient @DynamicSerializeElement + @XmlElement private float temperature = -9999; // in feet @Transient + @XmlElement @DynamicSerializeElement private Double waveHeight = -9999.0; // in seconds @Transient + @XmlElement @DynamicSerializeElement private Integer wavePeriod = -9999; // in Azimuth degrees @Transient + @XmlElement @DynamicSerializeElement private Double primarySwellWaveDir = -9999.0; // in seconds @Transient + @XmlElement @DynamicSerializeElement private Integer primarySwellWavePeriod = -9999; // in feet @Transient + @XmlElement @DynamicSerializeElement private Double primarySwellWaveHeight = -9999.0; // in Azimuth degrees @Transient + @XmlElement @DynamicSerializeElement private Double secondarySwellWaveDir = -9999.0; // in seconds @Transient + @XmlElement @DynamicSerializeElement private Integer secondarySwellWavePeriod = -9999; // in feet @Transient + @XmlElement @DynamicSerializeElement private Double secondarySwellWaveHeight = -9999.0; // Three-hour pressure change in thousandths of an inch of mercury ???? @Transient @DynamicSerializeElement + @XmlElement private float pressChange3Hour = -9999f; // Pressure change character for metar plot model /** A string denoting the pressure tendency(rising or falling) */ @Transient @DynamicSerializeElement + @XmlElement private String pressChangeChar; // Observed dewpoint in degrees Farenheit @Transient @DynamicSerializeElement + @XmlElement private float dewpoint = -9999f; // Observed sea surface temperature in degrees in Farenheit @Transient @DynamicSerializeElement + @XmlElement private float seaSurfaceTemp = -9999f; // the sea level pressure in hPa + @XmlElement @DynamicSerializeElement @Transient private float seaLevelPress = -9999f; // Altimeter setting in mm Hg. @Transient + @XmlElement @DynamicSerializeElement private float pressureAltimeter = -9999f; // Observed hourly precipitation in inches @Transient @DynamicSerializeElement + @XmlElement private float hourlyPrecip = -9999f; // Observed snow depth in inch @Transient @DynamicSerializeElement + @XmlElement private float snowDepth = -9999f; // Observed snow increasing rapidly, hourly total in inches @Transient @DynamicSerializeElement + @XmlElement private float snincrHourly = -9999f; // Observed snow increasing rapidly, total in inches @Transient @DynamicSerializeElement + @XmlElement private float snincrTotal = -9999f; // Observed frostbite time in minutes @Transient @DynamicSerializeElement + @XmlElement private float frostbiteTime; // present weather conditions for metar plot model @Transient @DynamicSerializeElement + @XmlElement private String[] presWeather; // Observed relative humidity in percent @Transient @DynamicSerializeElement + @XmlElement private float relativeHumidity = -9999f; // Observed ceiling in feet above ground level @Transient @DynamicSerializeElement + @XmlElement private float ceiling = -9999f; // Observed dewpoint depression in Farenheit @Transient @DynamicSerializeElement + @XmlElement private float dewpointDepr = -9999f; + @XmlElement @DynamicSerializeElement @Transient private String[] skyCover; + @XmlElement @DynamicSerializeElement @Transient private int totCloudAmount = -9999; @@ -309,6 +397,58 @@ public class FSSObsRecord extends PersistablePluginDataObject implements super(uri); } + @Override + public IDecoderGettable getDecoderGettable() { + return null; + } + + @Override + public Amount getValue(String paramName) { + Amount a = null; + + String pName = PARM_MAP.get(paramName); + + if (SFC_TEMP.equals(pName) && (temperature != -9999f)) { + a = new Amount(temperature, TEMPERATURE_UNIT); + } else if (SFC_DWPT.equals(pName) && (dewpoint != -9999f)) { + a = new Amount(dewpoint, TEMPERATURE_UNIT); + } else if (SFC_WNDSPD.equals(pName) && (windSpeed != -9999f)) { + a = new Amount(windSpeed, WIND_SPEED_UNIT); + } else if (SFC_WNDDIR.equals(pName) && (windDir != -9999f)) { + a = new Amount(windDir, WIND_DIR_UNIT); + } else if (SFC_WNDGST.equals(pName) && (windGust != -9999f)) { + a = new Amount(windGust, WIND_SPEED_UNIT); + } else if (PRES_SLP.equals(pName) && (seaLevelPress != -9999f)) { + a = new Amount(seaLevelPress, PRESSURE_UNIT); + // } else if (PRES_ALTSG.equals(pName) && (pressureAltimeter != + // -9999f)) { + // a = new Amount(pressureAltimeter, PRESSURE_UNIT); + } else if (STA_LAT.equals(pName)) { + a = new Amount(this.getLatitude(), LOCATION_UNIT); + } else if (STA_LON.equals(pName)) { + a = new Amount(this.getLongitude(), LOCATION_UNIT); + } else if ("WT".equals(pName) && (this.seaSurfaceTemp != -9999f)) { + a = new Amount(this.seaSurfaceTemp, TEMPERATURE_UNIT); + } else if ("WH".equals(pName)) { + a = new Amount(waveHeight, WAVE_UNIT); + } else if ("SWP".equals(pName)) { + a = new Amount(primarySwellWavePeriod, WAVE_UNIT); + } else if ("SWH".equals(pName)) { + a = new Amount(primarySwellWaveHeight, WAVE_UNIT); + // } else if ("PCHNG".equals(pName) && pressChange3Hour != MISSING) + // { + // a = new Amount(pressChange3Hour, PRESSURE_UNIT); + } else if ("PKWND".equals(paramName) && (maxWindSpeed != MISSING)) { + a = new Amount(maxWindSpeed, WIND_SPEED_UNIT); + } else if ("SWS".equals(paramName) || "SWGS".equals(paramName)) { + a = new Amount(1, WIND_SPEED_UNIT); + } else if ("SWD".equals(paramName) && (primarySwellWaveDir != MISSING)) { + a = new Amount(primarySwellWaveDir, WIND_DIR_UNIT); + } + + return a; + } + /** * @return the isNew */ @@ -1032,6 +1172,21 @@ public class FSSObsRecord extends PersistablePluginDataObject implements return totCloudAmount; } + @Override + public Collection getValues(String paramName) { + return null; + } + + @Override + public String getString(String paramName) { + return null; + } + + @Override + public String[] getStrings(String paramName) { + return null; + } + @Override public ISpatialObject getSpatialObject() { return location; diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.profiler/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject b/edexOsgi/com.raytheon.uf.common.dataplugin.profiler/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject new file mode 100644 index 0000000000..4c1ba1c6d2 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.profiler/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject @@ -0,0 +1,2 @@ +com.raytheon.uf.common.dataplugin.profiler.ProfilerObs +com.raytheon.uf.common.dataplugin.profiler.ProfilerLevel \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.profiler/src/com/raytheon/uf/common/dataplugin/profiler/ProfilerLevel.java b/edexOsgi/com.raytheon.uf.common.dataplugin.profiler/src/com/raytheon/uf/common/dataplugin/profiler/ProfilerLevel.java index 3991f64ae6..8eaaa8413d 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.profiler/src/com/raytheon/uf/common/dataplugin/profiler/ProfilerLevel.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.profiler/src/com/raytheon/uf/common/dataplugin/profiler/ProfilerLevel.java @@ -21,6 +21,11 @@ package com.raytheon.uf.common.dataplugin.profiler; import java.io.Serializable; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; + +import com.raytheon.uf.common.serialization.ISerializableObject; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; @@ -32,7 +37,6 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 20080303 969 jkorman Initial implementation. - * Oct 15, 2013 2361 njensen Remove XML annotations * * * @@ -40,41 +44,53 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; * @version 1.0 */ @DynamicSerialize -public class ProfilerLevel implements Serializable, Comparable { +@XmlAccessorType(XmlAccessType.NONE) +public class ProfilerLevel implements Serializable, ISerializableObject, Comparable { private static final long serialVersionUID = 1L; @DynamicSerializeElement + @XmlAttribute private Integer modeInfo; @DynamicSerializeElement + @XmlAttribute private Integer levelQualCode; @DynamicSerializeElement + @XmlAttribute private Double peakPower; @DynamicSerializeElement + @XmlAttribute private Integer levelHeight; @DynamicSerializeElement + @XmlAttribute private Double ucWind; @DynamicSerializeElement + @XmlAttribute private Double vcWind; @DynamicSerializeElement + @XmlAttribute private Double horzStdDev; @DynamicSerializeElement + @XmlAttribute private Integer horzConsensus; @DynamicSerializeElement + @XmlAttribute private Double wcWind; @DynamicSerializeElement + @XmlAttribute private Double vertStdDev; @DynamicSerializeElement + @XmlAttribute private Integer vertConsensus; /** @@ -323,5 +339,5 @@ public class ProfilerLevel implements Serializable, Comparable { } return result; } - + } diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.profiler/src/com/raytheon/uf/common/dataplugin/profiler/ProfilerObs.java b/edexOsgi/com.raytheon.uf.common.dataplugin.profiler/src/com/raytheon/uf/common/dataplugin/profiler/ProfilerObs.java index e2c48d4e93..3c8720bf16 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.profiler/src/com/raytheon/uf/common/dataplugin/profiler/ProfilerObs.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.profiler/src/com/raytheon/uf/common/dataplugin/profiler/ProfilerObs.java @@ -21,6 +21,7 @@ package com.raytheon.uf.common.dataplugin.profiler; import java.util.ArrayList; import java.util.Calendar; +import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.regex.Matcher; @@ -40,9 +41,15 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Transient; import javax.persistence.UniqueConstraint; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; import org.hibernate.annotations.Index; +import com.raytheon.uf.common.dataplugin.IDecoderGettable; import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.annotations.DataURI; import com.raytheon.uf.common.dataplugin.persist.IPersistable; @@ -74,7 +81,6 @@ import com.vividsolutions.jts.geom.Geometry; * May 07, 2013 1869 bsteffen Remove dataURI column from * PluginDataObject. * Aug 30, 2013 2298 rjpeter Make getPluginName abstract - * Oct 14, 2013 2361 njensen Removed XML annotations and IDecoderGettable * * * @@ -90,9 +96,12 @@ import com.vividsolutions.jts.geom.Geometry; */ @org.hibernate.annotations.Table(appliesTo = ProfilerObs.PLUGIN_NAME, indexes = { @Index(name = "profiler_refTimeIndex", columnNames = { "refTime", "forecastTime" }) }) +@XmlRootElement +@XmlAccessorType(XmlAccessType.NONE) @DynamicSerialize public class ProfilerObs extends PersistablePluginDataObject implements - ISpatialEnabled, IPointData, IPersistable, Comparable { + ISpatialEnabled, IDecoderGettable, IPointData, IPersistable, + Comparable { private static final long serialVersionUID = 1L; @@ -118,6 +127,18 @@ public class ProfilerObs extends PersistablePluginDataObject implements public static final Unit WIND_DIR_UNIT = NonSI.DEGREE_ANGLE; + private static final HashMap PARM_MAP = new HashMap(); + + private static final String PROF_ID = "profid"; + + static { + PARM_MAP.put("NLAT", STA_LAT); + PARM_MAP.put("NLON", STA_LON); + PARM_MAP.put("WS", SFC_WNDSPD); + PARM_MAP.put("WD", SFC_WNDDIR); + PARM_MAP.put("PROF_ID", PROF_ID); + } + private static final String PRESS = "PRESS"; private static final String AGL = "AGL"; @@ -145,20 +166,24 @@ public class ProfilerObs extends PersistablePluginDataObject implements private Integer levelId; @DataURI(position = 1) + @XmlAttribute @DynamicSerializeElement private Integer reportType; // The profiler observation time. @Column + @XmlAttribute @DynamicSerializeElement private Calendar timeObs; @Embedded @DataURI(position = 2, embedded = true) + @XmlElement @DynamicSerializeElement private SurfaceObsLocation location; @Column + @XmlAttribute @DynamicSerializeElement private String profilerId; @@ -167,23 +192,28 @@ public class ProfilerObs extends PersistablePluginDataObject implements private PointDataView pointDataView; // Text of the WMO header + @XmlAttribute @DynamicSerializeElement private String wmoHeader; // the level data + @XmlElement @DynamicSerializeElement @Transient private String profilerName; // the level data + @XmlElement @DynamicSerializeElement @Transient private List levels; + @XmlAttribute @DynamicSerializeElement @Transient private Double sfcWindSpeed; + @XmlAttribute @DynamicSerializeElement @Transient private Double sfcWindDir; @@ -353,6 +383,75 @@ public class ProfilerObs extends PersistablePluginDataObject implements return wmoHeader; } + @Override + public String getString(String paramName) { + String value = null; + String pName = PARM_MAP.get(paramName); + if (PROF_ID.equals(pName)) { + value = profilerId; + } + return value; + } + + @Override + public String[] getStrings(String paramName) { + return null; + } + + @Override + public Amount getValue(String paramName) { + Amount a = null; + + if (parseParameter(paramName)) { + String pName = PARM_MAP.get(parameterName); + if (unit.equals(AGL) && (levelId == 0)) { + Double dValue = null; + if (SFC_WNDSPD.equals(pName)) { + dValue = getSfcWindSpeed(); + if (dValue != null) { + a = new Amount(dValue, WIND_SPEED_UNIT); + } + } else if (SFC_WNDDIR.equals(pName)) { + dValue = getSfcWindDir(); + if (dValue != null) { + a = new Amount(dValue, WIND_DIR_UNIT); + } + } + } else { + if ((pName != null) && (levels != null) && (levels.size() > 0)) { + profLevel = getLevel(levelId); + if (profLevel != null) { + Double dValue = null; + if (SFC_WNDSPD.equals(pName)) { + dValue = getWindSpeed(); + if (dValue != null) { + a = new Amount(dValue, WIND_SPEED_UNIT); + } + } else if (SFC_WNDDIR.equals(pName)) { + dValue = getWindDirection(); + if (dValue != null) { + a = new Amount(dValue, WIND_DIR_UNIT); + } + } + } + } + } + } else { + String pName = PARM_MAP.get(paramName); + if (STA_LAT.equals(pName)) { + a = new Amount(getLatitude(), LOCATION_UNIT); + } else if (STA_LON.equals(pName)) { + a = new Amount(getLongitude(), LOCATION_UNIT); + } + } + return a; + } + + @Override + public Collection getValues(String paramName) { + return null; + } + /** * Get the WMOHeader of the file that contained this data. * @@ -409,6 +508,17 @@ public class ProfilerObs extends PersistablePluginDataObject implements this.levels = levels; } + /** + * Get the IDecoderGettable interface implementation. This class does not + * currently support this interface. + * + * @return Returns null. + */ + @Override + public IDecoderGettable getDecoderGettable() { + return this; + } + @Override public SurfaceObsLocation getSpatialObject() { return location; diff --git a/edexOsgi/com.raytheon.uf.common.pointdata/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject b/edexOsgi/com.raytheon.uf.common.pointdata/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject index 02051a688a..9dad017dfe 100644 --- a/edexOsgi/com.raytheon.uf.common.pointdata/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject +++ b/edexOsgi/com.raytheon.uf.common.pointdata/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject @@ -1,3 +1,11 @@ +com.raytheon.uf.common.pointdata.PointDataContainer +com.raytheon.uf.common.pointdata.PointDataSerializable +com.raytheon.uf.common.pointdata.ParameterDescription +com.raytheon.uf.common.pointdata.Dimension +com.raytheon.uf.common.pointdata.elements.FloatPointDataObject +com.raytheon.uf.common.pointdata.elements.IntPointDataObject +com.raytheon.uf.common.pointdata.elements.LongPointDataObject +com.raytheon.uf.common.pointdata.elements.StringPointDataObject com.raytheon.uf.common.pointdata.spatial.ObStation com.raytheon.uf.common.pointdata.spatial.AircraftObsLocation com.raytheon.uf.common.pointdata.spatial.SurfaceObsLocation \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/Dimension.java b/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/Dimension.java index 88d69cfa41..a30246b22d 100644 --- a/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/Dimension.java +++ b/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/Dimension.java @@ -23,6 +23,8 @@ import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; +import com.raytheon.uf.common.serialization.ISerializableObject; + /** * Provides metadata (primarily the size) of a named dimension * @@ -39,7 +41,7 @@ import javax.xml.bind.annotation.XmlAttribute; * @version 1.0 */ @XmlAccessorType(XmlAccessType.NONE) -public class Dimension { +public class Dimension implements ISerializableObject { @XmlAttribute(name = "name") private String dimensionName; diff --git a/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/ParameterDescription.java b/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/ParameterDescription.java index 431ef1ef32..6be79c020f 100644 --- a/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/ParameterDescription.java +++ b/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/ParameterDescription.java @@ -28,6 +28,7 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import com.raytheon.uf.common.pointdata.PointDataDescription.Type; +import com.raytheon.uf.common.serialization.ISerializableObject; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; @@ -50,7 +51,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; */ @XmlAccessorType(XmlAccessType.NONE) @DynamicSerialize -public class ParameterDescription { +public class ParameterDescription implements ISerializableObject { @XmlAttribute(name = "name", required = true) @DynamicSerializeElement diff --git a/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/PointDataContainer.java b/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/PointDataContainer.java index e32a5deb0f..179b0aa393 100644 --- a/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/PointDataContainer.java +++ b/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/PointDataContainer.java @@ -23,8 +23,17 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Map.Entry; import java.util.Set; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.adapters.XmlAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + import com.raytheon.uf.common.datastorage.records.FloatDataRecord; import com.raytheon.uf.common.datastorage.records.IDataRecord; import com.raytheon.uf.common.datastorage.records.IntegerDataRecord; @@ -37,6 +46,7 @@ import com.raytheon.uf.common.pointdata.elements.FloatPointDataObject; import com.raytheon.uf.common.pointdata.elements.IntPointDataObject; import com.raytheon.uf.common.pointdata.elements.LongPointDataObject; import com.raytheon.uf.common.pointdata.elements.StringPointDataObject; +import com.raytheon.uf.common.serialization.ISerializableObject; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; @@ -49,8 +59,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; * SOFTWARE HISTORY * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Apr 8, 2009 chammack Initial creation - * Oct 9, 2013 2361 njensen Removed XML annotations + * Apr 8, 2009 chammack Initial creation * * * @@ -58,17 +67,23 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; * @version 1.0 */ @DynamicSerialize -public class PointDataContainer { +@XmlRootElement +@XmlAccessorType(XmlAccessType.FIELD) +public class PointDataContainer implements ISerializableObject { protected static final int DEFAULT_SZ = 2048; @DynamicSerializeElement + @XmlAttribute protected int currentSz; @DynamicSerializeElement + @XmlAttribute protected int allocatedSz; @DynamicSerializeElement + @XmlElement + @XmlJavaTypeAdapter(value = PointDataMarshaller.class) protected HashMap> pointDataTypes; public PointDataContainer() { @@ -411,6 +426,55 @@ public class PointDataContainer { this.currentSz = currentSz; } + public static class PointDataMarshaller + extends + XmlAdapter>> { + + /* + * (non-Javadoc) + * + * @see + * javax.xml.bind.annotation.adapters.XmlAdapter#marshal(java.lang.Object + * ) + */ + @Override + public PointDataSerializable marshal( + HashMap> v) throws Exception { + PointDataSerializable serializable = new PointDataSerializable(); + PointDataSerializable.PointDataItemSerializable[] items = new PointDataSerializable.PointDataItemSerializable[v + .size()]; + int i = 0; + for (Entry> entry : v.entrySet()) { + items[i] = new PointDataSerializable.PointDataItemSerializable(); + items[i].key = entry.getKey(); + items[i].value = entry.getValue(); + i++; + } + serializable.items = items; + return serializable; + } + + /* + * (non-Javadoc) + * + * @see + * javax.xml.bind.annotation.adapters.XmlAdapter#unmarshal(java.lang + * .Object) + */ + @Override + public HashMap> unmarshal( + PointDataSerializable v) throws Exception { + HashMap> map = new HashMap>( + v.items.length); + for (PointDataSerializable.PointDataItemSerializable item : v.items) { + map.put(item.key, item.value); + } + + return map; + } + + } + protected AbstractPointDataObject getParamSafe(String parameter) { AbstractPointDataObject p = pointDataTypes.get(parameter); if (p == null) { diff --git a/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/PointDataSerializable.java b/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/PointDataSerializable.java new file mode 100644 index 0000000000..f5bfebc698 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/PointDataSerializable.java @@ -0,0 +1,60 @@ +/** + * This software was developed and / or modified by Raytheon Company, + * pursuant to Contract DG133W-05-CQ-1067 with the US Government. + * + * U.S. EXPORT CONTROLLED TECHNICAL DATA + * This software product contains export-restricted data whose + * export/transfer/disclosure is restricted by U.S. law. Dissemination + * to non-U.S. persons whether in the United States or abroad requires + * an export license or other authorization. + * + * Contractor Name: Raytheon Company + * Contractor Address: 6825 Pine Street, Suite 340 + * Mail Stop B8 + * Omaha, NE 68106 + * 402.291.0100 + * + * See the AWIPS II Master Rights File ("Master Rights File.pdf") for + * further licensing information. + **/ +package com.raytheon.uf.common.pointdata; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; + +import com.raytheon.uf.common.pointdata.elements.AbstractPointDataObject; +import com.raytheon.uf.common.serialization.ISerializableObject; + +/** + * A serialization helper class for serializing pointdata maps + * + *
+ * 
+ * SOFTWARE HISTORY
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Apr 16, 2009            chammack     Initial creation
+ * 
+ * 
+ * + * @author chammack + * @version 1.0 + */ +@XmlAccessorType(XmlAccessType.NONE) +public class PointDataSerializable implements ISerializableObject { + + @XmlElement(name = "item") + public PointDataItemSerializable[] items; + + public static class PointDataItemSerializable implements + ISerializableObject { + + @XmlAttribute + public String key; + + @XmlElement + public AbstractPointDataObject value; + } +} diff --git a/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/elements/AbstractPointDataObject.java b/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/elements/AbstractPointDataObject.java index 8809021aa6..a7bc160516 100644 --- a/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/elements/AbstractPointDataObject.java +++ b/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/elements/AbstractPointDataObject.java @@ -22,9 +22,13 @@ package com.raytheon.uf.common.pointdata.elements; import java.util.HashMap; import java.util.Map; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; + import com.raytheon.uf.common.datastorage.records.IDataRecord; import com.raytheon.uf.common.pointdata.ParameterDescription; import com.raytheon.uf.common.pointdata.PointDataContainer; +import com.raytheon.uf.common.serialization.ISerializableObject; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; @@ -36,17 +40,16 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; * SOFTWARE HISTORY * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Apr 8, 2009 chammack Initial creation - * Oct 9, 2013 2361 njensen Removed XML annotations + * Apr 8, 2009 chammack Initial creation * * * * @author chammack * @version 1.0 */ - +@XmlAccessorType(XmlAccessType.NONE) @DynamicSerialize -public abstract class AbstractPointDataObject { +public abstract class AbstractPointDataObject implements ISerializableObject { static final int STORAGE_CHUNK_SIZE = 1024; diff --git a/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/elements/FloatPointDataObject.java b/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/elements/FloatPointDataObject.java index bffec6ea88..02f8742dfb 100644 --- a/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/elements/FloatPointDataObject.java +++ b/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/elements/FloatPointDataObject.java @@ -19,6 +19,10 @@ **/ package com.raytheon.uf.common.pointdata.elements; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; + import com.raytheon.uf.common.datastorage.records.FloatDataRecord; import com.raytheon.uf.common.datastorage.records.IDataRecord; import com.raytheon.uf.common.pointdata.ParameterDescription; @@ -34,8 +38,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; * SOFTWARE HISTORY * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Apr 8, 2009 chammack Initial creation - * Oct 9, 2013 2361 njensen Removed XML annotations + * Apr 8, 2009 chammack Initial creation * * * @@ -43,9 +46,11 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; * @version 1.0 */ @DynamicSerialize +@XmlAccessorType(XmlAccessType.NONE) public class FloatPointDataObject extends AbstractPointDataObject { @DynamicSerializeElement + @XmlElement protected float[] floatData; public FloatPointDataObject() { diff --git a/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/elements/IntPointDataObject.java b/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/elements/IntPointDataObject.java index 28c933b923..a41601df68 100644 --- a/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/elements/IntPointDataObject.java +++ b/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/elements/IntPointDataObject.java @@ -19,6 +19,10 @@ **/ package com.raytheon.uf.common.pointdata.elements; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; + import com.raytheon.uf.common.datastorage.records.IDataRecord; import com.raytheon.uf.common.datastorage.records.IntegerDataRecord; import com.raytheon.uf.common.pointdata.ParameterDescription; @@ -34,8 +38,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; * SOFTWARE HISTORY * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Apr 8, 2009 chammack Initial creation - * Oct 9, 2013 2361 njensen Removed XML annotations + * Apr 8, 2009 chammack Initial creation * * * @@ -43,9 +46,10 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; * @version 1.0 */ @DynamicSerialize +@XmlAccessorType(XmlAccessType.NONE) public class IntPointDataObject extends AbstractPointDataObject { - @DynamicSerializeElement + @XmlElement protected int[] intData; public IntPointDataObject() { diff --git a/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/elements/LongPointDataObject.java b/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/elements/LongPointDataObject.java index 12d3871bc7..7f95c05964 100644 --- a/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/elements/LongPointDataObject.java +++ b/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/elements/LongPointDataObject.java @@ -19,6 +19,10 @@ **/ package com.raytheon.uf.common.pointdata.elements; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; + import com.raytheon.uf.common.datastorage.records.IDataRecord; import com.raytheon.uf.common.datastorage.records.LongDataRecord; import com.raytheon.uf.common.pointdata.ParameterDescription; @@ -34,8 +38,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; * SOFTWARE HISTORY * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Apr 8, 2009 chammack Initial creation - * Oct 9, 2013 2361 njensen Removed XML annotations + * Apr 8, 2009 chammack Initial creation * * * @@ -43,9 +46,10 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; * @version 1.0 */ @DynamicSerialize +@XmlAccessorType(XmlAccessType.NONE) public class LongPointDataObject extends AbstractPointDataObject { - @DynamicSerializeElement + @XmlElement protected long[] longData; public LongPointDataObject() { diff --git a/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/elements/StringPointDataObject.java b/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/elements/StringPointDataObject.java index 8d504c97a3..a57cbdc427 100644 --- a/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/elements/StringPointDataObject.java +++ b/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/elements/StringPointDataObject.java @@ -19,6 +19,10 @@ **/ package com.raytheon.uf.common.pointdata.elements; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; + import com.raytheon.uf.common.datastorage.records.IDataRecord; import com.raytheon.uf.common.datastorage.records.StringDataRecord; import com.raytheon.uf.common.pointdata.ParameterDescription; @@ -34,8 +38,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; * SOFTWARE HISTORY * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Apr 8, 2009 chammack Initial creation - * Oct 9, 2013 2361 njensen Removed XML annotations + * Apr 8, 2009 chammack Initial creation * * * @@ -43,9 +46,10 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; * @version 1.0 */ @DynamicSerialize +@XmlAccessorType(XmlAccessType.NONE) public class StringPointDataObject extends AbstractPointDataObject { - @DynamicSerializeElement + @XmlElement protected String[] stringData; public StringPointDataObject() {