13.2.1-3 baseline

Former-commit-id: ba03739c3528638c5383528fd64674ae5af1ed64
This commit is contained in:
Steve Harris 2013-01-23 11:24:17 -05:00
parent 83e9157df7
commit 7435527b25
19 changed files with 754 additions and 88 deletions

View file

@ -85,7 +85,7 @@
</mapping>
<mapping key="primaryElevationAngle">
<constraint constraintValue="${elevation1}"
constraintType="IN" />
constraintType="BETWEEN" />
</mapping>
</metadataMap>
</resourceData>
@ -119,7 +119,7 @@
</mapping>
<mapping key="primaryElevationAngle">
<constraint constraintValue="${elevation1}"
constraintType="IN" />
constraintType="BETWEEN" />
</mapping>
</metadataMap>
</resourceData>
@ -173,7 +173,7 @@
</mapping>
<mapping key="primaryElevationAngle">
<constraint constraintValue="${elevation2}"
constraintType="IN" />
constraintType="BETWEEN" />
</mapping>
</metadataMap>
</resourceData>
@ -207,7 +207,7 @@
</mapping>
<mapping key="primaryElevationAngle">
<constraint constraintValue="${elevation2}"
constraintType="IN" />
constraintType="BETWEEN" />
</mapping>
</metadataMap>
</resourceData>
@ -256,7 +256,7 @@
</mapping>
<mapping key="primaryElevationAngle">
<constraint constraintValue="${elevation4}"
constraintType="IN" />
constraintType="BETWEEN" />
</mapping>
</metadataMap>
</resourceData>
@ -290,7 +290,7 @@
</mapping>
<mapping key="primaryElevationAngle">
<constraint constraintValue="${elevation4}"
constraintType="IN" />
constraintType="BETWEEN" />
</mapping>
</metadataMap>
</resourceData>
@ -344,7 +344,7 @@
</mapping>
<mapping key="primaryElevationAngle">
<constraint constraintValue="${elevation3}"
constraintType="IN" />
constraintType="BETWEEN" />
</mapping>
</metadataMap>
</resourceData>
@ -378,7 +378,7 @@
</mapping>
<mapping key="primaryElevationAngle">
<constraint constraintValue="${elevation3}"
constraintType="IN" />
constraintType="BETWEEN" />
</mapping>
</metadataMap>
</resourceData>

View file

@ -110,7 +110,7 @@
<substitute key="stationId" value="72233"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Wash-Dulles, VA (KLWX)" id="raobWash-Dulles"
menuText="Wash-Dulles, VA (KIAD)" id="raobWash-Dulles"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="72403"/>
</contribute>

View file

@ -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()
* </pre>
*
* @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);
}
}
}

View file

@ -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.
*
* </pre>
*
@ -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);
}
}

View file

@ -23,6 +23,46 @@
id="${icao}fourPanel">
<contribute xsi:type="titleItem" titleText="------ Z/V ------"
id="${icao}Terminal4panelZV" />
<contribute xsi:type="bundleItem"
file="bundles/DefaultRadarFourPanelBlendedBestRes.xml" menuText="${elev1} ${elev2} ${elev6} ${elev8}"
id="${icao}${elev1}${elev2}${elev6}${elev8}Terminal4panelZV"
suppressErrors="${suppressErrors3}">
<substitute key="icao" value="${icao}" />
<substitute key="product1" value="180" />
<substitute key="product2" value="181" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode1" value="" />
<substitute key="product5" value="182" />
<substitute key="product6" value="183" />
<substitute key="product7" value="" />
<substitute key="product8" value="" />
<substitute key="mode2" value="" />
<substitute key="elevation1" value="${elev1}--${elev1}" />
<substitute key="elevation2" value="${elev2}--${elev2}" />
<substitute key="elevation3" value="${elev6}--${elev6}" />
<substitute key="elevation4" value="${elev8}--${elev8}" />
</contribute>
<contribute xsi:type="bundleItem"
file="bundles/DefaultRadarFourPanelBlendedBestRes.xml" menuText="${elev1} ${elev3} ${elev5} ${elev6}"
id="${icao}${elev1}${elev3}${elev5}${elev6}Terminal4panelZV"
suppressErrors="${suppressErrors3}">
<substitute key="icao" value="${icao}" />
<substitute key="product1" value="180" />
<substitute key="product2" value="181" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode1" value="" />
<substitute key="product5" value="182" />
<substitute key="product6" value="183" />
<substitute key="product7" value="" />
<substitute key="product8" value="" />
<substitute key="mode2" value="" />
<substitute key="elevation1" value="${elev1}--${elev1}" />
<substitute key="elevation2" value="${elev3}--${elev3}" />
<substitute key="elevation3" value="${elev5}--${elev5}" />
<substitute key="elevation4" value="${elev6}--${elev6}" />
</contribute>
<contribute xsi:type="bundleItem"
file="bundles/DefaultRadarFourPanelBlendedBestRes.xml" menuText="${elev1} ${elev2} ${elev3} ${elev4}"
id="${icao}${elev1}${elev2}${elev3}${elev4}Terminal4panelZV"
@ -38,14 +78,94 @@
<substitute key="product7" value="" />
<substitute key="product8" value="" />
<substitute key="mode2" value="" />
<substitute key="elevation1" value="${elev1}" />
<substitute key="elevation2" value="${elev2}" />
<substitute key="elevation3" value="${elev3}" />
<substitute key="elevation4" value="${elev4}" />
</contribute>
<substitute key="elevation1" value="${elev1}--${elev1}" />
<substitute key="elevation2" value="${elev2}--${elev2}" />
<substitute key="elevation3" value="${elev3}--${elev3}" />
<substitute key="elevation4" value="${elev4}--${elev4}" />
</contribute>
<contribute xsi:type="bundleItem"
file="bundles/DefaultRadarFourPanelBlendedBestRes.xml" menuText="${elev3} ${elev7} ${elev8} ${elev9}"
id="${icao}${elev3}${elev7}${elev8}${elev9}Terminal4panelZV"
suppressErrors="${suppressErrors3}">
<substitute key="icao" value="${icao}" />
<substitute key="product1" value="180" />
<substitute key="product2" value="181" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode1" value="" />
<substitute key="product5" value="182" />
<substitute key="product6" value="183" />
<substitute key="product7" value="" />
<substitute key="product8" value="" />
<substitute key="mode2" value="" />
<substitute key="elevation1" value="${elev3}--${elev3}" />
<substitute key="elevation2" value="${elev7}--${elev7}" />
<substitute key="elevation3" value="${elev8}--${elev8}" />
<substitute key="elevation4" value="${elev9}--${elev9}" />
</contribute>
<contribute xsi:type="bundleItem"
file="bundles/DefaultRadarFourPanelBlendedBestRes.xml" menuText="${elev8} ${elev9} ${elev10} ${elev12}"
id="${icao}${elev8}${elev9}${elev10}${elev12}Terminal4panelZV"
suppressErrors="${suppressErrors3}">
<substitute key="icao" value="${icao}" />
<substitute key="product1" value="180" />
<substitute key="product2" value="181" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode1" value="" />
<substitute key="product5" value="182" />
<substitute key="product6" value="183" />
<substitute key="product7" value="" />
<substitute key="product8" value="" />
<substitute key="mode2" value="" />
<substitute key="elevation1" value="${elev8}--${elev8}" />
<substitute key="elevation2" value="${elev9}--${elev9}" />
<substitute key="elevation3" value="${elev10}--${elev10}" />
<substitute key="elevation4" value="${elev12}--${elev12}" />
</contribute>
<contribute xsi:type="separator" id="below${icao}Terminal4panelZSRM8" />
<contribute xsi:type="titleItem" titleText="------ Z/SRM8 ------"
id="${icao}Terminal4panelZSRM8" />
<contribute xsi:type="bundleItem"
file="bundles/DefaultRadarFourPanelBlendedBestRes.xml" menuText="${elev1} ${elev2} ${elev6} ${elev8}"
id="${icao}${elev1}${elev2}${elev6}${elev8}Terminal4panelZSRM8"
suppressErrors="${suppressErrors3}">
<substitute key="icao" value="${icao}" />
<substitute key="product1" value="180" />
<substitute key="product2" value="181" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode1" value="" />
<substitute key="product5" value="182" />
<substitute key="product6" value="" />
<substitute key="product7" value="" />
<substitute key="product8" value="" />
<substitute key="mode2" value="SRM8" />
<substitute key="elevation1" value="${elev1}--${elev1}" />
<substitute key="elevation2" value="${elev2}--${elev2}" />
<substitute key="elevation3" value="${elev6}--${elev6}" />
<substitute key="elevation4" value="${elev8}--${elev8}" />
</contribute>
<contribute xsi:type="bundleItem"
file="bundles/DefaultRadarFourPanelBlendedBestRes.xml" menuText="${elev1} ${elev3} ${elev5} ${elev6}"
id="${icao}${elev1}${elev3}${elev5}${elev6}Terminal4panelZSRM8"
suppressErrors="${suppressErrors3}">
<substitute key="icao" value="${icao}" />
<substitute key="product1" value="180" />
<substitute key="product2" value="181" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode1" value="" />
<substitute key="product5" value="182" />
<substitute key="product6" value="" />
<substitute key="product7" value="" />
<substitute key="product8" value="" />
<substitute key="mode2" value="SRM8" />
<substitute key="elevation1" value="${elev1}--${elev1}" />
<substitute key="elevation2" value="${elev3}--${elev3}" />
<substitute key="elevation3" value="${elev5}--${elev5}" />
<substitute key="elevation4" value="${elev6}--${elev6}" />
</contribute>
<contribute xsi:type="bundleItem"
file="bundles/DefaultRadarFourPanelBlendedBestRes.xml" menuText="${elev1} ${elev2} ${elev3} ${elev4}"
id="${icao}${elev1}${elev2}${elev3}${elev4}Terminal4panelZSRM8"
@ -60,11 +180,51 @@
<substitute key="product6" value="" />
<substitute key="product7" value="" />
<substitute key="product8" value="" />
<substitute key="mode2" value="SRM8" />
<substitute key="elevation1" value="${elev1}--${elev1}" />
<substitute key="elevation2" value="${elev2}--${elev2}" />
<substitute key="elevation3" value="${elev3}--${elev3}" />
<substitute key="elevation4" value="${elev4}--${elev4}" />
</contribute>
<contribute xsi:type="bundleItem"
file="bundles/DefaultRadarFourPanelBlendedBestRes.xml" menuText="${elev3} ${elev7} ${elev8} ${elev9}"
id="${icao}${elev3}${elev7}${elev8}${elev9}Terminal4panelZSRM8"
suppressErrors="${suppressErrors3}">
<substitute key="icao" value="${icao}" />
<substitute key="product1" value="180" />
<substitute key="product2" value="181" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode1" value="" />
<substitute key="product5" value="182" />
<substitute key="product6" value="" />
<substitute key="product7" value="" />
<substitute key="product8" value="" />
<substitute key="mode2" value="SRM8" />
<substitute key="elevation1" value="${elev1}" />
<substitute key="elevation2" value="${elev2}" />
<substitute key="elevation3" value="${elev3}" />
<substitute key="elevation4" value="${elev4}" />
</contribute>
<substitute key="elevation1" value="${elev3}--${elev3}" />
<substitute key="elevation2" value="${elev7}--${elev7}" />
<substitute key="elevation3" value="${elev8}--${elev8}" />
<substitute key="elevation4" value="${elev9}--${elev9}" />
</contribute>
<contribute xsi:type="bundleItem"
file="bundles/DefaultRadarFourPanelBlendedBestRes.xml" menuText="${elev8} ${elev9} ${elev10} ${elev12}"
id="${icao}${elev8}${elev9}${elev10}${elev12}Terminal4panelZSRM8"
suppressErrors="${suppressErrors3}">
<substitute key="icao" value="${icao}" />
<substitute key="product1" value="180" />
<substitute key="product2" value="181" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode1" value="" />
<substitute key="product5" value="182" />
<substitute key="product6" value="" />
<substitute key="product7" value="" />
<substitute key="product8" value="" />
<substitute key="mode2" value="SRM8" />
<substitute key="elevation1" value="${elev8}--${elev8}" />
<substitute key="elevation2" value="${elev9}--${elev9}" />
<substitute key="elevation3" value="${elev10}--${elev10}" />
<substitute key="elevation4" value="${elev12}--${elev12}" />
</contribute>
</contribute>
</menuTemplate>

View file

@ -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.
*
* </pre>
*
@ -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));
}
});

View file

@ -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
* </pre>
*
* @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);

View file

@ -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
*
* </pre>
*
@ -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<textLines.length; counter++){
if (textLines[counter].length() > 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(' ');
}
/*

View file

@ -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)

View file

@ -164,7 +164,7 @@ public class GfeScriptExecutor {
}
String fileContents = getFileContents(xmlFileName);
Pattern pat = Pattern.compile("<site>([A-Z]{3})</site>");
Pattern pat = Pattern.compile("<site>(.*?)</site>");
Matcher matcher = pat.matcher(fileContents);
while (matcher.find()) {

View file

@ -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
com.raytheon.uf.common.dataplugin.shef.tables.ZonenumId
com.raytheon.edex.transform.shef.MetarToShefFilter

View file

@ -28,7 +28,7 @@
</bean>
<bean id="metarToShefFilter"
class="com.raytheon.uf.edex.decodertools.core.filterimpl.PluginDataObjectFilter">
class="com.raytheon.edex.transform.shef.MetarToShefFilter">
<constructor-arg type="java.lang.String" value="metarToShefFilter.xml" />
<constructor-arg type="java.lang.String" value="SITE" />
</bean>
@ -133,7 +133,7 @@
<pipeline>
<split streaming="true">
<method bean="metarToShef" method="iterate" />
<bean ref="metarToShef" method="transform" />
<bean ref="metarToShef" method="transformMetar" />
<to
uri="jms-generic:queue:Ingest.ShefStaged?destinationResolver=#qpidDurableResolver" />
</split>

View file

@ -483,7 +483,7 @@ public abstract class AbstractShefTransformer<T extends PluginDataObject>
/**
* 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);

View file

@ -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.
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ---------- ------- -------- --------------------------
* 1/10/2013 15497 wkwock Initial creation
*
* </pre>
*
* @author wkwock
* @version 1.0
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class MetarToShefFilter {
@XmlElement
@DynamicSerializeElement
protected List<MetarToShefRun> metarToShefRun = new ArrayList<MetarToShefRun>();
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<AbstractFilterElement> 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<MetarToShefRun> getMetarToShefRun() {
return metarToShefRun;
}
/**
*
* @param elements
*/
public void setMetarToShefRun(List<MetarToShefRun> elements) {
metarToShefRun = elements;
}
}

View file

@ -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
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ---------- ------- -------- --------------------------
* 1/10/2013 15497 wkwock Initial creation
*
* </pre>
*
* @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<AbstractFilterElement> filterElements = new ArrayList<AbstractFilterElement>();
@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<AbstractFilterElement> getFilterElements() {
return filterElements;
}
/**
*
* @param elements
*/
public void setFilterElements(List<AbstractFilterElement> elements) {
filterElements = elements;
}
/**
*
* @return
*/
public String getFilterName() {
return filterName;
}
/**
*
* @param name
*/
public void setFilterName(String name) {
filterName = name;
}
}

View file

@ -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;
}
}

View file

@ -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();

View file

@ -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:

View file

@ -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