Merge branch 'master_14.2.2' (14.2.2-3) into omaha_14.2.2
Former-commit-id: 0b9acf9e28c1048bd3b98af7c04e6953c8425e81
This commit is contained in:
commit
2ea3d45ecc
7 changed files with 106 additions and 92 deletions
|
@ -26,14 +26,15 @@ import java.util.Set;
|
||||||
|
|
||||||
import com.raytheon.uf.viz.cloudheight.rsc.CloudHeightResource;
|
import com.raytheon.uf.viz.cloudheight.rsc.CloudHeightResource;
|
||||||
import com.raytheon.uf.viz.cloudheight.rsc.CloudHeightResourceData;
|
import com.raytheon.uf.viz.cloudheight.rsc.CloudHeightResourceData;
|
||||||
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
|
||||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||||
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
|
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
|
||||||
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
||||||
import com.raytheon.uf.viz.core.exception.VizException;
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
|
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
|
||||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource.ResourceStatus;
|
import com.raytheon.uf.viz.core.rsc.AbstractVizResource.ResourceStatus;
|
||||||
import com.raytheon.uf.viz.core.rsc.IInitListener;
|
import com.raytheon.uf.viz.core.rsc.IInitListener;
|
||||||
|
import com.raytheon.uf.viz.core.rsc.IResourceGroup;
|
||||||
import com.raytheon.uf.viz.core.rsc.ResourceList;
|
import com.raytheon.uf.viz.core.rsc.ResourceList;
|
||||||
import com.raytheon.uf.viz.core.rsc.ResourceList.AddListener;
|
import com.raytheon.uf.viz.core.rsc.ResourceList.AddListener;
|
||||||
import com.raytheon.uf.viz.core.rsc.ResourceList.RemoveListener;
|
import com.raytheon.uf.viz.core.rsc.ResourceList.RemoveListener;
|
||||||
|
@ -53,9 +54,10 @@ import com.raytheon.viz.ui.perspectives.IRenderableDisplayCustomizer;
|
||||||
*
|
*
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------- -------- ----------- --------------------------
|
||||||
* Jul 31, 2013 2190 mschenke Initial creation
|
* Jul 31, 2013 2190 mschenke Initial creation
|
||||||
|
* Mar 20, 2014 2932 bsteffen Better support of blended resources.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -198,8 +200,22 @@ public class D2DPopupSkewTDisplayCustomizer implements
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isCompatibleResource(ResourcePair rp) {
|
private boolean isCompatibleResource(ResourcePair rp) {
|
||||||
return COMPATIBLE_CLASSES.contains(rp.getResourceData().getClass())
|
AbstractResourceData resourceData = rp.getResourceData();
|
||||||
&& CloudHeightResource.isValidContributor(rp.getResource());
|
if (resourceData != null) {
|
||||||
|
if (COMPATIBLE_CLASSES
|
||||||
|
.contains(rp.getResourceData().getClass())) {
|
||||||
|
return CloudHeightResource.isValidContributor(rp
|
||||||
|
.getResource());
|
||||||
|
} else if (resourceData instanceof IResourceGroup) {
|
||||||
|
IResourceGroup group = (IResourceGroup) resourceData;
|
||||||
|
for (ResourcePair internalPair : group.getResourceList()) {
|
||||||
|
if (isCompatibleResource(internalPair)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void addResources(IDescriptor descriptor) {
|
private synchronized void addResources(IDescriptor descriptor) {
|
||||||
|
|
|
@ -26,6 +26,7 @@ gov.noaa.nws.ncep.viz.rsc.idft
|
||||||
gov.noaa.nws.ncep.viz.rsc.intlsig
|
gov.noaa.nws.ncep.viz.rsc.intlsig
|
||||||
gov.noaa.nws.ncep.viz.rsc.lightning
|
gov.noaa.nws.ncep.viz.rsc.lightning
|
||||||
gov.noaa.nws.ncep.viz.rsc.mosaic
|
gov.noaa.nws.ncep.viz.rsc.mosaic
|
||||||
|
gov.noaa.nws.ncep.viz.rsc.ncgrid
|
||||||
gov.noaa.nws.ncep.viz.rsc.ncscat
|
gov.noaa.nws.ncep.viz.rsc.ncscat
|
||||||
gov.noaa.nws.ncep.viz.rsc.nonconvsigmet
|
gov.noaa.nws.ncep.viz.rsc.nonconvsigmet
|
||||||
gov.noaa.nws.ncep.viz.rsc.plotdata
|
gov.noaa.nws.ncep.viz.rsc.plotdata
|
||||||
|
|
|
@ -75,6 +75,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||||
* Oct 14, 2013 2361 njensen Removed IDecoderGettable
|
* Oct 14, 2013 2361 njensen Removed IDecoderGettable
|
||||||
* Dec 10, 2013 2616 mpduff Added stationId to the unique constraint
|
* Dec 10, 2013 2616 mpduff Added stationId to the unique constraint
|
||||||
* jan 22, 2014 2713 dhladky Calendar conversion.
|
* jan 22, 2014 2713 dhladky Calendar conversion.
|
||||||
|
* Mar 21, 2014 2939 dhladky Fixed mismatches in HDF5, DB records.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -85,7 +86,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||||
@Entity
|
@Entity
|
||||||
@SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "madisseq")
|
@SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "madisseq")
|
||||||
@Table(name = "madis", uniqueConstraints = { @UniqueConstraint(columnNames = {
|
@Table(name = "madis", uniqueConstraints = { @UniqueConstraint(columnNames = {
|
||||||
"location", "stationId", "refTime", "provider", "subProvider", "restriction" }) })
|
"latitude", "longitude", "stationId", "refTime", "provider", "subProvider", "restriction" }) })
|
||||||
@org.hibernate.annotations.Table(appliesTo = "madis", indexes = { @Index(name = "madis_wfsQueryIndex", columnNames = {
|
@org.hibernate.annotations.Table(appliesTo = "madis", indexes = { @Index(name = "madis_wfsQueryIndex", columnNames = {
|
||||||
"refTime", "location" }), })
|
"refTime", "location" }), })
|
||||||
@DynamicSerialize
|
@DynamicSerialize
|
||||||
|
@ -121,7 +122,7 @@ public class MadisRecord extends PersistablePluginDataObject implements
|
||||||
@Column
|
@Column
|
||||||
@DataURI(position = 4)
|
@DataURI(position = 4)
|
||||||
private int restriction;
|
private int restriction;
|
||||||
|
|
||||||
/** A string denoting the time of observation */
|
/** A string denoting the time of observation */
|
||||||
@DynamicSerializeElement
|
@DynamicSerializeElement
|
||||||
@Transient
|
@Transient
|
||||||
|
@ -349,7 +350,7 @@ public class MadisRecord extends PersistablePluginDataObject implements
|
||||||
@DynamicSerializeElement
|
@DynamicSerializeElement
|
||||||
@Embedded
|
@Embedded
|
||||||
private PointDataView pointDataView;
|
private PointDataView pointDataView;
|
||||||
|
|
||||||
public static final String PLUGIN_NAME = "madis";
|
public static final String PLUGIN_NAME = "madis";
|
||||||
|
|
||||||
public static final String STATION_ID = "stationId";
|
public static final String STATION_ID = "stationId";
|
||||||
|
@ -453,6 +454,19 @@ public class MadisRecord extends PersistablePluginDataObject implements
|
||||||
|
|
||||||
public static final String RESTRICTION = "RESTRICTION";
|
public static final String RESTRICTION = "RESTRICTION";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* URI constructor
|
||||||
|
* @param string
|
||||||
|
*/
|
||||||
|
public MadisRecord(String string) {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
//empty constructor
|
||||||
|
public MadisRecord() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the pointdata view
|
* Get the pointdata view
|
||||||
|
@ -1086,4 +1100,14 @@ public class MadisRecord extends PersistablePluginDataObject implements
|
||||||
public String getPluginName() {
|
public String getPluginName() {
|
||||||
return PLUGIN_NAME;
|
return PLUGIN_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allow overwrite of MADIS records
|
||||||
|
* MADIS records are frequently updated for even the same temporal
|
||||||
|
* record. QC value changes will cause record re-submissions.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean getAllowOverWrite() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ package com.raytheon.uf.edex.database.handlers;
|
||||||
|
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -47,7 +48,8 @@ import com.raytheon.uf.edex.database.query.DatabaseQuery;
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Apr 5, 2011 njensen Initial creation
|
* Apr 05, 2011 njensen Initial creation
|
||||||
|
* Mar 24, 2014 2941 mpduff Sort data before returning it.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -180,6 +182,8 @@ public class TimeQueryHandler implements IRequestHandler<TimeQueryRequest> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Collections.sort(times);
|
||||||
return times;
|
return times;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,7 @@
|
||||||
<constructor-arg ref="madis-camel" />
|
<constructor-arg ref="madis-camel" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="madisSeparator" class="com.raytheon.uf.edex.plugin.madis.MadisSeparator"
|
<bean id="madisSeparator" class="com.raytheon.uf.edex.plugin.madis.MadisSeparator">
|
||||||
depends-on="jmsIngestMadisConfig, jms-madis, madisThreadPool">
|
|
||||||
<constructor-arg
|
<constructor-arg
|
||||||
value="jms-durable:queue:Ingest.madisSeparator" />
|
value="jms-durable:queue:Ingest.madisSeparator" />
|
||||||
<!-- time in hours for orphan purging -->
|
<!-- time in hours for orphan purging -->
|
||||||
|
|
|
@ -47,6 +47,7 @@ import com.raytheon.uf.edex.pointdata.PointDataQuery;
|
||||||
* 28 Mar 2013 1746 dhladky Created
|
* 28 Mar 2013 1746 dhladky Created
|
||||||
* 10 Jun 2013 1763 dhladky Updates for speed.
|
* 10 Jun 2013 1763 dhladky Updates for speed.
|
||||||
* 08 Jul 2013 2171 dhladky Removed dataURI
|
* 08 Jul 2013 2171 dhladky Removed dataURI
|
||||||
|
* 21 Mar 2014 2939 dhladky Fixed mismatches in HDF5, DB records.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author dhladky
|
* @author dhladky
|
||||||
|
@ -164,8 +165,10 @@ public class MadisPointDataTransform {
|
||||||
public static final String RESTRICTION = "restriction";
|
public static final String RESTRICTION = "restriction";
|
||||||
|
|
||||||
public static final String TIME_OBS = "timeObs";
|
public static final String TIME_OBS = "timeObs";
|
||||||
|
|
||||||
public static final String ID = "id";
|
public static final String ID = "id";
|
||||||
|
|
||||||
|
public static final String EQUAL = "=";
|
||||||
|
|
||||||
public static final String[] ALL_PARAMS = { DATASET, DEWPOINT,
|
public static final String[] ALL_PARAMS = { DATASET, DEWPOINT,
|
||||||
DEWPOINT_QCD, DEWPOINT_QCA, DEWPOINT_QCR, RH, RH_QCD, RH_QCA,
|
DEWPOINT_QCD, DEWPOINT_QCA, DEWPOINT_QCR, RH, RH_QCD, RH_QCA,
|
||||||
|
@ -249,10 +252,7 @@ public class MadisPointDataTransform {
|
||||||
private PointDataView buildView(PointDataContainer container,
|
private PointDataView buildView(PointDataContainer container,
|
||||||
MadisRecord record) {
|
MadisRecord record) {
|
||||||
PointDataView pdv = container.append();
|
PointDataView pdv = container.append();
|
||||||
|
|
||||||
// I think this is inefficient but, PlotData for SVG reads
|
|
||||||
// the pointDataView so, the first 4 that are already in the
|
|
||||||
// DB have to be here.
|
|
||||||
pdv.setLong(TIME_OBS, record.getDataTime().getRefTime().getTime());
|
pdv.setLong(TIME_OBS, record.getDataTime().getRefTime().getTime());
|
||||||
pdv.setString(PROVIDER, record.getProvider());
|
pdv.setString(PROVIDER, record.getProvider());
|
||||||
pdv.setString(SUB_PROVIDER, record.getSubProvider());
|
pdv.setString(SUB_PROVIDER, record.getSubProvider());
|
||||||
|
@ -310,75 +310,10 @@ public class MadisPointDataTransform {
|
||||||
pdv.setString(PRESSURE_QCD, record.getPressure_qcd().toString());
|
pdv.setString(PRESSURE_QCD, record.getPressure_qcd().toString());
|
||||||
pdv.setInt(PRESSURE_QCA, record.getPressure_qca());
|
pdv.setInt(PRESSURE_QCA, record.getPressure_qca());
|
||||||
pdv.setInt(PRESSURE_QCR, record.getPressure_qcr());
|
pdv.setInt(PRESSURE_QCR, record.getPressure_qcr());
|
||||||
|
|
||||||
return pdv;
|
return pdv;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a MadisRecord from a PointDataContainer
|
|
||||||
*
|
|
||||||
* @param pdc
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static MadisRecord toMadisRecord(MadisRecord mr) {
|
|
||||||
|
|
||||||
PointDataView pdv = mr.getPointDataView();
|
|
||||||
mr.setDataset(pdv.getInt(DATASET));
|
|
||||||
// dewpoint
|
|
||||||
mr.setDewpoint(pdv.getFloat(DEWPOINT));
|
|
||||||
mr.setDewpoint_qcd(QCD.fromString(pdv.getString(DEWPOINT_QCD)));
|
|
||||||
mr.setDewpoint_qca(pdv.getInt(DEWPOINT_QCA));
|
|
||||||
mr.setDewpoint_qcr(pdv.getInt(DEWPOINT_QCR));
|
|
||||||
// relative humidty
|
|
||||||
mr.setRh(pdv.getFloat(RH));
|
|
||||||
mr.setRh_qcd(QCD.fromString(pdv.getString(RH_QCD)));
|
|
||||||
mr.setRh_qca(pdv.getInt(RH_QCA));
|
|
||||||
mr.setRh_qcr(pdv.getInt(RH_QCR));
|
|
||||||
// altimeter setting
|
|
||||||
mr.setAltimeter(pdv.getFloat(ALTIMETER));
|
|
||||||
mr.setAltimeter_qcd(QCD.fromString(pdv.getString(ALTIMETER_QCD)));
|
|
||||||
mr.setAltimeter_qca(pdv.getInt(ALTIMETER_QCA));
|
|
||||||
mr.setAltimeter_qcr(pdv.getInt(ALTIMETER_QCR));
|
|
||||||
// temperature
|
|
||||||
mr.setTemperature(pdv.getFloat(TEMPERATURE));
|
|
||||||
mr.setTemperature_qcd(QCD.fromString(pdv.getString(TEMPERATURE_QCD)));
|
|
||||||
mr.setTemperature_qca(pdv.getInt(TEMPERATURE_QCA));
|
|
||||||
mr.setTemperature_qcr(pdv.getInt(TEMPERATURE_QCR));
|
|
||||||
// wind direction
|
|
||||||
mr.setWindDirection(pdv.getNumber(WINDDIRECTION).intValue());
|
|
||||||
mr.setWindDirection_qcd(QCD.fromString(pdv.getString(WINDDIRECTION_QCD)));
|
|
||||||
mr.setWindDirection_qca(pdv.getInt(WINDDIRECTION_QCA));
|
|
||||||
mr.setWindDirection_qcr(pdv.getInt(WINDDIRECTION_QCR));
|
|
||||||
// precip rate
|
|
||||||
mr.setPrecipRate(pdv.getFloat(PRECIPRATE));
|
|
||||||
mr.setPrecipRate_qcd(QCD.fromString(pdv.getString(PRECIPRATE_QCD)));
|
|
||||||
mr.setPrecipRate_qca(pdv.getInt(PRECIPRATE_QCA));
|
|
||||||
mr.setPrecipRate_qcr(pdv.getInt(PRECIPRATE_QCR));
|
|
||||||
// WINDSPEED
|
|
||||||
mr.setWindSpeed(pdv.getFloat(WINDSPEED));
|
|
||||||
mr.setWindSpeed_qcd(QCD.fromString(pdv.getString(WINDSPEED_QCD)));
|
|
||||||
mr.setWindSpeed_qca(pdv.getInt(WINDSPEED_QCA));
|
|
||||||
mr.setWindSpeed_qcr(pdv.getInt(WINDSPEED_QCR));
|
|
||||||
// Wind Gust
|
|
||||||
mr.setWindGust(pdv.getFloat(WINDGUST));
|
|
||||||
mr.setWindGust_qcd(QCD.fromString(pdv.getString(WINDGUST_QCD)));
|
|
||||||
mr.setWindGust_qca(pdv.getInt(WINDGUST_QCA));
|
|
||||||
mr.setWindGust_qcr(pdv.getInt(WINDGUST_QCR));
|
|
||||||
// Precipital Water
|
|
||||||
mr.setPrecipitalWater(pdv.getFloat(PRECIPITALWATER));
|
|
||||||
mr.setPrecipitalWater_qcd(QCD.fromString(pdv
|
|
||||||
.getString(PRECIPITALWATER_QCD)));
|
|
||||||
mr.setPrecipitalWater_qca(pdv.getInt(PRECIPITALWATER_QCA));
|
|
||||||
mr.setPrecipitalWater_qcr(pdv.getInt(PRECIPITALWATER_QCR));
|
|
||||||
// Pressure
|
|
||||||
mr.setPressure(pdv.getFloat(PRESSURE));
|
|
||||||
mr.setPressure_qcd(QCD.fromString(pdv.getString(PRESSURE_QCD)));
|
|
||||||
mr.setPressure_qca(pdv.getInt(PRESSURE_QCA));
|
|
||||||
mr.setPressure_qcr(pdv.getInt(PRESSURE_QCR));
|
|
||||||
|
|
||||||
return mr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a MadisRecord from a PointDataContainer
|
* Creates a MadisRecord from a PointDataContainer
|
||||||
*
|
*
|
||||||
|
@ -458,7 +393,7 @@ public class MadisPointDataTransform {
|
||||||
try {
|
try {
|
||||||
request = new PointDataQuery(MadisRecord.PLUGIN_NAME);
|
request = new PointDataQuery(MadisRecord.PLUGIN_NAME);
|
||||||
request.requestAllLevels();
|
request.requestAllLevels();
|
||||||
request.addParameter(ID, ""+record.getId(), "=");
|
request.addParameter(ID, String.valueOf(record.getId()), EQUAL);
|
||||||
request.setParameters(ALL_PARAMS_LIST);
|
request.setParameters(ALL_PARAMS_LIST);
|
||||||
result = request.execute();
|
result = request.execute();
|
||||||
|
|
||||||
|
@ -483,9 +418,7 @@ public class MadisPointDataTransform {
|
||||||
* @return populated Madis record Array
|
* @return populated Madis record Array
|
||||||
* @throws PluginException
|
* @throws PluginException
|
||||||
*/
|
*/
|
||||||
// TODO I would like to make a PointDataInterface that could implement this
|
|
||||||
// and other methods that all of these
|
|
||||||
// will use.
|
|
||||||
public static PluginDataObject[] populatePointDataFields(
|
public static PluginDataObject[] populatePointDataFields(
|
||||||
PluginDataObject[] records) {
|
PluginDataObject[] records) {
|
||||||
|
|
||||||
|
@ -507,10 +440,19 @@ public class MadisPointDataTransform {
|
||||||
request.addParameter(ID, ids.toString(), IN);
|
request.addParameter(ID, ids.toString(), IN);
|
||||||
request.setParameters(ALL_PARAMS_LIST);
|
request.setParameters(ALL_PARAMS_LIST);
|
||||||
result = request.execute();
|
result = request.execute();
|
||||||
|
|
||||||
|
// correlate up the PointDataViews with the correct records.
|
||||||
|
HashMap<Integer, PointDataView> pdvs = new HashMap<Integer, PointDataView>(records.length);
|
||||||
for (int i = 0; i < records.length; i++) {
|
for (int i = 0; i < records.length; i++) {
|
||||||
PointDataView pdv = result.readRandom(i);
|
PointDataView pdv = result.readRandom(i);
|
||||||
toMadisRecord((MadisRecord) records[i], pdv);
|
// correlate ID from record with ID from PDV
|
||||||
|
int id = pdv.getInt(ID);
|
||||||
|
pdvs.put(id, pdv);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < records.length; i++) {
|
||||||
|
int id = records[i].getId();
|
||||||
|
records[i] = toMadisRecord((MadisRecord)records[i], pdvs.get(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package gov.noaa.nws.ncep.viz.gempak.nativelib;
|
package gov.noaa.nws.ncep.viz.gempak.nativelib;
|
||||||
|
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.FileLocator;
|
import org.eclipse.core.runtime.FileLocator;
|
||||||
|
@ -10,20 +11,47 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
import com.raytheon.uf.common.status.UFStatus;
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility to load a specific native library
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------- -------- ----------- -----------------------------------------
|
||||||
|
* --/--/---- Initial Creation
|
||||||
|
* Mar 20, 2014 2919 njensen Safety checks, better error messages
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
public class LibraryLoader {
|
public class LibraryLoader {
|
||||||
|
|
||||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||||
.getHandler(LibraryLoader.class);
|
.getHandler(LibraryLoader.class);
|
||||||
|
|
||||||
public static void load(String libName) {
|
public static void load(String libName) {
|
||||||
URL url = null;
|
URL url = null;
|
||||||
|
Path path = null;
|
||||||
try {
|
try {
|
||||||
Bundle b = Activator.getDefault().getBundle();
|
Bundle b = Activator.getDefault().getBundle();
|
||||||
url = FileLocator.find(b, new Path(System.mapLibraryName(libName)),
|
path = new Path(System.mapLibraryName(libName));
|
||||||
null);
|
url = FileLocator.find(b, path, null);
|
||||||
|
if (url == null) {
|
||||||
|
throw new FileNotFoundException("Unable to locate "
|
||||||
|
+ path.toString());
|
||||||
|
}
|
||||||
url = FileLocator.resolve(url);
|
url = FileLocator.resolve(url);
|
||||||
System.load(url.getPath());
|
System.load(url.getPath());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
String msg = "Could not Load native Library: " + url.getFile();
|
String msg = "Could not load native Library: ";
|
||||||
|
if (url != null) {
|
||||||
|
msg += url.getFile();
|
||||||
|
} else {
|
||||||
|
msg += path.toString();
|
||||||
|
}
|
||||||
statusHandler.handle(Priority.PROBLEM, msg, e);
|
statusHandler.handle(Priority.PROBLEM, msg, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue