OB_14.1.1-24 baseline
Former-commit-id: 8b1e7457fc58021208e4233502f118cf34df7534
This commit is contained in:
parent
bc6a7bf946
commit
face1ebeeb
5 changed files with 42 additions and 71 deletions
|
@ -21,10 +21,6 @@
|
|||
package com.raytheon.uf.viz.core;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.net.InetAddress;
|
||||
import java.net.NetworkInterface;
|
||||
import java.net.SocketException;
|
||||
import java.util.Enumeration;
|
||||
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
|
@ -52,6 +48,7 @@ import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
|||
* Jan 14, 2013 1469 bkowal Removed the hdf5 data directory.
|
||||
* Aug 27, 2013 2295 bkowal Removed the jms server property; added
|
||||
* jms connection string
|
||||
* Feb 17, 2014 2812 njensen getHostName() now uses getWsId()'s hostname
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -255,45 +252,20 @@ public final class VizApp {
|
|||
private static String host = null;
|
||||
|
||||
/**
|
||||
* Gets the ip address of the host machine calling the function
|
||||
* Gets the host name from the WsId of the host machine calling the function
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static synchronized String getHostName() {
|
||||
if (host == null) {
|
||||
InetAddress addrToUse = null;
|
||||
boolean found = false;
|
||||
try {
|
||||
Enumeration<NetworkInterface> nis = NetworkInterface
|
||||
.getNetworkInterfaces();
|
||||
while (nis.hasMoreElements() && !found) {
|
||||
NetworkInterface ni = nis.nextElement();
|
||||
ni.isVirtual();
|
||||
ni.isUp();
|
||||
Enumeration<InetAddress> addrs = ni.getInetAddresses();
|
||||
while (addrs.hasMoreElements() && !found) {
|
||||
InetAddress addr = addrs.nextElement();
|
||||
if (addr.isLinkLocalAddress() == false
|
||||
&& addr.isSiteLocalAddress() == false
|
||||
&& addr.isLoopbackAddress() == false) {
|
||||
addrToUse = addr;
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (SocketException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (addrToUse == null) {
|
||||
host = getWsId().getHostName();
|
||||
if (host == null) {
|
||||
String hostname = System.getenv("HOSTNAME");
|
||||
if (hostname != null && hostname.trim().length() == 0) {
|
||||
if (hostname != null && hostname.trim().length() > 0) {
|
||||
host = hostname;
|
||||
} else {
|
||||
host = "localhost";
|
||||
}
|
||||
} else {
|
||||
host = addrToUse.getHostName();
|
||||
}
|
||||
}
|
||||
return host;
|
||||
|
|
|
@ -22,6 +22,7 @@ package com.raytheon.viz.texteditor;
|
|||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
@ -62,6 +63,7 @@ import com.raytheon.viz.texteditor.msgs.ITextWorkstationCallback;
|
|||
* Apr 14, 2010 4734 mhuang Corrected StdTextProduct import
|
||||
* dependency
|
||||
* 05/28/2010 2187 cjeanbap Added StdTextProductFactory functionality.
|
||||
* 03/18/2014 DR 17174 D. Friedman Return correct 3-letter site IDs in getNnnXxx.
|
||||
* </pre>
|
||||
*
|
||||
* @author grichard
|
||||
|
@ -78,7 +80,7 @@ public final class TextDisplayModel {
|
|||
private static final Map<String, String> vtecPpToNnn = new HashMap<String, String>();
|
||||
|
||||
private static final Pattern warningPattern = Pattern
|
||||
.compile("/[A-Z]\\.([A-Z]{3})\\.\\p{Alnum}{1}(\\p{Alnum}{3})\\.([A-Z]{2}\\.[A-Z]{1})");
|
||||
.compile("/[A-Z]\\.([A-Z]{3})\\.(\\p{Alnum}{4})\\.([A-Z]{2}\\.[A-Z]{1})");
|
||||
|
||||
private static final Pattern nnnxxxPattern = Pattern
|
||||
.compile("[\\r\\n]+([A-Z]{3})([A-Z]{3})(| WRKWG[0-9])[\\r\\n]+");
|
||||
|
@ -514,29 +516,20 @@ public final class TextDisplayModel {
|
|||
* @return the product category and product designator strings
|
||||
*/
|
||||
public static String[] getNnnXxx(String warning) {
|
||||
String[] rval = { "nnn", "xxx" };
|
||||
if (warning != null) {
|
||||
Matcher m = warningPattern.matcher(warning);
|
||||
if (m.find()) {
|
||||
if (m.group(1).equals("NEW")
|
||||
&& vtecPpToNnn.containsKey(m.group(3))) {
|
||||
rval[0] = vtecPpToNnn.get(m.group(3));
|
||||
rval[1] = m.group(2);
|
||||
} else {
|
||||
m = nnnxxxPattern.matcher(warning);
|
||||
if (m.find()) {
|
||||
rval[0] = m.group(1);
|
||||
rval[1] = m.group(2);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
m = nnnxxxPattern.matcher(warning);
|
||||
if (m.find()) {
|
||||
rval[0] = m.group(1);
|
||||
rval[1] = m.group(2);
|
||||
if (m.find() && m.group(1).equals("NEW")) {
|
||||
String nnn = vtecPpToNnn.get(m.group(3));
|
||||
Set<String> siteSet = SiteMap.getInstance().getSite3LetterIds(m.group(2));
|
||||
if (nnn != null && siteSet.size() == 1) {
|
||||
return new String[] { nnn, siteSet.iterator().next() };
|
||||
}
|
||||
}
|
||||
m = nnnxxxPattern.matcher(warning);
|
||||
if (m.find()) {
|
||||
return new String[] { m.group(1), m.group(2) };
|
||||
}
|
||||
}
|
||||
return rval;
|
||||
return new String[] { "nnn", "xxx" };
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import java.util.TimeZone;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 8, 2008 1737 grichard Initial creation.
|
||||
* Mar 14, 2014 DR 17175 D. Friedman Fixed Atlantic and Samoa time zones
|
||||
* </pre>
|
||||
*
|
||||
* @author grichard
|
||||
|
@ -82,8 +83,8 @@ public final class TextWarningConstants {
|
|||
timeZoneAbbreviationMap.put("M", TimeZone.getTimeZone("MST7MDT"));
|
||||
timeZoneAbbreviationMap.put("m", TimeZone.getTimeZone("MST"));
|
||||
timeZoneAbbreviationMap.put("P", TimeZone.getTimeZone("PST8PDT"));
|
||||
timeZoneAbbreviationMap.put("S", TimeZone.getTimeZone("AST"));
|
||||
timeZoneAbbreviationMap.put("V", TimeZone.getTimeZone("VST"));
|
||||
timeZoneAbbreviationMap.put("S", TimeZone.getTimeZone("US/Samoa"));
|
||||
timeZoneAbbreviationMap.put("V", TimeZone.getTimeZone("America/Puerto_Rico"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.io.IOException;
|
|||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
@ -60,6 +61,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
* Apr 09, 2012 DR14765 mhuang Map out correct CCCC site ID for backup
|
||||
* sites.
|
||||
* May 15, 2013 1040 mpduff Add awips_site_list.xml.
|
||||
* Mar 18, 2014 DR 17173 D. Friedmna Re-implement DR 14765.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -93,6 +95,8 @@ public class SiteMap {
|
|||
|
||||
private final Map<String, Set<String>> siteTo3LetterSite = new HashMap<String, Set<String>>();
|
||||
|
||||
private final Set<String> site3to4LetterOverrides = new HashSet<String>();
|
||||
|
||||
private final Map<String, SiteData> siteMap = new TreeMap<String, SiteData>();
|
||||
|
||||
/** JAXB context */
|
||||
|
@ -163,6 +167,7 @@ public class SiteMap {
|
|||
nationalCategoryMap.clear();
|
||||
siteTo4LetterSite.clear();
|
||||
siteTo3LetterSite.clear();
|
||||
site3to4LetterOverrides.clear();
|
||||
siteMap.clear();
|
||||
|
||||
// load base afos lookup
|
||||
|
@ -311,6 +316,11 @@ public class SiteMap {
|
|||
}
|
||||
}
|
||||
|
||||
// Currently, only the 3-letter IDs are used (in
|
||||
// getSite4LetterId(), but it should be possible
|
||||
// to also add the 4-letter IDs to this set.
|
||||
site3to4LetterOverrides.add(site3);
|
||||
|
||||
site3To4LetterMap.put(site3, site4);
|
||||
|
||||
// Add the entry to the reverse lookup map
|
||||
|
@ -390,22 +400,17 @@ public class SiteMap {
|
|||
public String getSite4LetterId(String site3LetterId) {
|
||||
String site = siteTo4LetterSite.get(site3LetterId);
|
||||
|
||||
// if site not found default to K
|
||||
if (site == null) {
|
||||
/* If site not found default to K + 3-letter-ID.
|
||||
*
|
||||
* Or, if the 4-letter site ID that was looked up does not
|
||||
* start with a 'K' and did not come from
|
||||
* site3LetterTo4LetterOverride.dat, also return
|
||||
* K + 3-letter-ID.
|
||||
*/
|
||||
if (site == null
|
||||
|| (site.length() > 0 && site.charAt(0) != 'K' &&
|
||||
!site3to4LetterOverrides.contains(site3LetterId))) {
|
||||
site = "K" + site3LetterId;
|
||||
} else {
|
||||
// DR_14765, in case the site hashed out from combined mapping
|
||||
// table from both national_category_table and afo_lookup_table
|
||||
// does not start with K but not from
|
||||
// site3LetterTo4LetterOerride.dat
|
||||
// which are starting with P or T
|
||||
char[] siteChar = site.toCharArray();
|
||||
if (siteChar[0] != 'K') {
|
||||
if (!((siteChar[0] == 'P' && (siteChar[1] == 'A'
|
||||
|| siteChar[1] == 'G' || siteChar[1] == 'H')) || (siteChar[0] == 'T' && siteChar[1] == 'S'))) {
|
||||
site = "K" + site3LetterId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return site;
|
||||
|
|
|
@ -8,4 +8,4 @@ AFG PAFG
|
|||
AJK PAJK
|
||||
GUM PGUM
|
||||
HFO PHFO
|
||||
SJU TSJU
|
||||
SJU TJSJ
|
||||
|
|
Loading…
Add table
Reference in a new issue