13.5.1-11 baseline

Former-commit-id: c402dbf6e9 [formerly ea7b22500e] [formerly 4ec04083bd [formerly 7142e607157f6d6ac1ba5cb24f3b3dbf9ab75f7f]]
Former-commit-id: 4ec04083bd
Former-commit-id: 26e58d8cdb
This commit is contained in:
Greg Armendariz 2013-08-07 14:34:27 -04:00
parent 9ddb32967c
commit 75f9f8df3f
6 changed files with 105 additions and 70 deletions

View file

@ -30,6 +30,7 @@ import org.eclipse.swt.widgets.Event;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 7/1/06 chammack Initial Creation.
* 08/02/2013 DR 16427 Qinglu Lin (David's approach) Added SYSTEM_RESOURCE_LOW(1) to InputPriority.
*
* </pre>
*
@ -39,8 +40,8 @@ import org.eclipse.swt.widgets.Event;
public interface IInputHandler {
public static enum InputPriority {
LOWEST(0), RESOURCE(3), SYSTEM_RESOURCE(4), PART(5), PERSPECTIVE(6), WINDOW(
7);
LOWEST(0), SYSTEM_RESOURCE_LOW(1), RESOURCE(3), SYSTEM_RESOURCE(4), PART(5), PERSPECTIVE(6),
WINDOW(7);
public Integer value;

View file

@ -71,6 +71,8 @@ import com.raytheon.viz.ui.actions.DummyAction;
* drawn into the smaller pane.
* Sep 4, 2012 15335 kshresth Will now display lightning/wind fields
* when magnification set to 0
* Aug 2, 2013 DR 16427 Qinglu Lin (David's approach) Changing InputPriority.SYSTEM_RESOURCE to
* InputPriority.SYSTEM_RESOURCE_LOW in initInternal().
*
* </pre>
*
@ -500,7 +502,7 @@ public class D2DLegendResource extends
IDisplayPaneContainer rc = getResourceContainer();
if (rc != null) {
rc.registerMouseHandler(legendHandler,
InputPriority.SYSTEM_RESOURCE);
InputPriority.SYSTEM_RESOURCE_LOW);
rc.registerMouseHandler(changeModeHandler, InputPriority.RESOURCE);
}
}

View file

@ -88,6 +88,8 @@ public class AlertalarmStdTextProductUtil {
setCurrentReportfile();
reportAlarm();
System.exit(reportWriter.getAlarmCount());
}
/*
@ -230,7 +232,7 @@ public class AlertalarmStdTextProductUtil {
if (alarmCount > 0) {
log.info(alarmCount + " alarms reported, report written to "
+ reportWriter.getFilename());
saveReportTotextDb();
//saveReportTotextDb();
} else {
log.info("No alarms reported, info sent to "
+ reportWriter.getFilename());

View file

@ -27,6 +27,7 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import javax.xml.bind.JAXBException;
@ -63,6 +64,7 @@ import com.raytheon.uf.edex.decodertools.core.filterimpl.PluginDataObjectFilter;
* ---------- ------- -------- --------------------------
* 1/10/2013 15497 wkwock Initial creation
* 2/13/2013 1584 mpduff Fix creation of "dummy" config.
* 08/08/2013 16408 wkwock Use different metar.cfg file and options
*
* </pre>
*
@ -167,16 +169,13 @@ public class MetarToShefFilter {
}
}
private PluginDataObject[] filterARun(PluginDataObject[] reports,
private PluginDataObject filterARun(PluginDataObject report,
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]);
if (report != null) {
PluginDataObject r = null;
boolean keep = true;
for (AbstractFilterElement element : filterElements) {
r = element.filter(report);
// Only allow keep to be set to true. Once true it stays
// that way.
@ -200,26 +199,12 @@ public class MetarToShefFilter {
}
}
if (keep) {
reportCount++;
report = r;
} else {
reports[i] = null;
report = 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;
return report;
}
/**
@ -228,19 +213,20 @@ public class MetarToShefFilter {
*/
// @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;
HashMap<String,MetarToShefRun> matchList = new HashMap<String,MetarToShefRun>();
ArrayList<PluginDataObject> reportList = new ArrayList<PluginDataObject> ();
for (PluginDataObject report : reports) {
for (MetarToShefRun mtsr : metarToShefRun) {
PluginDataObject resultRpt = filterARun(report, mtsr.getFilterElements());
if (resultRpt != null ) {
reportList.add(resultRpt);
matchList.put(resultRpt.getDataURI(), mtsr);
MetarToShefTransformer.setMatchList (matchList);
break;
}
}
}
return resultRpt;
return (PluginDataObject[])reportList.toArray(new PluginDataObject[reportList.size()]);
}
private void createDummyFilter() {

View file

@ -22,6 +22,7 @@ package com.raytheon.edex.transform.shef;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashMap;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -51,6 +52,7 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
* AWIPS2 DR Work
* 20120918 1185 jkorman Added save to archive capability.
* Jan 30, 2010 15779 lbousaidi added 4 letter to station id for ACR
* Aug 08, 2013 16408 wkwock Use different metar.cfg file and options
* </pre>
*
* @author jkorman
@ -81,10 +83,23 @@ 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;
/*
* Max list for optionsList and matchList to prevent memory leak.
* (500 or any big number should be fine)
*/
private static final int MAX_LIST = 500;
/*
* MetarToShefRun list which has metar.cfg file and options to used by conversion
*/
private static HashMap<String,MetarToShefRun> mtsrList = new HashMap<String,MetarToShefRun>();
/*
* List of metar.cfg files + options.
*/
private HashMap<String,ObsToSHEFOptions> optionsList = new HashMap<String,ObsToSHEFOptions>();
private ObsToSHEFOptions defaultOptions =null;
/**
* Construct an instance of this transformer.
* @param cmdLine Command line options that may be used if these
@ -92,6 +107,7 @@ public class MetarToShefTransformer extends
*/
public MetarToShefTransformer(String cmdLine) {
super(cmdLine, WMO_HEADER_FMT);
defaultOptions = options;
}
/**
@ -421,21 +437,38 @@ public class MetarToShefTransformer extends
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;
ObsToSHEFOptions tmpOptions=null;
MetarToShefRun mtsr = mtsrList.get(report.getDataURI());
if (mtsr==null) {
tmpOptions = defaultOptions;
} else {
tmpOptions = optionsList.get(mtsr.getConfigFileName()+mtsr.getMetarToShefOptions());
if (tmpOptions==null) {
//just to prevent t memory leak
if (optionsList.size()>MAX_LIST) {
optionsList.clear();
}
tmpOptions = new ObsToSHEFOptions(mtsr.getConfigFileName(),mtsr.getMetarToShefOptions(),true);
optionsList.put(mtsr.getConfigFileName()+mtsr.getMetarToShefOptions(), tmpOptions);
}
mtsrList.remove(report.getDataURI());
}
options=tmpOptions;
logger.info("Metar to SHEF for "+report.getStationId()+" use config file: "+options.getCfgFileName()+" with options:"+mtsr.getMetarToShefOptions());
configureArchiveDir();
return transformReport(report, headers);
}
public static void setCfgNOption (String cfg, String options){
cfgFileName=cfg;
cmdLnOptions=options;
refreshOptions=true;
/*
* set matchList
*/
public static void setMatchList (HashMap<String,MetarToShefRun> matchLst) {
//should add to the list and remove after use. clear if reach certain big number
if (mtsrList.size()>MAX_LIST) {
mtsrList.clear();
}
mtsrList.putAll(matchLst);
}
}

View file

@ -57,7 +57,8 @@ import com.raytheon.uf.common.localization.PathManagerFactory;
* May 24, 2010 jkorman Initial creation
* ======================================
* AWIPS2 DR Work
* 20120918 1185 jkorman Added save to archive capability.
* 20120918 1185 jkorman Added save to archive capability.
* Aug 08, 2013 16408 wkwock Added get configuration file name function
*
* </pre>
*
@ -66,9 +67,6 @@ import com.raytheon.uf.common.localization.PathManagerFactory;
*/
public class ObsToSHEFOptions {
// 1 minute update delta.
private static final long UPDATE_DELTA = 60L * 1000L;
private static final String METAR_CFG = "metar.cfg";
private static final String ERROR_1_FMT = "Could not create {%s} context for file \"%s\"";
@ -399,8 +397,6 @@ public class ObsToSHEFOptions {
private final boolean localized;
private long updateTime = 0;
/**
*
* @param cmdLine
@ -414,7 +410,20 @@ public class ObsToSHEFOptions {
} else {
readConfig(cfgFileName, optConfigContext);
}
updateTime = System.currentTimeMillis();
}
localized = useLocalized;
}
/**
*
* @param cmdLine
*/
public ObsToSHEFOptions(String configFileName, String cmdLine, boolean useLocalized) {
cfgFileName = configFileName;
initOptions();
parseCommandLine(cmdLine);
if (useLocalized) {
readConfig(cfgFileName, optConfigContext);
}
localized = useLocalized;
}
@ -845,15 +854,11 @@ public class ObsToSHEFOptions {
* Check if the metar.cfg needs to be reread.
*/
public void updateOptions() {
long cTime = System.currentTimeMillis() - updateTime;
if (cTime > UPDATE_DELTA) {
if (loaded && localized) {
if (cfgFileName==null) {
readConfig(METAR_CFG, optConfigContext);
} else {
readConfig(cfgFileName, optConfigContext);
}
updateTime = System.currentTimeMillis();
if (loaded && localized) {
if (cfgFileName==null) {
readConfig(METAR_CFG, optConfigContext);
} else {
readConfig(cfgFileName, optConfigContext);
}
}
}
@ -888,6 +893,8 @@ public class ObsToSHEFOptions {
}else{
readConfig(cfgFileName, optConfigContext);
}
} else {
logger.warn("Uanble to read file "+cfgFileName);
}
}
} else {
@ -990,6 +997,10 @@ public class ObsToSHEFOptions {
cfgFileName=fileName;
}
public String getCfgFileName () {
return cfgFileName;
}
public String toString() {
StringBuilder sb = new StringBuilder();