13.3.1-3 baseline

Merge branch 'master_13.3.1' of ../ss_build_transfer_copy into master_13.3.1

conflicts resolved by 'theirs' strategy (all of 13.3.1-10)

Conflicts:
	cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java

Former-commit-id: 07167ec04f [formerly cf951785c8] [formerly db761c0f19 [formerly 8c1e3bc2413a6e1e6644f8ba8812edf591557f29]]
Former-commit-id: db761c0f19
Former-commit-id: 62e15dacdb
This commit is contained in:
Steve Harris 2013-02-25 15:54:24 -06:00
commit 988430b44d
9 changed files with 223 additions and 106 deletions

View file

@ -138,6 +138,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.edex.decodertools.time.TimeTools;
import com.raytheon.uf.edex.services.textdbsrv.IQueryTransport;
import com.raytheon.uf.edex.wmo.message.WMOHeader;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.notification.INotificationObserver;
@ -307,10 +308,11 @@ 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.
* 10JAN2013 15704 M.Gamazaychikov Added setting userKeyPressed to false in verifyText method.
* 31JAN2013 14247 D. Friedman Make spell check dialog child of editor window.
* 31JAN2013 15580 D. Friedman Prevent errors when window is disposed.
* 31JAN2013 15610 M.Gamazaychikov Added handling first line of text product which
* is not a valid WMO heading.
* </pre>
*
* @author lvenable
@ -4194,7 +4196,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);
}
/**
@ -4217,7 +4219,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);
@ -5203,85 +5205,108 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
int numberOfLinesOfHeaderText = 2;
int afosNnnLimit = 2; // first three characters is AFOS NNN
int afosXxxLimit = 5; // second three characters is AFOS XXX
/*
* DR15610 - Make sure that if the first line of the
* text product is not a WMO heading it is treated as
* part of the text body.
*/
String[] pieces = textEditor.getText().split("\r*\n", 2);
if (pieces.length > 1) {
pieces[0] += "\n"; // WMOHeader expects this
}
WMOHeader header = new WMOHeader(pieces[0].getBytes(), null);
if ( !header.isValid() ) {
headerTF.setText("");
try {
textEditor.setText(originalText);
textEditor.setEditable(true);
textEditor.setEditable(false);
} catch (IllegalArgumentException e) {
// There is no text product body, so set it to the empty string.
textEditor.setText("");
}
}
else {
// TODO FIX PARSING
// TODO FIX PARSING
// First, set the current header by assuming that it usually
// consists of the first two lines of text in the text product,
// though there will be exceptions to that "rule" as handled below.
// So, obtain the AFOS NNNxxx. If it's where it is supposed to be
// in the new format, then the existing header is already an AWIPS
// text product identifier. Otherwise it is a legacy AFOS identifier.
if (TextDisplayModel.getInstance().hasStdTextProduct(token)) {
StdTextProduct textProd = TextDisplayModel.getInstance()
.getStdTextProduct(token);
StdTextProductId prodId = textProd.getProdId();
try {
// start of second line of text
start = textEditor.getOffsetAtLine(thisLine + 1);
if ((textEditor.getText(start, start + afosNnnLimit)
.equals(prodId.getNnnid()))
&& (textEditor.getText(start + afosNnnLimit + 1, start
+ afosXxxLimit).equals(prodId.getXxxid()))) {
// Text matches the products nnnid and xxxid
numberOfLinesOfHeaderText = 2;
} else if (textEditor.getText(start, start + afosNnnLimit + 2)
.equals(AFOSParser.DRAFT_PIL)
|| textEditor.getText(start, start + afosNnnLimit + 2)
.equals("TTAA0")) {
// Text matches temporary WRKWG#
numberOfLinesOfHeaderText = 2;
} else {
// First, set the current header by assuming that it usually
// consists of the first two lines of text in the text product,
// though there will be exceptions to that "rule" as handled below.
// So, obtain the AFOS NNNxxx. If it's where it is supposed to be
// in the new format, then the existing header is already an AWIPS
// text product identifier. Otherwise it is a legacy AFOS identifier.
if (TextDisplayModel.getInstance().hasStdTextProduct(token)) {
StdTextProduct textProd = TextDisplayModel.getInstance()
.getStdTextProduct(token);
StdTextProductId prodId = textProd.getProdId();
try {
// start of second line of text
start = textEditor.getOffsetAtLine(thisLine + 1);
if ((textEditor.getText(start, start + afosNnnLimit)
.equals(prodId.getNnnid()))
&& (textEditor.getText(start + afosNnnLimit + 1, start
+ afosXxxLimit).equals(prodId.getXxxid()))) {
// Text matches the products nnnid and xxxid
numberOfLinesOfHeaderText = 2;
} else if (textEditor.getText(start, start + afosNnnLimit + 2)
.equals(AFOSParser.DRAFT_PIL)
|| textEditor.getText(start, start + afosNnnLimit + 2)
.equals("TTAA0")) {
// Text matches temporary WRKWG#
numberOfLinesOfHeaderText = 2;
} else {
// Assume this header block is a legacy AFOS identifier.
numberOfLinesOfHeaderText = 1;
}
} catch (IllegalArgumentException e) {
// Assume this header block is a legacy AFOS identifier.
numberOfLinesOfHeaderText = 1;
}
} catch (IllegalArgumentException e) {
// Assume this header block is a legacy AFOS identifier.
numberOfLinesOfHeaderText = 1;
}
}
try {
start = 0;
finish = textEditor.getOffsetAtLine(thisLine
+ numberOfLinesOfHeaderText) - 1;
} catch (IllegalArgumentException e) {
// The text does not span enough lines so use the full extent
// of the product.
finish = textEditor.getCharCount() - 1;
}
try {
start = 0;
finish = textEditor.getOffsetAtLine(thisLine
+ numberOfLinesOfHeaderText) - 1;
} catch (IllegalArgumentException e) {
// The text does not span enough lines so use the full extent
// of the product.
finish = textEditor.getCharCount() - 1;
}
// Set the content of the header block to consist of just the header of
// the text product... it will get reunited with the body when it is
// saved.
if (finish > start) {
headerTF.setText(textEditor.getText(start, finish));
} else {
headerTF.setText("");
}
// Set the content of the header block to consist of just the header of
// the text product... it will get reunited with the body when it is
// saved.
if (finish > start) {
headerTF.setText(textEditor.getText(start, finish));
} else {
headerTF.setText("");
}
// Next, set the current body by assuming that it always
// consists of the rest of the text product beyond the line(s)
// of text in the header.
try {
int numberOfBlankLines = -1;
String line = null;
do {
numberOfBlankLines++;
line = textEditor.getLine(thisLine + numberOfLinesOfHeaderText
+ numberOfBlankLines);
} while (line.length() == 0 || line.equals(""));
// Note: 'st' is a reference to 'textEditor'...
// delelete the header from the text in 'textEditor'
finish = textEditor.getOffsetAtLine(thisLine
+ numberOfLinesOfHeaderText + numberOfBlankLines);
textEditor.setSelection(start, finish);
textEditor.setEditable(true);
textEditor.invokeAction(SWT.DEL);
textEditor.setEditable(false);
} catch (IllegalArgumentException e) {
// There is no text product body, so set it to the empty string.
textEditor.setText("");
// Next, set the current body by assuming that it always
// consists of the rest of the text product beyond the line(s)
// of text in the header.
try {
int numberOfBlankLines = -1;
String line = null;
do {
numberOfBlankLines++;
line = textEditor.getLine(thisLine + numberOfLinesOfHeaderText
+ numberOfBlankLines);
} while (line.length() == 0 || line.equals(""));
// Note: 'st' is a reference to 'textEditor'...
// delelete the header from the text in 'textEditor'
finish = textEditor.getOffsetAtLine(thisLine
+ numberOfLinesOfHeaderText + numberOfBlankLines);
textEditor.setSelection(start, finish);
textEditor.setEditable(true);
textEditor.invokeAction(SWT.DEL);
textEditor.setEditable(false);
} catch (IllegalArgumentException e) {
// There is no text product body, so set it to the empty string.
textEditor.setText("");
}
}
// set editor status flags
dirty = false;

View file

@ -88,7 +88,7 @@ import com.raytheon.viz.core.slice.request.VerticalPointRequest.TimeDirection;
import com.raytheon.viz.skewt.SkewtDisplay;
import com.raytheon.viz.skewt.rscdata.SkewTResourceData;
import com.raytheon.viz.ui.EditorUtil;
import com.raytheon.viz.ui.MenuLoader;
import com.raytheon.viz.ui.BundleProductLoader;
import com.raytheon.viz.ui.UiUtil;
import com.raytheon.viz.ui.editor.AbstractEditor;
import com.raytheon.viz.ui.editor.IMultiPaneEditor;
@ -1081,7 +1081,7 @@ public class ProductTableComp extends Composite {
Bundle b = new Bundle();
b.setDisplays(new AbstractRenderableDisplay[] { display });
Job j = new MenuLoader(b, editor);
Job j = new BundleProductLoader(editor, b);
j.schedule();
}
}

View file

@ -20,6 +20,10 @@
package com.raytheon.viz.warngen.template;
import java.awt.geom.Point2D;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.io.StringWriter;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
@ -57,12 +61,18 @@ import com.raytheon.uf.common.activetable.ActiveTableRecord;
import com.raytheon.uf.common.activetable.GetActiveTableRequest;
import com.raytheon.uf.common.activetable.GetActiveTableResponse;
import com.raytheon.uf.common.dataplugin.warning.AbstractWarningRecord;
import com.raytheon.uf.common.dataplugin.warning.WarningConstants;
import com.raytheon.uf.common.dataplugin.warning.WarningRecord.WarningAction;
import com.raytheon.uf.common.dataplugin.warning.config.AreaSourceConfiguration;
import com.raytheon.uf.common.dataplugin.warning.config.AreaSourceConfiguration.AreaType;
import com.raytheon.uf.common.dataplugin.warning.config.WarngenConfiguration;
import com.raytheon.uf.common.dataplugin.warning.gis.GeospatialData;
import com.raytheon.uf.common.dataplugin.warning.util.GeometryUtil;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.site.SiteMap;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
@ -132,8 +142,10 @@ import com.vividsolutions.jts.io.WKTReader;
* in oldWarn.
* Dec 17, 2012 15571 Qinglu Lin For hydro products, resolved issue caused by calling wkt.read(loc)
* while loc is null.
* Jan 8, 2013 15664 Qinglu Lin Appended selectedAction to handler.handle()'s argument list.
*
* Jan 8, 2013 15664 Qinglu Lin Appended selectedAction to handler.handle()'s argument list.
* Feb 15, 2013 15820 Qinglu Lin Added createOfficeTimezoneMap() and added logic so that localtimezone
* and secondtimezone can get correct values when warning area covers two time zones.
*
* </pre>
*
* @author njensen
@ -167,6 +179,36 @@ public class TemplateRunner {
dateFormat.put("time", new SimpleDateFormat("HHmm"));
}
/**
* Read cwa and timezone info from officeCityTimezone.txt, and put them
* into map officeCityTimezone.
*/
public static Map<String,String> createOfficeTimezoneMap() {
Map<String,String> officeCityTimezone = new HashMap<String,String>();
IPathManager pathMgr = PathManagerFactory.getPathManager();
LocalizationContext lc = pathMgr.getContext(
LocalizationType.COMMON_STATIC, LocalizationLevel.BASE);
String octz = "officeCityTimezone.txt";
String fileToRetrieve = IPathManager.SEPARATOR + WarningConstants.WARNGEN_DIR
+ IPathManager.SEPARATOR + octz;
File timezoneFile = pathMgr.getFile(lc, fileToRetrieve);
String line;
String[] splitLine;
BufferedReader timezoneReader;
try {
timezoneReader = new BufferedReader(new InputStreamReader(new FileInputStream(
timezoneFile)));
for (line = timezoneReader.readLine(); line != null; line = timezoneReader.readLine()) {
splitLine = line.trim().split("\\\\");
officeCityTimezone.put(splitLine[0].trim(),splitLine[1].trim());
}
} catch (Exception e) {
statusHandler.handle(Priority.SIGNIFICANT,
"WarnGen Error while processing data in : " + octz, e);
}
return officeCityTimezone;
}
/**
* Executes a warngen template given the polygon from the Warngen Layer and
* the Storm tracking information from StormTrackDisplay
@ -363,12 +405,28 @@ public class TemplateRunner {
}
}
Map<String, String> officeCityTimezone = createOfficeTimezoneMap();
String cityTimezone = null;
if (officeCityTimezone != null)
cityTimezone = officeCityTimezone.get(warngenLayer.getLocalizedSite());
Iterator<String> iterator = timeZones.iterator();
while (iterator.hasNext()) {
if (context.get("localtimezone") == null) {
context.put("localtimezone", iterator.next());
} else if (context.get("secondtimezone") == null) {
context.put("secondtimezone", iterator.next());
if (timeZones.size() > 1 && cityTimezone != null) {
String timezone;
while (iterator.hasNext()) {
timezone = iterator.next().toUpperCase();
if (timezone.equals(cityTimezone) && context.get("localtimezone") == null) {
context.put("localtimezone", timezone);
} else if (context.get("secondtimezone") == null) {
context.put("secondtimezone", timezone);
}
}
} else {
while (iterator.hasNext()) {
if (context.get("localtimezone") == null) {
context.put("localtimezone", iterator.next());
} else if (context.get("secondtimezone") == null) {
context.put("secondtimezone", iterator.next());
}
}
}
}

View file

@ -0,0 +1,19 @@
MSO \ M
BOI \ M
VEF \ P
PSR \ M
BIS \ C
ABR \ C
UNR \ M
LBF \ C
GLD \ M
DDC \ C
MAF \ C
MQT \ E
IWX \ E
LOT \ C
PAH \ C
LMK \ E
MRX \ E
TAE \ E
AFC \ A

View file

@ -11,7 +11,6 @@
## VERSION AWIPS II 1.5 -- MAR 2 2012 OB12.2.1-4 ##
## BY QINGLU LIN 7-31-2012 DR 15217 use roundAndPad ##
## BY QINGLU LIN 8-14-2012 DR 14493 use TMLtime ##
## BY QINGLU LIN 2-04-2013 DR 15198 Added <L></L> to ${area.name} for NEW. ##
################################################################
## Added Volcano Information in version 1.3 for sites where
## Volcanoes affect their marine zones. If sites wish to hide
@ -70,7 +69,7 @@ SPECIAL MARINE WARNING FOR...
#end
#foreach (${area} in ${areas})
##
<L>${area.name}...</L>
${area.name}...
#end
##
##

View file

@ -11,7 +11,6 @@
## VERSION AWIPS II 1.5 -- MAR 2 2012 OB12.2.1-4 ##
## BY MGAMAZAYCHIKOV -- JUL 20 2012 DR15006 ##
## BY QINGLU LIN 7-31-2012 DR 15217 use roundAndPad ##
## BY QINGLU LIN 2-04-2013 DR 15198 Added <L></L> to ${area.name} for CON/CAN/(CON/CAN)/COR/EXP ##
#####################################################
## Added Volcano Information in version 1.3 for sites where
## Volcanoes affect their marine zones. If sites wish to hide
@ -88,7 +87,7 @@ THIS IS A TEST MESSAGE.##
THE AFFECTED AREAS WERE...
#foreach (${area} in ${areas})
<L>${area.name}...</L>
${area.name}...
#end
######################################################################
@ -362,7 +361,7 @@ THIS IS A TEST MESSAGE.##
FOR THE FOLLOWING AREAS...
#foreach (${area} in ${areas})
<L>${area.name}...</L>
${area.name}...
#end
## Storm current location description
@ -516,7 +515,7 @@ THIS IS A TEST MESSAGE.##
THE AFFECTED AREAS WERE...
#foreach (${area} in ${cancelareas})
<L>${area.name}...</L>
${area.name}...
#end
######################################################################
@ -778,7 +777,7 @@ THIS IS A TEST MESSAGE.##
FOR THE FOLLOWING AREAS...
#foreach (${area} in ${areas})
<L>${area.name}...</L>
${area.name}...
#end
#if(${productClass}=="T")
@ -1191,7 +1190,7 @@ THIS IS A TEST MESSAGE.##
FOR THE FOLLOWING AREAS...
#foreach (${area} in ${areas})
<L>${area.name}...</L>
${area.name}...
#end
#if(${productClass}=="T")
@ -1331,7 +1330,7 @@ WILL EXPIRE AT ${dateUtil.format(${expire}, ${timeFormat.clock}, 15, ${localtime
THE AFFECTED AREAS WERE...
#foreach (${area} in ${areas})
<L>${area.name}...</L>
${area.name}...
#end
######################################################################

View file

@ -9,6 +9,7 @@
# ------------ ---------- ----------- --------------------------
# 04/06/2012 10388 mhuang Initial creation
# 10/09/12 DR 13901 D. Friedman Add logging
# 02/20/13 DR 15836 D. Friedman Append to log
##############################################################################
# this allows you to run this script from outside of ./bin
@ -30,7 +31,7 @@ _MODULE="${RUN_FROM_DIR}/src/qpidNotify/mhsAckNotify.py"
log_file=${LOG_DIR:-/data/logs/fxa}/$(date -u +%Y%m%d)/mhsAckNotify
if touch "$log_file"; then
exec >& "$log_file"
exec >>"$log_file" 2>&1
fi
# quoting of '$@' is used to prevent command line interpretation

View file

@ -31,6 +31,7 @@
# ------------ ---------- ----------- --------------------------
# 09/19/11 8804 mhuang Initial creation
# 10/09/12 DR 13901 D. Friedman Add logging
# 02/20/13 DR 15836 D. Friedman Append to log
##############################################################################
# this allows you to run this script from outside of ./bin
@ -52,7 +53,7 @@ _MODULE="${RUN_FROM_DIR}/src/qpidNotify/qpidNotify.py"
log_file=${LOG_DIR:-/data/logs/fxa}/$(date -u +%Y%m%d)/qpidNotify
if touch "$log_file"; then
exec >& "$log_file"
exec >>"$log_file" 2>&1
fi
# quoting of '$@' is used to prevent command line interpretation

View file

@ -31,11 +31,14 @@
# ------------ ---------- ----------- --------------------------
# 09/19/11 8804 MHuang Initial creation
# 10/09/12 DR 13901 D. Friedman Limit execution time
# 02/20/13 DR 15836 D. Friedman Handle comma-delimited args.
# Improve logging.
##############################################################################
from ufpy import qpidingest
from lib.Util import doWithinTime
import logging
import os
import os.path
import sys
@ -50,7 +53,7 @@ class mhsFileIngest:
try:
cnn=qpidingest.IngestViaQPID(host=server, port=5672)
except:
print "Cannot connect qpid server:", server
log.error("Cannot connect qpid server: %s", server)
sys.exit(1)
self.conn = cnn
@ -59,19 +62,27 @@ class mhsFileIngest:
cnn = self.conn
#Get uplink files
size=len(sys.argv) - 1
print size, "files will be sent to EDEX via qpiningest"
#
# If using WAN backup for the SBN, the list of files is
# passed as a single comma-delimited argument.
if len(sys.argv) == 2 and ',' in sys.argv[1]:
args = sys.argv[1].split(',')
else:
args = sys.argv[1:]
size=len(args)
log.info("%d files will be sent to EDEX via qpiningest", size)
fileCount=0
errCount=0
for outfile in sys.argv[1:]:
for outfile in args:
#Make sure incoming file exists in /data_store/mhs directory
# print "outfle:", outfile
if os.path.exists(outfile):
try:
f=open(outfile, 'r')
except(IOerror), e:
print "Unable to open the file", outfile, e
except(IOError), e:
log.error("Unable to open the file %s: %s", outfile, e)
errCount += 1
else:
#Parse wmoId header info
@ -81,24 +92,28 @@ class mhsFileIngest:
f.close()
#Send message to the external dropbox queue for file to be ingested
cnn.sendmessage(outfile, wmoHdr)
print "Sent", outfile, "to EDEX via qpidingest"
log.info("Sent %s to EDEX via qpidingest", outfile)
fileCount += 1
else:
print outfile, "does not exist"
log.error("%s does not exist", outfile)
errCount += 1
cnn.close()
if fileCount == size:
print "Successfully sent", fileCount, "file(s) to EDEX via qpidingest"
log.info("Successfully sent %d file(s) to EDEX via qpidingest", fileCount)
return 0
elif errCount == size:
print "Failed to send", fileCount, "file(s) to EDEX via qpidingest"
log.info("Failed to send %d file(s) to EDEX via qpidingest", fileCount)
return 1
elif errCount > 0 and fileCount < size:
print errcount, "out of", size, "failed to be sent to EDEX via qpidingest"
log.info("%d out of %d failed to be sent to EDEX via qpidingest", errCount, size)
return 2
def run():
global log
logging.basicConfig(level=logging.INFO, datefmt='%H:%M:%S',
format='[%(process)s] %(asctime)s %(levelname)s: %(message)s')
log = logging.getLogger('qpidNotify')
try:
m = mhsFileIngest()
doWithinTime(m.startConnection, description='connect to qpid')