Issue #2858 - Implement NDM menus for ncep/hydro SPC

Peer review comments

Change-Id: Icbafa1e08ea9bc564c3f302715f527b92a5a55e5

Former-commit-id: 865ef97108 [formerly 9aa0b40ed5] [formerly b434ab5bb3 [formerly a74573fef8cc09ed15341d9873ae1dd2ba561478]]
Former-commit-id: b434ab5bb3
Former-commit-id: 693793eb92
This commit is contained in:
Mike Duff 2014-03-11 15:54:35 -05:00
parent 77e3f15d0b
commit 8c277c76f2
16 changed files with 969 additions and 149 deletions

View file

@ -27,18 +27,5 @@
menuText="Svr Wx Plot" id="spcWxPlot">
</contribute>
<contribute xsi:type="subMenu" menuText="SPC Convective Outlooks"
id="ncepHydro.spc.convectiveOutlooks">
<contribute xsi:type="separator" id="ncepHydro.spc.convectiveOutlooks.top" visible="false"/>
<contribute xsi:type="subinclude" fileName="menus/ncepHydro/spc/convectiveOutlooks.xml"/>
<contribute xsi:type="separator" id="ncepHydro.spc.convectiveOutlooks.bottom" visible="false"/>
</contribute>
<contribute xsi:type="subMenu" menuText="Fire Weather"
id="ncepHydro.spc.fireWeather">
<contribute xsi:type="separator" id="ncepHydro.spc.fireWeather.top" visible="false"/>
<contribute xsi:type="subinclude" fileName="menus/ncepHydro/spc/fireWeather.xml"/>
<contribute xsi:type="separator" id="ncepHydro.spc.fireWeather.bottom" visible="false"/>
</contribute>
<contribute xsi:type="subinclude" fileName="menus/spc/hazardMenus.xml"/>
</menuTemplate>

View file

@ -1,82 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
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.
-->
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="bundleItem" file="bundles/Redbook.xml"
menuText="Day 1 Convective Outlook" id="day1ConvectiveOutlook">
<substitute key="wmo" value="PGWE46"/>
<substitute key="posOff" value="0"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/Redbook.xml"
menuText="Day 2 Convective Outlook" id="day2ConvectiveOutlook">
<substitute key="wmo" value="PGWI47"/>
<substitute key="posOff" value="0"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/Redbook.xml"
menuText="Day 3 Convective Outlook" id="day3ConvectiveOutlook">
<substitute key="wmo" value="PGWK48"/>
<substitute key="posOff" value="0"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/Redbook.xml"
menuText="Thunderstorm Prob" id="thunderstormProb">
<substitute key="wmo" value="PGWB44"/>
<substitute key="posOff" value="0"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/Redbook.xml"
menuText="Severe Thunderstorm Prob" id="severeThunderstormProb">
<substitute key="wmo" value="PGWB45"/>
<substitute key="posOff" value="0"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/Redbook.xml"
menuText="Day 1 Hail outlook" id="day1Hailoutlook">
<substitute key="wmo" value="PENE00"/>
<substitute key="posOff" value="0"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/Redbook.xml"
menuText="Day 1 Convective Wind Outlook" id="day1ConvectiveWindOutlook">
<substitute key="wmo" value="PWNE00"/>
<substitute key="posOff" value="0"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/Redbook.xml"
menuText="Day 1 Tornado Outlook" id="day1TornadoOutlook">
<substitute key="wmo" value="PGNE00"/>
<substitute key="posOff" value="0"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/Redbook.xml"
menuText="Day 2 Combined Severe Outlook" id="day2CombinedSevereOutlook">
<substitute key="wmo" value="PGNI00"/>
<substitute key="posOff" value="0"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/Redbook.xml"
menuText="Day 3 Combined Severe Outlook" id="day3CombinedSevereOutlook">
<substitute key="wmo" value="PZNK00"/>
<substitute key="posOff" value="0"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/Redbook.xml"
menuText="Day 4-8 Composite Severe Outlook" id="day4to8CompositeSevereOutlook">
<substitute key="wmo" value="PGNM98"/>
<substitute key="posOff" value="0"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/Redbook.xml"
menuText="Active Mesoscale Disc Summary" id="activeMesoscaleDiscSummary">
<substitute key="wmo" value="PGNA00"/>
<substitute key="posOff" value="0"/>
</contribute>
</menuTemplate>

View file

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
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.
-->
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="bundleItem" file="bundles/Redbook.xml"
menuText="Fire Wx Outlook - Day 1" id="fireWxOutlookDay1">
<substitute key="wmo" value="PMWE98"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/Redbook.xml"
menuText="Fire Wx Outlook - Day 2" id="fireWxOutlookDay2">
<substitute key="wmo" value="PMWI98"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/Redbook.xml"
menuText="Fire Wx Outlook - Day 3-8" id="fireWxOutlookDay3to8">
<substitute key="wmo" value="PGNO98"/>
</contribute>
</menuTemplate>

View file

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<menuTemplate>
<contribute xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="subMenu" menuText="SPC Convective Outlooks" id="ncepHydro.spc.convectiveOutlooks">
<contribute xsi:type="bundleItem" useReferenceTime="true" file="bundles/Redbook.xml" menuText="Day 1 Convective Outlook" timeQuery="true" id="day1ConvectiveOutlook">
<substitute value="PGWE46" key="wmo"/>
<substitute value="0" key="posOff"/>
</contribute>
<contribute xsi:type="bundleItem" useReferenceTime="true" file="bundles/Redbook.xml" menuText="Day 2 Convective Outlook" timeQuery="true" id="day2ConvectiveOutlook">
<substitute value="PGWI47" key="wmo"/>
<substitute value="0" key="posOff"/>
</contribute>
<contribute xsi:type="bundleItem" useReferenceTime="true" file="bundles/Redbook.xml" menuText="Day 3 Convective Outlook" timeQuery="true" id="day3ConvectiveOutlook">
<substitute value="PGWK48" key="wmo"/>
<substitute value="0" key="posOff"/>
</contribute>
<contribute xsi:type="bundleItem" useReferenceTime="true" file="bundles/Redbook.xml" menuText="Thunderstorm Prob" timeQuery="true" id="thunderstormProb">
<substitute value="PGWB44" key="wmo"/>
<substitute value="0" key="posOff"/>
</contribute>
<contribute xsi:type="bundleItem" useReferenceTime="true" file="bundles/Redbook.xml" menuText="Severe Thunderstorm Prob" timeQuery="true" id="severeThunderstormProb">
<substitute value="PGWB45" key="wmo"/>
<substitute value="0" key="posOff"/>
</contribute>
<contribute xsi:type="bundleItem" useReferenceTime="true" file="bundles/Redbook.xml" menuText="Day 1 Hail outlook" timeQuery="true" id="day1Hailoutlook">
<substitute value="PENE00" key="wmo"/>
<substitute value="0" key="posOff"/>
</contribute>
<contribute xsi:type="bundleItem" useReferenceTime="true" file="bundles/Redbook.xml" menuText="Day 1 Convective Wind Outlook" timeQuery="true" id="day1ConvectiveWindOutlook">
<substitute value="PWNE00" key="wmo"/>
<substitute value="0" key="posOff"/>
</contribute>
<contribute xsi:type="bundleItem" useReferenceTime="true" file="bundles/Redbook.xml" menuText="Day 1 Tornado Outlook" timeQuery="true" id="day1TornadoOutlook">
<substitute value="PGNE00" key="wmo"/>
<substitute value="0" key="posOff"/>
</contribute>
<contribute xsi:type="bundleItem" useReferenceTime="true" file="bundles/Redbook.xml" menuText="Day 2 Combined Severe Outlook" timeQuery="true" id="day2CombinedSevereOutlook">
<substitute value="PGNI00" key="wmo"/>
<substitute value="0" key="posOff"/>
</contribute>
<contribute xsi:type="bundleItem" useReferenceTime="true" file="bundles/Redbook.xml" menuText="Day 3 Combined Severe Outlook" timeQuery="true" id="day3CombinedSevereOutlook">
<substitute value="PZNK00" key="wmo"/>
<substitute value="0" key="posOff"/>
</contribute>
<contribute xsi:type="bundleItem" useReferenceTime="true" file="bundles/Redbook.xml" menuText="Day 4-8 Composite Severe Outlook" timeQuery="true" id="day4to8CompositeSevereOutlook">
<substitute value="PGNM98" key="wmo"/>
<substitute value="0" key="posOff"/>
</contribute>
<contribute xsi:type="bundleItem" useReferenceTime="true" file="bundles/Redbook.xml" menuText="Active Mesoscale Disc Summary" timeQuery="true" id="activeMesoscaleDiscSummary">
<substitute value="PGNA00" key="wmo"/>
<substitute value="0" key="posOff"/>
</contribute>
</contribute>
<contribute xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="subMenu" menuText="Fire Weather" id="ncepHydro.spc.fireWeather">
<contribute xsi:type="bundleItem" useReferenceTime="true" file="bundles/Redbook.xml" menuText="Fire Wx Outlook - Day 1" timeQuery="true" id="fireWxOutlookDay1">
<substitute value="PMWE98" key="wmo"/>
</contribute>
<contribute xsi:type="bundleItem" useReferenceTime="true" file="bundles/Redbook.xml" menuText="Fire Wx Outlook - Day 2" timeQuery="true" id="fireWxOutlookDay2">
<substitute value="PMWI98" key="wmo"/>
</contribute>
<contribute xsi:type="bundleItem" useReferenceTime="true" file="bundles/Redbook.xml" menuText="Fire Wx Outlook - Day 3-8" timeQuery="true" id="fireWxOutlookDay3to82">
<substitute value="PGNO98" key="wmo"/>
</contribute>
</contribute>
</menuTemplate>

View file

@ -0,0 +1,4 @@
This folder contains sample NDM files.
Dropping RedbookHazardMenus.xml into the /awips2/edex/data/ndm directory will generate an override of the SPC hazards menu.
RedbookHazardMenus.xml as written here will generate the base version of the SPC hazard menus.

View file

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
This file is the A2 NDM replacement for redbookHazardMenus.txt.
Dropping RedbookHazardMenus.xml into the /awips2/edex/data/ndm directory
will generate an override of the SPC hazards menu.
RedbookHazardMenus.xml as written here will generate the base version
of the SPC hazard menus.
-->
<redbookHazardMenu>
<subMenu name="SPC Convective Outlooks" id="ncepHydro.spc.convectiveOutlooks">
<button type="product" menuText="Day 1 Convective Outlook" id="day1ConvectiveOutlook">
<!-- Redbook Key: 5069 -->
<substitute key="wmo" value="PGWE46"/>
<substitute key="posOff" value="0"/>
</button>
<button type="product" menuText="Day 2 Convective Outlook" id="day2ConvectiveOutlook">
<!-- Redbook Key: 5072 -->
<substitute key="wmo" value="PGWI47"/>
<substitute key="posOff" value="0"/>
</button>
<button type="product" menuText="Day 3 Convective Outlook" id="day3ConvectiveOutlook">
<!-- Redbook Key: 5385 -->
<substitute key="wmo" value="PGWK48"/>
<substitute key="posOff" value="0"/>
</button>
<button type="product" menuText="Thunderstorm Prob" id="thunderstormProb">
<!-- Redbook Key: 5067 -->
<substitute key="wmo" value="PGWB44"/>
<substitute key="posOff" value="0"/>
</button>
<button type="product" menuText="Severe Thunderstorm Prob" id="severeThunderstormProb">
<!-- Redbook Key: 5068 -->
<substitute key="wmo" value="PGWB45"/>
<substitute key="posOff" value="0"/>
</button>
<button type="product" menuText="Day 1 Hail outlook" id="day1Hailoutlook">
<!-- Redbook Key: 5376 -->
<substitute key="wmo" value="PENE00"/>
<substitute key="posOff" value="0"/>
</button>
<button type="product" menuText="Day 1 Convective Wind Outlook" id="day1ConvectiveWindOutlook">
<!-- Redbook Key: 5377 -->
<substitute key="wmo" value="PWNE00"/>
<substitute key="posOff" value="0"/>
</button>
<button type="product" menuText="Day 1 Tornado Outlook" id="day1TornadoOutlook">
<!-- Redbook Key: 5378 -->
<substitute key="wmo" value="PGNE00"/>
<substitute key="posOff" value="0"/>
</button>
<button type="product" menuText="Day 2 Combined Severe Outlook" id="day2CombinedSevereOutlook">
<!-- Redbook Key: 5379 -->
<substitute key="wmo" value="PGNI00"/>
<substitute key="posOff" value="0"/>
</button>
<button type="product" menuText="Day 3 Combined Severe Outlook" id="day3CombinedSevereOutlook">
<!-- Redbook Key: 5384 -->
<substitute key="wmo" value="PZNK00"/>
<substitute key="posOff" value="0"/>
</button>
<button type="product" menuText="Day 4-8 Composite Severe Outlook" id="day4to8CompositeSevereOutlook">
<!-- Redbook Key: 5430 -->
<substitute key="wmo" value="PGNM98"/>
<substitute key="posOff" value="0"/>
</button>
<button type="product" menuText="Active Mesoscale Disc Summary" id="activeMesoscaleDiscSummary">
<!-- Redbook Key: 5390 -->
<substitute key="wmo" value="PGNA00"/>
<substitute key="posOff" value="0"/>
</button>
</subMenu>
<subMenu name="Fire Weather" id="ncepHydro.spc.fireWeather">
<button type="product" menuText="Fire Wx Outlook - Day 1" id="fireWxOutlookDay1">
<!-- Redbook Key: 5370 -->
<substitute key="wmo" value="PMWE98"/>
</button>
<button type="product" menuText="Fire Wx Outlook - Day 2" id="fireWxOutlookDay2">
<!-- Redbook Key: 5371 -->
<substitute key="wmo" value="PMWI98"/>
</button>
<button type="product" A1Id="5431" menuText="Fire Wx Outlook - Day 3-8" id="fireWxOutlookDay3to82">
<!-- Redbook Key: 5431 -->
<substitute key="wmo" value="PGNO98"/>
</button>
</subMenu>
</redbookHazardMenu>

View file

@ -9,7 +9,9 @@ Require-Bundle: com.raytheon.edex.common,
com.raytheon.uf.edex.decodertools;bundle-version="1.0.0",
javax.persistence,
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.14.0",
com.raytheon.uf.edex.menus;bundle-version="1.0.0"
Export-Package: com.raytheon.edex.plugin.redbook,
com.raytheon.edex.plugin.redbook.common,
com.raytheon.edex.plugin.redbook.common.blocks,

View file

@ -13,6 +13,13 @@
<constructor-arg value="jms-durable:queue:Ingest.redbook"/>
</bean>
<bean id="spcMenuListener" class="com.raytheon.edex.plugin.redbook.ingest.RedbookMenuSubscriber"/>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="RedbookHazardMenus.xml" />
<constructor-arg ref="spcMenuListener" />
</bean>
<!--
<bean id="redbookCamelRegistered" factory-bean="contextManager"
factory-method="register" depends-on="persistCamelRegistered">

View file

@ -0,0 +1,187 @@
/**
* 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.
**/
package com.raytheon.edex.plugin.redbook.ingest;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import com.raytheon.edex.plugin.redbook.ingest.xml.ButtonXML;
import com.raytheon.edex.plugin.redbook.ingest.xml.RedbookHazardMenusXML;
import com.raytheon.edex.plugin.redbook.ingest.xml.SubmenuXML;
import com.raytheon.edex.plugin.redbook.ingest.xml.SubstituteXML;
import com.raytheon.uf.common.menus.xml.CommonBundleMenuContribution;
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.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.edex.menus.AbstractMenuUtil;
/**
* Builds the NCEP/Hydro SPC menu contributions for NDM (Redbook hazards).
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 7, 2014 2858 mpduff Initial creation
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
public class RedbookHazardsMenuUtil extends AbstractMenuUtil {
/** Status handler */
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(RedbookHazardsMenuUtil.class);
/** Menu type constant */
private static final String MENU_TYPE = "spc";
/** SPC hazard menu file */
private static final String HAZARD_MENU = "hazardMenus.xml";
/** Redbook bundle file */
private static final String BUNDLE_FILE = "bundles/Redbook.xml";
/** Redbook SPC hazard menu xml object */
private RedbookHazardMenusXML xml;
/** Jaxb unmarshaller */
private Unmarshaller unmarshaller;
/**
* Constructor.
*/
public RedbookHazardsMenuUtil() {
createContext();
}
/**
* {@inheritDoc}
*/
@Override
public void createMenus(String filename) {
xml = read(filename);
createMenus();
}
/**
* Create the JAXB context
*/
private void createContext() {
Class[] classes = new Class[] { SubmenuXML.class, SubstituteXML.class,
ButtonXML.class, RedbookHazardMenusXML.class };
try {
JAXBContext jax = JAXBContext.newInstance(classes);
this.unmarshaller = jax.createUnmarshaller();
} catch (JAXBException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
}
}
/**
* Read the xml file.
*
* @param filename
* fully qualified file name to read.
*
* @return The xml object
*/
private RedbookHazardMenusXML read(String filename) {
RedbookHazardMenusXML xml = null;
File f = new File(filename);
try {
xml = (RedbookHazardMenusXML) unmarshaller.unmarshal(f);
} catch (JAXBException e) {
statusHandler.handle(Priority.PROBLEM, "Error unmarshalling "
+ filename, e);
}
return xml;
}
/**
* {@inheritDoc}
*/
@Override
public void createMenus() {
MenuTemplateFile menuTemplate = new MenuTemplateFile();
List<CommonSubmenuContribution> submenuList = new ArrayList<CommonSubmenuContribution>();
for (SubmenuXML submenu : xml.getSubMenus()) {
CommonSubmenuContribution subMenuContribution = new CommonSubmenuContribution();
List<CommonBundleMenuContribution> commonBundleMenuContributions = new ArrayList<CommonBundleMenuContribution>();
subMenuContribution.menuText = submenu.getName();
subMenuContribution.id = submenu.getId();
List<ButtonXML> buttonList = submenu.getButtonList();
for (ButtonXML button : buttonList) {
CommonBundleMenuContribution commonBundleMenuContribution = new CommonBundleMenuContribution();
commonBundleMenuContribution.bundleFile = BUNDLE_FILE;
commonBundleMenuContribution.id = button.getId();
commonBundleMenuContribution.text = button.getMenuText();
List<VariableSubstitution> subList = new ArrayList<VariableSubstitution>();
for (int i = 0; i < button.getSubstitutionList().size(); i++) {
SubstituteXML sub = button.getSubstitutionList().get(i);
VariableSubstitution var = new VariableSubstitution();
var.key = sub.getKey();
var.value = sub.getValue();
subList.add(var);
}
commonBundleMenuContribution.substitutions = subList
.toArray(new VariableSubstitution[subList.size()]);
commonBundleMenuContributions.add(commonBundleMenuContribution);
}
subMenuContribution.contributions = commonBundleMenuContributions
.toArray(new CommonBundleMenuContribution[commonBundleMenuContributions
.size()]);
submenuList.add(subMenuContribution);
}
menuTemplate.contributions = submenuList
.toArray(new CommonSubmenuContribution[submenuList.size()]);
toXml(menuTemplate, "menus" + File.separator + MENU_TYPE
+ File.separator + HAZARD_MENU);
}
/**
* {@inheritDoc}
*/
@Override
protected boolean checkCreated() {
return super.checkCreated(HAZARD_MENU, MENU_TYPE);
}
}

View file

@ -0,0 +1,66 @@
/**
* 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.
**/
package com.raytheon.edex.plugin.redbook.ingest;
import java.io.File;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.edex.ndm.ingest.INationalDatasetSubscriber;
/**
* Redbook menu subscriber. Takes redbook menu files and passes them to the
* correct menu generators.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 10, 2014 2858 mpduff Initial creation.
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
public class RedbookMenuSubscriber implements INationalDatasetSubscriber {
/** Status handler */
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(RedbookMenuSubscriber.class);
/** Hazard menu file */
private static final String HAZARD_MENU_FILE = "RedbookHazardMenus.xml";
/**
* {@inheritDoc}
*/
@Override
public void notify(String fileName, File file) {
statusHandler.info("Processing " + fileName);
if (HAZARD_MENU_FILE.equals(fileName)) {
// Convert input file to output menu format
RedbookHazardsMenuUtil menuUtil = new RedbookHazardsMenuUtil();
menuUtil.createMenus(file.getAbsolutePath());
}
}
}

View file

@ -0,0 +1,181 @@
/**
* 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.
**/
package com.raytheon.edex.plugin.redbook.ingest.xml;
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.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
/**
* Button type xml object.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 07, 2014 2858 mpduff Initial creation
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
public class ButtonXML {
/**
* Button type
*/
@XmlAttribute(name = "type")
protected String type;
/**
* Awips 1 id
*/
@XmlAttribute(name = "A1Id")
protected String a1Id;
/**
* The menu text
*/
@XmlAttribute(name = "menuText")
protected String menuText;
/**
* A unique id for the menu
*/
@XmlAttribute(name = "id")
protected String id;
/**
* List of substitution items
*/
@XmlElements({ @XmlElement(name = "substitute", type = SubstituteXML.class) })
protected List<SubstituteXML> substitutionList = new ArrayList<SubstituteXML>();
/**
* Default constructor
*/
public ButtonXML() {
}
/**
* @return the type
*/
public String getType() {
return type;
}
/**
* @param type
* the type to set
*/
public void setType(String type) {
this.type = type;
}
/**
* @return the a1Id
*/
public String getA1Id() {
return a1Id;
}
/**
* @param a1Id
* the a1Id to set
*/
public void setA1Id(String a1Id) {
this.a1Id = a1Id;
}
/**
* @return the menuText
*/
public String getMenuText() {
return menuText;
}
/**
* @param menuText
* the menuText to set
*/
public void setMenuText(String menuText) {
this.menuText = menuText;
}
/**
* @return the id
*/
public String getId() {
return id;
}
/**
* @param id
* the id to set
*/
public void setId(String id) {
this.id = id;
}
/**
* @return the substitutionList
*/
public List<SubstituteXML> getSubstitutionList() {
return substitutionList;
}
/**
* @param substitutionList
* the substitutionList to set
*/
public void setSubstitutionList(List<SubstituteXML> substitutionList) {
this.substitutionList = substitutionList;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
final String nl = System.getProperty("line.separator");
StringBuilder sb = new StringBuilder();
sb.append(" A1Id: ").append(this.getA1Id()).append(nl);
sb.append(" ID: ").append(this.getId()).append(nl);
sb.append(" Text: ").append(this.getMenuText()).append(nl);
sb.append(" Type: ").append(this.getType()).append(nl);
for (SubstituteXML xml : substitutionList) {
sb.append(xml.toString());
}
return sb.toString();
}
}

View file

@ -0,0 +1,93 @@
/**
* 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.
**/
package com.raytheon.edex.plugin.redbook.ingest.xml;
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;
/**
* NDM Redbook hazard menu xml object.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 07, 2014 2858 mpduff Initial creation
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
@XmlRootElement(name = "redbookHazardMenu")
@XmlAccessorType(XmlAccessType.NONE)
public class RedbookHazardMenusXML {
/**
* Submenus
*/
@XmlElements({ @XmlElement(name = "subMenu", type = SubmenuXML.class) })
protected List<SubmenuXML> subMenus = new ArrayList<SubmenuXML>();
/**
* Default constructor
*/
public RedbookHazardMenusXML() {
}
/**
* @return the subMenus
*/
public List<SubmenuXML> getSubMenus() {
return subMenus;
}
/**
* @param subMenus
* the subMenus to set
*/
public void setSubMenus(List<SubmenuXML> subMenus) {
this.subMenus = subMenus;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
for (SubmenuXML sub : subMenus) {
sb.append(sub.toString());
}
return sb.toString();
}
}

View file

@ -0,0 +1,128 @@
/**
* 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.
**/
package com.raytheon.edex.plugin.redbook.ingest.xml;
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.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
/**
* Redbook hazard submenu object.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 07, 2014 2858 mpduff Initial creation
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
public class SubmenuXML {
/**
* Submenu text
*/
@XmlAttribute(name = "name")
protected String name;
/**
* Submenu unique id
*/
@XmlAttribute(name = "id")
protected String id;
/**
* List of menu items (buttons) for the submenu
*/
@XmlElements({ @XmlElement(name = "button", type = ButtonXML.class) })
protected List<ButtonXML> buttonList = new ArrayList<ButtonXML>();
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name
* the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the buttonList
*/
public List<ButtonXML> getButtonList() {
return buttonList;
}
/**
* @param buttonList
* the buttonList to set
*/
public void setButtonList(List<ButtonXML> buttonList) {
this.buttonList = buttonList;
}
/**
* @return the id
*/
public String getId() {
return id;
}
/**
* @param id
* the id to set
*/
public void setId(String id) {
this.id = id;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
final String nl = System.getProperty("line.separator");
StringBuilder sb = new StringBuilder();
sb.append("Submenu Name: ").append(this.name).append(nl);
for (ButtonXML xml : this.buttonList) {
sb.append(xml.toString());
}
return sb.toString();
}
}

View file

@ -0,0 +1,97 @@
/**
* 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.
**/
package com.raytheon.edex.plugin.redbook.ingest.xml;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
/**
* Redbook hazard substitute object.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 07, 2014 2858 mpduff Initial creation
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
public class SubstituteXML {
/** Substitute key */
@XmlAttribute(name = "key")
protected String key;
/** Substitute value */
@XmlAttribute(name = "value")
protected String value;
/**
* @return the key
*/
public String getKey() {
return key;
}
/**
* @param key
* the key to set
*/
public void setKey(String key) {
this.key = key;
}
/**
* @return the value
*/
public String getValue() {
return value;
}
/**
* @param value
* the value to set
*/
public void setValue(String value) {
this.value = value;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
final String nl = System.getProperty("line.separator");
StringBuilder sb = new StringBuilder();
sb.append(" Key: ").append(this.key).append(nl);
sb.append(" Value: ").append(this.value).append(nl);
return sb.toString();
}
}

View file

@ -40,7 +40,7 @@ import com.raytheon.uf.common.status.UFStatus;
/**
*
* Abstract class for generting menu files
* Abstract class for generating menu files
*
* <pre>
*
@ -48,7 +48,8 @@ import com.raytheon.uf.common.status.UFStatus;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 8, 2012 mschenke Initial javadoc creation
* Nov 08, 2012 mschenke Initial javadoc creation
* Mar 11, 2014 2858 mpduff javadoc updates
*
* </pre>
*
@ -56,7 +57,7 @@ import com.raytheon.uf.common.status.UFStatus;
* @version 1.0
*/
public abstract class AbstractMenuUtil {
private static final transient IUFStatusHandler statusHandler = UFStatus
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(AbstractMenuUtil.class);
private final PathManager pm = (PathManager) PathManagerFactory
@ -70,6 +71,9 @@ public abstract class AbstractMenuUtil {
private String site = null;
/**
* Create the menu contribution xml.
*/
public abstract void createMenus();
/**
@ -93,7 +97,10 @@ public abstract class AbstractMenuUtil {
* Convert menu objects to xml and writes them to disk
*
* @param object
* The object to marshal
*
* @param path
* The path
*/
public void toXml(Object object, String path) {
try {
@ -107,17 +114,13 @@ public abstract class AbstractMenuUtil {
if (!file.getFile().exists()) {
file.getFile().getParentFile().mkdirs();
}
// if (file.exists()) {
// statusHandler.info("Did not need to create the menu : "
// + file.getName());
// return;
// }
marshaller.marshal(object, pm.getFile(caveConfigured, path));
file.save();
} catch (JAXBException e) {
statusHandler.error("Unable to process the menu", e);
statusHandler.error("Unable to process the menu: " + path, e);
} catch (LocalizationOpFailedException e) {
statusHandler.error("Unable to process the menu", e);
statusHandler.error("Unable to process the menu: " + path, e);
}
}
@ -132,6 +135,16 @@ public abstract class AbstractMenuUtil {
return object;
}
/**
* Unmarshal an xml file.
*
* @param path
* The path of the file
* @param lContext
* The localization context
*
* @return The xml object
*/
public Object fromXml(String path, LocalizationContext lContext) {
Object object = null;
try {
@ -142,17 +155,26 @@ public abstract class AbstractMenuUtil {
object = unmarshaller.unmarshal(file.getFile());
}
} catch (JAXBException e) {
e.printStackTrace();
statusHandler.error("Error unmarshalling " + path, e);
}
return object;
}
/**
* Check to see whether the menu creator needs to be run
*
* @return true if it needs to be run
*/
protected abstract boolean checkCreated();
/**
* Check to see whether the menu creator needs to be run
*
* @return
* @param fileName
* @param type
*
* @return true if it needs to be run
*/
public boolean checkCreated(String fileName, String type) {
LocalizationContext context = pm.getContextForSite(
@ -180,13 +202,14 @@ public abstract class AbstractMenuUtil {
statusHandler.error("Error saving menu creation time file", e);
}
return false;
} else {
statusHandler.info("Timestamp in " + fileName
+ " was before timestamp in ." + type + "MenuTime");
statusHandler.info("Menus already created for site " + getSite()
+ " for " + type);
return true;
}
statusHandler.info("Timestamp in " + fileName
+ " was before timestamp in ." + type + "MenuTime");
statusHandler.info("Menus already created for site " + getSite()
+ " for " + type);
return true;
}
/**

View file

@ -32,6 +32,7 @@ import java.io.File;
* ------------ ---------- ----------- --------------------------
* Jan 05, 2011 bfarmer Initial creation
* Mar 06, 2014 2876 mpduff New NDM plugin.
* Mar 11, 2014 2858 mpduff javadoc update.
*
* </pre>
*
@ -40,5 +41,13 @@ import java.io.File;
*/
public interface INationalDatasetSubscriber {
/**
* Called when a new file is found in NDM.
*
* @param fileName
* The filename
* @param file
* The file object
*/
public void notify(String fileName, File file);
}