diff --git a/cave/com.raytheon.uf.viz.dataplugins.feature/feature.xml b/cave/com.raytheon.uf.viz.dataplugins.feature/feature.xml index abe95eb36c..7efe412ce8 100644 --- a/cave/com.raytheon.uf.viz.dataplugins.feature/feature.xml +++ b/cave/com.raytheon.uf.viz.dataplugins.feature/feature.xml @@ -96,7 +96,7 @@ install-size="0" version="0.0.0" unpack="false"/> - + + + diff --git a/cave/com.raytheon.viz.pointdata/localization/bundles/mping/MpingPlotAll.xml b/cave/com.raytheon.viz.pointdata/localization/bundles/mping/MpingPlotAll.xml new file mode 100644 index 0000000000..049c607fff --- /dev/null +++ b/cave/com.raytheon.viz.pointdata/localization/bundles/mping/MpingPlotAll.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cave/com.raytheon.viz.pointdata/localization/bundles/mping/MpingPlotCategory.xml b/cave/com.raytheon.viz.pointdata/localization/bundles/mping/MpingPlotCategory.xml new file mode 100644 index 0000000000..273afbe5ff --- /dev/null +++ b/cave/com.raytheon.viz.pointdata/localization/bundles/mping/MpingPlotCategory.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cave/com.raytheon.viz.pointdata/localization/menus/mping/baseMPing.xml b/cave/com.raytheon.viz.pointdata/localization/menus/mping/baseMPing.xml new file mode 100644 index 0000000000..96aa80f18f --- /dev/null +++ b/cave/com.raytheon.viz.pointdata/localization/menus/mping/baseMPing.xml @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cave/com.raytheon.viz.pointdata/localization/menus/mping/index.xml b/cave/com.raytheon.viz.pointdata/localization/menus/mping/index.xml new file mode 100755 index 0000000000..a20bd6b80d --- /dev/null +++ b/cave/com.raytheon.viz.pointdata/localization/menus/mping/index.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/cave/com.raytheon.viz.pointdata/localization/plotModels/mPing_trans.txt b/cave/com.raytheon.viz.pointdata/localization/plotModels/mPing_trans.txt new file mode 100644 index 0000000000..805a543453 --- /dev/null +++ b/cave/com.raytheon.viz.pointdata/localization/plotModels/mPing_trans.txt @@ -0,0 +1,45 @@ +s2s +1 : f +2 : e +3 : r +4 : u +5 : p +6 : q +7 : a +8 : t +9 : b +10 : c +11 : s +13 : o +14 : o +15 : o +16 : o +17 : n +19 : n +20 : m +21 : m +22 : m +23 : m +24 : k +25 : k +26 : k +27 : k +28 : l +29 : l +30 : l +31 : l +32 : j +33 : g +34 : g +35 : g +36 : h +37 : i +38 : d +39 : z +40 : x +41 : x +42 : y +43 : y +44 : A +45 : v +46 : w diff --git a/cave/com.raytheon.viz.pointdata/localization/plotModels/mping.svg b/cave/com.raytheon.viz.pointdata/localization/plotModels/mping.svg new file mode 100644 index 0000000000..78875519ad --- /dev/null +++ b/cave/com.raytheon.viz.pointdata/localization/plotModels/mping.svg @@ -0,0 +1,37 @@ + + + +Generated by Fontastic.me + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cave/com.raytheon.viz.pointdata/localization/plotModels/mpingPlotDesign.svg b/cave/com.raytheon.viz.pointdata/localization/plotModels/mpingPlotDesign.svg new file mode 100644 index 0000000000..acd74e4577 --- /dev/null +++ b/cave/com.raytheon.viz.pointdata/localization/plotModels/mpingPlotDesign.svg @@ -0,0 +1,97 @@ + + + + + + + 0 + 0 + + + + + diff --git a/edexOsgi/com.raytheon.edex.feature.uframe/feature.xml b/edexOsgi/com.raytheon.edex.feature.uframe/feature.xml index 509d52dd65..2d6bad5a07 100644 --- a/edexOsgi/com.raytheon.edex.feature.uframe/feature.xml +++ b/edexOsgi/com.raytheon.edex.feature.uframe/feature.xml @@ -140,4 +140,8 @@ id="gov.nasa.msfc.sport.edex.sportlma.feature" version="0.0.0"/> + + diff --git a/edexOsgi/gov.noaa.nws.sr.oun.dataplugin.mping/.classpath b/edexOsgi/gov.noaa.nws.sr.oun.dataplugin.mping/.classpath new file mode 100644 index 0000000000..ad32c83a78 --- /dev/null +++ b/edexOsgi/gov.noaa.nws.sr.oun.dataplugin.mping/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/edexOsgi/gov.noaa.nws.sr.oun.dataplugin.mping/.project b/edexOsgi/gov.noaa.nws.sr.oun.dataplugin.mping/.project new file mode 100644 index 0000000000..d80aaf2277 --- /dev/null +++ b/edexOsgi/gov.noaa.nws.sr.oun.dataplugin.mping/.project @@ -0,0 +1,28 @@ + + + gov.noaa.nws.sr.oun.dataplugin.mping + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/edexOsgi/gov.noaa.nws.sr.oun.dataplugin.mping/META-INF/MANIFEST.MF b/edexOsgi/gov.noaa.nws.sr.oun.dataplugin.mping/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..5ea0a48c47 --- /dev/null +++ b/edexOsgi/gov.noaa.nws.sr.oun.dataplugin.mping/META-INF/MANIFEST.MF @@ -0,0 +1,18 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Mping +Bundle-SymbolicName: gov.noaa.nws.sr.oun.dataplugin.mping +Bundle-Version: 1.0.0.qualifier +Bundle-Vendor: NWS OUN +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Require-Bundle: com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174", + com.raytheon.uf.common.serialization;bundle-version="1.12.1174", + com.raytheon.edex.common;bundle-version="1.12.1174", + javax.persistence;bundle-version="1.0.0", + org.apache.commons.lang;bundle-version="2.3.0", + javax.measure;bundle-version="1.0.0", + com.raytheon.uf.common.pointdata, + com.raytheon.uf.edex.pointdata, + com.raytheon.uf.common.status +Export-Package: gov.noaa.nws.sr.oun.dataplugin.mping + diff --git a/edexOsgi/gov.noaa.nws.sr.oun.dataplugin.mping/build.properties b/edexOsgi/gov.noaa.nws.sr.oun.dataplugin.mping/build.properties new file mode 100644 index 0000000000..34d2e4d2da --- /dev/null +++ b/edexOsgi/gov.noaa.nws.sr.oun.dataplugin.mping/build.properties @@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/edexOsgi/gov.noaa.nws.sr.oun.dataplugin.mping/src/gov/noaa/nws/sr/oun/dataplugin/mping/MPingReport.java b/edexOsgi/gov.noaa.nws.sr.oun.dataplugin.mping/src/gov/noaa/nws/sr/oun/dataplugin/mping/MPingReport.java new file mode 100644 index 0000000000..fb71d9ca90 --- /dev/null +++ b/edexOsgi/gov.noaa.nws.sr.oun.dataplugin.mping/src/gov/noaa/nws/sr/oun/dataplugin/mping/MPingReport.java @@ -0,0 +1,225 @@ +package gov.noaa.nws.sr.oun.dataplugin.mping; + +import java.util.Calendar; +import javax.persistence.Embedded; +import javax.persistence.Entity; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.UniqueConstraint; +import com.raytheon.uf.common.dataplugin.PluginDataObject; +import com.raytheon.uf.common.dataplugin.annotations.DataURI; +import com.raytheon.uf.common.dataplugin.persist.IPersistable; +import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject; +import com.raytheon.uf.common.geospatial.ISpatialEnabled; +import com.raytheon.uf.common.pointdata.IPointData; +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.vividsolutions.jts.geom.Geometry; +/** + * Record implementation for mPING Reports + * + *
+ * 
+ * SOFTWARE HISTORY
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Jun 25, 2015            aanderson   Initial creation of history
+ * 
+ * + * @author Aaron Anderson + * @version 1.0 + */ +@Entity +@SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "mpingseq") +@Table(name = "mping", uniqueConstraints = { @UniqueConstraint(columnNames = { + "latitude", "longitude", "stationId", "refTime"}) }) +@DynamicSerialize +public class MPingReport extends PersistablePluginDataObject implements +ISpatialEnabled, IPointData, IPersistable { + private static final long serialVersionUID = 1L; + + @Embedded + @DataURI(position = 1, embedded = true) + @DynamicSerializeElement + private SurfaceObsLocation location; + + @Embedded + @DynamicSerializeElement + private PointDataView pointDataView; + + @Transient + @DynamicSerializeElement + private String provider = null; + + @Transient + @DynamicSerializeElement + private String source = null; + + @Transient + @DynamicSerializeElement + int description_id; + + @DynamicSerializeElement + String description; + + @DynamicSerializeElement + String category; + + public MPingReport() { + super(); + } + + public MPingReport(String dataUri) { + super(dataUri); + } + + public String getProvider() { + return provider; + } + + public void setProvider(String provider) { + this.provider = provider; + } + + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + public int getDescription_id() { + return description_id; + } + + public void setDescription_id(int description_id) { + this.description_id = description_id; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + @Override + public SurfaceObsLocation getSpatialObject() { + return location; + } + + public SurfaceObsLocation getLocation() { + return location; + } + + public void setLocation(SurfaceObsLocation location) { + this.location = location; + } + + /** + * Get this observation's geometry. + * + * @return The geometry for this observation. + */ + public Geometry getGeometry() { + return location.getGeometry(); + } + + /** + * Get the geometry latitude. + * + * @return The geometry latitude. + */ + public double getLatitude() { + return location.getLatitude(); + } + + /** + * Get the geometry longitude. + * + * @return The geometry longitude. + */ + public double getLongitude() { + return location.getLongitude(); + } + + /** + * Get the station identifier for this observation. + * + * @return the stationId + */ + public String getStationId() { + return location.getStationId(); + } + + /** + * Get the elevation, in meters, of the observing platform or location. + * + * @return The observation elevation, in meters. + */ + public Integer getElevation() { + return location.getElevation(); + } + + /** + * Get whether the location for this observation is defined. + * + * @return Is this location defined. + */ + public Boolean getLocationDefined() { + return location.getLocationDefined(); + } + + @Override + public PointDataView getPointDataView() { + return pointDataView; + } + + @Override + public void setPointDataView(PointDataView pointDataView) { + this.pointDataView = pointDataView; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + Calendar c = getDataTime().getRefTimeAsCalendar(); + if (c != null) { + sb.append(String.format("MPing:%1$tY%1$tm%1$td%1$tH%1$tM", + getDataTime().getRefTimeAsCalendar())); + } else { + sb.append("MPing:YYYYMMDDHHmm"); + } + sb.append(String.format("%6.2f %7.2f:", getLatitude(), getLongitude())); + return sb.toString(); + } + + @SuppressWarnings("unchecked") + @Override + public void setDataURI(String dataURI) { + super.setDataURI(dataURI); + identifier = dataURI; + } + + @Override + public String getPluginName() { + return "mping"; + } + + + + +} diff --git a/edexOsgi/gov.noaa.nws.sr.oun.edex.mping.feature/.project b/edexOsgi/gov.noaa.nws.sr.oun.edex.mping.feature/.project new file mode 100644 index 0000000000..96a3e2c43e --- /dev/null +++ b/edexOsgi/gov.noaa.nws.sr.oun.edex.mping.feature/.project @@ -0,0 +1,17 @@ + + + gov.noaa.nws.sr.oun.edex.mping.feature + + + + + + org.eclipse.pde.FeatureBuilder + + + + + + org.eclipse.pde.FeatureNature + + diff --git a/edexOsgi/gov.noaa.nws.sr.oun.edex.mping.feature/build.properties b/edexOsgi/gov.noaa.nws.sr.oun.edex.mping.feature/build.properties new file mode 100644 index 0000000000..64f93a9f0b --- /dev/null +++ b/edexOsgi/gov.noaa.nws.sr.oun.edex.mping.feature/build.properties @@ -0,0 +1 @@ +bin.includes = feature.xml diff --git a/edexOsgi/gov.noaa.nws.sr.oun.edex.mping.feature/feature.xml b/edexOsgi/gov.noaa.nws.sr.oun.edex.mping.feature/feature.xml new file mode 100644 index 0000000000..d9c39ec70a --- /dev/null +++ b/edexOsgi/gov.noaa.nws.sr.oun.edex.mping.feature/feature.xml @@ -0,0 +1,34 @@ + + + + + [Enter Feature Description here.] + + + + [Enter Copyright Description here.] + + + + [Enter License Description here.] + + + + + + + diff --git a/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/.classpath b/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/.classpath new file mode 100644 index 0000000000..f721dabcde --- /dev/null +++ b/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/.project b/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/.project new file mode 100644 index 0000000000..d2bfbab32d --- /dev/null +++ b/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/.project @@ -0,0 +1,28 @@ + + + gov.noaa.nws.sr.oun.edex.plugin.mping + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/META-INF/MANIFEST.MF b/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..9d31d2afb4 --- /dev/null +++ b/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/META-INF/MANIFEST.MF @@ -0,0 +1,15 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Mping +Bundle-SymbolicName: gov.noaa.nws.sr.oun.edex.plugin.mping +Bundle-Version: 1.0.0.qualifier +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Require-Bundle: com.raytheon.edex.common;bundle-version="1.12.1174", + com.raytheon.uf.edex.decodertools;bundle-version="1.12.1174", + javax.measure;bundle-version="1.0.0", + javax.persistence;bundle-version="1.0.0", + org.dom4j;bundle-version="1.0.0", + com.raytheon.uf.common.status;bundle-version="1.12.1174", + com.raytheon.uf.common.pointdata;bundle-version="1.12.1174", + com.raytheon.uf.edex.pointdata;bundle-version="1.12.1174", + gov.noaa.nws.sr.oun.dataplugin.mping;bundle-version="1.0.0" diff --git a/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/build.properties b/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/build.properties new file mode 100644 index 0000000000..73974cda80 --- /dev/null +++ b/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/build.properties @@ -0,0 +1,6 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + res/,\ + utility/ diff --git a/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/res/pointdata/mping.xml b/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/res/pointdata/mping.xml new file mode 100644 index 0000000000..86f4943a17 --- /dev/null +++ b/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/res/pointdata/mping.xml @@ -0,0 +1,28 @@ + + + + + + + + diff --git a/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/res/pointdata/mpingdb.xml b/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/res/pointdata/mpingdb.xml new file mode 100644 index 0000000000..a744b81381 --- /dev/null +++ b/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/res/pointdata/mpingdb.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/res/spring/mping-common.xml b/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/res/spring/mping-common.xml new file mode 100644 index 0000000000..94722b1d11 --- /dev/null +++ b/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/res/spring/mping-common.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + diff --git a/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/res/spring/mping-ingest.xml b/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/res/spring/mping-ingest.xml new file mode 100644 index 0000000000..3ce23dea38 --- /dev/null +++ b/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/res/spring/mping-ingest.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + mping + + + + + + + + + + java.lang.Throwable + + + + + + + \ No newline at end of file diff --git a/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/src/gov/noaa/nws/sr/oun/edex/plugin/mping/MPingDecoder.java b/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/src/gov/noaa/nws/sr/oun/edex/plugin/mping/MPingDecoder.java new file mode 100644 index 0000000000..7dd9609454 --- /dev/null +++ b/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/src/gov/noaa/nws/sr/oun/edex/plugin/mping/MPingDecoder.java @@ -0,0 +1,181 @@ +package gov.noaa.nws.sr.oun.edex.plugin.mping; + +import gov.noaa.nws.sr.oun.dataplugin.mping.MPingReport; +import gov.noaa.nws.sr.oun.edex.plugin.mping.dao.MPingReportDao; + +import java.io.File; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.DocumentHelper; +import org.dom4j.Element; +import com.raytheon.edex.plugin.AbstractDecoder; +import com.raytheon.uf.common.dataplugin.PluginDataObject; +import com.raytheon.uf.common.pointdata.PointDataContainer; +import com.raytheon.uf.common.pointdata.PointDataDescription; +import com.raytheon.uf.common.pointdata.PointDataView; +import com.raytheon.uf.common.pointdata.spatial.SurfaceObsLocation; +import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.UFStatus; +import com.raytheon.uf.common.time.DataTime; +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.GeometryFactory; + +/** + * Decoder for mPING Reports + * + *
+ * 
+ * SOFTWARE HISTORY
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Jun 25, 2015            aanderson   Initial creation of history
+ * 
+ * + * @author Aaron Anderson + * @version 1.0 + */ +public class MPingDecoder extends AbstractDecoder { + + private static IUFStatusHandler logger = UFStatus + .getHandler(MPingDecoder.class); + + GeometryFactory geomFact = new GeometryFactory(); + + DateFormat reportTimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ssX"); + + MPingReportDao dao; + + private PointDataDescription pointDataDescription = null; + + private Map containerMap = new HashMap(); + private final String pluginName = "mping"; + + public MPingDecoder() { + try { + pointDataDescription = PointDataDescription + .fromStream(this.getClass().getResourceAsStream( + "/res/pointdata/mping.xml")); + dao = new MPingReportDao(pluginName); + logger.info("PointDataDescription loaded"); + + } catch (Exception e) { + logger.error("Problem loading point Data Description " + + e.getMessage()); + + } + + } + + public PluginDataObject[] decode(String input) throws Exception { + logger.info("Starting Decode of mPING xml"); + ArrayList list = new ArrayList(); + try { + // Parse the text input into a Document so that we can extract out + // the root element. + Document document = DocumentHelper.parseText(input); + // Get root element of the document in xml + Element e = document.getRootElement(); + // grab the results section of the kml file + Element results = e.element("results"); + // iterate over the items in the Document section and only grab + // report items. + Iterator i = results.elementIterator("report"); + while (i.hasNext()) { + // Grab next report + Element report = i.next(); + try { + // pull out the description_id tag + Element description_id = report.element("description_id"); + // If there actually is mPING data then process it. + if (description_id != null) { + // Get individual items of report + Element idElement = report.element("id"); + Element description = report.element("description"); + Element category = report.element("category"); + Element timeElement = report.element("obtime"); + Date reportTime = reportTimeFormat.parse(timeElement + .getText()); + Element geom = report.element("geom"); + Element coordinates = geom.element("coordinates"); + Element lon = coordinates.element("longitude"); + Element lat = coordinates.element("latitude"); + + // Create mping record + MPingReport record = new MPingReport(); + + // set the description and categories + record.setDescription_id(Integer + .parseInt(description_id.getText())); + record.setDescription(description.getText()); + record.setCategory(category.getText()); + // Create new SurfaceObsLocation + SurfaceObsLocation obsLoc = new SurfaceObsLocation(); + // Use id from mPING xml as stationid as this provides + // for an always + // unique value + obsLoc.setStationId(idElement.getText()); + // Set geometry of report + obsLoc.setGeometry(geomFact.createPoint(new Coordinate( + Float.parseFloat(lon.getText()), Float + .parseFloat(lat.getText())))); + record.setLocation(obsLoc); + + // Add our DataTime + record.setDataTime(new DataTime(reportTime)); + + PointDataContainer pdc = getContainer(record); + + // Populate the point data. + PointDataView view = pdc.append(); + view.setLong("description_id", + record.getDescription_id()); + + record.setPointDataView(view); + + // Add the record to the list + list.add(record); + } + } catch (Exception ex) { + logger.error("Error Creating Mping Record", ex); + } + } + } catch (DocumentException ex) { + logger.error("Error parsing Mping XML", ex); + } + // Process the list and send back an array of PluginDataObjects + return (list.toArray(new PluginDataObject[list.size()])); + } + + public MPingReportDao getDao() { + return dao; + } + + public void setDao(MPingReportDao dao) { + this.dao = dao; + } + + /** + * + * @param mpingData + * @return + */ + private PointDataContainer getContainer(MPingReport mpingData) { + + File file = dao.getFullFilePath(mpingData); + PointDataContainer container = containerMap.get(file); + if (container == null) { + container = PointDataContainer.build(pointDataDescription); + containerMap.put(file, container); + } + return container; + } + +} diff --git a/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/src/gov/noaa/nws/sr/oun/edex/plugin/mping/dao/MPingReportDao.java b/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/src/gov/noaa/nws/sr/oun/edex/plugin/mping/dao/MPingReportDao.java new file mode 100644 index 0000000000..b8545970da --- /dev/null +++ b/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/src/gov/noaa/nws/sr/oun/edex/plugin/mping/dao/MPingReportDao.java @@ -0,0 +1,44 @@ + +package gov.noaa.nws.sr.oun.edex.plugin.mping.dao; + +import gov.noaa.nws.sr.oun.dataplugin.mping.MPingReport; + +import com.raytheon.uf.common.dataplugin.PluginException; +import com.raytheon.uf.edex.pointdata.PointDataPluginDao; +/** + * DAO object for mPING Reports + * + *
+ * 
+ * SOFTWARE HISTORY
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Jun 25, 2015            aanderson   Initial creation of history
+ * 
+ * + * @author Aaron Anderson + * @version 1.0 + */ +public class MPingReportDao extends PointDataPluginDao { + + + public MPingReportDao(String pluginName) throws PluginException { + super(pluginName); + } + + @Override + public String[] getKeysRequiredForFileName() { + return new String[] { "dataTime.refTime" }; + } + + @Override + public String getPointDataFileName(MPingReport p) { + return "mping.h5"; + } + + @Override + public MPingReport newObject() { + return new MPingReport(); + } + +} diff --git a/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/test/MpingDecoderTest.java b/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/test/MpingDecoderTest.java new file mode 100644 index 0000000000..575b065ef4 --- /dev/null +++ b/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/test/MpingDecoderTest.java @@ -0,0 +1,39 @@ +import gov.noaa.nws.sr.oun.edex.plugin.mping.MPingDecoder; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; + +import com.raytheon.uf.common.dataplugin.PluginDataObject; + + +public class MpingDecoderTest { + + /** + * @param args + */ + public static void main(String[] args) { + try { + File file = new File("/home/awips/mpingtestfiles/mPingtesting.xml"); + FileInputStream fis = new FileInputStream(file); + byte[] array = new byte[(int)file.length()]; + fis.read(array); + fis.close(); + String input = new String(array); + + MPingDecoder decoder = new MPingDecoder(); + PluginDataObject[] obj = decoder.decode(input); + + System.out.println(obj[0].getDataTime()); + } catch(FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + + } + +} diff --git a/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/utility/common_static/base/purge/mpingPurgeRules.xml b/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/utility/common_static/base/purge/mpingPurgeRules.xml new file mode 100644 index 0000000000..b7064265b0 --- /dev/null +++ b/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/utility/common_static/base/purge/mpingPurgeRules.xml @@ -0,0 +1,6 @@ + + + + 01-00:00:00 + + diff --git a/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/utility/edex_static/base/distribution/mping.xml b/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/utility/edex_static/base/distribution/mping.xml new file mode 100644 index 0000000000..751a47d1a0 --- /dev/null +++ b/edexOsgi/gov.noaa.nws.sr.oun.edex.plugin.mping/utility/edex_static/base/distribution/mping.xml @@ -0,0 +1,4 @@ + + + ^[mM][pP][iI][nN][gG].* +