Merge "Issue #2876 - Pluginize NDM review comments" into development
Former-commit-id:4568108a3c
[formerly 296f8f835cbc87783f0f50278d2148f756cf6296] Former-commit-id:c9dfa75d1c
This commit is contained in:
commit
29250be003
46 changed files with 919 additions and 539 deletions
|
@ -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.menus;bundle-version="1.0.0",
|
||||
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,
|
||||
com.raytheon.edex.plugin,
|
||||
org.apache.commons.logging
|
||||
|
|
|
@ -19,6 +19,21 @@
|
|||
<constructor-arg ref="bufrua-camel"/>
|
||||
</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"
|
||||
xmlns="http://camel.apache.org/schema/spring"
|
||||
errorHandlerRef="errorHandler"
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.site.ingest;
|
||||
package com.raytheon.edex.plugin.bufrua.ingest;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
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.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.edex.ndm.ingest.INationalDatasetSubscriber;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* RAOB NDM subscriber.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -48,7 +49,8 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
*
|
||||
* 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>
|
||||
*
|
||||
|
@ -57,7 +59,9 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
*/
|
||||
|
||||
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;
|
||||
|
||||
@Override
|
||||
|
@ -77,6 +81,7 @@ public class RAOBSubscriber implements INationalDatasetSubscriber {
|
|||
if (null == combineThread) {
|
||||
combineThread = new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Thread.sleep(60 * 1000);
|
||||
|
@ -100,6 +105,7 @@ public class RAOBSubscriber implements INationalDatasetSubscriber {
|
|||
if (null == combineThread) {
|
||||
combineThread = new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Thread.sleep(60 * 1000);
|
||||
|
@ -120,10 +126,12 @@ public class RAOBSubscriber implements INationalDatasetSubscriber {
|
|||
|
||||
private void saveFile(File file, File outFile) {
|
||||
if ((file != null) && file.exists()) {
|
||||
BufferedReader fis = null;
|
||||
BufferedWriter fos = null;
|
||||
try {
|
||||
BufferedReader fis = new BufferedReader(new InputStreamReader(
|
||||
fis = new BufferedReader(new InputStreamReader(
|
||||
new FileInputStream(file)));
|
||||
BufferedWriter fos = new BufferedWriter(new OutputStreamWriter(
|
||||
fos = new BufferedWriter(new OutputStreamWriter(
|
||||
new FileOutputStream(outFile)));
|
||||
String line = null;
|
||||
try {
|
||||
|
@ -131,15 +139,29 @@ public class RAOBSubscriber implements INationalDatasetSubscriber {
|
|||
fos.write(line);
|
||||
fos.newLine();
|
||||
}
|
||||
fos.close();
|
||||
} catch (IOException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Could not read File ", e);
|
||||
"Could not read file: " + file.getName(), e);
|
||||
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Failed to find File ", e);
|
||||
statusHandler.handle(Priority.PROBLEM, "Failed to find file: "
|
||||
+ 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();
|
||||
} catch (IOException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Could not create primary file. ", e);
|
||||
"Could not create primary file: " + primary.getName(),
|
||||
e);
|
||||
}
|
||||
}
|
||||
if (!spi.exists()) {
|
||||
|
@ -164,7 +187,7 @@ public class RAOBSubscriber implements INationalDatasetSubscriber {
|
|||
spi.createNewFile();
|
||||
} catch (IOException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Could not create primary file. ", e);
|
||||
"Could not create spi file: " + spi.getName(), e);
|
||||
}
|
||||
}
|
||||
if (goodness.exists()) {
|
|
@ -17,7 +17,9 @@ Require-Bundle: com.raytheon.edex.common,
|
|||
javax.persistence,
|
||||
org.apache.camel;bundle-version="1.0.0";resolution:=optional,
|
||||
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
|
||||
Import-Package: com.raytheon.uf.common.dataplugin.obs.metar,
|
||||
com.raytheon.uf.common.dataplugin.obs.metar.util,
|
||||
|
|
|
@ -22,6 +22,21 @@
|
|||
<constructor-arg ref="obs-camel" />
|
||||
</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"
|
||||
errorHandlerRef="errorHandler" autoStartup="false">
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.site.ingest;
|
||||
package com.raytheon.edex.plugin.obs.ingest;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
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.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.edex.ndm.ingest.INationalDatasetSubscriber;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* MTR NDM subscriber.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -49,6 +50,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 29, 2011 bfarmer Initial creation
|
||||
* Mar 06, 2014 2876 mpduff New NDM plugin.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -57,7 +59,8 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
*/
|
||||
|
||||
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;
|
||||
|
||||
|
@ -78,6 +81,7 @@ public class MTRSubscriber implements INationalDatasetSubscriber {
|
|||
if (null == combineThread) {
|
||||
combineThread = new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Thread.sleep(60 * 1000);
|
||||
|
@ -101,6 +105,7 @@ public class MTRSubscriber implements INationalDatasetSubscriber {
|
|||
if (null == combineThread) {
|
||||
combineThread = new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Thread.sleep(60 * 1000);
|
||||
|
@ -120,13 +125,12 @@ public class MTRSubscriber implements INationalDatasetSubscriber {
|
|||
|
||||
private void saveFile(File file, File outFile) {
|
||||
if ((file != null) && file.exists()) {
|
||||
BufferedReader fis = null;
|
||||
BufferedWriter fos = null;
|
||||
try {
|
||||
if (!outFile.exists()) {
|
||||
outFile.createNewFile();
|
||||
}
|
||||
BufferedReader fis = new BufferedReader(new InputStreamReader(
|
||||
fis = new BufferedReader(new InputStreamReader(
|
||||
new FileInputStream(file)));
|
||||
BufferedWriter fos = new BufferedWriter(new OutputStreamWriter(
|
||||
fos = new BufferedWriter(new OutputStreamWriter(
|
||||
new FileOutputStream(outFile)));
|
||||
String line = null;
|
||||
try {
|
||||
|
@ -134,19 +138,29 @@ public class MTRSubscriber implements INationalDatasetSubscriber {
|
|||
fos.write(line);
|
||||
fos.newLine();
|
||||
}
|
||||
fos.close();
|
||||
} catch (IOException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Could not read File ", e);
|
||||
"Could not read file: " + file.getName(), e);
|
||||
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Failed to find File ", e);
|
||||
|
||||
} catch (IOException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Could not create output file. ", e);
|
||||
statusHandler.handle(Priority.PROBLEM, "Failed to find file: "
|
||||
+ file.getName(), e);
|
||||
} finally {
|
||||
if (fis != null) {
|
||||
try {
|
||||
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();
|
||||
} catch (IOException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Could not create primary file. ", e);
|
||||
"Could not create primary file: " + primary.getName(),
|
||||
e);
|
||||
}
|
||||
}
|
||||
if (!spi.exists()) {
|
||||
|
@ -171,7 +186,7 @@ public class MTRSubscriber implements INationalDatasetSubscriber {
|
|||
spi.createNewFile();
|
||||
} catch (IOException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Could not create primary file. ", e);
|
||||
"Could not create spi file: " + spi.getName(), e);
|
||||
}
|
||||
}
|
||||
if (goodness.exists()) {
|
|
@ -16,7 +16,8 @@ Require-Bundle: com.raytheon.edex.common,
|
|||
com.raytheon.uf.common.status;bundle-version="1.11.11",
|
||||
com.raytheon.uf.common.dataplugin.radar,
|
||||
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
|
||||
Export-Package: com.raytheon.edex.plugin.radar,
|
||||
com.raytheon.edex.plugin.radar.dao,
|
||||
|
@ -25,5 +26,4 @@ Export-Package: com.raytheon.edex.plugin.radar,
|
|||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Import-Package: com.raytheon.uf.common.comm,
|
||||
com.raytheon.uf.common.dataplugin.text.db,
|
||||
com.raytheon.uf.common.site.ingest,
|
||||
org.apache.commons.logging
|
||||
|
|
|
@ -99,4 +99,25 @@
|
|||
value="com.raytheon.uf.common.dataplugin.radar.request.RadarServerConnectionRequest" />
|
||||
<constructor-arg ref="radarServerConnectionHandler" />
|
||||
</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>
|
||||
|
|
|
@ -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.LocalizationFile;
|
||||
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.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
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.Point;
|
||||
import com.vividsolutions.jts.geom.PrecisionModel;
|
||||
|
@ -43,12 +43,13 @@ import com.vividsolutions.jts.io.WKTReader;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* 10Oct2011 10520 JWork Initial check-in.
|
||||
* 09/11/2012 DR 15366 D. Friedman Set SRID on radar stations.
|
||||
* Mar 06, 2014 2876 mpduff Moved NationalDatasetSubscriber.
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
|
||||
public class Import88DLocationsUtil implements INationalDatasetSubscriber {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(Import88DLocationsUtil.class);
|
||||
|
||||
private static final String SHAPEFILE = "fsl-w88d.shp";
|
||||
|
@ -58,34 +59,30 @@ public class Import88DLocationsUtil implements INationalDatasetSubscriber {
|
|||
|
||||
private static final int WGS84_SRID = 4326;
|
||||
|
||||
// The list of the required file comprising a Shapefile set
|
||||
private ArrayList<String> theRadarShapeFileList = new ArrayList<String>() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
/** The list of the required files comprising a Shapefile set */
|
||||
private static final String[] SHAPE_FILES = new String[] { "fsl-w88d.shp",
|
||||
"fsl-w88d.shx", "fsl-w88d.dbf" };
|
||||
|
||||
{
|
||||
add("fsl-w88d.shp");
|
||||
add("fsl-w88d.shx");
|
||||
add("fsl-w88d.dbf");
|
||||
}
|
||||
};
|
||||
|
||||
// The collection of feature attribute names this code needs from the
|
||||
// shapefile
|
||||
/**
|
||||
* The collection of feature attribute names this code needs from the
|
||||
* shapefile
|
||||
*/
|
||||
private enum databaseColumns {
|
||||
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;
|
||||
|
||||
// The date, in millis, of the file currently being processed.
|
||||
/** The date, in millis, of the file currently being processed. */
|
||||
private long theCurrentFileDateMillis = 0;
|
||||
|
||||
// The list of RDA_ID's from the shapefile used to determine if an ID has
|
||||
// been
|
||||
// removed from the database
|
||||
/**
|
||||
* The list of RDA_ID's from the shapefile used to determine if an ID has
|
||||
* been removed from the database
|
||||
*/
|
||||
private ArrayList<String> theRDAList = null;
|
||||
|
||||
private IPathManager thePathMgr = null;
|
||||
|
@ -140,16 +137,16 @@ public class Import88DLocationsUtil implements INationalDatasetSubscriber {
|
|||
*/
|
||||
private void saveFile(File file, LocalizationFile outFile) {
|
||||
if ((file != null) && file.exists()) {
|
||||
FileInputStream fis = null;
|
||||
FileOutputStream fos = null;
|
||||
try {
|
||||
byte[] fileByteArray = new byte[(int) file.length()];
|
||||
FileInputStream fis = new FileInputStream(file);
|
||||
fis = new FileInputStream(file);
|
||||
fis.read(fileByteArray);
|
||||
|
||||
FileOutputStream fos = new FileOutputStream(outFile.getFile());
|
||||
fos = new FileOutputStream(outFile.getFile());
|
||||
fos.write(fileByteArray);
|
||||
|
||||
fis.close();
|
||||
fos.close();
|
||||
/*
|
||||
* BufferedReader fis = new BufferedReader(new
|
||||
* InputStreamReader( new FileInputStream(file)));
|
||||
|
@ -165,12 +162,29 @@ public class Import88DLocationsUtil implements INationalDatasetSubscriber {
|
|||
} catch (FileNotFoundException e) {
|
||||
if (statusHandler.isPriorityEnabled(Priority.PROBLEM)) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Failed to find File ", e);
|
||||
"Failed to find file: " + file.getName(), e);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
if (statusHandler.isPriorityEnabled(Priority.PROBLEM)) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Could not create output file. ", e);
|
||||
statusHandler.handle(
|
||||
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
|
||||
// threshold has been crossed and are to old to process
|
||||
for (String key : theRadarShapeFileList) {
|
||||
for (String key : SHAPE_FILES) {
|
||||
if (!key.equals(theFileName)) {
|
||||
tempFile = getPathInfoRead(key);
|
||||
timeStampMillis = tempFile.lastModified();
|
||||
|
@ -271,7 +285,7 @@ public class Import88DLocationsUtil implements INationalDatasetSubscriber {
|
|||
for (RadarStation station : aStationList) {
|
||||
radarStationDAO.saveOrUpdate(station);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Kludge for DR 15366: The GeoTools WKBWriter does not store SRIDs so
|
||||
* we must update them manually.
|
||||
|
@ -285,7 +299,7 @@ public class Import88DLocationsUtil implements INationalDatasetSubscriber {
|
|||
statusHandler.handle(Priority.ERROR,
|
||||
"Failed to update the SRIDs in the radar_spatial_table", e);
|
||||
}
|
||||
|
||||
|
||||
if (statusHandler.isPriorityEnabled(Priority.INFO)) {
|
||||
statusHandler
|
||||
.handle(Priority.INFO,
|
||||
|
@ -322,7 +336,8 @@ public class Import88DLocationsUtil implements INationalDatasetSubscriber {
|
|||
String rda_id = null;
|
||||
RadarStation tempStation = 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);
|
||||
for (HashMap<String, String> aHashMap : aDataList) {
|
||||
keySet = aHashMap.keySet();
|
||||
|
|
|
@ -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.MenuTemplateFile;
|
||||
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.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.edex.menus.AbstractMenuUtil;
|
||||
|
||||
import com.raytheon.uf.edex.ndm.ingest.INationalDatasetSubscriber;
|
||||
|
||||
/**
|
||||
* Builds menus using JAXB
|
||||
|
@ -61,7 +60,8 @@ import com.raytheon.uf.edex.menus.AbstractMenuUtil;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 30, 2010 mnash Initial creation
|
||||
* 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>
|
||||
*
|
||||
|
@ -71,11 +71,11 @@ import com.raytheon.uf.edex.menus.AbstractMenuUtil;
|
|||
|
||||
public class RadarMenuUtil extends AbstractMenuUtil implements
|
||||
INationalDatasetSubscriber {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(RadarMenuUtil.class);
|
||||
|
||||
private final int NUM_POSSIBLE_RADARS = 25;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -92,7 +92,7 @@ public class RadarMenuUtil extends AbstractMenuUtil implements
|
|||
RadarsInUseUtil.setParsed(false);
|
||||
List<String> radars = RadarsInUseUtil.getSite(getSite(),
|
||||
RadarsInUseUtil.LOCAL_CONSTANT);
|
||||
;
|
||||
|
||||
String path = "menus" + File.separator + "radar" + File.separator;
|
||||
CommonMenuContributionFile menuContributionFile = new CommonMenuContributionFile();
|
||||
CommonIncludeMenuItem includeMenuItem = null;
|
||||
|
@ -113,9 +113,8 @@ public class RadarMenuUtil extends AbstractMenuUtil implements
|
|||
boolean terminal = TerminalRadarUtils.isTerminalRadar(radars
|
||||
.get(i).toLowerCase());
|
||||
if (terminal) {
|
||||
includeMenuItem.fileName = new File(path
|
||||
+ "dualPol" + File.separator
|
||||
+ "baseTerminalLocalRadarMenu.xml");
|
||||
includeMenuItem.fileName = new File(path + "dualPol"
|
||||
+ File.separator + "baseTerminalLocalRadarMenu.xml");
|
||||
List<Double> elevations = map.get(radars.get(i));
|
||||
vars = new VariableSubstitution[(elevations.size() + 1)
|
||||
+ NUM_POSSIBLE_RADARS + 1];
|
||||
|
@ -141,17 +140,14 @@ public class RadarMenuUtil extends AbstractMenuUtil implements
|
|||
}
|
||||
includeMenuItem.substitutions = vars;
|
||||
} else {
|
||||
if (SsssRadarUtil.isSsssRadar(radars.get(i).toLowerCase())) {
|
||||
String ssssRadar = radars.get(i).toLowerCase();
|
||||
includeMenuItem.fileName = new File(path
|
||||
+ ssssRadar + File.separator
|
||||
+ "baseLocalRadarMenu.xml");
|
||||
}
|
||||
else {
|
||||
includeMenuItem.fileName = new File(path
|
||||
+ "dualPol" + File.separator
|
||||
+ "baseLocalRadarMenu.xml");
|
||||
}
|
||||
if (SsssRadarUtil.isSsssRadar(radars.get(i).toLowerCase())) {
|
||||
String ssssRadar = radars.get(i).toLowerCase();
|
||||
includeMenuItem.fileName = new File(path + ssssRadar
|
||||
+ File.separator + "baseLocalRadarMenu.xml");
|
||||
} else {
|
||||
includeMenuItem.fileName = new File(path + "dualPol"
|
||||
+ File.separator + "baseLocalRadarMenu.xml");
|
||||
}
|
||||
vars = new VariableSubstitution[1];
|
||||
vars[0] = new VariableSubstitution();
|
||||
vars[0].key = "icao";
|
||||
|
@ -189,9 +185,9 @@ public class RadarMenuUtil extends AbstractMenuUtil implements
|
|||
.toLowerCase());
|
||||
if (terminal) {
|
||||
List<Double> elevations = map.get(radars.get(i));
|
||||
includeMenuContribution.fileName = new File(path
|
||||
+ "dualPol" + File.separator
|
||||
+ File.separator + "baseTerminalLocalRadarMenu.xml");
|
||||
includeMenuContribution.fileName = new File(path + "dualPol"
|
||||
+ File.separator + File.separator
|
||||
+ "baseTerminalLocalRadarMenu.xml");
|
||||
vars = new VariableSubstitution[(elevations.size() + 1)
|
||||
+ NUM_POSSIBLE_RADARS + 1];
|
||||
vars[0] = new VariableSubstitution();
|
||||
|
@ -217,17 +213,16 @@ public class RadarMenuUtil extends AbstractMenuUtil implements
|
|||
includeMenuContribution.substitutions = vars;
|
||||
terminal = true;
|
||||
} else {
|
||||
if (SsssRadarUtil.isSsssRadar(radars.get(i).toLowerCase())) {
|
||||
String ssssRadar = radars.get(i).toLowerCase();
|
||||
includeMenuContribution.fileName = new File(path
|
||||
if (SsssRadarUtil.isSsssRadar(radars.get(i).toLowerCase())) {
|
||||
String ssssRadar = radars.get(i).toLowerCase();
|
||||
includeMenuContribution.fileName = new File(path
|
||||
+ ssssRadar + File.separator
|
||||
+ "baseLocalRadarMenu.xml");
|
||||
}
|
||||
else {
|
||||
includeMenuContribution.fileName = new File(path
|
||||
} else {
|
||||
includeMenuContribution.fileName = new File(path
|
||||
+ "dualPol" + File.separator
|
||||
+ "baseLocalRadarMenu.xml");
|
||||
}
|
||||
}
|
||||
vars = new VariableSubstitution[1];
|
||||
vars[0] = new VariableSubstitution();
|
||||
vars[0].key = "icao";
|
||||
|
@ -386,10 +381,12 @@ public class RadarMenuUtil extends AbstractMenuUtil implements
|
|||
|
||||
private void saveFile(File file, File outFile) {
|
||||
if ((file != null) && file.exists()) {
|
||||
BufferedReader fis = null;
|
||||
BufferedWriter fos = null;
|
||||
try {
|
||||
BufferedReader fis = new BufferedReader(new InputStreamReader(
|
||||
fis = new BufferedReader(new InputStreamReader(
|
||||
new FileInputStream(file)));
|
||||
BufferedWriter fos = new BufferedWriter(new OutputStreamWriter(
|
||||
fos = new BufferedWriter(new OutputStreamWriter(
|
||||
new FileOutputStream(outFile)));
|
||||
String line = null;
|
||||
try {
|
||||
|
@ -397,15 +394,29 @@ public class RadarMenuUtil extends AbstractMenuUtil implements
|
|||
fos.write(line);
|
||||
fos.newLine();
|
||||
}
|
||||
fos.close();
|
||||
} catch (IOException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Could not read File ", e);
|
||||
"Could not read file: " + file.getName(), e);
|
||||
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, "Failed to find file ",
|
||||
e);
|
||||
statusHandler.handle(Priority.PROBLEM, "Failed to find file: "
|
||||
+ file.getName(), e);
|
||||
} finally {
|
||||
if (fis != null) {
|
||||
try {
|
||||
fis.close();
|
||||
} catch (IOException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
if (fos != null) {
|
||||
try {
|
||||
fos.close();
|
||||
} catch (IOException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,9 @@ Require-Bundle: com.raytheon.edex.common,
|
|||
com.raytheon.uf.edex.pointdata,
|
||||
org.geotools,
|
||||
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
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Import-Package: com.raytheon.uf.common.dataplugin.sfcobs,
|
||||
|
|
|
@ -22,6 +22,35 @@
|
|||
<constructor-arg ref="sfcobs-camel" />
|
||||
</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"
|
||||
errorHandlerRef="errorHandler" autoStartup="false">
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.site.ingest;
|
||||
package com.raytheon.edex.plugin.sfcobs.ingest;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
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.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.edex.ndm.ingest.INationalDatasetSubscriber;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Buoy NDM subscriber.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -49,6 +50,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 28, 2011 bfarmer Initial creation
|
||||
* Mar 06, 2014 2876 mpduff New NDM plugin.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -57,7 +59,9 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
*/
|
||||
|
||||
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;
|
||||
|
||||
@Override
|
||||
|
@ -77,6 +81,7 @@ public class BuoySubscriber implements INationalDatasetSubscriber {
|
|||
if (null == combineThread) {
|
||||
combineThread = new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Thread.sleep(60 * 1000);
|
||||
|
@ -100,6 +105,7 @@ public class BuoySubscriber implements INationalDatasetSubscriber {
|
|||
if (null == combineThread) {
|
||||
combineThread = new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Thread.sleep(60 * 1000);
|
||||
|
@ -128,8 +134,10 @@ public class BuoySubscriber implements INationalDatasetSubscriber {
|
|||
try {
|
||||
spiFile.createNewFile();
|
||||
} catch (IOException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Could not create primary file. ", e);
|
||||
statusHandler.handle(
|
||||
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) {
|
||||
String line;
|
||||
String[] splitLine;
|
||||
BufferedReader fis = null;
|
||||
BufferedWriter fos = null;
|
||||
try {
|
||||
BufferedReader fis = new BufferedReader(new InputStreamReader(
|
||||
new FileInputStream(file)));
|
||||
fis = new BufferedReader(new InputStreamReader(new FileInputStream(
|
||||
file)));
|
||||
if (!goodnessFile.exists()) {
|
||||
goodnessFile.createNewFile();
|
||||
}
|
||||
BufferedWriter fos = new BufferedWriter(new OutputStreamWriter(
|
||||
fos = new BufferedWriter(new OutputStreamWriter(
|
||||
new FileOutputStream(goodnessFile)));
|
||||
for (line = fis.readLine(); line != null; line = fis.readLine()) {
|
||||
splitLine = line.split("\\|");
|
||||
Integer elevation;
|
||||
Double latitude;
|
||||
Double longitude;
|
||||
String stationName;
|
||||
try {
|
||||
elevation = Integer.parseInt(splitLine[4].trim());
|
||||
} catch (Exception e) {
|
||||
continue;
|
||||
}
|
||||
latitude = Double.parseDouble(splitLine[2].trim());
|
||||
longitude = Double.parseDouble(splitLine[3].trim());
|
||||
stationName = splitLine[1].trim();
|
||||
Double latitude = Double.parseDouble(splitLine[2].trim());
|
||||
Double longitude = Double.parseDouble(splitLine[3].trim());
|
||||
String stationName = splitLine[1].trim();
|
||||
fos.write("0 ");
|
||||
fos.write(stationName);
|
||||
fos.write(String.format(" %8.4f %9.4f %5d %9d", latitude,
|
||||
longitude, elevation, 0));
|
||||
fos.newLine();
|
||||
}
|
||||
fos.close();
|
||||
|
||||
} catch (FileNotFoundException e) {
|
||||
// TODO Auto-generated catch block. Please revise as appropriate.
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Could not read File ", e);
|
||||
|
||||
statusHandler.handle(Priority.PROBLEM, "Could not read file: "
|
||||
+ file.getName(), 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) {
|
||||
if ((file != null) && file.exists()) {
|
||||
BufferedReader fis = null;
|
||||
BufferedWriter fos = null;
|
||||
try {
|
||||
BufferedReader fis = new BufferedReader(new InputStreamReader(
|
||||
fis = new BufferedReader(new InputStreamReader(
|
||||
new FileInputStream(file)));
|
||||
BufferedWriter fos = new BufferedWriter(new OutputStreamWriter(
|
||||
fos = new BufferedWriter(new OutputStreamWriter(
|
||||
new FileOutputStream(outFile)));
|
||||
String line = null;
|
||||
try {
|
||||
|
@ -196,16 +217,29 @@ public class BuoySubscriber implements INationalDatasetSubscriber {
|
|||
fos.write(line);
|
||||
fos.newLine();
|
||||
}
|
||||
fos.close();
|
||||
} catch (IOException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Could not read File ", e);
|
||||
"Could not read file: " + file.getName(), e);
|
||||
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Failed to find File ", e);
|
||||
|
||||
statusHandler.handle(Priority.PROBLEM, "Failed to find file: "
|
||||
+ file.getName(), e);
|
||||
} finally {
|
||||
if (fis != null) {
|
||||
try {
|
||||
fis.close();
|
||||
} catch (IOException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
if (fos != null) {
|
||||
try {
|
||||
fos.close();
|
||||
} catch (IOException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.site.ingest;
|
||||
package com.raytheon.edex.plugin.sfcobs.ingest;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
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.LocalizationType;
|
||||
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.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.edex.database.tasks.SqlStatementTask;
|
||||
import com.raytheon.uf.edex.ndm.ingest.INationalDatasetSubscriber;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Marine information NDM subscriber.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -50,6 +50,7 @@ import com.raytheon.uf.edex.database.tasks.SqlStatementTask;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 11, 2011 bfarmer Initial creation
|
||||
* Mar 06, 2014 2876 mpduff New NDM plugin.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -58,15 +59,9 @@ import com.raytheon.uf.edex.database.tasks.SqlStatementTask;
|
|||
*/
|
||||
|
||||
public class MarineInfoSubscriber implements INationalDatasetSubscriber {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.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 static String DBSCHEMA = "mapdata";
|
||||
|
@ -140,8 +135,9 @@ public class MarineInfoSubscriber implements INationalDatasetSubscriber {
|
|||
|
||||
private void triggerDBReload(File outFile) {
|
||||
if ((outFile != null) && outFile.exists()) {
|
||||
BufferedReader fis = null;
|
||||
try {
|
||||
BufferedReader fis = new BufferedReader(new InputStreamReader(
|
||||
fis = new BufferedReader(new InputStreamReader(
|
||||
new FileInputStream(outFile)));
|
||||
try {
|
||||
SqlStatementTask task = new SqlStatementTask(setupOne,
|
||||
|
@ -204,7 +200,7 @@ public class MarineInfoSubscriber implements INationalDatasetSubscriber {
|
|||
}
|
||||
} catch (IOException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Could not read File ", e);
|
||||
"Could not read file: " + outFile, e);
|
||||
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
|
@ -212,19 +208,29 @@ public class MarineInfoSubscriber implements INationalDatasetSubscriber {
|
|||
+ query.toString(), e);
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, "Failed to find File ",
|
||||
e);
|
||||
statusHandler.handle(Priority.PROBLEM, "Failed to find file: "
|
||||
+ outFile, e);
|
||||
|
||||
} finally {
|
||||
if (fis != null) {
|
||||
try {
|
||||
fis.close();
|
||||
} catch (IOException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void saveFile(File file, File outFile) {
|
||||
if ((file != null) && file.exists()) {
|
||||
BufferedReader fis = null;
|
||||
BufferedWriter fos = null;
|
||||
try {
|
||||
BufferedReader fis = new BufferedReader(new InputStreamReader(
|
||||
fis = new BufferedReader(new InputStreamReader(
|
||||
new FileInputStream(file)));
|
||||
BufferedWriter fos = new BufferedWriter(new OutputStreamWriter(
|
||||
fos = new BufferedWriter(new OutputStreamWriter(
|
||||
new FileOutputStream(outFile)));
|
||||
String line = null;
|
||||
try {
|
||||
|
@ -235,13 +241,27 @@ public class MarineInfoSubscriber implements INationalDatasetSubscriber {
|
|||
fos.close();
|
||||
} catch (IOException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Could not read File ", e);
|
||||
"Could not read file: " + file.getName(), e);
|
||||
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, "Failed to find File ",
|
||||
e);
|
||||
|
||||
statusHandler.handle(Priority.PROBLEM, "Failed to find file: "
|
||||
+ file.getName(), e);
|
||||
} finally {
|
||||
if (fis != null) {
|
||||
try {
|
||||
fis.close();
|
||||
} catch (IOException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
if (fos != null) {
|
||||
try {
|
||||
fos.close();
|
||||
} catch (IOException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -13,7 +13,9 @@ Require-Bundle: com.raytheon.edex.textdb,
|
|||
com.raytheon.uf.edex.decodertools;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.status;bundle-version="1.11.17",
|
||||
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,
|
||||
com.raytheon.edex.plugin.text.dao
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
|
|
|
@ -52,6 +52,35 @@
|
|||
<constructor-arg value="1000" type="java.lang.Integer"/>
|
||||
</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"
|
||||
xmlns="http://camel.apache.org/schema/spring"
|
||||
errorHandlerRef="errorHandler">
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.site.ingest;
|
||||
package com.raytheon.edex.plugin.text.ingest;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
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.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.edex.ndm.ingest.INationalDatasetSubscriber;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* AFOS NDM Subscriber.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -48,6 +49,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 12, 2011 bfarmer Initial creation
|
||||
* Mar 06, 2014 2876 mpduff New NDM plugin.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -56,7 +58,8 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
*/
|
||||
|
||||
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";
|
||||
|
||||
|
@ -112,10 +115,12 @@ public class AfosBrowserModelSubscriber implements INationalDatasetSubscriber {
|
|||
|
||||
private void saveFile(File file, File outFile) {
|
||||
if ((file != null) && file.exists()) {
|
||||
BufferedReader fis = null;
|
||||
BufferedWriter fos = null;
|
||||
try {
|
||||
BufferedReader fis = new BufferedReader(new InputStreamReader(
|
||||
fis = new BufferedReader(new InputStreamReader(
|
||||
new FileInputStream(file)));
|
||||
BufferedWriter fos = new BufferedWriter(new OutputStreamWriter(
|
||||
fos = new BufferedWriter(new OutputStreamWriter(
|
||||
new FileOutputStream(outFile)));
|
||||
String line = null;
|
||||
try {
|
||||
|
@ -123,18 +128,30 @@ public class AfosBrowserModelSubscriber implements INationalDatasetSubscriber {
|
|||
fos.write(line);
|
||||
fos.newLine();
|
||||
}
|
||||
fos.close();
|
||||
} catch (IOException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Could not read File ", e);
|
||||
"Could not read file: " + file.getName(), e);
|
||||
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Failed to find File ", e);
|
||||
|
||||
statusHandler.handle(Priority.PROBLEM, "Failed to find File: "
|
||||
+ file.getName(), e);
|
||||
} finally {
|
||||
if (fis != null) {
|
||||
try {
|
||||
fis.close();
|
||||
} catch (IOException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
if (fos != null) {
|
||||
try {
|
||||
fos.close();
|
||||
} catch (IOException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -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.db.AfosToAwips;
|
||||
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.UFStatus;
|
||||
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>
|
||||
*
|
||||
|
@ -49,6 +50,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 11, 2011 bfarmer Initial creation
|
||||
* Mar 06, 2014 2876 mpduff New NDM plugin.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -57,7 +59,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
*/
|
||||
|
||||
public class AfosToAwipsListener implements INationalDatasetSubscriber {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(AfosToAwipsListener.class);
|
||||
|
||||
/*
|
||||
|
@ -93,6 +95,14 @@ public class AfosToAwipsListener implements INationalDatasetSubscriber {
|
|||
"Could not read ingested afos2awips file:"
|
||||
+ file.getAbsolutePath(), e);
|
||||
return;
|
||||
} finally {
|
||||
if (fis != null) {
|
||||
try {
|
||||
fis.close();
|
||||
} catch (IOException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
statusHandler.handle(
|
||||
|
@ -100,15 +110,6 @@ public class AfosToAwipsListener implements INationalDatasetSubscriber {
|
|||
"Could not read ingested afos2awips file:"
|
||||
+ file.getAbsolutePath(), e);
|
||||
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();
|
||||
AfosWmoIdDataContainer allRecords = afosDao.getAllRecords();
|
||||
|
|
|
@ -12,7 +12,8 @@ Require-Bundle: com.raytheon.edex.common,
|
|||
javax.persistence,
|
||||
com.raytheon.uf.common.dataplugin.text,
|
||||
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,
|
||||
com.raytheon.edex.textdb.dao,
|
||||
com.raytheon.edex.textdb.dbapi.impl,
|
||||
|
|
|
@ -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>
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.site.ingest;
|
||||
package com.raytheon.edex.textdb.ingest;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
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.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.edex.ndm.ingest.INationalDatasetSubscriber;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Site Map NDM subscriber.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -48,7 +49,8 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
*
|
||||
* 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>
|
||||
*
|
||||
|
@ -58,7 +60,9 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
|
||||
public class SiteMapNationalDatasetSubscriber implements
|
||||
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 NATIONAL_CATEGORY_TABLE_FILENAME = "textdb/national_category_table.template";
|
||||
|
@ -91,10 +95,12 @@ public class SiteMapNationalDatasetSubscriber implements
|
|||
|
||||
private void saveFile(File file, File outFile) {
|
||||
if ((file != null) && file.exists()) {
|
||||
BufferedReader fis = null;
|
||||
BufferedWriter fos = null;
|
||||
try {
|
||||
BufferedReader fis = new BufferedReader(new InputStreamReader(
|
||||
fis = new BufferedReader(new InputStreamReader(
|
||||
new FileInputStream(file)));
|
||||
BufferedWriter fos = new BufferedWriter(new OutputStreamWriter(
|
||||
fos = new BufferedWriter(new OutputStreamWriter(
|
||||
new FileOutputStream(outFile)));
|
||||
String line = null;
|
||||
try {
|
||||
|
@ -102,18 +108,29 @@ public class SiteMapNationalDatasetSubscriber implements
|
|||
fos.write(line);
|
||||
fos.newLine();
|
||||
}
|
||||
fos.close();
|
||||
} catch (IOException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Could not read AFOS Lookup File "
|
||||
+ AFOS_LOOKUP_FILENAME, e);
|
||||
"Could not read file: " + file.getName(), e);
|
||||
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Failed to find AFOS Lookup File "
|
||||
+ AFOS_LOOKUP_FILENAME, e);
|
||||
|
||||
statusHandler.handle(Priority.PROBLEM, "Failed to find file: "
|
||||
+ file.getName(), e);
|
||||
} finally {
|
||||
if (fis != null) {
|
||||
try {
|
||||
fis.close();
|
||||
} catch (IOException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
if (fos != null) {
|
||||
try {
|
||||
fos.close();
|
||||
} catch (IOException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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.LocalizationType;
|
||||
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.UFStatus;
|
||||
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>
|
||||
*
|
||||
|
@ -51,6 +51,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 25, 2011 bfarmer Initial creation
|
||||
* Oct 18, 2011 10909 rferrel notify() now saves a file.
|
||||
* Mar 06, 2014 2876 mpduff New NDM plugin.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -59,7 +60,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
*/
|
||||
|
||||
public class TextDBStaticDataSubscriber implements INationalDatasetSubscriber {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(TextDBStaticDataSubscriber.class);
|
||||
|
||||
@Override
|
||||
|
@ -75,10 +76,12 @@ public class TextDBStaticDataSubscriber implements INationalDatasetSubscriber {
|
|||
|
||||
private void saveFile(File file, File outFile) {
|
||||
if ((file != null) && file.exists()) {
|
||||
BufferedReader fis = null;
|
||||
BufferedWriter fos = null;
|
||||
try {
|
||||
BufferedReader fis = new BufferedReader(new InputStreamReader(
|
||||
fis = new BufferedReader(new InputStreamReader(
|
||||
new FileInputStream(file)));
|
||||
BufferedWriter fos = new BufferedWriter(new OutputStreamWriter(
|
||||
fos = new BufferedWriter(new OutputStreamWriter(
|
||||
new FileOutputStream(outFile)));
|
||||
String line = null;
|
||||
try {
|
||||
|
@ -86,19 +89,30 @@ public class TextDBStaticDataSubscriber implements INationalDatasetSubscriber {
|
|||
fos.write(line);
|
||||
fos.newLine();
|
||||
}
|
||||
fos.close();
|
||||
} catch (IOException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Could not read File ", e);
|
||||
|
||||
"Could not read file: " + file.getName(), e);
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, "Failed to find File ",
|
||||
e);
|
||||
|
||||
statusHandler.handle(Priority.PROBLEM, "Failed to find file: "
|
||||
+ 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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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.pointdata;bundle-version="1.12.1174"
|
||||
Export-Package: com.raytheon.uf.common.site,
|
||||
com.raytheon.uf.common.site.ingest,
|
||||
com.raytheon.uf.common.site.notify,
|
||||
com.raytheon.uf.common.site.requests,
|
||||
com.raytheon.uf.common.site.xml
|
||||
|
|
|
@ -111,4 +111,10 @@
|
|||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="com.raytheon.uf.edex.ndm"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
</feature>
|
||||
|
|
|
@ -10,7 +10,9 @@ Require-Bundle: com.raytheon.edex.common;bundle-version="1.11.1",
|
|||
com.raytheon.uf.common.pointdata,
|
||||
javax.measure;bundle-version="1.0.0",
|
||||
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,
|
||||
com.raytheon.uf.edex.decodertools.bufr,
|
||||
com.raytheon.uf.edex.decodertools.bufr.descriptors,
|
||||
|
|
|
@ -31,16 +31,30 @@ import java.text.DecimalFormat;
|
|||
import java.util.HashMap;
|
||||
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 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
|
||||
*
|
||||
*/
|
||||
public class AWIPSCommonObsSQLGenerator implements INationalDatasetSubscriber {
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(AWIPSCommonObsSQLGenerator.class);
|
||||
|
||||
private static final String FILE_NAME_PREFIX = "common_obs_spatial_";
|
||||
|
||||
|
@ -135,68 +149,70 @@ public class AWIPSCommonObsSQLGenerator implements INationalDatasetSubscriber {
|
|||
|
||||
FileWriter fstream = 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) {
|
||||
fstream = new FileWriter(path + FILE_NAME_PREFIX + (fileCount)
|
||||
+ FILE_NAME_SUFFIX);
|
||||
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();
|
||||
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) {
|
||||
bw = new BufferedWriter(fstream);
|
||||
}
|
||||
|
||||
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) {
|
||||
} finally {
|
||||
if (bw != null) {
|
||||
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) {
|
||||
bw.close();
|
||||
}
|
||||
if (fstream != null) {
|
||||
fstream.close();
|
||||
if (fstream != null) {
|
||||
fstream.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -210,25 +226,47 @@ public class AWIPSCommonObsSQLGenerator implements INationalDatasetSubscriber {
|
|||
* @param 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 {
|
||||
FileInputStream fis = new FileInputStream(filename);
|
||||
DataInputStream dis = new DataInputStream(fis);
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(dis));
|
||||
fis = new FileInputStream(filename);
|
||||
dis = new DataInputStream(fis);
|
||||
br = new BufferedReader(new InputStreamReader(dis));
|
||||
String strLine;
|
||||
while ((strLine = br.readLine()) != null) {
|
||||
if (!strLine.startsWith(SKIP)) {
|
||||
String[] readLine = strLine.split(DELIMITER);
|
||||
SpatialLine line = new SpatialLine(readLine);
|
||||
stationMap.put(line.getGid(), line);
|
||||
System.out.println(strLine);
|
||||
read++;
|
||||
}
|
||||
}
|
||||
} 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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,4 +25,5 @@ Require-Bundle: org.jep;bundle-version="1.0.0",
|
|||
org.springframework;bundle-version="2.5.6",
|
||||
com.raytheon.uf.edex.database,
|
||||
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"
|
||||
|
|
|
@ -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>
|
|
@ -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.LocalizationType;
|
||||
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.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.edex.ndm.ingest.INationalDatasetSubscriber;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Dissemination NDM subscriber.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -50,6 +50,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 13, 2011 bfarmer Initial creation
|
||||
* Mar 06, 2014 2876 mpduff New NDM plugin.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -59,7 +60,8 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
|
||||
public class DisseminationNationalDatasetSubscriber implements
|
||||
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";
|
||||
|
||||
|
@ -84,7 +86,8 @@ public class DisseminationNationalDatasetSubscriber implements
|
|||
try {
|
||||
backupFile.createNewFile();
|
||||
} 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(file, outFile);
|
||||
|
@ -93,10 +96,12 @@ public class DisseminationNationalDatasetSubscriber implements
|
|||
|
||||
private void saveFile(File file, File outFile) {
|
||||
if ((file != null) && file.exists()) {
|
||||
BufferedReader fis = null;
|
||||
BufferedWriter fos = null;
|
||||
try {
|
||||
BufferedReader fis = new BufferedReader(new InputStreamReader(
|
||||
fis = new BufferedReader(new InputStreamReader(
|
||||
new FileInputStream(file)));
|
||||
BufferedWriter fos = new BufferedWriter(new OutputStreamWriter(
|
||||
fos = new BufferedWriter(new OutputStreamWriter(
|
||||
new FileOutputStream(outFile)));
|
||||
String line = null;
|
||||
try {
|
||||
|
@ -104,19 +109,30 @@ public class DisseminationNationalDatasetSubscriber implements
|
|||
fos.write(line);
|
||||
fos.newLine();
|
||||
}
|
||||
fos.close();
|
||||
} catch (IOException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Could not read File " + AWIPS_PRIORITIES_FILENAME,
|
||||
e);
|
||||
"Could not read file: " + file.getName(), e);
|
||||
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Failed to find File " + AWIPS_PRIORITIES_FILENAME, e);
|
||||
|
||||
statusHandler.handle(Priority.PROBLEM, "Failed to find file: "
|
||||
+ file.getName(), e);
|
||||
} finally {
|
||||
if (fis != null) {
|
||||
try {
|
||||
fis.close();
|
||||
} catch (IOException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
if (fos != null) {
|
||||
try {
|
||||
fos.close();
|
||||
} catch (IOException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
7
edexOsgi/com.raytheon.uf.edex.ndm/.classpath
Normal file
7
edexOsgi/com.raytheon.uf.edex.ndm/.classpath
Normal 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>
|
28
edexOsgi/com.raytheon.uf.edex.ndm/.project
Normal file
28
edexOsgi/com.raytheon.uf.edex.ndm/.project
Normal 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>
|
|
@ -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
|
16
edexOsgi/com.raytheon.uf.edex.ndm/META-INF/MANIFEST.MF
Normal file
16
edexOsgi/com.raytheon.uf.edex.ndm/META-INF/MANIFEST.MF
Normal 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
|
5
edexOsgi/com.raytheon.uf.edex.ndm/build.properties
Normal file
5
edexOsgi/com.raytheon.uf.edex.ndm/build.properties
Normal file
|
@ -0,0 +1,5 @@
|
|||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
res/
|
26
edexOsgi/com.raytheon.uf.edex.ndm/res/spring/ndm-ingest.xml
Normal file
26
edexOsgi/com.raytheon.uf.edex.ndm/res/spring/ndm-ingest.xml
Normal 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&delay=5000&maxMessagesPerPoll=1000&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>
|
|
@ -17,44 +17,48 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* 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>
|
||||
*
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 22, 2011 jkorman Initial creation
|
||||
*
|
||||
* Mar 06, 2014 2876 mpduff New NDM plugin.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @author jkorman
|
||||
* @version 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public interface IDataSetIngester {
|
||||
|
||||
/**
|
||||
* Register a filename to be processed and the subscription listener that will process
|
||||
* the file.
|
||||
* @param filename
|
||||
* Register a filename to be processed and the subscription listener that
|
||||
* will process the file.
|
||||
*
|
||||
* @param filename
|
||||
* @param listener
|
||||
* @return
|
||||
*/
|
||||
INationalDatasetSubscriber registerListener(String filename, INationalDatasetSubscriber listener);
|
||||
INationalDatasetSubscriber registerListener(String filename,
|
||||
INationalDatasetSubscriber listener);
|
||||
|
||||
/**
|
||||
* Remove a subscription listener for a given file.
|
||||
* @param filename
|
||||
*
|
||||
* @param filename
|
||||
* @param listener
|
||||
* @return
|
||||
*/
|
||||
INationalDatasetSubscriber removeListener(String filename, INationalDatasetSubscriber listener);
|
||||
|
||||
INationalDatasetSubscriber removeListener(String filename,
|
||||
INationalDatasetSubscriber listener);
|
||||
|
||||
}
|
|
@ -17,12 +17,12 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.site.ingest;
|
||||
package com.raytheon.uf.edex.ndm.ingest;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* National Dataset Subscriber Interface.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -30,7 +30,8 @@ import java.io.File;
|
|||
*
|
||||
* 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>
|
||||
*
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.site.ingest;
|
||||
package com.raytheon.uf.edex.ndm.ingest;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
|
@ -25,14 +25,13 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
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.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.edex.core.EdexException;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* National Dataset Maintenance ingester.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -44,6 +43,7 @@ import com.raytheon.uf.edex.core.EdexException;
|
|||
* Aug 11,2011 9965 rferrel Added logging to processEvent
|
||||
* Aug 24,2011 10775 rferrel Fixed error in processEvent and added
|
||||
* check on statusHandler messages.
|
||||
* Mar 06, 2014 2876 mpduff New NDM plugin.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -53,15 +53,17 @@ import com.raytheon.uf.edex.core.EdexException;
|
|||
|
||||
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
|
||||
* the file.
|
||||
* @param filename
|
||||
* Register a filename to be processed and the subscription listener that
|
||||
* will process the file.
|
||||
*
|
||||
* @param filename
|
||||
* @param listener
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public INationalDatasetSubscriber registerListener(String filename,
|
||||
INationalDatasetSubscriber listener) {
|
||||
if (listeners.get(filename) == null) {
|
||||
|
@ -74,22 +76,23 @@ public class NationalDatasetIngester implements IDataSetIngester {
|
|||
|
||||
/**
|
||||
* Remove a subscription listener for a given file.
|
||||
* @param filename
|
||||
*
|
||||
* @param filename
|
||||
* @param listener
|
||||
* @return Returns the listener reference that was removed, otherwise a
|
||||
* null reference is returned.
|
||||
* @return Returns the listener reference that was removed, otherwise a null
|
||||
* reference is returned.
|
||||
*/
|
||||
@Override
|
||||
public INationalDatasetSubscriber removeListener(String filename,
|
||||
INationalDatasetSubscriber listener) {
|
||||
|
||||
INationalDatasetSubscriber storedListener = null;
|
||||
if(filename != null) {
|
||||
if(listeners.containsKey(filename)) {
|
||||
if (filename != null) {
|
||||
if (listeners.containsKey(filename)) {
|
||||
List<INationalDatasetSubscriber> list = listeners.get(filename);
|
||||
for(int i = 0;i < list.size();i++) {
|
||||
|
||||
if(list.get(i).equals(listener)) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
|
||||
if (list.get(i).equals(listener)) {
|
||||
storedListener = list.get(i);
|
||||
list.remove(i);
|
||||
break;
|
||||
|
@ -99,7 +102,7 @@ public class NationalDatasetIngester implements IDataSetIngester {
|
|||
}
|
||||
return storedListener;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -145,6 +148,4 @@ public class NationalDatasetIngester implements IDataSetIngester {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -15,5 +15,6 @@ Require-Bundle: com.raytheon.edex.common,
|
|||
com.raytheon.uf.edex.decodertools;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.site;bundle-version="1.12.1174",
|
||||
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
|
||||
|
|
|
@ -29,12 +29,12 @@ import org.apache.commons.logging.Log;
|
|||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
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.MonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.config.SSMonitorConfigurationManager;
|
||||
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.TableHandler;
|
||||
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.SynopticLandTableHandler;
|
||||
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>
|
||||
*
|
||||
|
@ -58,7 +55,8 @@ import com.raytheon.uf.edex.site.ingest.IDataSetIngester;
|
|||
*
|
||||
* 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>
|
||||
*
|
||||
|
@ -74,7 +72,7 @@ public class LocationTablesIngest implements INationalDatasetSubscriber {
|
|||
|
||||
private IDataSetIngester ingester = null;
|
||||
|
||||
private Log logger = LogFactory.getLog(getClass());
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private LocationTablesIngest() {
|
||||
|
@ -130,7 +128,9 @@ public class LocationTablesIngest implements INationalDatasetSubscriber {
|
|||
try {
|
||||
monitor.readConfigXml(currentSite);
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
errorHandlerRef="errorHandler" autoStartup="false">
|
||||
<endpoint id="manualFileEndpoint"
|
||||
uri="file:${edex.home}/data/manual?delete=true&delay=5000&maxMessagesPerPoll=1000&exclusiveReadLockStrategy=#fileChangedStrategy&recursive=true" />
|
||||
<endpoint id="ndmFileEndpoint"
|
||||
uri="file:${edex.home}/data/ndm?delete=true&delay=5000&maxMessagesPerPoll=1000&exclusiveReadLockStrategy=#ndmFileChangedStrategy" />
|
||||
|
||||
<route id="manualFileScan">
|
||||
<from ref="manualFileEndpoint" />
|
||||
|
@ -18,167 +16,10 @@
|
|||
<bean ref="manualProc" />
|
||||
<to uri="jms-durable:queue:external.dropbox"/>
|
||||
</route>
|
||||
|
||||
<route id="ndmFileScan">
|
||||
<from ref="ndmFileEndpoint" />
|
||||
<bean ref="ndmProc" method="processEvent" />
|
||||
</route>
|
||||
</camelContext>
|
||||
|
||||
<bean factory-bean="clusteredCamelContextMgr"
|
||||
factory-method="register">
|
||||
<constructor-arg ref="clusteredManualProc" />
|
||||
</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>
|
||||
|
|
|
@ -7,7 +7,7 @@ Bundle-Vendor: RAYTHEON
|
|||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
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.pointdata,
|
||||
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.serialization,
|
||||
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,
|
||||
com.raytheon.edex.plugin
|
||||
Export-Package: com.raytheon.uf.edex.plugin.modelsounding,
|
||||
|
|
|
@ -30,6 +30,21 @@
|
|||
<constructor-arg ref="modelsounding-camel"/>
|
||||
</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"
|
||||
xmlns="http://camel.apache.org/schema/spring"
|
||||
errorHandlerRef="errorHandler"
|
||||
|
|
|
@ -22,10 +22,14 @@ package com.raytheon.uf.edex.plugin.modelsounding.ingest;
|
|||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
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.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.PathManagerFactory;
|
||||
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.UFStatus;
|
||||
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;
|
||||
|
||||
/**
|
||||
|
@ -51,6 +55,7 @@ import com.raytheon.uf.edex.plugin.modelsounding.decoder.ModelSoundingDataAdapte
|
|||
* ------------- -------- ----------- --------------------------
|
||||
* Jan 29, 2011 bfarmer Initial creation
|
||||
* Dec 02, 2013 2537 bsteffen Ensure streams are closed.
|
||||
* Mar 06, 2014 2876 mpduff New NDM plugin.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -61,26 +66,26 @@ import com.raytheon.uf.edex.plugin.modelsounding.decoder.ModelSoundingDataAdapte
|
|||
public class ModelBufrSubscriber implements INationalDatasetSubscriber {
|
||||
|
||||
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_GOODNESS = "modelBufr.goodness";
|
||||
|
||||
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(ModelBufrSubscriber.class);
|
||||
|
||||
@Override
|
||||
public void notify(String fileName, File file) {
|
||||
|
||||
|
||||
statusHandler.handle(Priority.EVENTA,
|
||||
"modelBufr:Processing input file [" + fileName + "]");
|
||||
|
||||
|
||||
if ("modelBufr.spi".equals(fileName)) {
|
||||
IPathManager pathMgr = PathManagerFactory.getPathManager();
|
||||
LocalizationContext lc = pathMgr.getContext(
|
||||
LocalizationType.COMMON_STATIC, LocalizationLevel.SITE);
|
||||
File outFile = pathMgr.getFile(lc, ModelSoundingDataAdapter.SPI_FILE);
|
||||
File outFile = pathMgr.getFile(lc,
|
||||
ModelSoundingDataAdapter.SPI_FILE);
|
||||
saveFile(file, outFile);
|
||||
ModelSoundingDataAdapter.updateSPIData();
|
||||
} else if (MODEL_STATION_LIST.equals(fileName)) {
|
||||
|
@ -92,13 +97,16 @@ public class ModelBufrSubscriber implements INationalDatasetSubscriber {
|
|||
saveFile(file, outFile);
|
||||
generateSPI(file, goodnessFile);
|
||||
|
||||
File spiFile = pathMgr.getFile(lc, ModelSoundingDataAdapter.SPI_FILE);
|
||||
File spiFile = pathMgr.getFile(lc,
|
||||
ModelSoundingDataAdapter.SPI_FILE);
|
||||
if (!spiFile.exists()) {
|
||||
try {
|
||||
spiFile.createNewFile();
|
||||
} catch (IOException e) {
|
||||
statusHandler.handle(Priority.SIGNIFICANT,
|
||||
"modelBufr:Could not create primary file. ", e);
|
||||
statusHandler.handle(
|
||||
Priority.SIGNIFICANT,
|
||||
"modelBufr:Could not create spi file: "
|
||||
+ spiFile.getName(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -116,13 +124,15 @@ public class ModelBufrSubscriber implements INationalDatasetSubscriber {
|
|||
saveFile(file, outFile);
|
||||
generateSPI(file, goodnessFile);
|
||||
|
||||
File spiFile = pathMgr.getFile(lc, ModelSoundingDataAdapter.SPI_FILE);
|
||||
File spiFile = pathMgr.getFile(lc,
|
||||
ModelSoundingDataAdapter.SPI_FILE);
|
||||
if (!spiFile.exists()) {
|
||||
try {
|
||||
spiFile.createNewFile();
|
||||
} catch (IOException e) {
|
||||
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);
|
||||
// updateStationList will reload spi files also
|
||||
ModelSoundingDataAdapter.update();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,17 +155,17 @@ public class ModelBufrSubscriber implements INationalDatasetSubscriber {
|
|||
String[] splitLine;
|
||||
try {
|
||||
BufferedReader fis = null;
|
||||
// if (!goodnessFile.exists()) {
|
||||
// goodnessFile.createNewFile();
|
||||
// }
|
||||
// if (!goodnessFile.exists()) {
|
||||
// goodnessFile.createNewFile();
|
||||
// }
|
||||
BufferedWriter fos = null;
|
||||
try {
|
||||
fis = new BufferedReader(new FileReader(file));
|
||||
fos = new BufferedWriter(new FileWriter(goodnessFile));
|
||||
while ((line = fis.readLine()) != null) {
|
||||
if(line.length() > 0) {
|
||||
if (line.length() > 0) {
|
||||
// check for commented lines
|
||||
if('#' != line.charAt(0)) {
|
||||
if ('#' != line.charAt(0)) {
|
||||
try {
|
||||
splitLine = line.split("\\|");
|
||||
Integer elevation;
|
||||
|
@ -163,27 +173,34 @@ public class ModelBufrSubscriber implements INationalDatasetSubscriber {
|
|||
Double longitude;
|
||||
String cause = "elevation";
|
||||
try {
|
||||
elevation = Integer.parseInt(splitLine[4].trim());
|
||||
elevation = Integer.parseInt(splitLine[4]
|
||||
.trim());
|
||||
cause = "latitude";
|
||||
latitude = Double.parseDouble(splitLine[2].trim());
|
||||
latitude = Double.parseDouble(splitLine[2]
|
||||
.trim());
|
||||
cause = "longitude";
|
||||
longitude = Double.parseDouble(splitLine[3].trim());
|
||||
longitude = Double.parseDouble(splitLine[3]
|
||||
.trim());
|
||||
} catch (NumberFormatException nfe) {
|
||||
String err = String.format("modelBufr:Invalid %s in data line [%s]", cause, line);
|
||||
statusHandler.handle(Priority.PROBLEM,err);
|
||||
String err = String
|
||||
.format("modelBufr:Invalid %s in data line [%s]",
|
||||
cause, line);
|
||||
statusHandler.handle(Priority.PROBLEM, err);
|
||||
continue;
|
||||
}
|
||||
String stationName = splitLine[1].trim();
|
||||
fos.write("0 ");
|
||||
fos.write(stationName);
|
||||
fos.write(String.format(" %8.4f %9.4f %5d %9d", latitude,
|
||||
longitude, elevation, 0));
|
||||
fos.write(String.format(" %8.4f %9.4f %5d %9d",
|
||||
latitude, longitude, elevation, 0));
|
||||
fos.newLine();
|
||||
} catch (Exception e) {
|
||||
String err = String.format("modelBufr:Error in data line [%s]", line);
|
||||
statusHandler.handle(Priority.PROBLEM,err,e);
|
||||
String err = String.format(
|
||||
"modelBufr:Error in data line [%s]",
|
||||
line);
|
||||
statusHandler.handle(Priority.PROBLEM, err, e);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -198,21 +215,22 @@ public class ModelBufrSubscriber implements INationalDatasetSubscriber {
|
|||
+ file.getName() + "]");
|
||||
}
|
||||
}
|
||||
if(fos != null) {
|
||||
if (fos != null) {
|
||||
try {
|
||||
fos.close();
|
||||
} catch (IOException ioe) {
|
||||
statusHandler.handle(Priority.SIGNIFICANT,
|
||||
"modelBufr:Error closing output file [" + goodnessFile.getName() + "]");
|
||||
"modelBufr:Error closing output file ["
|
||||
+ goodnessFile.getName() + "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
} 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
|
||||
|
@ -223,28 +241,37 @@ public class ModelBufrSubscriber implements INationalDatasetSubscriber {
|
|||
BufferedReader fis = null;
|
||||
BufferedWriter fos = null;
|
||||
try {
|
||||
fis = new BufferedReader(new FileReader(file));
|
||||
fos = new BufferedWriter(new FileWriter(outFile));
|
||||
fis = new BufferedReader(new InputStreamReader(
|
||||
new FileInputStream(file)));
|
||||
fos = new BufferedWriter(new OutputStreamWriter(
|
||||
new FileOutputStream(outFile)));
|
||||
String line = null;
|
||||
while ((line = fis.readLine()) != null) {
|
||||
fos.write(line);
|
||||
fos.newLine();
|
||||
try {
|
||||
while ((line = fis.readLine()) != null) {
|
||||
fos.write(line);
|
||||
fos.newLine();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Could not read file: " + file.getName(), e);
|
||||
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
statusHandler.handle(Priority.SIGNIFICANT, "modelBufr:Failed to find File ",
|
||||
e);
|
||||
} catch (IOException e) {
|
||||
statusHandler.handle(Priority.SIGNIFICANT, "modelBufr:Error reading File ",
|
||||
e);
|
||||
statusHandler.handle(Priority.PROBLEM, "Failed to find file: "
|
||||
+ file.getName(), e);
|
||||
} finally {
|
||||
if (fis != null) {
|
||||
try {
|
||||
fis.close();
|
||||
} catch (IOException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
if (fos != null) {
|
||||
try {
|
||||
fos.close();
|
||||
} catch (IOException e) {
|
||||
statusHandler.handle(
|
||||
Priority.SIGNIFICANT,
|
||||
"Error closing output file ["
|
||||
+ outFile.getName() + "]");
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.serialization.comm;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-ActivationPolicy: lazy
|
||||
Export-Package: com.raytheon.uf.edex.site,
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<license url="http://www.example.com/license">
|
||||
[Enter License Description here.]
|
||||
</license>
|
||||
|
||||
|
||||
<requires>
|
||||
<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"/>
|
||||
|
|
Loading…
Add table
Reference in a new issue