From 090d5f3d3b1bacf90997e64a6be98983d30b951e Mon Sep 17 00:00:00 2001 From: Steve Harris Date: Wed, 23 Jan 2013 11:24:17 -0500 Subject: [PATCH] 13.2.1-3 baseline Former-commit-id: 2b6ac028bd5ff3d43dec61cb3d060d7c7d05e66d [formerly a5a0da5c024a3580db1515b728287df2aa828894 [formerly 7435527b2565fc3f4db5908aaaa3edcfba99f001] [formerly 2b6ac028bd5ff3d43dec61cb3d060d7c7d05e66d [formerly ba03739c3528638c5383528fd64674ae5af1ed64]]] Former-commit-id: a5a0da5c024a3580db1515b728287df2aa828894 [formerly 7435527b2565fc3f4db5908aaaa3edcfba99f001] Former-commit-id: a5a0da5c024a3580db1515b728287df2aa828894 Former-commit-id: 7d2e979c51c8d64fe18b5bb4d554172f44414395 --- .../DefaultRadarFourPanelBlendedBestRes.xml | 16 +- .../cave/etc/menus/upperair/baseUSEastern.xml | 2 +- .../viz/gfe/actions/ShowISCGridsAction.java | 70 +++-- .../viz/gfe/core/msgs/ShowISCGridsMsg.java | 23 +- .../menus/radar/baseTerminal4Panel.xml | 180 ++++++++++- .../dialogs/AlarmDisplayWindow.java | 7 +- .../texteditor/dialogs/TextEditorDialog.java | 7 +- .../viz/texteditor/print/PrintDisplay.java | 33 +- .../base/config/gfe/serverConfig.py | 2 +- .../plugin/gfe/isc/GfeScriptExecutor.java | 2 +- ...f.common.serialization.ISerializableObject | 3 +- .../res/spring/shef-ingest.xml | 4 +- .../shef/AbstractShefTransformer.java | 2 +- .../transform/shef/MetarToShefFilter.java | 286 ++++++++++++++++++ .../edex/transform/shef/MetarToShefRun.java | 150 +++++++++ .../shef/MetarToShefTransformer.java | 26 +- .../transform/shef/obs/ObsToSHEFOptions.java | 23 +- .../pypies/pypies/impl/H5pyDataStore.py | 4 + rpms/awips2.core/Installer.ldm/component.spec | 2 +- 19 files changed, 754 insertions(+), 88 deletions(-) create mode 100644 edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/transform/shef/MetarToShefFilter.java create mode 100644 edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/transform/shef/MetarToShefRun.java diff --git a/cave/build/static/common/cave/etc/bundles/DefaultRadarFourPanelBlendedBestRes.xml b/cave/build/static/common/cave/etc/bundles/DefaultRadarFourPanelBlendedBestRes.xml index 6806261a7d..c845de5067 100644 --- a/cave/build/static/common/cave/etc/bundles/DefaultRadarFourPanelBlendedBestRes.xml +++ b/cave/build/static/common/cave/etc/bundles/DefaultRadarFourPanelBlendedBestRes.xml @@ -85,7 +85,7 @@ + constraintType="BETWEEN" /> @@ -119,7 +119,7 @@ + constraintType="BETWEEN" /> @@ -173,7 +173,7 @@ + constraintType="BETWEEN" /> @@ -207,7 +207,7 @@ + constraintType="BETWEEN" /> @@ -256,7 +256,7 @@ + constraintType="BETWEEN" /> @@ -290,7 +290,7 @@ + constraintType="BETWEEN" /> @@ -344,7 +344,7 @@ + constraintType="BETWEEN" /> @@ -378,7 +378,7 @@ + constraintType="BETWEEN" /> diff --git a/cave/build/static/common/cave/etc/menus/upperair/baseUSEastern.xml b/cave/build/static/common/cave/etc/menus/upperair/baseUSEastern.xml index 5957f707ce..5db3590ee1 100644 --- a/cave/build/static/common/cave/etc/menus/upperair/baseUSEastern.xml +++ b/cave/build/static/common/cave/etc/menus/upperair/baseUSEastern.xml @@ -110,7 +110,7 @@ diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowISCGridsAction.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowISCGridsAction.java index b4c634ff0f..d969901054 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowISCGridsAction.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowISCGridsAction.java @@ -20,6 +20,8 @@ package com.raytheon.viz.gfe.actions; +import java.util.Map; + import com.raytheon.viz.gfe.Activator; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; @@ -29,9 +31,8 @@ import org.eclipse.jface.resource.ImageDescriptor; import com.raytheon.viz.gfe.core.msgs.Message; import com.raytheon.viz.gfe.core.msgs.ShowISCGridsMsg; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.ToolItem; +import org.eclipse.ui.commands.IElementUpdater; +import org.eclipse.ui.menus.UIElement; /** * Action to show the ISC grids @@ -44,44 +45,47 @@ import org.eclipse.swt.widgets.ToolItem; * ------------ ---------- ----------- -------------------------- * 07/20/09 1995 bphillip Initial release * 12/06/12 DR 15574 jzeng Change the image of - * the icon when it is activated - * 01/11/13 DR 15574 jzeng delete all fields to local variables + * the icon when it is activated + * 01/11/13 DR 15574 jzeng Change all fields to local variables + * 01/16/13 DR 15722 jzeng/randerson override updateElement() * * * @author bphillip * @version 1 */ -public class ShowISCGridsAction extends AbstractHandler { +public class ShowISCGridsAction extends AbstractHandler implements + IElementUpdater { - @Override + + @Override public Object execute(ExecutionEvent arg0) throws ExecutionException { - boolean current = Message.inquireLastMessage(ShowISCGridsMsg.class).show(); - - if (arg0.getTrigger() instanceof Event) { - Event e = (Event) arg0.getTrigger(); - if ( e.widget instanceof ToolItem) { - ToolItem ti = (ToolItem) e.widget; - if (ti != null ){ - ImageDescriptor id; - - if (!current){ - id = Activator.imageDescriptorFromPlugin( - Activator.PLUGIN_ID, "icons/isc1.gif" ); - } else { - id = Activator.imageDescriptorFromPlugin( - Activator.PLUGIN_ID, "icons/isc0.gif" ); - } - - if (id != null){ - Image img = id.createImage(); - ti.setImage(img); - img.dispose(); - } - } - } - } - + boolean current = Message.inquireLastMessage(ShowISCGridsMsg.class) + .show(); + + new ShowISCGridsMsg(!current).send(); return null; + + } + + @Override + public void updateElement(UIElement element, + @SuppressWarnings("rawtypes") Map parameters) { + + boolean current = Message.inquireLastMessage(ShowISCGridsMsg.class) + .show(); + + ImageDescriptor id; + if (current) { + id = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, + "icons/isc1.gif"); + } else { + id = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, + "icons/isc0.gif"); + } + + if (id != null) { + element.setIcon(id); + } } } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/msgs/ShowISCGridsMsg.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/msgs/ShowISCGridsMsg.java index 7ac8c57e58..2d185a1d67 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/msgs/ShowISCGridsMsg.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/msgs/ShowISCGridsMsg.java @@ -19,6 +19,9 @@ **/ package com.raytheon.viz.gfe.core.msgs; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.commands.ICommandService; + /** * TODO Add Description * @@ -26,9 +29,12 @@ package com.raytheon.viz.gfe.core.msgs; * * SOFTWARE HISTORY * - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * Mar 30, 2011 randerso Initial creation + * Date Ticket# Engineer Description + * ------------ ---------- ---------------- -------------------------- + * 03/30/11 randerso Initial creation + * 01/16/13 DR15722 jzeng/randerso override send() to + * force the UI to update the button + * whenever the message is sent. * * * @@ -50,4 +56,15 @@ public class ShowISCGridsMsg extends Message { public boolean show() { return showIscGrids; } + + @Override + public void send() { + super.send(); + + ICommandService service = (ICommandService) PlatformUI.getWorkbench() + .getService(ICommandService.class); + service.refreshElements("com.raytheon.viz.gfe.actions.showISCGrids", + null); + } + } diff --git a/cave/com.raytheon.viz.radar/localization/menus/radar/baseTerminal4Panel.xml b/cave/com.raytheon.viz.radar/localization/menus/radar/baseTerminal4Panel.xml index b6a428a02d..ab46a9fb59 100644 --- a/cave/com.raytheon.viz.radar/localization/menus/radar/baseTerminal4Panel.xml +++ b/cave/com.raytheon.viz.radar/localization/menus/radar/baseTerminal4Panel.xml @@ -23,6 +23,46 @@ id="${icao}fourPanel"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/alarmalert/dialogs/AlarmDisplayWindow.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/alarmalert/dialogs/AlarmDisplayWindow.java index 4a23cdd9c7..16200b88cf 100644 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/alarmalert/dialogs/AlarmDisplayWindow.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/alarmalert/dialogs/AlarmDisplayWindow.java @@ -60,8 +60,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * uses the font. * Feb 03, 2012 14317 mhuang Make alarm display window wider * Sep 6, 2012 13365 rferrel Accumulate and Display fix. - * Sep 25, 2012 1196 lvenable Dialog refactor for AlarmDisplayWindow. Added DO_NOT_BLOCK. - * Dec 31, 2012 15651 mgamazaychikov Added an argument to re-factored PrintDisplay.print + * Sep 25, 2012 1196 lvenable Dialog refactor for AlarmDisplayWindow.Added DO_NOT_BLOCK. * * * @@ -199,7 +198,7 @@ public class AlarmDisplayWindow extends CaveSWTDialog { } PrintDisplay.print(lines.toString(), text.getFont() - .getFontData()[0], -1, UFStatus + .getFontData()[0], UFStatus .getHandler(AlarmDisplayWindow.class)); } }); @@ -208,7 +207,7 @@ public class AlarmDisplayWindow extends CaveSWTDialog { @Override public void widgetSelected(SelectionEvent event) { PrintDisplay.print(text.getText(), - text.getFont().getFontData()[0], -1, + text.getFont().getFontData()[0], UFStatus.getHandler(AlarmDisplayWindow.class)); } }); diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java index 007664fa7b..06b41f6e97 100644 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java @@ -307,8 +307,7 @@ import com.raytheon.viz.ui.dialogs.SWTMessageBox; * 28Nov2012 14842 M.Gamazaychikov Re-wrote processPopup method * 13Dec2012 1353 rferrel Change to make edit cancel message not * dispaly the red had kill job message. - * 31Dec2012 15651 M.Gamazaychikov Added an argument to re-factored PrintDisplay.print - * 10JAN2012 15704 M.Gamazaychikov Added setting userKeyPressed to false in verifyText method. + * 10JAN2012 15704 M.Gamazaychikov Added setting userKeyPressed to false in verifyText method * * * @author lvenable @@ -4192,7 +4191,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, */ private void printAllText() { FontData fontData = textEditor.getFont().getFontData()[0]; - PrintDisplay.print(textEditor.getText(), fontData, charWrapCol, statusHandler); + PrintDisplay.print(textEditor.getText(), fontData, statusHandler); } /** @@ -4215,7 +4214,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, String tmpText = textEditor.getText(); Point point = textEditor.getSelection(); FontData fontData = textEditor.getFont().getFontData()[0]; - PrintDisplay.print(textEditor.getSelectionText(), fontData, charWrapCol, + PrintDisplay.print(textEditor.getSelectionText(), fontData, statusHandler); textEditor.setText(tmpText); textEditor.setSelection(point); diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/print/PrintDisplay.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/print/PrintDisplay.java index 39070fa383..2e3e0d7636 100644 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/print/PrintDisplay.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/print/PrintDisplay.java @@ -43,7 +43,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority; * Sep 15, 2011 10557 rferrel Initial creation * Jul 17, 2012 14274 rferrel Now use eclipse Printer instead of awt. * Text is printed using same font as the GUI - * Dec 31, 2012 15651 mgamazaychikov Added setFont method to scale font for printing + * Dec 31, 2012 15651 M Gamazaychikov Added setFont method to scale font for printing * * * @@ -53,7 +53,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority; public class PrintDisplay { public static void print(final String printedText, final FontData fontData, - int aLineWidth, IUFStatusHandler statusHandler) { + IUFStatusHandler statusHandler) { PrinterData data = Printer.getDefaultPrinterData(); if (data == null) { statusHandler.handle(Priority.PROBLEM, @@ -67,11 +67,9 @@ public class PrintDisplay { } final Printer printer = new Printer(data); - PrintDisplay pd = new PrintDisplay(printer, printedText, fontData, aLineWidth); + PrintDisplay pd = new PrintDisplay(printer, printedText, fontData); pd.printJob(); } - - private int lineWidth; private Printer printer; @@ -105,16 +103,10 @@ public class PrintDisplay { int end; - private PrintDisplay(Printer printer, String text, FontData fontData, int aWidth) { + private PrintDisplay(Printer printer, String text, FontData fontData) { this.printer = printer; this.textToPrint = text; this.printerFontData = fontData; - if (aWidth == -1) { - this.lineWidth = 69; - } - else { - this.lineWidth = aWidth; - } } private void printJob() { @@ -128,6 +120,19 @@ public class PrintDisplay { } protected void setFont() { + /* + * get the max number of characters in a line of text + * and add a length of tab + */ + String [] textLines = textToPrint.split("[\n]"); + int maxChar = textLines[0].length(); + for ( int counter=1; counter maxChar){ + maxChar = textLines[counter].length(); + } + } + maxChar = maxChar + 4; + /* * get the original font size and set the gc font. */ @@ -138,8 +143,8 @@ public class PrintDisplay { /* * Create a buffer for computing line width in pixels. */ - StringBuilder aBuffer = new StringBuilder(lineWidth); - for (int i = 0; i < lineWidth; i++) { + StringBuilder aBuffer = new StringBuilder(maxChar); + for (int i = 0; i < maxChar; i++) { aBuffer.append(' '); } /* diff --git a/edexOsgi/build.edex/esb/data/utility/edex_static/base/config/gfe/serverConfig.py b/edexOsgi/build.edex/esb/data/utility/edex_static/base/config/gfe/serverConfig.py index e8b147f218..3acf5633db 100644 --- a/edexOsgi/build.edex/esb/data/utility/edex_static/base/config/gfe/serverConfig.py +++ b/edexOsgi/build.edex/esb/data/utility/edex_static/base/config/gfe/serverConfig.py @@ -605,7 +605,7 @@ HRAP = ('HRAP', POLAR_STEREOGRAPHIC, (-119.036, 23.097), (-75.945396, 53.480095), (0.0, 0.0), 0.0, 0.0, (1, 1), (801, 881), 0.0, 0.0, -105.0) -NDFD_Oceanic_10K = ('NDFD Oceanic 10km', MERCATOR, +NDFD_Oceanic_10K = ('NDFD_Oceanic_10km', MERCATOR, (-230.094, -30.4192), (10.71, 67.03), (0.0, 0.0), 0.0, 0.0, (1, 1), (2517, 1289), 0.0, -109.962, 0.0) diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/isc/GfeScriptExecutor.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/isc/GfeScriptExecutor.java index 4374fb841e..dfa97aff41 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/isc/GfeScriptExecutor.java +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/isc/GfeScriptExecutor.java @@ -164,7 +164,7 @@ public class GfeScriptExecutor { } String fileContents = getFileContents(xmlFileName); - Pattern pat = Pattern.compile("([A-Z]{3})"); + Pattern pat = Pattern.compile("(.*?)"); Matcher matcher = pat.matcher(fileContents); while (matcher.find()) { diff --git a/edexOsgi/com.raytheon.edex.plugin.shef/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject b/edexOsgi/com.raytheon.edex.plugin.shef/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject index f85617d7be..b887a863a2 100644 --- a/edexOsgi/com.raytheon.edex.plugin.shef/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject +++ b/edexOsgi/com.raytheon.edex.plugin.shef/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject @@ -334,4 +334,5 @@ com.raytheon.uf.common.dataplugin.shef.tables.YuniqueId com.raytheon.uf.common.dataplugin.shef.tables.Zoneinfo com.raytheon.uf.common.dataplugin.shef.tables.ZoneinfoId com.raytheon.uf.common.dataplugin.shef.tables.Zonenum -com.raytheon.uf.common.dataplugin.shef.tables.ZonenumId \ No newline at end of file +com.raytheon.uf.common.dataplugin.shef.tables.ZonenumId +com.raytheon.edex.transform.shef.MetarToShefFilter \ No newline at end of file diff --git a/edexOsgi/com.raytheon.edex.plugin.shef/res/spring/shef-ingest.xml b/edexOsgi/com.raytheon.edex.plugin.shef/res/spring/shef-ingest.xml index 620377a45f..f5dd3198d0 100644 --- a/edexOsgi/com.raytheon.edex.plugin.shef/res/spring/shef-ingest.xml +++ b/edexOsgi/com.raytheon.edex.plugin.shef/res/spring/shef-ingest.xml @@ -28,7 +28,7 @@ + class="com.raytheon.edex.transform.shef.MetarToShefFilter"> @@ -133,7 +133,7 @@ - + diff --git a/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/transform/shef/AbstractShefTransformer.java b/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/transform/shef/AbstractShefTransformer.java index f639ee2a95..fb5aacbd1a 100644 --- a/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/transform/shef/AbstractShefTransformer.java +++ b/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/transform/shef/AbstractShefTransformer.java @@ -483,7 +483,7 @@ public abstract class AbstractShefTransformer /** * Create, or recreate and validate the shef archive directory. */ - private void configureArchiveDir() { + protected void configureArchiveDir() { archiveEnabled = AppsDefaults.getInstance().getBoolean(OPT_ARC_ENABLE, false); String arcDir = AppsDefaults.getInstance().getToken(OPT_SHEF_ARC_DIR); diff --git a/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/transform/shef/MetarToShefFilter.java b/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/transform/shef/MetarToShefFilter.java new file mode 100644 index 0000000000..676230c094 --- /dev/null +++ b/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/transform/shef/MetarToShefFilter.java @@ -0,0 +1,286 @@ +/** + * 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.transform.shef; + +import static com.raytheon.uf.common.localization.LocalizationContext.LocalizationType.EDEX_STATIC; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.JAXBException; +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 org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import com.raytheon.uf.common.dataplugin.PluginDataObject; +import com.raytheon.uf.common.localization.IPathManager; +import com.raytheon.uf.common.localization.LocalizationContext; +import com.raytheon.uf.common.localization.PathManagerFactory; +import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; +import com.raytheon.uf.common.serialization.SerializationUtil; +import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; +import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; +import com.raytheon.uf.common.ohd.AppsDefaults; +//import com.raytheon.edex.transform.shef.MetarToShefTransformer; +import com.raytheon.uf.edex.decodertools.core.filterimpl.AbstractFilterElement; +import com.raytheon.uf.edex.decodertools.core.filterimpl.AbstractObsFilter; +import com.raytheon.uf.edex.decodertools.core.filterimpl.PluginDataObjectFilter; + +/** + * Use information in metarToShefFilter.xml, MetarToShefFilter filters out + * the metar messages before send the message to MetarToShefTransformer to + * encode to a SHEF message. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * Date       Ticket# Engineer Description
+ * ---------- ------- -------- --------------------------
+ * 1/10/2013  15497   wkwock   Initial creation
+ * 
+ * 
+ * + * @author wkwock + * @version 1.0 + */ +@XmlRootElement +@XmlAccessorType(XmlAccessType.NONE) +@DynamicSerialize +public class MetarToShefFilter { + @XmlElement + @DynamicSerializeElement + protected List metarToShefRun = new ArrayList(); + + private static final String ERROR_1_FMT = "Could not create {%s} context for file \"%s\""; + + private static final String ERROR_2_FMT = "File %s does not exist"; + + private static final String METAR_CFG = "metar.cfg"; + + public static final String FILTERS_DIR = "plugin-filters"; + + private String metarToShefOptions = AppsDefaults.getInstance().getToken("metar2shef_options"); + + private Log logger = LogFactory.getLog(getClass()); + + private String filterConfigFile = null; + + public MetarToShefFilter() { + } + + public MetarToShefFilter(String configFile, String localContext) { + filterConfigFile = configFile; + try { + File filterDir = null; + IPathManager manager = PathManagerFactory.getPathManager(); + if(manager != null) { + LocalizationContext context = manager.getContext(EDEX_STATIC, LocalizationLevel.valueOf(localContext)); + if(context != null) { + filterDir = manager.getFile(context, FILTERS_DIR); + if (filterDir.exists()) { + File srcFile = new File(filterDir, filterConfigFile); + + byte[] data = new byte[(int) srcFile.length()]; + + InputStream stream = getInputStream(srcFile); + try { + stream.read(data); + stream.close(); + Object obj = SerializationUtil + .unmarshalFromXml(new String(data)); + if (obj instanceof PluginDataObjectFilter){ + logger.info("Found "+filterConfigFile+" is PluginDataObjectFilter"); + PluginDataObjectFilter pdof=(PluginDataObjectFilter) obj; + MetarToShefRun mtsr= new MetarToShefRun(); + mtsr.setConfigFileName(METAR_CFG); + mtsr.setMetarToShefOptions(metarToShefOptions); + mtsr.setFilterElements(pdof.getFilterElements()); + mtsr.setFilterName(pdof.getFilterName()); + this.metarToShefRun.add(mtsr); + }else if (obj instanceof MetarToShefFilter) { + MetarToShefFilter filter = (MetarToShefFilter) obj; + this.metarToShefRun=filter.metarToShefRun; + logger.info("Found "+filterConfigFile+" is MetarToShefFilter"); + }else { + logger.error("Found "+filterConfigFile+" is "+obj.getClass().getCanonicalName()); + createDummyFilter(); + } + } catch (IOException e) { + logger.error("Unable to read filter config", e); + } catch (JAXBException e) { + logger.error("Unable to unmarshall filter config", e); + } + } else { + logger.error(String.format(ERROR_2_FMT,filterDir.getPath())); + createDummyFilter(); + } + } else { + logger.error(String.format(ERROR_1_FMT, localContext,configFile)); + createDummyFilter(); + } + } else { + // Could not create PathManager + } + } catch (Exception e) { + logger.error( + "Error creating filter.", e); + createDummyFilter(); + } + + for (MetarToShefRun mtsr: metarToShefRun){ + logger.info("Filter name = " + mtsr.getFilterName()+" with config file: "+mtsr.getConfigFileName()); + } + } + + private PluginDataObject[] filterARun(PluginDataObject[] reports, List filterElements) { + int reportCount = 0; + if (reports != null) { + + + for (int i = 0; i < reports.length; i++) { + PluginDataObject r = null; + boolean keep = true; + for (AbstractFilterElement element : filterElements) { + r = element.filter(reports[i]); + + // Only allow keep to be set to true. Once true it stays that way. + if(AbstractObsFilter.INCLUDE_TYPE.equals(element.getFilterType())) { + // Did the filter pass? + if(r == null) { + // If we fail an element, exit now. + keep = false; + break; + } + } else if(AbstractObsFilter.EXCLUDE_TYPE.equals(element.getFilterType())) { + if(r != null) { + // There was a match, so we want to remove this item. + keep = false; + // And there's no reason for further checks. + break; + } + } + } + if (keep) { + reportCount++; + } else { + reports[i] = null; + } + } + } + if (reportCount == 0) { + reports = new PluginDataObject[0]; + } else { + PluginDataObject[] newReports = new PluginDataObject[reportCount]; + int i = 0; + // Copy in the reports that passed filtering. + for (PluginDataObject report : reports) { + if (report != null) { + newReports[i++] = report; + } + } + reports = newReports; + } + return reports; + } + + /** + * Apply the list of filters against given input data. + * + */ + // @Override + public PluginDataObject[] filter(PluginDataObject[] reports) { + PluginDataObject[] resultRpt=null; + for (MetarToShefRun mtsr : metarToShefRun) { + PluginDataObject[] tmpRprts = reports.clone(); + resultRpt=filterARun(tmpRprts,mtsr.getFilterElements()); + if (resultRpt!=null && resultRpt.length>=1) { + logger.info("Report matchs in filter "+mtsr.getFilterName()); + MetarToShefTransformer.setCfgNOption(mtsr.getConfigFileName(),mtsr.getMetarToShefOptions()); + break ; + } + } + + return resultRpt; + } + + private void createDummyFilter() { + MetarToShefRun mtsr= new MetarToShefRun(); + mtsr.setConfigFileName(METAR_CFG); + mtsr.setMetarToShefOptions(metarToShefOptions); + + // Add a dummy element. + AbstractFilterElement dummy = new AbstractFilterElement() { + @Override + public PluginDataObject filter(PluginDataObject report) { + return report; + } + }; + dummy.setFilterType(AbstractObsFilter.INCLUDE_TYPE); + mtsr.getFilterElements().set(0, dummy); + mtsr.setFilterName("Created Pass-All filter"); + this.metarToShefRun.add(mtsr); + } + + /** + * + * @param file + * @return + */ + private static FileInputStream getInputStream(File file) { + FileInputStream fis = null; + + try { + fis = new FileInputStream(file); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + return fis; + } + + public void addMetarToShefRun(MetarToShefRun element) { + metarToShefRun.add(element); + } + + /** + * + * @return + */ + public List getMetarToShefRun() { + return metarToShefRun; + } + + /** + * + * @param elements + */ + public void setMetarToShefRun(List elements) { + metarToShefRun = elements; + } + + } diff --git a/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/transform/shef/MetarToShefRun.java b/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/transform/shef/MetarToShefRun.java new file mode 100644 index 0000000000..83323b7982 --- /dev/null +++ b/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/transform/shef/MetarToShefRun.java @@ -0,0 +1,150 @@ +package com.raytheon.edex.transform.shef; +/** + * 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.io.File; +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 com.raytheon.uf.common.serialization.ISerializableObject; +import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; +import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; +import com.raytheon.uf.edex.decodertools.core.filterimpl.AbstractFilterElement; + +/** + * MetarToShefRun is for the metarToShefRun tag in Metar2ShefFilter tag + * + *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date       Ticket# Engineer Description
+ * ---------- ------- -------- --------------------------
+ * 1/10/2013  15497   wkwock   Initial creation
+ *
+ * 
+ * + * @author wkwock + * @version 1.0 + */ +@XmlAccessorType(XmlAccessType.NONE) +@DynamicSerialize +public class MetarToShefRun implements ISerializableObject{ + public static final String INCLUDE_TYPE = "INCLUDE"; + + public static final String EXCLUDE_TYPE = "EXCLUDE"; + @XmlElement + @DynamicSerializeElement + private String configFileName; + + @XmlElement + @DynamicSerializeElement + private String metarToShefOptions; + + @XmlElement + @DynamicSerializeElement + protected List filterElements = new ArrayList(); + + @XmlElement + @DynamicSerializeElement + private String filterName; + + /** + * + * @param filterFile + */ + void createFilter(File filterFile) { + } + + /** + * + * @return + */ + public String getConfigFileName() { + return configFileName; + } + + /** + * + * @param name + */ + public void setConfigFileName(String name) { + configFileName = name; + } + + /** + * + * @return + */ + public String getMetarToShefOptions() { + return metarToShefOptions; + } + + /** + * + * @param name + */ + public void setMetarToShefOptions(String name) { + metarToShefOptions = name; + } + + /** + * + */ + public void addFilterElement(AbstractFilterElement element) { + filterElements.add(element); + } + + /** + * + * @return + */ + public List getFilterElements() { + return filterElements; + } + + /** + * + * @param elements + */ + public void setFilterElements(List elements) { + filterElements = elements; + } + + /** + * + * @return + */ + public String getFilterName() { + return filterName; + } + + /** + * + * @param name + */ + public void setFilterName(String name) { + filterName = name; + } +} diff --git a/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/transform/shef/MetarToShefTransformer.java b/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/transform/shef/MetarToShefTransformer.java index 4e7a600235..e883e40693 100644 --- a/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/transform/shef/MetarToShefTransformer.java +++ b/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/transform/shef/MetarToShefTransformer.java @@ -80,6 +80,10 @@ public class MetarToShefTransformer extends private static final int P1_MIN = 50; private static final int P2_MAX = 5; + private static String cfgFileName="metar.cfg"; + private static String cmdLnOptions=""; + private static boolean refreshOptions=true; + /** * Construct an instance of this transformer. * @param cmdLine Command line options that may be used if these @@ -411,4 +415,24 @@ public class MetarToShefTransformer extends } return sb; } -} + + public final byte[] transformMetar(MetarRecord report, Headers headers) + throws TransformerException { + if (refreshOptions) { + logger.info("Metar to SHEF now use config file: "+cfgFileName+" with options:"+cmdLnOptions); + options.setCfgFileName(cfgFileName); + options.updateCommandLine(cmdLnOptions); + options.updateOptions(); + refreshOptions=false; + } + configureArchiveDir(); + + return transformReport(report, headers); + } + + public static void setCfgNOption (String cfg, String options){ + cfgFileName=cfg; + cmdLnOptions=options; + refreshOptions=true; + } +} \ No newline at end of file diff --git a/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/transform/shef/obs/ObsToSHEFOptions.java b/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/transform/shef/obs/ObsToSHEFOptions.java index 031ca96379..8adc2b0213 100644 --- a/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/transform/shef/obs/ObsToSHEFOptions.java +++ b/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/transform/shef/obs/ObsToSHEFOptions.java @@ -179,6 +179,7 @@ public class ObsToSHEFOptions { public static final String OPT_NO_HR_TRACE = "optNoHourTrace"; + private String cfgFileName=null; // private static class PCReset { // // private final String stationId; @@ -408,7 +409,11 @@ public class ObsToSHEFOptions { initOptions(); parseCommandLine(cmdLine); if (useLocalized) { - readConfig(METAR_CFG, optConfigContext); + if (cfgFileName==null){ + readConfig(METAR_CFG, optConfigContext); + } else { + readConfig(cfgFileName, optConfigContext); + } updateTime = System.currentTimeMillis(); } localized = useLocalized; @@ -843,7 +848,11 @@ public class ObsToSHEFOptions { long cTime = System.currentTimeMillis() - updateTime; if (cTime > UPDATE_DELTA) { if (loaded && localized) { - readConfig(METAR_CFG, optConfigContext); + if (cfgFileName==null) { + readConfig(METAR_CFG, optConfigContext); + } else { + readConfig(cfgFileName, optConfigContext); + } updateTime = System.currentTimeMillis(); } } @@ -874,7 +883,11 @@ public class ObsToSHEFOptions { if (SITE_CONTEXT.equals(optConfigContext)) { // Retry from a base context. optConfigContext = BASE_CONTEXT; - readConfig(METAR_CFG, optConfigContext); + if (cfgFileName==null) { + readConfig(METAR_CFG, optConfigContext); + }else{ + readConfig(cfgFileName, optConfigContext); + } } } } else { @@ -973,6 +986,10 @@ public class ObsToSHEFOptions { loaded = true; } + public void setCfgFileName(String fileName) { + cfgFileName=fileName; + } + public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/pythonPackages/pypies/pypies/impl/H5pyDataStore.py b/pythonPackages/pypies/pypies/impl/H5pyDataStore.py index 0b42f69c29..b5b7c6c185 100644 --- a/pythonPackages/pypies/pypies/impl/H5pyDataStore.py +++ b/pythonPackages/pypies/pypies/impl/H5pyDataStore.py @@ -30,6 +30,7 @@ # 06/16/10 njensen Initial Creation. # 05/03/11 9134 njensen Optimized for pointdata # 10/09/12 rjpeter Optimized __getGroup for retrievals +# 01/17/13 DR 15294 D. Friedman Clear out data in response # # # @@ -94,6 +95,9 @@ class H5pyDataStore(IDataStore.IDataStore): except: logger.warn("Exception occurred on file " + fn + ":" + IDataStore._exc()) exc.append(IDataStore._exc()) + # Clear out data so we don't send the whole thing back to the client. + # NOTE: This assumes pypies no longer needs the data + r.putDataObject(None) failRecs.append(r) if ss: diff --git a/rpms/awips2.core/Installer.ldm/component.spec b/rpms/awips2.core/Installer.ldm/component.spec index b6481310af..dba0c07bbc 100644 --- a/rpms/awips2.core/Installer.ldm/component.spec +++ b/rpms/awips2.core/Installer.ldm/component.spec @@ -5,7 +5,7 @@ Name: awips2-ldm Summary: AWIPS II LDM Distribution Version: 6.8.1 -Release: 28 +Release: 29 Group: AWIPSII BuildRoot: /tmp URL: N/A