From f38d77b307db6dae8e0d08cd3fd8885668af3deb Mon Sep 17 00:00:00 2001 From: Dave Hladky Date: Wed, 15 Jan 2014 13:29:18 -0600 Subject: [PATCH] Issue #2693 Data set information infrastructure for availability offset calculations Change-Id: I0f8d90a753ce37d37c682ff17613eb9a44554a3b Former-commit-id: ef8eb701daf180ea49a5c32f36155dba2ba21ba6 [formerly 129163bf87c00a5c0eba9bc635731f53f65a2529] [formerly ef8eb701daf180ea49a5c32f36155dba2ba21ba6 [formerly 129163bf87c00a5c0eba9bc635731f53f65a2529] [formerly b64df5806afba5482ea2cf22fb9a968701bf8bd5 [formerly 48fad391deb95616556628424b1a1799c2929f89]]] Former-commit-id: b64df5806afba5482ea2cf22fb9a968701bf8bd5 Former-commit-id: c05cbb533758c1f4be8fa5089ba777274948850a [formerly 682b06c89d09a0c901e4eac59ad58ebf88c5291b] Former-commit-id: 83c4b031d6a92cf16a2390e545f838b02708ee55 --- .../lookups/DataSetInformationLookup.xml | 1435 +++++++++++++++++ .../util/DataSetInformationXmlWriter.java | 54 + .../retrieval/util/LookupManager.java | 201 ++- .../retrieval/xml/DataSetInformation.java | 118 ++ .../xml/DataSetInformationLookup.java | 74 + .../datadelivery/OPENDAPServiceConfig.xml | 3 + .../opendap/OpenDAPMetaDataParser.java | 60 +- 7 files changed, 1925 insertions(+), 20 deletions(-) create mode 100644 edexOsgi/com.raytheon.uf.common.datadelivery.harvester/utility/common_static/base/datadelivery/lookups/DataSetInformationLookup.xml create mode 100644 edexOsgi/com.raytheon.uf.common.datadelivery.retrieval/src/com/raytheon/uf/common/datadelivery/retrieval/util/DataSetInformationXmlWriter.java create mode 100644 edexOsgi/com.raytheon.uf.common.datadelivery.retrieval/src/com/raytheon/uf/common/datadelivery/retrieval/xml/DataSetInformation.java create mode 100644 edexOsgi/com.raytheon.uf.common.datadelivery.retrieval/src/com/raytheon/uf/common/datadelivery/retrieval/xml/DataSetInformationLookup.java diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.harvester/utility/common_static/base/datadelivery/lookups/DataSetInformationLookup.xml b/edexOsgi/com.raytheon.uf.common.datadelivery.harvester/utility/common_static/base/datadelivery/lookups/DataSetInformationLookup.xml new file mode 100644 index 0000000000..8fdf1af782 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.datadelivery.harvester/utility/common_static/base/datadelivery/lookups/DataSetInformationLookup.xml @@ -0,0 +1,1435 @@ + + + + + wave_mww3 + 1.5 + 6 + 270 + + + rap32 + 1.5 + 6 + 70 + + + rtofs_native_048_gma + 1.5 + 6 + 270 + + + naefs_bc_gemode + 1.5 + 6 + 375 + + + sref_na_nmm_p1 + 1.5 + 6 + 240 + + + rtofs_native_000_gma + 1.5 + 6 + 210 + + + rtofs_glo_3dz_nowcast_6hrly_reg1 + 1.5 + 6 + 1440 + + + rtofs_glo_3dz_nowcast_6hrly_reg2 + 1.5 + 6 + 1440 + + + rtofs_glo_3dz_nowcast_6hrly_reg3 + 1.5 + 6 + 1440 + + + srefbc_nmb_ctl + 1.5 + 6 + 240 + + + gens_bc_gep_all + 1.5 + 6 + 360 + + + sref_na_em_p2 + 1.5 + 6 + 240 + + + sref_na_em_p3 + 1.5 + 6 + 240 + + + sref_na_em_p1 + 1.5 + 6 + 240 + + + gens_ndgd_ge10pt + 1.5 + 6 + 420 + + + naefs_ndgd_gemode + 1.5 + 6 + 555 + + + rtofs_native_144_atl + 1.5 + 6 + 420 + + + nam_alaskanest + 1.5 + 6 + 180 + + + sref_na_nmm_p2 + 1.5 + 6 + 240 + + + sref_na_nmm_p3 + 1.5 + 6 + 240 + + + hiresw_eastarw + 1.5 + 6 + 330 + + + rtofs_glo_3dz_nowcast_daily_uvel + 1.5 + 6 + 1440 + + + rtofs_forecast_hires_std_atl + 1.5 + 6 + 720 + + + fens_all + 1.5 + 6 + 450 + + + sref_na132_nmb_ctl + 1.5 + 6 + 240 + + + fnlflx + 1.5 + 6 + 405 + + + nam_conusnest + 1.5 + 6 + 180 + + + rtma2p5_err + 1.5 + 6 + 60 + + + wave_nph + 1.5 + 6 + 315 + + + rtofs_native_120_gs + 1.5 + 6 + 390 + + + gens_ndgd_ge50pt + 1.5 + 6 + 420 + + + sref_na_em_n2 + 1.5 + 6 + 270 + + + wave_enp + 1.5 + 6 + 285 + + + sref_na_em_n3 + 1.5 + 6 + 240 + + + rtofs_native_120_gm + 1.5 + 6 + 390 + + + sref_na_em_n1 + 1.5 + 6 + 240 + + + hirtma_ges + 1.5 + 6 + 45 + + + rtofs_glo_2ds_nowcast_3hrly_diag + 1.5 + 6 + 1440 + + + gurtma_err + 1.5 + 6 + 45 + + + sref_na_nmm_ctl + 1.5 + 6 + 240 + + + hiresw_westarw + 1.5 + 6 + 330 + + + gfs2p5 + 1.5 + 6 + 300 + + + sref_na_nmm_n2 + 1.5 + 6 + 240 + + + sref_na_nmm_n3 + 1.5 + 6 + 240 + + + sref_na_nmm_n1 + 1.5 + 6 + 240 + + + rtofs_glo_2ds_forecast_3hrly_prog + 1.5 + 6 + 1440 + + + naefs_ndgd_gespr + 1.5 + 6 + 555 + + + rtofs_glo_2ds_forecast_3hrly_diag + 1.5 + 6 + 1440 + + + sref_na132_nmb_p3 + 1.5 + 6 + 240 + + + gfs + 1.5 + 6 + 285 + + + rtofs_glo_2ds_forecast_daily_prog + 1.5 + 6 + 1440 + + + sref_nmm_n3 + 1.5 + 6 + 240 + + + sref_nmm_n2 + 1.5 + 6 + 240 + + + sref_nmm_n1 + 1.5 + 6 + 240 + + + wave_nww3 + 1.5 + 6 + 270 + + + rtofs_native_024_gma + 1.5 + 6 + 240 + + + akrtma_anl + 1.5 + 6 + 45 + + + rtofs_glo_3dz_forecast_daily_vvel + 1.5 + 6 + 1440 + + + naefs_bc_ge50pt + 1.5 + 6 + 270 + + + naefs_ndgd_geavg + 1.5 + 6 + 555 + + + srefbc_em_n1 + 1.5 + 6 + 240 + + + gens_bc_geavg + 1.5 + 6 + 270 + + + srefbc_em_n2 + 1.5 + 6 + 240 + + + nam_na + 1.5 + 6 + 180 + + + srefbc_em_n3 + 1.5 + 6 + 240 + + + rtofs_glo_3dz_nowcast_daily_salt + 1.5 + 6 + 1440 + + + prrtma_ges + 1.5 + 6 + 45 + + + gens_bc_ge90pt + 1.5 + 6 + 270 + + + srefbc_nmb_n3 + 1.5 + 6 + 240 + + + rtofs_native_048_atl + 1.5 + 6 + 270 + + + ncom_amseas + 1.5 + 6 + 900 + + + srefbc_nmb_n2 + 1.5 + 6 + 240 + + + srefbc_nmb_n1 + 1.5 + 6 + 240 + + + gens_bc_ge10pt + 1.5 + 6 + 270 + + + wave_wna + 1.5 + 6 + 270 + + + sref_na132_nmb_p2 + 1.5 + 6 + 240 + + + sref_na132_nmb_p1 + 1.5 + 6 + 240 + + + narre_130_mean + 1.5 + 6 + 150 + + + srefbc_em_ctl + 1.5 + 6 + 240 + + + estofs_conus + 1.5 + 6 + 360 + + + sref_na132_nmb_n1 + 1.5 + 6 + 240 + + + sref_na132_nmb_n2 + 1.5 + 6 + 240 + + + sref_na132_nmb_n3 + 1.5 + 6 + 240 + + + nam + 1.5 + 6 + 180 + + + naefs_ndgd_ge90pt + 1.5 + 6 + 555 + + + sref_nmm_p3 + 1.5 + 6 + 240 + + + rap + 1.5 + 6 + 70 + + + sref_nmm_p2 + 1.5 + 6 + 240 + + + wave_nah + 1.5 + 6 + 315 + + + sref_nmm_p1 + 1.5 + 6 + 240 + + + rtofs_native_024_atl + 1.5 + 6 + 300 + + + sref_na_nmb_ctl + 1.5 + 6 + 240 + + + ncom_socal + 1.5 + 6 + 750 + + + ice + 1.5 + 6 + 420 + + + hiresw_guamnmm + 1.5 + 6 + 300 + + + srefbc_em_p3 + 1.5 + 6 + 240 + + + rtofs_glo_3dz_forecast_6hrly_reg1 + 1.5 + 6 + 1440 + + + hiresw_hiarw + 1.5 + 6 + 270 + + + srefbc_em_p1 + 1.5 + 6 + 240 + + + rtofs_glo_3dz_forecast_6hrly_reg3 + 1.5 + 6 + 1440 + + + srefbc_em_p2 + 1.5 + 6 + 240 + + + rtofs_glo_3dz_forecast_6hrly_reg2 + 1.5 + 6 + 1440 + + + sref_na132_em_n1 + 1.5 + 6 + 240 + + + sref_na132_em_n3 + 1.5 + 6 + 240 + + + sref_na132_em_n2 + 1.5 + 6 + 240 + + + ncom_useast + 1.5 + 6 + 810 + + + srefbc_nmb_p3 + 1.5 + 6 + 240 + + + srefbc_nmb_p2 + 1.5 + 6 + 240 + + + rtofs_native_096_gma + 1.5 + 6 + 360 + + + srefbc_nmb_p1 + 1.5 + 6 + 240 + + + gens_ndgd_gespr + 1.5 + 6 + 420 + + + nam_crb + 1.5 + 6 + 180 + + + rtofs_glo_2ds_forecast_daily_diag + 1.5 + 6 + 1440 + + + naefs_ndgd_ge10pt + 1.5 + 6 + 555 + + + narre_242_spread + 1.5 + 6 + 150 + + + nam_priconest + 1.5 + 6 + 180 + + + gens_ndgd_geavg + 1.5 + 6 + 420 + + + wave_akw + 1.5 + 6 + 285 + + + sref_na_nmb_p3 + 1.5 + 6 + 240 + + + sref_na_nmb_p2 + 1.5 + 6 + 240 + + + sref_na_nmb_p1 + 1.5 + 6 + 240 + + + gurtma_anl + 1.5 + 6 + 45 + + + rtofs_glo_3dz_forecast_daily_salt + 1.5 + 6 + 270 + + + rtofs_glo_2ds_nowcast_daily_diag + 1.5 + 6 + 1440 + + + gens_ndgd_ge90pt + 1.5 + 6 + 420 + + + rtofs_native_120_atl + 1.5 + 6 + 390 + + + hiresw_guamarw + 1.5 + 6 + 285 + + + rtofs_glo_2ds_nowcast_daily_prog + 1.5 + 6 + 1440 + + + rtma2p5_anl + 1.5 + 6 + 600 + + + sref_em_p3 + 1.5 + 6 + 240 + + + sref_em_p2 + 1.5 + 6 + 240 + + + rtofs_native_096_gm + 1.5 + 6 + 360 + + + sref_em_p1 + 1.5 + 6 + 240 + + + sref_na132_em_ctl + 1.5 + 6 + 240 + + + gens_gep_all + 1.5 + 6 + 360 + + + gens_bc_gespr + 1.5 + 6 + 270 + + + naefs_ndgd_ge50pt + 1.5 + 6 + 555 + + + rtofs_native_048_gm + 1.5 + 6 + 270 + + + prrtma_err + 1.5 + 6 + 45 + + + rtofs_native_048_gs + 1.5 + 6 + 270 + + + cmcens_all + 1.5 + 6 + 540 + + + gens_bc_gemode + 1.5 + 6 + 270 + + + rtofs_forecast_atl + 1.5 + 6 + 400 + + + rtofs_native_120_gma + 1.5 + 6 + 390 + + + sref_na132_em_p1 + 1.5 + 6 + 240 + + + rtofs_native_000_gm + 1.5 + 6 + 210 + + + hiresw_westnmm + 1.5 + 6 + 270 + + + rtofs_native_000_gs + 1.5 + 6 + 210 + + + nam_ak + 1.5 + 6 + 180 + + + sref_na132_nmm_n1 + 1.5 + 6 + 240 + + + sref_na132_nmm_n2 + 1.5 + 6 + 240 + + + sref_na132_nmm_n3 + 1.5 + 6 + 240 + + + akrtma_err + 1.5 + 6 + 45 + + + rtma2p5_ges + 1.5 + 6 + 60 + + + sref_na132_em_p2 + 1.5 + 6 + 240 + + + gens_bc_gens_bc + 1.5 + 6 + 270 + + + rtma_ges + 1.5 + 6 + 45 + + + sref_na132_em_p3 + 1.5 + 6 + 240 + + + rtma_err + 1.5 + 6 + 45 + + + gens_ndgd_gemode + 1.5 + 6 + 420 + + + sref_na_nmb_n3 + 1.5 + 6 + 240 + + + sref_na_nmb_n2 + 1.5 + 6 + 240 + + + sref_na_nmb_n1 + 1.5 + 6 + 240 + + + aqm_dailymax_1hro3 + 1.5 + 6 + 210 + + + sref_em_n1 + 1.5 + 6 + 240 + + + rtofs_native_144_gma + 1.5 + 6 + 420 + + + hirtma_anl + 1.5 + 6 + 45 + + + sref_em_n3 + 1.5 + 6 + 240 + + + wave_nfcens + 1.5 + 6 + 390 + + + sref_em_n2 + 1.5 + 6 + 240 + + + rtofs_glo_3dz_nowcast_daily_vvel + 1.5 + 6 + 1440 + + + gens_bc_gegfs + 1.5 + 6 + 270 + + + narre_130_spread + 1.5 + 6 + 105 + + + cmcensspr + 1.5 + 6 + 495 + + + rtofs_native_000_atl + 1.5 + 6 + 210 + + + srefbc_nmm_n3 + 1.5 + 6 + 240 + + + rtofs_native_096_gs + 1.5 + 6 + 360 + + + naefs_bc_ge90pt + 1.5 + 6 + 270 + + + naefs_bc_geavg + 1.5 + 6 + 375 + + + srefbc_nmm_n1 + 1.5 + 6 + 240 + + + srefbc_nmm_n2 + 1.5 + 6 + 240 + + + gfs_anl + 1.5 + 6 + 285 + + + sref_na132_nmm_p1 + 1.5 + 6 + 240 + + + sref_na132_nmm_p2 + 1.5 + 6 + 240 + + + sref_na132_nmm_ctl + 1.5 + 6 + 240 + + + sref_na132_nmm_p3 + 1.5 + 6 + 240 + + + rtofs_glo_3dz_forecast_daily_temp + 1.5 + 6 + 1440 + + + srefbc_nmm_ctl + 1.5 + 6 + 240 + + + rtofs_native_072_gma + 1.5 + 6 + 300 + + + hiresw_prarw + 1.5 + 6 + 300 + + + sref_em_ctl + 1.5 + 6 + 240 + + + wave_glw + 1.5 + 6 + 180 + + + sref_nmm_ctl + 1.5 + 6 + 240 + + + prrtma_anl + 1.5 + 6 + 45 + + + rtofs_latlon + 1.5 + 6 + 240 + + + srefbc_nmm_p2 + 1.5 + 6 + 240 + + + srefbc_nmm_p1 + 1.5 + 6 + 240 + + + srefbc_nmm_p3 + 1.5 + 6 + 240 + + + rtofs_native_024_gs + 1.5 + 6 + 240 + + + rtofs_native_072_gs + 1.5 + 6 + 300 + + + hirtma_err + 1.5 + 6 + 45 + + + rtofs_native_024_gm + 1.5 + 6 + 240 + + + narre_242_mean + 1.5 + 6 + 150 + + + hiresw_eastnmm + 1.5 + 6 + 330 + + + gfs_hd + 1.5 + 6 + 285 + + + akrtma_ges + 1.5 + 6 + 45 + + + sref_nmb_p3 + 1.5 + 6 + 240 + + + sref_nmb_p1 + 1.5 + 6 + 240 + + + sref_nmb_p2 + 1.5 + 6 + 240 + + + sref_nmb_ctl + 1.5 + 6 + 240 + + + rtofs_native_096_atl + 1.5 + 6 + 345 + + + sref_nmb_n3 + 1.5 + 6 + 240 + + + rtofs_nowcast_atl + 1.5 + 6 + 300 + + + gurtma_ges + 1.5 + 6 + 45 + + + rtofs_glo_3dz_nowcast_daily_temp + 1.5 + 6 + 1440 + + + naefs_bc_ge10pt + 1.5 + 6 + 270 + + + nam_hawaiinest + 1.5 + 6 + 180 + + + rtofs_native_072_atl + 1.5 + 6 + 300 + + + nam1hr + 1.5 + 6 + 180 + + + rtofs_glo_2ds_nowcast_3hrly_prog + 1.5 + 6 + 1440 + + + ncom_hawaii + 1.5 + 6 + 720 + + + rtofs_native_072_gm + 1.5 + 6 + 300 + + + naefs_bc_gespr + 1.5 + 6 + 375 + + + gens_bc_ge50pt + 1.5 + 6 + 270 + + + hiresw_hinmm + 1.5 + 6 + 300 + + + aqm_dailymax_8hro3 + 1.5 + 6 + 210 + + + rtofs_glo_3dz_forecast_daily_uvel + 1.5 + 6 + 1440 + + + rtma_anl + 1.5 + 6 + 45 + + + rtofs_native_144_gm + 1.5 + 6 + 400 + + + sref_na_em_ctl + 1.5 + 6 + 240 + + + nam_pac + 1.5 + 6 + 180 + + + sref_nmb_n1 + 1.5 + 6 + 240 + + + sref_nmb_n2 + 1.5 + 6 + 240 + + + rtofs_nowcast_hires_std_atl + 1.5 + 6 + 480 + + + cmcensavg + 1.5 + 6 + 495 + + + estofs_pr + 1.5 + 6 + 360 + + + rtofs_native_144_gs + 1.5 + 6 + 400 + + + hiresw_prnmm + 1.5 + 6 + 300 + + \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.retrieval/src/com/raytheon/uf/common/datadelivery/retrieval/util/DataSetInformationXmlWriter.java b/edexOsgi/com.raytheon.uf.common.datadelivery.retrieval/src/com/raytheon/uf/common/datadelivery/retrieval/util/DataSetInformationXmlWriter.java new file mode 100644 index 0000000000..fd14f54f41 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.datadelivery.retrieval/src/com/raytheon/uf/common/datadelivery/retrieval/util/DataSetInformationXmlWriter.java @@ -0,0 +1,54 @@ +package com.raytheon.uf.common.datadelivery.retrieval.util; + +/** + * This software was developed and / or modified by Raytheon Company, + * pursuant to Contract DG133W-05-CQ-1067 with the US Government. + * + * U.S. EXPORT CONTROLLED TECHNICAL DATA + * This software product contains export-restricted data whose + * export/transfer/disclosure is restricted by U.S. law. Dissemination + * to non-U.S. persons whether in the United States or abroad requires + * an export license or other authorization. + * + * Contractor Name: Raytheon Company + * Contractor Address: 6825 Pine Street, Suite 340 + * Mail Stop B8 + * Omaha, NE 68106 + * 402.291.0100 + * + * See the AWIPS II Master Rights File ("Master Rights File.pdf") for + * further licensing information. + **/ + +import com.raytheon.uf.common.datadelivery.retrieval.xml.DataSetInformationLookup; + +/** + * Writes out DataSet Information data to xml. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Jan 14, 2014            dhladky     Initial creation
+ * 
+ * 
+ * + * @author dhladky + * @version 1.0 + */ + +public interface DataSetInformationXmlWriter { + + /** + * Writes the DataSetInformation lookup to XML + * + * @param aol + * @param modelName + * @throws Exception + */ + void writeDataSetInformationXml(DataSetInformationLookup dsi) + throws Exception; + +} diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.retrieval/src/com/raytheon/uf/common/datadelivery/retrieval/util/LookupManager.java b/edexOsgi/com.raytheon.uf.common.datadelivery.retrieval/src/com/raytheon/uf/common/datadelivery/retrieval/util/LookupManager.java index 84c9aa1bdc..eff7cd452d 100644 --- a/edexOsgi/com.raytheon.uf.common.datadelivery.retrieval/src/com/raytheon/uf/common/datadelivery/retrieval/util/LookupManager.java +++ b/edexOsgi/com.raytheon.uf.common.datadelivery.retrieval/src/com/raytheon/uf/common/datadelivery/retrieval/util/LookupManager.java @@ -26,10 +26,13 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import javax.xml.bind.JAXBException; import com.raytheon.uf.common.datadelivery.registry.Parameter; +import com.raytheon.uf.common.datadelivery.retrieval.xml.DataSetInformation; +import com.raytheon.uf.common.datadelivery.retrieval.xml.DataSetInformationLookup; import com.raytheon.uf.common.datadelivery.retrieval.xml.LevelLookup; import com.raytheon.uf.common.datadelivery.retrieval.xml.ParameterConfig; import com.raytheon.uf.common.datadelivery.retrieval.xml.ParameterLookup; @@ -60,6 +63,7 @@ import com.raytheon.uf.common.util.ServiceLoaderUtil; * Jan 18, 2013 1513 dhladky Level lookup refit. * Mar 21, 2013 1794 djohnson ServiceLoaderUtil now requires the requesting class. * Nov 07, 2013 2361 njensen Use JAXBManager for XML + * Jam 14, 2014 dhladky AvailabilityOffset calculations * * * @@ -72,7 +76,7 @@ public class LookupManager { * Implementation of the xml writers that writes to localization files. */ private class LocalizationXmlWriter implements LevelXmlWriter, - ParameterXmlWriter { + ParameterXmlWriter, DataSetInformationXmlWriter { /** * {@inheritDoc} */ @@ -107,6 +111,23 @@ public class LookupManager { getJaxbManager().marshalToXmlFile(pl, file.getAbsolutePath()); } + + + @Override + public void writeDataSetInformationXml(DataSetInformationLookup dsi) + throws Exception { + + IPathManager pm = PathManagerFactory.getPathManager(); + LocalizationContext lc = pm.getContext( + LocalizationType.COMMON_STATIC, LocalizationLevel.SITE); + String fileName = getDataSetInformationFileName(); + LocalizationFile lf = pm.getLocalizationFile(lc, fileName); + File file = lf.getFile(); + + getJaxbManager().marshalToXmlFile(dsi, file.getAbsolutePath()); + + } + } private static final IUFStatusHandler statusHandler = UFStatus @@ -120,6 +141,8 @@ public class LookupManager { + File.separatorChar + "lookups" + File.separatorChar; private static final String CONFIG_FILE_PARAM = "ParameterLookup.xml"; + + private static final String CONFIG_FILE_DATASETINFO = "DataSetInformationLookup.xml"; private static final String CONFIG_FILE_LEVEL = "LevelLookup.xml"; @@ -135,9 +158,11 @@ public class LookupManager { return instance; } - private final Map parameters = new HashMap(); + private final Map parameters = new HashMap(1); - private final Map levels = new HashMap(); + private final Map levels = new HashMap(1); + + private final Map dataSetInformations = new HashMap(1); private UnitLookup unitLookup = null; @@ -148,13 +173,17 @@ public class LookupManager { private final ParameterXmlWriter parameterXmlWriter = ServiceLoaderUtil .load(LookupManager.class, ParameterXmlWriter.class, new LocalizationXmlWriter()); + + private final DataSetInformationXmlWriter dataSetInformationXmlWriter = ServiceLoaderUtil + .load(LookupManager.class, DataSetInformationXmlWriter.class, + new LocalizationXmlWriter()); private static JAXBManager jaxb; - private static JAXBManager getJaxbManager() - throws JAXBException { + private static JAXBManager getJaxbManager() throws JAXBException { if (jaxb == null) { jaxb = new JAXBManager(LevelLookup.class, ParameterLookup.class, + DataSetInformationLookup.class, DataSetInformation.class, UnitLookup.class); } @@ -295,6 +324,168 @@ public class LookupManager { return paramLoookup; } + + /** + * Gets the Data Set Information + * + * @param modelName + * @return + */ + public DataSetInformation getDataSetInformation(String modelName) { + + DataSetInformation dsi = null; + + if (dataSetInformations.isEmpty()) { + + DataSetInformationLookup dataSetInformationLookup = getDataSetInformationLookupFromFile(); + + if (dataSetInformationLookup == null) { + dataSetInformationLookup = new DataSetInformationLookup(); + } + + for (DataSetInformation dataSetinfo: dataSetInformationLookup.getDataSetInformations()){ + dataSetInformations.put(dataSetinfo.getModelName(), dataSetinfo); + } + } + + if (dataSetInformations.containsKey(modelName)) { + dsi = dataSetInformations.get(modelName); + } + + return dsi; + } + + private DataSetInformationLookup getDataSetInformationLookupFromFile() { + + DataSetInformationLookup dataSetInformationLookup = null; + LocalizationFile file = null; + String fileName = getDataSetInformationFileName(); + + try { + file = getLocalizationFile(fileName); + } catch (Exception e) { + statusHandler + .error(" Failed to read Data Set Information Lookup: " + fileName, e); + } + + if (file != null) { + try { + dataSetInformationLookup = readDataSetInformationXml(file.getFile()); + } catch (Exception e) { + statusHandler.handle( + Priority.PROBLEM, + "Failed to Read Data Set Information Lookup from file: " + + file.getName(), e); + } + } + + return dataSetInformationLookup; + } + + /** + * Availability Offset file name + * + * @param modelName + * @return + */ + private String getDataSetInformationFileName() { + return CONFIG_FILE_ROOT + CONFIG_FILE_DATASETINFO; + } + + /** + * Read Data Set Information lookup + * + * @param file + * @return + * @throws Exception + */ + private DataSetInformationLookup readDataSetInformationXml(File file) throws Exception { + + DataSetInformationLookup dsi = null; + + if (file != null && file.exists()) { + dsi = getJaxbManager().unmarshalFromXmlFile( + DataSetInformationLookup.class, file); + } + + return dsi; + } + + /** + * Modify or create a data set information lookup + * + * @param modelName + */ + public void modifyDataSetInformationLookup(DataSetInformation dsi) { + + try { + DataSetInformationLookup dataSetInformationLookup = null; + // update map and write out file + synchronized (dataSetInformations) { + + dataSetInformations.put(dsi.getModelName(), dsi); + dataSetInformationLookup = getDataSetInformationLookupFromFile(); + + if (dataSetInformationLookup == null) { + dataSetInformationLookup = new DataSetInformationLookup(); + } + + if (dataSetInformationLookup.getDataSetInformations().contains( + dsi)) { + // no changes + return; + } else { + // clear the hash and rebuild it with what is set in current + dataSetInformationLookup.getDataSetInformations().clear(); + + for (Entry entry : dataSetInformations + .entrySet()) { + dataSetInformationLookup.getDataSetInformations().add( + entry.getValue()); + } + } + } + + if (dataSetInformationLookup != null) { + dataSetInformationXmlWriter + .writeDataSetInformationXml(dataSetInformationLookup); + + statusHandler + .info("Updated/Created Data Set Information lookup! " + + dsi.getModelName()); + } + + } catch (Exception e) { + statusHandler.error( + "Couldn't create/update Data Set Information lookup! ", e); + } + } + + /** + * Does a availability offset lookup exist? + * + * @param modelName + * @return + */ + public boolean dataSetInformationLookupExists() { + + LocalizationFile file = null; + String fileName = getDataSetInformationFileName(); + try { + file = getLocalizationFile(fileName); + } catch (Exception fnfe) { + statusHandler.error( + "Failed to lookup Data Set Information localization file: " + + fileName, fnfe); + } + if (file != null) { + return file.exists(); + } + + return false; + } + + /** * param file name diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.retrieval/src/com/raytheon/uf/common/datadelivery/retrieval/xml/DataSetInformation.java b/edexOsgi/com.raytheon.uf.common.datadelivery.retrieval/src/com/raytheon/uf/common/datadelivery/retrieval/xml/DataSetInformation.java new file mode 100644 index 0000000000..2c64949b57 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.datadelivery.retrieval/src/com/raytheon/uf/common/datadelivery/retrieval/xml/DataSetInformation.java @@ -0,0 +1,118 @@ +package com.raytheon.uf.common.datadelivery.retrieval.xml; + +/** + * This software was developed and / or modified by Raytheon Company, + * pursuant to Contract DG133W-05-CQ-1067 with the US Government. + * + * U.S. EXPORT CONTROLLED TECHNICAL DATA + * This software product contains export-restricted data whose + * export/transfer/disclosure is restricted by U.S. law. Dissemination + * to non-U.S. persons whether in the United States or abroad requires + * an export license or other authorization. + * + * Contractor Name: Raytheon Company + * Contractor Address: 6825 Pine Street, Suite 340 + * Mail Stop B8 + * Omaha, NE 68106 + * 402.291.0100 + * + * See the AWIPS II Master Rights File ("Master Rights File.pdf") for + * further licensing information. + **/ + + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; +import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; + +/** + * Data Set Info XML Object. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Jan 14, 2014            dhladky      Initial creation.
+ * 
+ * 
+ * + * @author dhladky + * @version 1.0 + */ + +@XmlRootElement(name = "DataSetInformation") +@XmlAccessorType(XmlAccessType.NONE) +@DynamicSerialize +public class DataSetInformation { + + @XmlElement(name = "modelName", type = String.class) + @DynamicSerializeElement + protected String modelName; + + @XmlElement(name = "multiplier", type = Double.class) + @DynamicSerializeElement + protected Double multiplier; + + @XmlElement(name = "modelRunIncrement", type = Integer.class) + @DynamicSerializeElement + protected Integer modelRunIncrement; + + @XmlElement(name = "defaultOffset", type = Integer.class) + @DynamicSerializeElement + protected Integer defaultOffset; + + public DataSetInformation() { + + } + + public DataSetInformation(String modelName, Double multiplier, int modelRunIncrement, int defaultOffset) { + + this.modelName = modelName; + this.multiplier = multiplier; + this.modelRunIncrement = modelRunIncrement; + this.defaultOffset = defaultOffset; + } + + public String getModelName() { + return modelName; + } + + public void setModelName(String modelName) { + this.modelName = modelName; + } + + public Double getMultiplier() { + return multiplier; + } + + public void setMultiplier(Double multiplier) { + this.multiplier = multiplier; + } + + public Integer getModelRunIncrement() { + return modelRunIncrement; + } + + public void setModelRunIncrement(Integer modelRunIncrement) { + this.modelRunIncrement = modelRunIncrement; + } + + public Integer getDefaultOffset() { + return defaultOffset; + } + + public void setDefaultOffset(Integer defaultOffset) { + this.defaultOffset = defaultOffset; + } + + public int getRange() { + return (int) (getMultiplier() * getModelRunIncrement()); + } + +} diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.retrieval/src/com/raytheon/uf/common/datadelivery/retrieval/xml/DataSetInformationLookup.java b/edexOsgi/com.raytheon.uf.common.datadelivery.retrieval/src/com/raytheon/uf/common/datadelivery/retrieval/xml/DataSetInformationLookup.java new file mode 100644 index 0000000000..e2042bccd0 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.datadelivery.retrieval/src/com/raytheon/uf/common/datadelivery/retrieval/xml/DataSetInformationLookup.java @@ -0,0 +1,74 @@ +package com.raytheon.uf.common.datadelivery.retrieval.xml; + +/** + * This software was developed and / or modified by Raytheon Company, + * pursuant to Contract DG133W-05-CQ-1067 with the US Government. + * + * U.S. EXPORT CONTROLLED TECHNICAL DATA + * This software product contains export-restricted data whose + * export/transfer/disclosure is restricted by U.S. law. Dissemination + * to non-U.S. persons whether in the United States or abroad requires + * an export license or other authorization. + * + * Contractor Name: Raytheon Company + * Contractor Address: 6825 Pine Street, Suite 340 + * Mail Stop B8 + * Omaha, NE 68106 + * 402.291.0100 + * + * See the AWIPS II Master Rights File ("Master Rights File.pdf") for + * further licensing information. + **/ + + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElements; +import javax.xml.bind.annotation.XmlRootElement; + +import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; +import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; + +/** + * Data Set Lookup XML Object. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Jan 14, 2014            dhladky      Initial creation.
+ * 
+ * 
+ * + * @author dhladky + * @version 1.0 + */ + +@XmlRootElement(name = "DataSetInformationLookup") +@XmlAccessorType(XmlAccessType.NONE) +@DynamicSerialize +public class DataSetInformationLookup { + + public DataSetInformationLookup() { + dataSetInformations = new ArrayList(1); + } + + @XmlElements({ @XmlElement(name = "dataSetInformation", type = DataSetInformation.class) }) + @DynamicSerializeElement + private List dataSetInformations; + + public List getDataSetInformations() { + return dataSetInformations; + } + + public void setDataSetInformations(List dataSetInformations) { + this.dataSetInformations = dataSetInformations; + } + +} diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.harvester/utility/common_static/base/datadelivery/OPENDAPServiceConfig.xml b/edexOsgi/com.raytheon.uf.edex.datadelivery.harvester/utility/common_static/base/datadelivery/OPENDAPServiceConfig.xml index 1c895b1050..a652faedb8 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.harvester/utility/common_static/base/datadelivery/OPENDAPServiceConfig.xml +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.harvester/utility/common_static/base/datadelivery/OPENDAPServiceConfig.xml @@ -86,5 +86,8 @@ + + + \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/src/com/raytheon/uf/edex/datadelivery/retrieval/opendap/OpenDAPMetaDataParser.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/src/com/raytheon/uf/edex/datadelivery/retrieval/opendap/OpenDAPMetaDataParser.java index f1bd4d778e..6e6fefe754 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/src/com/raytheon/uf/edex/datadelivery/retrieval/opendap/OpenDAPMetaDataParser.java +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/src/com/raytheon/uf/edex/datadelivery/retrieval/opendap/OpenDAPMetaDataParser.java @@ -47,6 +47,7 @@ import com.raytheon.uf.common.datadelivery.registry.Provider.ServiceType; import com.raytheon.uf.common.datadelivery.registry.Time; import com.raytheon.uf.common.datadelivery.retrieval.util.HarvesterServiceManager; import com.raytheon.uf.common.datadelivery.retrieval.util.LookupManager; +import com.raytheon.uf.common.datadelivery.retrieval.xml.DataSetInformation; import com.raytheon.uf.common.datadelivery.retrieval.xml.ParameterConfig; import com.raytheon.uf.common.datadelivery.retrieval.xml.ParameterLookup; import com.raytheon.uf.common.gridcoverage.Corner; @@ -95,6 +96,7 @@ import dods.dap.DAS; * Sept 25, 2013 1797 dhladky separated time from gridded time * Oct 10, 2013 1797 bgonzale Refactored registry Time objects. * Dec 18, 2013 2636 mpduff Calculate a data availability delay for the dataset and dataset meta data. + * Jan 14, 2014 dhladky Data set info used for availability delay calculations. * * * @@ -261,21 +263,7 @@ class OpenDAPMetaDataParser extends MetaDataParser { time.setStepUnit(Time.findStepUnit(step.get(1)) .getDurationUnit()); gdsmd.setTime(time); - - // Calculate dataset availability delay - long startMillis = time.getStart().getTime(); - long now = TimeUtil.newGmtCalendar().getTimeInMillis(); - long offset = (now - startMillis) / TimeUtil.MILLIS_PER_MINUTE; - dataSet.setAvailabilityOffset((int) offset); - gdsmd.setAvailabilityOffset((int) offset); - - if (statusHandler.isPriorityEnabled(Priority.DEBUG)) { - statusHandler.debug("Dataset Name: " - + dataSet.getDataSetName()); - statusHandler.debug("StartTime: " + time.getStart()); - statusHandler.debug("Offset: " - + dataSet.getAvailabilityOffset()); - } + } catch (Exception le) { logParsingException(timecon, "Time", collectionName, url); } @@ -756,12 +744,54 @@ class OpenDAPMetaDataParser extends MetaDataParser { throw new IllegalStateException( "The time cannot be null for a DataSet object!"); } + + // Calculate dataset availability delay + DataSetInformation dsi = LookupManager.getInstance().getDataSetInformation(gdsmd.getDataSetName()); + long offset = 0l; + long startMillis = gdsmd.getTime().getStart().getTime(); + long endMillis = TimeUtil.newGmtCalendar().getTimeInMillis(); + + /** + * This is here for if no one has configured this particular model + * They are gross defaults and will not guarantee this model working + */ + if (dsi == null) { + Double multi = Double.parseDouble(serviceConfig + .getConstantValue("DEFAULT_MULTIPLIER")); + Integer runIncrement = Integer.parseInt(serviceConfig + .getConstantValue("DEFAULT_RUN_INCREMENT")); + Integer defaultOffest = Integer.parseInt(serviceConfig + .getConstantValue("DEFAULT_OFFSET")); + dsi = new DataSetInformation(gdsmd.getDataSetName(), multi, + runIncrement, defaultOffest); + // writes out a place holder DataSetInformation object in the file + LookupManager.getInstance().modifyDataSetInformationLookup(dsi); + } + + offset = (endMillis - startMillis) / TimeUtil.MILLIS_PER_MINUTE; + // this is the actually ranging check + if (dsi.getRange() < offset) { + offset = dsi.getDefaultOffset(); + } + dataSet.setAvailabilityOffset((int) offset); + gdsmd.setAvailabilityOffset((int) offset); + + if (statusHandler.isPriorityEnabled(Priority.DEBUG)) { + statusHandler.debug("Dataset Name: " + + dataSet.getDataSetName()); + statusHandler.debug("StartTime: " + gdsmd.getTime()); + statusHandler.debug("Offset: " + + dataSet.getAvailabilityOffset()); + } + List> toStore = metaDatas.get(dataSet); + if (toStore == null) { toStore = new ArrayList>(); metaDatas.put(dataSet, toStore); } + toStore.add(gdsmd); }