(list);
- }
- }
- }
- if (runnables != null) {
- for (Runnable r : runnables) {
- r.run();
- }
- }
- }
-
- public static void setInstance(RcmResourceProvider instance) {
- RcmResourceProvider.instance = instance;
- }
-
- public static RcmResourceProvider getInstance() {
- return instance;
- }
-}
diff --git a/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/config/RcmUtil.java b/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/config/RcmUtil.java
deleted file mode 100755
index 5f4c954ec6..0000000000
--- a/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/config/RcmUtil.java
+++ /dev/null
@@ -1,86 +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.
- **/
-package com.raytheon.rcm.config;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.util.Scanner;
-
-import javax.xml.bind.JAXBException;
-
-import com.raytheon.rcm.config.awips1.Awips1RpsListUtil;
-import com.raytheon.rcm.request.Request;
-import com.raytheon.rcm.request.RpsList;
-import com.raytheon.rcm.request.RpsXml;
-import com.raytheon.uf.common.serialization.SerializationException;
-
-
-/**
- * Utility class for RCM.
- *
- *
- *
- * SOFTWARE HISTORY
- *
- * Date Ticket# Engineer Description
- * ------------ ---------- ----------- --------------------------
- * Jun 5, 2015 4498 nabowle Use JAXBManager to unmarshal. Rename to
- * RcmUtil.
- * Oct 15,2015 17789 wkwock Change max TDWR radar ID to 3099
- *
- *
- *
- * @version 1.0
- */
-public class RcmUtil {
-
- public static RadarType getRadarType(RadarConfig rc) {
- int id = rc.getNexradID();
- if (id >= 3000 && id <= 3099) // TODO: 3099 is the current max, but...
- return RadarType.TDWR;
- else if (id >= 4000 && id < 4050) // TODO: may be 4050
- return RadarType.ASR;
- else if (id >= 4100 && id < 5000)
- return RadarType.ARSR;
- else
- return RadarType.WSR;
- }
-
- public static RpsList parseRpsListData(byte[] data, int opModeHint,
- int vcpHint) throws IOException, JAXBException {
- ByteArrayInputStream bis = new ByteArrayInputStream(data);
- RpsList rpsList;
- if (new String(data, 0, 8).equals("RPS List")) {
- Request[] reqs = null;
- Scanner s = new Scanner(bis);
- reqs = Awips1RpsListUtil.parse(s);
- rpsList = new RpsList(opModeHint, vcpHint, reqs);
- } else {
- try {
- rpsList = (RpsList) RpsXml.getJAXBManager()
- .unmarshalFromInputStream(bis);
- } catch (SerializationException e) {
- throw new JAXBException(e);
- }
- }
- return rpsList;
- }
-
-}
diff --git a/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/config/StandardProductDistInfoDB.java b/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/config/StandardProductDistInfoDB.java
deleted file mode 100755
index 060cd82b99..0000000000
--- a/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/config/StandardProductDistInfoDB.java
+++ /dev/null
@@ -1,148 +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.
- **/
-package com.raytheon.rcm.config;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.raytheon.rcm.message.GraphicProduct.PDB;
-import com.raytheon.rcm.products.RadarProduct.Param;
-
-/**
- * Simple implementation of ProductDistInfoDB that can represent the AWIPS 1
- * prodList.txt and tdwrProdList.txt.
- *
- * This should only be use directly within the ...config.* sub-packages.
- *
- * Implementation note: Does not use MessageInfo to determine if a product
- * is elevation based. Whether or not the elevation angle is specified in
- * the matching criteria.
- */
-public class StandardProductDistInfoDB extends ProductDistInfoDB {
-
- protected static class SimpleMatch {
- public int messageCode;
- public Param matchParam;
- public int minValue;
- public int maxValue;
-
- public SimpleMatch(int messageCode) {
- this.messageCode = messageCode;
- }
-
- /**
- * NOTE: If matchParam is Param.CFC_BITMAP, minValue and maxValue
- * refer to the segment number (not the bitmap value).
- */
- public SimpleMatch(int messageCode, Param matchParam, int minValue, int maxValue) {
- if (matchParam != null && matchParam != Param.ELEVATION &&
- matchParam != Param.CFC_BITMAP)
- throw new IllegalArgumentException("Unsupported parameter "
- + matchParam);
- this.messageCode = messageCode;
- this.matchParam = matchParam;
- this.minValue = minValue;
- this.maxValue = maxValue;
- }
-
- @Override
- public boolean equals(Object obj) {
- try {
- SimpleMatch other = (SimpleMatch) obj;
- return messageCode == other.messageCode
- && matchParam == other.matchParam
- && minValue == other.minValue
- && maxValue == other.maxValue;
- } catch (ClassCastException e) {
- return false;
- }
- }
-
- @Override
- public int hashCode() {
- int result = matchParam != null ? matchParam.hashCode() : 0;
- result = (result * 31) ^ minValue;
- result = (result * 31) ^ maxValue;
- result = (result * 31) ^ messageCode;
- return result;
- }
- }
-
- HashMap matches = new HashMap();
-
- @Override
- public ProductDistributionInfo getProductDistInfo(RadarConfig rc,
- int messageCode, PDB pdb) {
- for (Map.Entry e : matches
- .entrySet()) {
- SimpleMatch match = e.getKey();
- if (match.messageCode == messageCode) {
- boolean matched = false;
- if (match.matchParam != null) {
- if (pdb != null) {
- int value;
- if (match.matchParam == Param.ELEVATION)
- value = pdb.getElevationAngle();
- else if (match.matchParam == Param.CFC_BITMAP)
- value = pdb.getElevationSegmentNumber();
- else if (match.matchParam == Param.TIME_SPAN_MINUTES)
- value = pdb.getTimeSpan();
- else
- continue;
- matched = value >= match.minValue &&
- value <= match.maxValue;
- }
- } else
- matched = true;
-
- if (matched)
- return e.getValue();
- }
- }
- return null;
- }
-
- /*
- * The following two methods are all that are needed now for the current
- * AWIPS 1 prodList.txt and tdwrProdList.txt files. If there are
- * conflicting terms, an IllegalArgumentException will be thrown which means
- * a redesign is needed.
- */
- public void add(int messageCode, ProductDistributionInfo info) {
- add(new SimpleMatch(messageCode), info);
- }
-
- public void add(int messageCode, Param param, int minValue, int maxValue,
- ProductDistributionInfo info) {
- add(new SimpleMatch(messageCode, param, minValue, maxValue), info);
- }
-
- protected void add(SimpleMatch match, ProductDistributionInfo info) {
- ProductDistributionInfo existing = matches.get(match);
- if (existing != null) {
- if (existing.equals(info))
- return;
- else
- throw new IllegalArgumentException(
- "Attempted to add conflicting information to the product distribution table.");
- } else
- matches.put(match, info);
- }
-}
diff --git a/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/config/awips1/Awips1RpsListUtil.java b/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/config/awips1/Awips1RpsListUtil.java
deleted file mode 100644
index 4b6d3cd66f..0000000000
--- a/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/config/awips1/Awips1RpsListUtil.java
+++ /dev/null
@@ -1,317 +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.
- **/
-package com.raytheon.rcm.config.awips1;
-
-import java.util.ArrayList;
-import java.util.NoSuchElementException;
-import java.util.Scanner;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import com.raytheon.rcm.config.RadarConfig;
-import com.raytheon.rcm.config.RadarType;
-import com.raytheon.rcm.config.RcmUtil;
-import com.raytheon.rcm.message.GSM;
-import com.raytheon.rcm.request.Request;
-import com.raytheon.rcm.request.RpsList;
-
-/**
- * Utility class for dealing with AWIPS 1 RPS lists.
- *
- *
- * SOFTWARE HISTORY
- *
- * Date Ticket# Engineer Description
- * ------------ ---------- ----------- --------------------------
- * 2009 dfriedma Initial version
- * 2012-04-30 DR 14908 D. Friedman Require radar name for valid RPS
- * file names.
- * 2015-06-10 4498 nabowle Rename Util->RcmUtil
- * 2017-02-06 DR 19764 jdynina Account for LR being other than 0.6 in TDWR Bld 2
- *
- *
- */
-public class Awips1RpsListUtil {
- // is 'maint' an opMode??
- public static class Selector {
- public String radar; // null === national
-
- public int opMode;
-
- public int vcp;
-
- public String comment; // extra stuff at end
- }
-
- public static Request[] parse(Scanner s) {
- ArrayList requests = new ArrayList();
-
- // Ref ProductRequestList.C : ProductRequestList::readList
- final int MAX_NAME_FIELD_SIZE = 41;
-
- // Skip the first five lines
- for (int i = 0; i < 5 && s.hasNextLine(); ++i)
- s.nextLine();
-
- while (s.hasNextLine()) {
- String line = s.nextLine();
- int pos;
- if ((pos = line.indexOf('\t')) != -1)
- line = line.substring(pos + 1);
- else
- line = line.substring(Math.min(MAX_NAME_FIELD_SIZE,
- line.length()));
- Scanner ls = new Scanner(line);
- try {
- Request req = new Request();
- String mne = ls.next();
- req.selectCurrent();
- req.count = Request.CONTINUOUS;
- req.comment = mne;
- req.productCode = ls.nextShort();
- /* int levels = */ls.nextInt(); // not used
- /* int res = */ls.nextInt(); // not used
- /* String layerCode = */ls.next(); // not used
- int elev = ls.nextInt();
- /* int contourInterval = */ls.nextInt(); // only for (obsolete?)
- // echo tops contour
- req.highPriority = ls.nextInt() != 0;
-
- /*
- * The next two fields tend to be smushed together. Scanner
- * cannot handle this.
- */
- String field = ls.next();
- try {
- if (Character.isLetter(field.charAt(field.length() - 1))) {
- String f1 = field.substring(0, field.length() - 1);
- req.interval = Short.parseShort(f1);
- req.mapRequested = field.charAt(field.length() - 1) == 'Y';
- field = null;
- }
- } catch (RuntimeException e) {
- throw new NoSuchElementException(e.toString());
- }
- if (field != null) {
- req.interval = Short.parseShort(field);
- req.mapRequested = ls.next().equals("Y");
- }
-
- // The remaining fields are optional
-
- // layers only used for product 137
- int lowerLayer = -1;
- int upperLayer = -1;
-
- boolean multiCuts = false;
-
- if (ls.hasNext())
- lowerLayer = ls.nextInt();
- if (ls.hasNext())
- upperLayer = ls.nextInt();
-
- if (ls.hasNext())
- multiCuts = ls.next().equals("Y");
-
- if (elev != -1) { // TODO: replace with logic for with ones
- // actually use elevation..
- if (multiCuts)
- req.selectAllElevations(elev & 0x1fff);
- else {
- // The AWIPS 1 code just sets this directly.
- req.pdw22 = elev;
- }
- }
-
- // also ProductRequestEntry::checkUpLowLayer
-
- int endHour = -1; // TODO: these too...
- int timeSpan = 0;
-
- if (ls.hasNext())
- endHour = ls.nextInt(); // TODO: these too...
- if (ls.hasNext())
- timeSpan = ls.nextInt();
-
- // copied from ProductRequestList::readList
- if (endHour < -1 || endHour > 1440)
- endHour = -1;
- if (timeSpan < 0 || timeSpan > 1440)
- timeSpan = 0;
-
- switch (req.productCode) {
- case 56:
- req.setStormSpeed(-1);
- break;
- case 137:
- req.setBottomAltitude(lowerLayer);
- req.setTopAltitude(upperLayer);
- break;
- // TODO: copied from AWIPS1; not verified
- case 31:
- case 150:
- case 151:
- case 173:
- req.setTimeSpan(timeSpan);
- req.setEndHour(endHour);
- break;
- case 35:
- case 36:
- case 37:
- case 38:
- case 41:
- case 57:
- case 58:
- case 59:
- case 61:
- case 141:
- case 149:
- /*
- * On the SPG, these products have a "mini-volume number"
- * parameter. It seems to be safe to set this for the RPG
- * even though it is not used.
- */
- req.setMiniVolume(lowerLayer);
- break;
- default:
- // nothing
- }
-
- requests.add(req);
- } catch (NoSuchElementException e) {
- }
- }
-
- return requests.toArray(new Request[requests.size()]);
- }
-
- protected static final Pattern selectorPattern = Pattern
- .compile("^(.+)\\.(.+)\\.VCP(\\d+)(?:\\.(.*))?$");
-
- protected static final Pattern maintPattern = Pattern
- .compile("^([^\\.]+)\\.maint(?:\\.(.*))?$");
-
- public static Selector parseName(String name) {
- Matcher m = selectorPattern.matcher(name);
- if (m.matches()) {
- Selector sel = new Selector();
-
- sel.radar = m.group(1).toLowerCase();
-
- String opModeString = m.group(2).toLowerCase();
- if (opModeString.equals("clear-air"))
- sel.opMode = GSM.OP_MODE_CLEAR_AIR;
- else if (opModeString.equals("storm"))
- sel.opMode = GSM.OP_MODE_STORM;
- else if (opModeString.equals("maint"))
- sel.opMode = GSM.OP_MODE_MAINTENANCE;
-
- sel.vcp = Integer.parseInt(m.group(3));
-
- sel.comment = m.group(4);
-
- return sel;
- }
- m = maintPattern.matcher(name);
- if (m.matches()) {
- Selector sel = new Selector();
- sel.radar = m.group(1).toLowerCase();
- sel.opMode = GSM.OP_MODE_MAINTENANCE;
- sel.vcp = 0;
- return sel;
- }
- return null;
- }
-
- /*
- * AWIPS 1 handling of the national and default local RPS lists for TDWRs
- * has an additional quirk: The 0.5, 1.0, 3.0, 6.0 elevation angles are
- * replaced with the lowest four elevation angles requested for products 180
- * - 183 in the site's local list. This essentially turns the national rps
- * list into a template.
- *
- * There may be a need for something like and RpsListTemplate in the config
- * package, but the extra logic will be kept here for now.
- *
- * The intent is to use the lowest four available elevation angles, so this
- * implementation uses the actual list of elevations angles instead of
- * relying on the existence of a configuration file.
- *
- * Note that there are two instances of this logic in AWIPS 1. One is
- * RadarServer, the other is in localization. The latter (which is applied
- * to the default local lists) does not examine the product ID.
- */
-
- public static RpsList maybeTransformForTDWR(RadarConfig rc, RpsList list,
- int[] cuts) {
-
- if (list != null && RcmUtil.getRadarType(rc) == RadarType.TDWR) {
- list = (RpsList) list.clone();
-
- int[] fourLowest = new int[4];
- int i = 0;
- int nLowest = 0;
-
- /*
- * The initial elevation angle is part of the long range scan
- * and not included.
- */
- if (cuts.length > 0 && cuts[1] < 10)
- ++i;
-
- while (nLowest < fourLowest.length && i < cuts.length)
- fourLowest[nLowest++] = cuts[i++];
-
- for (Request r : list.getRequests()) {
- if (r.productCode >= 180 && r.productCode <= 183) {
- int sel = r.getElevationSelection();
- if (sel == Request.SPECIFIC_ELEVATION
- || sel == Request.ALL_ELEVATIONS) {
- int newi = -1;
- switch (r.getElevationAngle()) {
- case 5:
- newi = 0;
- break;
- case 10:
- newi = 1;
- break;
- case 30:
- newi = 2;
- break;
- case 60:
- newi = 3;
- break;
- }
- if (newi >= 0 && newi < nLowest) {
- if (sel == Request.SPECIFIC_ELEVATION)
- r.setElevationAngle(fourLowest[newi]);
- else if (sel == Request.ALL_ELEVATIONS)
- r.selectAllElevations(fourLowest[newi]);
- }
- // else maybe should remove this request
- }
- }
- }
- }
-
- return list;
- }
-
-}
diff --git a/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/event/ConfigEvent.java b/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/event/ConfigEvent.java
deleted file mode 100755
index 9f2867b87e..0000000000
--- a/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/event/ConfigEvent.java
+++ /dev/null
@@ -1,114 +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.
- **/
-package com.raytheon.rcm.event;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import com.raytheon.rcm.config.RadarConfig;
-
-
-/**
- * Represents events that can happen within the RadarServer.
- *
- *
- *
- * SOFTWARE HISTORY
- * Date Ticket# Engineer Description
- * ------------ ---------- ----------- --------------------------
- * 2009-04-22 #1693 D. Friedman Initial checkin
- * ...
- * 2014-02-03 DR 14762 D. Friedman Add Category enum
- * 2015-02-11 DR 17092 D. Friedman Handle NDM cronOTRs.xml updates.
- * 2015-09-08 DR 17944 D. Friedman Handle elevation list file updates.
- *
- *
- */
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class ConfigEvent {
- public static enum Category {
- GLOBAL_CONFIG, RADAR_CONFIG, PROD_DISTRIBUTION, NATIONAL_RPS_LISTS,
- CRON_OTRS, ELEVATION_LISTS
- }
-
- private String radarID; // null indicates global configuration change.
- private RadarConfig oldConfig;
- private RadarConfig newConfig;
-
- private Category category;
-
- /** Public constructor for deserialization. Not intended for users. */
- public ConfigEvent() {
-
- }
-
- public ConfigEvent(Category category) {
- this.category = category;
- }
-
- public ConfigEvent(String radarID, RadarConfig oldConfig,
- RadarConfig newConfig) {
- this.radarID = radarID;
- this.oldConfig = oldConfig;
- this.newConfig = newConfig;
- this.category = radarID == null ? Category.GLOBAL_CONFIG : Category.RADAR_CONFIG;
- }
-
- public String getRadarID() {
- return radarID;
- }
-
- public void setRadarID(String radarID) {
- this.radarID = radarID;
- }
-
- public RadarConfig getOldConfig() {
- return oldConfig;
- }
-
- public void setOldConfig(RadarConfig oldConfig) {
- this.oldConfig = oldConfig;
- }
-
- public RadarConfig getNewConfig() {
- return newConfig;
- }
-
- public void setNewConfig(RadarConfig newConfig) {
- this.newConfig = newConfig;
- }
-
- public String toString() {
- if (radarID != null)
- return String.format("{Config change for radar '%s'}", radarID);
- else
- return "{Global config change}";
- }
-
- public Category getCategory() {
- return category;
- }
-
- public void setCategory(Category category) {
- this.category = category;
- }
-}
diff --git a/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/event/NotificationEvent.java b/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/event/NotificationEvent.java
deleted file mode 100644
index 6308d6ffb9..0000000000
--- a/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/event/NotificationEvent.java
+++ /dev/null
@@ -1,24 +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.
- **/
-package com.raytheon.rcm.event;
-
-abstract public class NotificationEvent {
-
-}
diff --git a/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/event/OtrEvent.java b/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/event/OtrEvent.java
deleted file mode 100644
index 7a82475b00..0000000000
--- a/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/event/OtrEvent.java
+++ /dev/null
@@ -1,51 +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.
- **/
-package com.raytheon.rcm.event;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import com.raytheon.rcm.request.Request;
-
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class OtrEvent extends NotificationEvent implements Cloneable {
- public Request request;
- public String radarID;
- public boolean done;
-
- /** The product data. For clients outside of the RadarServer, this
- * may be truncated after the PDB.
- */
- public byte[] product;
-
- /* (non-Javadoc)
- * @see java.lang.Object#clone()
- */
- @Override
- public OtrEvent clone() {
- try {
- return (OtrEvent) super.clone();
- } catch (CloneNotSupportedException e) {
- throw new RuntimeException(e);
- }
- }
-}
diff --git a/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/event/RadarEvent.java b/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/event/RadarEvent.java
deleted file mode 100755
index d54bde1aac..0000000000
--- a/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/event/RadarEvent.java
+++ /dev/null
@@ -1,91 +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.
- **/
-package com.raytheon.rcm.event;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
-
-import com.raytheon.rcm.config.LinkResource;
-
-/** Describes events that can occur within the Radar Server. */
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class RadarEvent {
- public static final int CONNECTION_UP = 1;
- public static final int CONNECTION_DOWN = 2;
- public static final int MESSAGE_RECEIVED = 3;
-
- public static final int CONNECTION_ATTEMPT_STARTED = 4;
- public static final int CONNECTION_ATTEMPT_FAILED = 5;
-
- private int type;
- private String radarID;
- private byte[] messageData;
- // TODO: Cache decoded message?
-
- /*
- * Transient because this field is currently only used to let the
- * ConnectionManger know which link is being used so that the RPSListManager
- * can know what the maximum RPS list size is. May do this another way in
- * the future and there is no need for clients to use it now.
- */
- @XmlTransient
- private LinkResource linkResource;
-
- public RadarEvent() {
-
- }
-
- public RadarEvent(int type, String radarID) {
- this.type = type;
- this.radarID = radarID;
- }
-
- public RadarEvent(int type, String radarID, byte[] messageBuffer) {
- this.type = type;
- this.radarID = radarID;
- this.messageData = messageBuffer;
- }
-
- public RadarEvent(int type, String radarID, LinkResource linkResource) {
- this.type = type;
- this.radarID = radarID;
- this.linkResource = linkResource;
- }
-
- public final int getType() {
- return type;
- }
-
- public final String getRadarID() {
- return radarID;
- }
-
- public final byte[] getMessageData() {
- return messageData;
- }
-
- public final LinkResource getLinkResource() {
- return linkResource;
- }
-
-}
diff --git a/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/event/RadarEventAdapter.java b/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/event/RadarEventAdapter.java
deleted file mode 100755
index dc68203b00..0000000000
--- a/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/event/RadarEventAdapter.java
+++ /dev/null
@@ -1,39 +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.
- **/
-package com.raytheon.rcm.event;
-
-public class RadarEventAdapter implements RadarEventListener {
-
- @Override
- public void handleConfigEvent(ConfigEvent event) {
- // nothing
- }
-
- @Override
- public void handleRadarEvent(RadarEvent event) {
- // nothing
- }
-
- @Override
- public void handleNotificationEvent(NotificationEvent event) {
- // nothing
- }
-
-}
diff --git a/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/event/RadarEventListener.java b/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/event/RadarEventListener.java
deleted file mode 100755
index 79e9360b72..0000000000
--- a/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/event/RadarEventListener.java
+++ /dev/null
@@ -1,26 +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.
- **/
-package com.raytheon.rcm.event;
-
-public interface RadarEventListener {
- public void handleRadarEvent(RadarEvent event);
- public void handleConfigEvent(ConfigEvent event);
- public void handleNotificationEvent(NotificationEvent event);
-}
diff --git a/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/message/CCM.java b/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/message/CCM.java
deleted file mode 100644
index 53c8ae8fdf..0000000000
--- a/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/message/CCM.java
+++ /dev/null
@@ -1,89 +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.
- **/
-package com.raytheon.rcm.message;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.Calendar;
-
-import com.raytheon.rcm.ccmreq.CcmRequestDefinition;
-
-/**
- * Represents the contents of an ORPG Command Control Message.
- *
- *
- * SOFTWARE HISTORY
- *
- * Date Ticket# Engineer Description
- * ------------ ---------- ----------- --------------------------
- * 2016-05-06 DCS18795 jdynina Initial version
- *
- *
- * @author jdynina
- * @version 1.0
- */
-
-public class CCM {
-
- private static final short MASK = (short) (1 << 13);
-
- public static byte[] encode(CcmRequestDefinition options) {
- Message msg = new Message();
- msg.messageCode = Message.COMMAND_CONTROL_MESSAGE;
- msg.time = Calendar.getInstance();
-
- try {
- msg.blocks = new byte[][] { encodeCcmBlock(options) };
- } catch (IOException ie) {
- ie.printStackTrace();
- }
-
- return msg.encode();
- }
-
- private static byte[] encodeCcmBlock(CcmRequestDefinition options) throws IOException {
-
- ByteBuffer buf = ByteBuffer.allocate(3 * 2); // 3 shorts
- short vcpFlag;
-
- if (options.getRestartVcp()) {
- vcpFlag = (short) 1;
- } else {
- vcpFlag = (short) 0;
- }
-
- Short vcp = (short) options.getVcp();
-
- if (vcp > Short.MAX_VALUE) {
- throw new IllegalArgumentException("Vcp Overflow occured");
- }
-
- if (vcpFlag == 1) {
- vcp = (short) ((short) vcp | MASK);
- }
-
- buf.putShort(vcp);
- buf.putShort((short) options.getAvsetEnabled());
- buf.putShort((short) options.getSailsCount());
-
- return buf.array();
- }
-}
-
diff --git a/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/message/CPM.java b/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/message/CPM.java
deleted file mode 100644
index 30f7a4d6c3..0000000000
--- a/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/message/CPM.java
+++ /dev/null
@@ -1,73 +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.
- **/
-package com.raytheon.rcm.message;
-
-import java.nio.ByteBuffer;
-
-/**
- * Represents the contents of an ORPG Command Parameter Message.
- *
- *
- * SOFTWARE HISTORY
- *
- * Date Ticket# Engineer Description
- * ------------ ---------- ----------- --------------------------
- * 2016-05-06 DCS18795 jdynina Initial version
- *
- *
- * @author jdynina
- * @version 1.0
- */
-
-public class CPM extends Message {
-
- public int[] clearAirVcps;
- public int[] precipVcps;
-
- public int maxSailsCuts;
-
- public static CPM decode(byte[] msg) {
- return (CPM) MD.decode(msg);
- }
-
- protected void decodeBlock(int index, ByteBuffer buf) {
- if (index != 1) {
- return;
- }
-
- int numClearAirVcps = buf.getShort();
- clearAirVcps = new int[numClearAirVcps];
-
- for (int i = 0; i < numClearAirVcps; ++i) {
- clearAirVcps[i] = buf.getShort();
- }
-
- int numPrecipVcps = buf.getShort();
- precipVcps = new int[numPrecipVcps];
-
- for (int i = 0; i < numPrecipVcps; ++i) {
- precipVcps[i] = buf.getShort();
- }
-
- buf.position(buf.limit() - 2);
- maxSailsCuts = buf.getShort();
-
- }
-}
diff --git a/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/message/ExternalData.java b/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/message/ExternalData.java
deleted file mode 100644
index eb3ff6ba60..0000000000
--- a/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/message/ExternalData.java
+++ /dev/null
@@ -1,130 +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.
- **/
-package com.raytheon.rcm.message;
-
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.Calendar;
-
-public class ExternalData extends GenericProduct {
-
- public GenericData genericData;
-
- public static interface ICompressor {
- byte[] compress(byte[] data);
- int getCompressionMethod();
- }
-
- public static byte[] encode(GenericData data) {
- return encode(data, null);
- }
-
- public static GenericData decodeExternalData(byte[] msgData) {
- ExternalData msg = new ExternalData();
- ByteBuffer buf = ByteBuffer.wrap(msgData);
- msg.decode(buf);
- return msg.genericData;
- }
-
- public static byte[] encode(GenericData data, ICompressor compressor) {
-
- byte[] packetData = encodeExternalDataPacket(data);
- int uncompressedSize = packetData.length;
- int compressionMethod = 0;
-
- if (compressor != null) {
- byte[] compressedData = compressor.compress(packetData);
- if (compressedData != null) {
- packetData = compressedData;
- compressionMethod = compressor.getCompressionMethod();
- }
- }
-
- ByteBuffer buf = ByteBuffer.allocate(HEADER_SIZE +
- + 6 * 2 + packetData.length);
-
- Message msg = new Message();
- msg.messageCode = Message.EXTERNAL_DATA;
- msg.time = Calendar.getInstance();
- msg.blocks = new byte[1][];
- msg.encodeHeader(buf);
- buf.putShort((short) -1);
-
- /* Value of 4 indicates Environmental Data from 40-km RUC Model.
- * - so shouldn't block id be configurable?
- */
- buf.putShort((short) 4);
- buf.putShort((short) 0); // Spare
- buf.putShort((short) compressionMethod); // Compression method
- buf.putInt(uncompressedSize);
- buf.put(packetData);
-
- return buf.array();
- }
-
- public static byte[] encodeExternalDataPacket(GenericData data) {
- ByteArrayOutputStream outStream = new ByteArrayOutputStream(4096);
- DataOutputStream out = new DataOutputStream(outStream);
-
- final int packetCode =
- GenericProduct.EXTERNAL_DATA_DESCRIPTION_PACKET;
-
- try {
- out.writeShort((short) packetCode);
- out.writeShort((short) 0); // "Reserved"
- out.writeInt(0); // Placeholder for data length
-
- data.encode(out, packetCode);
-
- out.flush();
- } catch (IOException e) {
- throw new RuntimeException("Encoding failed");
- }
-
- ByteBuffer buf = ByteBuffer.wrap(outStream.toByteArray());
- buf.putInt(4, buf.capacity() - 8); // Set the data length
-
- return buf.array();
- }
-
- @Override
- protected void decodeBlocks(ByteBuffer buf) {
- buf.getShort(); // Number of blocks
- int divider = buf.getShort();
- Message.checkFormat(divider == -1, "expected block divider");
- buf.getShort(); // block ID. don't care. have to assume it is 4
- buf.getShort(); // Spare
- int compressionMethod = buf.getShort();
- Message.checkFormat(compressionMethod == 0, "compression not supported");
- buf.getInt();
- int packetCode = buf.getShort();
- Message.checkFormat(packetCode == GenericProduct.EXTERNAL_DATA_DESCRIPTION_PACKET,
- "unexpected packet type");
- buf.getShort(); // Reserved
- int length = buf.getInt();
- ByteBuffer gdBuf = buf.slice();
- gdBuf.limit(length);
- genericData = new GenericData();
- genericData.decode(gdBuf, packetCode);
- }
-
-}
diff --git a/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/message/GSM.java b/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/message/GSM.java
deleted file mode 100755
index a2eb2b7da5..0000000000
--- a/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/message/GSM.java
+++ /dev/null
@@ -1,104 +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.
- **/
-package com.raytheon.rcm.message;
-
-import java.nio.ByteBuffer;
-
-/**
- * Represents the contents of an ORPG General Status Message.
- *
- *
- * SOFTWARE HISTORY
- *
- * Date Ticket# Engineer Description
- * ------------ ---------- ----------- --------------------------
- * 2009 dfriedman Initial version
- * 2016-04-22 DR 18909 dfriedman Read fields of expanded GSM.
- *
- */
-public class GSM extends Message {
- public static final int OP_MODE_MAINTENANCE = 0;
- public static final int OP_MODE_CLEAR_AIR = 1;
- public static final int OP_MODE_STORM = 2;
-
- public int opMode;
- public int rdaOpStatus;
- public int vcp;
- public int[] cuts; // in tenths of degrees
- public int rdaStatus;
- public int rdaAlarms;
- public int dataAvailability; // "DTE"
- public int rpgOpStatus;
- public int rpgAlarms;
- public int rpgStatus;
- public int rpgNarrowbandStatus;
- public int rcc;
- public int productAvailability;
- public int superResCuts;
- public int rdaVersion;
- public int rdaChannel;
- public int rpgVersion;
- public int vcpSupplemental;
-
- public static GSM decode(byte[] msg) {
- return (GSM) MD.decode(msg);
- }
-
- protected void decodeBlock(int index, ByteBuffer buf) {
- if (index != 1)
- return;
- opMode = buf.getShort();
- rdaOpStatus = buf.getShort();
- vcp = buf.getShort();
- int nCuts = buf.getShort();
- cuts = new int[nCuts];
- for (int i = 0; i < 20; ++i) {
- short cut = buf.getShort();
- if (i < cuts.length) {
- cuts[i] = cut;
- }
- }
- rdaStatus = buf.getShort();
- rdaAlarms = buf.getShort();
- dataAvailability = buf.getShort();
- rpgOpStatus = buf.getShort();
- rpgAlarms = buf.getShort();
- rpgStatus = buf.getShort();
- rpgNarrowbandStatus = buf.getShort();
- rcc = buf.getShort();
- productAvailability = buf.getShort();
- superResCuts = buf.getShort();
- buf.position(buf.position() + 4);
- rdaVersion = buf.getShort();
- rdaChannel = buf.getShort();
- buf.position(buf.position() + 4);
- rpgVersion = buf.getShort();
- if (buf.remaining() < 12) {
- return;
- }
- for (int i = 20; i < 25; ++i) {
- short cut = buf.getShort();
- if (i < cuts.length) {
- cuts[i] = cut;
- }
- }
- vcpSupplemental = buf.getShort();
- }
-}
diff --git a/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/message/GenericData.java b/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/message/GenericData.java
deleted file mode 100644
index e0485432fb..0000000000
--- a/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/message/GenericData.java
+++ /dev/null
@@ -1,570 +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.
- **/
-package com.raytheon.rcm.message;
-
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutput;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-
-import com.raytheon.rcm.message.Message;
-
-// TODO: redundant counts are not redundant... 0 == short circuit
-
-public class GenericData {
- public static final int VOLUME = 1;
- public static final int ELEVATION = 2;
- public static final int TIME = 3;
- public static final int ON_DEMAND = 4;
- public static final int ON_REQUEST = 5;
- public static final int RADIAL = 6;
- public static final int EXTERNAL = 7;
-
- public String name;
- public String description;
- public int code;
- public int type;
- public int generationTime;
- public String radarName;
- public float lat, lon, height;
- public int volumeScanStartTime;
- public int elevationScanStartTime;
- public float elevationAngle;
- public int volumeScanNumber;
- public short opMode;
- public short vcp;
- public short elevationNumber;
- public ParameterSet parameters = new ParameterSet();
- public Component[] components;
-
- public static class Parameter {
- /* The ICD says attribute names are case-insensitive, but the
- * RPG code expects lower case.
- */
- public static final String NAME_KEY = "name";
- public static final String TYPE_KEY = "type";
- public static final String VALUE_KEY = "value";
- public static final String UNITS_KEY = "units"; // Spec sez "unit". I see "Units"
-
- // TODO: Cache the toLower() value?
- private class Key {
- String originalName;
- public Key(String attributeName) {
- this.originalName = attributeName;
- }
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- else if (obj instanceof Key)
- return originalName.equalsIgnoreCase(((Key) obj).originalName);
- else
- return false;
- }
- @Override
- public int hashCode() {
- return originalName.toLowerCase().hashCode();
- }
- @Override
- public String toString() {
- return originalName;
- }
-
- }
-
- private String id;
- private Map attributes = new HashMap();
-
- public Parameter() {
-
- }
-
- public Parameter(String id) {
- this.id = id;
- }
-
- public Parameter(String id, String text) {
- this.id = id;
- setAttributesText(text);
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getName() { return getAttribute(NAME_KEY); }
- public String getType() { return getAttribute(TYPE_KEY); }
- public String getValue() { return getAttribute(VALUE_KEY); }
- public String getUnits() { return getAttribute(UNITS_KEY); }
- public void setName(String name) { putAttribute(NAME_KEY, name); }
- public void setType(String type) { putAttribute(TYPE_KEY, type); }
- public void setValueText(String value) { putAttribute(VALUE_KEY, value); }
- public void setUnits(String units) { putAttribute(UNITS_KEY, units); }
-
- public void setValue(String value) {
- setValueText(value);
- setType("string");
- }
-
- public void setValue(int value) {
- setValueText(Integer.toString(value));
- setType("int");
- }
-
- public void setValue(double value) {
- setValueText(String.format("%f", value));
- setType("float");
- }
-
- public void setAttributesText(String text) {
- attributes.clear();
- // TODO: needs to handle "\" escape
- for (String s : text.split(";")) {
- if (s.length() <= 0)
- continue;
- int pos = s.indexOf('=');
- String n = s.substring(0, pos).trim();
- String v = s.substring(pos + 1);
- attributes.put(new Key(n), v);
- }
- }
-
- public String getAttributesText() {
- StringBuilder sb = new StringBuilder();
- for (Map.Entry e : attributes.entrySet())
- sb.append(e.getKey().toString()).append('=').append(e.getValue()).append(';');
- return sb.toString();
- }
-
- public String getAttribute(String name) {
- return attributes.get(new Key(name));
- }
-
- public void putAttribute(String name, String value) {
- if (value != null)
- attributes.put(new Key(name), value);
- else
- attributes.remove(new Key(name));
- }
- }
-
- public static class ParameterSet {
- public Map getMap() { return map; }
-
- Parameter[] getArray() {
- return Arrays.copyOf(array, array.length);
- }
-
- private HashMap map = new HashMap();
- // array is just a debugging aid
- private Parameter[] array;
-
- void decode(ByteBuffer buf) {
- if (buf.getInt() > 0) {
- int nParameters = buf.getInt();
- array = new Parameter[nParameters];
- for (int i = 0; i < nParameters; ++i) {
- String id = getString(buf);
- String text = getString(buf);
- Parameter p = new Parameter(id, text);
- map.put(p.id, p);
- array[i] = p;
- }
- }
- }
-
- public void encode(DataOutput out) throws IOException{
- final int mapSize = map.size();
- out.writeInt(mapSize);
- if (mapSize > 0) {
- out.writeInt(mapSize); // redundant count
- for (Map.Entry p : map.entrySet()) {
- putString(out, p.getKey());
- putString(out, p.getValue().getAttributesText());
- }
- }
- }
-
- public void put(Parameter parameter) {
- map.put(parameter.id, parameter);
- }
- }
-
- public static abstract class Component {
- public static final int RADIAL = 1;
- public static final int GRID = 2;
- public static final int AREA = 3;
- public static final int TEXT = 4;
- public static final int TABLE = 5;
- public static final int EVENT = 6;
-
- public ParameterSet parameters = new ParameterSet();
-
- public void decode(ByteBuffer buf) {
- parameters = getParameters(buf);
- }
-
- public abstract int getTypeCode();
-
- public void encode(DataOutput out) throws IOException {
- parameters.encode(out);
- }
- }
-
- public static class AreaComponent extends Component {
- public static final int POINT = 1;
- public static final int AREA = 2;
- public static final int POLYLINE = 3;
- public static final int LAT_LON = 0;
- public static final int X_Y = 1;
- public static final int AZ_RAN = 2;
-
- public int geometry;
- public int coordinates;
- public float[] c0;
- public float[] c1;
-
- public void decode(ByteBuffer buf) {
- super.decode(buf);
- int geoCoord = buf.getInt();
- geometry = geoCoord & 0xffff;
- coordinates = (geoCoord >> 16) & 0xffff;
- if (buf.getInt() > 0) {
- int nCoords = buf.getInt();
- c0 = new float[nCoords];
- c1 = new float[nCoords];
- for (int i = 0; i < nCoords; ++i) {
- c0[i] = buf.getFloat();
- c1[i] = buf.getFloat();
- }
- } else {
- c0 = c1 = new float[0];
- }
- }
-
- @Override
- public void encode(DataOutput out) throws IOException {
- super.encode(out);
- out.writeInt(geometry | (coordinates << 16));
- if (c0 != null && c0.length > 0) {
- out.writeInt(c0.length);
- out.writeInt(c0.length);
- for (int i = 0; i < c0.length; ++i) {
- out.writeFloat(c0[i]);
- out.writeFloat(c1[i]);
- }
- } else
- out.writeInt(0);
- }
-
- @Override
- public int getTypeCode() {
- return Component.AREA;
- }
- }
-
- public static class EventComponent extends Component {
- public Component[] components;
-
- public void decode(ByteBuffer buf) {
- super.decode(buf);
- components = decodeComponents(buf);
- }
-
- @Override
- public int getTypeCode() {
- return Component.EVENT;
- }
-
- @Override
- public void encode(DataOutput out) throws IOException {
- super.encode(out);
- encodeComponents(out, components);
- }
- }
-
- public static class GridComponent extends Component {
- public static final int ARRAY = 1;
- public static final int EQUALLY_SPACED = 2;
- public static final int LAT_LON = 3;
- public static final int POLAR = 4;
-
- public int gridType;
- public int[] dimensions;
- public Object data;
- private Parameter dataAttributes = new Parameter(); // Not a full Parameter -- just the attributes
-
- public void decode(ByteBuffer buf) {
- if (buf.getInt() > 0) {
- int nDimensions = buf.getInt();
- dimensions = new int[nDimensions];
- for (int i = 0; i < nDimensions; ++i)
- dimensions[i] = buf.getInt();
- } else
- dimensions = new int[0];
- gridType = buf.getInt();
- super.decode(buf);
- dataAttributes = new Parameter();
- dataAttributes.setAttributesText(getString(buf));
- String type = dataAttributes.getType();
- if (type == null)
- throw new RuntimeException("Grid type not specified.");
- if (! type.equalsIgnoreCase("float"))
- throw new RuntimeException("Only grids of type float are supported.");
- int arraySize = buf.getInt();
- int pointCount = getPointCount();
- if (arraySize != pointCount)
- throw new RuntimeException("Grid array size and point count do not match.");
- float[] array = new float[pointCount];
- buf.asFloatBuffer().get(array);
- buf.position(buf.position() + array.length * 4);
- }
-
- @Override
- public int getTypeCode() {
- return Component.GRID;
- }
-
- @Override
- public void encode(DataOutput out) throws IOException {
- if (dimensions != null && dimensions.length > 0) {
- out.writeInt(dimensions.length);
- out.writeInt(dimensions.length);
- for (int d : dimensions)
- out.writeInt(d);
- } else
- out.writeInt(0);
- out.writeInt(gridType);
- super.encode(out);
-
- putString(out, dataAttributes.getAttributesText());
- if (data.getClass().isArray() &&
- data.getClass().getComponentType() == Float.TYPE) {
- float[] array = (float[]) data;
- // No redundant count for once.
- if (array.length != getPointCount())
- throw new IllegalArgumentException("Dimensions and data length do not match");
- ByteBuffer bb = ByteBuffer.allocate(array.length * 4);
- bb.asFloatBuffer().put(array);
- out.writeInt(array.length);
- out.write(bb.array());
- } else {
- throw new RuntimeException("Only grids of type float are supported.");
- }
- }
-
- public int getPointCount() {
- if (dimensions != null && dimensions.length > 0) {
- int count = 1;
- for (int d : dimensions)
- count *= d;
- return count;
- } else
- return 0;
- }
-
- /** Returns pseudo-parameter object that describes the grid data. */
- public Parameter getDataAttributes() {
- return dataAttributes;
- }
-
- }
-
- public void decode(ByteBuffer buf, int packetCode) {
- name = getString(buf);
- description = getString(buf);
- code = buf.getInt();
- type = buf.getInt();
- generationTime = buf.getInt();
- if (packetCode == 28) {
- radarName = getString(buf);
- lat = buf.getFloat();
- lon = buf.getFloat();
- height = buf.getFloat();
- volumeScanStartTime = buf.getInt();
- elevationScanStartTime = buf.getInt();
- elevationAngle = buf.getFloat();
- volumeScanNumber = buf.getInt();
- opMode = getXdrShort(buf);
- vcp = getXdrShort(buf);
- elevationNumber = getXdrShort(buf);
- } else if (packetCode == 29) {
- // Documented as "Spare".
- // ICD is confusing here about the number of fields.
- buf.getInt();
- buf.getInt();
- buf.getInt();
- buf.getInt();
- getXdrShort(buf);
- } else
- throw new RuntimeException("fix"); // TODO: ...
-
- // Documented as "Spare (reserved for future compression ...)"
- getXdrShort(buf);
- buf.getInt();
-
- parameters = getParameters(buf);
- components = decodeComponents(buf);
- }
-
- void encode(DataOutput out, int packetCode) throws IOException {
- putString(out, name);
- putString(out, description);
- out.writeInt(code);
- out.writeInt(type);
- out.writeInt(generationTime);
- if (packetCode == 28) {
- putString(out, radarName);
- out.writeFloat(lat);
- out.writeFloat(lon);
- out.writeFloat(height);
- out.writeInt(volumeScanStartTime);
- out.writeInt(elevationScanStartTime);
- out.writeFloat(elevationAngle);
- out.writeInt(volumeScanNumber);
- putXdrShort(out, opMode);
- putXdrShort(out, vcp);
- putXdrShort(out, elevationNumber);
- } else if (packetCode == 29) {
- // Documented as "Spare".
- // ICD is confusing here about the number of fields.
- out.writeInt(0);
- out.writeInt(0);
- out.writeInt(0);
- out.writeInt(0);
- putXdrShort(out, (short) 0);
- } else {
- throw new IllegalArgumentException(String.format("Unknown packet code %d", packetCode));
- }
- // Documented as "Spare (reserved for future compression ...)"
- putXdrShort(out, (short) 0);
- out.writeInt(0);
-
- parameters.encode(out);
- encodeComponents(out, components);
-
- }
-
- public byte[] encode(int packetCode) throws IOException {
- ByteArrayOutputStream outStream = new ByteArrayOutputStream(4096);
- DataOutputStream out = new DataOutputStream(outStream);
-
- encode(out, packetCode);
-
- out.flush();
- return outStream.toByteArray();
- }
-
- private static ParameterSet getParameters(ByteBuffer buf) {
- ParameterSet ps = new ParameterSet();
- ps.decode(buf);
- return ps;
- }
-
- private static Component[] decodeComponents(ByteBuffer buf) {
- Component[] components;
- if (buf.getInt() > 0) {
- components = new Component[buf.getInt()];
- for (int i = 0; i < components.length; ++i) {
- Component component = null;
- if (buf.getInt() != 0) { // Optional value flag
- int componentType = buf.getInt();
-
- switch (componentType) {
- case Component.AREA:
- component = new AreaComponent();
- break;
- case Component.EVENT:
- component = new EventComponent();
- break;
- case Component.GRID:
- component = new GridComponent();
- break;
- default:
- Message.checkFormat(false,
- String.format("Unsupported component type %d", componentType));
- }
- component.decode(buf);
- }
- components[i] = component;
- }
- } else
- components = new Component[0];
- return components;
- }
-
- private static void encodeComponents(DataOutput out, Component[] components) throws IOException {
- if (components != null && components.length > 0) {
- out.writeInt(components.length);
- out.writeInt(components.length); // Redundant count
- for (Component c : components) {
- if (c != null) {
- out.writeInt(1);
- out.writeInt(c.getTypeCode());
- c.encode(out);
- } else
- out.writeInt(0);
- }
- } else {
- out.writeInt(0);
- }
- }
-
- private static String getString(ByteBuffer buf) {
- int len = buf.getInt();
- byte[] bytes = new byte[len];
- buf.get(bytes);
- if ((len & 3) != 0)
- buf.position(buf.position() + (4 - (len & 3))); // it's an XDR thing
- return new String(bytes);
- }
-
- private static void putString(DataOutput out, String str) throws IOException {
- if (str != null) {
- byte[] bytes = str.getBytes();
- int len = bytes.length;
- out.writeInt(len);
- out.write(bytes);
- // XDR requires padding to a multiple of four bytes
- while ((len & 3) != 0) {
- out.write(0);
- ++len;
- }
- } else
- out.writeInt(0);
- }
-
- private static short getXdrShort(ByteBuffer buf) {
- // TODO: signedness.....
- return (short) buf.getInt();
- }
-
- private static void putXdrShort(DataOutput out, short value) throws IOException {
- out.writeInt(value);
- }
-}
diff --git a/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/message/GenericProduct.java b/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/message/GenericProduct.java
deleted file mode 100644
index 39f2d5bfdb..0000000000
--- a/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/message/GenericProduct.java
+++ /dev/null
@@ -1,119 +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.
- **/
-package com.raytheon.rcm.message;
-
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-
-import com.raytheon.rcm.message.GraphicProduct;
-import com.raytheon.rcm.message.Message;
-
-public class GenericProduct extends GraphicProduct {
-
- public static final int PRODUCT_DESCRIPTION_PACKET = 28;
- public static final int EXTERNAL_DATA_DESCRIPTION_PACKET = 29;
-
- public static GenericProduct decode(byte[] bytes) {
- GenericProduct gp = new GenericProduct();
- gp.decode(ByteBuffer.wrap(bytes));
- return gp;
- }
-
- @Override
- protected void decodeBlocks(ByteBuffer buf) {
- ByteBuffer block;
-
- // The header counts as one block
- int nBlocks = buf.getShort();
-
- // Read the PDB which is in a fixed-size block
- if (nBlocks < 2)
- return;
- block = buf.slice();
- block.limit(51 * 2);
- decodeBlock(1, block);
- buf.position(buf.position() + 51 * 2);
-
- for (int i = 2; i < nBlocks; ++i) {
- int divider = buf.getShort(buf.position()); // Note: does not consume the divider
- Message.checkFormat(divider == -1, "expected block divider");
- int blockSize = buf.getInt(buf.position() + 4); // Skip divider and block ID
- block = buf.slice();
- block.limit(blockSize);
- decodeBlock(i, block);
- buf.position(buf.position() + blockSize);
- }
- }
-
- @Override
- protected void decodeBlock(int index, ByteBuffer buf) {
- if (index > 1) {
- checkFormat(buf.getShort() == -1, "expected block divider");
- if (buf.getShort() != 1) // 1 == Symbology block
- return;
- buf.getInt(); // symbology size
- int nLayers = buf.getShort();
- layers = new Object[nLayers][];
- for (int iLayer = 0; iLayer < nLayers; ++iLayer) {
- checkFormat(buf.getShort() == -1, "expected layer divider");
-
- int layerSize = buf.getInt();
- ByteBuffer layerBuf = buf.slice();
- layerBuf.limit(layerSize);
- buf.position(buf.position() + layerSize);
-
- Object[] layer = decodeLayer(layerBuf);
- layers[iLayer] = layer;
- }
- } else
- super.decodeBlock(index, buf);
- }
-
- private Object[] decodeLayer(ByteBuffer buf) {
- ArrayList