Issue #2876 - Pluginize NDM

review comments

Change-Id: I9911c531a0e2ac735df949cc3f9aa72dc192483d

Former-commit-id: 944fca16b8 [formerly 2f1aa28a4389c15e20724ebc8d79501c338f565e]
Former-commit-id: c388cb839b
This commit is contained in:
Mike Duff 2014-03-06 10:26:48 -06:00
parent 17ee130b2a
commit 7bb9ada00d
46 changed files with 919 additions and 539 deletions

View file

@ -18,7 +18,8 @@ Require-Bundle: com.raytheon.uf.common.dataplugin.bufrua;bundle-version="1.12.11
com.raytheon.uf.edex.pointdata;bundle-version="1.12.1174", com.raytheon.uf.edex.pointdata;bundle-version="1.12.1174",
com.raytheon.uf.edex.menus;bundle-version="1.0.0", com.raytheon.uf.edex.menus;bundle-version="1.0.0",
com.raytheon.uf.edex.bufrtools;bundle-version="1.12.1174", com.raytheon.uf.edex.bufrtools;bundle-version="1.12.1174",
com.raytheon.uf.edex.decodertools;bundle-version="1.12.1174" com.raytheon.uf.edex.decodertools;bundle-version="1.12.1174",
com.raytheon.uf.edex.ndm;bundle-version="1.0.0"
Import-Package: com.raytheon.edex.esb, Import-Package: com.raytheon.edex.esb,
com.raytheon.edex.plugin, com.raytheon.edex.plugin,
org.apache.commons.logging org.apache.commons.logging

View file

@ -19,6 +19,21 @@
<constructor-arg ref="bufrua-camel"/> <constructor-arg ref="bufrua-camel"/>
</bean> </bean>
<bean id="raobListener" class="com.raytheon.edex.plugin.bufrua.ingest.RAOBSubscriber" />
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="raob.spi" />
<constructor-arg ref="raobListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="raob.goodness" />
<constructor-arg ref="raobListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="raob.primary" />
<constructor-arg ref="raobListener" />
</bean>
<camelContext id="bufrua-camel" <camelContext id="bufrua-camel"
xmlns="http://camel.apache.org/schema/spring" xmlns="http://camel.apache.org/schema/spring"
errorHandlerRef="errorHandler" errorHandlerRef="errorHandler"

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * further licensing information.
**/ **/
package com.raytheon.uf.common.site.ingest; package com.raytheon.edex.plugin.bufrua.ingest;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.BufferedWriter; import java.io.BufferedWriter;
@ -38,9 +38,10 @@ import com.raytheon.uf.common.pointdata.vadriver.VA_Driver;
import com.raytheon.uf.common.status.IUFStatusHandler; 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;
import com.raytheon.uf.edex.ndm.ingest.INationalDatasetSubscriber;
/** /**
* TODO Add Description * RAOB NDM subscriber.
* *
* <pre> * <pre>
* *
@ -48,7 +49,8 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Feb 8, 2011 bfarmer Initial creation * Feb 08, 2011 bfarmer Initial creation
* Mar 06, 2014 2876 mpduff New NDM plugin.
* *
* </pre> * </pre>
* *
@ -57,7 +59,9 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
*/ */
public class RAOBSubscriber implements INationalDatasetSubscriber { public class RAOBSubscriber implements INationalDatasetSubscriber {
private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(RAOBSubscriber.class); private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(RAOBSubscriber.class);
private Thread combineThread = null; private Thread combineThread = null;
@Override @Override
@ -77,6 +81,7 @@ public class RAOBSubscriber implements INationalDatasetSubscriber {
if (null == combineThread) { if (null == combineThread) {
combineThread = new Thread(new Runnable() { combineThread = new Thread(new Runnable() {
@Override
public void run() { public void run() {
try { try {
Thread.sleep(60 * 1000); Thread.sleep(60 * 1000);
@ -100,6 +105,7 @@ public class RAOBSubscriber implements INationalDatasetSubscriber {
if (null == combineThread) { if (null == combineThread) {
combineThread = new Thread(new Runnable() { combineThread = new Thread(new Runnable() {
@Override
public void run() { public void run() {
try { try {
Thread.sleep(60 * 1000); Thread.sleep(60 * 1000);
@ -120,10 +126,12 @@ public class RAOBSubscriber implements INationalDatasetSubscriber {
private void saveFile(File file, File outFile) { private void saveFile(File file, File outFile) {
if ((file != null) && file.exists()) { if ((file != null) && file.exists()) {
BufferedReader fis = null;
BufferedWriter fos = null;
try { try {
BufferedReader fis = new BufferedReader(new InputStreamReader( fis = new BufferedReader(new InputStreamReader(
new FileInputStream(file))); new FileInputStream(file)));
BufferedWriter fos = new BufferedWriter(new OutputStreamWriter( fos = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(outFile))); new FileOutputStream(outFile)));
String line = null; String line = null;
try { try {
@ -131,15 +139,29 @@ public class RAOBSubscriber implements INationalDatasetSubscriber {
fos.write(line); fos.write(line);
fos.newLine(); fos.newLine();
} }
fos.close();
} catch (IOException e) { } catch (IOException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"Could not read File ", e); "Could not read file: " + file.getName(), e);
} }
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM, "Failed to find file: "
"Failed to find File ", e); + file.getName(), e);
} finally {
if (fis != null) {
try {
fis.close();
} catch (IOException e) {
// ignore
}
}
if (fos != null) {
try {
fos.close();
} catch (IOException e) {
// ignore
}
}
} }
} }
} }
@ -156,7 +178,8 @@ public class RAOBSubscriber implements INationalDatasetSubscriber {
primary.createNewFile(); primary.createNewFile();
} catch (IOException e) { } catch (IOException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"Could not create primary file. ", e); "Could not create primary file: " + primary.getName(),
e);
} }
} }
if (!spi.exists()) { if (!spi.exists()) {
@ -164,7 +187,7 @@ public class RAOBSubscriber implements INationalDatasetSubscriber {
spi.createNewFile(); spi.createNewFile();
} catch (IOException e) { } catch (IOException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"Could not create primary file. ", e); "Could not create spi file: " + spi.getName(), e);
} }
} }
if (goodness.exists()) { if (goodness.exists()) {

View file

@ -17,7 +17,9 @@ Require-Bundle: com.raytheon.edex.common,
javax.persistence, javax.persistence,
org.apache.camel;bundle-version="1.0.0";resolution:=optional, org.apache.camel;bundle-version="1.0.0";resolution:=optional,
com.raytheon.uf.common.pointdata;bundle-version="1.11.7", com.raytheon.uf.common.pointdata;bundle-version="1.11.7",
com.raytheon.uf.edex.pointdata;bundle-version="1.11.7" com.raytheon.uf.edex.pointdata;bundle-version="1.11.7",
com.raytheon.uf.edex.ndm;bundle-version="1.0.0",
com.raytheon.uf.common.localization;bundle-version="1.14.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: com.raytheon.uf.common.dataplugin.obs.metar, Import-Package: com.raytheon.uf.common.dataplugin.obs.metar,
com.raytheon.uf.common.dataplugin.obs.metar.util, com.raytheon.uf.common.dataplugin.obs.metar.util,

View file

@ -22,6 +22,21 @@
<constructor-arg ref="obs-camel" /> <constructor-arg ref="obs-camel" />
</bean> </bean>
<bean id="mtrListener" class="com.raytheon.edex.plugin.obs.ingest.MTRSubscriber" />
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="MTR.spi" />
<constructor-arg ref="mtrListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="MTR.goodness" />
<constructor-arg ref="mtrListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="MTR.primary" />
<constructor-arg ref="mtrListener" />
</bean>
<camelContext id="obs-camel" xmlns="http://camel.apache.org/schema/spring" <camelContext id="obs-camel" xmlns="http://camel.apache.org/schema/spring"
errorHandlerRef="errorHandler" autoStartup="false"> errorHandlerRef="errorHandler" autoStartup="false">

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * further licensing information.
**/ **/
package com.raytheon.uf.common.site.ingest; package com.raytheon.edex.plugin.obs.ingest;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.BufferedWriter; import java.io.BufferedWriter;
@ -38,9 +38,10 @@ import com.raytheon.uf.common.pointdata.vadriver.VA_Driver;
import com.raytheon.uf.common.status.IUFStatusHandler; 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;
import com.raytheon.uf.edex.ndm.ingest.INationalDatasetSubscriber;
/** /**
* TODO Add Description * MTR NDM subscriber.
* *
* <pre> * <pre>
* *
@ -49,6 +50,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jan 29, 2011 bfarmer Initial creation * Jan 29, 2011 bfarmer Initial creation
* Mar 06, 2014 2876 mpduff New NDM plugin.
* *
* </pre> * </pre>
* *
@ -57,7 +59,8 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
*/ */
public class MTRSubscriber implements INationalDatasetSubscriber { public class MTRSubscriber implements INationalDatasetSubscriber {
private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(MTRSubscriber.class); private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(MTRSubscriber.class);
private Thread combineThread = null; private Thread combineThread = null;
@ -78,6 +81,7 @@ public class MTRSubscriber implements INationalDatasetSubscriber {
if (null == combineThread) { if (null == combineThread) {
combineThread = new Thread(new Runnable() { combineThread = new Thread(new Runnable() {
@Override
public void run() { public void run() {
try { try {
Thread.sleep(60 * 1000); Thread.sleep(60 * 1000);
@ -101,6 +105,7 @@ public class MTRSubscriber implements INationalDatasetSubscriber {
if (null == combineThread) { if (null == combineThread) {
combineThread = new Thread(new Runnable() { combineThread = new Thread(new Runnable() {
@Override
public void run() { public void run() {
try { try {
Thread.sleep(60 * 1000); Thread.sleep(60 * 1000);
@ -120,13 +125,12 @@ public class MTRSubscriber implements INationalDatasetSubscriber {
private void saveFile(File file, File outFile) { private void saveFile(File file, File outFile) {
if ((file != null) && file.exists()) { if ((file != null) && file.exists()) {
BufferedReader fis = null;
BufferedWriter fos = null;
try { try {
if (!outFile.exists()) { fis = new BufferedReader(new InputStreamReader(
outFile.createNewFile();
}
BufferedReader fis = new BufferedReader(new InputStreamReader(
new FileInputStream(file))); new FileInputStream(file)));
BufferedWriter fos = new BufferedWriter(new OutputStreamWriter( fos = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(outFile))); new FileOutputStream(outFile)));
String line = null; String line = null;
try { try {
@ -134,19 +138,29 @@ public class MTRSubscriber implements INationalDatasetSubscriber {
fos.write(line); fos.write(line);
fos.newLine(); fos.newLine();
} }
fos.close();
} catch (IOException e) { } catch (IOException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"Could not read File ", e); "Could not read file: " + file.getName(), e);
} }
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM, "Failed to find file: "
"Failed to find File ", e); + file.getName(), e);
} finally {
} catch (IOException e) { if (fis != null) {
statusHandler.handle(Priority.PROBLEM, try {
"Could not create output file. ", e); fis.close();
} catch (IOException e) {
// ignore
}
}
if (fos != null) {
try {
fos.close();
} catch (IOException e) {
// ignore
}
}
} }
} }
} }
@ -163,7 +177,8 @@ public class MTRSubscriber implements INationalDatasetSubscriber {
primary.createNewFile(); primary.createNewFile();
} catch (IOException e) { } catch (IOException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"Could not create primary file. ", e); "Could not create primary file: " + primary.getName(),
e);
} }
} }
if (!spi.exists()) { if (!spi.exists()) {
@ -171,7 +186,7 @@ public class MTRSubscriber implements INationalDatasetSubscriber {
spi.createNewFile(); spi.createNewFile();
} catch (IOException e) { } catch (IOException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"Could not create primary file. ", e); "Could not create spi file: " + spi.getName(), e);
} }
} }
if (goodness.exists()) { if (goodness.exists()) {

View file

@ -16,7 +16,8 @@ Require-Bundle: com.raytheon.edex.common,
com.raytheon.uf.common.status;bundle-version="1.11.11", com.raytheon.uf.common.status;bundle-version="1.11.11",
com.raytheon.uf.common.dataplugin.radar, com.raytheon.uf.common.dataplugin.radar,
com.raytheon.uf.edex.menus;bundle-version="1.0.0", com.raytheon.uf.edex.menus;bundle-version="1.0.0",
org.itadaki.bzip2;bundle-version="0.9.1" org.itadaki.bzip2;bundle-version="0.9.1",
com.raytheon.uf.edex.ndm;bundle-version="1.0.0"
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Export-Package: com.raytheon.edex.plugin.radar, Export-Package: com.raytheon.edex.plugin.radar,
com.raytheon.edex.plugin.radar.dao, com.raytheon.edex.plugin.radar.dao,
@ -25,5 +26,4 @@ Export-Package: com.raytheon.edex.plugin.radar,
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: com.raytheon.uf.common.comm, Import-Package: com.raytheon.uf.common.comm,
com.raytheon.uf.common.dataplugin.text.db, com.raytheon.uf.common.dataplugin.text.db,
com.raytheon.uf.common.site.ingest,
org.apache.commons.logging org.apache.commons.logging

View file

@ -99,4 +99,25 @@
value="com.raytheon.uf.common.dataplugin.radar.request.RadarServerConnectionRequest" /> value="com.raytheon.uf.common.dataplugin.radar.request.RadarServerConnectionRequest" />
<constructor-arg ref="radarServerConnectionHandler" /> <constructor-arg ref="radarServerConnectionHandler" />
</bean> </bean>
<bean id="radarMenuCreator" class="com.raytheon.edex.plugin.radar.util.RadarMenuUtil"/>
<bean id="import88dLocations" class="com.raytheon.edex.plugin.radar.util.Import88DLocationsUtil"/>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="tdwrElevations.txt" />
<constructor-arg ref="radarMenuCreator" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="fsl-w88d.shp" />
<constructor-arg ref="import88dLocations" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="fsl-w88d.shx" />
<constructor-arg ref="import88dLocations" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="fsl-w88d.dbf" />
<constructor-arg ref="import88dLocations" />
</bean>
</beans> </beans>

View file

@ -23,11 +23,11 @@ import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile; import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory; import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.site.ingest.INationalDatasetSubscriber;
import com.raytheon.uf.common.status.IUFStatusHandler; 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;
import com.raytheon.uf.edex.database.DataAccessLayerException; import com.raytheon.uf.edex.database.DataAccessLayerException;
import com.raytheon.uf.edex.ndm.ingest.INationalDatasetSubscriber;
import com.vividsolutions.jts.geom.GeometryFactory; import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.Point; import com.vividsolutions.jts.geom.Point;
import com.vividsolutions.jts.geom.PrecisionModel; import com.vividsolutions.jts.geom.PrecisionModel;
@ -43,12 +43,13 @@ import com.vividsolutions.jts.io.WKTReader;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 10Oct2011 10520 JWork Initial check-in. * 10Oct2011 10520 JWork Initial check-in.
* 09/11/2012 DR 15366 D. Friedman Set SRID on radar stations. * 09/11/2012 DR 15366 D. Friedman Set SRID on radar stations.
* Mar 06, 2014 2876 mpduff Moved NationalDatasetSubscriber.
* </pre> * </pre>
* *
*/ */
public class Import88DLocationsUtil implements INationalDatasetSubscriber { public class Import88DLocationsUtil implements INationalDatasetSubscriber {
private static final transient IUFStatusHandler statusHandler = UFStatus private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(Import88DLocationsUtil.class); .getHandler(Import88DLocationsUtil.class);
private static final String SHAPEFILE = "fsl-w88d.shp"; private static final String SHAPEFILE = "fsl-w88d.shp";
@ -58,34 +59,30 @@ public class Import88DLocationsUtil implements INationalDatasetSubscriber {
private static final int WGS84_SRID = 4326; private static final int WGS84_SRID = 4326;
// The list of the required file comprising a Shapefile set /** The list of the required files comprising a Shapefile set */
private ArrayList<String> theRadarShapeFileList = new ArrayList<String>() { private static final String[] SHAPE_FILES = new String[] { "fsl-w88d.shp",
private static final long serialVersionUID = 1L; "fsl-w88d.shx", "fsl-w88d.dbf" };
{ /**
add("fsl-w88d.shp"); * The collection of feature attribute names this code needs from the
add("fsl-w88d.shx"); * shapefile
add("fsl-w88d.dbf"); */
}
};
// The collection of feature attribute names this code needs from the
// shapefile
private enum databaseColumns { private enum databaseColumns {
LAT, EQP_ELV, NAME, LON, IMMUTABLEX, RDA_ID, ELEVMETER, THE_GEOM, WFO_ID, RPG_ID_DEC LAT, EQP_ELV, NAME, LON, IMMUTABLEX, RDA_ID, ELEVMETER, THE_GEOM, WFO_ID, RPG_ID_DEC
} }
private long theTimeRange = 3600000l; private final long theTimeRange = 3600000l;
// The file name of the file currently being processed. /** The file name of the file currently being processed. */
private String theFileName = null; private String theFileName = null;
// The date, in millis, of the file currently being processed. /** The date, in millis, of the file currently being processed. */
private long theCurrentFileDateMillis = 0; private long theCurrentFileDateMillis = 0;
// The list of RDA_ID's from the shapefile used to determine if an ID has /**
// been * The list of RDA_ID's from the shapefile used to determine if an ID has
// removed from the database * been removed from the database
*/
private ArrayList<String> theRDAList = null; private ArrayList<String> theRDAList = null;
private IPathManager thePathMgr = null; private IPathManager thePathMgr = null;
@ -140,16 +137,16 @@ public class Import88DLocationsUtil implements INationalDatasetSubscriber {
*/ */
private void saveFile(File file, LocalizationFile outFile) { private void saveFile(File file, LocalizationFile outFile) {
if ((file != null) && file.exists()) { if ((file != null) && file.exists()) {
FileInputStream fis = null;
FileOutputStream fos = null;
try { try {
byte[] fileByteArray = new byte[(int) file.length()]; byte[] fileByteArray = new byte[(int) file.length()];
FileInputStream fis = new FileInputStream(file); fis = new FileInputStream(file);
fis.read(fileByteArray); fis.read(fileByteArray);
FileOutputStream fos = new FileOutputStream(outFile.getFile()); fos = new FileOutputStream(outFile.getFile());
fos.write(fileByteArray); fos.write(fileByteArray);
fis.close();
fos.close();
/* /*
* BufferedReader fis = new BufferedReader(new * BufferedReader fis = new BufferedReader(new
* InputStreamReader( new FileInputStream(file))); * InputStreamReader( new FileInputStream(file)));
@ -165,12 +162,29 @@ public class Import88DLocationsUtil implements INationalDatasetSubscriber {
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
if (statusHandler.isPriorityEnabled(Priority.PROBLEM)) { if (statusHandler.isPriorityEnabled(Priority.PROBLEM)) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"Failed to find File ", e); "Failed to find file: " + file.getName(), e);
} }
} catch (IOException e) { } catch (IOException e) {
if (statusHandler.isPriorityEnabled(Priority.PROBLEM)) { if (statusHandler.isPriorityEnabled(Priority.PROBLEM)) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(
"Could not create output file. ", e); Priority.PROBLEM,
"Could not create output file: "
+ outFile.getName(), e);
}
} finally {
if (fis != null) {
try {
fis.close();
} catch (IOException e) {
// ignore
}
}
if (fos != null) {
try {
fos.close();
} catch (IOException e) {
// ignore
}
} }
} }
} }
@ -193,7 +207,7 @@ public class Import88DLocationsUtil implements INationalDatasetSubscriber {
// Determine if the two other files are available or if the time // Determine if the two other files are available or if the time
// threshold has been crossed and are to old to process // threshold has been crossed and are to old to process
for (String key : theRadarShapeFileList) { for (String key : SHAPE_FILES) {
if (!key.equals(theFileName)) { if (!key.equals(theFileName)) {
tempFile = getPathInfoRead(key); tempFile = getPathInfoRead(key);
timeStampMillis = tempFile.lastModified(); timeStampMillis = tempFile.lastModified();
@ -271,7 +285,7 @@ public class Import88DLocationsUtil implements INationalDatasetSubscriber {
for (RadarStation station : aStationList) { for (RadarStation station : aStationList) {
radarStationDAO.saveOrUpdate(station); radarStationDAO.saveOrUpdate(station);
} }
/* /*
* Kludge for DR 15366: The GeoTools WKBWriter does not store SRIDs so * Kludge for DR 15366: The GeoTools WKBWriter does not store SRIDs so
* we must update them manually. * we must update them manually.
@ -285,7 +299,7 @@ public class Import88DLocationsUtil implements INationalDatasetSubscriber {
statusHandler.handle(Priority.ERROR, statusHandler.handle(Priority.ERROR,
"Failed to update the SRIDs in the radar_spatial_table", e); "Failed to update the SRIDs in the radar_spatial_table", e);
} }
if (statusHandler.isPriorityEnabled(Priority.INFO)) { if (statusHandler.isPriorityEnabled(Priority.INFO)) {
statusHandler statusHandler
.handle(Priority.INFO, .handle(Priority.INFO,
@ -322,7 +336,8 @@ public class Import88DLocationsUtil implements INationalDatasetSubscriber {
String rda_id = null; String rda_id = null;
RadarStation tempStation = null; RadarStation tempStation = null;
Set<String> keySet = null; Set<String> keySet = null;
GeometryFactory gf = new GeometryFactory(new PrecisionModel(), WGS84_SRID); GeometryFactory gf = new GeometryFactory(new PrecisionModel(),
WGS84_SRID);
WKTReader wkt = new WKTReader(gf); WKTReader wkt = new WKTReader(gf);
for (HashMap<String, String> aHashMap : aDataList) { for (HashMap<String, String> aHashMap : aDataList) {
keySet = aHashMap.keySet(); keySet = aHashMap.keySet();

View file

@ -44,12 +44,11 @@ import com.raytheon.uf.common.menus.xml.CommonSeparatorMenuContribution;
import com.raytheon.uf.common.menus.xml.CommonSubmenuContribution; import com.raytheon.uf.common.menus.xml.CommonSubmenuContribution;
import com.raytheon.uf.common.menus.xml.MenuTemplateFile; import com.raytheon.uf.common.menus.xml.MenuTemplateFile;
import com.raytheon.uf.common.menus.xml.VariableSubstitution; import com.raytheon.uf.common.menus.xml.VariableSubstitution;
import com.raytheon.uf.common.site.ingest.INationalDatasetSubscriber;
import com.raytheon.uf.common.status.IUFStatusHandler; 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;
import com.raytheon.uf.edex.menus.AbstractMenuUtil; import com.raytheon.uf.edex.menus.AbstractMenuUtil;
import com.raytheon.uf.edex.ndm.ingest.INationalDatasetSubscriber;
/** /**
* Builds menus using JAXB * Builds menus using JAXB
@ -61,7 +60,8 @@ import com.raytheon.uf.edex.menus.AbstractMenuUtil;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jun 30, 2010 mnash Initial creation * Jun 30, 2010 mnash Initial creation
* Feb 25, 2013 DR14418 zwang Change radar menu to dual pol style * Feb 25, 2013 DR14418 zwang Change radar menu to dual pol style
* 03/07/2013 DR15495 zwang Handle additional elevation for ssss radars * 03/07/2013 DR15495 zwang Handle additional elevation for ssss radars
* Mar 06, 2014 2876 mpduff New NDM plugin.
* *
* </pre> * </pre>
* *
@ -71,11 +71,11 @@ import com.raytheon.uf.edex.menus.AbstractMenuUtil;
public class RadarMenuUtil extends AbstractMenuUtil implements public class RadarMenuUtil extends AbstractMenuUtil implements
INationalDatasetSubscriber { INationalDatasetSubscriber {
private static final transient IUFStatusHandler statusHandler = UFStatus private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(RadarMenuUtil.class); .getHandler(RadarMenuUtil.class);
private final int NUM_POSSIBLE_RADARS = 25; private final int NUM_POSSIBLE_RADARS = 25;
/** /**
* *
*/ */
@ -92,7 +92,7 @@ public class RadarMenuUtil extends AbstractMenuUtil implements
RadarsInUseUtil.setParsed(false); RadarsInUseUtil.setParsed(false);
List<String> radars = RadarsInUseUtil.getSite(getSite(), List<String> radars = RadarsInUseUtil.getSite(getSite(),
RadarsInUseUtil.LOCAL_CONSTANT); RadarsInUseUtil.LOCAL_CONSTANT);
;
String path = "menus" + File.separator + "radar" + File.separator; String path = "menus" + File.separator + "radar" + File.separator;
CommonMenuContributionFile menuContributionFile = new CommonMenuContributionFile(); CommonMenuContributionFile menuContributionFile = new CommonMenuContributionFile();
CommonIncludeMenuItem includeMenuItem = null; CommonIncludeMenuItem includeMenuItem = null;
@ -113,9 +113,8 @@ public class RadarMenuUtil extends AbstractMenuUtil implements
boolean terminal = TerminalRadarUtils.isTerminalRadar(radars boolean terminal = TerminalRadarUtils.isTerminalRadar(radars
.get(i).toLowerCase()); .get(i).toLowerCase());
if (terminal) { if (terminal) {
includeMenuItem.fileName = new File(path includeMenuItem.fileName = new File(path + "dualPol"
+ "dualPol" + File.separator + File.separator + "baseTerminalLocalRadarMenu.xml");
+ "baseTerminalLocalRadarMenu.xml");
List<Double> elevations = map.get(radars.get(i)); List<Double> elevations = map.get(radars.get(i));
vars = new VariableSubstitution[(elevations.size() + 1) vars = new VariableSubstitution[(elevations.size() + 1)
+ NUM_POSSIBLE_RADARS + 1]; + NUM_POSSIBLE_RADARS + 1];
@ -141,17 +140,14 @@ public class RadarMenuUtil extends AbstractMenuUtil implements
} }
includeMenuItem.substitutions = vars; includeMenuItem.substitutions = vars;
} else { } else {
if (SsssRadarUtil.isSsssRadar(radars.get(i).toLowerCase())) { if (SsssRadarUtil.isSsssRadar(radars.get(i).toLowerCase())) {
String ssssRadar = radars.get(i).toLowerCase(); String ssssRadar = radars.get(i).toLowerCase();
includeMenuItem.fileName = new File(path includeMenuItem.fileName = new File(path + ssssRadar
+ ssssRadar + File.separator + File.separator + "baseLocalRadarMenu.xml");
+ "baseLocalRadarMenu.xml"); } else {
} includeMenuItem.fileName = new File(path + "dualPol"
else { + File.separator + "baseLocalRadarMenu.xml");
includeMenuItem.fileName = new File(path }
+ "dualPol" + File.separator
+ "baseLocalRadarMenu.xml");
}
vars = new VariableSubstitution[1]; vars = new VariableSubstitution[1];
vars[0] = new VariableSubstitution(); vars[0] = new VariableSubstitution();
vars[0].key = "icao"; vars[0].key = "icao";
@ -189,9 +185,9 @@ public class RadarMenuUtil extends AbstractMenuUtil implements
.toLowerCase()); .toLowerCase());
if (terminal) { if (terminal) {
List<Double> elevations = map.get(radars.get(i)); List<Double> elevations = map.get(radars.get(i));
includeMenuContribution.fileName = new File(path includeMenuContribution.fileName = new File(path + "dualPol"
+ "dualPol" + File.separator + File.separator + File.separator
+ File.separator + "baseTerminalLocalRadarMenu.xml"); + "baseTerminalLocalRadarMenu.xml");
vars = new VariableSubstitution[(elevations.size() + 1) vars = new VariableSubstitution[(elevations.size() + 1)
+ NUM_POSSIBLE_RADARS + 1]; + NUM_POSSIBLE_RADARS + 1];
vars[0] = new VariableSubstitution(); vars[0] = new VariableSubstitution();
@ -217,17 +213,16 @@ public class RadarMenuUtil extends AbstractMenuUtil implements
includeMenuContribution.substitutions = vars; includeMenuContribution.substitutions = vars;
terminal = true; terminal = true;
} else { } else {
if (SsssRadarUtil.isSsssRadar(radars.get(i).toLowerCase())) { if (SsssRadarUtil.isSsssRadar(radars.get(i).toLowerCase())) {
String ssssRadar = radars.get(i).toLowerCase(); String ssssRadar = radars.get(i).toLowerCase();
includeMenuContribution.fileName = new File(path includeMenuContribution.fileName = new File(path
+ ssssRadar + File.separator + ssssRadar + File.separator
+ "baseLocalRadarMenu.xml"); + "baseLocalRadarMenu.xml");
} } else {
else { includeMenuContribution.fileName = new File(path
includeMenuContribution.fileName = new File(path
+ "dualPol" + File.separator + "dualPol" + File.separator
+ "baseLocalRadarMenu.xml"); + "baseLocalRadarMenu.xml");
} }
vars = new VariableSubstitution[1]; vars = new VariableSubstitution[1];
vars[0] = new VariableSubstitution(); vars[0] = new VariableSubstitution();
vars[0].key = "icao"; vars[0].key = "icao";
@ -386,10 +381,12 @@ public class RadarMenuUtil extends AbstractMenuUtil implements
private void saveFile(File file, File outFile) { private void saveFile(File file, File outFile) {
if ((file != null) && file.exists()) { if ((file != null) && file.exists()) {
BufferedReader fis = null;
BufferedWriter fos = null;
try { try {
BufferedReader fis = new BufferedReader(new InputStreamReader( fis = new BufferedReader(new InputStreamReader(
new FileInputStream(file))); new FileInputStream(file)));
BufferedWriter fos = new BufferedWriter(new OutputStreamWriter( fos = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(outFile))); new FileOutputStream(outFile)));
String line = null; String line = null;
try { try {
@ -397,15 +394,29 @@ public class RadarMenuUtil extends AbstractMenuUtil implements
fos.write(line); fos.write(line);
fos.newLine(); fos.newLine();
} }
fos.close();
} catch (IOException e) { } catch (IOException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"Could not read File ", e); "Could not read file: " + file.getName(), e);
} }
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
statusHandler.handle(Priority.PROBLEM, "Failed to find file ", statusHandler.handle(Priority.PROBLEM, "Failed to find file: "
e); + file.getName(), e);
} finally {
if (fis != null) {
try {
fis.close();
} catch (IOException e) {
// ignore
}
}
if (fos != null) {
try {
fos.close();
} catch (IOException e) {
// ignore
}
}
} }
} }
} }

View file

@ -10,7 +10,9 @@ Require-Bundle: com.raytheon.edex.common,
com.raytheon.uf.edex.pointdata, com.raytheon.uf.edex.pointdata,
org.geotools, org.geotools,
javax.measure, javax.measure,
javax.persistence javax.persistence,
com.raytheon.uf.edex.ndm;bundle-version="1.0.0",
com.raytheon.uf.common.localization;bundle-version="1.14.0"
Export-Package: com.raytheon.edex.plugin.sfcobs.common Export-Package: com.raytheon.edex.plugin.sfcobs.common
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: com.raytheon.uf.common.dataplugin.sfcobs, Import-Package: com.raytheon.uf.common.dataplugin.sfcobs,

View file

@ -22,6 +22,35 @@
<constructor-arg ref="sfcobs-camel" /> <constructor-arg ref="sfcobs-camel" />
</bean> </bean>
<bean id="buoyListener" class="com.raytheon.edex.plugin.sfcobs.ingest.BuoySubscriber" />
<bean id="marineInfoListener" class="com.raytheon.edex.plugin.sfcobs.ingest.MarineInfoSubscriber">
<constructor-arg value="${db.port}" />
<constructor-arg value="${edex.home}" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="MarineInfo.txt" />
<constructor-arg ref="marineInfoListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="BUOY.spi" />
<constructor-arg ref="buoyListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="BUOY.goodness" />
<constructor-arg ref="buoyListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="BUOY.primary" />
<constructor-arg ref="buoyListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="maritimeStationInfo.txt" />
<constructor-arg ref="buoyListener" />
</bean>
<camelContext id="sfcobs-camel" xmlns="http://camel.apache.org/schema/spring" <camelContext id="sfcobs-camel" xmlns="http://camel.apache.org/schema/spring"
errorHandlerRef="errorHandler" autoStartup="false"> errorHandlerRef="errorHandler" autoStartup="false">

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * further licensing information.
**/ **/
package com.raytheon.uf.common.site.ingest; package com.raytheon.edex.plugin.sfcobs.ingest;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.BufferedWriter; import java.io.BufferedWriter;
@ -38,9 +38,10 @@ import com.raytheon.uf.common.pointdata.vadriver.VA_Driver;
import com.raytheon.uf.common.status.IUFStatusHandler; 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;
import com.raytheon.uf.edex.ndm.ingest.INationalDatasetSubscriber;
/** /**
* TODO Add Description * Buoy NDM subscriber.
* *
* <pre> * <pre>
* *
@ -49,6 +50,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jan 28, 2011 bfarmer Initial creation * Jan 28, 2011 bfarmer Initial creation
* Mar 06, 2014 2876 mpduff New NDM plugin.
* *
* </pre> * </pre>
* *
@ -57,7 +59,9 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
*/ */
public class BuoySubscriber implements INationalDatasetSubscriber { public class BuoySubscriber implements INationalDatasetSubscriber {
private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(BuoySubscriber.class); private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(BuoySubscriber.class);
private Thread combineThread = null; private Thread combineThread = null;
@Override @Override
@ -77,6 +81,7 @@ public class BuoySubscriber implements INationalDatasetSubscriber {
if (null == combineThread) { if (null == combineThread) {
combineThread = new Thread(new Runnable() { combineThread = new Thread(new Runnable() {
@Override
public void run() { public void run() {
try { try {
Thread.sleep(60 * 1000); Thread.sleep(60 * 1000);
@ -100,6 +105,7 @@ public class BuoySubscriber implements INationalDatasetSubscriber {
if (null == combineThread) { if (null == combineThread) {
combineThread = new Thread(new Runnable() { combineThread = new Thread(new Runnable() {
@Override
public void run() { public void run() {
try { try {
Thread.sleep(60 * 1000); Thread.sleep(60 * 1000);
@ -128,8 +134,10 @@ public class BuoySubscriber implements INationalDatasetSubscriber {
try { try {
spiFile.createNewFile(); spiFile.createNewFile();
} catch (IOException e) { } catch (IOException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(
"Could not create primary file. ", e); Priority.PROBLEM,
"Could not create primary file: "
+ spiFile.getName(), e);
} }
} }
@ -143,52 +151,65 @@ public class BuoySubscriber implements INationalDatasetSubscriber {
private void generateSPI(File file, File goodnessFile) { private void generateSPI(File file, File goodnessFile) {
String line; String line;
String[] splitLine; String[] splitLine;
BufferedReader fis = null;
BufferedWriter fos = null;
try { try {
BufferedReader fis = new BufferedReader(new InputStreamReader( fis = new BufferedReader(new InputStreamReader(new FileInputStream(
new FileInputStream(file))); file)));
if (!goodnessFile.exists()) { if (!goodnessFile.exists()) {
goodnessFile.createNewFile(); goodnessFile.createNewFile();
} }
BufferedWriter fos = new BufferedWriter(new OutputStreamWriter( fos = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(goodnessFile))); new FileOutputStream(goodnessFile)));
for (line = fis.readLine(); line != null; line = fis.readLine()) { for (line = fis.readLine(); line != null; line = fis.readLine()) {
splitLine = line.split("\\|"); splitLine = line.split("\\|");
Integer elevation; Integer elevation;
Double latitude;
Double longitude;
String stationName;
try { try {
elevation = Integer.parseInt(splitLine[4].trim()); elevation = Integer.parseInt(splitLine[4].trim());
} catch (Exception e) { } catch (Exception e) {
continue; continue;
} }
latitude = Double.parseDouble(splitLine[2].trim()); Double latitude = Double.parseDouble(splitLine[2].trim());
longitude = Double.parseDouble(splitLine[3].trim()); Double longitude = Double.parseDouble(splitLine[3].trim());
stationName = splitLine[1].trim(); String stationName = splitLine[1].trim();
fos.write("0 "); fos.write("0 ");
fos.write(stationName); fos.write(stationName);
fos.write(String.format(" %8.4f %9.4f %5d %9d", latitude, fos.write(String.format(" %8.4f %9.4f %5d %9d", latitude,
longitude, elevation, 0)); longitude, elevation, 0));
fos.newLine(); fos.newLine();
} }
fos.close();
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
// TODO Auto-generated catch block. Please revise as appropriate. statusHandler.handle(Priority.PROBLEM, "Could not read file: "
statusHandler.handle(Priority.PROBLEM, + file.getName(), e);
"Could not read File ", e);
} catch (IOException e) { } catch (IOException e) {
statusHandler.handle(Priority.PROBLEM,
"Error with file: " + file.getName(), e);
} finally {
if (fos != null) {
try {
fos.close();
} catch (IOException e) {
// Ignore
}
}
if (fis != null) {
try {
fis.close();
} catch (IOException e) {
// Ignore
}
}
} }
} }
private void saveFile(File file, File outFile) { private void saveFile(File file, File outFile) {
if ((file != null) && file.exists()) { if ((file != null) && file.exists()) {
BufferedReader fis = null;
BufferedWriter fos = null;
try { try {
BufferedReader fis = new BufferedReader(new InputStreamReader( fis = new BufferedReader(new InputStreamReader(
new FileInputStream(file))); new FileInputStream(file)));
BufferedWriter fos = new BufferedWriter(new OutputStreamWriter( fos = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(outFile))); new FileOutputStream(outFile)));
String line = null; String line = null;
try { try {
@ -196,16 +217,29 @@ public class BuoySubscriber implements INationalDatasetSubscriber {
fos.write(line); fos.write(line);
fos.newLine(); fos.newLine();
} }
fos.close();
} catch (IOException e) { } catch (IOException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"Could not read File ", e); "Could not read file: " + file.getName(), e);
} }
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM, "Failed to find file: "
"Failed to find File ", e); + file.getName(), e);
} finally {
if (fis != null) {
try {
fis.close();
} catch (IOException e) {
// ignore
}
}
if (fos != null) {
try {
fos.close();
} catch (IOException e) {
// ignore
}
}
} }
} }
} }

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * further licensing information.
**/ **/
package com.raytheon.uf.edex.site.ingest; package com.raytheon.edex.plugin.sfcobs.ingest;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.BufferedWriter; import java.io.BufferedWriter;
@ -34,14 +34,14 @@ import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.PathManagerFactory; import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.site.ingest.INationalDatasetSubscriber;
import com.raytheon.uf.common.status.IUFStatusHandler; 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;
import com.raytheon.uf.edex.database.tasks.SqlStatementTask; import com.raytheon.uf.edex.database.tasks.SqlStatementTask;
import com.raytheon.uf.edex.ndm.ingest.INationalDatasetSubscriber;
/** /**
* TODO Add Description * Marine information NDM subscriber.
* *
* <pre> * <pre>
* *
@ -50,6 +50,7 @@ import com.raytheon.uf.edex.database.tasks.SqlStatementTask;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 11, 2011 bfarmer Initial creation * Apr 11, 2011 bfarmer Initial creation
* Mar 06, 2014 2876 mpduff New NDM plugin.
* *
* </pre> * </pre>
* *
@ -58,15 +59,9 @@ import com.raytheon.uf.edex.database.tasks.SqlStatementTask;
*/ */
public class MarineInfoSubscriber implements INationalDatasetSubscriber { public class MarineInfoSubscriber implements INationalDatasetSubscriber {
private static final transient IUFStatusHandler statusHandler = UFStatus private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(MarineInfoSubscriber.class); .getHandler(MarineInfoSubscriber.class);
private static final String SCRIPT_PATH = "/static/database.maps/importPointsInfo.sh";
private String fileNamePath = null;
private static String PGUSER = "awips";
private String pgPort = null; private String pgPort = null;
private static String DBSCHEMA = "mapdata"; private static String DBSCHEMA = "mapdata";
@ -140,8 +135,9 @@ public class MarineInfoSubscriber implements INationalDatasetSubscriber {
private void triggerDBReload(File outFile) { private void triggerDBReload(File outFile) {
if ((outFile != null) && outFile.exists()) { if ((outFile != null) && outFile.exists()) {
BufferedReader fis = null;
try { try {
BufferedReader fis = new BufferedReader(new InputStreamReader( fis = new BufferedReader(new InputStreamReader(
new FileInputStream(outFile))); new FileInputStream(outFile)));
try { try {
SqlStatementTask task = new SqlStatementTask(setupOne, SqlStatementTask task = new SqlStatementTask(setupOne,
@ -204,7 +200,7 @@ public class MarineInfoSubscriber implements INationalDatasetSubscriber {
} }
} catch (IOException e) { } catch (IOException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"Could not read File ", e); "Could not read file: " + outFile, e);
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
@ -212,19 +208,29 @@ public class MarineInfoSubscriber implements INationalDatasetSubscriber {
+ query.toString(), e); + query.toString(), e);
} }
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
statusHandler.handle(Priority.PROBLEM, "Failed to find File ", statusHandler.handle(Priority.PROBLEM, "Failed to find file: "
e); + outFile, e);
} finally {
if (fis != null) {
try {
fis.close();
} catch (IOException e) {
// ignore
}
}
} }
} }
} }
private void saveFile(File file, File outFile) { private void saveFile(File file, File outFile) {
if ((file != null) && file.exists()) { if ((file != null) && file.exists()) {
BufferedReader fis = null;
BufferedWriter fos = null;
try { try {
BufferedReader fis = new BufferedReader(new InputStreamReader( fis = new BufferedReader(new InputStreamReader(
new FileInputStream(file))); new FileInputStream(file)));
BufferedWriter fos = new BufferedWriter(new OutputStreamWriter( fos = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(outFile))); new FileOutputStream(outFile)));
String line = null; String line = null;
try { try {
@ -235,13 +241,27 @@ public class MarineInfoSubscriber implements INationalDatasetSubscriber {
fos.close(); fos.close();
} catch (IOException e) { } catch (IOException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"Could not read File ", e); "Could not read file: " + file.getName(), e);
} }
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
statusHandler.handle(Priority.PROBLEM, "Failed to find File ", statusHandler.handle(Priority.PROBLEM, "Failed to find file: "
e); + file.getName(), e);
} finally {
if (fis != null) {
try {
fis.close();
} catch (IOException e) {
// ignore
}
}
if (fos != null) {
try {
fos.close();
} catch (IOException e) {
// ignore
}
}
} }
} }
} }

View file

@ -13,7 +13,9 @@ Require-Bundle: com.raytheon.edex.textdb,
com.raytheon.uf.edex.decodertools;bundle-version="1.0.0", com.raytheon.uf.edex.decodertools;bundle-version="1.0.0",
com.raytheon.uf.common.status;bundle-version="1.11.17", com.raytheon.uf.common.status;bundle-version="1.11.17",
com.raytheon.uf.common.site;bundle-version="1.12.1174", com.raytheon.uf.common.site;bundle-version="1.12.1174",
com.raytheon.uf.edex.archive com.raytheon.uf.edex.archive,
com.raytheon.uf.edex.ndm;bundle-version="1.0.0",
com.raytheon.uf.common.localization;bundle-version="1.14.0"
Export-Package: com.raytheon.edex.plugin.text, Export-Package: com.raytheon.edex.plugin.text,
com.raytheon.edex.plugin.text.dao com.raytheon.edex.plugin.text.dao
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6

View file

@ -52,6 +52,35 @@
<constructor-arg value="1000" type="java.lang.Integer"/> <constructor-arg value="1000" type="java.lang.Integer"/>
</bean> </bean>
<bean id="afosToAwipsListener" class="com.raytheon.edex.plugin.text.ingest.AfosToAwipsListener" />
<bean id="afosBrowserListener" class="com.raytheon.edex.plugin.text.ingest.AfosBrowserModelSubscriber" />
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="afos2awips.txt" />
<constructor-arg ref="afosToAwipsListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="textCCChelp.txt" />
<constructor-arg ref="afosBrowserListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="textNNNhelp.txt" />
<constructor-arg ref="afosBrowserListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="textCategoryClass.txt" />
<constructor-arg ref="afosBrowserListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="textOriginTable.txt" />
<constructor-arg ref="afosBrowserListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="afosMasterPIL.txt" />
<constructor-arg ref="afosBrowserListener" />
</bean>
<camelContext id="text-camel" <camelContext id="text-camel"
xmlns="http://camel.apache.org/schema/spring" xmlns="http://camel.apache.org/schema/spring"
errorHandlerRef="errorHandler"> errorHandlerRef="errorHandler">

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * further licensing information.
**/ **/
package com.raytheon.uf.common.site.ingest; package com.raytheon.edex.plugin.text.ingest;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.BufferedWriter; import java.io.BufferedWriter;
@ -37,9 +37,10 @@ import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.status.IUFStatusHandler; 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;
import com.raytheon.uf.edex.ndm.ingest.INationalDatasetSubscriber;
/** /**
* TODO Add Description * AFOS NDM Subscriber.
* *
* <pre> * <pre>
* *
@ -48,6 +49,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jan 12, 2011 bfarmer Initial creation * Jan 12, 2011 bfarmer Initial creation
* Mar 06, 2014 2876 mpduff New NDM plugin.
* *
* </pre> * </pre>
* *
@ -56,7 +58,8 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
*/ */
public class AfosBrowserModelSubscriber implements INationalDatasetSubscriber { public class AfosBrowserModelSubscriber implements INationalDatasetSubscriber {
private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(AfosBrowserModelSubscriber.class); private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(AfosBrowserModelSubscriber.class);
private static final String CCC_HELP = "textdb/textCCChelp.txt"; private static final String CCC_HELP = "textdb/textCCChelp.txt";
@ -112,10 +115,12 @@ public class AfosBrowserModelSubscriber implements INationalDatasetSubscriber {
private void saveFile(File file, File outFile) { private void saveFile(File file, File outFile) {
if ((file != null) && file.exists()) { if ((file != null) && file.exists()) {
BufferedReader fis = null;
BufferedWriter fos = null;
try { try {
BufferedReader fis = new BufferedReader(new InputStreamReader( fis = new BufferedReader(new InputStreamReader(
new FileInputStream(file))); new FileInputStream(file)));
BufferedWriter fos = new BufferedWriter(new OutputStreamWriter( fos = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(outFile))); new FileOutputStream(outFile)));
String line = null; String line = null;
try { try {
@ -123,18 +128,30 @@ public class AfosBrowserModelSubscriber implements INationalDatasetSubscriber {
fos.write(line); fos.write(line);
fos.newLine(); fos.newLine();
} }
fos.close();
} catch (IOException e) { } catch (IOException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"Could not read File ", e); "Could not read file: " + file.getName(), e);
} }
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM, "Failed to find File: "
"Failed to find File ", e); + file.getName(), e);
} finally {
if (fis != null) {
try {
fis.close();
} catch (IOException e) {
// ignore
}
}
if (fos != null) {
try {
fos.close();
} catch (IOException e) {
// ignore
}
}
} }
} }
} }
} }

View file

@ -34,13 +34,14 @@ import com.raytheon.edex.plugin.text.dao.AfosToAwipsDao;
import com.raytheon.uf.common.dataplugin.text.AfosWmoIdDataContainer; import com.raytheon.uf.common.dataplugin.text.AfosWmoIdDataContainer;
import com.raytheon.uf.common.dataplugin.text.db.AfosToAwips; import com.raytheon.uf.common.dataplugin.text.db.AfosToAwips;
import com.raytheon.uf.common.dataplugin.text.db.AfosToAwipsId; import com.raytheon.uf.common.dataplugin.text.db.AfosToAwipsId;
import com.raytheon.uf.common.site.ingest.INationalDatasetSubscriber;
import com.raytheon.uf.common.status.IUFStatusHandler; 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;
import com.raytheon.uf.edex.ndm.ingest.INationalDatasetSubscriber;
/** /**
* TODO Add Description * Updates the afos_to_awips table in the database based on the supplied
* afos2awips.txt file.
* *
* <pre> * <pre>
* *
@ -49,6 +50,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jan 11, 2011 bfarmer Initial creation * Jan 11, 2011 bfarmer Initial creation
* Mar 06, 2014 2876 mpduff New NDM plugin.
* *
* </pre> * </pre>
* *
@ -57,7 +59,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
*/ */
public class AfosToAwipsListener implements INationalDatasetSubscriber { public class AfosToAwipsListener implements INationalDatasetSubscriber {
private static final transient IUFStatusHandler statusHandler = UFStatus private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(AfosToAwipsListener.class); .getHandler(AfosToAwipsListener.class);
/* /*
@ -93,6 +95,14 @@ public class AfosToAwipsListener implements INationalDatasetSubscriber {
"Could not read ingested afos2awips file:" "Could not read ingested afos2awips file:"
+ file.getAbsolutePath(), e); + file.getAbsolutePath(), e);
return; return;
} finally {
if (fis != null) {
try {
fis.close();
} catch (IOException e) {
// ignore
}
}
} }
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
statusHandler.handle( statusHandler.handle(
@ -100,15 +110,6 @@ public class AfosToAwipsListener implements INationalDatasetSubscriber {
"Could not read ingested afos2awips file:" "Could not read ingested afos2awips file:"
+ file.getAbsolutePath(), e); + file.getAbsolutePath(), e);
return; return;
} finally {
if (fis != null) {
try {
fis.close();
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM,
"Error closing file: " + file.getAbsolutePath(), e);
}
}
} }
AfosToAwipsDao afosDao = new AfosToAwipsDao(); AfosToAwipsDao afosDao = new AfosToAwipsDao();
AfosWmoIdDataContainer allRecords = afosDao.getAllRecords(); AfosWmoIdDataContainer allRecords = afosDao.getAllRecords();

View file

@ -12,7 +12,8 @@ Require-Bundle: com.raytheon.edex.common,
javax.persistence, javax.persistence,
com.raytheon.uf.common.dataplugin.text, com.raytheon.uf.common.dataplugin.text,
com.raytheon.uf.common.status;bundle-version="1.12.1122", com.raytheon.uf.common.status;bundle-version="1.12.1122",
com.raytheon.uf.common.site;bundle-version="1.0.0" com.raytheon.uf.common.site;bundle-version="1.0.0",
com.raytheon.uf.edex.ndm;bundle-version="1.0.0"
Export-Package: com.raytheon.edex.textdb.alarms, Export-Package: com.raytheon.edex.textdb.alarms,
com.raytheon.edex.textdb.dao, com.raytheon.edex.textdb.dao,
com.raytheon.edex.textdb.dbapi.impl, com.raytheon.edex.textdb.dbapi.impl,

View file

@ -0,0 +1,41 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
<bean id="fileChangedStrategy" class="com.raytheon.uf.edex.esb.camel.FileChangedExclusiveReadLockStrategy"/>
<bean id="textDBStaticDataListener" class="com.raytheon.edex.textdb.ingest.TextDBStaticDataSubscriber" />
<bean id="siteMapListener" class="com.raytheon.edex.textdb.ingest.SiteMapNationalDatasetSubscriber" />
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="bit_table.dat" />
<constructor-arg ref="textDBStaticDataListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="collective_table.dat" />
<constructor-arg ref="textDBStaticDataListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="exclusionProductList.dat" />
<constructor-arg ref="textDBStaticDataListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="ispan_table.dat" />
<constructor-arg ref="textDBStaticDataListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="station_table.dat" />
<constructor-arg ref="textDBStaticDataListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="upair_table.dat" />
<constructor-arg ref="textDBStaticDataListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="afos_lookup_table.dat" />
<constructor-arg ref="siteMapListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="national_category_table.template" />
<constructor-arg ref="siteMapListener" />
</bean>
</beans>

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * further licensing information.
**/ **/
package com.raytheon.uf.common.site.ingest; package com.raytheon.edex.textdb.ingest;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.BufferedWriter; import java.io.BufferedWriter;
@ -38,9 +38,10 @@ import com.raytheon.uf.common.site.SiteMap;
import com.raytheon.uf.common.status.IUFStatusHandler; 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;
import com.raytheon.uf.edex.ndm.ingest.INationalDatasetSubscriber;
/** /**
* TODO Add Description * Site Map NDM subscriber.
* *
* <pre> * <pre>
* *
@ -48,7 +49,8 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jan 6, 2011 bfarmer Initial creation * Jan 06, 2011 bfarmer Initial creation
* Mar 06, 2014 2876 mpduff New NDM plugin.
* *
* </pre> * </pre>
* *
@ -58,7 +60,9 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
public class SiteMapNationalDatasetSubscriber implements public class SiteMapNationalDatasetSubscriber implements
INationalDatasetSubscriber { INationalDatasetSubscriber {
private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(SiteMapNationalDatasetSubscriber.class); private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(SiteMapNationalDatasetSubscriber.class);
private static final String AFOS_LOOKUP_FILENAME = "textdb/afos_lookup_table.dat"; private static final String AFOS_LOOKUP_FILENAME = "textdb/afos_lookup_table.dat";
private static final String NATIONAL_CATEGORY_TABLE_FILENAME = "textdb/national_category_table.template"; private static final String NATIONAL_CATEGORY_TABLE_FILENAME = "textdb/national_category_table.template";
@ -91,10 +95,12 @@ public class SiteMapNationalDatasetSubscriber implements
private void saveFile(File file, File outFile) { private void saveFile(File file, File outFile) {
if ((file != null) && file.exists()) { if ((file != null) && file.exists()) {
BufferedReader fis = null;
BufferedWriter fos = null;
try { try {
BufferedReader fis = new BufferedReader(new InputStreamReader( fis = new BufferedReader(new InputStreamReader(
new FileInputStream(file))); new FileInputStream(file)));
BufferedWriter fos = new BufferedWriter(new OutputStreamWriter( fos = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(outFile))); new FileOutputStream(outFile)));
String line = null; String line = null;
try { try {
@ -102,18 +108,29 @@ public class SiteMapNationalDatasetSubscriber implements
fos.write(line); fos.write(line);
fos.newLine(); fos.newLine();
} }
fos.close();
} catch (IOException e) { } catch (IOException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"Could not read AFOS Lookup File " "Could not read file: " + file.getName(), e);
+ AFOS_LOOKUP_FILENAME, e);
} }
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM, "Failed to find file: "
"Failed to find AFOS Lookup File " + file.getName(), e);
+ AFOS_LOOKUP_FILENAME, e); } finally {
if (fis != null) {
try {
fis.close();
} catch (IOException e) {
// ignore
}
}
if (fos != null) {
try {
fos.close();
} catch (IOException e) {
// ignore
}
}
} }
} }
} }

View file

@ -35,13 +35,13 @@ import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.PathManagerFactory; import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.site.ingest.INationalDatasetSubscriber;
import com.raytheon.uf.common.status.IUFStatusHandler; 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;
import com.raytheon.uf.edex.ndm.ingest.INationalDatasetSubscriber;
/** /**
* TODO Add Description * Text DB static data subscriber.
* *
* <pre> * <pre>
* *
@ -51,6 +51,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jan 25, 2011 bfarmer Initial creation * Jan 25, 2011 bfarmer Initial creation
* Oct 18, 2011 10909 rferrel notify() now saves a file. * Oct 18, 2011 10909 rferrel notify() now saves a file.
* Mar 06, 2014 2876 mpduff New NDM plugin.
* *
* </pre> * </pre>
* *
@ -59,7 +60,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
*/ */
public class TextDBStaticDataSubscriber implements INationalDatasetSubscriber { public class TextDBStaticDataSubscriber implements INationalDatasetSubscriber {
private static final transient IUFStatusHandler statusHandler = UFStatus private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(TextDBStaticDataSubscriber.class); .getHandler(TextDBStaticDataSubscriber.class);
@Override @Override
@ -75,10 +76,12 @@ public class TextDBStaticDataSubscriber implements INationalDatasetSubscriber {
private void saveFile(File file, File outFile) { private void saveFile(File file, File outFile) {
if ((file != null) && file.exists()) { if ((file != null) && file.exists()) {
BufferedReader fis = null;
BufferedWriter fos = null;
try { try {
BufferedReader fis = new BufferedReader(new InputStreamReader( fis = new BufferedReader(new InputStreamReader(
new FileInputStream(file))); new FileInputStream(file)));
BufferedWriter fos = new BufferedWriter(new OutputStreamWriter( fos = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(outFile))); new FileOutputStream(outFile)));
String line = null; String line = null;
try { try {
@ -86,19 +89,30 @@ public class TextDBStaticDataSubscriber implements INationalDatasetSubscriber {
fos.write(line); fos.write(line);
fos.newLine(); fos.newLine();
} }
fos.close();
} catch (IOException e) { } catch (IOException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"Could not read File ", e); "Could not read file: " + file.getName(), e);
} }
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
statusHandler.handle(Priority.PROBLEM, "Failed to find File ", statusHandler.handle(Priority.PROBLEM, "Failed to find file: "
e); + file.getName(), e);
} finally {
if (fis != null) {
try {
fis.close();
} catch (IOException e) {
// ignore
}
}
if (fos != null) {
try {
fos.close();
} catch (IOException e) {
// ignore
}
}
} }
} }
TextDBStaticData.setDirty(); TextDBStaticData.setDirty();
} }
} }

View file

@ -11,7 +11,6 @@ Require-Bundle: com.raytheon.uf.common.localization;bundle-version="1.12.1130",
com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1174", com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1174",
com.raytheon.uf.common.pointdata;bundle-version="1.12.1174" com.raytheon.uf.common.pointdata;bundle-version="1.12.1174"
Export-Package: com.raytheon.uf.common.site, Export-Package: com.raytheon.uf.common.site,
com.raytheon.uf.common.site.ingest,
com.raytheon.uf.common.site.notify, com.raytheon.uf.common.site.notify,
com.raytheon.uf.common.site.requests, com.raytheon.uf.common.site.requests,
com.raytheon.uf.common.site.xml com.raytheon.uf.common.site.xml

View file

@ -111,4 +111,10 @@
version="0.0.0" version="0.0.0"
unpack="false"/> unpack="false"/>
<plugin
id="com.raytheon.uf.edex.ndm"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature> </feature>

View file

@ -10,7 +10,9 @@ Require-Bundle: com.raytheon.edex.common;bundle-version="1.11.1",
com.raytheon.uf.common.pointdata, com.raytheon.uf.common.pointdata,
javax.measure;bundle-version="1.0.0", javax.measure;bundle-version="1.0.0",
org.geotools;bundle-version="2.5.2", org.geotools;bundle-version="2.5.2",
com.raytheon.uf.common.site;bundle-version="1.12.1174" com.raytheon.uf.common.site;bundle-version="1.12.1174",
com.raytheon.uf.edex.ndm;bundle-version="1.0.0",
com.raytheon.uf.common.status;bundle-version="1.12.1174"
Export-Package: com.raytheon.uf.edex.decodertools.aircraft, Export-Package: com.raytheon.uf.edex.decodertools.aircraft,
com.raytheon.uf.edex.decodertools.bufr, com.raytheon.uf.edex.decodertools.bufr,
com.raytheon.uf.edex.decodertools.bufr.descriptors, com.raytheon.uf.edex.decodertools.bufr.descriptors,

View file

@ -31,16 +31,30 @@ import java.text.DecimalFormat;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import com.raytheon.uf.common.site.ingest.INationalDatasetSubscriber; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.edex.ndm.ingest.INationalDatasetSubscriber;
/** /**
* Give this program a path containing the files you wish to read. It will then * Give this program a path containing the files you wish to read. It will then
* give you back SQL files you can then insert into the AWIPS DB * give you back SQL files you can then insert into the AWIPS DB
* *
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Initial release.
* Mar 06, 2014 2876 mpduff New NDM plugin.
*
* </pre>
*
* @author dhladky * @author dhladky
* *
*/ */
public class AWIPSCommonObsSQLGenerator implements INationalDatasetSubscriber { public class AWIPSCommonObsSQLGenerator implements INationalDatasetSubscriber {
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(AWIPSCommonObsSQLGenerator.class);
private static final String FILE_NAME_PREFIX = "common_obs_spatial_"; private static final String FILE_NAME_PREFIX = "common_obs_spatial_";
@ -135,68 +149,70 @@ public class AWIPSCommonObsSQLGenerator implements INationalDatasetSubscriber {
FileWriter fstream = null; FileWriter fstream = null;
BufferedWriter bw = null; BufferedWriter bw = null;
try {
while (it.hasNext()) {
while (it.hasNext()) { if (fstream == null) {
fstream = new FileWriter(path + FILE_NAME_PREFIX
+ (fileCount) + FILE_NAME_SUFFIX);
}
if (bw == null) {
bw = new BufferedWriter(fstream);
}
if (fstream == null) { SpatialLine sline = stationMap.get(it.next());
fstream = new FileWriter(path + FILE_NAME_PREFIX + (fileCount)
+ FILE_NAME_SUFFIX); String gid = sline.getGid();
String state = sline.getState();
String elevation = sline.getElevation();
String icao = sline.getICAO();
String the_geom = sline.getGeom();
String name = sline.getName();
String rbsnindicator = NULL;
String country = sline.getCountry();
// TODO: these are hard coded to the same as surface, must fix
String upperairelevation = sline.getElevation();
String upperairgeom = sline.getGeom();
String wmoindex = sline.getWmo();
String wmoregion = NULL;
StringBuffer line = new StringBuffer();
line.append(INSERT_PREFIX);
line.append(addParam(gid, true, false, false));
line.append(addParam(country, false, false, false));
line.append(addParam(elevation, false, false, true));
line.append(addParam(icao, false, false, false));
line.append(addParam(the_geom, false, false, false));
line.append(addParam(name, false, false, false));
line.append(addParam(rbsnindicator, false, false, false));
line.append(addParam(state, false, false, false));
line.append(addParam(upperairelevation, false, false, true));
line.append(addParam(upperairgeom, false, false, false));
line.append(addParam(wmoindex, false, false, false));
line.append(addParam(wmoregion, false, true, false));
bw.write(line.toString() + "\n");
count++;
if (count == (FILE_SIZE_LIMIT * fileCount) - 1) {
bw.close();
fstream.close();
bw = null;
fstream = null;
fileCount++;
fstream = new FileWriter(path + FILE_NAME_PREFIX
+ (fileCount) + FILE_NAME_SUFFIX);
bw = new BufferedWriter(fstream);
}
} }
if (bw == null) { } finally {
bw = new BufferedWriter(fstream); if (bw != null) {
}
SpatialLine sline = stationMap.get(it.next());
String gid = sline.getGid();
String state = sline.getState();
String elevation = sline.getElevation();
String icao = sline.getICAO();
String the_geom = sline.getGeom();
String name = sline.getName();
String rbsnindicator = NULL;
String country = sline.getCountry();
// TODO: these are hard coded to the same as surface, must fix
String upperairelevation = sline.getElevation();
String upperairgeom = sline.getGeom();
String wmoindex = sline.getWmo();
String wmoregion = NULL;
StringBuffer line = new StringBuffer();
line.append(INSERT_PREFIX);
line.append(addParam(gid, true, false, false));
line.append(addParam(country, false, false, false));
line.append(addParam(elevation, false, false, true));
line.append(addParam(icao, false, false, false));
line.append(addParam(the_geom, false, false, false));
line.append(addParam(name, false, false, false));
line.append(addParam(rbsnindicator, false, false, false));
line.append(addParam(state, false, false, false));
line.append(addParam(upperairelevation, false, false, true));
line.append(addParam(upperairgeom, false, false, false));
line.append(addParam(wmoindex, false, false, false));
line.append(addParam(wmoregion, false, true, false));
bw.write(line.toString() + "\n");
count++;
if (count == (FILE_SIZE_LIMIT * fileCount) - 1) {
bw.close(); bw.close();
fstream.close();
bw = null;
fstream = null;
fileCount++;
fstream = new FileWriter(path + FILE_NAME_PREFIX + (fileCount)
+ FILE_NAME_SUFFIX);
bw = new BufferedWriter(fstream);
} }
} if (fstream != null) {
if (bw != null) { fstream.close();
bw.close(); }
}
if (fstream != null) {
fstream.close();
} }
} }
@ -210,25 +226,47 @@ public class AWIPSCommonObsSQLGenerator implements INationalDatasetSubscriber {
* @param filename * @param filename
*/ */
private void readFile(String filename) { private void readFile(String filename) {
FileInputStream fis = null;
DataInputStream dis = null;
BufferedReader br = null;
System.out.println("Read : " + filename);
System.out.println("\n");
try { try {
FileInputStream fis = new FileInputStream(filename); fis = new FileInputStream(filename);
DataInputStream dis = new DataInputStream(fis); dis = new DataInputStream(fis);
BufferedReader br = new BufferedReader(new InputStreamReader(dis)); br = new BufferedReader(new InputStreamReader(dis));
String strLine; String strLine;
while ((strLine = br.readLine()) != null) { while ((strLine = br.readLine()) != null) {
if (!strLine.startsWith(SKIP)) { if (!strLine.startsWith(SKIP)) {
String[] readLine = strLine.split(DELIMITER); String[] readLine = strLine.split(DELIMITER);
SpatialLine line = new SpatialLine(readLine); SpatialLine line = new SpatialLine(readLine);
stationMap.put(line.getGid(), line); stationMap.put(line.getGid(), line);
System.out.println(strLine);
read++; read++;
} }
} }
} catch (IOException ioe) { } catch (IOException ioe) {
ioe.printStackTrace(); statusHandler.error("Error processing file: " + filename, ioe);
} finally {
if (fis != null) {
try {
fis.close();
} catch (IOException e) {
// ignore
}
}
if (dis != null) {
try {
dis.close();
} catch (IOException e) {
// ignore
}
}
if (br != null) {
try {
br.close();
} catch (IOException e) {
// ignore
}
}
} }
} }

View file

@ -25,4 +25,5 @@ Require-Bundle: org.jep;bundle-version="1.0.0",
org.springframework;bundle-version="2.5.6", org.springframework;bundle-version="2.5.6",
com.raytheon.uf.edex.database, com.raytheon.uf.edex.database,
com.raytheon.uf.common.auth;bundle-version="1.12.1174", com.raytheon.uf.common.auth;bundle-version="1.12.1174",
com.raytheon.uf.edex.auth;bundle-version="1.12.1174" com.raytheon.uf.edex.auth;bundle-version="1.12.1174",
com.raytheon.uf.edex.ndm;bundle-version="1.0.0"

View file

@ -0,0 +1,12 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
<bean id="fileChangedStrategy" class="com.raytheon.uf.edex.esb.camel.FileChangedExclusiveReadLockStrategy"/>
<bean id="disseminationListener" class="com.raytheon.uf.edex.dissemination.ingest.DisseminationNationalDatasetSubscriber" />
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="awipsPriorities.txt" />
<constructor-arg ref="disseminationListener" />
</bean>
</beans>

View file

@ -35,13 +35,13 @@ import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.PathManagerFactory; import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.site.ingest.INationalDatasetSubscriber;
import com.raytheon.uf.common.status.IUFStatusHandler; 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;
import com.raytheon.uf.edex.ndm.ingest.INationalDatasetSubscriber;
/** /**
* TODO Add Description * Dissemination NDM subscriber.
* *
* <pre> * <pre>
* *
@ -50,6 +50,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jan 13, 2011 bfarmer Initial creation * Jan 13, 2011 bfarmer Initial creation
* Mar 06, 2014 2876 mpduff New NDM plugin.
* *
* </pre> * </pre>
* *
@ -59,7 +60,8 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
public class DisseminationNationalDatasetSubscriber implements public class DisseminationNationalDatasetSubscriber implements
INationalDatasetSubscriber { INationalDatasetSubscriber {
private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(DisseminationNationalDatasetSubscriber.class); private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(DisseminationNationalDatasetSubscriber.class);
private static final String AWIPS_PRIORITIES_FILENAME = "dissemination/awipsPriorities.txt"; private static final String AWIPS_PRIORITIES_FILENAME = "dissemination/awipsPriorities.txt";
@ -84,7 +86,8 @@ public class DisseminationNationalDatasetSubscriber implements
try { try {
backupFile.createNewFile(); backupFile.createNewFile();
} catch (IOException e) { } catch (IOException e) {
statusHandler.handle(Priority.PROBLEM, "Failed to create File " + backupFilename, e); statusHandler.handle(Priority.PROBLEM, "Failed to create file "
+ backupFilename, e);
} }
saveFile(outFile, backupFile); saveFile(outFile, backupFile);
saveFile(file, outFile); saveFile(file, outFile);
@ -93,10 +96,12 @@ public class DisseminationNationalDatasetSubscriber implements
private void saveFile(File file, File outFile) { private void saveFile(File file, File outFile) {
if ((file != null) && file.exists()) { if ((file != null) && file.exists()) {
BufferedReader fis = null;
BufferedWriter fos = null;
try { try {
BufferedReader fis = new BufferedReader(new InputStreamReader( fis = new BufferedReader(new InputStreamReader(
new FileInputStream(file))); new FileInputStream(file)));
BufferedWriter fos = new BufferedWriter(new OutputStreamWriter( fos = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(outFile))); new FileOutputStream(outFile)));
String line = null; String line = null;
try { try {
@ -104,19 +109,30 @@ public class DisseminationNationalDatasetSubscriber implements
fos.write(line); fos.write(line);
fos.newLine(); fos.newLine();
} }
fos.close();
} catch (IOException e) { } catch (IOException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"Could not read File " + AWIPS_PRIORITIES_FILENAME, "Could not read file: " + file.getName(), e);
e);
} }
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM, "Failed to find file: "
"Failed to find File " + AWIPS_PRIORITIES_FILENAME, e); + file.getName(), e);
} finally {
if (fis != null) {
try {
fis.close();
} catch (IOException e) {
// ignore
}
}
if (fos != null) {
try {
fos.close();
} catch (IOException e) {
// ignore
}
}
} }
} }
} }
} }

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.raytheon.uf.edex.ndm</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7

View file

@ -0,0 +1,16 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Ndm
Bundle-SymbolicName: com.raytheon.uf.edex.ndm
Bundle-Version: 1.14.0.qualifier
Bundle-Activator: com.raytheon.uf.edex.ndm.Activator
Bundle-Vendor: RAYTHEON
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: org.osgi.framework;version="1.3.0"
Bundle-ActivationPolicy: lazy
Require-Bundle: com.raytheon.uf.common.localization;bundle-version="1.14.0",
com.raytheon.uf.common.status;bundle-version="1.12.1174",
com.raytheon.uf.common.pointdata;bundle-version="1.13.0",
com.raytheon.uf.common.site;bundle-version="1.12.1174",
com.raytheon.uf.edex.core;bundle-version="1.12.1174"
Export-Package: com.raytheon.uf.edex.ndm.ingest

View file

@ -0,0 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
res/

View file

@ -0,0 +1,26 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<camelContext id="clusteredNdmProc"
xmlns="http://camel.apache.org/schema/spring"
errorHandlerRef="errorHandler" autoStartup="false">
<endpoint id="ndmFileEndpoint"
uri="file:${edex.home}/data/ndm?delete=true&amp;delay=5000&amp;maxMessagesPerPoll=1000&amp;exclusiveReadLockStrategy=#ndmFileChangedStrategy" />
<route id="ndmFileScan">
<from ref="ndmFileEndpoint" />
<bean ref="ndmProc" method="processEvent" />
</route>
</camelContext>
<bean factory-bean="clusteredCamelContextMgr"
factory-method="register">
<constructor-arg ref="clusteredNdmProc" />
</bean>
<bean id="ndmProc" class="com.raytheon.uf.edex.ndm.ingest.NationalDatasetIngester"/>
<bean id="ndmFileChangedStrategy" class="com.raytheon.uf.edex.esb.camel.FileChangedExclusiveReadLockStrategy"/>
</beans>

View file

@ -17,44 +17,48 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * further licensing information.
**/ **/
package com.raytheon.uf.edex.site.ingest; package com.raytheon.uf.edex.ndm.ingest;
import com.raytheon.uf.common.site.ingest.INationalDatasetSubscriber;
/** /**
* TODO Add Description * NDM Dataset ingester interface.
* *
* <pre> * <pre>
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Sep 22, 2011 jkorman Initial creation * Sep 22, 2011 jkorman Initial creation
* * Mar 06, 2014 2876 mpduff New NDM plugin.
*
* </pre> * </pre>
* *
* @author jkorman * @author jkorman
* @version 1.0 * @version 1.0
*/ */
public interface IDataSetIngester { public interface IDataSetIngester {
/** /**
* Register a filename to be processed and the subscription listener that will process * Register a filename to be processed and the subscription listener that
* the file. * will process the file.
* @param filename *
* @param filename
* @param listener * @param listener
* @return * @return
*/ */
INationalDatasetSubscriber registerListener(String filename, INationalDatasetSubscriber listener); INationalDatasetSubscriber registerListener(String filename,
INationalDatasetSubscriber listener);
/** /**
* Remove a subscription listener for a given file. * Remove a subscription listener for a given file.
* @param filename *
* @param filename
* @param listener * @param listener
* @return * @return
*/ */
INationalDatasetSubscriber removeListener(String filename, INationalDatasetSubscriber listener); INationalDatasetSubscriber removeListener(String filename,
INationalDatasetSubscriber listener);
} }

View file

@ -17,12 +17,12 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * further licensing information.
**/ **/
package com.raytheon.uf.common.site.ingest; package com.raytheon.uf.edex.ndm.ingest;
import java.io.File; import java.io.File;
/** /**
* TODO Add Description * National Dataset Subscriber Interface.
* *
* <pre> * <pre>
* *
@ -30,7 +30,8 @@ import java.io.File;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jan 5, 2011 bfarmer Initial creation * Jan 05, 2011 bfarmer Initial creation
* Mar 06, 2014 2876 mpduff New NDM plugin.
* *
* </pre> * </pre>
* *

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * further licensing information.
**/ **/
package com.raytheon.uf.edex.site.ingest; package com.raytheon.uf.edex.ndm.ingest;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
@ -25,14 +25,13 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.raytheon.uf.common.site.ingest.INationalDatasetSubscriber;
import com.raytheon.uf.common.status.IUFStatusHandler; 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;
import com.raytheon.uf.edex.core.EdexException; import com.raytheon.uf.edex.core.EdexException;
/** /**
* TODO Add Description * National Dataset Maintenance ingester.
* *
* <pre> * <pre>
* *
@ -44,6 +43,7 @@ import com.raytheon.uf.edex.core.EdexException;
* Aug 11,2011 9965 rferrel Added logging to processEvent * Aug 11,2011 9965 rferrel Added logging to processEvent
* Aug 24,2011 10775 rferrel Fixed error in processEvent and added * Aug 24,2011 10775 rferrel Fixed error in processEvent and added
* check on statusHandler messages. * check on statusHandler messages.
* Mar 06, 2014 2876 mpduff New NDM plugin.
* *
* </pre> * </pre>
* *
@ -53,15 +53,17 @@ import com.raytheon.uf.edex.core.EdexException;
public class NationalDatasetIngester implements IDataSetIngester { public class NationalDatasetIngester implements IDataSetIngester {
private Map<String, List<INationalDatasetSubscriber>> listeners = new HashMap<String, List<INationalDatasetSubscriber>>(); private final Map<String, List<INationalDatasetSubscriber>> listeners = new HashMap<String, List<INationalDatasetSubscriber>>();
/** /**
* Register a filename to be processed and the subscription listener that will process * Register a filename to be processed and the subscription listener that
* the file. * will process the file.
* @param filename *
* @param filename
* @param listener * @param listener
* @return * @return
*/ */
@Override
public INationalDatasetSubscriber registerListener(String filename, public INationalDatasetSubscriber registerListener(String filename,
INationalDatasetSubscriber listener) { INationalDatasetSubscriber listener) {
if (listeners.get(filename) == null) { if (listeners.get(filename) == null) {
@ -74,22 +76,23 @@ public class NationalDatasetIngester implements IDataSetIngester {
/** /**
* Remove a subscription listener for a given file. * Remove a subscription listener for a given file.
* @param filename *
* @param filename
* @param listener * @param listener
* @return Returns the listener reference that was removed, otherwise a * @return Returns the listener reference that was removed, otherwise a null
* null reference is returned. * reference is returned.
*/ */
@Override @Override
public INationalDatasetSubscriber removeListener(String filename, public INationalDatasetSubscriber removeListener(String filename,
INationalDatasetSubscriber listener) { INationalDatasetSubscriber listener) {
INationalDatasetSubscriber storedListener = null; INationalDatasetSubscriber storedListener = null;
if(filename != null) { if (filename != null) {
if(listeners.containsKey(filename)) { if (listeners.containsKey(filename)) {
List<INationalDatasetSubscriber> list = listeners.get(filename); List<INationalDatasetSubscriber> list = listeners.get(filename);
for(int i = 0;i < list.size();i++) { for (int i = 0; i < list.size(); i++) {
if(list.get(i).equals(listener)) { if (list.get(i).equals(listener)) {
storedListener = list.get(i); storedListener = list.get(i);
list.remove(i); list.remove(i);
break; break;
@ -99,7 +102,7 @@ public class NationalDatasetIngester implements IDataSetIngester {
} }
return storedListener; return storedListener;
} }
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
@ -145,6 +148,4 @@ public class NationalDatasetIngester implements IDataSetIngester {
} }
} }
} }

View file

@ -15,5 +15,6 @@ Require-Bundle: com.raytheon.edex.common,
com.raytheon.uf.edex.decodertools;bundle-version="1.0.0", com.raytheon.uf.edex.decodertools;bundle-version="1.0.0",
com.raytheon.uf.common.site;bundle-version="1.12.1174", com.raytheon.uf.common.site;bundle-version="1.12.1174",
com.raytheon.uf.edex.site;bundle-version="1.0.0", com.raytheon.uf.edex.site;bundle-version="1.0.0",
com.raytheon.uf.common.monitor;bundle-version="1.12.1174" com.raytheon.uf.common.monitor;bundle-version="1.12.1174",
com.raytheon.uf.edex.ndm;bundle-version="1.0.0"
Import-Package: org.apache.commons.logging Import-Package: org.apache.commons.logging

View file

@ -29,12 +29,12 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import com.raytheon.edex.site.SiteUtil; import com.raytheon.edex.site.SiteUtil;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.monitor.config.FogMonitorConfigurationManager; import com.raytheon.uf.common.monitor.config.FogMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.MonitorConfigurationManager; import com.raytheon.uf.common.monitor.config.MonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.SSMonitorConfigurationManager; import com.raytheon.uf.common.monitor.config.SSMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.SnowMonitorConfigurationManager; import com.raytheon.uf.common.monitor.config.SnowMonitorConfigurationManager;
import com.raytheon.uf.common.site.ingest.INationalDatasetSubscriber; import com.raytheon.uf.edex.ndm.ingest.IDataSetIngester;
import com.raytheon.uf.edex.ndm.ingest.INationalDatasetSubscriber;
import com.raytheon.uf.edex.plugin.loctables.util.CommonObsSpatialBuilder; import com.raytheon.uf.edex.plugin.loctables.util.CommonObsSpatialBuilder;
import com.raytheon.uf.edex.plugin.loctables.util.TableHandler; import com.raytheon.uf.edex.plugin.loctables.util.TableHandler;
import com.raytheon.uf.edex.plugin.loctables.util.handlers.DefaultHandler; import com.raytheon.uf.edex.plugin.loctables.util.handlers.DefaultHandler;
@ -45,12 +45,9 @@ import com.raytheon.uf.edex.plugin.loctables.util.handlers.PirepTableHandler;
import com.raytheon.uf.edex.plugin.loctables.util.handlers.RAOBTableHandler; import com.raytheon.uf.edex.plugin.loctables.util.handlers.RAOBTableHandler;
import com.raytheon.uf.edex.plugin.loctables.util.handlers.SynopticLandTableHandler; import com.raytheon.uf.edex.plugin.loctables.util.handlers.SynopticLandTableHandler;
import com.raytheon.uf.edex.plugin.loctables.util.store.ObStationStoreStrategy; import com.raytheon.uf.edex.plugin.loctables.util.store.ObStationStoreStrategy;
import com.raytheon.uf.edex.plugin.loctables.util.store.PrintStreamStoreStrategy;
import com.raytheon.uf.edex.plugin.loctables.util.store.RowStoreStrategy;
import com.raytheon.uf.edex.site.ingest.IDataSetIngester;
/** /**
* TODO Add Description * Location Tables NDM subscriber
* *
* <pre> * <pre>
* *
@ -58,7 +55,8 @@ import com.raytheon.uf.edex.site.ingest.IDataSetIngester;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 8, 2010 jkorman Initial creation * Apr 08, 2010 jkorman Initial creation
* Mar 06, 2014 2876 mpduff New NDM plugin.
* *
* </pre> * </pre>
* *
@ -74,7 +72,7 @@ public class LocationTablesIngest implements INationalDatasetSubscriber {
private IDataSetIngester ingester = null; private IDataSetIngester ingester = null;
private Log logger = LogFactory.getLog(getClass()); private final Log logger = LogFactory.getLog(getClass());
@SuppressWarnings("unused") @SuppressWarnings("unused")
private LocationTablesIngest() { private LocationTablesIngest() {
@ -130,7 +128,9 @@ public class LocationTablesIngest implements INationalDatasetSubscriber {
try { try {
monitor.readConfigXml(currentSite); monitor.readConfigXml(currentSite);
} catch (Throwable t) { } catch (Throwable t) {
logger.error("Could not configure " + monitor.getClass().getName() + " for site " + currentSite, t); logger.error("Could not configure "
+ monitor.getClass().getName() + " for site "
+ currentSite, t);
} }
} }
} }

View file

@ -9,8 +9,6 @@
errorHandlerRef="errorHandler" autoStartup="false"> errorHandlerRef="errorHandler" autoStartup="false">
<endpoint id="manualFileEndpoint" <endpoint id="manualFileEndpoint"
uri="file:${edex.home}/data/manual?delete=true&amp;delay=5000&amp;maxMessagesPerPoll=1000&amp;exclusiveReadLockStrategy=#fileChangedStrategy&amp;recursive=true" /> uri="file:${edex.home}/data/manual?delete=true&amp;delay=5000&amp;maxMessagesPerPoll=1000&amp;exclusiveReadLockStrategy=#fileChangedStrategy&amp;recursive=true" />
<endpoint id="ndmFileEndpoint"
uri="file:${edex.home}/data/ndm?delete=true&amp;delay=5000&amp;maxMessagesPerPoll=1000&amp;exclusiveReadLockStrategy=#ndmFileChangedStrategy" />
<route id="manualFileScan"> <route id="manualFileScan">
<from ref="manualFileEndpoint" /> <from ref="manualFileEndpoint" />
@ -18,167 +16,10 @@
<bean ref="manualProc" /> <bean ref="manualProc" />
<to uri="jms-durable:queue:external.dropbox"/> <to uri="jms-durable:queue:external.dropbox"/>
</route> </route>
<route id="ndmFileScan">
<from ref="ndmFileEndpoint" />
<bean ref="ndmProc" method="processEvent" />
</route>
</camelContext> </camelContext>
<bean factory-bean="clusteredCamelContextMgr" <bean factory-bean="clusteredCamelContextMgr"
factory-method="register"> factory-method="register">
<constructor-arg ref="clusteredManualProc" /> <constructor-arg ref="clusteredManualProc" />
</bean> </bean>
<bean id="ndmProc" class="com.raytheon.uf.edex.site.ingest.NationalDatasetIngester"/>
<bean id="ndmFileChangedStrategy" class="com.raytheon.uf.edex.esb.camel.FileChangedExclusiveReadLockStrategy"/>
<bean id="siteMapListener" class="com.raytheon.uf.common.site.ingest.SiteMapNationalDatasetSubscriber" />
<bean id="afosBrowserListener" class="com.raytheon.uf.common.site.ingest.AfosBrowserModelSubscriber" />
<bean id="buoyListener" class="com.raytheon.uf.common.site.ingest.BuoySubscriber" />
<bean id="mtrListener" class="com.raytheon.uf.common.site.ingest.MTRSubscriber" />
<bean id="afosToAwipsListener" class="com.raytheon.edex.plugin.text.ingest.AfosToAwipsListener" />
<bean id="disseminationListener" class="com.raytheon.uf.edex.dissemination.ingest.DisseminationNationalDatasetSubscriber" />
<bean id="textDBStaticDataListener" class="com.raytheon.edex.textdb.ingest.TextDBStaticDataSubscriber" />
<bean id="modelBufrListener" class="com.raytheon.uf.edex.plugin.modelsounding.ingest.ModelBufrSubscriber" />
<bean id="radarMenuCreator" class="com.raytheon.edex.plugin.radar.util.RadarMenuUtil"/>
<bean id="import88dLocations" class="com.raytheon.edex.plugin.radar.util.Import88DLocationsUtil"/>
<bean id="marineInfoListener" class="com.raytheon.uf.edex.site.ingest.MarineInfoSubscriber">
<constructor-arg value="${db.port}" />
<constructor-arg value="${edex.home}" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="MarineInfo.txt" />
<constructor-arg ref="marineInfoListener" />
</bean>
<bean id="raobListener" class="com.raytheon.uf.common.site.ingest.RAOBSubscriber" />
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="raob.spi" />
<constructor-arg ref="raobListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="raob.goodness" />
<constructor-arg ref="raobListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="raob.primary" />
<constructor-arg ref="raobListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="tdwrElevations.txt" />
<constructor-arg ref="radarMenuCreator" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="fsl-w88d.shp" />
<constructor-arg ref="import88dLocations" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="fsl-w88d.shx" />
<constructor-arg ref="import88dLocations" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="fsl-w88d.dbf" />
<constructor-arg ref="import88dLocations" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="modelBufr.spi" />
<constructor-arg ref="modelBufrListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="modelBufrStationInfo.txt" />
<constructor-arg ref="modelBufrListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="modelBufrStationList.txt" />
<constructor-arg ref="modelBufrListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="BUOY.spi" />
<constructor-arg ref="buoyListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="BUOY.goodness" />
<constructor-arg ref="buoyListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="BUOY.primary" />
<constructor-arg ref="buoyListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="maritimeStationInfo.txt" />
<constructor-arg ref="buoyListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="MTR.spi" />
<constructor-arg ref="mtrListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="MTR.goodness" />
<constructor-arg ref="mtrListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="MTR.primary" />
<constructor-arg ref="mtrListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="bit_table.dat" />
<constructor-arg ref="textDBStaticDataListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="collective_table.dat" />
<constructor-arg ref="textDBStaticDataListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="exclusionProductList.dat" />
<constructor-arg ref="textDBStaticDataListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="ispan_table.dat" />
<constructor-arg ref="textDBStaticDataListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="station_table.dat" />
<constructor-arg ref="textDBStaticDataListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="upair_table.dat" />
<constructor-arg ref="textDBStaticDataListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="awipsPriorities.txt" />
<constructor-arg ref="disseminationListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="afos_lookup_table.dat" />
<constructor-arg ref="siteMapListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="national_category_table.template" />
<constructor-arg ref="siteMapListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="afos2awips.txt" />
<constructor-arg ref="afosToAwipsListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="textCCChelp.txt" />
<constructor-arg ref="afosBrowserListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="textNNNhelp.txt" />
<constructor-arg ref="afosBrowserListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="textCategoryClass.txt" />
<constructor-arg ref="afosBrowserListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="textOriginTable.txt" />
<constructor-arg ref="afosBrowserListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="afosMasterPIL.txt" />
<constructor-arg ref="afosBrowserListener" />
</bean>
</beans> </beans>

View file

@ -7,7 +7,7 @@ Bundle-Vendor: RAYTHEON
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
Require-Bundle: com.raytheon.uf.edex.core, Require-Bundle: com.raytheon.uf.edex.core,
com.raytheon.uf.edex.database, com.raytheon.uf.edex.database,
com.raytheon.uf.edex.pointdata, com.raytheon.uf.edex.pointdata,
com.raytheon.uf.edex.decodertools, com.raytheon.uf.edex.decodertools,
@ -18,7 +18,8 @@ Require-Bundle: com.raytheon.uf.edex.core,
com.raytheon.uf.common.status, com.raytheon.uf.common.status,
com.raytheon.uf.common.serialization, com.raytheon.uf.common.serialization,
com.raytheon.uf.common.localization, com.raytheon.uf.common.localization,
com.raytheon.uf.common.site com.raytheon.uf.common.site,
com.raytheon.uf.edex.ndm;bundle-version="1.0.0"
Import-Package: com.raytheon.edex.esb, Import-Package: com.raytheon.edex.esb,
com.raytheon.edex.plugin com.raytheon.edex.plugin
Export-Package: com.raytheon.uf.edex.plugin.modelsounding, Export-Package: com.raytheon.uf.edex.plugin.modelsounding,

View file

@ -30,6 +30,21 @@
<constructor-arg ref="modelsounding-camel"/> <constructor-arg ref="modelsounding-camel"/>
</bean> </bean>
<bean id="modelBufrListener" class="com.raytheon.uf.edex.plugin.modelsounding.ingest.ModelBufrSubscriber" />
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="modelBufr.spi" />
<constructor-arg ref="modelBufrListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="modelBufrStationInfo.txt" />
<constructor-arg ref="modelBufrListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="modelBufrStationList.txt" />
<constructor-arg ref="modelBufrListener" />
</bean>
<camelContext id="modelsounding-camel" <camelContext id="modelsounding-camel"
xmlns="http://camel.apache.org/schema/spring" xmlns="http://camel.apache.org/schema/spring"
errorHandlerRef="errorHandler" errorHandlerRef="errorHandler"

View file

@ -22,10 +22,14 @@ package com.raytheon.uf.edex.plugin.modelsounding.ingest;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.BufferedWriter; import java.io.BufferedWriter;
import java.io.File; import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader; import java.io.FileReader;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import com.raytheon.uf.common.localization.IPathManager; import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext; import com.raytheon.uf.common.localization.LocalizationContext;
@ -33,10 +37,10 @@ import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.PathManagerFactory; import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.pointdata.vadriver.VA_Driver; import com.raytheon.uf.common.pointdata.vadriver.VA_Driver;
import com.raytheon.uf.common.site.ingest.INationalDatasetSubscriber;
import com.raytheon.uf.common.status.IUFStatusHandler; 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;
import com.raytheon.uf.edex.ndm.ingest.INationalDatasetSubscriber;
import com.raytheon.uf.edex.plugin.modelsounding.decoder.ModelSoundingDataAdapter; import com.raytheon.uf.edex.plugin.modelsounding.decoder.ModelSoundingDataAdapter;
/** /**
@ -51,6 +55,7 @@ import com.raytheon.uf.edex.plugin.modelsounding.decoder.ModelSoundingDataAdapte
* ------------- -------- ----------- -------------------------- * ------------- -------- ----------- --------------------------
* Jan 29, 2011 bfarmer Initial creation * Jan 29, 2011 bfarmer Initial creation
* Dec 02, 2013 2537 bsteffen Ensure streams are closed. * Dec 02, 2013 2537 bsteffen Ensure streams are closed.
* Mar 06, 2014 2876 mpduff New NDM plugin.
* *
* </pre> * </pre>
* *
@ -61,26 +66,26 @@ import com.raytheon.uf.edex.plugin.modelsounding.decoder.ModelSoundingDataAdapte
public class ModelBufrSubscriber implements INationalDatasetSubscriber { public class ModelBufrSubscriber implements INationalDatasetSubscriber {
private static final String MODEL_STATION_LIST = ModelSoundingDataAdapter.MODEL_STATION_LIST; private static final String MODEL_STATION_LIST = ModelSoundingDataAdapter.MODEL_STATION_LIST;
private static final String MODEL_STATION_INFO = "modelBufrStationInfo.txt"; private static final String MODEL_STATION_INFO = "modelBufrStationInfo.txt";
private static final String MODEL_GOODNESS = "modelBufr.goodness"; private static final String MODEL_GOODNESS = "modelBufr.goodness";
private static final IUFStatusHandler statusHandler = UFStatus
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(ModelBufrSubscriber.class); .getHandler(ModelBufrSubscriber.class);
@Override @Override
public void notify(String fileName, File file) { public void notify(String fileName, File file) {
statusHandler.handle(Priority.EVENTA, statusHandler.handle(Priority.EVENTA,
"modelBufr:Processing input file [" + fileName + "]"); "modelBufr:Processing input file [" + fileName + "]");
if ("modelBufr.spi".equals(fileName)) { if ("modelBufr.spi".equals(fileName)) {
IPathManager pathMgr = PathManagerFactory.getPathManager(); IPathManager pathMgr = PathManagerFactory.getPathManager();
LocalizationContext lc = pathMgr.getContext( LocalizationContext lc = pathMgr.getContext(
LocalizationType.COMMON_STATIC, LocalizationLevel.SITE); LocalizationType.COMMON_STATIC, LocalizationLevel.SITE);
File outFile = pathMgr.getFile(lc, ModelSoundingDataAdapter.SPI_FILE); File outFile = pathMgr.getFile(lc,
ModelSoundingDataAdapter.SPI_FILE);
saveFile(file, outFile); saveFile(file, outFile);
ModelSoundingDataAdapter.updateSPIData(); ModelSoundingDataAdapter.updateSPIData();
} else if (MODEL_STATION_LIST.equals(fileName)) { } else if (MODEL_STATION_LIST.equals(fileName)) {
@ -92,13 +97,16 @@ public class ModelBufrSubscriber implements INationalDatasetSubscriber {
saveFile(file, outFile); saveFile(file, outFile);
generateSPI(file, goodnessFile); generateSPI(file, goodnessFile);
File spiFile = pathMgr.getFile(lc, ModelSoundingDataAdapter.SPI_FILE); File spiFile = pathMgr.getFile(lc,
ModelSoundingDataAdapter.SPI_FILE);
if (!spiFile.exists()) { if (!spiFile.exists()) {
try { try {
spiFile.createNewFile(); spiFile.createNewFile();
} catch (IOException e) { } catch (IOException e) {
statusHandler.handle(Priority.SIGNIFICANT, statusHandler.handle(
"modelBufr:Could not create primary file. ", e); Priority.SIGNIFICANT,
"modelBufr:Could not create spi file: "
+ spiFile.getName(), e);
} }
} }
@ -116,13 +124,15 @@ public class ModelBufrSubscriber implements INationalDatasetSubscriber {
saveFile(file, outFile); saveFile(file, outFile);
generateSPI(file, goodnessFile); generateSPI(file, goodnessFile);
File spiFile = pathMgr.getFile(lc, ModelSoundingDataAdapter.SPI_FILE); File spiFile = pathMgr.getFile(lc,
ModelSoundingDataAdapter.SPI_FILE);
if (!spiFile.exists()) { if (!spiFile.exists()) {
try { try {
spiFile.createNewFile(); spiFile.createNewFile();
} catch (IOException e) { } catch (IOException e) {
statusHandler.handle(Priority.SIGNIFICANT, statusHandler.handle(Priority.SIGNIFICANT,
"modelBufr:Could not create primary file. ", e); "modelBufr:Could not create spiFile file: "
+ spiFile.getName(), e);
} }
} }
@ -131,7 +141,7 @@ public class ModelBufrSubscriber implements INationalDatasetSubscriber {
driver.vaStationsFile(goodnessFile, null, spiFile); driver.vaStationsFile(goodnessFile, null, spiFile);
// updateStationList will reload spi files also // updateStationList will reload spi files also
ModelSoundingDataAdapter.update(); ModelSoundingDataAdapter.update();
} }
} }
@ -145,17 +155,17 @@ public class ModelBufrSubscriber implements INationalDatasetSubscriber {
String[] splitLine; String[] splitLine;
try { try {
BufferedReader fis = null; BufferedReader fis = null;
// if (!goodnessFile.exists()) { // if (!goodnessFile.exists()) {
// goodnessFile.createNewFile(); // goodnessFile.createNewFile();
// } // }
BufferedWriter fos = null; BufferedWriter fos = null;
try { try {
fis = new BufferedReader(new FileReader(file)); fis = new BufferedReader(new FileReader(file));
fos = new BufferedWriter(new FileWriter(goodnessFile)); fos = new BufferedWriter(new FileWriter(goodnessFile));
while ((line = fis.readLine()) != null) { while ((line = fis.readLine()) != null) {
if(line.length() > 0) { if (line.length() > 0) {
// check for commented lines // check for commented lines
if('#' != line.charAt(0)) { if ('#' != line.charAt(0)) {
try { try {
splitLine = line.split("\\|"); splitLine = line.split("\\|");
Integer elevation; Integer elevation;
@ -163,27 +173,34 @@ public class ModelBufrSubscriber implements INationalDatasetSubscriber {
Double longitude; Double longitude;
String cause = "elevation"; String cause = "elevation";
try { try {
elevation = Integer.parseInt(splitLine[4].trim()); elevation = Integer.parseInt(splitLine[4]
.trim());
cause = "latitude"; cause = "latitude";
latitude = Double.parseDouble(splitLine[2].trim()); latitude = Double.parseDouble(splitLine[2]
.trim());
cause = "longitude"; cause = "longitude";
longitude = Double.parseDouble(splitLine[3].trim()); longitude = Double.parseDouble(splitLine[3]
.trim());
} catch (NumberFormatException nfe) { } catch (NumberFormatException nfe) {
String err = String.format("modelBufr:Invalid %s in data line [%s]", cause, line); String err = String
statusHandler.handle(Priority.PROBLEM,err); .format("modelBufr:Invalid %s in data line [%s]",
cause, line);
statusHandler.handle(Priority.PROBLEM, err);
continue; continue;
} }
String stationName = splitLine[1].trim(); String stationName = splitLine[1].trim();
fos.write("0 "); fos.write("0 ");
fos.write(stationName); fos.write(stationName);
fos.write(String.format(" %8.4f %9.4f %5d %9d", latitude, fos.write(String.format(" %8.4f %9.4f %5d %9d",
longitude, elevation, 0)); latitude, longitude, elevation, 0));
fos.newLine(); fos.newLine();
} catch (Exception e) { } catch (Exception e) {
String err = String.format("modelBufr:Error in data line [%s]", line); String err = String.format(
statusHandler.handle(Priority.PROBLEM,err,e); "modelBufr:Error in data line [%s]",
line);
statusHandler.handle(Priority.PROBLEM, err, e);
continue; continue;
} }
} }
} }
} }
@ -198,21 +215,22 @@ public class ModelBufrSubscriber implements INationalDatasetSubscriber {
+ file.getName() + "]"); + file.getName() + "]");
} }
} }
if(fos != null) { if (fos != null) {
try { try {
fos.close(); fos.close();
} catch (IOException ioe) { } catch (IOException ioe) {
statusHandler.handle(Priority.SIGNIFICANT, statusHandler.handle(Priority.SIGNIFICANT,
"modelBufr:Error closing output file [" + goodnessFile.getName() + "]"); "modelBufr:Error closing output file ["
+ goodnessFile.getName() + "]");
} }
} }
} }
} catch (IOException e) { } catch (IOException e) {
statusHandler.handle(Priority.SIGNIFICANT, "modelBufr:Could not read File ", e); statusHandler.handle(Priority.SIGNIFICANT,
"modelBufr:Could not read File ", e);
} }
} }
/** /**
* *
* @param file * @param file
@ -223,28 +241,37 @@ public class ModelBufrSubscriber implements INationalDatasetSubscriber {
BufferedReader fis = null; BufferedReader fis = null;
BufferedWriter fos = null; BufferedWriter fos = null;
try { try {
fis = new BufferedReader(new FileReader(file)); fis = new BufferedReader(new InputStreamReader(
fos = new BufferedWriter(new FileWriter(outFile)); new FileInputStream(file)));
fos = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(outFile)));
String line = null; String line = null;
while ((line = fis.readLine()) != null) { try {
fos.write(line); while ((line = fis.readLine()) != null) {
fos.newLine(); fos.write(line);
fos.newLine();
}
} catch (IOException e) {
statusHandler.handle(Priority.PROBLEM,
"Could not read file: " + file.getName(), e);
} }
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
statusHandler.handle(Priority.SIGNIFICANT, "modelBufr:Failed to find File ", statusHandler.handle(Priority.PROBLEM, "Failed to find file: "
e); + file.getName(), e);
} catch (IOException e) {
statusHandler.handle(Priority.SIGNIFICANT, "modelBufr:Error reading File ",
e);
} finally { } finally {
if (fis != null) {
try {
fis.close();
} catch (IOException e) {
// ignore
}
}
if (fos != null) { if (fos != null) {
try { try {
fos.close(); fos.close();
} catch (IOException e) { } catch (IOException e) {
statusHandler.handle( // ignore
Priority.SIGNIFICANT,
"Error closing output file ["
+ outFile.getName() + "]");
} }
} }
} }

View file

@ -8,7 +8,8 @@ Require-Bundle: com.raytheon.edex.common,
com.raytheon.uf.common.site;bundle-version="1.12.1174";visibility:=reexport, com.raytheon.uf.common.site;bundle-version="1.12.1174";visibility:=reexport,
com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1174", com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1174",
com.raytheon.uf.common.localization;bundle-version="1.12.1174", com.raytheon.uf.common.localization;bundle-version="1.12.1174",
com.raytheon.uf.common.status;bundle-version="1.12.1174" com.raytheon.uf.common.status;bundle-version="1.12.1174",
com.raytheon.uf.edex.ndm;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Export-Package: com.raytheon.uf.edex.site, Export-Package: com.raytheon.uf.edex.site,

View file

@ -16,7 +16,7 @@
<license url="http://www.example.com/license"> <license url="http://www.example.com/license">
[Enter License Description here.] [Enter License Description here.]
</license> </license>
<requires> <requires>
<import feature="com.raytheon.uf.edex.grib.feature" version="1.0.0.qualifier"/> <import feature="com.raytheon.uf.edex.grib.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.uf.edex.archive.feature" version="1.0.0.qualifier"/> <import feature="com.raytheon.uf.edex.archive.feature" version="1.0.0.qualifier"/>