From 7bb9ada00d43118d1c0cbc4c403376315ced84c2 Mon Sep 17 00:00:00 2001 From: Mike Duff Date: Thu, 6 Mar 2014 10:26:48 -0600 Subject: [PATCH] Issue #2876 - Pluginize NDM review comments Change-Id: I9911c531a0e2ac735df949cc3f9aa72dc192483d Former-commit-id: 944fca16b8b7748217e97eb7d7fe36b46636d356 [formerly 2f1aa28a4389c15e20724ebc8d79501c338f565e] Former-commit-id: c388cb839bcd782b3aee4d0eb749c04a9f673728 --- .../META-INF/MANIFEST.MF | 3 +- .../res/spring/bufrua-ingest.xml | 15 ++ .../plugin/bufrua}/ingest/RAOBSubscriber.java | 47 +++-- .../META-INF/MANIFEST.MF | 4 +- .../res/spring/obs-ingest.xml | 15 ++ .../plugin/obs}/ingest/MTRSubscriber.java | 51 ++++-- .../META-INF/MANIFEST.MF | 4 +- .../res/spring/radar-ingest.xml | 21 +++ .../radar/util/Import88DLocationsUtil.java | 77 ++++---- .../edex/plugin/radar/util/RadarMenuUtil.java | 83 +++++---- .../META-INF/MANIFEST.MF | 4 +- .../res/spring/sfcobs-ingest.xml | 29 +++ .../plugin/sfcobs}/ingest/BuoySubscriber.java | 90 +++++++--- .../sfcobs}/ingest/MarineInfoSubscriber.java | 60 ++++--- .../META-INF/MANIFEST.MF | 4 +- .../res/spring/text-ingest.xml | 29 +++ .../ingest/AfosBrowserModelSubscriber.java | 39 ++-- .../text/ingest/AfosToAwipsListener.java | 25 +-- .../META-INF/MANIFEST.MF | 3 +- .../res/spring/textdb-ingest.xml | 41 +++++ .../SiteMapNationalDatasetSubscriber.java | 43 +++-- .../ingest/TextDBStaticDataSubscriber.java | 38 ++-- .../META-INF/MANIFEST.MF | 1 - .../feature.xml | 6 + .../META-INF/MANIFEST.MF | 4 +- .../sql/AWIPSCommonObsSQLGenerator.java | 168 +++++++++++------- .../META-INF/MANIFEST.MF | 3 +- .../res/spring/dissemination-ingest.xml | 12 ++ ...isseminationNationalDatasetSubscriber.java | 42 +++-- edexOsgi/com.raytheon.uf.edex.ndm/.classpath | 7 + edexOsgi/com.raytheon.uf.edex.ndm/.project | 28 +++ .../.settings/org.eclipse.jdt.core.prefs | 7 + .../META-INF/MANIFEST.MF | 16 ++ .../com.raytheon.uf.edex.ndm/build.properties | 5 + .../res/spring/ndm-ingest.xml | 26 +++ .../uf/edex/ndm}/ingest/IDataSetIngester.java | 34 ++-- .../ingest/INationalDatasetSubscriber.java | 7 +- .../ndm}/ingest/NationalDatasetIngester.java | 37 ++-- .../META-INF/MANIFEST.MF | 3 +- .../ingest/LocationTablesIngest.java | 18 +- .../res/spring/manualIngest-spring.xml | 159 ----------------- .../META-INF/MANIFEST.MF | 5 +- .../res/spring/modelsounding-ingest.xml | 15 ++ .../ingest/ModelBufrSubscriber.java | 125 ++++++++----- .../META-INF/MANIFEST.MF | 3 +- .../feature.xml | 2 +- 46 files changed, 919 insertions(+), 539 deletions(-) rename edexOsgi/{com.raytheon.uf.common.site/src/com/raytheon/uf/common/site => com.raytheon.edex.plugin.bufrua/src/com/raytheon/edex/plugin/bufrua}/ingest/RAOBSubscriber.java (80%) rename edexOsgi/{com.raytheon.uf.common.site/src/com/raytheon/uf/common/site => com.raytheon.edex.plugin.obs/src/com/raytheon/edex/plugin/obs}/ingest/MTRSubscriber.java (81%) rename edexOsgi/{com.raytheon.uf.common.site/src/com/raytheon/uf/common/site => com.raytheon.edex.plugin.sfcobs/src/com/raytheon/edex/plugin/sfcobs}/ingest/BuoySubscriber.java (77%) rename edexOsgi/{com.raytheon.uf.edex.site/src/com/raytheon/uf/edex/site => com.raytheon.edex.plugin.sfcobs/src/com/raytheon/edex/plugin/sfcobs}/ingest/MarineInfoSubscriber.java (87%) rename edexOsgi/{com.raytheon.uf.common.site/src/com/raytheon/uf/common/site => com.raytheon.edex.plugin.text/src/com/raytheon/edex/plugin/text}/ingest/AfosBrowserModelSubscriber.java (80%) create mode 100644 edexOsgi/com.raytheon.edex.textdb/res/spring/textdb-ingest.xml rename edexOsgi/{com.raytheon.uf.common.site/src/com/raytheon/uf/common/site => com.raytheon.edex.textdb/src/com/raytheon/edex/textdb}/ingest/SiteMapNationalDatasetSubscriber.java (76%) create mode 100644 edexOsgi/com.raytheon.uf.edex.dissemination/res/spring/dissemination-ingest.xml create mode 100644 edexOsgi/com.raytheon.uf.edex.ndm/.classpath create mode 100644 edexOsgi/com.raytheon.uf.edex.ndm/.project create mode 100644 edexOsgi/com.raytheon.uf.edex.ndm/.settings/org.eclipse.jdt.core.prefs create mode 100644 edexOsgi/com.raytheon.uf.edex.ndm/META-INF/MANIFEST.MF create mode 100644 edexOsgi/com.raytheon.uf.edex.ndm/build.properties create mode 100644 edexOsgi/com.raytheon.uf.edex.ndm/res/spring/ndm-ingest.xml rename edexOsgi/{com.raytheon.uf.edex.site/src/com/raytheon/uf/edex/site => com.raytheon.uf.edex.ndm/src/com/raytheon/uf/edex/ndm}/ingest/IDataSetIngester.java (75%) rename edexOsgi/{com.raytheon.uf.common.site/src/com/raytheon/uf/common/site => com.raytheon.uf.edex.ndm/src/com/raytheon/uf/edex/ndm}/ingest/INationalDatasetSubscriber.java (85%) rename edexOsgi/{com.raytheon.uf.edex.site/src/com/raytheon/uf/edex/site => com.raytheon.uf.edex.ndm/src/com/raytheon/uf/edex/ndm}/ingest/NationalDatasetIngester.java (87%) diff --git a/edexOsgi/com.raytheon.edex.plugin.bufrua/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.edex.plugin.bufrua/META-INF/MANIFEST.MF index bc344241c1..44569911a1 100644 --- a/edexOsgi/com.raytheon.edex.plugin.bufrua/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.edex.plugin.bufrua/META-INF/MANIFEST.MF @@ -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 diff --git a/edexOsgi/com.raytheon.edex.plugin.bufrua/res/spring/bufrua-ingest.xml b/edexOsgi/com.raytheon.edex.plugin.bufrua/res/spring/bufrua-ingest.xml index df4ddcd80c..4f74f45993 100644 --- a/edexOsgi/com.raytheon.edex.plugin.bufrua/res/spring/bufrua-ingest.xml +++ b/edexOsgi/com.raytheon.edex.plugin.bufrua/res/spring/bufrua-ingest.xml @@ -19,6 +19,21 @@ + + + + + + + + + + + + + + + * @@ -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. * * * @@ -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()) { diff --git a/edexOsgi/com.raytheon.edex.plugin.obs/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.edex.plugin.obs/META-INF/MANIFEST.MF index 1111c9f01e..f6bfa2a3cc 100644 --- a/edexOsgi/com.raytheon.edex.plugin.obs/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.edex.plugin.obs/META-INF/MANIFEST.MF @@ -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, diff --git a/edexOsgi/com.raytheon.edex.plugin.obs/res/spring/obs-ingest.xml b/edexOsgi/com.raytheon.edex.plugin.obs/res/spring/obs-ingest.xml index f797a17d03..9ba4868890 100644 --- a/edexOsgi/com.raytheon.edex.plugin.obs/res/spring/obs-ingest.xml +++ b/edexOsgi/com.raytheon.edex.plugin.obs/res/spring/obs-ingest.xml @@ -22,6 +22,21 @@ + + + + + + + + + + + + + + + diff --git a/edexOsgi/com.raytheon.uf.common.site/src/com/raytheon/uf/common/site/ingest/MTRSubscriber.java b/edexOsgi/com.raytheon.edex.plugin.obs/src/com/raytheon/edex/plugin/obs/ingest/MTRSubscriber.java similarity index 81% rename from edexOsgi/com.raytheon.uf.common.site/src/com/raytheon/uf/common/site/ingest/MTRSubscriber.java rename to edexOsgi/com.raytheon.edex.plugin.obs/src/com/raytheon/edex/plugin/obs/ingest/MTRSubscriber.java index abd423a1d7..62fd87c409 100644 --- a/edexOsgi/com.raytheon.uf.common.site/src/com/raytheon/uf/common/site/ingest/MTRSubscriber.java +++ b/edexOsgi/com.raytheon.edex.plugin.obs/src/com/raytheon/edex/plugin/obs/ingest/MTRSubscriber.java @@ -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. * *
  * 
@@ -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.
  * 
  * 
* @@ -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()) { diff --git a/edexOsgi/com.raytheon.edex.plugin.radar/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.edex.plugin.radar/META-INF/MANIFEST.MF index f9fde2d038..81b3c23d85 100644 --- a/edexOsgi/com.raytheon.edex.plugin.radar/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.edex.plugin.radar/META-INF/MANIFEST.MF @@ -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 diff --git a/edexOsgi/com.raytheon.edex.plugin.radar/res/spring/radar-ingest.xml b/edexOsgi/com.raytheon.edex.plugin.radar/res/spring/radar-ingest.xml index d5fd8f0fec..4140a144ef 100644 --- a/edexOsgi/com.raytheon.edex.plugin.radar/res/spring/radar-ingest.xml +++ b/edexOsgi/com.raytheon.edex.plugin.radar/res/spring/radar-ingest.xml @@ -99,4 +99,25 @@ value="com.raytheon.uf.common.dataplugin.radar.request.RadarServerConnectionRequest" />
+ + + + + + + + + + + + + + + + + + + + + diff --git a/edexOsgi/com.raytheon.edex.plugin.radar/src/com/raytheon/edex/plugin/radar/util/Import88DLocationsUtil.java b/edexOsgi/com.raytheon.edex.plugin.radar/src/com/raytheon/edex/plugin/radar/util/Import88DLocationsUtil.java index d5a300643e..573a0aadd5 100644 --- a/edexOsgi/com.raytheon.edex.plugin.radar/src/com/raytheon/edex/plugin/radar/util/Import88DLocationsUtil.java +++ b/edexOsgi/com.raytheon.edex.plugin.radar/src/com/raytheon/edex/plugin/radar/util/Import88DLocationsUtil.java @@ -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. * * */ 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 theRadarShapeFileList = new ArrayList() { - 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 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 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 aHashMap : aDataList) { keySet = aHashMap.keySet(); diff --git a/edexOsgi/com.raytheon.edex.plugin.radar/src/com/raytheon/edex/plugin/radar/util/RadarMenuUtil.java b/edexOsgi/com.raytheon.edex.plugin.radar/src/com/raytheon/edex/plugin/radar/util/RadarMenuUtil.java index be6defcae9..50693257c3 100644 --- a/edexOsgi/com.raytheon.edex.plugin.radar/src/com/raytheon/edex/plugin/radar/util/RadarMenuUtil.java +++ b/edexOsgi/com.raytheon.edex.plugin.radar/src/com/raytheon/edex/plugin/radar/util/RadarMenuUtil.java @@ -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. * * * @@ -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 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 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 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 + } + } } } } diff --git a/edexOsgi/com.raytheon.edex.plugin.sfcobs/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.edex.plugin.sfcobs/META-INF/MANIFEST.MF index 1ceed53715..0f0fabd9d0 100644 --- a/edexOsgi/com.raytheon.edex.plugin.sfcobs/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.edex.plugin.sfcobs/META-INF/MANIFEST.MF @@ -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, diff --git a/edexOsgi/com.raytheon.edex.plugin.sfcobs/res/spring/sfcobs-ingest.xml b/edexOsgi/com.raytheon.edex.plugin.sfcobs/res/spring/sfcobs-ingest.xml index 303c3f7cdc..0de703d79d 100644 --- a/edexOsgi/com.raytheon.edex.plugin.sfcobs/res/spring/sfcobs-ingest.xml +++ b/edexOsgi/com.raytheon.edex.plugin.sfcobs/res/spring/sfcobs-ingest.xml @@ -22,6 +22,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/edexOsgi/com.raytheon.uf.common.site/src/com/raytheon/uf/common/site/ingest/BuoySubscriber.java b/edexOsgi/com.raytheon.edex.plugin.sfcobs/src/com/raytheon/edex/plugin/sfcobs/ingest/BuoySubscriber.java similarity index 77% rename from edexOsgi/com.raytheon.uf.common.site/src/com/raytheon/uf/common/site/ingest/BuoySubscriber.java rename to edexOsgi/com.raytheon.edex.plugin.sfcobs/src/com/raytheon/edex/plugin/sfcobs/ingest/BuoySubscriber.java index d2d98eaa68..75f0590028 100644 --- a/edexOsgi/com.raytheon.uf.common.site/src/com/raytheon/uf/common/site/ingest/BuoySubscriber.java +++ b/edexOsgi/com.raytheon.edex.plugin.sfcobs/src/com/raytheon/edex/plugin/sfcobs/ingest/BuoySubscriber.java @@ -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. * *
  * 
@@ -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.
  * 
  * 
* @@ -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 + } + } } } } diff --git a/edexOsgi/com.raytheon.uf.edex.site/src/com/raytheon/uf/edex/site/ingest/MarineInfoSubscriber.java b/edexOsgi/com.raytheon.edex.plugin.sfcobs/src/com/raytheon/edex/plugin/sfcobs/ingest/MarineInfoSubscriber.java similarity index 87% rename from edexOsgi/com.raytheon.uf.edex.site/src/com/raytheon/uf/edex/site/ingest/MarineInfoSubscriber.java rename to edexOsgi/com.raytheon.edex.plugin.sfcobs/src/com/raytheon/edex/plugin/sfcobs/ingest/MarineInfoSubscriber.java index d3fe671d29..551e6fe985 100644 --- a/edexOsgi/com.raytheon.uf.edex.site/src/com/raytheon/uf/edex/site/ingest/MarineInfoSubscriber.java +++ b/edexOsgi/com.raytheon.edex.plugin.sfcobs/src/com/raytheon/edex/plugin/sfcobs/ingest/MarineInfoSubscriber.java @@ -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. * *
  * 
@@ -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.
  * 
  * 
* @@ -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 + } + } } } } diff --git a/edexOsgi/com.raytheon.edex.plugin.text/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.edex.plugin.text/META-INF/MANIFEST.MF index 7fa37b096c..3167641bc6 100644 --- a/edexOsgi/com.raytheon.edex.plugin.text/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.edex.plugin.text/META-INF/MANIFEST.MF @@ -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 diff --git a/edexOsgi/com.raytheon.edex.plugin.text/res/spring/text-ingest.xml b/edexOsgi/com.raytheon.edex.plugin.text/res/spring/text-ingest.xml index f2c2cdc1bc..e503613e8e 100644 --- a/edexOsgi/com.raytheon.edex.plugin.text/res/spring/text-ingest.xml +++ b/edexOsgi/com.raytheon.edex.plugin.text/res/spring/text-ingest.xml @@ -52,6 +52,35 @@
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/edexOsgi/com.raytheon.uf.common.site/src/com/raytheon/uf/common/site/ingest/AfosBrowserModelSubscriber.java b/edexOsgi/com.raytheon.edex.plugin.text/src/com/raytheon/edex/plugin/text/ingest/AfosBrowserModelSubscriber.java similarity index 80% rename from edexOsgi/com.raytheon.uf.common.site/src/com/raytheon/uf/common/site/ingest/AfosBrowserModelSubscriber.java rename to edexOsgi/com.raytheon.edex.plugin.text/src/com/raytheon/edex/plugin/text/ingest/AfosBrowserModelSubscriber.java index 8ad808e7dc..7498db05ea 100644 --- a/edexOsgi/com.raytheon.uf.common.site/src/com/raytheon/uf/common/site/ingest/AfosBrowserModelSubscriber.java +++ b/edexOsgi/com.raytheon.edex.plugin.text/src/com/raytheon/edex/plugin/text/ingest/AfosBrowserModelSubscriber.java @@ -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. * *
  * 
@@ -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.
  * 
  * 
* @@ -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 + } + } } } } - } diff --git a/edexOsgi/com.raytheon.edex.plugin.text/src/com/raytheon/edex/plugin/text/ingest/AfosToAwipsListener.java b/edexOsgi/com.raytheon.edex.plugin.text/src/com/raytheon/edex/plugin/text/ingest/AfosToAwipsListener.java index bc528dbac7..5c8f898cf3 100644 --- a/edexOsgi/com.raytheon.edex.plugin.text/src/com/raytheon/edex/plugin/text/ingest/AfosToAwipsListener.java +++ b/edexOsgi/com.raytheon.edex.plugin.text/src/com/raytheon/edex/plugin/text/ingest/AfosToAwipsListener.java @@ -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. * *
  * 
@@ -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.
  * 
  * 
* @@ -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(); diff --git a/edexOsgi/com.raytheon.edex.textdb/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.edex.textdb/META-INF/MANIFEST.MF index 8faab5a194..1f04cb3849 100644 --- a/edexOsgi/com.raytheon.edex.textdb/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.edex.textdb/META-INF/MANIFEST.MF @@ -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, diff --git a/edexOsgi/com.raytheon.edex.textdb/res/spring/textdb-ingest.xml b/edexOsgi/com.raytheon.edex.textdb/res/spring/textdb-ingest.xml new file mode 100644 index 0000000000..0c2b59c350 --- /dev/null +++ b/edexOsgi/com.raytheon.edex.textdb/res/spring/textdb-ingest.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.common.site/src/com/raytheon/uf/common/site/ingest/SiteMapNationalDatasetSubscriber.java b/edexOsgi/com.raytheon.edex.textdb/src/com/raytheon/edex/textdb/ingest/SiteMapNationalDatasetSubscriber.java similarity index 76% rename from edexOsgi/com.raytheon.uf.common.site/src/com/raytheon/uf/common/site/ingest/SiteMapNationalDatasetSubscriber.java rename to edexOsgi/com.raytheon.edex.textdb/src/com/raytheon/edex/textdb/ingest/SiteMapNationalDatasetSubscriber.java index af968e74c1..67f330a179 100644 --- a/edexOsgi/com.raytheon.uf.common.site/src/com/raytheon/uf/common/site/ingest/SiteMapNationalDatasetSubscriber.java +++ b/edexOsgi/com.raytheon.edex.textdb/src/com/raytheon/edex/textdb/ingest/SiteMapNationalDatasetSubscriber.java @@ -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. * *
  * 
@@ -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.
  * 
  * 
* @@ -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 + } + } } } } diff --git a/edexOsgi/com.raytheon.edex.textdb/src/com/raytheon/edex/textdb/ingest/TextDBStaticDataSubscriber.java b/edexOsgi/com.raytheon.edex.textdb/src/com/raytheon/edex/textdb/ingest/TextDBStaticDataSubscriber.java index 68e13e616d..027b5125e4 100644 --- a/edexOsgi/com.raytheon.edex.textdb/src/com/raytheon/edex/textdb/ingest/TextDBStaticDataSubscriber.java +++ b/edexOsgi/com.raytheon.edex.textdb/src/com/raytheon/edex/textdb/ingest/TextDBStaticDataSubscriber.java @@ -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. * *
  * 
@@ -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.
  * 
  * 
* @@ -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(); } - } diff --git a/edexOsgi/com.raytheon.uf.common.site/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.site/META-INF/MANIFEST.MF index b2622c2a51..b82a32830f 100644 --- a/edexOsgi/com.raytheon.uf.common.site/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.common.site/META-INF/MANIFEST.MF @@ -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 diff --git a/edexOsgi/com.raytheon.uf.edex.core.feature/feature.xml b/edexOsgi/com.raytheon.uf.edex.core.feature/feature.xml index c79ec44b8b..973ea5e4e4 100644 --- a/edexOsgi/com.raytheon.uf.edex.core.feature/feature.xml +++ b/edexOsgi/com.raytheon.uf.edex.core.feature/feature.xml @@ -111,4 +111,10 @@ version="0.0.0" unpack="false"/> + diff --git a/edexOsgi/com.raytheon.uf.edex.decodertools/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.decodertools/META-INF/MANIFEST.MF index e2419f92c1..51f40afd88 100644 --- a/edexOsgi/com.raytheon.uf.edex.decodertools/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.edex.decodertools/META-INF/MANIFEST.MF @@ -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, diff --git a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/stations/sql/AWIPSCommonObsSQLGenerator.java b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/stations/sql/AWIPSCommonObsSQLGenerator.java index 30aa25afb6..9a1c4cf7eb 100644 --- a/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/stations/sql/AWIPSCommonObsSQLGenerator.java +++ b/edexOsgi/com.raytheon.uf.edex.decodertools/src/com/raytheon/uf/edex/stations/sql/AWIPSCommonObsSQLGenerator.java @@ -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 * + *
+ * 
+ * SOFTWARE HISTORY
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ *                                     Initial release.
+ * Mar 06, 2014   2876     mpduff      New NDM plugin.
+ * 
+ * 
+ * * @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 + } + } } } diff --git a/edexOsgi/com.raytheon.uf.edex.dissemination/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.dissemination/META-INF/MANIFEST.MF index 7786719fcc..a26c1d0d81 100644 --- a/edexOsgi/com.raytheon.uf.edex.dissemination/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.edex.dissemination/META-INF/MANIFEST.MF @@ -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" diff --git a/edexOsgi/com.raytheon.uf.edex.dissemination/res/spring/dissemination-ingest.xml b/edexOsgi/com.raytheon.uf.edex.dissemination/res/spring/dissemination-ingest.xml new file mode 100644 index 0000000000..f8c063f693 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.dissemination/res/spring/dissemination-ingest.xml @@ -0,0 +1,12 @@ + + + + + + + + + + \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.dissemination/src/com/raytheon/uf/edex/dissemination/ingest/DisseminationNationalDatasetSubscriber.java b/edexOsgi/com.raytheon.uf.edex.dissemination/src/com/raytheon/uf/edex/dissemination/ingest/DisseminationNationalDatasetSubscriber.java index 676580aba3..f16f91c5f3 100644 --- a/edexOsgi/com.raytheon.uf.edex.dissemination/src/com/raytheon/uf/edex/dissemination/ingest/DisseminationNationalDatasetSubscriber.java +++ b/edexOsgi/com.raytheon.uf.edex.dissemination/src/com/raytheon/uf/edex/dissemination/ingest/DisseminationNationalDatasetSubscriber.java @@ -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. * *
  * 
@@ -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.
  * 
  * 
* @@ -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 + } + } } } } - } diff --git a/edexOsgi/com.raytheon.uf.edex.ndm/.classpath b/edexOsgi/com.raytheon.uf.edex.ndm/.classpath new file mode 100644 index 0000000000..098194ca4b --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.ndm/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/edexOsgi/com.raytheon.uf.edex.ndm/.project b/edexOsgi/com.raytheon.uf.edex.ndm/.project new file mode 100644 index 0000000000..3080f854f7 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.ndm/.project @@ -0,0 +1,28 @@ + + + com.raytheon.uf.edex.ndm + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/edexOsgi/com.raytheon.uf.edex.ndm/.settings/org.eclipse.jdt.core.prefs b/edexOsgi/com.raytheon.uf.edex.ndm/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..f42de363af --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.ndm/.settings/org.eclipse.jdt.core.prefs @@ -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 diff --git a/edexOsgi/com.raytheon.uf.edex.ndm/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.ndm/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..bb93b7e7e6 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.ndm/META-INF/MANIFEST.MF @@ -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 diff --git a/edexOsgi/com.raytheon.uf.edex.ndm/build.properties b/edexOsgi/com.raytheon.uf.edex.ndm/build.properties new file mode 100644 index 0000000000..5791d48d5f --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.ndm/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + res/ diff --git a/edexOsgi/com.raytheon.uf.edex.ndm/res/spring/ndm-ingest.xml b/edexOsgi/com.raytheon.uf.edex.ndm/res/spring/ndm-ingest.xml new file mode 100644 index 0000000000..83550d5dea --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.ndm/res/spring/ndm-ingest.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.site/src/com/raytheon/uf/edex/site/ingest/IDataSetIngester.java b/edexOsgi/com.raytheon.uf.edex.ndm/src/com/raytheon/uf/edex/ndm/ingest/IDataSetIngester.java similarity index 75% rename from edexOsgi/com.raytheon.uf.edex.site/src/com/raytheon/uf/edex/site/ingest/IDataSetIngester.java rename to edexOsgi/com.raytheon.uf.edex.ndm/src/com/raytheon/uf/edex/ndm/ingest/IDataSetIngester.java index 9dd79d7b5e..6c55ace9dc 100644 --- a/edexOsgi/com.raytheon.uf.edex.site/src/com/raytheon/uf/edex/site/ingest/IDataSetIngester.java +++ b/edexOsgi/com.raytheon.uf.edex.ndm/src/com/raytheon/uf/edex/ndm/ingest/IDataSetIngester.java @@ -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. * *
- *
+ * 
  * SOFTWARE HISTORY
- *
+ * 
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Sep 22, 2011            jkorman     Initial creation
- *
+ * Mar 06, 2014   2876     mpduff      New NDM plugin.
+ * 
  * 
- * + * * @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); + } diff --git a/edexOsgi/com.raytheon.uf.common.site/src/com/raytheon/uf/common/site/ingest/INationalDatasetSubscriber.java b/edexOsgi/com.raytheon.uf.edex.ndm/src/com/raytheon/uf/edex/ndm/ingest/INationalDatasetSubscriber.java similarity index 85% rename from edexOsgi/com.raytheon.uf.common.site/src/com/raytheon/uf/common/site/ingest/INationalDatasetSubscriber.java rename to edexOsgi/com.raytheon.uf.edex.ndm/src/com/raytheon/uf/edex/ndm/ingest/INationalDatasetSubscriber.java index 35489d016d..128d01873f 100644 --- a/edexOsgi/com.raytheon.uf.common.site/src/com/raytheon/uf/common/site/ingest/INationalDatasetSubscriber.java +++ b/edexOsgi/com.raytheon.uf.edex.ndm/src/com/raytheon/uf/edex/ndm/ingest/INationalDatasetSubscriber.java @@ -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. * *
  * 
@@ -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.
  * 
  * 
* diff --git a/edexOsgi/com.raytheon.uf.edex.site/src/com/raytheon/uf/edex/site/ingest/NationalDatasetIngester.java b/edexOsgi/com.raytheon.uf.edex.ndm/src/com/raytheon/uf/edex/ndm/ingest/NationalDatasetIngester.java similarity index 87% rename from edexOsgi/com.raytheon.uf.edex.site/src/com/raytheon/uf/edex/site/ingest/NationalDatasetIngester.java rename to edexOsgi/com.raytheon.uf.edex.ndm/src/com/raytheon/uf/edex/ndm/ingest/NationalDatasetIngester.java index 2982d8d808..a67bfd3e32 100644 --- a/edexOsgi/com.raytheon.uf.edex.site/src/com/raytheon/uf/edex/site/ingest/NationalDatasetIngester.java +++ b/edexOsgi/com.raytheon.uf.edex.ndm/src/com/raytheon/uf/edex/ndm/ingest/NationalDatasetIngester.java @@ -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. * *
  * 
@@ -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.
  * 
  * 
* @@ -53,15 +53,17 @@ import com.raytheon.uf.edex.core.EdexException; public class NationalDatasetIngester implements IDataSetIngester { - private Map> listeners = new HashMap>(); + private final Map> listeners = new HashMap>(); /** - * 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 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 { } } - - } diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.loctables/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.plugin.loctables/META-INF/MANIFEST.MF index 41868ea655..85ed17b223 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.loctables/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.edex.plugin.loctables/META-INF/MANIFEST.MF @@ -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 diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.loctables/src/com/raytheon/uf/edex/plugin/loctables/ingest/LocationTablesIngest.java b/edexOsgi/com.raytheon.uf.edex.plugin.loctables/src/com/raytheon/uf/edex/plugin/loctables/ingest/LocationTablesIngest.java index 4e80ac0a72..3519925d87 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.loctables/src/com/raytheon/uf/edex/plugin/loctables/ingest/LocationTablesIngest.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.loctables/src/com/raytheon/uf/edex/plugin/loctables/ingest/LocationTablesIngest.java @@ -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 * *
  * 
@@ -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.
  * 
  * 
* @@ -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); } } } diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.manualIngest/res/spring/manualIngest-spring.xml b/edexOsgi/com.raytheon.uf.edex.plugin.manualIngest/res/spring/manualIngest-spring.xml index 5c575dbd48..0ec3a71073 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.manualIngest/res/spring/manualIngest-spring.xml +++ b/edexOsgi/com.raytheon.uf.edex.plugin.manualIngest/res/spring/manualIngest-spring.xml @@ -9,8 +9,6 @@ errorHandlerRef="errorHandler" autoStartup="false"> - @@ -18,167 +16,10 @@ - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.modelsounding/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.plugin.modelsounding/META-INF/MANIFEST.MF index 200fbd6852..67ea2826a6 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.modelsounding/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.edex.plugin.modelsounding/META-INF/MANIFEST.MF @@ -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, diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.modelsounding/res/spring/modelsounding-ingest.xml b/edexOsgi/com.raytheon.uf.edex.plugin.modelsounding/res/spring/modelsounding-ingest.xml index 0230b80501..804a8a151d 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.modelsounding/res/spring/modelsounding-ingest.xml +++ b/edexOsgi/com.raytheon.uf.edex.plugin.modelsounding/res/spring/modelsounding-ingest.xml @@ -30,6 +30,21 @@ + + + + + + + + + + + + + + + * @@ -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 } } } diff --git a/edexOsgi/com.raytheon.uf.edex.site/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.site/META-INF/MANIFEST.MF index 894b867f73..1e6bb88733 100644 --- a/edexOsgi/com.raytheon.uf.edex.site/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.edex.site/META-INF/MANIFEST.MF @@ -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, diff --git a/edexOsgi/com.raytheon.uf.edex.text.feature/feature.xml b/edexOsgi/com.raytheon.uf.edex.text.feature/feature.xml index 10df591fb1..6758a13f01 100644 --- a/edexOsgi/com.raytheon.uf.edex.text.feature/feature.xml +++ b/edexOsgi/com.raytheon.uf.edex.text.feature/feature.xml @@ -16,7 +16,7 @@ [Enter License Description here.] - +