Omaha #3002 Moved common taf code to com.raytheon.uf.common.dataplugin.taf.

Amend: updated manifest.
       Removed static imports.
       Refactored String constants to Pattern constants in TafConstants.
       Refactored com.raytheon.edex.plugin.taf to com.raytheon.uf.edex.taf.
       Renamed com.raytheon.edex.plugin.taf project to com.raytheon.uf.edex.taf.
       fixed .project.  Updated yet more Patterns.

Change-Id: Ia5db9d185c6c32e6ce25748ae4b3b6fb389b2acc

Former-commit-id: f73ed1c8ee81f3ae1ffdf44ba4726453e7e0b9d2
This commit is contained in:
Brad Gonzales 2014-05-16 08:47:29 -05:00
parent eff69410eb
commit e560ce4880
49 changed files with 325 additions and 299 deletions

View file

@ -15,7 +15,6 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.uf.common.dataplugin.ccfp,
com.raytheon.uf.common.pointdata;bundle-version="1.11.7",
com.raytheon.uf.common.serialization,
com.raytheon.edex.plugin.taf;bundle-version="1.12.1174",
com.raytheon.viz.pointdata;bundle-version="1.11.7",
com.raytheon.uf.common.python;bundle-version="1.11.7",
org.jep;bundle-version="1.0.0",
@ -27,7 +26,8 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.uf.common.tafqueue;bundle-version="1.0.0",
org.apache.commons.lang;bundle-version="2.3.0",
com.raytheon.uf.common.auth;bundle-version="1.12.1174",
com.raytheon.uf.viz.datacube
com.raytheon.uf.viz.datacube,
com.raytheon.uf.common.dataplugin.taf
Bundle-ActivationPolicy: lazy
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
Export-Package: com.raytheon.viz.aviation,

View file

@ -34,7 +34,7 @@ import javax.xml.bind.JAXB;
import jep.JepException;
import com.raytheon.edex.plugin.taf.common.TafRecord;
import com.raytheon.uf.common.dataplugin.taf.TafRecord;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.PathManagerFactory;
@ -70,6 +70,7 @@ import com.raytheon.viz.aviation.xml.WxPlotCfg;
* Apr 28, 2011 8065 rferrel Use cache data
* Nov 26, 2012 1298 rferrel Non-blocking dialog cleanup now use
* IUFStatusHandler for error messages.
* May 15, 2014 3002 bgonzale Moved common taf code to com.raytheon.uf.common.dataplugin.taf.
*
* </pre>
*

View file

@ -44,7 +44,7 @@ import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.edex.plugin.taf.common.TafRecord;
import com.raytheon.uf.common.dataplugin.taf.TafRecord;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.viz.aviation.monitor.TafUtil;
import com.raytheon.viz.aviation.resource.ResourceConfigMgr;
@ -72,6 +72,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* 9/9/2010 5468 rferrel Check for no TAF loaded for a site
* 10/1/2010 4345 rferrel Made products display the same as AWIPS I
* 10/04/2012 1229 rferrel Made non-blocking.
* May 15, 2014 3002 bgonzale Moved common taf code to com.raytheon.uf.common.dataplugin.taf.
*
* </pre>
*

View file

@ -91,7 +91,7 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import com.raytheon.edex.plugin.taf.common.TafRecord;
import com.raytheon.uf.common.dataplugin.taf.TafRecord;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
@ -235,6 +235,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* 02/19/2014 16980 zhao add code to ensure the Alt flag is false after the Alt kay is released
* 21Mar2014 #2925 lvenable Fixed NPE error found during testing.
* 06May2014 3091 rferrel Use OUP authorization to bring up send dialog.
* May 15, 2014 3002 bgonzale Moved common taf code to com.raytheon.uf.common.dataplugin.taf.
*
* </pre>
*

View file

@ -31,7 +31,7 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import com.raytheon.edex.plugin.taf.common.TafRecord;
import com.raytheon.uf.common.dataplugin.taf.TafRecord;
import com.raytheon.uf.viz.core.jobs.IRequestCompleteListener;
import com.raytheon.viz.aviation.cachedata.CacheGuidanceRequest;
import com.raytheon.viz.aviation.cachedata.TampCacheGuidanceRequest;
@ -54,6 +54,7 @@ import com.raytheon.viz.aviation.resource.ResourceConfigMgr.ResourceTag;
* and routine button's values.
* 14 APR 2011 8065 rferrel Add flag to indicate display is current
* and implement data caching
* May 15, 2014 3002 bgonzale Moved common taf code to com.raytheon.uf.common.dataplugin.taf.
*
* </pre>
*

View file

@ -20,13 +20,6 @@
package com.raytheon.viz.aviation.model;
import static com.raytheon.edex.plugin.taf.common.TafConstants.CG_BECMG;
import static com.raytheon.edex.plugin.taf.common.TafConstants.CG_FM;
import static com.raytheon.edex.plugin.taf.common.TafConstants.CG_INITIAL;
import static com.raytheon.edex.plugin.taf.common.TafConstants.CG_PROB;
import static com.raytheon.edex.plugin.taf.common.TafConstants.CG_PROB_TEMPO;
import static com.raytheon.edex.plugin.taf.common.TafConstants.CG_TEMPO;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
@ -34,6 +27,7 @@ import java.util.TimeZone;
import com.raytheon.uf.common.dataplugin.obs.metar.MetarRecord;
import com.raytheon.uf.common.dataplugin.obs.metar.util.SkyCover;
import com.raytheon.uf.common.dataplugin.taf.TafConstants;
import com.raytheon.viz.aviation.model.CloudGroup.CloudCategory;
/**
@ -62,6 +56,7 @@ import com.raytheon.viz.aviation.model.CloudGroup.CloudCategory;
* 1/15/2009 1816 grichard Correct TAF to conform to 10-813 NWSI.
* 4/29/2009 1982 grichard Correct TAF to conform to 10-813 NWSI.
* 5/11/2009 1816 grichard Corrected visibility for metar change.
* May 15, 2014 3002 bgonzale Moved common taf code to com.raytheon.uf.common.dataplugin.taf.
*
* </pre>
*
@ -810,8 +805,9 @@ public class TimeGroup implements Comparable<TimeGroup> {
/* Becoming (BECMG) */
/* Tempo (TEMPO) */
/* Probability (PROB) */
FM(CG_FM), BECMG(CG_BECMG), INITIAL(CG_INITIAL), TEMPO(CG_TEMPO), PROB(
CG_PROB), PROB_TEMPO(CG_PROB_TEMPO);
FM(TafConstants.CG_FM), BECMG(TafConstants.CG_BECMG), INITIAL(
TafConstants.CG_INITIAL), TEMPO(TafConstants.CG_TEMPO), PROB(
TafConstants.CG_PROB), PROB_TEMPO(TafConstants.CG_PROB_TEMPO);
/*
* See: NWS Operations Manual W/OM12 Part D-31 for more information.
*/

View file

@ -34,7 +34,7 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import com.raytheon.edex.plugin.taf.common.TafRecord;
import com.raytheon.uf.common.dataplugin.taf.TafRecord;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.common.util.StringUtil;
import com.raytheon.uf.viz.core.jobs.IRequestCompleteListener;
@ -65,6 +65,7 @@ import com.raytheon.viz.aviation.xml.MonitorCfg;
* 20JUL2012 14570 gzhang/zhao Modified for highlighting correct time groups in TAF Viewer
* 11AUG2012 14570 zhao Added 'cat' to alert_key_map
* 02Jan2013 15606 gzhang Remove GridData widthHint so button/label size change with GUI
* May 15, 2014 3002 bgonzale Moved common taf code to com.raytheon.uf.common.dataplugin.taf.
*
* </pre>
*

View file

@ -22,7 +22,7 @@ package com.raytheon.viz.aviation.monitor;
import java.util.ArrayList;
import java.util.Collection;
import com.raytheon.edex.plugin.taf.common.TafRecord;
import com.raytheon.uf.common.dataplugin.taf.TafRecord;
import com.raytheon.uf.viz.core.alerts.AlertMessage;
import com.raytheon.uf.viz.core.jobs.IRequestCompleteListener;
import com.raytheon.viz.aviation.guidance.GuidanceRequest;
@ -42,6 +42,7 @@ import com.raytheon.viz.aviation.observer.TafMonitorDlg;
* Sep 2, 2009 njensen Initial creation
* Nov 12, 2010 6195 rferrel Clear guidance's TAF cache when
* an alert received.
* May 15, 2014 3002 bgonzale Moved common taf code to com.raytheon.uf.common.dataplugin.taf.
*
* </pre>
*

View file

@ -48,7 +48,7 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.edex.plugin.taf.common.TafRecord;
import com.raytheon.uf.common.dataplugin.taf.TafRecord;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.viz.core.RGBColors;
import com.raytheon.uf.viz.core.VizApp;
@ -94,6 +94,7 @@ import com.raytheon.viz.avnconfig.IStatusSettable;
* 01/02/2013 15606 gzhang Remove GridData widthHint so button/label size change with GUI
* 03/07/2013 1735 rferrel Flag to indicate grid data is needed.
* 19Mar2014 #2925 lvenable Added dispose checks for runAsync.
* May 15, 2014 3002 bgonzale Moved common taf code to com.raytheon.uf.common.dataplugin.taf.
* </pre>
*
* @author lvenable

View file

@ -27,10 +27,10 @@ import java.util.HashMap;
import java.util.Map;
import java.util.TimeZone;
import com.raytheon.edex.plugin.taf.common.TafRecord;
import com.raytheon.uf.common.inventory.exception.DataCubeException;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.taf.TafRecord;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.inventory.exception.DataCubeException;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
@ -53,6 +53,7 @@ import com.raytheon.uf.viz.datacube.DataCubeContainer;
* Sep 11, 2013 2277 mschenke Got rid of ScriptCreator references
* Feb 24, 2014 2830 njensen Sort dataTimes in getLatestTafs()
* so it works correctly
* May 15, 2014 3002 bgonzale Moved common taf code to com.raytheon.uf.common.dataplugin.taf.
*
* </pre>
*

View file

@ -42,7 +42,7 @@
version="0.0.0"/>
<plugin
id="com.raytheon.edex.plugin.taf"
id="com.raytheon.uf.common.dataplugin.taf"
download-size="0"
install-size="0"
version="0.0.0"

View file

@ -1,23 +0,0 @@
/**
* 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.
**/
/**
* Contains common classes implementing the TAF data structure.
*/
package com.raytheon.edex.plugin.taf.common;

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.raytheon.uf.common.dataplugin.taf</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,20 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 1
Bundle-Name: Taf Plug-in
Bundle-SymbolicName: com.raytheon.uf.common.dataplugin.taf
Bundle-Version: 1.14.0.qualifier
Eclipse-RegisterBuddy: com.raytheon.edex.common, com.raytheon.uf.common.serialization
Bundle-Vendor: RAYTHEON
Export-Package: com.raytheon.uf.common.dataplugin.taf
Require-Bundle: org.apache.commons.lang,
javax.persistence
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: com.raytheon.uf.common.dataplugin,
com.raytheon.uf.common.dataplugin.annotations,
com.raytheon.uf.common.dataplugin.persist,
com.raytheon.uf.common.geospatial,
com.raytheon.uf.common.pointdata.spatial,
com.raytheon.uf.common.serialization.annotations,
com.raytheon.uf.common.time.util,
com.raytheon.uf.common.wmo,
org.hibernate.annotations

View file

@ -0,0 +1,4 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.

View file

@ -18,33 +18,13 @@
* further licensing information.
**/
package com.raytheon.edex.plugin.taf.common;
import static com.raytheon.edex.plugin.taf.common.TafConstants.ALTIMETER_GROUP_EXP;
import static com.raytheon.edex.plugin.taf.common.TafConstants.CG_BECMG;
import static com.raytheon.edex.plugin.taf.common.TafConstants.CG_FM;
import static com.raytheon.edex.plugin.taf.common.TafConstants.CG_PROB;
import static com.raytheon.edex.plugin.taf.common.TafConstants.CG_PROB_TEMPO;
import static com.raytheon.edex.plugin.taf.common.TafConstants.CG_TEMPO;
import static com.raytheon.edex.plugin.taf.common.TafConstants.CHANGE_GROUP_EXP;
import static com.raytheon.edex.plugin.taf.common.TafConstants.ICING_GROUP_EXP;
import static com.raytheon.edex.plugin.taf.common.TafConstants.SKY_COVER_GROUP_EXP;
import static com.raytheon.edex.plugin.taf.common.TafConstants.TEMP_GROUP_EXP;
import static com.raytheon.edex.plugin.taf.common.TafConstants.TURBULENCE_GROUP_EXP;
import static com.raytheon.edex.plugin.taf.common.TafConstants.VISIBILITY_GROUP_EXP;
import static com.raytheon.edex.plugin.taf.common.TafConstants.VS_6PLUS_M;
import static com.raytheon.edex.plugin.taf.common.TafConstants.VS_6PLUS_SM;
import static com.raytheon.edex.plugin.taf.common.TafConstants.WIND_GROUP_EXP;
import static com.raytheon.edex.plugin.taf.common.TafConstants.WIND_SHEAR_GROUP_EXP;
import static com.raytheon.edex.plugin.taf.common.TafConstants.WX_CAVOK;
import static com.raytheon.edex.plugin.taf.common.TafConstants.WX_NSW;
package com.raytheon.uf.common.dataplugin.taf;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.persistence.CascadeType;
import javax.persistence.Column;
@ -62,7 +42,7 @@ import javax.persistence.Transient;
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.edex.decodertools.time.TimeTools;
import com.raytheon.uf.common.time.util.TimeUtil;
/**
* This class represents a forecast group found in a taf message.
@ -81,8 +61,11 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools;
* Oct 21, 2008 1515 jkorman Added 30 Hour capability changes.
* Jun 28, 2012 #827 dgilling Annotate id field for
* serialization.
* Nov 01, 2013 2361 njensen Remove XML annotations
* Nov 01, 2013 2361 njensen Remove XML annotations
* Feb 10, 2014 2777 rferrel set the parentId when assinging sets.
* May 15, 2014 3002 bgonzale Moved to com.raytheon.uf.common.dataplugin.taf.
* Changed groupPattern to static field.
* Refactored Strings to Patterns in TafConstants.
*
* </pre>
*
@ -247,8 +230,8 @@ public class ChangeGroup extends PersistableDataObject {
changeGroup = group;
tafValidPeriod = tafIssuePeriod;
tafChangePeriod = new TafPeriod(TimeTools.copy(tafValidPeriod
.getStartDate()), TimeTools.copy(tafValidPeriod.getEndDate()));
tafChangePeriod = new TafPeriod(TimeUtil.newCalendar(tafValidPeriod
.getStartDate()), TimeUtil.newCalendar(tafValidPeriod.getEndDate()));
decode(extractTime(group));
}
@ -297,8 +280,7 @@ public class ChangeGroup extends PersistableDataObject {
private String extractTime(String groupData) {
StringBuilder grpData = new StringBuilder(groupData);
checkGroupDataEnd(grpData);
Pattern groupPattern = Pattern.compile(CHANGE_GROUP_EXP);
Matcher matcher = groupPattern.matcher(grpData);
Matcher matcher = TafConstants.CHANGE_GROUP_EXP.matcher(grpData);
int stopPos = -1;
if (matcher.find()) {
@ -312,10 +294,10 @@ public class ChangeGroup extends PersistableDataObject {
probability = Integer.parseInt(prob.substring(4, 6));
s = (matcher.group(7) != null) ? matcher.group(7).trim() : null;
if (CG_TEMPO.equals(s)) {
chgGrp = CG_PROB_TEMPO;
if (TafConstants.CG_TEMPO.equals(s)) {
chgGrp = TafConstants.CG_PROB_TEMPO;
} else {
chgGrp = CG_PROB;
chgGrp = TafConstants.CG_PROB;
}
}
@ -328,14 +310,14 @@ public class ChangeGroup extends PersistableDataObject {
int t2 = Integer.parseInt(s.substring(2, 4));
// FM group is hour/minute
if (CG_FM.equals(chgGrp)) {
if (TafConstants.CG_FM.equals(chgGrp)) {
tafChangePeriod = TafPeriod.determineChangeGroupPeriodSSss(
t1, t2, tafValidPeriod);
} else {
// All the rest are hour/hour
tafChangePeriod = TafPeriod.determineChangeGroupPeriodSSEE(
t1, t2, tafValidPeriod,
CG_BECMG.equals(change_indicator));
TafConstants.CG_BECMG.equals(change_indicator));
}
}
}
@ -359,10 +341,9 @@ public class ChangeGroup extends PersistableDataObject {
icing_layers = new HashSet<IcingLayer>();
temp_forecasts = new HashSet<TemperatureForecast>();
Pattern groupPattern = Pattern.compile(WIND_GROUP_EXP);
// Extracting the wind group
checkGroupDataEnd(grpData);
Matcher matcher = groupPattern.matcher(grpData);
Matcher matcher = TafConstants.WIND_GROUP_EXP.matcher(grpData);
int stopPos = -1;
if (matcher.find()) {
@ -395,11 +376,10 @@ public class ChangeGroup extends PersistableDataObject {
}
// Extracting icing information
groupPattern = Pattern.compile(ICING_GROUP_EXP);
checkGroupDataEnd(grpData);
int start = grpData.length();
int stop = -1;
matcher = groupPattern.matcher(grpData);
matcher = TafConstants.ICING_GROUP_EXP.matcher(grpData);
while (matcher.find()) {
icing_layers.add(new IcingLayer(this, matcher.group(1), matcher
.group(2), matcher.group(3)));
@ -411,11 +391,10 @@ public class ChangeGroup extends PersistableDataObject {
}
// Extracting turbulence information
groupPattern = Pattern.compile(TURBULENCE_GROUP_EXP);
checkGroupDataEnd(grpData);
start = grpData.length();
stop = -1;
matcher = groupPattern.matcher(grpData);
matcher = TafConstants.TURBULENCE_GROUP_EXP.matcher(grpData);
while (matcher.find()) {
turbulence_layers.add(new TurbulenceLayer(this, matcher.group(1),
matcher.group(2), matcher.group(3)));
@ -426,11 +405,10 @@ public class ChangeGroup extends PersistableDataObject {
grpData.delete(start, stop);
}
groupPattern = Pattern.compile(TEMP_GROUP_EXP);
checkGroupDataEnd(grpData);
start = grpData.length();
stop = -1;
matcher = groupPattern.matcher(grpData);
matcher = TafConstants.TEMP_GROUP_EXP.matcher(grpData);
while (matcher.find()) {
temp_forecasts.add(new TemperatureForecast(this, matcher.group(1),
matcher.group(2), matcher.group(3)));
@ -442,9 +420,8 @@ public class ChangeGroup extends PersistableDataObject {
}
// Extracting altimeter information
groupPattern = Pattern.compile(ALTIMETER_GROUP_EXP);
checkGroupDataEnd(grpData);
matcher = groupPattern.matcher(grpData);
matcher = TafConstants.ALTIMETER_GROUP_EXP.matcher(grpData);
if (matcher.find()) {
altim_in_hg = Double
.toString(Double.parseDouble(matcher.group(1)) / 100);
@ -452,9 +429,8 @@ public class ChangeGroup extends PersistableDataObject {
}
// Extracting wind shear information
groupPattern = Pattern.compile(WIND_SHEAR_GROUP_EXP);
checkGroupDataEnd(grpData);
matcher = groupPattern.matcher(grpData);
matcher = TafConstants.WIND_SHEAR_GROUP_EXP.matcher(grpData);
if (matcher.find()) {
this.wind_shear_hgt_ft_agl = Integer.parseInt(matcher.group(1)) * 100;
@ -464,30 +440,27 @@ public class ChangeGroup extends PersistableDataObject {
}
// Extracting the visibility
groupPattern = Pattern.compile(WX_CAVOK);
checkGroupDataEnd(grpData);
matcher = groupPattern.matcher(grpData);
matcher = TafConstants.WX_CAVOK.matcher(grpData);
if (matcher.find()) {
// CAVOK implies 6+ visibility and no cloud or weather groups!
visibility_mi = VS_6PLUS_SM;
visibility_mi = TafConstants.VS_6PLUS_SM;
grpData.delete(matcher.start(), matcher.end());
} else {
// Extracting the visibility
groupPattern = Pattern.compile(VISIBILITY_GROUP_EXP);
matcher = groupPattern.matcher(grpData);
matcher = TafConstants.VISIBILITY_GROUP_EXP.matcher(grpData);
if (matcher.find()) {
visibility_mi = matcher.group(1);
grpData.delete(matcher.start(), matcher.end());
} else {
// Statue miles vis didn't work so check metric
groupPattern = Pattern.compile("\\d{4}");
matcher = groupPattern.matcher(grpData);
matcher = TafConstants.FourDigitMetric.matcher(grpData);
if (matcher.find()) {
if (matcher.end() < 6) {
visibility_mi = matcher.group();
if (VS_6PLUS_M.equals(visibility_mi)) {
visibility_mi = VS_6PLUS_SM;
if (TafConstants.VS_6PLUS_M.equals(visibility_mi)) {
visibility_mi = TafConstants.VS_6PLUS_SM;
}
grpData.delete(matcher.start(), matcher.end());
}
@ -495,13 +468,12 @@ public class ChangeGroup extends PersistableDataObject {
}
// Extracting the weather
groupPattern = Pattern.compile(WX_NSW);
checkGroupDataEnd(grpData);
matcher = groupPattern.matcher(grpData);
matcher = TafConstants.WX_NSW.matcher(grpData);
if (matcher.find()) {
TafWeatherCondition wxCon = new TafWeatherCondition();
wxCon.setSequenceId(1);
wxCon.setOther(WX_NSW);
wxCon.setOther(TafConstants.WX_NSW.pattern());
weather.add(wxCon);
wxCon.setParentID(this);
grpData.delete(matcher.start(), matcher.end());
@ -519,9 +491,8 @@ public class ChangeGroup extends PersistableDataObject {
}
// Extracting the sky cover
groupPattern = Pattern.compile(SKY_COVER_GROUP_EXP);
checkGroupDataEnd(grpData);
matcher = groupPattern.matcher(grpData);
matcher = TafConstants.SKY_COVER_GROUP_EXP.matcher(grpData);
start = grpData.length();
stop = -1;

View file

@ -18,7 +18,7 @@
* further licensing information.
**/
package com.raytheon.edex.plugin.taf.common;
package com.raytheon.uf.common.dataplugin.taf;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -45,6 +45,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* 8/30/06 bphillip Initial Creation
* 6/21/07 180 bphillip Updated for use with plugin persistance pattern
* Nov 01, 2013 2361 njensen Remove XML annotations
* May 15, 2014 3002 bgonzale Moved to com.raytheon.uf.common.dataplugin.taf.
*
* </pre>
*

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.edex.plugin.taf.decoder;
package com.raytheon.uf.common.dataplugin.taf;
/**TODO Add Description
*
@ -28,6 +28,7 @@ package com.raytheon.edex.plugin.taf.decoder;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 20080424 1001 jkorman Initial implementation.
* May 15, 2014 3002 bgonzale Moved to com.raytheon.uf.common.dataplugin.taf.
*
* </pre>
*

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.edex.plugin.taf.common;
package com.raytheon.uf.common.dataplugin.taf;
import java.util.ArrayList;
import java.util.Collections;
@ -37,6 +37,7 @@ import java.util.Set;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 20080605 1001 jkorman Initial implementation.
* May 15, 2014 3002 bgonzale Moved to com.raytheon.uf.common.dataplugin.taf.
*
* </pre>
*

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.edex.plugin.taf.common;
package com.raytheon.uf.common.dataplugin.taf;
/**
* Intermediate data element used to parse weather data elements. It differs from
@ -32,7 +32,7 @@ package com.raytheon.edex.plugin.taf.common;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 20080605 1001 jkorman Initial implementation.
*
* May 15, 2014 3002 bgonzale Moved to com.raytheon.uf.common.dataplugin.taf.
* </pre>
*
* @author jkorman

View file

@ -17,7 +17,9 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.edex.plugin.taf.common;
package com.raytheon.uf.common.dataplugin.taf;
import java.util.regex.Pattern;
/**
* String constants used in the TAF Plugin.
@ -27,6 +29,9 @@ package com.raytheon.edex.plugin.taf.common;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 4, 2008 1444 grichard Initial creation.
* May 15, 2014 3002 bgonzale Moved to com.raytheon.uf.common.dataplugin.taf.
* Changed String patterns to Patterns.
* Refactored Strings to Patterns in TafConstants.
* </pre>
*
* @author grichard
@ -36,28 +41,36 @@ package com.raytheon.edex.plugin.taf.common;
public final class TafConstants {
/** Regular expression for extracting wind information */
public static final String WIND_GROUP_EXP = "(\\d{3}|VRB)(\\d{2,3})((G)(\\d{2,3}))?(KT|MPS|KMH)()";
public static final Pattern WIND_GROUP_EXP = Pattern
.compile("(\\d{3}|VRB)(\\d{2,3})((G)(\\d{2,3}))?(KT|MPS|KMH)()");
/** Regular expression for extracting visibility information */
public static final String VISIBILITY_GROUP_EXP = "(P?[0-6]|[0-6] [13]/[24]|[13]/[24])SM";
public static final Pattern VISIBILITY_GROUP_EXP = Pattern
.compile("(P?[0-6]|[0-6] [13]/[24]|[13]/[24])SM");
/** Regular expression for extracting sky coverage information */
public static final String SKY_COVER_GROUP_EXP = "(((FEW|SCT|BKN|OVC|VV)((\\d{3}|///)((CB|TCU)?)))|((SKC|CLR|NSC)))";
public static final Pattern SKY_COVER_GROUP_EXP = Pattern
.compile("(((FEW|SCT|BKN|OVC|VV)((\\d{3}|///)((CB|TCU)?)))|((SKC|CLR|NSC)))");
/** Regular expression for extracting wind shear information */
public static final String WIND_SHEAR_GROUP_EXP = "WS([0-9]{3})/([0-9]{3})([0-9]{2})KT";
public static final Pattern WIND_SHEAR_GROUP_EXP = Pattern
.compile("WS([0-9]{3})/([0-9]{3})([0-9]{2})KT");
/** Regular expression for extracting icing information */
public static final String ICING_GROUP_EXP = "6([0-9])([0-9]{3})([0-9])";
public static final Pattern ICING_GROUP_EXP = Pattern
.compile("6([0-9])([0-9]{3})([0-9])");
/** Regular expression for extracting turbulence information */
public static final String TURBULENCE_GROUP_EXP = "5([0-9])([0-9]{3})([0-9])";
public static final Pattern TURBULENCE_GROUP_EXP = Pattern
.compile("5([0-9])([0-9]{3})([0-9])");
/** Regular expression for extracting temperature information */
public static final String TEMP_GROUP_EXP = "T(M)?([0-9]{2})/([0-9]{2})Z";
public static final Pattern TEMP_GROUP_EXP = Pattern
.compile("T(M)?([0-9]{2})/([0-9]{2})Z");
/** Regular expression for extracting altimeter information */
public static final String ALTIMETER_GROUP_EXP = "QNH([23]\\d{3})INS";
public static final Pattern ALTIMETER_GROUP_EXP = Pattern
.compile("QNH([23]\\d{3})INS");
/**
* Pattern used for extracting change groups
@ -77,7 +90,8 @@ public final class TafConstants {
* </pre>
*/
public static final String CHANGE_GROUP_EXP = "((FM|((BECMG )|((PROB[34]0) +(TEMPO )?)|(TEMPO )))((\\d{6})|(([0-3]\\d{3})/([0-3]\\d{3})))( ))";
public static final Pattern CHANGE_GROUP_EXP = Pattern
.compile("((FM|((BECMG )|((PROB[34]0) +(TEMPO )?)|(TEMPO )))((\\d{6})|(([0-3]\\d{3})/([0-3]\\d{3})))( ))");
public static final String CG_FM = "FM";
@ -95,9 +109,9 @@ public final class TafConstants {
public static final String VS_6PLUS_M = "9999";
public static final String WX_NSW = "NSW";
public static final Pattern WX_NSW = Pattern.compile("NSW");
public static final String WX_CAVOK = "CAVOK";
public static final Pattern WX_CAVOK = Pattern.compile("CAVOK");
public static final String CLD_SKC = "SKC";
@ -109,20 +123,20 @@ public final class TafConstants {
public static final String COR_IND = "COR";
public static final String REPORT_HEADER = "(TAF )?((AMD|COR) )*?"
+ "([A-Z][A-Z,0-9]{3}) ([0-3]\\d{5}Z )?([0-3]\\d{5})( )";
public static final Pattern REPORT_HEADER = Pattern
.compile("(TAF )?((AMD|COR) )*?"
+ "([A-Z][A-Z,0-9]{3}) ([0-3]\\d{5}Z )?([0-3]\\d{5})( )");
public static final String REPORT_HEADER30 = "(TAF )?((AMD|COR) )*?"
+ "([A-Z][A-Z,0-9]{3}) ([0-3]\\d{5}Z )?(\\d{4}/\\d{4})( )";
public static final Pattern REPORT_HEADER30 = Pattern
.compile("(TAF )?((AMD|COR) )*?"
+ "([A-Z][A-Z,0-9]{3}) ([0-3]\\d{5}Z )?(\\d{4}/\\d{4})( )");
public static final String RPT_HDR_TAF = "(TAF((\\s)+(AMD|COR))?)";
public static final Pattern RPT_HDR_TAF = Pattern
.compile("(TAF((\\s)+(AMD|COR))?)");
public static final String RPT_HDR_CCCC = "([A-Z][A-Z,0-9]{3}) ([0-3]\\d{5}Z )?([0-3]\\d{3})/([0-3]\\d{3})( )";
public static final Pattern RPT_HDR_CCCC = Pattern
.compile("([A-Z][A-Z,0-9]{3}) ([0-3]\\d{5}Z )?([0-3]\\d{3})/([0-3]\\d{3})( )");
/**
* Constructor.
*/
private TafConstants() {
}
public static final Pattern FourDigitMetric = Pattern.compile("\\d{4}");
}

View file

@ -18,7 +18,7 @@
* further licensing information.
**/
package com.raytheon.edex.plugin.taf.common;
package com.raytheon.uf.common.dataplugin.taf;
import java.io.Serializable;
import java.util.Calendar;
@ -48,6 +48,7 @@ import com.raytheon.uf.common.wmo.WMOHeader;
* 30Aug2006 B. Phillippe Modified for use to decode TAFs for AWIPS
* Nov 01, 2013 2361 njensen Remove XML annotations
* May 14, 2014 2536 bclement moved WMO Header to common, removed TimeTools usage
* May 15, 2014 3002 bgonzale Moved to com.raytheon.uf.common.dataplugin.taf.
*
* </pre>
*

View file

@ -18,7 +18,7 @@
* further licensing information.
**/
package com.raytheon.edex.plugin.taf.common;
package com.raytheon.uf.common.dataplugin.taf;
import java.util.Date;
import java.util.HashSet;
@ -67,7 +67,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Nov 01, 2013 2361 njensen Remove XML annotations
* Feb 10, 2014 2777 rferrel Assign parent id when setting ChangeGroup.
* Feb 11, 2014 2784 rferrel Remove override of setIdentifier.
*
* May 15, 2014 3002 bgonzale Moved to com.raytheon.uf.common.dataplugin.taf.
* </pre>
*
* @author bphillip

View file

@ -18,7 +18,7 @@
* further licensing information.
**/
package com.raytheon.edex.plugin.taf.common;
package com.raytheon.uf.common.dataplugin.taf;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -46,6 +46,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* 6/21/2007 180 Phillippe initial creation.
* 4/16/2008 934 grichard Added toString overridden method.
* Nov 01, 2013 2361 njensen Remove XML annotations
* May 15, 2014 3002 bgonzale Moved to com.raytheon.uf.common.dataplugin.taf.
*
* </pre>
*

View file

@ -18,7 +18,7 @@
* further licensing information.
**/
package com.raytheon.edex.plugin.taf.common;
package com.raytheon.uf.common.dataplugin.taf;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -47,7 +47,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* 6/21/2007 180 Phillippe Initial creation
* 20081106 1515 jkorman Changed length of &quot;other&quot; attribute.
* Nov 01, 2013 2361 njensen Remove XML annotations
*
* May 15, 2014 3002 bgonzale Moved to com.raytheon.uf.common.dataplugin.taf.
* </pre>
*
* @author bphillip

View file

@ -18,7 +18,7 @@
* further licensing information.
**/
package com.raytheon.edex.plugin.taf.common;
package com.raytheon.uf.common.dataplugin.taf;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -47,7 +47,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* 8/30/2006 bphillip Initial Creation
* 6/21/2007 180 bphillip Updated for use with plugin persistence pattern
* Nov 01, 2013 2361 njensen Remove XML annotations
*
* May 15, 2014 3002 bgonzale Moved to com.raytheon.uf.common.dataplugin.taf.
* </pre>
*
* @author bphillip

View file

@ -18,7 +18,7 @@
* further licensing information.
**/
package com.raytheon.edex.plugin.taf.common;
package com.raytheon.uf.common.dataplugin.taf;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -45,7 +45,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* 8/30/2006 bphillip Initial Creation
* 6/21/2007 bphillip Updated for use with plugin persistance pattern
* Nov 01, 2013 2361 njensen Remove XML annotations
*
* May 15, 2014 3002 bgonzale Moved to com.raytheon.uf.common.dataplugin.taf.
* </pre>
*
* @author bphillip

View file

@ -242,7 +242,14 @@
unpack="false"/>
<plugin
id="com.raytheon.edex.plugin.taf"
id="com.raytheon.uf.edex.plugin.taf"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.common.dataplugin.taf"
download-size="0"
install-size="0"
version="0.0.0"

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.raytheon.edex.plugin.taf</name>
<name>com.raytheon.uf.edex.plugin.taf</name>
<comment></comment>
<projects>
</projects>

View file

@ -0,0 +1,7 @@
#Thu Mar 26 10:25:50 CDT 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6

View file

@ -1,18 +1,16 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Taf Plug-in
Bundle-SymbolicName: com.raytheon.edex.plugin.taf
Bundle-Version: 1.12.1174.qualifier
Bundle-SymbolicName: com.raytheon.uf.edex.plugin.taf
Bundle-Version: 1.14.0
Eclipse-RegisterBuddy: com.raytheon.edex.common, com.raytheon.uf.common.serialization
Bundle-Vendor: RAYTHEON
Export-Package: com.raytheon.edex.plugin.taf,
com.raytheon.edex.plugin.taf.common,
com.raytheon.edex.plugin.taf.decoder
Export-Package: com.raytheon.uf.edex.plugin.taf,
com.raytheon.uf.edex.plugin.taf.decoder
Require-Bundle: com.raytheon.edex.common,
com.raytheon.uf.edex.pointdata,
com.raytheon.uf.edex.decodertools;bundle-version="1.0.0",
org.apache.commons.lang,
javax.persistence
com.raytheon.uf.common.dataplugin.taf
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: com.raytheon.uf.common.wmo,
org.apache.commons.logging

View file

@ -4,9 +4,9 @@
<bean id="tafProperties" class="com.raytheon.uf.common.dataplugin.PluginProperties">
<property name="pluginName" value="taf" />
<property name="pluginFQN" value="com.raytheon.edex.plugin.taf" />
<property name="dao" value="com.raytheon.edex.plugin.taf.dao.TafDao" />
<property name="record" value="com.raytheon.edex.plugin.taf.common.TafRecord" />
<property name="pluginFQN" value="com.raytheon.uf.common.dataplugin.taf" />
<property name="dao" value="com.raytheon.uf.edex.plugin.taf.dao.TafDao" />
<property name="record" value="com.raytheon.uf.common.dataplugin.taf.TafRecord" />
<property name="dependencyFQNs">
<list>
<value>com.raytheon.uf.common.pointdata</value>

View file

@ -3,8 +3,8 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="tafDecoder" class="com.raytheon.edex.plugin.taf.TafDecoder" />
<bean id="tafSeparator" class="com.raytheon.edex.plugin.taf.decoder.TafSeparator" />
<bean id="tafDecoder" class="com.raytheon.uf.edex.plugin.taf.TafDecoder" />
<bean id="tafSeparator" class="com.raytheon.uf.edex.plugin.taf.decoder.TafSeparator" />
<bean id="tafDistRegistry" factory-bean="distributionSrv"
factory-method="register">

View file

@ -18,15 +18,15 @@
* further licensing information.
**/
package com.raytheon.edex.plugin.taf;
package com.raytheon.uf.edex.plugin.taf;
import com.raytheon.edex.exception.DecoderException;
import com.raytheon.edex.plugin.AbstractDecoder;
import com.raytheon.edex.plugin.taf.common.TafRecord;
import com.raytheon.edex.plugin.taf.decoder.TAFParser;
import com.raytheon.edex.plugin.taf.decoder.TAFParts;
import com.raytheon.uf.common.dataplugin.taf.TafRecord;
import com.raytheon.uf.common.dataplugin.taf.TAFParts;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.wmo.WMOHeader;
import com.raytheon.uf.edex.plugin.taf.decoder.TAFParser;
/**
*
@ -43,6 +43,7 @@ import com.raytheon.uf.common.wmo.WMOHeader;
* Apr 25, 2008 1001 jkorman Extracted decoder code into TAFParser.
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
* May 14, 2014 2536 bclement moved WMO Header to common, removed constrcutDataURI() call
* May 15, 2014 3002 bgonzale Moved common taf code to com.raytheon.uf.common.dataplugin.taf.
* </pre>
*
* @author bphillip

View file

@ -17,12 +17,12 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.edex.plugin.taf.dao;
package com.raytheon.uf.edex.plugin.taf.dao;
import java.util.List;
import com.raytheon.edex.db.dao.DefaultPluginDao;
import com.raytheon.edex.plugin.taf.common.TafRecord;
import com.raytheon.uf.common.dataplugin.taf.TafRecord;
import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.edex.database.DataAccessLayerException;
@ -36,6 +36,7 @@ import com.raytheon.uf.edex.database.DataAccessLayerException;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 20080103 384 jkorman Initial Coding.
* May 15, 2014 3002 bgonzale Moved common taf code to com.raytheon.uf.common.dataplugin.taf.
* </pre>
*
* @author jkorman

View file

@ -17,13 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.edex.plugin.taf.decoder;
import static com.raytheon.edex.plugin.taf.common.TafConstants.AMD_IND;
import static com.raytheon.edex.plugin.taf.common.TafConstants.COR_IND;
import static com.raytheon.edex.plugin.taf.common.TafConstants.REPORT_HEADER30;
import static com.raytheon.edex.plugin.taf.decoder.TAFParser.cvtInt;
import static com.raytheon.edex.plugin.taf.decoder.TafSeparator.STATION_ID;
package com.raytheon.uf.edex.plugin.taf.decoder;
import java.util.ArrayList;
import java.util.Calendar;
@ -35,9 +29,11 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.raytheon.edex.exception.DecoderException;
import com.raytheon.edex.plugin.taf.common.ChangeGroup;
import com.raytheon.edex.plugin.taf.common.TafPeriod;
import com.raytheon.edex.plugin.taf.common.TafRecord;
import com.raytheon.uf.common.dataplugin.taf.ChangeGroup;
import com.raytheon.uf.common.dataplugin.taf.TAFParts;
import com.raytheon.uf.common.dataplugin.taf.TafConstants;
import com.raytheon.uf.common.dataplugin.taf.TafPeriod;
import com.raytheon.uf.common.dataplugin.taf.TafRecord;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.uf.common.time.util.TimeUtil;
@ -54,6 +50,7 @@ import com.raytheon.uf.common.wmo.WMOHeader;
* add 30 Hour tafs.
* Nov 12, 2013 2546 bclement added check for legacy valid time
* May 14, 2014 2536 bclement moved WMO Header to common, removed TimeTools usage
* May 15, 2014 3002 bgonzale Moved common taf code to com.raytheon.uf.common.dataplugin.taf.
* </pre>
*
* @author jkorman
@ -402,11 +399,10 @@ public class TAFChangeGroupFactory {
StringBuilder sb = new StringBuilder(tafHeader.getExtension());
// The pattern regex needs a terminating space.
sb.append(" ");
Pattern headerPattern = Pattern.compile(REPORT_HEADER30);
Matcher matcher = headerPattern.matcher(sb);
Matcher matcher = TafConstants.REPORT_HEADER30.matcher(sb);
if (matcher.find()) {
stationId = matcher.group(STATION_ID);
stationId = matcher.group(TafSeparator.STATION_ID);
}
Matcher m = PAT_VALID_TIME.matcher(sb);
@ -419,9 +415,9 @@ public class TAFChangeGroupFactory {
issueTm = sb.substring(m.start(), m.end());
issueTimeString = issueTm;
int iDay = cvtInt(issueTm.substring(0, 2));
int iHour = cvtInt(issueTm.substring(2, 4));
int iMin = cvtInt(issueTm.substring(4, 6));
int iDay = TAFParser.cvtInt(issueTm.substring(0, 2));
int iHour = TAFParser.cvtInt(issueTm.substring(2, 4));
int iMin = TAFParser.cvtInt(issueTm.substring(4, 6));
issueTime = TimeUtil.newGmtCalendar(wmoHeader.getYear(),
wmoHeader.getMonth(), wmoHeader.getDay());
@ -562,10 +558,12 @@ public class TAFChangeGroupFactory {
record.setStationId(stationId);
if (isCOR || (tafParts.getTafHeader().indexOf(COR_IND) >= 0)) {
if (isCOR
|| (tafParts.getTafHeader().indexOf(TafConstants.COR_IND) >= 0)) {
record.setCorIndicator("COR");
}
if (isAMD || (tafParts.getTafHeader().indexOf(AMD_IND) >= 0)) {
if (isAMD
|| (tafParts.getTafHeader().indexOf(TafConstants.AMD_IND) >= 0)) {
record.setAmdIndicator("AMD");
}

View file

@ -17,21 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.edex.plugin.taf.decoder;
import static com.raytheon.edex.plugin.taf.common.TafConstants.AMD_IND;
import static com.raytheon.edex.plugin.taf.common.TafConstants.CG_BECMG;
import static com.raytheon.edex.plugin.taf.common.TafConstants.CG_FM;
import static com.raytheon.edex.plugin.taf.common.TafConstants.CG_INITIAL;
import static com.raytheon.edex.plugin.taf.common.TafConstants.CG_PROB;
import static com.raytheon.edex.plugin.taf.common.TafConstants.CG_PROB_TEMPO;
import static com.raytheon.edex.plugin.taf.common.TafConstants.CG_TEMPO;
import static com.raytheon.edex.plugin.taf.common.TafConstants.CHANGE_GROUP_EXP;
import static com.raytheon.edex.plugin.taf.common.TafConstants.COR_IND;
import static com.raytheon.edex.plugin.taf.common.TafConstants.REPORT_HEADER;
import static com.raytheon.edex.plugin.taf.decoder.TafSeparator.ISSUE_TIME;
import static com.raytheon.edex.plugin.taf.decoder.TafSeparator.STATION_ID;
import static com.raytheon.edex.plugin.taf.decoder.TafSeparator.VALID_TIME;
package com.raytheon.uf.edex.plugin.taf.decoder;
import java.util.ArrayList;
import java.util.Calendar;
@ -45,9 +31,11 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.raytheon.edex.exception.DecoderException;
import com.raytheon.edex.plugin.taf.common.ChangeGroup;
import com.raytheon.edex.plugin.taf.common.TafPeriod;
import com.raytheon.edex.plugin.taf.common.TafRecord;
import com.raytheon.uf.common.dataplugin.taf.ChangeGroup;
import com.raytheon.uf.common.dataplugin.taf.TAFParts;
import com.raytheon.uf.common.dataplugin.taf.TafConstants;
import com.raytheon.uf.common.dataplugin.taf.TafPeriod;
import com.raytheon.uf.common.dataplugin.taf.TafRecord;
import com.raytheon.uf.common.pointdata.spatial.ObStation;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.TimeRange;
@ -70,6 +58,8 @@ import com.raytheon.uf.edex.pointdata.spatial.ObStationDao;
* Oct 21, 2008 1515 jkorman Added 30 Hour capability changes.
* Feb 27, 2013 1638 mschenke Moved ObStationDao to edex pointdata plugin
* May 14, 2014 2536 bclement moved WMO Header to common, removed TimeTools usage
* May 15, 2014 3002 bgonzale Moved common taf code to com.raytheon.uf.common.dataplugin.taf.
* Refactored Strings to Patterns in TafConstants.
* </pre>
*
* @author jkorman
@ -83,7 +73,8 @@ public class TAFParser {
// COR hhmm
// AMD hhmm
// 01234567
private static final String AMD_COR_TIME = "(" + AMD_IND + "|" + COR_IND
private static final String AMD_COR_TIME = "(" + TafConstants.AMD_IND + "|"
+ TafConstants.COR_IND
+ ") \\d{4}";
private static final int HOUR_START = 4;
@ -218,10 +209,10 @@ public class TAFParser {
record.setWmoHeader(header.getWmoHeader());
if (isAMD) {
record.setAmdIndicator(AMD_IND);
record.setAmdIndicator(TafConstants.AMD_IND);
}
if (isCOR) {
record.setCorIndicator(COR_IND);
record.setCorIndicator(TafConstants.COR_IND);
}
ObStation location = null;
@ -251,12 +242,12 @@ public class TAFParser {
record = new TafRecord();
Pattern headerPattern = Pattern.compile(REPORT_HEADER);
Matcher matcher = headerPattern.matcher(tafParts.getTafHeader());
Matcher matcher = TafConstants.REPORT_HEADER.matcher(tafParts
.getTafHeader());
if (matcher.find()) {
String s = matcher.group(STATION_ID);
String s = matcher.group(TafSeparator.STATION_ID);
if (s != null) {
record.setStationId(s);
} else {
@ -264,7 +255,7 @@ public class TAFParser {
return;
}
s = matcher.group(ISSUE_TIME);
s = matcher.group(TafSeparator.ISSUE_TIME);
if (s != null) {
issueDate = transformDate(s, header);
issueDate.set(Calendar.MILLISECOND, 0);
@ -273,8 +264,10 @@ public class TAFParser {
// date-time. So we need to create one.
// Create an issue time from the valid period data.
StringBuilder sb = new StringBuilder();
sb.append(matcher.group(VALID_TIME).substring(0, 2));
sb.append(matcher.group(VALID_TIME).substring(2, 4));
sb.append(matcher.group(TafSeparator.VALID_TIME)
.substring(0, 2));
sb.append(matcher.group(TafSeparator.VALID_TIME)
.substring(2, 4));
sb.append("00Z");
issueDate = transformDate(sb.toString(), header);
issueDate.set(Calendar.MILLISECOND, 0);
@ -285,10 +278,10 @@ public class TAFParser {
checkAMDCOR(issueDate, tafParts.getTafBody());
s = tafParts.getTafHeader();
if (!isCOR) {
isCOR = s.indexOf(COR_IND) >= 0;
isCOR = s.indexOf(TafConstants.COR_IND) >= 0;
}
if (!isAMD) {
isAMD = s.indexOf(AMD_IND) >= 0;
isAMD = s.indexOf(TafConstants.AMD_IND) >= 0;
}
record.setIssue_time(issueDate.getTime());
@ -402,8 +395,8 @@ public class TAFParser {
issueDate = null;
}
}
isCOR = s.indexOf(COR_IND) >= 0;
isAMD = s.indexOf(AMD_IND) >= 0;
isCOR = s.indexOf(TafConstants.COR_IND) >= 0;
isAMD = s.indexOf(TafConstants.AMD_IND) >= 0;
}
return issueDate;
}
@ -438,8 +431,7 @@ public class TAFParser {
String reportBody = sb.toString();
Pattern p = Pattern.compile(CHANGE_GROUP_EXP);
Matcher m = p.matcher(reportBody);
Matcher m = TafConstants.CHANGE_GROUP_EXP.matcher(reportBody);
// Collect all of the start positions
ArrayList<Integer> positions = new ArrayList<Integer>();
@ -484,9 +476,9 @@ public class TAFParser {
*/
public static boolean isChangeGroup(String groupValue) {
boolean isTemp = CG_FM.equals(groupValue);
isTemp = isTemp || CG_BECMG.equals(groupValue);
isTemp = isTemp || CG_INITIAL.equals(groupValue);
boolean isTemp = TafConstants.CG_FM.equals(groupValue);
isTemp = isTemp || TafConstants.CG_BECMG.equals(groupValue);
isTemp = isTemp || TafConstants.CG_INITIAL.equals(groupValue);
return isTemp;
}
@ -497,9 +489,9 @@ public class TAFParser {
*/
public static boolean isTempGroup(String groupValue) {
boolean isTemp = CG_TEMPO.equals(groupValue);
isTemp = isTemp || CG_PROB_TEMPO.equals(groupValue);
isTemp = isTemp || CG_PROB.equals(groupValue);
boolean isTemp = TafConstants.CG_TEMPO.equals(groupValue);
isTemp = isTemp || TafConstants.CG_PROB_TEMPO.equals(groupValue);
isTemp = isTemp || TafConstants.CG_PROB.equals(groupValue);
return isTemp;
}
@ -521,10 +513,13 @@ public class TAFParser {
private static String formatTAF(String taf) {
StringBuilder sb = new StringBuilder(taf);
int n = 0;
String[] find = { "\r " + CG_FM, "\r " + CG_BECMG, "\r " + CG_TEMPO,
"\r " + CG_PROB, };
String[] replace = { "\r " + CG_FM, "\r " + CG_BECMG,
"\r " + CG_TEMPO, "\r " + CG_PROB, };
String[] find = { "\r " + TafConstants.CG_FM,
"\r " + TafConstants.CG_BECMG, "\r " + TafConstants.CG_TEMPO,
"\r " + TafConstants.CG_PROB, };
String[] replace = { "\r " + TafConstants.CG_FM,
"\r " + TafConstants.CG_BECMG,
"\r " + TafConstants.CG_TEMPO,
"\r " + TafConstants.CG_PROB, };
for (int i = 0; i < find.length; i++) {
while ((n = sb.indexOf(find[i])) >= 0) {
sb.replace(n, n + find[i].length(), replace[i]);

View file

@ -17,15 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.edex.plugin.taf.decoder;
import static com.raytheon.edex.plugin.taf.common.TafConstants.CG_BECMG;
import static com.raytheon.edex.plugin.taf.common.TafConstants.CG_FM;
import static com.raytheon.edex.plugin.taf.common.TafConstants.CG_INITIAL;
import static com.raytheon.edex.plugin.taf.common.TafConstants.CG_PROB;
import static com.raytheon.edex.plugin.taf.common.TafConstants.CG_PROB_TEMPO;
import static com.raytheon.edex.plugin.taf.common.TafConstants.CG_TEMPO;
import static com.raytheon.edex.plugin.taf.decoder.TAFParser.cvtInt;
package com.raytheon.uf.edex.plugin.taf.decoder;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -33,8 +25,9 @@ import java.util.regex.Pattern;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.raytheon.edex.plugin.taf.common.ChangeGroup;
import com.raytheon.edex.plugin.taf.common.TafPeriod;
import com.raytheon.uf.common.dataplugin.taf.ChangeGroup;
import com.raytheon.uf.common.dataplugin.taf.TafConstants;
import com.raytheon.uf.common.dataplugin.taf.TafPeriod;
/**
* TODO Add Description
@ -45,6 +38,7 @@ import com.raytheon.edex.plugin.taf.common.TafPeriod;
* ------------ ---------- ----------- --------------------------
* Oct 20, 2008 1515 jkorman Initial implementation to
* add 30 Hour tafs.
* May 15, 2014 3002 bgonzale Moved common taf code to com.raytheon.uf.common.dataplugin.taf.
* </pre>
*
* @author jkorman
@ -110,73 +104,73 @@ class TAFSubGroup {
Matcher m = PAT_PROBTEMPO.matcher(changeGroupHdr);
if (m.find()) {
changeGroupHeader = CG_PROB_TEMPO;
changeGroupHeader = TafConstants.CG_PROB_TEMPO;
prob = Integer.decode(changeGroupHdr.substring(4, 5));
startDay = cvtInt(changeGroupHdr.substring(13, 15));
startHour = cvtInt(changeGroupHdr.substring(15, 17));
stopDay = cvtInt(changeGroupHdr.substring(18, 20));
stopHour = cvtInt(changeGroupHdr.substring(20, 22));
startDay = TAFParser.cvtInt(changeGroupHdr.substring(13, 15));
startHour = TAFParser.cvtInt(changeGroupHdr.substring(15, 17));
stopDay = TAFParser.cvtInt(changeGroupHdr.substring(18, 20));
stopHour = TAFParser.cvtInt(changeGroupHdr.substring(20, 22));
return;
}
m = PAT_PROB.matcher(changeGroupHdr);
if (m.find()) {
changeGroupHeader = CG_PROB;
changeGroupHeader = TafConstants.CG_PROB;
prob = Integer.decode(changeGroupHdr.substring(4, 5));
startDay = cvtInt(changeGroupHdr.substring(7, 9));
startHour = cvtInt(changeGroupHdr.substring(9, 11));
stopDay = cvtInt(changeGroupHdr.substring(12, 14));
stopHour = cvtInt(changeGroupHdr.substring(14, 16));
startDay = TAFParser.cvtInt(changeGroupHdr.substring(7, 9));
startHour = TAFParser.cvtInt(changeGroupHdr.substring(9, 11));
stopDay = TAFParser.cvtInt(changeGroupHdr.substring(12, 14));
stopHour = TAFParser.cvtInt(changeGroupHdr.substring(14, 16));
return;
}
m = PAT_TEMPO.matcher(changeGroupHdr);
if (m.find()) {
changeGroupHeader = CG_TEMPO;
changeGroupHeader = TafConstants.CG_TEMPO;
startDay = cvtInt(changeGroupHdr.substring(6, 8));
startHour = cvtInt(changeGroupHdr.substring(8, 10));
stopDay = cvtInt(changeGroupHdr.substring(11, 13));
stopHour = cvtInt(changeGroupHdr.substring(13, 15));
startDay = TAFParser.cvtInt(changeGroupHdr.substring(6, 8));
startHour = TAFParser.cvtInt(changeGroupHdr.substring(8, 10));
stopDay = TAFParser.cvtInt(changeGroupHdr.substring(11, 13));
stopHour = TAFParser.cvtInt(changeGroupHdr.substring(13, 15));
return;
}
m = PAT_BECMG.matcher(changeGroupHdr);
if (m.find()) {
changeGroupHeader = CG_BECMG;
startDay = cvtInt(changeGroupHdr.substring(6, 8));
startHour = cvtInt(changeGroupHdr.substring(8, 10));
stopDay = cvtInt(changeGroupHdr.substring(11, 13));
stopHour = cvtInt(changeGroupHdr.substring(13, 15));
changeGroupHeader = TafConstants.CG_BECMG;
startDay = TAFParser.cvtInt(changeGroupHdr.substring(6, 8));
startHour = TAFParser.cvtInt(changeGroupHdr.substring(8, 10));
stopDay = TAFParser.cvtInt(changeGroupHdr.substring(11, 13));
stopHour = TAFParser.cvtInt(changeGroupHdr.substring(13, 15));
return;
}
m = PAT_FM.matcher(changeGroupHdr);
if (m.find()) {
changeGroupHeader = CG_FM;
changeGroupHeader = TafConstants.CG_FM;
startDay = cvtInt(changeGroupHdr.substring(2, 4));
startHour = cvtInt(changeGroupHdr.substring(4, 6));
startMin = cvtInt(changeGroupHdr.substring(6, 8));
startDay = TAFParser.cvtInt(changeGroupHdr.substring(2, 4));
startHour = TAFParser.cvtInt(changeGroupHdr.substring(4, 6));
startMin = TAFParser.cvtInt(changeGroupHdr.substring(6, 8));
return;
}
changeGroupHeader = CG_INITIAL;
changeGroupHeader = TafConstants.CG_INITIAL;
extension = changeGroupHdr;
int pos = changeGroupHdr.length() - "DDMM/DDMM".length();
startDay = cvtInt(changeGroupHdr.substring(pos, pos + 2));
startDay = TAFParser.cvtInt(changeGroupHdr.substring(pos, pos + 2));
pos += 2;
startHour = cvtInt(changeGroupHdr.substring(pos, pos + 2));
startHour = TAFParser.cvtInt(changeGroupHdr.substring(pos, pos + 2));
pos += 3;
stopDay = cvtInt(changeGroupHdr.substring(pos, pos + 2));
stopDay = TAFParser.cvtInt(changeGroupHdr.substring(pos, pos + 2));
pos += 2;
stopHour = cvtInt(changeGroupHdr.substring(pos, pos + 2));
stopHour = TAFParser.cvtInt(changeGroupHdr.substring(pos, pos + 2));
}
/**
@ -219,23 +213,23 @@ class TAFSubGroup {
ChangeGroup chgGroup = null;
TafPeriod period = null;
if (CG_FM.equals(changeGroupHeader)) {
if (TafConstants.CG_FM.equals(changeGroupHeader)) {
period = TafPeriod.determineChangeGroupPeriodDDhhmm(startDay
.intValue(), startHour.intValue(), startMin.intValue(),
issueTime);
} else if (CG_BECMG.equals(changeGroupHeader)) {
} else if (TafConstants.CG_BECMG.equals(changeGroupHeader)) {
period = TafPeriod.determineChangeGroupPeriodDDhhDDhh(startDay
.intValue(), startHour.intValue(), stopDay.intValue(),
stopHour.intValue(), issueTime, true);
} else if (CG_PROB.equals(changeGroupHeader)) {
} else if (TafConstants.CG_PROB.equals(changeGroupHeader)) {
period = TafPeriod.determineChangeGroupPeriodDDhhDDhh(startDay
.intValue(), startHour.intValue(), stopDay.intValue(),
stopHour.intValue(), issueTime, false);
} else if (CG_PROB_TEMPO.equals(changeGroupHeader)) {
} else if (TafConstants.CG_PROB_TEMPO.equals(changeGroupHeader)) {
period = TafPeriod.determineChangeGroupPeriodDDhhDDhh(startDay
.intValue(), startHour.intValue(), stopDay.intValue(),
stopHour.intValue(), issueTime, false);
} else if (CG_TEMPO.equals(changeGroupHeader)) {
} else if (TafConstants.CG_TEMPO.equals(changeGroupHeader)) {
period = TafPeriod.determineChangeGroupPeriodDDhhDDhh(startDay
.intValue(), startHour.intValue(), stopDay.intValue(),
stopHour.intValue(), issueTime, false);

View file

@ -17,13 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.edex.plugin.taf.decoder;
import static com.raytheon.edex.plugin.taf.common.TafConstants.AMD_IND;
import static com.raytheon.edex.plugin.taf.common.TafConstants.COR_IND;
import static com.raytheon.edex.plugin.taf.common.TafConstants.REPORT_HEADER;
import static com.raytheon.edex.plugin.taf.common.TafConstants.REPORT_HEADER30;
import static com.raytheon.edex.plugin.taf.common.TafConstants.TAF_IND;
package com.raytheon.uf.edex.plugin.taf.decoder;
import java.util.ArrayList;
import java.util.List;
@ -35,9 +29,11 @@ import org.apache.commons.logging.LogFactory;
import com.raytheon.edex.esb.Headers;
import com.raytheon.edex.plugin.AbstractRecordSeparator;
import com.raytheon.edex.plugin.taf.TafDecoder;
import com.raytheon.uf.common.dataplugin.taf.TAFParts;
import com.raytheon.uf.common.dataplugin.taf.TafConstants;
import com.raytheon.uf.common.wmo.WMOHeader;
import com.raytheon.uf.edex.decodertools.core.DecoderTools;
import com.raytheon.uf.edex.plugin.taf.TafDecoder;
/**
*
@ -53,6 +49,7 @@ import com.raytheon.uf.edex.decodertools.core.DecoderTools;
* and amended records
* 9/4/2008 1444 grichard Move constants to TafConstants class.
* May 14, 2014 2536 bclement moved WMO Header to common
* May 15, 2014 3002 bgonzale Moved common taf code to com.raytheon.uf.common.dataplugin.taf.
*
*
* </pre>
@ -65,11 +62,14 @@ public class TafSeparator extends AbstractRecordSeparator {
private final Log logger = LogFactory.getLog(getClass());
private static final String TEMPO_EXC = "EMPO (\\d{4}/\\d{4})";
private static final Pattern TEMPO_EXC = Pattern
.compile("EMPO (\\d{4}/\\d{4})");
private static final String BECMG_EXC = "ECMG (\\d{4}/\\d{4})";
private static final Pattern BECMG_EXC = Pattern
.compile("ECMG (\\d{4}/\\d{4})");
private static final String PROB_EXC = "OB[34]0 (\\d{4}/\\d{4})";
private static final Pattern PROB_EXC = Pattern
.compile("OB[34]0 (\\d{4}/\\d{4})");
public static final int STATION_ID = 4;
@ -178,20 +178,18 @@ public class TafSeparator extends AbstractRecordSeparator {
if (m.find()) {
int pos = 0;
if (!isAmd) {
pos = s.indexOf(AMD_IND);
pos = s.indexOf(TafConstants.AMD_IND);
isAmd = ((pos >= 0) && (pos <= m.end()));
}
if (!isCor) {
pos = s.indexOf(COR_IND);
pos = s.indexOf(TafConstants.COR_IND);
isCor = ((pos >= 0) && (pos <= m.end()));
}
}
ArrayList<Integer> partPos = new ArrayList<Integer>();
Pattern p = Pattern.compile(REPORT_HEADER);
m = p.matcher(s);
m = TafConstants.REPORT_HEADER.matcher(s);
if (m.find()) {
partPos.add(m.start());
@ -210,14 +208,9 @@ public class TafSeparator extends AbstractRecordSeparator {
}
partPos.add(s.length());
} else {
p = Pattern.compile(REPORT_HEADER30);
Pattern pT = Pattern.compile(TEMPO_EXC);
Pattern pB = Pattern.compile(BECMG_EXC);
Pattern pP = Pattern.compile(PROB_EXC);
Matcher m1 = null;
m = p.matcher(s);
m = TafConstants.REPORT_HEADER30.matcher(s);
if (m.find()) {
int start = m.start();
int stop = m.end();
@ -233,15 +226,15 @@ public class TafSeparator extends AbstractRecordSeparator {
// The TEMPO, BECMG, and PROB patterns can match the
// start
// of a taf so skip if there's a match.
m1 = pT.matcher(s.substring(start, stop));
m1 = TEMPO_EXC.matcher(s.substring(start, stop));
if (m1.find()) {
continue;
}
m1 = pB.matcher(s.substring(start, stop));
m1 = BECMG_EXC.matcher(s.substring(start, stop));
if (m1.find()) {
continue;
}
m1 = pP.matcher(s.substring(start, stop));
m1 = PROB_EXC.matcher(s.substring(start, stop));
if (m1.find()) {
continue;
}
@ -264,19 +257,21 @@ public class TafSeparator extends AbstractRecordSeparator {
StringBuilder tafHdr = new StringBuilder(s.substring(
partPos.get(i), partPos.get(i + 1)));
if ((isCor) && (tafHdr.indexOf(COR_IND) < 0)) {
if ((isCor)
&& (tafHdr.indexOf(TafConstants.COR_IND) < 0)) {
tafHdr.insert(0, ' ');
tafHdr.insert(0, COR_IND);
tafHdr.insert(0, TafConstants.COR_IND);
}
if ((isAmd) && (tafHdr.indexOf(AMD_IND) < 0)) {
if ((isAmd)
&& (tafHdr.indexOf(TafConstants.AMD_IND) < 0)) {
tafHdr.insert(0, ' ');
tafHdr.insert(0, AMD_IND);
tafHdr.insert(0, TafConstants.AMD_IND);
}
if (tafHdr.indexOf(TAF_IND) < 0) {
if (tafHdr.indexOf(TafConstants.TAF_IND) < 0) {
tafHdr.insert(0, ' ');
tafHdr.insert(0, TAF_IND);
tafHdr.insert(0, TafConstants.TAF_IND);
}
parts.setTafHeader(tafHdr.toString());

View file

@ -20,4 +20,4 @@
/**
* Contains TAF decoder implementation detail classes.
*/
package com.raytheon.edex.plugin.taf.decoder;
package com.raytheon.uf.edex.plugin.taf.decoder;

View file

@ -24,4 +24,4 @@
* and common packages.
*
*/
package com.raytheon.edex.plugin.taf;
package com.raytheon.uf.edex.plugin.taf;