Omaha #2061 Remove dataURI from acars.

Former-commit-id: 0a6e99e9d1 [formerly f66725a515] [formerly 35ad2f2b8d [formerly e8b5ea58ca12878922be01c815a354703f5f4387]]
Former-commit-id: 35ad2f2b8d
Former-commit-id: e227d408db
This commit is contained in:
Ben Steffensmeier 2014-06-12 13:56:39 -05:00
parent 595cb870bf
commit 4e3a8e97fe
6 changed files with 87 additions and 39 deletions

View file

@ -149,7 +149,6 @@ public class PlotResourceData extends AbstractRequestableResourceData {
pluginProps.put("svrwx", new PluginPlotProperties(false));
pluginProps.put("ldadhydro", new PluginPlotProperties(false));
pluginProps.put("textPoints", new PluginPlotProperties(false));
pluginProps.put("acars", new PluginPlotProperties(false));
/*
* The good ones, these don't even need to be here because this is the
@ -180,6 +179,7 @@ public class PlotResourceData extends AbstractRequestableResourceData {
pluginProps.put("madis", new PluginPlotProperties());
pluginProps.put("pirep", new PluginPlotProperties());
pluginProps.put("airep", new PluginPlotProperties());
pluginProps.put("acars", new PluginPlotProperties());
ParsedURL.registerHandler(new LocalizationParsedURLHandler());
}

View file

@ -0,0 +1,40 @@
#!/bin/bash
# DR #2061 - this update script will drop the dataURI column from acars
PSQL="/awips2/psql/bin/psql"
# takes one arg: a table name
# drops the datauri constraint and column if they exist
function dropDatauri {
echo "INFO: Dropping DataURI column from $1"
${PSQL} -U awips -d metadata -c "ALTER TABLE $1 DROP CONSTRAINT IF EXISTS ${1}_datauri_key;"
${PSQL} -U awips -d metadata -c "ALTER TABLE $1 DROP COLUMN IF EXISTS datauri;"
if [ $? -ne 0 ]; then
echo "ERROR: Failed to drop dataURI column for $table"
echo "FATAL: The update has failed."
exit 1
fi
}
# takes three args: table, constraint name, unique columns
# will first drop the constraint if it exists and then adds it back, this is
# fairly inefficient if it does exist but operationally it won't exist and for
# testing this allows the script to be run easily as a noop.
function dropDatauriAndAddConstraint {
dropDatauri $1
${PSQL} -U awips -d metadata -c "ALTER TABLE $1 DROP CONSTRAINT IF EXISTS $2;"
${PSQL} -U awips -d metadata -c "ALTER TABLE $1 ADD CONSTRAINT $2 UNIQUE $3;"
if [ $? -ne 0 ]; then
echo "ERROR: Failed to add new unique constraint for $table"
echo "FATAL: The update has failed."
exit 1
fi
}
echo "INFO: Dropping acars dataURI columns."
dropDatauriAndAddConstraint acars acars_reftime_tailnumber_flightlevel_latitude_longitude_key "(reftime, tailnumber, flightlevel, latitude, longitude)"
${PSQL} -U awips -d metadata -c "update acars set stationid = to_char(longitude, 'FM999.999') || ':' || to_char(latitude, 'FM999.999')"
${PSQL} -U awips -d metadata -c "VACUUM FULL ANALYZE acars"
echo "INFO: acars dataURI columns dropped successfully"

View file

@ -1,17 +1,17 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Acars Plug-in
Bundle-Name: Acars Common Plug-in
Bundle-SymbolicName: com.raytheon.uf.common.dataplugin.acars
Bundle-Version: 1.12.1174.qualifier
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
Bundle-Version: 1.14.0.qualifier
Bundle-Vendor: RAYTHEON
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
Require-Bundle: com.raytheon.uf.common.dataplugin,
com.raytheon.uf.common.pointdata,
com.raytheon.uf.common.serialization,
com.raytheon.uf.common.geospatial;bundle-version="1.12.1174",
com.raytheon.uf.common.pointdata;bundle-version="1.13.0",
com.raytheon.uf.common.serialization;bundle-version="1.14.0",
com.raytheon.uf.common.geospatial;bundle-version="1.14.0",
com.raytheon.uf.common.dataaccess;bundle-version="1.14.0",
javax.persistence,
org.hibernate;bundle-version="1.0.0",
javax.measure;bundle-version="1.0.0",
com.raytheon.uf.common.dataaccess;bundle-version="1.14.0"
org.hibernate,
javax.measure
Export-Package: com.raytheon.uf.common.dataplugin.acars

View file

@ -21,8 +21,6 @@ package com.raytheon.uf.common.dataplugin.acars;
import java.util.Calendar;
import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
@ -65,7 +63,8 @@ import com.vividsolutions.jts.geom.Geometry;
* May 07, 2013 1869 bsteffen Remove dataURI column from
* PluginDataObject.
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
* Jun 11, 2014 2061 bsteffen Remove IDecoderGettable
* Jun 11, 2014 2061 bsteffen Remove IDecoderGettable, drop datauri
*
*
* </pre>
*
@ -74,13 +73,14 @@ import com.vividsolutions.jts.geom.Geometry;
*/
@Entity
@SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "acarsseq")
@Table(name = "acars", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) })
@Table(name = "acars", uniqueConstraints = { @UniqueConstraint(columnNames = {
"refTime", "tailNumber", "flightLevel", "latitude", "longitude" }) })
/*
* Both refTime and forecastTime are included in the refTimeIndex since
* forecastTime is unlikely to be used.
*/
@org.hibernate.annotations.Table(appliesTo = "acars", indexes = { @Index(name = "acars_refTimeIndex", columnNames = {
"refTime", "forecastTime" }) })
"refTime" }) })
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
@ -681,13 +681,6 @@ public class ACARSRecord extends PluginDataObject implements ISpatialEnabled,
return result;
}
@Override
@Column
@Access(AccessType.PROPERTY)
public String getDataURI() {
return super.getDataURI();
}
@Override
public String getPluginName() {
return "acars";

View file

@ -2,19 +2,19 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Acars Decoder Plug-in
Bundle-SymbolicName: com.raytheon.uf.edex.plugin.acars
Bundle-Version: 1.14.0.qualifier
Bundle-Version: 1.14.1.qualifier
Bundle-Vendor: RAYTHEON
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: com.raytheon.edex.common,
com.raytheon.uf.common.pointdata,
com.raytheon.uf.edex.decodertools;bundle-version="1.0.0",
org.geotools,
Require-Bundle: com.raytheon.edex.common;bundle-version="1.14.0",
com.raytheon.uf.common.dataplugin.acars;bundle-version="1.14.0",
com.raytheon.uf.common.pointdata;bundle-version="1.13.0",
com.raytheon.uf.edex.decodertools,
com.raytheon.uf.common.status,
com.raytheon.uf.common.wmo;bundle-version="1.14.0",
org.geotools;bundle-version="10.5",
javax.persistence,
javax.measure,
com.raytheon.uf.edex.pointdata;bundle-version="1.12.1174"
com.raytheon.uf.edex.pointdata
Export-Package: com.raytheon.uf.edex.plugin.acars,
com.raytheon.uf.edex.plugin.acars.common,
com.raytheon.uf.edex.plugin.acars.dao
Import-Package: com.raytheon.uf.common.dataplugin.acars,
com.raytheon.uf.common.status,
com.raytheon.uf.common.wmo

View file

@ -24,6 +24,7 @@ import static com.raytheon.uf.edex.decodertools.bufr.packets.DataPacketTypes.Sub
import static com.raytheon.uf.edex.plugin.acars.common.ACARSConstants.NO_ICING;
import static com.raytheon.uf.edex.plugin.acars.common.ACARSConstants.RESERVE_13;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashSet;
@ -50,12 +51,13 @@ import com.raytheon.uf.edex.decodertools.bufr.packets.IBUFRDataPacket;
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* ------------- -------- ----------- --------------------------
* Jan 22, 2009 1939 jkorman Initial creation
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
* Sep 18, 2013 2339 njensen Index safety check in getTailNumber()
* Mar 27, 2014 2811 skorolev Added check for empty message.
* May 14, 2014 2536 bclement moved WMO Header to common, removed TimeTools usage
* Jun 12, 2014 2061 bsteffen Generate unique stationid
*
* </pre>
*
@ -82,6 +84,9 @@ public class ACARSDataAdapter {
private static final int[] DETAIL_PHASE_MAP = { 3, 4, 2, 3, 4, 5, 6, 5, 5,
5, 5, 6, 6, 6, 6, 7, };
private static final DecimalFormat STATION_ID_FORMAT = new DecimalFormat(
"###.###");
private String traceId = null;
/**
@ -495,6 +500,7 @@ public class ACARSDataAdapter {
if (hgt != null) {
loc.setFlightLevel(hgt.intValue());
}
generateStationId(loc);
}
return loc;
}
@ -534,10 +540,19 @@ public class ACARSDataAdapter {
loc.setLatitude(lat);
loc.setLongitude(lon);
loc.setLocation(lat, lon);
generateStationId(loc);
}
return loc;
}
private static void generateStationId(AircraftObsLocation loc) {
synchronized (STATION_ID_FORMAT) {
loc.setStationId(STATION_ID_FORMAT.format(loc.getLongitude()) + ":"
+ STATION_ID_FORMAT.format(loc.getLatitude()));
}
}
/**
*
* @param dataList