Merge branch 'unidata_20.3.2' into unidata_20.3.2-osx

Bring over the most recent changes from the unidata_20.3.2 branch to the osx branch
This commit is contained in:
Shay Carter 2023-07-05 13:18:05 -07:00
commit 4e5e42f063
146 changed files with 121497 additions and 4112 deletions

40
.github/workflows/update_NDM.yml vendored Normal file
View file

@ -0,0 +1,40 @@
name: update station info
on:
workflow_dispatch:
schedule:
- cron: "0 6 * * *"
jobs:
update_ndm:
runs-on: ubuntu-latest
environment:
name: VLAB
steps:
# Checkout this repo
# this gets the latest code (and is run on the default branch)
- name: Checkout awips2
uses: actions/checkout@v3
with:
ref: unidata_20.3.2
# Do individual pulls for all the files in the ndm directory
- name: Pull latest from vlab svn repo
run: |
cd rpms/awips2.edex/Installer.edex/ndm/
for file in *; do
svn export --force https://vlab.noaa.gov/svn/awips-ndm/trunk/"$file" --username ${{ secrets.VLAB_UNAME }} --password ${{ secrets.VLAB_PASS }}
done
# Check in all the new files
# Only do a git add/commit/push if files have changed
- name: Update existing NDM files for awips2 repo
run: |
date=`date +%Y%m%d-%H:%M:%S`
git config user.name $GITHUB_ACTOR
git config user.email $GITHUB_ACTOR@users.noreply.github.com
change=`git diff`
if [[ ! -z "$change" ]]
then
git add --all
git commit -m "New NDM updates on $date - autogenerated"
git push
fi

View file

@ -1,7 +1,9 @@
#!/bin/bash
# Version
export AWIPSII_VERSION="20.3.2"
export AWIPSII_RELEASE="0.3"
export AWIPSII_RELEASE="0.4"
export AWIPSII_BUILD_DATE=`date`
export AWIPSII_BUILD_SYS=`cat /etc/system-release`
# Author
export AWIPSII_BUILD_VENDOR="UCAR"
export AWIPSII_BUILD_SITE="Unidata"

View file

@ -23,6 +23,11 @@ splashLoc=$(find /awips2/repo/awips2/cave -name "splash.bmp")
mv splash.bmp $splashLoc
echo "replacing splash.bmp"
#Set CAVE About information
echo "0=$AWIPSII_VERSION-$AWIPSII_RELEASE
1=$AWIPSII_BUILD_DATE
2=$AWIPSII_BUILD_SYS">/awips2/repo/awips2/cave/com.raytheon.viz.product.awips/about.mappings
# If local source directories, exist, mount them to the container
if [ $rpmname = "buildCAVE" ]; then
for dn in `cat build/repos| grep -v static| grep -v nativelib |grep -v awips2-rpm`
@ -72,10 +77,10 @@ if [[ $(whoami) == "awips" ]]; then # local build
sudo mv dist/${os_version}-dev dist/${os_version}-dev-${date}
sudo su - -c "createrepo -g /awips2/repo/awips2/dist/comps.xml /awips2/repo/awips2/dist/${os_version}-dev-${date}/"
sudo chown -R awips:fxalpha dist/${os_version}-dev-${date}
# rsync -aP dist/${os_version}-
#TM#echo "rsync -aP dist/${os_version}-dev-${date} tiffanym@fserv:/share/awips2/${AWIPSII_VERSION}/linux/"
#TM#rsync -aP dist/${os_version}-dev-${date} tiffanym@fserv:/share/awips2/${AWIPSII_VERSION}/linux/
rsync -aP dist/${os_version}-dev-${date} awips@edex3:/awips2/dev
echo "rsync -aP dist/${os_version}-dev-${date}"
#echo "rsync -aP dist/${os_version}-dev-${date} tiffanym@fserv:/share/awips2/${AWIPSII_VERSION}/linux/"
#rsync -aP dist/${os_version}-dev-${date} tiffanym@fserv:/share/awips2/${AWIPSII_VERSION}/linux/
#rsync -aP dist/${os_version}-dev-${date} awips@edex3:/awips2/dev
rsync -aP dist/${os_version}-dev-${date} awips@hardy:/awips2/dev
#repomanage -k1 --old dist/${os_version}-dev | xargs rm -f
#

View file

@ -53,3 +53,4 @@ com.raytheon.uf.viz.ncep.perspective.feature
com.raytheon.uf.viz.d2d.skewt.feature
com.raytheon.uf.viz.server.edex.feature
com.raytheon.uf.viz.dataplugin.nswrc.feature
edu.wisc.ssec.cimss.viz.probsevere.feature

View file

@ -301,6 +301,9 @@
<antcall target="p2.build.repo">
<param name="feature" value="com.raytheon.uf.viz.alertview.feature" />
</antcall>
<antcall target="p2.build.repo">
<param name="feature" value="edu.wisc.ssec.cimss.viz.probsevere.feature" />
</antcall>
<antcall target="cleanup.features" />
</target>

View file

@ -75,6 +75,10 @@
</and>
</activeWhen>
</handler>
<handler
class="com.raytheon.uf.viz.d2d.nsharp.D2DNsharpViewAction"
commandId="com.raytheon.uf.viz.d2d.nsharp.dialog">
</handler>
</extension>
<extension
point="com.raytheon.uf.viz.core.classContext">
@ -92,5 +96,11 @@
resourceType="sounding">
</productCreator>
</extension>
<extension
point="org.eclipse.ui.commands">
<command
id="com.raytheon.uf.viz.d2d.nsharp.dialog"
name="D2DNsharp">
</command>
</extension>
</plugin>

View file

@ -0,0 +1,56 @@
/**
*
* gov.noaa.nws.ncep.ui.nsharp.palette.NsharpViewAction
*
*
* This code has been developed by the NCEP-SIB for use in the AWIPS2 system.
*
* <pre>
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------- ------- -------- -----------
* 06/25/2012 229 Chin Chen Initial coding
* 06/15/2023 tiffanym@ucar Added into Unidata v20.3.2
*
* </pre>
*
* @author Chin Chen
* @version 1.0
*/
package com.raytheon.uf.viz.d2d.nsharp;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PlatformUI;
public class D2DNsharpViewAction extends AbstractHandler {
@Override
public Object execute(ExecutionEvent arg0) throws ExecutionException {
/*
* The viewID string is in the XML file for NSHARP extension point.
*/
String viewid = "com.raytheon.uf.viz.d2d.nsharp.display.D2DNSharpPaletteWindow";
IWorkbenchPage wpage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IViewPart vpart = wpage.findView( viewid);
try {
if ( vpart == null ){
vpart = wpage.showView(viewid );
} else {
if ( ! wpage.isPartVisible(vpart) ) vpart = wpage.showView( viewid );
}
}
catch (Exception e) {
e.printStackTrace();
}
return null;
}
}

View file

@ -23,7 +23,9 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.PlatformUI;
import com.raytheon.viz.ui.EditorUtil;
import com.raytheon.viz.ui.perspectives.AbstractVizPerspectiveManager;
@ -47,6 +49,7 @@ import gov.noaa.nws.ncep.ui.nsharp.view.NsharpPaletteWindow;
* ------------- -------- --------- ------------------------------------------
* May 12, 2011 9249 bsteffen Initial creation
* Apr 29, 2016 5607 bsteffen Fix modal tool manipulation in eclipse 4.
* Jun 15, 2023 tiffanym@ucar reimplement NSHARP load functionality
*
* </pre>
*
@ -57,6 +60,11 @@ public class D2DNSharpPaletteWindow extends NsharpPaletteWindow {
private static final String EDIT_TOOL_CATEGY = "com.raytheon.viz.ui.modalTool.nav";
private AbstractModalTool lastTool = null;
Shell shell = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getShell();
D2DNsharpLoadDialog loadDia = D2DNsharpLoadDialog.getInstance(shell);
@Override
public void init(IViewSite site) {
@ -104,8 +112,9 @@ public class D2DNSharpPaletteWindow extends NsharpPaletteWindow {
@Override
public void handleEvent(Event event) {
D2DNsharpHandleArchiveFile.openArchiveFile(getViewSite()
.getShell());
if (loadDia != null) {
loadDia.open();
}
}
});

View file

@ -0,0 +1,292 @@
/**
*
* com.raytheon.uf.viz.d2d.nsharp.view.D2DNsharpLoadDialog
*
* This java class performs the NSHARP D2DNsharpLoadDialog functions.
* This code has been developed by the NCEP-SIB for use in the AWIPS2 system.
*
* <pre>
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------- ------- -------- -----------
* 03/23/2010 229 Chin Chen Initial coding
* 06/15/2023 tiffanym@ucar Added into Unidata v20.3.2
*
* </pre>
*
* @author Chin Chen
* @version 1.0
*/
package com.raytheon.uf.viz.d2d.nsharp.display;
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingProfile;
import gov.noaa.nws.ncep.ui.nsharp.NsharpConstants;
import gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor;
import com.raytheon.uf.viz.d2d.nsharp.display.map.D2DNsharpMapResource;
import com.raytheon.uf.viz.d2d.nsharp.display.D2DNsharpHandleArchiveFile;
import com.raytheon.uf.viz.d2d.nsharp.display.D2DNsharpObservedSoundingDialogContents;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import com.raytheon.uf.viz.core.exception.VizException;
public class D2DNsharpLoadDialog extends Dialog {
private final static int DIALOG_WIDTH = 300;
private final static int DIALOG_HEIGHT = 700;
protected Composite top;
private static Composite dialogParent;
private static D2DNsharpLoadDialog INSTANCE = null;
private static Shell shell;
public static final String soundingTypeString = "Observed Soundings";
public static final int OBSER_SND = 0;
public static final int ARCHIVE = 3; // TBDGPD 5;
private D2DNsharpObservedSoundingDialogContents obsDialog;
private Group soundingTypeGp;
private int activeLoadSoundingType;
private NcSoundingProfile.ObsSndType activeObsSndType = NcSoundingProfile.ObsSndType.BUFRUA;
private ArrayList<String> obsSelectedTimeList = new ArrayList<String>();
private String activeGpdProdName = "";
private ArrayList<String> gpdSelectedTimeList = new ArrayList<String>();
private Text text1;
private MessageBox mb;
private Cursor waitCursor = null;
private Font newFont;
public Font getNewFont() {
return newFont;
}
public D2DNsharpObservedSoundingDialogContents getObsDialog() {
return obsDialog;
}
public void setAndOpenMb(String msg) {
if (mb != null) {
mb.setMessage(msg);
try {
mb.open();
} catch (Exception e) {
mb = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK);
mb.setMessage(msg);
mb.open();
}
}
}
private void cleanSelf() {
if (text1 != null) {
text1.dispose();
text1 = null;
}
}
private void cleanupDialog(int activeLoadType) {
switch (activeLoadType) {
case OBSER_SND:
obsDialog.cleanup();
break;
default:
break;
}
}
public void setActiveLoadSoundingType(int activeLoadSoundingType) {
this.activeLoadSoundingType = activeLoadSoundingType;
}
public int getActiveLoadSoundingType() {
return activeLoadSoundingType;
}
public ArrayList<String> getObsSelectedTimeList() {
return obsSelectedTimeList;
}
public void setObsSelectedTimeList(ArrayList<String> obsSelectedTimeList) {
this.obsSelectedTimeList = obsSelectedTimeList;
}
public ArrayList<String> getGpdSelectedTimeList() {
return gpdSelectedTimeList;
}
public void setGpdSelectedTimeList(ArrayList<String> gpdSelectedTimeList) {
this.gpdSelectedTimeList = gpdSelectedTimeList;
}
public NcSoundingProfile.ObsSndType getActiveObsSndType() {
return activeObsSndType;
}
public void setActiveObsSndType(
NcSoundingProfile.ObsSndType activeObsSndType) {
this.activeObsSndType = activeObsSndType;
}
public String getActiveGpdProdName() {
return activeGpdProdName;
}
public void setActiveGpdProdName(String activeGpdProdName) {
this.activeGpdProdName = activeGpdProdName;
}
static int count = 0;
public static D2DNsharpLoadDialog getAccess() {
return INSTANCE;
}
public D2DNsharpLoadDialog(Shell parentShell) throws VizException {
super(parentShell);
this.setShellStyle(SWT.TITLE | SWT.MODELESS | SWT.CLOSE
| SWT.SHELL_TRIM);
activeLoadSoundingType = OBSER_SND;
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets
* .Shell)
*/
@Override
protected void configureShell(Shell shell) {
super.configureShell(shell);
D2DNsharpLoadDialog.shell = shell;
shell.setSize(getDialogWidth(), DIALOG_HEIGHT);
shell.setText("Load Data");
mb = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK);
mb.setMessage("User Input Error!");
Font font = shell.getFont();
FontData[] fontData = font.getFontData();
for (int i = 0; i < fontData.length; i++) {
fontData[i].setHeight(7);
}
newFont = new Font(font.getDevice(), fontData);
shell.setFont(newFont);
}
private void createLoadContents(Composite parent) {
dialogParent = parent;
obsDialog = new D2DNsharpObservedSoundingDialogContents(dialogParent);
obsDialog.createObsvdDialogContents();
activeLoadSoundingType = OBSER_SND;
}
/**
* Creates the dialog area
*/
@Override
public Control createDialogArea(Composite parent) {
top = (Composite) super.createDialogArea(parent);
GridLayout mainLayout = new GridLayout(1, false);
mainLayout.marginHeight = 3;
mainLayout.marginWidth = 3;
createLoadContents(top);
if (waitCursor == null)
waitCursor = new Cursor(top.getDisplay(), SWT.CURSOR_WAIT);
return top;
}
@Override
public int open() {
if (this.getShell() == null) {
this.create();
}
this.getShell().setLocation(
this.getShell().getParent().getLocation().x + 1100,
this.getShell().getParent().getLocation().y + 200);
D2DNsharpMapResource.bringMapEditorToTop();
return super.open();
}
@Override
public boolean close() {
cleanSelf();
cleanupDialog(activeLoadSoundingType);
if (waitCursor != null)
waitCursor.dispose();
waitCursor = null;
newFont.dispose();
return (super.close());
}
public boolean closeDiaOnly() {
cleanSelf();
return (super.close());
}
@Override
public void createButtonsForButtonBar(Composite parent) {
createButton(parent, IDialogConstants.CANCEL_ID,
IDialogConstants.CLOSE_LABEL, false);
}
public static D2DNsharpLoadDialog getInstance(Shell parShell) {
if (INSTANCE == null) {
try {
INSTANCE = new D2DNsharpLoadDialog(parShell);
} catch (VizException e) {
e.printStackTrace();
}
}
return INSTANCE;
}
public void startWaitCursor() {
if (waitCursor != null)
top.setCursor(waitCursor);
}
public void stopWaitCursor() {
top.setCursor(null);
}
public static int getDialogWidth() {
return DIALOG_WIDTH;
}
}

View file

@ -0,0 +1,369 @@
/**
*
* gov.noaa.nws.ncep.ui.nsharp.view.ObservedSoundingDialogContents
*
* This java class performs the NSHARP D2DNsharpLoadDialog functions.
* This code has been developed by the NCEP-SIB for use in the AWIPS2 system.
*
* <pre>
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------- ------- -------- -----------
* 01/2011 229 Chin Chen Initial coding
* 09/14/2011 457 S. Gurung Renamed H5UAIR to NCUAIR
* 07202015 RM#9173 Chin Chen use NcSoundingQuery.genericSoundingDataQuery() to query grid model sounding data
* 06/15/2023 tiffanym@ucar Added into Unidata v20.3.2
*
* </pre>
*
* @author Chin Chen
* @version 1.0
*/
package com.raytheon.uf.viz.d2d.nsharp.display;
import gov.noaa.nws.ncep.viz.soundingrequest.NcSoundingQuery;
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingProfile;
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingStnInfo;
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingStnInfoCollection;
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingTimeLines;
import gov.noaa.nws.ncep.ui.nsharp.NsharpConstants;
import gov.noaa.nws.ncep.ui.nsharp.NsharpStationInfo;
import com.raytheon.uf.viz.d2d.nsharp.display.map.D2DNsharpMapResource;
import java.text.DateFormatSymbols;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Listener;
public class D2DNsharpObservedSoundingDialogContents {
private Composite parent;
private org.eclipse.swt.widgets.List sndTimeList;
private Group sndTimeListGp, topGp;
private boolean timeLimit = false;
private boolean rawData = false;
private Button timeBtn, bufruaBtn, uairBtn, rawBtn;
private String FILE_UAIR = "UAIR";
private String FILE_BUFRUA = "BUFRUA";
// private String FILE_DROP = "DROP";
private NcSoundingProfile.ObsSndType currentSndType = NcSoundingProfile.ObsSndType.NONE;
private D2DNsharpLoadDialog ldDia;
private ArrayList<String> selectedTimeList = new ArrayList<String>();
private Font newFont;
public boolean isRawData() {
return rawData;
}
public NcSoundingProfile.ObsSndType getCurrentSndType() {
return currentSndType;
}
public D2DNsharpObservedSoundingDialogContents(Composite parent) {
this.parent = parent;
ldDia = D2DNsharpLoadDialog.getAccess();
newFont = ldDia.getNewFont();
}
private void createObsvdSndUairList() {
sndTimeList.removeAll();
// use NcSoundingQuery to query
NcSoundingTimeLines timeLines = NcSoundingQuery
.soundingTimeLineQuery(currentSndType.toString());
if (timeLines != null && timeLines.getTimeLines() != null) {
DateFormatSymbols dfs = new DateFormatSymbols();
String[] defaultDays = dfs.getShortWeekdays();
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
ldDia.startWaitCursor();
for (Object timeLine : timeLines.getTimeLines()) {
Date synoptictime = (Date) timeLine;
if (synoptictime != null) {
// need to format synoptictime to GMT time string.
// Date.toString produce a local time Not GMT time
cal.setTimeInMillis(synoptictime.getTime());
String dayOfWeek = defaultDays[cal
.get(Calendar.DAY_OF_WEEK)];
// String gmtTimeStr =
// String.format("%1$ty%1$tm%1$td/%1$tH%1$tM %2$s", cal,
// currentSndType.toString());
String gmtTimeStr = String.format(
"%1$ty%1$tm%1$td/%1$tH(%3$s) %2$s", cal,
currentSndType.toString(), dayOfWeek);
if (!timeLimit) {
// System.out.println("not 00z and 12z only");
sndTimeList.add(gmtTimeStr);
} else {
int hour = cal.get(Calendar.HOUR_OF_DAY);
// System.out.println("00z and 12z only hour = "+ hour);
if ((hour == 0) || (hour == 12))
sndTimeList.add(gmtTimeStr);
}
}
}
ldDia.stopWaitCursor();
} else
System.out.println("EDEX timeline query return null");
}
private void queryAndMarkStn(String selectedSndTime) {
String selectTimetr = NcSoundingQuery
.convertSoundTimeDispStringToRangeStartTimeFormat(selectedSndTime);
D2DNsharpMapResource nsharpMapResource = D2DNsharpMapResource
.getOrCreateNsharpMapResource();
// Chin float lat, lon;
double lat, lon;
String stnInfoStr;
// use NcSoundingQuery to query stn info
NcSoundingStnInfoCollection sndStnInfoCol = NcSoundingQuery.genericSoundingStnInfoQuery(currentSndType.toString(),null, selectTimetr) ;
// .soundingStnInfoQuery(currentSndType.toString(), selectTimetr);
if (sndStnInfoCol != null && sndStnInfoCol.getStationInfo() != null) {
NcSoundingStnInfo[] stnInfoAry = sndStnInfoCol.getStationInfo();
// System.out.println("obs station number = "+ stnInfoAry.length );
// Note: A same station may have many reports
for (int i = 0; i < stnInfoAry.length; i++) {
NcSoundingStnInfo stnInfo = stnInfoAry[i];
Date synoptictime = null;
stnInfoStr = stnInfo.getStnId();
if (stnInfoStr == null || stnInfoStr.length() < 1)
stnInfoStr = "*";
lat = stnInfo.getStationLatitude();
lon = stnInfo.getStationLongitude();
// elv = stnInfo.getStationElevation();
synoptictime = (Date) stnInfo.getSynopTime();
// convert to Nsharp's own station info struct
NsharpStationInfo stn = new NsharpStationInfo();
String packedStnInfoStr = stnInfoStr.replace(" ", "_");
stn.setStnDisplayInfo(packedStnInfoStr + " " + selectedSndTime
+ " " + currentSndType.toString());
stn.setLongitude(lon);
stn.setLatitude(lat);
stn.setStnId(stnInfoStr);
stn.setReftime(synoptictime);
stn.setRangestarttime(synoptictime);
stn.setSndType(currentSndType.toString());
// System.out.println("sndType= "+currentSndType);
// System.out.println("stn lat ="+stn.getLatitude() +
// " lon="+stn.getLongitude());
nsharpMapResource.addPoint(stn);
}
D2DNsharpMapResource.bringMapEditorToTop();
}
}
private void handleSndTimeSelection() {
String selectedSndTime = null;
if (sndTimeList.getSelectionCount() > 0) {
D2DNsharpMapResource nsharpMapResource = D2DNsharpMapResource
.getOrCreateNsharpMapResource();// D2DNsharpLoadDialog.getAccess().getD2DNsharpMapResource();
nsharpMapResource.setPoints(null);
selectedTimeList.clear();
ldDia.startWaitCursor();
for (int i = 0; i < sndTimeList.getSelectionCount(); i++) {
selectedSndTime = sndTimeList.getSelection()[i];
selectedTimeList.add(selectedSndTime);
int endIndex = selectedSndTime.indexOf(" ");
String queryingSndTime = selectedSndTime.substring(0, endIndex);
queryAndMarkStn(queryingSndTime);
}
ldDia.setObsSelectedTimeList(selectedTimeList);
ldDia.stopWaitCursor();
}
}
public void createObsvdDialogContents() {
currentSndType = ldDia.getActiveObsSndType();
timeLimit = false;
rawData = false;
topGp = new Group(parent, SWT.SHADOW_ETCHED_IN);
topGp.setLayout(new GridLayout(2, false));
bufruaBtn = new Button(topGp, SWT.RADIO | SWT.BORDER);
bufruaBtn.setText(FILE_BUFRUA);
bufruaBtn.setEnabled(true);
bufruaBtn.setBounds(topGp.getBounds().x + NsharpConstants.btnGapX,
topGp.getBounds().y + NsharpConstants.labelGap,
NsharpConstants.btnWidth, NsharpConstants.btnHeight);
bufruaBtn.setFont(newFont);
bufruaBtn.addListener(SWT.MouseUp, new Listener() {
public void handleEvent(Event event) {
sndTimeList.removeAll();
currentSndType = NcSoundingProfile.ObsSndType.BUFRUA;
ldDia.setActiveObsSndType(currentSndType);
createObsvdSndUairList();
}
});
uairBtn = new Button(topGp, SWT.RADIO | SWT.BORDER);
uairBtn.setText(FILE_UAIR);
uairBtn.setEnabled(true);
uairBtn.setBounds(topGp.getBounds().x + NsharpConstants.btnGapX,
bufruaBtn.getBounds().y + bufruaBtn.getBounds().height
+ NsharpConstants.btnGapY, NsharpConstants.btnWidth,
NsharpConstants.btnHeight);
uairBtn.setFont(newFont);
uairBtn.addListener(SWT.MouseUp, new Listener() {
public void handleEvent(Event event) {
sndTimeList.removeAll();
currentSndType = NcSoundingProfile.ObsSndType.NCUAIR;
ldDia.setActiveObsSndType(currentSndType);
createObsvdSndUairList();
}
});
timeBtn = new Button(topGp, SWT.CHECK | SWT.BORDER);
timeBtn.setText("00Z and 12Z only");
timeBtn.setEnabled(true);
timeBtn.setFont(newFont);
timeBtn.addListener(SWT.MouseUp, new Listener() {
public void handleEvent(Event event) {
if (timeBtn.getSelection())
timeLimit = true;
else
timeLimit = false;
// refresh sounding list if file type is selected already
if (currentSndType == NcSoundingProfile.ObsSndType.NCUAIR
|| currentSndType == NcSoundingProfile.ObsSndType.BUFRUA) {
createObsvdSndUairList();
}
}
});
rawBtn = new Button(topGp, SWT.CHECK | SWT.BORDER);
rawBtn.setText("raw data");
rawBtn.setEnabled(true);
rawBtn.setBounds(timeBtn.getBounds().x + timeBtn.getBounds().width,
timeBtn.getBounds().y, timeBtn.getBounds().width,
timeBtn.getBounds().height);
rawBtn.setFont(newFont);
rawBtn.addListener(SWT.MouseUp, new Listener() {
public void handleEvent(Event event) {
if (rawBtn.getSelection())
rawData = true;
else
rawData = false;
;
}
});
// create file widget list
sndTimeListGp = new Group(parent, SWT.SHADOW_NONE);
sndTimeListGp.setFont(newFont);
sndTimeList = new org.eclipse.swt.widgets.List(sndTimeListGp,
SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
sndTimeList.setBounds(topGp.getBounds().x + NsharpConstants.btnGapX,
sndTimeListGp.getBounds().y + NsharpConstants.labelGap,
D2DNsharpLoadDialog.getDialogWidth()-40, NsharpConstants.listHeight * 6);
sndTimeList.setFont(newFont);
// create a selection listener to handle user's selection on list
sndTimeList.addListener(SWT.Selection, new Listener() {
// private String selectedSndTime=null;
public void handleEvent(Event e) {
handleSndTimeSelection();
}
});
if (currentSndType == NcSoundingProfile.ObsSndType.NCUAIR
|| currentSndType == NcSoundingProfile.ObsSndType.BUFRUA) {
if (currentSndType == NcSoundingProfile.ObsSndType.NCUAIR)
uairBtn.setSelection(true);
else
bufruaBtn.setSelection(true);
createObsvdSndUairList();
selectedTimeList = ldDia.getObsSelectedTimeList();
Object[] selTimeObjectArray = selectedTimeList.toArray();
String[] selTimeStringArray = Arrays.copyOf(selTimeObjectArray,
selTimeObjectArray.length, String[].class);
sndTimeList.setSelection(selTimeStringArray);
handleSndTimeSelection();
}
}
public void cleanup() {
if (sndTimeList != null) {
sndTimeList.removeListener(SWT.Selection,
sndTimeList.getListeners(SWT.Selection)[0]);
sndTimeList.dispose();
sndTimeList = null;
}
if (sndTimeListGp != null) {
sndTimeListGp.dispose();
sndTimeListGp = null;
}
if (timeBtn != null) {
timeBtn.removeListener(SWT.MouseUp,
timeBtn.getListeners(SWT.MouseUp)[0]);
timeBtn.dispose();
timeBtn = null;
}
if (rawBtn != null) {
rawBtn.removeListener(SWT.MouseUp,
rawBtn.getListeners(SWT.MouseUp)[0]);
rawBtn.dispose();
rawBtn = null;
}
/*
* if(browseBtn != null){ browseBtn.removeListener(SWT.MouseUp,
* browseBtn.getListeners(SWT.MouseUp)[0]); browseBtn.dispose();
* browseBtn = null; }
*
*
* if(tamBtn != null){ tamBtn.removeListener(SWT.MouseUp,
* tamBtn.getListeners(SWT.MouseUp)[0]); tamBtn.dispose(); tamBtn =
* null; }
*/
if (bufruaBtn != null) {
bufruaBtn.removeListener(SWT.MouseUp,
bufruaBtn.getListeners(SWT.MouseUp)[0]);
bufruaBtn.dispose();
bufruaBtn = null;
}
if (uairBtn != null) {
uairBtn.removeListener(SWT.MouseUp,
uairBtn.getListeners(SWT.MouseUp)[0]);
uairBtn.dispose();
uairBtn = null;
}
/*
* if(newTabBtn != null){ newTabBtn.removeListener(SWT.MouseUp,
* newTabBtn.getListeners(SWT.MouseUp)[0]); newTabBtn.dispose();
* newTabBtn = null; }
*/
D2DNsharpLoadDialog ldDia = D2DNsharpLoadDialog.getAccess();
if (topGp != null) {
topGp.dispose();
topGp = null;
}
}
}

View file

@ -0,0 +1,243 @@
/**
*
* com.raytheon.uf.viz.d2d.nsharp.display.map.D2DNsharpMapMouseHandler
*
* This java class performs the NSHARP Modal functions.
* This code has been developed by the NCEP-SIB for use in the AWIPS2 system.
*
* <pre>
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------- ------- -------- -----------
* 03/23/2010 229 Chin Chen Initial coding
* 03/11/2013 972 Greg Hull NatlCntrsEditor
* 09/28/2015 RM#10295 Chin Chen Let sounding data query run in its own thread to avoid gui locked out during load
* 06/15/2023 tiffanym@ucar Added into Unidata v20.3.2
*
* </pre>
*
* @author Chin Chen
* @version 1.0
*/
package com.raytheon.uf.viz.d2d.nsharp.display.map;
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingLayer;
import gov.noaa.nws.ncep.ui.nsharp.NsharpStationInfo;
import gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor;
import gov.noaa.nws.ncep.ui.nsharp.display.map.NsharpObservedSoundingQuery;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.ui.progress.UIJob;
import org.geotools.referencing.GeodeticCalculator;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.viz.core.map.IMapDescriptor;
import com.raytheon.uf.viz.d2d.nsharp.display.D2DNsharpLoadDialog;
import com.raytheon.viz.ui.editor.AbstractEditor;
import com.raytheon.viz.ui.input.InputAdapter;
import org.locationtech.jts.geom.Coordinate;
public class D2DNsharpMapMouseHandler extends InputAdapter {
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(D2DNsharpMapMouseHandler.class);
public D2DNsharpMapMouseHandler() {
instance = this;
}
private static final double NctextuiPointMinDistance = 45000;
private static D2DNsharpMapMouseHandler instance;
private double lat, lon;
public double getLat() {
return lat;
}
public double getLon() {
return lon;
}
public static D2DNsharpMapMouseHandler getAccess() {
return instance;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseDown(int, int,
* int)
*/
@Override
public boolean handleMouseDown(int x, int y, int button) {
return false;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseDownMove(int,
* int, int) handle left button, so user be able to shift map while it is
* down
*/
@Override
public boolean handleMouseDownMove(int x, int y, int button) {
return false;
}
@Override
public boolean handleMouseMove(int x, int y) {
return false;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseUp(int, int, int)
* handle right button, so user be able to pick stn and print text report
*/
@Override
public boolean handleMouseUp(int x, int y, int button) {
if (!D2DNsharpMapResource.getMapRsc().isEditable())
return false;
// button 1 is left mouse button
if (button == 1) {
AbstractEditor mapEditor = D2DNsharpMapResource.getMapEditor();
if (mapEditor != null) {
// Check if mouse is in geographic extent
Coordinate loc = mapEditor.translateClick(x, y);
if (loc == null)
return false;
D2DNsharpLoadDialog loadDia = D2DNsharpLoadDialog.getAccess();
if (loadDia != null) {
int activeLoadType = loadDia
.getActiveLoadSoundingType();
List<NsharpStationInfo> points = D2DNsharpMapResource
.getOrCreateNsharpMapResource().getPoints();
if (points.isEmpty() == false) {
// get the stn close to loc "enough" and retrieve
// report for it
// Note::One stn may have more than one dataLine, if
// user picked multiple data time lines
List<NsharpStationInfo> stnPtDataLineLst = getPtWithinMinDist(
points, loc);
if (stnPtDataLineLst != null
&& stnPtDataLineLst.size() > 0) {
// hash map, use stn display info as key
Map<String, List<NcSoundingLayer>> soundingLysLstMap = new HashMap<String, List<NcSoundingLayer>>();
// String soundingType;
if (activeLoadType == D2DNsharpLoadDialog.OBSER_SND) {
NsharpObservedSoundingQuery obsQry = new NsharpObservedSoundingQuery(
"Querying Sounding Data...");
obsQry.getObservedSndData(stnPtDataLineLst,
loadDia.getObsDialog().isRawData(),
soundingLysLstMap);
}
else
return false;
}
}
}
}
} else if (button == 3) {
// button 3 is right button.
bringSkewTEdToTop();
}
return false;
}
/*
* Chin Note: If calling NsharpEditor.bringSkewTEditorToTop() directly in
* mouse handler API, e.g. handleMouseUp(), then handleMouseUp() will be
* called one more time by System. Do not know the root cause of it. To
* avoid handling such event twice (e.g. query sounding data twice), we will
* call NsharpEditor.bringSkewTEditorToTop() from an UiJob.
*/
private void bringSkewTEdToTop() {
Job uijob = new UIJob("bring skewT to top") {
public IStatus runInUIThread(IProgressMonitor monitor) {
NsharpEditor.bringEditorToTop();
return Status.OK_STATUS;
}
};
uijob.setSystem(true);
uijob.schedule();
}
/**
* Gets the nearest point of an selected element to the input point
*
* @param el
* element
* @param pt
* input point
* @return
*/
private List<NsharpStationInfo> getPtWithinMinDist(
List<NsharpStationInfo> points, Coordinate pt) {
NsharpStationInfo thePoint = null;
double minDistance = NctextuiPointMinDistance;
GeodeticCalculator gc;
List<NsharpStationInfo> thePoints = new ArrayList<NsharpStationInfo>();
// can't assume this is a map Editor/MapDescriptor
AbstractEditor mapEditor = D2DNsharpMapResource.getMapEditor();
if (mapEditor != null) {
IMapDescriptor desc = (IMapDescriptor) mapEditor
.getActiveDisplayPane().getRenderableDisplay()
.getDescriptor();
gc = new GeodeticCalculator(desc.getCRS());
gc.setStartingGeographicPoint(pt.x, pt.y);
for (NsharpStationInfo point : points) {
gc.setDestinationGeographicPoint(point.getLongitude(),
point.getLatitude());
double dist;
try {
dist = gc.getOrthodromicDistance();
if (dist < minDistance) {
minDistance = dist;
thePoint = point;
}
} catch (Exception e) {}
}
// Chin, there may be more than one point for a selected stn. As
// user may selected more than one data time,
// For same stn, each data time will have one point to represent it.
// So, a stn may have more than one points
if (thePoint != null) {
for (NsharpStationInfo point : points) {
if ((thePoint.getLatitude() == point.getLatitude())
&& (thePoint.getLongitude() == point.getLongitude())) {
thePoints.add(point);
}
}
// marked X on selected point
D2DNsharpMapResource.getOrCreateNsharpMapResource()
.setPickedPoint(thePoint);
}
}
return thePoints;
}
}

View file

@ -0,0 +1,483 @@
package com.raytheon.uf.viz.d2d.nsharp.display.map;
import gov.noaa.nws.ncep.ui.nsharp.NsharpConstants;
import gov.noaa.nws.ncep.ui.nsharp.NsharpStationInfo;
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PlatformUI;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import com.raytheon.uf.viz.core.DrawableCircle;
import com.raytheon.uf.viz.core.DrawableString;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.PixelExtent;
import com.raytheon.uf.viz.core.drawables.PaintProperties;
import com.raytheon.uf.viz.core.drawables.ResourcePair;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.map.IMapDescriptor;
import com.raytheon.uf.viz.core.map.MapDescriptor;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.IInputHandler;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.ResourceList.RemoveListener;
import com.raytheon.uf.viz.core.rsc.capabilities.EditableCapability;
import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability;
import com.raytheon.viz.ui.EditorUtil;
import com.raytheon.viz.ui.editor.AbstractEditor;
import com.raytheon.viz.ui.input.EditableManager;
import org.locationtech.jts.geom.Coordinate;
/**
*
* com.raytheon.uf.viz.d2d.nsharp.display.map.D2DNsharpMapResource
*
* This java class performs the NSHARP Resource functions.
* This code has been developed by the NCEP-SIB for use in the AWIPS2 system.
*
* <pre>
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------- ------- -------- -----------
* 03/23/2010 229 Chin Chen Initial coding
* 08/17/2012 655 B. Hebbard Added paintProps as parameter to IDisplayable draw (2)
* 03/11/2013 972 Greg Hull NatlCntrsEditor
* 06/15/2023 tiffanym@ucar Added into Unidata v20.3.2
*
* </pre>
*
* @author Chin Chen
* @version 1.0
*/
public class D2DNsharpMapResource extends
AbstractVizResource<D2DNsharpMapResourceData, MapDescriptor> implements
RemoveListener {
private static D2DNsharpMapResource mapRsc = null;
private static D2DNsharpMapResourceData mapRscData = null;
private static AbstractEditor mapEditor = null;
private static D2DNsharpMapMouseHandler mouseHandler;
private static Cursor waitCursor = null;
private static Control cursorControl;
private static boolean mouseHandlerRegistered = false;
public static void bringMapEditorToTop() {
// get current map editor, if non existent create one.
try {
if (mapEditor != null
&& PlatformUI.getWorkbench() != null
&& PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null
&& PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getActivePage() != null) {
PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getActivePage().bringToTop(mapEditor);
mapEditor.refresh();
}
} catch (Exception e) {}
}
public static AbstractEditor getMapEditor() {
return mapEditor;
}
public static D2DNsharpMapResource getMapRsc() {
return mapRsc;
}
private D2DNsharpMapResourceData nsharpMapResourceData;
/** The set of symbols with similar attributes across many locations */
private List<DrawableCircle> symbolSet = null;
private List<DrawableString> symbolText = null;
private DrawableCircle symbolToMark = null;
private List<NsharpStationInfo> points = new ArrayList<NsharpStationInfo>();
private List<NsharpStationInfo> pickedPoint = new ArrayList<NsharpStationInfo>();
public void setPickedPoint(NsharpStationInfo point) {
this.pickedPoint.add(point);
}
public List<NsharpStationInfo> getPoints() {
return points;
}
public void setPoints(List<NsharpStationInfo> points) {
if (points == null) {
this.pickedPoint.clear();
symbolToMark = null;
symbolSet = null;
this.points.clear();
} else {
this.points = points;
}
}
public void addPoint(NsharpStationInfo point) {
points.add(point);
}
/**
* Default constructor
*/
protected D2DNsharpMapResource(D2DNsharpMapResourceData d2dNsharpMapResourceData,
LoadProperties loadProperties) {
super(d2dNsharpMapResourceData, loadProperties);
getCapability(EditableCapability.class).setEditable(true);
this.nsharpMapResourceData = d2dNsharpMapResourceData;
}
public static void startWaitCursor() {
waitCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_WAIT);
cursorControl = Display.getCurrent().getCursorControl();
if (cursorControl != null && waitCursor != null)
cursorControl.setCursor(waitCursor);
}
public static void stopWaitCursor() {
if (cursorControl != null && waitCursor != null) {
cursorControl.setCursor(null);
}
if (waitCursor != null) {
waitCursor.dispose();
waitCursor = null;
}
}
/**
*
*/
private static void createMapEditor() {
try {
mapEditor = (AbstractEditor) EditorUtil.getActiveEditor();
} catch (Exception ve) {
System.out
.println("D2DNsharpMapResource Could not load initial editor: "
+ ve.getMessage());
ve.printStackTrace();
}
}
public static void registerMouseHandler() {
if (mouseHandlerRegistered)
return;
mouseHandler = getMouseHandler();
if (mapEditor != null && mouseHandler != null) {
mapEditor.registerMouseHandler((IInputHandler) mouseHandler);
mouseHandlerRegistered = true;
}
}
public static void unregisterMouseHandler() {
if (!mouseHandlerRegistered)
return;
mouseHandler = getMouseHandler();
if (mapEditor != null && mouseHandler != null) {
mapEditor.unregisterMouseHandler((IInputHandler) mouseHandler);
mouseHandlerRegistered = false;
}
}
/**
* Create a new MapResource and add it to the current editor.
*
* @return the MapResource
*/
public static D2DNsharpMapResource getOrCreateNsharpMapResource() {
if (mapRsc == null) {
if (mapEditor == null) {
createMapEditor();
}
if (mapEditor != null) {
IMapDescriptor desc = (IMapDescriptor) mapEditor
.getActiveDisplayPane().getRenderableDisplay()
.getDescriptor();
try {
if (mapRscData == null)
mapRscData = new D2DNsharpMapResourceData();
mapRsc = mapRscData.construct(new LoadProperties(), desc);
desc.getResourceList().add(mapRsc);
mapRsc.init(mapEditor.getActiveDisplayPane().getTarget());
// register mouse handler
mouseHandler = getMouseHandler();
mapEditor
.registerMouseHandler((IInputHandler) mouseHandler);
} catch (Exception e) {
e.printStackTrace();
}
}
}
return mapRsc;
}
public static void deleteNsharpMapResource() {
if (mapRsc != null) {
mapRsc.dispose();
mapRsc = null;
}
}
/**
* Called when resource is disposed
*
* @see com.raytheon.viz.core.rsc.IVizResource#dispose()
*/
@Override
public void disposeInternal() {
if (mapEditor != null) {
mapEditor.unregisterMouseHandler(mouseHandler);
mouseHandler = null;
mapEditor = null;
}
pickedPoint = null;
points = null;
symbolSet = null;
symbolToMark = null;
mapRsc = null;
mapRscData = null;
if (waitCursor != null)
waitCursor.dispose();
waitCursor = null;
mouseHandlerRegistered = false;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.core.rsc.IVizResource#getCoordinateReferenceSystem()
*/
public CoordinateReferenceSystem getCoordinateReferenceSystem() {
if (descriptor == null)
return null;
return descriptor.getCRS();
}
/**
*
* @see com.raytheon.viz.core.rsc.IVizResource#getName()
*/
@Override
public String getName() {
return "NSHARP Display";
}
/**
*
* @see com.raytheon.viz.core.rsc.IVizResource#init(com.raytheon.viz.core.
* IGraphicsTarget)
*/
@Override
public void initInternal(IGraphicsTarget target) throws VizException {
EditableManager.makeEditable(this,
getCapability(EditableCapability.class).isEditable());
}
/**
*
* @see
* com.raytheon.viz.core.rsc.IVizResource#isApplicable(com.raytheon.viz.
* core.PixelExtent)
*/
public boolean isApplicable(PixelExtent extent) {
return true;
}
/**
*
*/
private void generateSymbolForDrawing() {
String type = null;
symbolText = new ArrayList<DrawableString>(mapRsc.getPoints().size());
symbolSet = new ArrayList<DrawableCircle>(mapRsc.getPoints().size());
if (points.isEmpty() == true) {
symbolSet = null;
} else {
Coordinate[] locations = new Coordinate[points.size()];
int i = 0;
type = nsharpMapResourceData.getMarkerType().toString();
for (NsharpStationInfo p : points) {
double lon, lat;
lon = p.getLongitude();
lat = p.getLatitude();
locations[i++] = new Coordinate(lon, lat);
DrawableCircle circle = new DrawableCircle();
double[] pixel = descriptor.worldToPixel(new double[] { lon, lat });
circle.setCoordinates(pixel[0], pixel[1]);
circle.lineWidth = nsharpMapResourceData.getMarkerWidth();
circle.screenRadius = getRadius()*1.4;
circle.basics.color = NsharpConstants.color_green;
circle.filled = false;
symbolSet.add(circle);
DrawableString drawString = new DrawableString(p.getStnId());
drawString.basics.color = NsharpConstants.color_white;
drawString.setCoordinates(pixel[0], pixel[1]);
drawString.setText(p.getStnId(), NsharpConstants.color_white);
symbolText.add(drawString);
}
}
// generate symbol for picked stn to mark X
if (pickedPoint != null && pickedPoint.size() > 0) {
Coordinate[] locations = new Coordinate[pickedPoint.size()];
type = nsharpMapResourceData.getStnMarkerType().toString();
int i = 0;
for (NsharpStationInfo p : pickedPoint) {
double lon, lat;
lon = p.getLongitude();
lat = p.getLatitude();
locations[i++] = new Coordinate(lon, lat);
DrawableCircle circle = new DrawableCircle();
double[] pixel = descriptor.worldToPixel(new double[] { lon, lat });
circle.setCoordinates(pixel[0], pixel[1]);
circle.lineWidth = nsharpMapResourceData.getMarkerWidth();
circle.screenRadius = getRadius()*1.4;
circle.basics.color = NsharpConstants.color_red;
circle.filled = false;
symbolSet.add(circle);
}
} else {
symbolToMark = null;
}
}
/**
*
* @return
*/
protected double getRadius() {
return 5 * getCapability(MagnificationCapability.class)
.getMagnification();
}
/**
*
* @see
* com.raytheon.viz.core.drawables.IRenderable#paint(com.raytheon.viz.core
* .IGraphicsTarget, com.raytheon.viz.core.drawables.PaintProperties)
*/
@Override
public void paintInternal(IGraphicsTarget target, PaintProperties paintProps)
throws VizException {
generateSymbolForDrawing();
if (symbolSet != null) {
target.drawCircle(symbolSet.toArray(new DrawableCircle[0]));
target.drawStrings(symbolText);
}
// if (symbolToMark != null) {
// ArrayList<IDisplayable> elements = df.createDisplayElements(
// symbolToMark, paintProps);
// for (IDisplayable each : elements) {
// try {
// each.draw(target, paintProps);
// each.dispose();
// } catch (Exception e) {e.printStackTrace();}
// }
// }
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.core.rsc.capabilities.IProjectableResource#isProjectable
* (org.opengis.referencing.crs.CoordinateReferenceSystem)
*/
public boolean isProjectable(CoordinateReferenceSystem mapData) {
return true;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.core.rsc.capabilities.IProjectableResource#project(org
* .opengis.referencing.crs.CoordinateReferenceSystem)
*/
@Override
public void project(CoordinateReferenceSystem mapData) throws VizException {
// System.out.println("NctextuiResource: project ");
}
/**
* Returns the current mouse handler.
*
* @return
*/
private static D2DNsharpMapMouseHandler getMouseHandler() {
if (mouseHandler == null) {
mouseHandler = new D2DNsharpMapMouseHandler();
}
return mouseHandler;
}
@Override
public boolean okToUnload() {
/*
* DisAllow unloading of Resource
*/
return false;
}
@Override
public void notifyRemove(ResourcePair rp) throws VizException {
// TODO Auto-generated method stub
}
/**
* Check if the resource is currently editable
*
* @return editable
*/
public boolean isEditable() {
return getCapability(EditableCapability.class).isEditable();
}
public void setEditable(boolean enable) {
getCapability(EditableCapability.class).setEditable(enable);
EditableManager.makeEditable(this,
getCapability(EditableCapability.class).isEditable());
}
}

View file

@ -0,0 +1,148 @@
package com.raytheon.uf.viz.d2d.nsharp.display.map;
import gov.noaa.nws.ncep.viz.common.ui.Markers.MarkerState;
import gov.noaa.nws.ncep.viz.common.ui.Markers.MarkerTextSize;
import gov.noaa.nws.ncep.viz.common.ui.Markers.MarkerType;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
/**
*
* com.raytheon.uf.viz.d2d.nsharp.display.map.D2DNsharpMapResourceData
*
* This java class performs the NSHARP ResourceData functions.
* This code has been developed by the NCEP-SIB for use in the AWIPS2 system.
*
* <pre>
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------- ------- -------- -----------
* 03/23/2010 229 Chin Chen Initial coding
* 06/15/2023 tiffanym@ucar Added into Unidata v20.3.2
*
* </pre>
*
* @author Chin Chen
* @version 1.0
*/
public class D2DNsharpMapResourceData extends AbstractResourceData {
private MarkerState markerState = MarkerState.MARKER_ONLY;
private MarkerType markerType = MarkerType.DIAMOND;
private Float markerSize = 1f;
private Integer markerWidth = 2;
private MarkerTextSize markerTextSize = MarkerTextSize.MEDIUM;
private String mapName = "NSHARP";
private MarkerType stnMarkerType = MarkerType.LARGE_X;
public MarkerType getStnMarkerType() {
return stnMarkerType;
}
public D2DNsharpMapResourceData() {
super();
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.rsc.AbstractResourceData#construct(com.raytheon
* .uf.viz.core.comm.LoadProperties,
* com.raytheon.uf.viz.core.drawables.IDescriptor)
*/
@Override
public D2DNsharpMapResource construct(LoadProperties loadProperties,
IDescriptor descriptor) throws VizException {
// TODO Auto-generated method stub
return new D2DNsharpMapResource(this, loadProperties);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.rsc.AbstractResourceData#update(java.lang.Object
* )
*/
@Override
public void update(Object updateData) {
// TODO Auto-generated method stub
}
@Override
public boolean equals(Object obj) {
if (obj == null || !(obj instanceof D2DNsharpMapResourceData))
return false;
D2DNsharpMapResourceData rdata = (D2DNsharpMapResourceData) obj;
if (this.markerState.equals(rdata.getMarkerState())
&& this.markerType.equals(rdata.getMarkerType())
&& this.markerSize.equals(rdata.getMarkerSize())
&& this.markerWidth.equals(rdata.getMarkerWidth())
&& this.markerTextSize.equals(rdata.getMarkerTextSize())
&& this.stnMarkerType.equals(rdata.getStnMarkerType()))
return true;
return false;
}
public MarkerState getMarkerState() {
return markerState;
}
public void setMarkerState(MarkerState markerState) {
this.markerState = markerState;
}
public MarkerType getMarkerType() {
return markerType;
}
public void setMarkerType(MarkerType markerType) {
this.markerType = markerType;
}
public Float getMarkerSize() {
return markerSize;
}
public void setMarkerSize(Float markerSize) {
this.markerSize = markerSize;
}
public Integer getMarkerWidth() {
return markerWidth;
}
public void setMarkerWidth(Integer markerWidth) {
this.markerWidth = markerWidth;
}
public MarkerTextSize getMarkerTextSize() {
return markerTextSize;
}
public void setMarkerTextSize(MarkerTextSize markerTextSize) {
this.markerTextSize = markerTextSize;
}
public String getMapName() {
return mapName;
}
public void setMapName(String mapName) {
this.mapName = mapName;
}
}

View file

@ -73,6 +73,7 @@ import gov.noaa.nws.ncep.ui.nsharp.display.rsc.NsharpResourceHandler;
* Jan 15, 2019 7697 bsteffen Individually add soundings so station info
* is not shared.
* Apr 15 2019 7480 bhurley Improved auto-update
* Jun 15, 2023 tiffanym@ucar reimplement NSHARP load functionality
*
* </pre>
*
@ -212,8 +213,8 @@ public class D2DNSharpResource
@Override
protected void initInternal(IGraphicsTarget target) throws VizException {
getHandler().setSoundingType(resourceData.getSoundingType());
partListener = new D2DNSharpPartListener(this);
partListener.enable();
//partListener = new D2DNSharpPartListener(this);
//partListener.enable();
}
@Override

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View file

@ -620,6 +620,20 @@
</toolbar>
<toolbar
id="applications">
<command
commandId="com.raytheon.uf.viz.d2d.nsharp.dialog"
icon="icons/nsharp.png"
id="com.raytheon.uf.viz.d2d.nsharp.dialog"
label="Nsharp"
mode="FORCE_TEXT"
style="push"
tooltip="Nsharp">
<visibleWhen>
<reference
definitionId="com.raytheon.uf.viz.d2d.ui.inD2DActionSet">
</reference>
</visibleWhen>
</command>
<command
commandId="com.raytheon.uf.viz.productbrowser.productBrowser"
icon="icons/plus.png"

View file

@ -34,18 +34,6 @@
name="AAG"
value="aviation/aag">
</path>
<path
application="EDEX"
localizationType="COMMON_STATIC"
name="Backup Service"
value="backupsvc">
</path>
<path
application="EDEX"
localizationType="COMMON_STATIC"
name="Localization Backup"
value="localizationBackup">
</path>
<path
application="EDEX"
localizationType="COMMON_STATIC"

View file

@ -1,6 +1,5 @@
output.com.raytheon.uf.viz.npp.nucaps.jar = bin/
bin.includes = META-INF/,\
localization/,\
plugin.xml,\
com.raytheon.uf.viz.npp.nucaps.jar
source.com.raytheon.uf.viz.npp.nucaps.jar = src/

View file

@ -1,7 +1,6 @@
output.com.raytheon.uf.viz.npp.viirs.jar = bin/
bin.includes = META-INF/,\
plugin.xml,\
localization/,\
res/,\
com.raytheon.uf.viz.npp.viirs.jar
source.com.raytheon.uf.viz.npp.viirs.jar = src/

View file

@ -1,5 +1,4 @@
output.com.raytheon.uf.viz.npp.jar = bin/
bin.includes = META-INF/,\
localization/,\
com.raytheon.uf.viz.npp.jar
source.com.raytheon.uf.viz.npp.jar = src/

View file

@ -181,6 +181,10 @@
id="com.raytheon.uf.viz.gisdatastore.feature"
version="0.0.0"/>
<includes
id="edu.wisc.ssec.cimss.viz.probsevere.feature"
version="0.0.0"/>
<requires>
<import feature="com.raytheon.uf.viz.application.feature" version="1.0.0.qualifier"/>
</requires>

View file

@ -1,4 +1,3 @@
0=$vizVersion$
1=$buildDate$
2=$buildTime$
3=$buildSystem$
0=20.3.2-0.4
1=Wed Jun 28 20:21:00 GMT 2023
2=CentOS Linux release 7.9.2009 (Core)

View file

@ -127,6 +127,7 @@
<feature id="com.raytheon.uf.viz.ffmp.feature"/>
<feature id="com.raytheon.uf.viz.scan.feature"/>
<feature id="com.raytheon.uf.viz.fssobs.feature"/>
<feature id="edu.wisc.ssec.cimss.viz.probsevere.feature"/>
<feature id="com.raytheon.uf.viz.satellite.goesr.feature" installMode="root"/>
</features>

View file

@ -1,11 +1,10 @@
caveAboutText=Common AWIPS Visualization Environment (CAVE)\n\
\n\
Developed on the Raytheon viz Environment, released as non-operational\
software by UCAR's Unidata Program Center\
software by UCAR''s Unidata Program Center\
https://www.unidata.ucar.edu/software/awips2 \
\n\n\
\tBUILD VERSION: {0}\n\
\tBUILD DATE: {1}\n\
\tBUILD TIME: {2}\n\
\tBUILD SYSTEM: {3}
\tBUILD SYSTEM: {2}
caveVersion=DEVELOPMENT

View file

@ -24,26 +24,115 @@
of the file.
-->
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="bundleItem"
file="bundles/DefaultRadarCodedMessage.xml" menuText="10km Radar Coded Msg"
id="10kmRadarCodedMsg" />
<contribute xsi:type="subinclude" fileName="menus/radar/airportRadars.xml" />
<contribute xsi:type="titleItem" titleText="------ Mosaic ------"
<contribute xsi:type="subinclude" subMenu="Dial Radars" id="allDialRadar" fileName="menus/radar/dialRadars.xml"/>
<contribute xsi:type="subinclude" subMenu="TDWR Radars" id="tdwrRadar" fileName="menus/radar/tdwrRadars.xml" />
<contribute xsi:type="separator" id="seperator" />
<contribute xsi:type="titleItem" titleText="------ Mosaic ------"
id="RadarMosaic" />
<contribute xsi:type="subinclude"
fileName="menus/radar/regionalMosaicMenus.xml" />
<contribute xsi:type="subinclude"
fileName="menus/radar/radarMosaicProductMenu.xml" />
<contribute xsi:type="separator" id="belowRadarMosaics" />
<contribute xsi:type="subMenu" menuText="Dial Radars"
id="RadarMenuDialRadarsSubMenu">
<contribute xsi:type="subinclude" subMenu="Local Dial Radars"
id="localDialRadar" fileName="menus/radar/dialRadars.xml">
</contribute>
<contribute xsi:type="subinclude" subMenu="All Dial Radars"
id="allDialRadar" fileName="menus/radar/dialAllRadars.xml">
</contribute>
</contribute>
<contribute xsi:type="subinclude" fileName="menus/radar/regionalMosaicMenus.xml"
subMenu="N0Q - 0.5 Reflectivity" id="Radar05Reflectivity">
<substitute key="product" value="153,94,19,20" />
<substitute key="elevation" value="0.5" />
<substitute key="name" value="N0Q 0.5 Reflectivity" />
</contribute>
<contribute xsi:type="subinclude" fileName="menus/radar/regionalMosaicMenus.xml"
subMenu="DHR - Hybrid Scan Reflectivity" id="RadarHybridScanRefl">
<substitute key="product" value="32,33" />
<substitute key="elevation" value="0.0" />
<substitute key="name" value="DHR Hybrid Scan Refl" />
</contribute>
<contribute xsi:type="subinclude" fileName="menus/radar/regionalMosaicMenus.xml"
subMenu="DVL - Digital Vert integrated Liquid" id="RadarDigitalVertIntegratedLiquid">
<substitute key="product" value="134" />
<substitute key="elevation" value="0.0" />
<substitute key="name" value="DVL Digital Vert integrated Liquid" />
</contribute>
<contribute xsi:type="subinclude" fileName="menus/radar/regionalMosaicMenus.xml"
subMenu="HHC - Hybrid Hydrometeor Classification" id="RadarHybridHydroClass">
<substitute key="product" value="177" />
<substitute key="elevation" value="0.0" />
<substitute key="name" value="HHC Hybrid Hydro Class" />
</contribute>
<contribute xsi:type="subinclude" fileName="menus/radar/regionalMosaicMenus.xml"
subMenu="EET - Enhanced Echo Tops" id="RadarEnhancedEchoTopsClass">
<substitute key="product" value="135" />
<substitute key="elevation" value="0.0" />
<substitute key="name" value="EET Enhanced Echo Tops" />
</contribute>
<contribute xsi:type="subinclude" fileName="menus/radar/regionalMosaicMenus.xml"
subMenu="DSP - Digital Storm Total Precip" id="RadarDigitalStormTotalPrecip">
<substitute key="product" value="138" />
<substitute key="elevation" value="0.0" />
<substitute key="name" value="DSP Digital Storm Total Precip" />
</contribute>
<contribute xsi:type="subinclude" fileName="menus/radar/regionalMosaicMenus.xml"
subMenu="DPR - Inst Precip Rate" id="InstPrecipRateDPR">
<substitute key="product" value="176" />
<substitute key="elevation" value="0.0" />
<substitute key="name" value="DPR Inst Precip Rate (in/hr)" />
</contribute>
<contribute xsi:type="subinclude" fileName="menus/radar/regionalMosaicMenus.xml"
subMenu="DTA - Storm Total Accum (STA)" id="RadarDualPolStormTotal">
<substitute key="product" value="172" />
<substitute key="elevation" value="0.0" />
<substitute key="name" value="DTA Storm Total Accum" />
</contribute>
<contribute xsi:type="subinclude" fileName="menus/radar/regionalMosaicMenus.xml"
subMenu="DSD - Storm Total Accum Diff" id="RadarDualPolStormTotal">
<substitute key="product" value="175" />
<substitute key="elevation" value="0.0" />
<substitute key="name" value="DSD Storm Total Accum Diff" />
</contribute>
<contribute xsi:type="subinclude" fileName="menus/radar/regionalMosaicMenus.xml"
subMenu="DAA - 1 Hour Digital Accumulation Array" id="RadarDualPol1hrPrecip">
<substitute key="product" value="170" />
<substitute key="elevation" value="0.0" />
<substitute key="name" value="DAA 1hr Digital Accumulation Array" />
</contribute>
<contribute xsi:type="subinclude" fileName="menus/radar/regionalMosaicMenus.xml"
subMenu="OHA - 1 Hour Accumulation" id="RadarDualPol1hrAccum">
<substitute key="product" value="169" />
<substitute key="elevation" value="0.0" />
<substitute key="name" value="OHA 1hr Accum" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/regionalMosaicMenus.xml" subMenu="Dual Pol User 3hr Accum /hrly (DUA)"
id="RadarUserSelectablePrecip3hr">
<substitute key="product" value="173" />
<substitute key="elevation" value="0.0" />
<substitute key="layer" value="3.0" />
<substitute key="name" value="Dual Pol User 3hr Accum /hrly (DUA)" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/regionalMosaicMenus.xml" subMenu="Dual Pol User 24hr Accum @12Z (DUA)"
id="RadarUserSelectablePrecip24hr">
<substitute key="product" value="173" />
<substitute key="elevation" value="0.0" />
<substitute key="layer" value="6.0" />
<substitute key="name" value="Dual Pol User 24hr Accum @12Z (DUA)" />
</contribute>
<contribute xsi:type="subinclude" fileName="menus/radar/regionalMosaicMenus.xml"
subMenu="N0X - 0.5 Differential Reflectivity (ZDR)" id="Radar05ZDR">
<substitute key="product" value="159,158" />
<substitute key="elevation" value="0.5" />
<substitute key="name" value="N0X Diff Reflectivity" />
</contribute>
<contribute xsi:type="subinclude" fileName="menus/radar/regionalMosaicMenus.xml"
subMenu="N0K - 0.5 Specific Diff Phase (KDP)" id="Radar05KDP">
<substitute key="product" value="163,162" />
<substitute key="elevation" value="0.5" />
<substitute key="name" value="N0K Specific Diff Phase" />
</contribute>
<contribute xsi:type="subinclude" fileName="menus/radar/regionalMosaicMenus.xml"
subMenu="N0C - 0.5 Correlation Coeff (CC)" id="Radar05CC">
<substitute key="product" value="161,160" />
<substitute key="elevation" value="0.5" />
<substitute key="name" value="N0C Correlation Coefficient" />
</contribute>
<contribute xsi:type="separator" id="seperator" />
<contribute xsi:type="subinclude"
fileName="menus/radar/baseRadarApplications.xml" />
</menuTemplate>

View file

@ -0,0 +1,694 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
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.
-->
<!--
This is an absolute override file, indicating that a higher priority
version of the file will completely replace a lower priority version
of the file.
-->
<menuTemplate>
<contribute xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="subMenu" menuText="kabr-kbis">
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kabr" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kabx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kakq" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kama" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kamx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kapx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="karx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="katx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kbbx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kbgm" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kbhx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kbis" key="icao" />
</contribute>
</contribute>
<contribute xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="subMenu" menuText="kblx-kcri">
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kblx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kbmx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kbox" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kbro" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/kbuf/baseLocalRadarMenu.xml">
<substitute value="kbuf" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kbyx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kcae" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kcbw" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kcbx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kccx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/kcle/baseLocalRadarMenu.xml">
<substitute value="kcle" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/kclx/baseLocalRadarMenu.xml">
<substitute value="kclx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/kcri/baseLocalRadarMenu.xml">
<substitute value="kcri" key="icao" />
</contribute>
</contribute>
<contribute xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="subMenu" menuText="kcrp-kdtx">
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kcrp" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kcxx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kcys" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kdax" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kddc" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kdfx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/kdgx/baseLocalRadarMenu.xml">
<substitute value="kdgx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kdix" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/kdlh/baseLocalRadarMenu.xml">
<substitute value="kdlh" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kdmx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kdox" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kdtx" key="icao" />
</contribute>
</contribute>
<contribute xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="subMenu" menuText="kdvn-kfcx">
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kdvn" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kdyx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="keax" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kemx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kenx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="keox" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kepz" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kesx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kevx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kewx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="keyx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kfcx" key="icao" />
</contribute>
</contribute>
<contribute xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="subMenu" menuText="kfdr-kgrk">
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kfdr" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kfdx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kffc" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kfsd" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/kfsx/baseLocalRadarMenu.xml">
<substitute value="kfsx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kftg" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kfws" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kggw" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/kgjx/baseLocalRadarMenu.xml">
<substitute value="kgjx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kgld" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kgrb" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kgrk" key="icao" />
</contribute>
</contribute>
<contribute xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="subMenu" menuText="kgrr-kiln">
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kgrr" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/kgsp/baseLocalRadarMenu.xml">
<substitute value="kgsp" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kgwx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kgyx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="khdx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="khgx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="khnx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="khpx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="khtx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kict" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/kicx/baseLocalRadarMenu.xml">
<substitute value="kicx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kiln" key="icao" />
</contribute>
</contribute>
<contribute xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="subMenu" menuText="kilx-klgx">
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kilx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kind" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kinx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kiwa" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kiwx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kjan" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kjax" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kjgx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kjkl" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="klbb" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="klch" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/klgx/baseLocalRadarMenu.xml">
<substitute value="klgx" key="icao" />
</contribute>
</contribute>
<contribute xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="subMenu" menuText="klix-kmbx">
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="klix" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="klnx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="klot" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="klrx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="klsx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kltx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="klvx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="klwx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="klzk" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kmaf" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/kmax/baseLocalRadarMenu.xml">
<substitute value="kmax" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/kmbx/baseLocalRadarMenu.xml">
<substitute value="kmbx" key="icao" />
</contribute>
</contribute>
<contribute xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="subMenu" menuText="kmhx-kmxx">
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kmhx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kmkx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kmlb" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kmob" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kmpx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kmqt" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kmrx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/kmsx/baseLocalRadarMenu.xml">
<substitute value="kmsx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/kmtx/baseLocalRadarMenu.xml">
<substitute value="kmtx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/kmux/baseLocalRadarMenu.xml">
<substitute value="kmux" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kmvx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kmxx" key="icao" />
</contribute>
</contribute>
<contribute xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="subMenu" menuText="knkx-krax">
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="knkx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="knqa" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="koax" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kohx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kokx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kotx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kpah" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kpbz" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kpdt" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kpoe" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kpux" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/krax/baseLocalRadarMenu.xml">
<substitute value="krax" key="icao" />
</contribute>
</contribute>
<contribute xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="subMenu" menuText="krgx-ktfx">
<contribute xsi:type="subinclude"
fileName="menus/radar/krgx/baseLocalRadarMenu.xml">
<substitute value="krgx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kriw" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="krlx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="krtx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="ksfx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="ksgf" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/kshv/baseLocalRadarMenu.xml">
<substitute value="kshv" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="ksjt" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="ksox" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="ksrx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="ktbw" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="ktfx" key="icao" />
</contribute>
</contribute>
<contribute xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="subMenu" menuText="ktlh-kyux">
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="ktlh" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="ktlx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="ktwx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="ktyx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kudx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kuex" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kvax" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kvbx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kvnx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kvtx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kvwx" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="kyux" key="icao" />
</contribute>
</contribute>
<contribute xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="subMenu" menuText="pabc-phwa">
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="pabc" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="pacg" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="paec" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="pahg" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="paih" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="pakc" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="papd" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="pgua" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="phki" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="phkm" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="phmo" key="icao" />
</contribute>
<contribute xsi:type="subinclude"
fileName="menus/radar/dualPol/baseLocalRadarMenu.xml">
<substitute value="phwa" key="icao" />
</contribute>
</contribute>
</menuTemplate>

View file

@ -24,67 +24,52 @@
of the file.
-->
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="subMenu" menuText="Regional and National Mosaics"
id="otherRegMosiacMenu">
<contribute xsi:type="subinclude" subMenu="Northeast Region"
id="neRegMosiacMenu" fileName="menus/radar/radarMosaicProductMenu.xml">
<substitute key="mosaicIcaoList"
value="kcbw,kcxx,kgyx,ktyx,kenx,kbox,kbuf,kbgm,kokx,kcle,kpbz,kccx,kdix,krlx,kfcx,kakq,kdox,klwx" />
</contribute>
<contribute xsi:type="subinclude" subMenu="Mid-Atlantic Region"
id="mid-atlRegMosiacMenu" fileName="menus/radar/radarMosaicProductMenu.xml">
<substitute key="mosaicIcaoList"
value="kcle,kpbz,kccx,kokx,kdix,kiln,krlx,klwx,kdox,kjkl,kfcx,kakq,kmrx,krax,kgsp,kmhx,kltx,kcae,kffc,kjgx,kclx,keox,kvax,kjax" />
</contribute>
<contribute xsi:type="subinclude" subMenu="Southeast Region"
id="seRegMosiacMenu" fileName="menus/radar/radarMosaicProductMenu.xml">
<substitute key="mosaicIcaoList"
value="kohx,kmrx,krax,knqa,khtx,kgsp,kcae,kltx,kgwx,kdgx,kmhx,kffc,klix,kbix,kmob,kbmx,kmxx,keox,kjgx,kclx,kevx,ktlh,kvax,kjax,ktbw,kmlb,kamx,kbyx" />
</contribute>
<contribute xsi:type="subinclude" subMenu="Gulf Coast Region"
id="gulfRegMosiacMenu" fileName="menus/radar/radarMosaicProductMenu.xml">
<substitute key="mosaicIcaoList"
value="kbro,kcrp,kdfx,kewx,kgrk,khgx,kfws,kshv,kpoe,klch,klix,klzk,kdgx,kbix,kgwx,kmob,kbmx,kmxx,keox,kevx,ktlh,kffc,kjgx,kvax,kjax,ktbw,kmlb,kamx,kbyx" />
</contribute>
<contribute xsi:type="subinclude" subMenu="Great Lakes Region"
id="lakesRegMosiacMenu" fileName="menus/radar/radarMosaicProductMenu.xml">
<substitute key="mosaicIcaoList"
value="kdlh,kmpx,krlx,kccx,kjkl,krlx,karx,kmqt,kgrb,kmkx,kdmx,kdvn,klot,kilx,klsx,kapx,kgrr,kdtx,kiwx,kind,kvwx,klvx,kiln,kcle,kpbz,kbuf,kccf,kbgm,ktyx" />
</contribute>
<contribute xsi:type="subinclude" subMenu="Ozarks/Tenn Valley Region"
id="oztennRegMosiacMenu" fileName="menus/radar/radarMosaicProductMenu.xml">
<substitute key="mosaicIcaoList"
value="keax,ksgf,klsx,kilx,kind,kvwx,kiln,kpah,khpx,klvx,kjkl,krlx,ksrx,klzk,knqa,kohx,kmrx,kshv,kdgx,kgwx,kbmx,khtx,kffc,kgsp" />
</contribute>
<contribute xsi:type="subinclude" subMenu="Northern Plains Region"
id="nrnplainsRegMosiacMenu" fileName="menus/radar/radarMosaicProductMenu.xml">
<substitute key="mosaicIcaoList"
value="kggw,kmbx,kbis,kmvx,kudx,kabr,kdlh,kmpx,karx,kfsd,kcys,klnx,kuex,koax,kdmx,kdvn,kftg,kpux,kgld,kddc,kict,ktwx,keax,ksgf,klsx,kilx,kvnx" />
</contribute>
<contribute xsi:type="subinclude" subMenu="Southern Plains Region"
id="srnplainsRegMosiacMenu" fileName="menus/radar/radarMosaicProductMenu.xml">
<substitute key="mosaicIcaoList"
value="kpux,kgld,kddc,kict,ktwx,keax,ksgf,klsx,kpah,kfdx,khdx,kepz,kama,klbb,kmaf,ksjt,kdfx,kdyx,kfws,kgrk,kewx,kcrp,kbro,khgx,kfdr,ktlx,kvnx,kinx,ksrx,klzk,kshv,kpoe,klch,knqa,kdgx,klix,kpah" />
</contribute>
<contribute xsi:type="subinclude" subMenu="Northwest Region"
id="nwRegMosiacMenu" fileName="menus/radar/radarMosaicProductMenu.xml">
<substitute key="mosaicIcaoList"
value="katx,krtx,kotx,kpdt,kmax,kcbx,ksfx,kmsx,ktfx,kblx,kggw,kriw,kcys,kbhx,kbbx,kdax,kmux,khnx,krgx,klgx,klrx,kmtx,kicx,kgjx,kftg,kpux" />
</contribute>
<contribute xsi:type="subinclude" subMenu="Southwest Region"
id="swRegMosiacMenu" fileName="menus/radar/radarMosaicProductMenu.xml">
<substitute key="mosaicIcaoList"
value="kmax,kcbx,ksfx,kriw,kcys,kbbx,kdax,kmux,khnx,kvbx,kvtx,keyx,ksox,knkx,krgx,klrx,kesx,kmtx,kicx,kfsx,kiwa,kyux,kemx,kgjx,kftg,kpux,kabx,khdx,kepz,kfdx" />
</contribute>
<contribute xsi:type="subinclude" subMenu="National Mosaic"
id="natMosiacMenu" fileName="menus/radar/radarMosaicProductMenu.xml">
<substitute key="mosaicIcaoList"
value="kabr,kabx,kakq,kama,kamx,kapx,karx,katx,kbbx,kbgm,kbhx,kbis,kblx,kbmx,kbox,kbro,kbuf,kbyx,kcae,kcbw,kcbx,kccx,kcle,kclx,kcrp,kcxx,kcys,kdax,kddc,kdfx,kdgx,kdix,kdlh,kdmx,kdox,kdtx,kdvn,kdyx,keax,kemx,kenx,keox,kepz,kesx,kevx,kewx,keyx,kfcx,kfdr,kfdx,kffc,kfsd,kfsx,kftg,kfws,kggw,kgjx,kgld,kgrb,kgrk,kgrr,kgsp,kgwx,kgyx,khdx,khgx,khnx,khpx,khtx,kict,kicx,kiln,kilx,kind,kinx,kiwa,kiwx,kjan,kjax,kjgx,kjkl,klbb,klch,klgx,klix,klnx,klot,klrx,klsx,kltx,klvx,klwx,klzk,kmaf,kmax,kmbx,kmhx,kmkx,kmlb,kmob,kmpx,kmqt,kmrx,kmsx,kmtx,kmux,kmvx,kmxx,knkx,knqa,koax,kohx,kokx,kotx,kpah,kpbz,kpdt,kpoe,kpux,krax,krgx,kriw,krlx,krtx,ksfx,ksgf,kshv,ksjt,ksox,ksrx,ktbw,ktfx,ktlh,ktlx,ktwx,ktyx,kudx,kuex,kvax,kvbx,kvnx,kvtx,kvwx,kyux,pabc,pacg,paec,pahg,paih,pakc,papd,pgua,phki,phkm,phmo,phwa,tjua,tadw,tatl,tbna,tbos,tbwi,tclt,tcmh,tcvg,tdal,tday,tdca,tden,tdfw,tdtw,tewr,tfll,thou,tiad,tiah,tich,tids,tjfk,tlas,tlve,tmci,tmco,tmdw,tmem,tmia,tmke,tmsp,tmsy,tokc,tord,tpbi,tphl,tphx,tpit,trdu,tsdf,tsju,tslc,tstl,ttpa,ttul" />
</contribute>
<contribute xsi:type="subinclude" subMenu="TDWR Mosaic"
id="tdwrMosaicMenu" fileName="menus/radar/tdwrMosaicProductMenu.xml">
<substitute key="mosaicIcaoList"
value="tjua,tadw,tatl,tbna,tbos,tbwi,tclt,tcmh,tcvg,tdal,tday,tdca,tden,tdfw,tdtw,tewr,tfll,thou,tiad,tiah,tich,tids,tjfk,tlas,tlve,tmci,tmco,tmdw,tmem,tmia,tmke,tmsp,tmsy,tokc,tord,tpbi,tphl,tphx,tpit,trdu,tsdf,tsju,tslc,tstl,ttpa,ttul" />
</contribute>
</contribute>
<contribute xsi:type="bundleItem" menuText="Northeast" id="neRegMosiacMenu"
file="bundles/DefaultRadarMosaic.xml">
<substitute key="mosaicIcaoList" value="kcbw,kcxx,kgyx,ktyx,kenx,kbox,kbuf,kbgm,kokx,kcle,kpbz,kccx,kdix,krlx,kfcx,kakq,kdox,klwx" />
</contribute>
<contribute xsi:type="bundleItem" menuText="Mid-Atlantic" id="mid-atlRegMosiacMenu"
file="bundles/DefaultRadarMosaic.xml">
<substitute key="mosaicIcaoList" value="kcle,kpbz,kccx,kokx,kdix,kiln,krlx,klwx,kdox,kjkl,kfcx,kakq,kmrx,krax,kgsp,kmhx,kltx,kcae,kffc,kjgx,kclx,keox,kvax,kjax" />
</contribute>
<contribute xsi:type="bundleItem" menuText="Southeast" id="seRegMosiacMenu"
file="bundles/DefaultRadarMosaic.xml">
<substitute key="mosaicIcaoList" value="kohx,kmrx,krax,knqa,khtx,kgsp,kcae,kltx,kgwx,kdgx,kmhx,kffc,klix,kbix,kmob,kbmx,kmxx,keox,kjgx,kclx,kevx,ktlh,kvax,kjax,ktbw,kmlb,kamx,kbyx" />
</contribute>
<contribute xsi:type="bundleItem" menuText="Gulf Coast" id="gulfRegMosiacMenu"
file="bundles/DefaultRadarMosaic.xml">
<substitute key="mosaicIcaoList" value="kbro,kcrp,kdfx,kewx,kgrk,khgx,kfws,kshv,kpoe,klch,klix,klzk,kdgx,kbix,kgwx,kmob,kbmx,kmxx,keox,kevx,ktlh,kffc,kjgx,kvax,kjax,ktbw,kmlb,kamx,kbyx" />
</contribute>
<contribute xsi:type="bundleItem" menuText="Great Lakes" id="lakesRegMosiacMenu"
file="bundles/DefaultRadarMosaic.xml">
<substitute key="mosaicIcaoList" value="kdlh,kmpx,krlx,kccx,kjkl,krlx,karx,kmqt,kgrb,kmkx,kdmx,kdvn,klot,kilx,klsx,kapx,kgrr,kdtx,kiwx,kind,kvwx,klvx,kiln,kcle,kpbz,kbuf,kccf,kbgm,ktyx" />
</contribute>
<contribute xsi:type="bundleItem" menuText="Ozarks/Tenn Valley" id="oztennRegMosiacMenu"
file="bundles/DefaultRadarMosaic.xml">
<substitute key="mosaicIcaoList" value="keax,ksgf,klsx,kilx,kind,kvwx,kiln,kpah,khpx,klvx,kjkl,krlx,ksrx,klzk,knqa,kohx,kmrx,kshv,kdgx,kgwx,kbmx,khtx,kffc,kgsp" />
</contribute>
<contribute xsi:type="bundleItem" menuText="Northern Plains" id="nrnplainsRegMosiacMenu"
file="bundles/DefaultRadarMosaic.xml">
<substitute key="mosaicIcaoList" value="kggw,kmbx,kbis,kmvx,kudx,kabr,kdlh,kmpx,karx,kfsd,kcys,klnx,kuex,koax,kdmx,kdvn,kftg,kpux,kgld,kddc,kict,ktwx,keax,ksgf,klsx,kilx,kvnx" />
</contribute>
<contribute xsi:type="bundleItem" menuText="Southern Plains" id="srnplainsRegMosiacMenu"
file="bundles/DefaultRadarMosaic.xml">
<substitute key="mosaicIcaoList" value="kpux,kgld,kddc,kict,ktwx,keax,ksgf,klsx,kpah,kfdx,khdx,kepz,kama,klbb,kmaf,ksjt,kdfx,kdyx,kfws,kgrk,kewx,kcrp,kbro,khgx,kfdr,ktlx,kvnx,kinx,ksrx,klzk,kshv,kpoe,klch,knqa,kdgx,klix,kpah" />
</contribute>
<contribute xsi:type="bundleItem" menuText="Northwest" id="nwRegMosiacMenu"
file="bundles/DefaultRadarMosaic.xml">
<substitute key="mosaicIcaoList" value="katx,krtx,kotx,kpdt,kmax,kcbx,ksfx,kmsx,ktfx,kblx,kggw,kriw,kcys,kbhx,kbbx,kdax,kmux,khnx,krgx,klgx,klrx,kmtx,kicx,kgjx,kftg,kpux" />
</contribute>
<contribute xsi:type="bundleItem" menuText="Southwest" id="swRegMosiacMenu"
file="bundles/DefaultRadarMosaic.xml">
<substitute key="mosaicIcaoList" value="kmax,kcbx,ksfx,kriw,kcys,kbbx,kdax,kmux,khnx,kvbx,kvtx,keyx,ksox,knkx,krgx,klrx,kesx,kmtx,kicx,kfsx,kiwa,kyux,kemx,kgjx,kftg,kpux,kabx,khdx,kepz,kfdx" />
</contribute>
<contribute xsi:type="bundleItem" menuText="National Mosaic" id="natMosiacMenu"
file="bundles/DefaultRadarMosaic.xml">
<substitute key="mosaicIcaoList" value="kabr,kabx,kakq,kama,kamx,kapx,karx,katx,kbbx,kbgm,kbhx,kbis,kblx,kbmx,kbox,kbro,kbuf,kbyx,kcae,kcbw,kcbx,kccx,kcle,kclx,kcrp,kcxx,kcys,kdax,kddc,kdfx,kdgx,kdix,kdlh,kdmx,kdox,kdtx,kdvn,kdyx,keax,kemx,kenx,keox,kepz,kesx,kevx,kewx,keyx,kfcx,kfdr,kfdx,kffc,kfsd,kfsx,kftg,kfws,kggw,kgjx,kgld,kgrb,kgrk,kgrr,kgsp,kgwx,kgyx,khdx,khgx,khnx,khpx,khtx,kict,kicx,kiln,kilx,kind,kinx,kiwa,kiwx,kjan,kjax,kjgx,kjkl,klbb,klch,klgx,klix,klnx,klot,klrx,klsx,kltx,klvx,klwx,klzk,kmaf,kmax,kmbx,kmhx,kmkx,kmlb,kmob,kmpx,kmqt,kmrx,kmsx,kmtx,kmux,kmvx,kmxx,knkx,knqa,koax,kohx,kokx,kotx,kpah,kpbz,kpdt,kpoe,kpux,krax,krgx,kriw,krlx,krtx,ksfx,ksgf,kshv,ksjt,ksox,ksrx,ktbw,ktfx,ktlh,ktlx,ktwx,ktyx,kudx,kuex,kvax,kvbx,kvnx,kvtx,kvwx,kyux,pabc,pacg,paec,pahg,paih,pakc,papd,pgua,phki,phkm,phmo,phwa,tjua,tadw,tatl,tbna,tbos,tbwi,tclt,tcmh,tcvg,tdal,tday,tdca,tden,tdfw,tdtw,tewr,tfll,thou,tiad,tiah,tich,tids,tjfk,tlas,tlve,tmci,tmco,tmdw,tmem,tmia,tmke,tmsp,tmsy,tokc,tord,tpbi,tphl,tphx,tpit,trdu,tsdf,tsju,tslc,tstl,ttpa,ttul" />
</contribute>
<contribute xsi:type="bundleItem" menuText="TDWR Mosaic" id="tdwrMosaicMenu"
file="bundles/DefaultRadarMosaic.xml">
<substitute key="mosaicIcaoList" value="tjua,tadw,tatl,tbna,tbos,tbwi,tclt,tcmh,tcvg,tdal,tday,tdca,tden,tdfw,tdtw,tewr,tfll,thou,tiad,tiah,tich,tids,tjfk,tlas,tlve,tmci,tmco,tmdw,tmem,tmia,tmke,tmsp,tmsy,tokc,tord,tpbi,tphl,tphx,tpit,trdu,tsdf,tsju,tslc,tstl,ttpa,ttul" />
</contribute>
</menuTemplate>

File diff suppressed because it is too large Load diff

View file

@ -241,10 +241,6 @@
<param name="feature"
value="com.raytheon.uf.edex.text.feature" />
</antcall>
<antcall target="build">
<param name="feature"
value="com.raytheon.uf.edex.aviation.feature" />
</antcall>
<antcall target="build">
<param name="feature"
value="com.raytheon.uf.edex.satellite.feature" />
@ -261,6 +257,7 @@
<param name="feature"
value="com.raytheon.uf.edex.radar.feature" />
</antcall>
<!--
<antcall target="build">
<param name="feature"
value="com.raytheon.uf.edex.hydro.feature" />
@ -273,6 +270,7 @@
<param name="feature"
value="com.raytheon.uf.edex.dat.feature" />
</antcall>
-->
<antcall target="build">
<param name="feature"
value="com.raytheon.uf.edex.config.auto.feature" />
@ -313,6 +311,9 @@
<param name="feature"
value="com.raytheon.uf.edex.nswrc.radar.feature" />
</antcall>
<antcall target="build">
<param name="feature" value="edu.wisc.ssec.cimss.edex.probsevere.feature" />
</antcall>
<!-- SPECIAL CASE -->
<if>
<equals arg1="${lightning}" arg2="false" />

View file

@ -39,6 +39,7 @@
<includes
id="com.raytheon.uf.common.base.feature"
version="0.0.0"/>
<includes
id="com.raytheon.uf.edex.foss.org.apache.commons.management.feature"
version="0.0.0"/>
@ -223,10 +224,6 @@
id="com.raytheon.uf.edex.text.feature"
version="0.0.0"/>
<includes
id="com.raytheon.uf.edex.aviation.feature"
version="0.0.0"/>
<includes
id="com.raytheon.uf.edex.satellite.feature"
version="0.0.0"/>
@ -235,18 +232,10 @@
id="com.raytheon.uf.edex.gfe.feature"
version="0.0.0"/>
<includes
id="com.raytheon.uf.edex.hydro.feature"
version="0.0.0"/>
<includes
id="com.raytheon.uf.edex.radar.feature"
version="0.0.0"/>
<includes
id="com.raytheon.uf.edex.dat.feature"
version="0.0.0"/>
<includes
id="com.raytheon.uf.edex.ncep.feature"
version="0.0.0"/>
@ -271,10 +260,6 @@
id="com.raytheon.uf.edex.config.auto.feature"
version="0.0.0"/>
<includes
id="com.raytheon.uf.edex.mpe.feature"
version="0.0.0"/>
<includes
id="com.raytheon.uf.edex.menus.vb.feature"
version="0.0.0"/>
@ -283,4 +268,8 @@
id="com.raytheon.uf.edex.goesr.feature"
version="0.0.0"/>
<includes
id="com.raytheon.uf.edex.ncep.nco.feature"
version="0.0.0"/>
</feature>

View file

@ -50,6 +50,7 @@ import com.raytheon.uf.edex.database.dao.DaoConfig;
* Jun 27, 2012 798 jkorman Corrected id query type.
* Oct 02, 2013 2333 mschenke Removed unused code
* Nov 05, 2014 3788 bsteffen add getOrCreateCoverage
* Apr 30, 2016 ---- mjames add Criteria for line element/res
* Mar 25, 2020 8103 randerso Fixed ContraintViolationException handling
*
* </pre>
@ -144,6 +145,10 @@ public class SatMapCoverageDao extends CoreDao {
crit.add(Restrictions.eq("ny", coverage.getNy()));
crit.add(Restrictions.eq("dx", coverage.getDx()));
crit.add(Restrictions.eq("dy", coverage.getDy()));
crit.add(Restrictions.eq("upperLeftElement", coverage.getUpperLeftElement()));
crit.add(Restrictions.eq("upperLeftLine", coverage.getUpperLeftLine()));
crit.add(Restrictions.eq("elementRes", coverage.getElementRes()));
crit.add(Restrictions.eq("lineRes", coverage.getLineRes()));
crit.add(Restrictions.eq("minX", coverage.getMinX()));
crit.add(Restrictions.eq("minY", coverage.getMinY()));
crit.add(Restrictions.eq("crsWKT", coverage.getCrsWKT()));

View file

@ -20,6 +20,8 @@
package com.raytheon.edex.util.satellite;
import java.awt.geom.Rectangle2D;
import org.geotools.geometry.DirectPosition2D;
import org.opengis.referencing.crs.ProjectedCRS;
import org.opengis.referencing.operation.MathTransform;
@ -29,6 +31,8 @@ import com.raytheon.edex.plugin.satellite.dao.SatMapCoverageDao;
import com.raytheon.uf.common.dataplugin.satellite.SatMapCoverage;
import com.raytheon.uf.common.geospatial.MapUtil;
import org.locationtech.jts.geom.Envelope;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.io.WKTReader;
/**
*
@ -47,6 +51,8 @@ import org.locationtech.jts.geom.Envelope;
* Sep 15, 2014 17303 jgerth Support for second standard latitude
* Nov 05, 2014 2714 bclement replaced DecoderException with SatelliteDecoderException
* Nov 05, 2014 3788 bsteffen use getOrCreateCoverage in place of queryByMapId
* May 11, 2015 mjames South polar stereographic support added.
* May 19, 2015 mjames Added GVAR native projection support.
*
*
* </pre>
@ -62,6 +68,8 @@ public class SatSpatialFactory {
public static final int PROJ_LAMBERT = 3;
public static final int PROJ_POLAR = 5;
public static final int PROJ_GVAR = 7585;
public static final int PROJ_CYLIN_EQUIDISTANT = 7;
@ -209,6 +217,58 @@ public class SatSpatialFactory {
return getCoverageSingleCorner(crsType, nx, ny, lov, latin, latin, la1, lo1, dx, dy);
}
public SatMapCoverage getCoverageNative(int crsType, int nx, int ny,
double reflon, int upperLeftElement, int upperLeftLine,
int xres, int yres, ProjectedCRS crs)
throws SatelliteDecoderException {
try {
// Construct the polygon constructor String
StringBuffer buffer = new StringBuffer();
buffer.append("POLYGON((");
buffer.append(reflon - 90. + " -90.0,");
buffer.append(reflon + 90. + " -90.0,");
buffer.append(reflon + 90. + " 90.0,");
buffer.append(reflon - 90. + " 90.0,");
buffer.append(reflon - 90. + " -90.0");
buffer.append("))");
// Create the geometry from the constructed String
Geometry geometry = new WKTReader().read(buffer.toString());
// Construct rectangle
double minX = upperLeftElement;
int maxX = upperLeftElement + (nx * xres);
double minY = upperLeftLine + (ny * yres);
minY = -minY;
int maxY = -1 * upperLeftLine;
Rectangle2D rect = new Rectangle2D.Double(minX,
minY, maxX, maxY);
SatMapCoverage coverage = createCoverageFromNative(crsType, nx, ny,
reflon, upperLeftElement, upperLeftLine,
xres, yres, crs, geometry );
return checkPersisted(coverage);
} catch (Exception e) {
StringBuilder buf = new StringBuilder();
buf.append(
"Error getting or constructing SatMapCoverage for values: ")
.append("\n\t");
buf.append("crsType=" + crsType).append("\n\t");
buf.append("nx=" + nx).append("\n\t");
buf.append("ny=" + ny).append("\n\t");
buf.append("reflon=" + reflon).append("\n\t");
buf.append("upperLeftElement=" + upperLeftElement).append("\n\t");
buf.append("upperLeftLine=" + upperLeftLine).append("\n\t");
buf.append("xres=" + xres).append("\n\t");
buf.append("yres=" + yres).append("\n\t");
throw new SatelliteDecoderException(buf.toString(), e);
}
}
/**
*
* Create a {@link SatMapCoverage} with an area defined by two corners. The
@ -309,6 +369,24 @@ public class SatSpatialFactory {
envelope.getMinY(), nx, ny, dx, dy, crs);
}
/**
* Create a SatMapCoverage from native projection
*/
private static SatMapCoverage createCoverageFromNative(Integer crsType,
Integer nx, Integer ny, double reflon, int upperLeftElement,
int upperLeftLine, int xres, int yres, ProjectedCRS crs,
Geometry geometry) {
float dx = 999999.f;
float dy = 999999.f;
double minX, minY;
minX = upperLeftElement;
minY = upperLeftLine + (ny * yres);
minY = -minY;
return new SatMapCoverage(crsType, minX, minY, nx, ny,
dx, dy, upperLeftElement, upperLeftLine,
xres, yres, crs, geometry);
}
/**
* Create a {@link ProjectedCRS} from a crsType and some parameters.
*
@ -336,6 +414,11 @@ public class SatSpatialFactory {
switch (crsType) {
case PROJ_MERCATOR:
return createMercatorCrs(latin, cm);
case PROJ_POLAR:
if (latin >= 0.)
return createNorthPolarStereoCrs(lov);
else
return createSouthPolarStereoCrs(latin, lov);
case PROJ_LAMBERT:
return createLambertCrs(latin, latin2, lov);
case PROJ_CYLIN_EQUIDISTANT:
@ -365,5 +448,10 @@ public class SatSpatialFactory {
return MapUtil.constructNorthPolarStereo(MapUtil.AWIPS_EARTH_RADIUS,
MapUtil.AWIPS_EARTH_RADIUS, 60, lov);
}
private static ProjectedCRS createSouthPolarStereoCrs(double latin, double lov) {
return MapUtil.constructSouthPolarStereo(MapUtil.AWIPS_EARTH_RADIUS,
MapUtil.AWIPS_EARTH_RADIUS, latin, lov);
}
}

View file

@ -1,80 +1,122 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
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.
-->
<!--
This is an absolute override file, indicating that a higher priority
version of the file will completely replace a lower priority version
of the file.
-->
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="satBundleItem"
file="bundles/DefaultCompositeSatellite.xml" menuText="IR Window"
id="irWindow">
<substitute key="timeMatchMode" value="${blendedTimeMatchMode;ALL_IMAGES}" />
<substitute key="element" value="Imager 11 micron IR" />
<substitute key="colormap" value="Sat/IR/CIRA (IR Default)" />
</contribute>
<contribute xsi:type="satBundleItem"
file="bundles/DefaultCompositeSatellite.xml" menuText="Water Vapor"
id="waterVapor">
<substitute key="timeMatchMode" value="${blendedTimeMatchMode;ALL_IMAGES}" />
<substitute key="element" value="Imager 6.7-6.5 micron IR (WV)" />
<substitute key="colormap" value="Sat/WV/Gray Scale Water Vapor" />
</contribute>
<contribute xsi:type="satBundleItem"
file="bundles/DefaultCompositeSatellite.xml" menuText="Visible"
id="visible">
<substitute key="timeMatchMode" value="${blendedTimeMatchMode;ALL_IMAGES}" />
<substitute key="element" value="Imager Visible" />
<substitute key="colormap" value="Sat/VIS/ZA (Vis Default)" />
</contribute>
<contribute xsi:type="satBundleItem" file="bundles/DefaultCONUSSatellite.xml"
menuText="3.9u" id="3.9u">
<substitute key="element" value="Imager 3.9 micron IR" />
<substitute key="colormap" value="Sat/VIS/ZA (Vis Default)" />
</contribute>
<contribute xsi:type="satBundleItem" file="bundles/DefaultCONUSSatellite.xml"
menuText="13u" id="13u">
<substitute key="element" value="Imager 13 micron (IR)" />
<substitute key="colormap" value="Sat/IR/CIRA (IR Default)" />
</contribute>
<contribute xsi:type="satBundleItem" file="bundles/DerivedCONUSSatellite.xml"
menuText="11u-3.9u" id="11-3.9u">
<substitute key="element" value="satDif11u3_9uIR" />
<substitute key="colormap" value="Sat/VIS/CA (Low Light Vis)" />
</contribute>
<contribute xsi:type="satBundleItem" file="bundles/DerivedCONUSSatellite.xml"
menuText="11u-13u" id="11u-13u">
<substitute key="timeMatchMode" value="${blendedTimeMatchMode;ALL_IMAGES}" />
<substitute key="element" value="satDif11u13uIR" />
<substitute key="colormap" value="Grid/gridded data" />
</contribute>
<contribute xsi:type="satBundleItem"
file="bundles/DerivedCompositeSatellite.xml" menuText="WV/IR"
id="WV/IR">
<substitute key="timeMatchMode" value="${blendedTimeMatchMode;ALL_IMAGES}" />
<substitute key="element" value="satDivWVIR" />
<substitute key="colormap" value="Sat/IR/IR WV" />
</contribute>
<contribute xsi:type="satBundleItem"
file="bundles/satellite/FourPanelGoesMtoQ.xml" menuText="4 panel (GOES M-Q)"
id="4_panel_(GOES_M-Q)">
</contribute>
</menuTemplate>
<contribute xsi:type="separator" id="Separator"/>
<contribute xsi:type="titleItem" titleText="------ Legacy Satellitle Data ------" id="legacySat"/>
<contribute xsi:type="subMenu" menuText="Legacy Satellite Data">
<contribute xsi:type="titleItem" titleText="------ Composite Imagery ------" id="CompositeImagery" />
<contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
menuText="Global Rectilinear 20km IR" id="waterVapor">
<substitute key="element" value="Imager 11 micron IR"/>
<substitute key="sector" value="AREA3100"/>
<substitute key="entity" value="UNIWISC"/>
<substitute key="colormap" value="Sat/IR/CIRA (IR Default)"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
menuText="Global Rectilinear 20km WV" id="waterVapor">
<substitute key="element" value="Imager 6.7-6.5 micron IR (WV)"/>
<substitute key="sector" value="AREA3101"/>
<substitute key="entity" value="UNIWISC"/>
<substitute key="colormap" value="Sat/WV/RAMSDIS WV"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
menuText="Global Mollweide 30km IR" id="waterVapor">
<substitute key="element" value="Imager 11 micron IR"/>
<substitute key="sector" value="AREA0700"/>
<substitute key="entity" value="UNIWISC"/>
<substitute key="colormap" value="Sat/IR/CIRA (IR Default)"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
menuText="Global Mollweide 30km WV" id="waterVapor">
<substitute key="element" value="Imager 6.7-6.5 micron IR (WV)"/>
<substitute key="sector" value="AREA0600"/>
<substitute key="entity" value="UNIWISC"/>
<substitute key="colormap" value="Sat/WV/RAMSDIS WV"/>
</contribute>
<contribute xsi:type="separator" id="Separator"/>
<contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
menuText="Arctic 12 micron IR" id="irWindow">
<substitute key="element" value="Imager 12 micron IR"/>
<substitute key="sector" value="Arctic"/>
<substitute key="entity" value="UNIWISC" />
<substitute key="colormap" value="Sat/IR/CIRA (IR Default)"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
menuText="Arctic 11 micron IR" id="irWindow">
<substitute key="element" value="Imager 11 micron IR"/>
<substitute key="sector" value="Arctic"/>
<substitute key="entity" value="UNIWISC" />
<substitute key="colormap" value="Sat/IR/CIRA (IR Default)"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
menuText="Arctic 3.5-4.0 micron IR (Fog)" id="irWindow">
<substitute key="element" value="Imager 3.5-4.0 micron IR (Fog)"/>
<substitute key="sector" value="Arctic"/>
<substitute key="entity" value="UNIWISC" />
<substitute key="colormap" value="Sat/IR/CIRA (IR Default)"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
menuText="Arctic 6.7-6.5 micron IR (WV)" id="irWindow">
<substitute key="element" value="Imager 6.7-6.5 micron IR (WV)"/>
<substitute key="sector" value="Arctic"/>
<substitute key="entity" value="UNIWISC" />
<substitute key="colormap" value="Sat/WV/RAMSDIS WV"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
menuText="Arctic Visible" id="visible">
<substitute key="element" value="Imager Visible"/>
<substitute key="sector" value="Arctic"/>
<substitute key="entity" value="UNIWISC" />
<substitute key="colormap" value="Sat/VIS/Linear"/>
</contribute>
<contribute xsi:type="separator" id="MySeparatorId"/>
<contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
menuText="Antarctic 12 micron IR" id="irWindow">
<substitute key="element" value="Imager 12 micron IR"/>
<substitute key="sector" value="Antarctic"/>
<substitute key="entity" value="UNIWISC" />
<substitute key="colormap" value="Sat/IR/CIRA (IR Default)"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
menuText="Antarctic 11 micron IR" id="irWindow">
<substitute key="element" value="Imager 11 micron IR"/>
<substitute key="sector" value="Antarctic"/>
<substitute key="entity" value="UNIWISC" />
<substitute key="colormap" value="Sat/IR/CIRA (IR Default)"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
menuText="Antarctic 3.5-4.0 micron IR (Fog)" id="irWindow">
<substitute key="element" value="Imager 3.5-4.0 micron IR (Fog)"/>
<substitute key="sector" value="Antarctic"/>
<substitute key="entity" value="UNIWISC" />
<substitute key="colormap" value="Sat/IR/CIRA (IR Default)"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
menuText="Antarctic 6.7-6.5 micron IR (WV)" id="irWindow">
<substitute key="element" value="Imager 6.7-6.5 micron IR (WV)"/>
<substitute key="sector" value="Antarctic"/>
<substitute key="entity" value="UNIWISC" />
<substitute key="colormap" value="Sat/WV/RAMSDIS WV"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
menuText="Antarctic Visible" id="visible">
<substitute key="element" value="Imager Visible"/>
<substitute key="sector" value="Antarctic"/>
<substitute key="entity" value="UNIWISC" />
<substitute key="colormap" value="Sat/VIS/Linear"/>
</contribute>
<contribute xsi:type="titleItem" titleText="------ Satellite Winds ------" id="SatWind" />
<contribute xsi:type="bundleItem" file="bundles/Scatterometer.xml"
menuText="ASCAT Winds 25 km" id="ASCATWinds">
<substitute key="legend" value="ASCAT"/>
<substitute key="svg" value="ascatPlotDesign.svg"/>
<substitute key="plugin" value="bufrascat"/>
<substitute key="posOffset" value="5400"/>
<substitute key="negOffset" value="5400"/>
</contribute>
</contribute>
</menuTemplate>

View file

@ -3,9 +3,7 @@
<include installTo="menu:satellite?before=GOESR"
fileName="menus/satellite/goesr/goesrMenu.xml">
</include>
<!--
<include installTo="menu:satellite?after=GOESR"
<include installTo="menu:satellite"
fileName="menus/satellite/baseSatellite.xml">
</include>
-->
</include>
</menuContributionFile>

View file

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

View file

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.raytheon.uf.common.backupsvc</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

@ -1,10 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=11

View file

@ -1,17 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Backup Service Plug-in
Bundle-SymbolicName: com.raytheon.uf.common.backupsvc
Bundle-Version: 1.16.0.qualifier
Bundle-Vendor: RAYTHEON
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: com.raytheon.uf.common.backupsvc.request,
com.raytheon.uf.common.backupsvc.response,
com.raytheon.uf.common.backupsvc
Require-Bundle: com.raytheon.uf.common.serialization.comm,
com.raytheon.uf.common.serialization,
org.slf4j,
com.raytheon.uf.common.comm,
com.raytheon.uf.common.message,
com.raytheon.uf.common.util,
javax.xml.bind

View file

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

View file

@ -1,336 +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.uf.common.backupsvc;
import java.text.ParseException;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.raytheon.uf.common.backupsvc.request.GetBackupServiceCapabilitiesRequest;
import com.raytheon.uf.common.backupsvc.request.GetEDEXVersionRequest;
import com.raytheon.uf.common.backupsvc.response.GetEDEXVersionResponse;
import com.raytheon.uf.common.comm.HttpClient;
import com.raytheon.uf.common.comm.HttpClientConfigBuilder;
import com.raytheon.uf.common.message.WsId;
import com.raytheon.uf.common.serialization.ExceptionWrapper;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.common.serialization.comm.IServerRequest;
import com.raytheon.uf.common.serialization.comm.RequestWrapper;
import com.raytheon.uf.common.serialization.comm.response.ServerErrorResponse;
import com.raytheon.uf.common.util.SystemUtil;
import com.raytheon.uf.common.util.app.AppInfo;
import com.raytheon.uf.common.util.app.Version;
import com.raytheon.uf.common.util.rate.TokenBucket;
/**
* Backup host and optional port as specified in config XML file
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 28, 2016 5937 tgurney Initial creation
* Dec 9, 2016 5937 tgurney Add copy constructor
* Jul 20, 2017 6352 tgurney Add equals(), hashCode(), DynamicSerialize
* Jul 24, 2017 6352 tgurney Move request-sending from BackupService
* Oct 3, 2019 7929 tgurney Add special MY_VERSION version value.
* Move class from edex to common. Use a
* httpClient with gzip enabled
*
* </pre>
*
* @author tgurney
*/
@DynamicSerialize
@XmlAccessorType(XmlAccessType.NONE)
public class BackupHost {
private final Logger logger = LoggerFactory.getLogger(getClass());
private static final int DEFAULT_THRIFT_PORT = Integer
.parseInt(System.getenv("HTTP_PORT"));
private static final String THRIFT_HTTP_PATH;
static {
String serverPath = System.getenv("HTTP_SERVER_PATH");
if (!serverPath.startsWith("/")) {
serverPath = "/" + serverPath;
}
THRIFT_HTTP_PATH = serverPath + "/thrift";
}
private static HttpClient httpClient;
static {
HttpClientConfigBuilder cfgBuilder = new HttpClientConfigBuilder();
cfgBuilder.setGzipEnabled(true);
httpClient = new HttpClient(cfgBuilder.build());
}
/**
* Special value that can be used in place of the minimum or maximum
* required version, indicating that the requirement is the sender's current
* EDEX version.
*/
public static final String MY_VERSION = "my";
@DynamicSerializeElement
@XmlElement
private int port = DEFAULT_THRIFT_PORT;
@DynamicSerializeElement
@XmlElement(required = true)
private String name;
private String hostEdexVersion;
/**
* No-arg constructor for serialization
*/
public BackupHost() {
}
/**
* Copy constructor
*
* @param aBackupHost
* The BackupHost to copy
*/
public BackupHost(BackupHost aBackupHost) {
port = aBackupHost.port;
name = aBackupHost.name;
hostEdexVersion = aBackupHost.hostEdexVersion;
}
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (name == null ? 0 : name.hashCode());
result = prime * result + port;
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!obj.getClass().equals(BackupHost.class)) {
return false;
}
BackupHost other = (BackupHost) obj;
if (name == null) {
if (other.name != null) {
return false;
}
} else if (!name.equals(other.name)) {
return false;
}
if (port != other.port) {
return false;
}
return true;
}
/**
* Send an IServerRequest to this host
*
* @param request
* @return the object the server returns
* @throws Exception
* If sending the request fails for some reason
*/
public Object sendRequest(IServerRequest request) throws Exception {
return sendRequest(request, null);
}
/**
* Send an IServerRequest to this host
*
* @param request
* @param rateLimiter
* Token bucket to rate-limit the request, can be null
* @return the object the server returns
* @throws Exception
* If sending the request fails for some reason
*/
public Object sendRequest(IServerRequest request, TokenBucket rateLimiter)
throws Exception {
RequestWrapper wrapper = new RequestWrapper(request, new WsId());
Object rval = null;
if (rateLimiter != null) {
rval = httpClient.postDynamicSerialize(
"http://" + name + ":" + port + THRIFT_HTTP_PATH, wrapper,
true, rateLimiter);
} else {
rval = httpClient.postDynamicSerialize(
"http://" + name + ":" + port + THRIFT_HTTP_PATH, wrapper,
true);
}
if (rval instanceof ServerErrorResponse) {
ServerErrorResponse resp = (ServerErrorResponse) rval;
Throwable serverException = ExceptionWrapper
.unwrapThrowable(resp.getException());
throw new BackupServiceException(serverException.getMessage(),
serverException);
}
return rval;
}
/**
* @param useCached
* If true, use cached version string if it is available
* @return version string. Will query the remote host if necessary. null if
* there is no cached value and the host could not be contacted.
*/
public String getEDEXVersion(boolean useCached) {
if (hostEdexVersion == null || !useCached) {
try {
GetEDEXVersionRequest request = new GetEDEXVersionRequest();
request.setRequestingHost(SystemUtil.getHostName());
Object response = sendRequest(new GetEDEXVersionRequest());
if (response instanceof GetEDEXVersionResponse) {
hostEdexVersion = ((GetEDEXVersionResponse) response)
.getEdexVersion();
}
} catch (Exception e) {
logger.error(
"Error when sending GetEDEXVersionRequest to " + name,
e);
hostEdexVersion = null;
}
}
return hostEdexVersion;
}
/*
* @return version string. Will use cached version string if it is
* available, otherwise will query the remote host.
*/
public String getEDEXVersion() {
return getEDEXVersion(true);
}
/**
* @param minVersionRequired
* If null, use this host's current EDEX version. If
* {@link #MY_VERSION}, use the caller's current EDEX version.
* @param maxVersionRequired
* If null, use this host's current EDEX version. If
* {@link #MY_VERSION}, use the caller's current EDEX version.
* @return Zero if this host's EDEX version falls within the range of
* (minVersionRequired, maxVersionRequired). A positive integer if
* this host's EDEX version is greater than maxVersionRequired. A
* negative integer if this host's EDEX version is less than
* minVersionRequired. Null if unable to contact the host
*/
public Integer compareVersion(String minVersionRequired,
String maxVersionRequired) {
// refresh cached version string
getEDEXVersion(false);
if (hostEdexVersion == null) {
return null;
}
if (minVersionRequired == null) {
minVersionRequired = hostEdexVersion;
}
if (maxVersionRequired == null) {
maxVersionRequired = hostEdexVersion;
}
if (MY_VERSION.equals(minVersionRequired)) {
minVersionRequired = AppInfo.getInstance().getVersion();
}
if (MY_VERSION.equals(maxVersionRequired)) {
maxVersionRequired = AppInfo.getInstance().getVersion();
}
Version minVer;
Version maxVer;
Version ver;
try {
minVer = Version.fromString(minVersionRequired);
maxVer = Version.fromString(maxVersionRequired);
ver = Version.fromString(hostEdexVersion);
} catch (ParseException e) {
logger.warn("Failed to parse version string (hostEdexVersion: "
+ hostEdexVersion + ", minVersionRequired: "
+ minVersionRequired + ", maxVersionRequired: "
+ maxVersionRequired + ")", e);
return null;
}
if (ver.compareTo(minVer) < 0) {
// Version is less than the minimum required
return -1;
} else if (ver.compareTo(maxVer) > 0) {
// Version is greater than the max allowed
return 1;
} else {
// Version falls within allowed range
return 0;
}
}
/** @return List of all this host's capabilities. */
public Set<String> getCapabilities() {
Set<String> rval = null;
try {
Object response = sendRequest(
new GetBackupServiceCapabilitiesRequest());
if (response instanceof Set<?>) {
rval = (Set<String>) response;
}
} catch (Exception e) {
logger.error(
"Error when sending GetBackupServiceCapabilitiesRequest to "
+ name,
e);
}
return rval;
}
}

View file

@ -1,55 +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.uf.common.backupsvc;
/**
* Exception for Backup Service related problems
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 2, 2017 tgurney Initial creation
* Oct 3, 2019 7929 tgurney Move to common
*
* </pre>
*
* @author tgurney
*/
public class BackupServiceException extends Exception {
private static final long serialVersionUID = 1L;
public BackupServiceException(String message) {
super(message);
}
public BackupServiceException(String message, Throwable cause) {
super(message, cause);
}
public BackupServiceException(Throwable cause) {
super(cause);
}
}

View file

@ -1,55 +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.uf.common.backupsvc;
import java.util.Optional;
import com.raytheon.uf.common.serialization.comm.IServerRequest;
/**
* A refreshable {@link IServerRequest}. Calling {@link #refresh()} allows the
* request to update itself arbitrarily.
*
* Introduced for BackupService, which stores IServerRequests to be sent later.
* Such requests may be "stale" for whatever reason by the time they'd be sent.
* This mechanism allows for a stale request to be updated or even canceled
* before it would be sent.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 7, 2019 tgurney Initial creation
*
* </pre>
*
* @author tgurney
*/
public interface IRefreshableServerRequest extends IServerRequest {
/**
* @return the request itself updated arbitrarily, or a new/different
* request object of the same type, or a different type of request
* object, or nothing.
*/
Optional<IServerRequest> refresh();
}

View file

@ -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.uf.common.backupsvc.request;
import java.util.List;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.common.serialization.comm.IServerRequest;
/**
* Request to queue up a backup job
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 10, 2016 5937 tgurney Initial creation
* Jul 20, 2017 6352 tgurney Add min/maxversionRequired
*
* </pre>
*
* @author tgurney
*/
@DynamicSerialize
public class BackupEnqueueRequest implements IServerRequest {
@DynamicSerializeElement
private IServerRequest request;
@DynamicSerializeElement
private String jobName;
/** Lower number = higher priority. May be negative */
@DynamicSerializeElement
private int priority;
@DynamicSerializeElement
private String minVersionRequired;
@DynamicSerializeElement
private String maxVersionRequired;
@DynamicSerializeElement
private List<String> hosts;
public IServerRequest getRequest() {
return request;
}
public void setRequest(IServerRequest request) {
this.request = request;
}
public String getJobName() {
return jobName;
}
public void setJobName(String jobName) {
this.jobName = jobName;
}
public int getPriority() {
return priority;
}
public void setPriority(int priority) {
this.priority = priority;
}
public List<String> getHosts() {
return hosts;
}
public void setHosts(List<String> hosts) {
this.hosts = hosts;
}
public String getMinVersionRequired() {
return minVersionRequired;
}
public void setMinVersionRequired(String minVersionRequired) {
this.minVersionRequired = minVersionRequired;
}
public String getMaxVersionRequired() {
return maxVersionRequired;
}
public void setMaxVersionRequired(String maxVersionRequired) {
this.maxVersionRequired = maxVersionRequired;
}
}

View file

@ -1,43 +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.uf.common.backupsvc.request;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.comm.IServerRequest;
/**
* Request to get map of backup hosts to set of capabilities for each host
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 20, 2017 6352 tgurney Initial creation
*
* </pre>
*
* @author tgurney
*/
@DynamicSerialize
public class GetBackupHostCapabilitiesMapRequest implements IServerRequest {
}

View file

@ -1,43 +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.uf.common.backupsvc.request;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.comm.IServerRequest;
/**
* Request to get list of backup hosts and EDEX version for each host
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 20, 2017 6352 tgurney Initial creation
*
* </pre>
*
* @author tgurney
*/
@DynamicSerialize
public class GetBackupHostVersionMapRequest implements IServerRequest {
}

View file

@ -1,43 +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.uf.common.backupsvc.request;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.comm.IServerRequest;
/**
* Request to get list of BackupService capabilities for a single server
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 26, 2017 6352 tgurney Initial creation
*
* </pre>
*
* @author tgurney
*/
@DynamicSerialize
public class GetBackupServiceCapabilitiesRequest implements IServerRequest {
}

View file

@ -1,61 +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.uf.common.backupsvc.request;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.common.serialization.comm.IServerRequest;
/**
* Request to get EDEX version string
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 17, 2016 5937 tgurney Initial creation
*
* </pre>
*
* @author tgurney
*/
@DynamicSerialize
public class GetEDEXVersionRequest implements IServerRequest {
/** Name of the host that is sending this request. */
@DynamicSerializeElement
private String requestingHost;
public String getRequestingHost() {
return requestingHost;
}
public void setRequestingHost(String requestingHost) {
this.requestingHost = requestingHost;
}
@Override
public String toString() {
return "GetEDEXVersionRequest [requestingHost=" + requestingHost + "]";
}
}

View file

@ -1,76 +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.uf.common.backupsvc.response;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* Response to GetEDEXVersionRequest
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 17, 2016 5937 tgurney Initial creation
*
* </pre>
*
* @author tgurney
*/
@DynamicSerialize
public class GetEDEXVersionResponse {
/** String returned in response when EDEX version is not known */
public static final String UNDEFINED = "Undefined";
@DynamicSerializeElement
private String edexVersion;
/** Host that is sending this response. */
@DynamicSerializeElement
private String respondingHost;
public String getEdexVersion() {
return edexVersion;
}
public void setEdexVersion(String edexVersion) {
this.edexVersion = edexVersion;
}
public String getRespondingHost() {
return respondingHost;
}
public void setRespondingHost(String respondingHost) {
this.respondingHost = respondingHost;
}
@Override
public String toString() {
return "GetEDEXVersionResponse [edexVersion=" + edexVersion
+ ", respondingHost=" + respondingHost + "]";
}
}

View file

@ -21,6 +21,8 @@
package com.raytheon.uf.common.dataplugin.satellite;
import java.awt.geom.Rectangle2D;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -37,22 +39,30 @@ import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.geotools.coverage.grid.GeneralGridEnvelope;
import org.geotools.coverage.grid.GridEnvelope2D;
import org.geotools.coverage.grid.GridGeometry2D;
import org.geotools.geometry.Envelope2D;
import org.geotools.geometry.GeneralEnvelope;
import org.geotools.referencing.crs.DefaultGeographicCRS;
import org.geotools.referencing.operation.DefaultMathTransformFactory;
import org.hibernate.annotations.Type;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.GeometryFactory;
import org.locationtech.jts.geom.Polygon;
import org.opengis.coverage.grid.GridEnvelope;
import org.opengis.geometry.Envelope;
import org.opengis.parameter.ParameterValueGroup;
import org.opengis.referencing.FactoryException;
import org.opengis.referencing.NoSuchIdentifierException;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.crs.ProjectedCRS;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
import com.raytheon.uf.common.geospatial.CRSCache;
import com.raytheon.uf.common.geospatial.IGridGeometryProvider;
import com.raytheon.uf.common.geospatial.MapUtil;
import com.raytheon.uf.common.geospatial.adapter.GeometryAdapter;
import com.raytheon.uf.common.geospatial.util.EnvelopeIntersection;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
@ -81,6 +91,8 @@ import com.raytheon.uf.common.status.UFStatus;
* Apr 11, 2014 2947 bsteffen Fix equals
* Oct 16, 2014 3454 bphillip Upgrading to Hibernate 4
* Nov 05, 2014 3788 bsteffen Make gid a sequence instead of a hash.
* May 19, 2015 mjames Added McIDAS GVAR native projection support.
* Apr 03, 2017 mjames Un-deprecate projection and fix for goesr ingest.
* Mar 20, 2019 6140 tgurney Hibernate 5 GeometryType fix
* May 8, 2019 6140 tgurney Lower the log level of some previously
* ignored exceptions (from error to debug)
@ -88,15 +100,19 @@ import com.raytheon.uf.common.status.UFStatus;
* </pre>
*/
@Entity
@Table(name = "satellite_spatial", uniqueConstraints = {
@UniqueConstraint(columnNames = { "minX", "minY", "dx", "dy", "nx",
"ny", "crsWKT" }) })
@Table(name = "satellite_spatial", uniqueConstraints = { @UniqueConstraint(columnNames = {
"minX", "minY", "dx", "dy", "nx", "ny", "projection", "upperLeftElement",
"upperLeftLine", "elementRes", "lineRes", "crsWKT" }) })
@SequenceGenerator(name = "SATELLITE_SPATIAL_GENERATOR", sequenceName = "satspatial_seq", allocationSize = 1)
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class SatMapCoverage extends PersistableDataObject<Object>
implements IGridGeometryProvider {
public static final int PROJ_GVAR = 7585;
public static final Integer VAL_MISSING = new Integer(-9999998);
private static final long serialVersionUID = 1L;
private static final IUFStatusHandler logger = UFStatus
@ -157,7 +173,31 @@ public class SatMapCoverage extends PersistableDataObject<Object>
@DynamicSerializeElement
private double dy;
@Column(length = 2047)
/** image element coordinate of area line 0, element 0 */
@Column
@XmlAttribute
@DynamicSerializeElement
private int upperLeftElement;
/** image line coordinate of area line 0, element 0 */
@Column
@XmlAttribute
@DynamicSerializeElement
private int upperLeftLine;
/** element resolution */
@Column
@XmlAttribute
@DynamicSerializeElement
private int elementRes;
/** line resolution */
@Column
@XmlAttribute
@DynamicSerializeElement
private int lineRes;
@Column(length = 5120)
@XmlAttribute
@DynamicSerializeElement
private String crsWKT;
@ -166,7 +206,7 @@ public class SatMapCoverage extends PersistableDataObject<Object>
private CoordinateReferenceSystem crsObject;
/** The map coverage */
@Column(name = "the_geom", columnDefinition = "geometry")
@Column(name = "the_geom")
@XmlJavaTypeAdapter(value = GeometryAdapter.class)
@DynamicSerializeElement
private Geometry location;
@ -232,6 +272,10 @@ public class SatMapCoverage extends PersistableDataObject<Object>
this.ny = ny;
this.dx = dx;
this.dy = dy;
setUpperLeftElement(VAL_MISSING);
setUpperLeftLine(VAL_MISSING);
setElementRes(VAL_MISSING);
setLineRes(VAL_MISSING);
this.crsObject = crs;
if (latLonGeometry == null) {
try {
@ -251,8 +295,67 @@ public class SatMapCoverage extends PersistableDataObject<Object>
}
/**
* @deprecated This field is only useful for GINI satellite format decoding
* and should not be in the coverage object
* Constructs a new SatMapCoverage Object
*
* @param projection
* the projection id value
* @param minX
* minimum x value in crs space
* @param minY
* minimum y value in crs space
* @param nx
* number of x points in the satellite grid
* @param ny
* number of y points in the satellite grid
* @param dx
* spacing between grid cells in crs x space
* @param dy
* spacing between grid cells in crs y space
* @param upperLeftElement
*
* @param upperLeftLine
*
* @param xres
*
* @param yres
*
* @param crs
* the satellite data crs
* @param latLonGeometry
* A Geometry representing the satellite bounds in lat/lon space
*/
public SatMapCoverage(int projection, double minX, double minY, int nx,
int ny, double dx, double dy, int upperLeftElement, int upperLeftLine,
int xres, int yres, CoordinateReferenceSystem crs, Geometry latLonGeometry) {
this.projection = projection;
this.minX = minX;
this.minY = minY;
this.nx = nx;
this.ny = ny;
this.dx = dx;
this.dy = dy;
setUpperLeftElement(upperLeftElement);
setUpperLeftLine(upperLeftLine);
setElementRes(xres);
setLineRes(yres);
this.crsObject = crs;
if (latLonGeometry == null) {
try {
latLonGeometry = EnvelopeIntersection
.createEnvelopeIntersection(
getGridGeometry().getEnvelope(),
new Envelope2D(DefaultGeographicCRS.WGS84,
-180, -90, 360, 180), 1.0, 10, 10)
.getEnvelope();
} catch (Exception e) {
// Ignore exception, null location
}
}
this.location = latLonGeometry;
}
/**
* @return
*/
@Deprecated
@ -326,6 +429,38 @@ public class SatMapCoverage extends PersistableDataObject<Object>
this.dy = dy;
}
public int getUpperLeftElement() {
return upperLeftElement;
}
public void setUpperLeftElement(int upperLeftElement) {
this.upperLeftElement = upperLeftElement;
}
public int getUpperLeftLine() {
return upperLeftLine;
}
public void setUpperLeftLine(int upperLeftLine) {
this.upperLeftLine = upperLeftLine;
}
public int getElementRes() {
return elementRes;
}
public void setElementRes(int elementRes) {
this.elementRes = elementRes;
}
public int getLineRes() {
return lineRes;
}
public void setLineRes(int lineRes) {
this.lineRes = lineRes;
}
public String getCrsWKT() {
if (crsWKT == null && crsObject != null) {
crsWKT = crsObject.toWKT();
@ -334,7 +469,7 @@ public class SatMapCoverage extends PersistableDataObject<Object>
}
public void setCrsWKT(String crsWKT) {
this.crsWKT = crsWKT;
this.crsWKT = crsWKT.replaceAll("\r\n", "");;
if (crsObject != null) {
crsObject = null;
}
@ -387,8 +522,18 @@ public class SatMapCoverage extends PersistableDataObject<Object>
public CoordinateReferenceSystem getCrs() {
if (crsObject == null && crsWKT != null) {
try {
crsObject = CRSCache.getInstance()
.getCoordinateReferenceSystem(crsWKT);
if (this.projection != null) {
if (this.projection == PROJ_GVAR) {
crsObject = constructCRSfromWKT(crsWKT);
} else {
crsObject = CRSCache.getInstance()
.getCoordinateReferenceSystem(crsWKT);
}
} else {
crsObject = CRSCache.getInstance()
.getCoordinateReferenceSystem(crsWKT);
}
} catch (FactoryException e) {
logger.debug("Error in getting the Coordinate Reference System",
e);
@ -400,10 +545,108 @@ public class SatMapCoverage extends PersistableDataObject<Object>
@Override
public GridGeometry2D getGridGeometry() {
GridEnvelope gridRange = new GridEnvelope2D(0, 0, getNx(), getNy());
Envelope crsRange = new Envelope2D(getCrs(), new Rectangle2D.Double(
minX, minY, getNx() * getDx(), getNy() * getDy()));
return new GridGeometry2D(gridRange, crsRange);
/*
* Native projections
*/
if (this.projection != null) {
if (projection == PROJ_GVAR) {
GridEnvelope gridRange = new GeneralGridEnvelope(new int[] {
0, 0 }, new int[] { getNx(),getNy() }, false);
GeneralEnvelope crsRange = new GeneralEnvelope(2);
crsRange.setCoordinateReferenceSystem( getCrs() );
int minX = getUpperLeftElement();
int maxX = getUpperLeftElement() + ( getNx() * getElementRes() );
int minY = getUpperLeftLine() + ( getNy() * getLineRes() );
minY = -minY;
int maxY = -1 * getUpperLeftLine();
crsRange.setRange(0, minX, maxX);
crsRange.setRange(1, minY, maxY);
return new GridGeometry2D(gridRange, crsRange);
} else {
GridEnvelope gridRange = new GridEnvelope2D(0, 0, getNx(), getNy());
Envelope crsRange = new Envelope2D(getCrs(), new Rectangle2D.Double(
minX, minY, getNx() * getDx(), getNy() * getDy()));
return new GridGeometry2D(gridRange, crsRange);
}
} else {
GridEnvelope gridRange = new GridEnvelope2D(0, 0, getNx(), getNy());
Envelope crsRange = new Envelope2D(getCrs(), new Rectangle2D.Double(
minX, minY, getNx() * getDx(), getNy() * getDy()));
return new GridGeometry2D(gridRange, crsRange);
}
}
public static ProjectedCRS constructCRSfromWKT(String crsWKT) {
Pattern AREA_PATTERN = Pattern
.compile("PROJCS\\[\"MCIDAS\\sAREA\\s(.*)\"");
Pattern NAV_BLOCK_PATTERN = Pattern.compile(
"\\[\"NAV_BLOCK_BASE64\",\\s\"(.*)\"\\]", Pattern.MULTILINE
| Pattern.DOTALL);
Matcher m = AREA_PATTERN.matcher(crsWKT);
m.find();
ProjectedCRS crsObject = null;
if (m.groupCount() == 1) {
String type = m.group(1);
m = NAV_BLOCK_PATTERN.matcher(crsWKT);
boolean found = m.find();
if (found) {
String navBlock = m.group(1);
crsObject = constructCRS(type, navBlock);
}
}
return crsObject;
}
public static ProjectedCRS constructCRS(String type, String encoded) {
ParameterValueGroup pvg = null;
DefaultMathTransformFactory dmtFactory = new DefaultMathTransformFactory();
try {
pvg = dmtFactory.getDefaultParameters("MCIDAS_AREA_NAV");
} catch (NoSuchIdentifierException e1) {
e1.printStackTrace();
}
/*
* semi_major and semi_minor parameters are set to 1, so that no global
* scaling is performed during coordinate transforms by
* org.geotools.referencing.operation.projection.MapProjection based on
* the radius of earth
*/
pvg.parameter("semi_major").setValue(1.0);
pvg.parameter("semi_minor").setValue(1.0);
pvg.parameter("central_meridian").setValue(0.0);
pvg.parameter("NAV_BLOCK_BASE64").setValue(encoded);
String projectionName = "MCIDAS AREA " + type;
ProjectedCRS mcidasCRS = null;
try {
mcidasCRS = MapUtil.constructProjection(projectionName, pvg);
} catch (FactoryException e) {
e.printStackTrace();
}
return mcidasCRS;
}
public GridGeometry2D getGridGeometryNativeProjection() {
GridEnvelope gridRange = new GeneralGridEnvelope(new int[] { 0, 0 }, new int[] { getNx(),getNy() }, false);
GeneralEnvelope crsRange = new GeneralEnvelope(2);
crsRange.setCoordinateReferenceSystem( constructCRSfromWKT(crsWKT) );
int minX = getUpperLeftElement();
int maxX = getUpperLeftElement() + ( getNx() * getElementRes() );
int minY = getUpperLeftLine() + ( getNy() * getLineRes() );
minY = -minY;
int maxY = -1 * getUpperLeftLine();
crsRange.setRange(0, minX, maxX);
crsRange.setRange(1, minY, maxY);
return new GridGeometry2D(gridRange, crsRange);
}
public Geometry getGeometry() {
return getLocation();
}
@Override

View file

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

View file

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.raytheon.uf.common.localization.backup</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

@ -1,10 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=11

View file

@ -1,16 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Localization Backup Plug-in
Bundle-SymbolicName: com.raytheon.uf.common.localization.backup
Bundle-Version: 1.16.0.qualifier
Bundle-Vendor: RAYTHEON
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: com.raytheon.uf.common.localization.backup.request
Require-Bundle: com.raytheon.uf.common.status,
com.raytheon.uf.common.serialization,
com.raytheon.uf.common.serialization.comm,
com.raytheon.uf.common.util,
com.raytheon.uf.common.localization,
com.raytheon.uf.common.backupsvc,
org.apache.commons.io,
org.slf4j

View file

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

View file

@ -1,109 +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.uf.common.localization.backup.request;
import java.io.IOException;
import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.raytheon.uf.common.backupsvc.IRefreshableServerRequest;
import com.raytheon.uf.common.localization.ILocalizationFile;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.exception.LocalizationException;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.common.serialization.comm.IServerRequest;
/**
* Request to delete a localization file
*
* NOTE: This is meant only for use with BackupService. If you need an API for
* generic localization file operations then use the localization REST
* interface.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 11, 2016 5937 tgurney Initial creation
* Oct 8, 2019 7929 tgurney Implement refresh()
*
* </pre>
*
* @author tgurney
*/
@DynamicSerialize
public class LocalizationFileDeleteRequest
implements IRefreshableServerRequest {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@DynamicSerializeElement
private String path;
@DynamicSerializeElement
private LocalizationContext context;
public LocalizationFileDeleteRequest() {
}
public LocalizationFileDeleteRequest(ILocalizationFile lf) {
this.path = lf.getPath();
this.context = lf.getContext();
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public LocalizationContext getContext() {
return context;
}
public void setContext(LocalizationContext context) {
this.context = context;
}
@Override
public Optional<IServerRequest> refresh() {
IPathManager pathMgr = PathManagerFactory.getPathManager();
ILocalizationFile lf = pathMgr.getLocalizationFile(context, path);
if (lf.exists()) {
try {
return Optional.of(new LocalizationFileSaveRequest(lf));
} catch (IOException | LocalizationException e) {
logger.warn("Failed to create a new save request for " + lf
+ ". Returning the old request unchanged", e);
}
}
return Optional.of(this);
}
}

View file

@ -1,142 +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.uf.common.localization.backup.request;
import java.io.IOException;
import java.io.InputStream;
import java.util.Optional;
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.raytheon.uf.common.backupsvc.IRefreshableServerRequest;
import com.raytheon.uf.common.localization.ILocalizationFile;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.exception.LocalizationException;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.common.serialization.comm.IServerRequest;
/**
* Request to save a localization file. Includes the entire contents of the file
* to save.
*
* NOTE: This is meant only for use with BackupService. If you need an API for
* generic localization file operations then use the localization REST
* interface.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 9, 2016 5937 tgurney Initial creation
* Oct 8, 2019 7929 tgurney Implement refresh(). Add file checksum
*
* </pre>
*
* @author tgurney
*/
@DynamicSerialize
public class LocalizationFileSaveRequest implements IRefreshableServerRequest {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@DynamicSerializeElement
private byte[] bytes;
@DynamicSerializeElement
private String path;
@DynamicSerializeElement
private LocalizationContext context;
@DynamicSerializeElement
private String checksum;
public LocalizationFileSaveRequest() {
}
public LocalizationFileSaveRequest(ILocalizationFile lf)
throws IOException, LocalizationException {
this.path = lf.getPath();
this.context = lf.getContext();
this.checksum = lf.getCheckSum();
try (InputStream inStream = lf.openInputStream()) {
this.bytes = IOUtils.toByteArray(inStream);
}
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public LocalizationContext getContext() {
return context;
}
public void setContext(LocalizationContext context) {
this.context = context;
}
public byte[] getBytes() {
return bytes;
}
public void setBytes(byte[] bytes) {
this.bytes = bytes;
}
public String getChecksum() {
return checksum;
}
public void setChecksum(String checksum) {
this.checksum = checksum;
}
@Override
public Optional<IServerRequest> refresh() {
IPathManager pathMgr = PathManagerFactory.getPathManager();
ILocalizationFile lf = pathMgr.getLocalizationFile(context, path);
if (lf.exists() && !lf.getCheckSum().equals(checksum)) {
try {
return Optional.of(new LocalizationFileSaveRequest(lf));
} catch (IOException | LocalizationException e) {
logger.warn("Failed to create a new save request for " + lf
+ ". Returning the old request unchanged", e);
}
} else if (!lf.exists()) {
LocalizationFileDeleteRequest newReq = new LocalizationFileDeleteRequest();
newReq.setContext(context);
newReq.setPath(path);
return Optional.of(newReq);
}
return Optional.of(this);
}
}

View file

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

View file

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.raytheon.uf.edex.backupsvc</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

@ -1,10 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=11

View file

@ -1,22 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Backup Service Plug-in
Bundle-SymbolicName: com.raytheon.uf.edex.backupsvc
Bundle-Version: 1.18.0.qualifier
Bundle-Vendor: RAYTHEON
Bundle-RequiredExecutionEnvironment: JavaSE-11
Bundle-ActivationPolicy: lazy
Import-Package: javax.persistence
Require-Bundle: com.raytheon.uf.edex.database,
com.raytheon.uf.common.serialization.comm,
com.raytheon.uf.common.backupsvc,
com.raytheon.uf.common.serialization,
com.raytheon.uf.common.status,
com.raytheon.uf.edex.core,
com.raytheon.uf.common.comm,
com.raytheon.uf.common.message,
com.raytheon.uf.common.util,
com.raytheon.uf.common.localization,
com.raytheon.uf.common.time,
org.slf4j,
javax.xml.bind

View file

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

View file

@ -1,60 +0,0 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="backupSvcDbPluginProperties" class="com.raytheon.uf.edex.database.DatabasePluginProperties">
<property name="pluginFQN" value="com.raytheon.uf.edex.backupsvc"/>
<property name="database" value="metadata"/>
</bean>
<bean id="backupSvcDbRegistered" factory-bean="dbPluginRegistry" factory-method="register">
<constructor-arg value="com.raytheon.uf.edex.backupsvc"/>
<constructor-arg ref="backupSvcDbPluginProperties"/>
</bean>
<bean id="backupServiceCapabilityManager" class="com.raytheon.uf.edex.backupsvc.service.BackupServiceCapabilityManager"
factory-method="getInstance" />
<bean id="getBackupHostCapabilitiesMapHandler" class="com.raytheon.uf.edex.backupsvc.handlers.GetBackupHostCapabilitiesMapHandler" />
<bean id="getBackupHostVersionMapHandler" class="com.raytheon.uf.edex.backupsvc.handlers.GetBackupHostVersionMapHandler" />
<bean id="getEdexVersionHandler" class="com.raytheon.uf.edex.backupsvc.handlers.GetEDEXVersionHandler" />
<bean id="getBackupServiceCapabilitiesHandler" class="com.raytheon.uf.edex.backupsvc.handlers.GetBackupServiceCapabilitiesHandler" />
<bean id="backupEnqueueHandler" class="com.raytheon.uf.edex.backupsvc.handlers.BackupEnqueueHandler" />
<bean id="backupSvc" class="com.raytheon.uf.edex.backupsvc.service.BackupService" depends-on="backupSvcDbRegistered" />
<camelContext id="clusteredBackupSvcContext"
xmlns="http://camel.apache.org/schema/spring"
errorHandlerRef="errorHandler">
<endpoint id="backupSvcStatsCron"
uri="quartz://backupSvcStatsScheduled/?cron=0+7+*+*+*+?)"/>
<route id="backupSvcStatsScheduled">
<from uri="backupSvcStatsCron" />
<doTry>
<bean ref="backupSvc" method="reportStats" />
<doCatch>
<exception>java.lang.Throwable</exception>
<to uri="log:backupSvc?level=ERROR"/>
</doCatch>
</doTry>
</route>
</camelContext>
<bean factory-bean="contextManager" factory-method="registerClusteredContext">
<constructor-arg ref="clusteredBackupSvcContext" />
</bean>
<bean factory-bean="contextManager" factory-method="registerContextStateProcessor">
<constructor-arg ref="clusteredBackupSvcContext"/>
<constructor-arg ref="backupSvc"/>
</bean>
</beans>

View file

@ -1,70 +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.uf.edex.backupsvc.database;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
/**
* Separate blob table for backup jobs
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 10, 2016 5937 tgurney Initial creation
*
* </pre>
*
* @author tgurney
*/
@Entity
@SequenceGenerator(initialValue = 1, name = "backup_blobseq", sequenceName = "backup_blobseq", allocationSize = 1)
@Table(name = "backup_blob")
public class BackupBlob implements Serializable {
private static final long serialVersionUID = 1L;
@Column
@Id
@GeneratedValue(generator = "backup_blobseq", strategy = GenerationType.SEQUENCE)
private long id;
@Column
private byte[] blob;
public byte[] getBlob() {
return blob;
}
public void setBlob(byte[] blob) {
this.blob = blob;
}
}

View file

@ -1,166 +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.uf.edex.backupsvc.database;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import org.hibernate.annotations.Index;
/**
* Backup job that includes a host name and data to send to that host
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 18, 2016 5937 tgurney Initial creation
* Jul 20, 2017 6352 tgurney Add min/maxversionRequired
* Apr 06, 2021 22487 smoorthy increase field size of jobName
*
* </pre>
*
* @author tgurney
*/
@Entity
@SequenceGenerator(initialValue = 1, name = "backup_jobseq", sequenceName = "backup_jobseq", allocationSize = 1)
@Table(name = "backup_job")
public class BackupJob implements Serializable {
private static final long serialVersionUID = 1L;
@Column
@Id
@GeneratedValue(generator = "backup_jobseq", strategy = GenerationType.SEQUENCE)
private long id;
@Column(nullable = false, length = 256)
private String jobName;
@Column(nullable = false)
private int priority;
@Column(name = "host", nullable = false, length = 128)
@Index(name = "backupJobHostIdx")
private String host;
/**
* NOTE: There is no getter for this field. Access should be done via a
* primary key lookup on backup_blob table, hence the separate backupBlobId
* field.
*/
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "backup_blob_id")
private BackupBlob requestBlob;
@Column(nullable = false)
private long createdTime;
@Column(nullable = false)
private int blobSize;
@Column(name = "backup_blob_id", insertable = false, updatable = false)
private long backupBlobId;
@Column(length = 16)
private String minVersionRequired;
@Column(length = 16)
private String maxVersionRequired;
public int getPriority() {
return priority;
}
public void setPriority(int priority) {
this.priority = priority;
}
public String getJobName() {
return jobName;
}
public void setJobName(String jobName) {
this.jobName = jobName;
}
public long getId() {
return id;
}
public void setRequestBlob(BackupBlob requestBlob) {
this.requestBlob = requestBlob;
this.blobSize = requestBlob.getBlob().length;
}
public long getCreatedTime() {
return createdTime;
}
public void setCreatedTime(long createdTime) {
this.createdTime = createdTime;
}
public int getBlobSize() {
return blobSize;
}
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public long getBackupBlobId() {
return backupBlobId;
}
public String getMinVersionRequired() {
return minVersionRequired;
}
public void setMinVersionRequired(String minVersionRequired) {
this.minVersionRequired = minVersionRequired;
}
public String getMaxVersionRequired() {
return maxVersionRequired;
}
public void setMaxVersionRequired(String maxVersionRequired) {
this.maxVersionRequired = maxVersionRequired;
}
}

View file

@ -1,237 +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.uf.edex.backupsvc.database;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.StatelessSession;
import org.hibernate.Transaction;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.edex.database.dao.CoreDao;
import com.raytheon.uf.edex.database.dao.DaoConfig;
/**
* Data access methods for backup job operations.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 10, 2016 5937 tgurney Initial creation
* Jul 20, 2017 6352 tgurney Add versionRequired parameters to
* createNewJob()
* Oct 3, 2019 7929 tgurney Add FIXME for potential issue with
* large numbers of deferred jobs clogging
* up the queue
*
* </pre>
*
* @author tgurney
*/
public class BackupJobDao extends CoreDao {
private static final String DB_NAME = "metadata";
private static final String POLL_QUERY = "select j1.id id from "
+ " (select max(id) id, jobname from backup_job "
+ " where host = :host group by jobname) j1 "
+ " join (select id, priority from backup_job) j2 "
+ " on j1.id=j2.id order by priority asc";
private static final String PURGE_OLD_JOBS_QUERY = "delete from backup_job "
+ " where jobname = :jobName and host = :host and id <= :jobId ";
private static final String PURGE_HOSTS_QUERY = "delete from backup_job "
+ " where host in (:hosts)";
private static final String PURGE_BLOBS_QUERY = "delete from backup_blob "
+ " where id in "
+ "(select b.id from backup_blob b left join backup_job j"
+ " on b.id = j.backup_blob_id "
+ " where j.backup_blob_id is null)";
public BackupJobDao() {
super(DaoConfig.forDatabase(DB_NAME));
}
/**
* Delete this job and any older jobs that it replaced.
*
* @param job
*/
public void removeFinishedJob(BackupJob job) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("jobName", job.getJobName());
paramMap.put("host", job.getHost());
paramMap.put("jobId", job.getId());
executeSQLUpdate(PURGE_OLD_JOBS_QUERY, paramMap);
}
/**
* Delete all jobs except those for the specified hosts. Then delete any
* orphan blobs.
*
* @param hostsToKeep
* Keep only the jobs that would run for these hosts.
*/
public void cleanUp(List<String> hostsToKeep) {
long t0 = System.currentTimeMillis();
Object[] result = executeSQLQuery(
"select distinct host from backup_job");
if (result != null && result.length > 0) {
List<String> hostsToRemove = Arrays.stream(result)
.map(Object::toString)
.filter(item -> !hostsToKeep.contains(item))
.collect(Collectors.toList());
if (!hostsToRemove.isEmpty()) {
logger.info("Found " + hostsToRemove.size()
+ " old hosts. Purging old host jobs");
int purgeCount = executeSQLUpdate(PURGE_HOSTS_QUERY, "hosts",
hostsToRemove);
logger.info("Purged " + purgeCount + " jobs");
}
}
int purgeCount = executeSQLUpdate(PURGE_BLOBS_QUERY);
long t1 = System.currentTimeMillis();
logger.info("Purged " + purgeCount + " finished request blobs");
logger.info("Cleanup took " + TimeUtil.prettyDuration(t1 - t0));
}
/**
* Create a new backup job.
*
* @param jobName
* @param priority
* Lower number = higher priority
* @param blob
* The serialized request blob
* @param hosts
* List of hosts to send the request to
* @param minVersionRequired
* Host must have at least this EDEX version to receive this
* request
* @param maxVersionRequired
* Host must have no greater than this EDEX version to receive
* this request
*/
public void createNewJob(String jobName, int priority, byte[] blob,
List<String> hosts, String minVersionRequired,
String maxVersionRequired) {
Session session = null;
Transaction tx = null;
long now = System.currentTimeMillis();
try {
session = getSessionFactory().openSession();
tx = session.beginTransaction();
BackupBlob requestBlob = new BackupBlob();
requestBlob.setBlob(blob);
session.persist(requestBlob);
for (String host : hosts) {
BackupJob job = new BackupJob();
job.setJobName(jobName);
job.setPriority(priority);
job.setRequestBlob(requestBlob);
job.setCreatedTime(now);
job.setHost(host);
job.setMinVersionRequired(minVersionRequired);
job.setMaxVersionRequired(maxVersionRequired);
session.persist(job);
}
tx.commit();
} catch (HibernateException e) {
if (tx != null) {
tx.rollback();
}
throw e;
} finally {
if (session != null) {
session.close();
}
}
}
/**
* Get next jobs to run for a single host
*
* @param host
* @return List of jobs
*/
@SuppressWarnings("unchecked")
public List<BackupJob> poll(String host) {
/*
* FIXME: Returning only the 1000 oldest/highest priority jobs means
* that in the unlikely event that there are 1000 or more jobs in the
* queue, and the top 1000 are being held due to version mismatch
* between sender and receiver, then any jobs behind those will be stuck
* for a long time. The solution here is not obvious, and this seems
* pretty unlikely to happen in any operational situation, but if it did
* happen it could be a big problem.
*/
Object[] ids = executeSQLQuery(POLL_QUERY, "host", host, 1000);
if (ids == null || ids.length == 0) {
return Collections.emptyList();
}
List<Long> longIds = Arrays.stream(ids).map(Object::toString)
.map(Long::valueOf).collect(Collectors.toList());
Session s = null;
try {
s = getSessionFactory().openSession();
List<BackupJob> jobs = s
.createQuery("from BackupJob where id in (:ids)")
.setParameterList("ids", longIds).list();
return jobs;
} finally {
if (s != null) {
s.close();
}
}
}
/**
* Get request blob for a specified job
*
* @param job
* @return The serialized request
*/
public byte[] fetchBlob(BackupJob job) {
StatelessSession ss = null;
try {
ss = getSessionFactory().openStatelessSession();
BackupBlob blobRecord = (BackupBlob) ss.get(BackupBlob.class,
job.getBackupBlobId());
return blobRecord.getBlob();
} finally {
if (ss != null) {
ss.close();
}
}
}
}

View file

@ -1,151 +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.uf.edex.backupsvc.handlers;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.raytheon.uf.common.backupsvc.BackupServiceException;
import com.raytheon.uf.common.backupsvc.request.BackupEnqueueRequest;
import com.raytheon.uf.common.serialization.DynamicSerializationManager;
import com.raytheon.uf.common.serialization.DynamicSerializationManager.SerializationType;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.serialization.comm.IRequestHandler;
import com.raytheon.uf.common.serialization.comm.IServerRequest;
import com.raytheon.uf.common.serialization.comm.response.GenericResponse;
import com.raytheon.uf.edex.backupsvc.database.BackupJobDao;
import com.raytheon.uf.edex.backupsvc.service.BackupServiceConfigManager;
/**
* Handler for BackupEnqueueRequest
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 10, 2016 5937 tgurney Initial creation
* Dec 9, 2016 5937 tgurney Better config handling
* Jul 20, 2017 6352 tgurney Add versionRequired parameters to enqueue
* Oct 8, 2019 7929 tgurney Store the request uncompressed
*
* </pre>
*
* @author tgurney
*/
public class BackupEnqueueHandler
implements IRequestHandler<BackupEnqueueRequest> {
private final Logger logger = LoggerFactory.getLogger(getClass());
private BackupJobDao dao;
private BackupServiceConfigManager configMgr;
public BackupEnqueueHandler() {
dao = new BackupJobDao();
configMgr = BackupServiceConfigManager.getInstance();
}
/**
* Enqueue a request to send to backup hosts. A new job with the same name
* as a job that is already in queue will supersede that already existing
* job. If you don't want this behavior then you need to use a unique job
* name every time you enqueue a job. Note that this method will not create
* a job (i.e. is a no-op) if no backup hosts are configured.
*
* @param request
* Request to send
* @param jobName
* Job name
* @param priority
* Request priority (lower number = higher priority)
* @param hostnames
* List of hosts to send the request to. If empty, send to all
* hosts configured with BackupService
* @param minVersionRequired
* Host must have at least this EDEX version to receive this
* request
* @param maxVersionRequired
* Host must have no greater than this EDEX version to receive
* this request
* @throws SerializationException
* @throws BackupServiceException
* If the enqueue failed. This is either a database-related
* error, or a failure to serialize the provided request, or a
* problem with BackupService configuration
*/
private void enqueue(IServerRequest request, String jobName, int priority,
List<String> hostnames, String minVersionRequired,
String maxVersionRequired)
throws BackupServiceException, SerializationException {
List<String> filteredHostnames = new ArrayList<>();
List<String> configuredHostnames = configMgr.getHostnamesOnly();
if (configuredHostnames.isEmpty()) {
throw new BackupServiceException("No backup hosts are configured.");
}
if (hostnames != null) {
for (String hostname : hostnames) {
if (configuredHostnames.contains(hostname)) {
filteredHostnames.add(hostname);
} else {
// Host specified that is not configured
throw new BackupServiceException("Host " + hostname
+ " is not a configured backup host.");
}
}
} else {
// No hostnames specified. Send to all configured hosts
filteredHostnames = configuredHostnames;
}
byte[] blob = DynamicSerializationManager
.getManager(SerializationType.Thrift).serialize(request);
try {
dao.createNewJob(jobName, priority, blob, filteredHostnames,
minVersionRequired, maxVersionRequired);
} catch (Exception e) {
throw new BackupServiceException(e);
}
}
@Override
public Object handleRequest(BackupEnqueueRequest request) throws Exception {
GenericResponse response = new GenericResponse();
response.setSuccess(false);
try {
enqueue(request.getRequest(), request.getJobName(),
request.getPriority(), request.getHosts(),
request.getMinVersionRequired(),
request.getMaxVersionRequired());
response.setSuccess(true);
} catch (Exception e) {
logger.error("Failed to enqueue backup job " + request.getJobName()
+ ": ", e);
response.setMessage(e.getMessage());
}
return response;
}
}

View file

@ -1,71 +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.uf.edex.backupsvc.handlers;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.raytheon.uf.common.backupsvc.BackupHost;
import com.raytheon.uf.common.backupsvc.request.GetBackupHostCapabilitiesMapRequest;
import com.raytheon.uf.common.serialization.comm.IRequestHandler;
import com.raytheon.uf.edex.backupsvc.service.BackupServiceConfigManager;
/**
* Handler for {@link GetBackupHostCapabilitiesMapRequest}
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 20, 2017 6352 tgurney Initial creation
*
* </pre>
*
* @author tgurney
*/
public class GetBackupHostCapabilitiesMapHandler
implements IRequestHandler<GetBackupHostCapabilitiesMapRequest> {
public GetBackupHostCapabilitiesMapHandler() {
}
@Override
public Object handleRequest(GetBackupHostCapabilitiesMapRequest request)
throws Exception {
BackupServiceConfigManager configMgr = BackupServiceConfigManager
.getInstance();
configMgr.reload();
List<BackupHost> hosts = BackupServiceConfigManager.getInstance()
.getBackupHosts();
Map<String, Set<String>> hostMap = new HashMap<>();
for (BackupHost host : hosts) {
Set<String> capabilities = host.getCapabilities();
if (capabilities != null) {
hostMap.put(host.getName(), capabilities);
}
}
return hostMap;
}
}

View file

@ -1,70 +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.uf.edex.backupsvc.handlers;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.raytheon.uf.common.backupsvc.BackupHost;
import com.raytheon.uf.common.backupsvc.request.GetBackupHostVersionMapRequest;
import com.raytheon.uf.common.serialization.comm.IRequestHandler;
import com.raytheon.uf.edex.backupsvc.service.BackupServiceConfigManager;
/**
* Handler for {@link GetBackupHostVersionMapRequest}
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 20, 2017 6352 tgurney Initial creation
*
* </pre>
*
* @author tgurney
*/
public class GetBackupHostVersionMapHandler
implements IRequestHandler<GetBackupHostVersionMapRequest> {
public GetBackupHostVersionMapHandler() {
}
@Override
public Object handleRequest(GetBackupHostVersionMapRequest request)
throws Exception {
BackupServiceConfigManager configMgr = BackupServiceConfigManager
.getInstance();
configMgr.reload();
List<BackupHost> hosts = BackupServiceConfigManager.getInstance()
.getBackupHosts();
Map<String, String> hostMap = new HashMap<>();
for (BackupHost host : hosts) {
String version = host.getEDEXVersion();
if (version != null) {
hostMap.put(host.getName(), version);
}
}
return hostMap;
}
}

View file

@ -1,50 +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.uf.edex.backupsvc.handlers;
import com.raytheon.uf.common.backupsvc.request.GetBackupServiceCapabilitiesRequest;
import com.raytheon.uf.common.serialization.comm.IRequestHandler;
import com.raytheon.uf.edex.backupsvc.service.BackupServiceCapabilityManager;
/**
* Handler for {@link GetBackupServiceCapabilitiesRequest}
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 26, 2017 6352 tgurney Initial creation
*
* </pre>
*
* @author tgurney
*/
public class GetBackupServiceCapabilitiesHandler
implements IRequestHandler<GetBackupServiceCapabilitiesRequest> {
@Override
public Object handleRequest(GetBackupServiceCapabilitiesRequest request)
throws Exception {
return BackupServiceCapabilityManager.getInstance().getCapabilities();
}
}

View file

@ -1,60 +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.uf.edex.backupsvc.handlers;
import com.raytheon.uf.common.backupsvc.request.GetEDEXVersionRequest;
import com.raytheon.uf.common.backupsvc.response.GetEDEXVersionResponse;
import com.raytheon.uf.common.serialization.comm.IRequestHandler;
import com.raytheon.uf.common.util.SystemUtil;
import com.raytheon.uf.common.util.app.AppInfo;
/**
* Handler for GetEDEXVersionRequest
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 17, 2016 5937 tgurney Initial creation
*
* </pre>
*
* @author tgurney
*/
public class GetEDEXVersionHandler
implements IRequestHandler<GetEDEXVersionRequest> {
@Override
public Object handleRequest(GetEDEXVersionRequest request)
throws Exception {
GetEDEXVersionResponse response = new GetEDEXVersionResponse();
response.setEdexVersion(GetEDEXVersionResponse.UNDEFINED);
response.setRespondingHost(SystemUtil.getHostName());
String edexVersion = AppInfo.getInstance().getVersion();
if (edexVersion != null) {
response.setEdexVersion(edexVersion);
}
return response;
}
}

View file

@ -1,310 +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.uf.edex.backupsvc.service;
import java.util.List;
import java.util.Optional;
import com.raytheon.uf.common.backupsvc.BackupHost;
import com.raytheon.uf.common.backupsvc.IRefreshableServerRequest;
import com.raytheon.uf.common.serialization.DynamicSerializationManager;
import com.raytheon.uf.common.serialization.DynamicSerializationManager.SerializationType;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.serialization.comm.IServerRequest;
import com.raytheon.uf.common.serialization.comm.RequestRouter;
import com.raytheon.uf.common.serialization.comm.response.GenericResponse;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.common.util.SizeUtil;
import com.raytheon.uf.common.util.rate.TokenBucket;
import com.raytheon.uf.edex.backupsvc.database.BackupJob;
import com.raytheon.uf.edex.backupsvc.database.BackupJobDao;
import com.raytheon.uf.edex.core.EDEXUtil;
import com.raytheon.uf.edex.core.EdexTimerBasedThread;
/**
* Service for pushing data to other EDEX hosts. Designed for pushing
* localization file updates to backup hosts, but may be used for other
* inter-site communication purposes.
*
* This is a clustered singleton service. It must only be instantiated from
* Spring and only in one place.
*
* USAGE: Submit a BackupEnqueueRequest that contains the request you want to
* send out to the backup hosts.
*
* CONFIGURATION: The service is configured by a site-level localization XML
* file. That file lists the hosts that all data will be sent to, and specifies
* the rate limit (in KiB) for sending requests. The config file is reloaded
* each time the backup service wakes up.
*
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 18, 2016 5937 tgurney Initial creation
* Dec 9, 2016 5937 tgurney Fix initial sleep interval
* Dec 9, 2016 5937 tgurney Improve configuration logic
* Mar 23, 2017 5937 tgurney Do not process() during EDEX startup
* Mar 30, 2017 5937 rjpeter Use EdexTimerBasedThread logger.
* Jul 20, 2017 6352 tgurney Add min/maxVersionRequired job parameters
* Jul 24, 2017 6352 tgurney Move stats reporting code to new class
* Oct 3, 2019 7929 tgurney Defer jobs that are destined for a server
* with newer EDEX version (instead of
* throwing them out). Also log stats for
* deferred jobs. Add mechanism to refresh
* a request before it is sent
*
* </pre>
*
* @author tgurney
*/
public class BackupService extends EdexTimerBasedThread {
public enum JobStatus {
SUCCESSFUL, FAILED, DEFERRED, CANCELED;
@Override
public String toString() {
String name = name().toLowerCase();
return Character.toUpperCase(name.charAt(0)) + name.substring(1);
}
}
private final BackupServiceStatsReporter statsReporter;
private final BackupJobDao dao;
private TokenBucket rateLimiter;
/**
* Public constructor for Spring only; do not try to instantiate this
* yourself
*/
public BackupService() {
long t0 = System.currentTimeMillis();
threadSleepInterval = (int) (BackupServiceConfigManager.getInstance()
.getPollIntervalSeconds() * TimeUtil.MILLIS_PER_SECOND);
dao = new BackupJobDao();
statsReporter = new BackupServiceStatsReporter();
long t1 = System.currentTimeMillis();
logger.info("Initialized in " + TimeUtil.prettyDuration(t1 - t0));
}
/**
* Run a single job for a single host.
*
* @param job
* @param host
* @return the job status
*/
private JobStatus runJob(BackupJob job, BackupHost host) {
try {
// Send the request
Optional<IServerRequest> maybeRequest = getRequestFromJob(job);
if (!maybeRequest.isPresent()) {
return JobStatus.CANCELED;
}
IServerRequest request = maybeRequest.get();
Object response = null;
try {
response = host.sendRequest(request, rateLimiter);
} catch (Exception e) {
logger.error("Error when sending request " + request + " to "
+ host + " for job " + job.getJobName(), e);
return JobStatus.FAILED;
}
if (response instanceof IServerRequest) {
// Route response-request if we got one
try {
RequestRouter.route((IServerRequest) response);
} catch (Exception e) {
logger.error("Error when handling response " + response
+ " from " + host, e);
}
} else if (response instanceof GenericResponse) {
// Handle generic response if we got one
GenericResponse genericResponse = (GenericResponse) response;
if (genericResponse.isSuccess()) {
logger.debug("Got success response from " + host);
} else {
logger.warn("Got failure response from " + host + ": "
+ genericResponse.getMessage());
}
} else {
logger.info("Got unknown type of response from " + host + ": "
+ response.toString());
}
return JobStatus.SUCCESSFUL;
} catch (SerializationException e) {
logger.error("Error when deserializing stored request for job "
+ job.getJobName(), e);
return JobStatus.FAILED;
}
}
private Optional<IServerRequest> getRequestFromJob(BackupJob job)
throws SerializationException {
IServerRequest request = (IServerRequest) DynamicSerializationManager
.getManager(SerializationType.Thrift)
.deserialize(dao.fetchBlob(job));
if (!(request instanceof IRefreshableServerRequest)) {
return Optional.of(request);
}
IRefreshableServerRequest refreshable = (IRefreshableServerRequest) request;
Optional<IServerRequest> maybeRequest = refreshable.refresh();
if (maybeRequest.isPresent() && maybeRequest.get() != request) {
logger.info("Job " + job.getJobName() + " was refreshed");
}
return maybeRequest;
}
/**
* Take a snapshot of enqueued jobs and run them one at a time.
*/
@Override
public void process() throws Exception {
if (!EDEXUtil.isRunning()) {
return;
}
statsReporter.logRun();
logger.info("Checking for Backup Service jobs...");
BackupServiceConfigManager configMgr = BackupServiceConfigManager
.getInstance();
configMgr.reload();
threadSleepInterval = (int) (configMgr.getPollIntervalSeconds()
* TimeUtil.MILLIS_PER_SECOND);
if (rateLimiter == null || configMgr.getRateLimitKBps()
* SizeUtil.BYTES_PER_KB != rateLimiter.getCapacity()) {
rateLimiter = new TokenBucket((int) (configMgr.getRateLimitKBps()
* SizeUtil.BYTES_PER_KB));
}
List<BackupHost> hosts = configMgr.getBackupHosts();
if (hosts.isEmpty()) {
logger.info("No backup sites configured, exiting");
return;
}
long bytesSentThisRun = 0;
int requestsSentThisRun = 0;
long t0 = System.currentTimeMillis();
for (BackupHost host : hosts) {
if (EDEXUtil.isShuttingDown()) {
break;
}
for (BackupJob job : dao.poll(host.getName())) {
if (EDEXUtil.isShuttingDown()) {
break;
}
Integer versionMatches = host.compareVersion(
job.getMinVersionRequired(),
job.getMaxVersionRequired());
JobStatus jobStatus = JobStatus.DEFERRED;
if (versionMatches == null) {
logger.warn("Unable to contact " + job.getHost()
+ " for version information. Skipping job "
+ job.getJobName() + " for this host. "
+ "Will try again next time");
} else if (versionMatches != 0) {
logger.info("Skipping job " + job.getJobName() + " for "
+ job.getHost() + " as that server's version ("
+ host.getEDEXVersion()
+ ") is outside the allowed range ["
+ job.getMinVersionRequired() + ", "
+ job.getMaxVersionRequired()
+ "]. Will try again next time");
} else {
if (job.getBlobSize() > configMgr.getBigJobSize()) {
logger.warn(String.format(
"Job %s includes large request (%s)",
job.getJobName(),
SizeUtil.prettyByteSize(job.getBlobSize())));
}
jobStatus = runJob(job, host);
if (jobStatus == JobStatus.SUCCESSFUL) {
/*
* TODO this size is not correct anymore. It's only
* correct for the request blob as stored in the
* database. The request is now gzipped by HttpClient so
* we don't know how many bytes are actually being sent.
* Also the request could have been refreshed before
* sending, which could change the size arbitrarily. So
* this stat isn't of much use except as an
* approximation.
*/
bytesSentThisRun += job.getBlobSize();
requestsSentThisRun++;
dao.removeFinishedJob(job);
} else if (jobStatus == JobStatus.CANCELED) {
logger.info("Job " + job.getJobName()
+ " was canceled on refresh");
dao.removeFinishedJob(job);
}
}
statsReporter.logProcessedJob(job, jobStatus);
}
}
long t1 = System.currentTimeMillis();
if (requestsSentThisRun > 0) {
logger.info(String.format("Sent %d requests totaling %s in %s.",
requestsSentThisRun,
SizeUtil.prettyByteSize(bytesSentThisRun),
TimeUtil.prettyDuration(t1 - t0)));
} else {
logger.info("No jobs to run");
}
if (!EDEXUtil.isShuttingDown() && requestsSentThisRun > 0) {
// This is a maintenance task that need not be performed every run
dao.cleanUp(configMgr.getHostnamesOnly());
}
}
@Override
public String getThreadGroupName() {
return "backupServiceThread";
}
@Override
public void preStop() {
super.preStop();
// Stop any network I/O
synchronized (threads) {
for (Thread thread : threads) {
thread.interrupt();
}
}
}
/**
* Dump stats report to log and reset accumulated stats. Called via Spring
*/
public void reportStats() {
statsReporter.reportStats();
}
}

View file

@ -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.uf.edex.backupsvc.service;
import java.util.HashSet;
import java.util.Set;
import com.raytheon.uf.common.backupsvc.request.GetBackupHostCapabilitiesMapRequest;
/**
* Stores BackupService capabilities for this server.
*
* A "capability" in the BackupService context is just a string associated with
* a particular server. EDEX plugins may contribute capabilities by calling
* register(). Then anyone (client or server-side) may send a
* {@link GetBackupHostCapabilitiesMapRequest} to the server running
* BackupService to retrieve a list of all configured backup servers and the
* capabilities of each server.
*
* Example use cases:
*
* 1. A part of the system that wants to enqueue a backup job may query for a
* list of servers that have a particular capability, and only enqueue the job
* for those servers.
*
* 2. Creators of BackupService jobs can tailor a job's IServerRequest to each
* individual server, depending on what capabilities each server has.
*
* Notes:
*
* - The total number of different capabilities that a server may have is not
* enumerable. Any EDEX code can call registerCapability() with any string, and
* in doing so create a new capability.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 26, 2017 6352 tgurney Initial creation
*
* </pre>
*
* @author tgurney
*/
public class BackupServiceCapabilityManager {
private static final BackupServiceCapabilityManager INSTANCE = new BackupServiceCapabilityManager();
private Set<String> capabilities = new HashSet<>();
private BackupServiceCapabilityManager() {
}
public static BackupServiceCapabilityManager getInstance() {
return INSTANCE;
}
public void register(String capability) {
capabilities.add(capability);
}
/** @return the list of capabilities that this server has */
public Set<String> getCapabilities() {
return new HashSet<>(capabilities);
}
}

View file

@ -1,97 +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.uf.edex.backupsvc.service;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.backupsvc.BackupHost;
import com.raytheon.uf.common.util.SizeUtil;
/**
* Configuration XML file for backup service
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 2, 2016 5937 tgurney Initial creation
*
* </pre>
*
* @author tgurney
*/
@XmlRootElement(name = "backupServiceConfig")
@XmlAccessorType(XmlAccessType.NONE)
public class BackupServiceConfig {
@XmlElement(name = "pollIntervalSeconds")
private int pollIntervalSeconds = 300;
@XmlElement(name = "rateLimitKBps")
private int rateLimitKBps = 16;
@XmlElement(name = "bigJobSize")
private int bigJobSize = (int) (5 * SizeUtil.BYTES_PER_MB);
@XmlElementWrapper(name = "hosts", required = true)
@XmlElement(name = "host")
private List<BackupHost> hosts = new ArrayList<>();
public List<BackupHost> getHosts() {
return hosts;
}
public void setHosts(List<BackupHost> hosts) {
this.hosts = hosts;
}
public int getPollIntervalSeconds() {
return pollIntervalSeconds;
}
public void setPollIntervalSeconds(int pollIntervalSeconds) {
this.pollIntervalSeconds = pollIntervalSeconds;
}
public int getRateLimitKBps() {
return rateLimitKBps;
}
public void setRateLimitKBps(int rateLimitKBps) {
this.rateLimitKBps = rateLimitKBps;
}
public int getBigJobSize() {
return bigJobSize;
}
public void setBigJobSize(int bigJobSize) {
this.bigJobSize = bigJobSize;
}
}

View file

@ -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.uf.edex.backupsvc.service;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import javax.xml.bind.JAXBException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.raytheon.uf.common.backupsvc.BackupHost;
import com.raytheon.uf.common.localization.ILocalizationFile;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.exception.LocalizationException;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.serialization.SingleTypeJAXBManager;
/**
* Singleton that manages configuration for backup service
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 16, 2016 5937 tgurney Initial creation
* Dec 9, 2016 5937 tgurney Make thread safe. Change reload strategy
* Jul 24, 2017 6352 tgurney Host getters return ArrayList
*
* </pre>
*
* @author tgurney
*/
public class BackupServiceConfigManager {
private static final String SETTINGS_FILE = "backupsvc"
+ IPathManager.SEPARATOR + "backupSvc.xml";
private static final Logger logger = LoggerFactory
.getLogger(BackupServiceConfigManager.class);
private static final BackupServiceConfigManager INSTANCE = new BackupServiceConfigManager();
private SingleTypeJAXBManager<BackupServiceConfig> jaxbManager;
private volatile BackupServiceConfig config;
private BackupServiceConfigManager() {
reload();
PathManagerFactory.getPathManager()
.addLocalizationPathObserver(SETTINGS_FILE, (file) -> {
reload();
});
}
public static BackupServiceConfigManager getInstance() {
return INSTANCE;
}
/**
* Load backup service configuration from the localization XML file. Will
* always load the file, regardless of last modified time. If there is an
* error when loading the file then we will fall back to the default
* configuration which contains no backup hosts.
*/
public synchronized void reload() {
IPathManager pathManager = PathManagerFactory.getPathManager();
LocalizationContext siteCtx = pathManager.getContext(
LocalizationType.COMMON_STATIC, LocalizationLevel.SITE);
ILocalizationFile file = PathManagerFactory.getPathManager()
.getLocalizationFile(siteCtx, SETTINGS_FILE);
BackupServiceConfig newConfig = null;
try {
if (file.exists()) {
if (jaxbManager == null) {
jaxbManager = new SingleTypeJAXBManager<>(true,
BackupServiceConfig.class);
}
try (InputStream is = file.openInputStream()) {
newConfig = jaxbManager.unmarshalFromInputStream(
BackupServiceConfig.class, is);
} catch (IOException e) {
logger.debug("Error on stream close", e);
}
} else {
// Load the default config
newConfig = new BackupServiceConfig();
}
} catch (JAXBException | SerializationException
| LocalizationException e) {
logger.error("Failed to load settings from " + file.getPath(), e);
logger.warn("Falling back to default config with no hosts");
newConfig = new BackupServiceConfig();
}
config = newConfig;
}
public List<BackupHost> getBackupHosts() {
return config.getHosts().stream()
.map((aBackupHost) -> new BackupHost(aBackupHost))
.collect(Collectors.toCollection(ArrayList::new));
}
public List<String> getHostnamesOnly() {
return config.getHosts().stream().map(BackupHost::getName)
.collect(Collectors.toCollection(ArrayList::new));
}
public int getPollIntervalSeconds() {
return config.getPollIntervalSeconds();
}
public int getBigJobSize() {
return config.getBigJobSize();
}
public int getRateLimitKBps() {
return config.getRateLimitKBps();
}
}

View file

@ -1,115 +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.uf.edex.backupsvc.service;
import java.util.EnumMap;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.common.util.SizeUtil;
import com.raytheon.uf.edex.backupsvc.database.BackupJob;
/**
* Collect and report statistics for BackupService. Thread-safe
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 25, 2017 6352 tgurney Initial creation, extracted from
* BackupService
* Oct 3, 2019 7929 tgurney Report stats for deferred jobs
*
* </pre>
*
* @author tgurney
*/
public class BackupServiceStatsReporter {
private final Logger logger = LoggerFactory.getLogger(getClass());
private Map<BackupService.JobStatus, Integer> processedJobs = new EnumMap<>(
BackupService.JobStatus.class);
private long bytesSent;
private long lastStatusReportTime;
private boolean ranSinceLastStatusReport;
public BackupServiceStatsReporter() {
resetStats();
}
private synchronized void resetStats() {
bytesSent = 0;
processedJobs.clear();
for (BackupService.JobStatus status : BackupService.JobStatus
.values()) {
processedJobs.put(status, 0);
}
lastStatusReportTime = System.currentTimeMillis();
}
public synchronized void logProcessedJob(BackupJob job,
BackupService.JobStatus status) {
bytesSent += job.getBlobSize();
int last = processedJobs.get(status);
processedJobs.put(status, last + 1);
}
public synchronized void logRun() {
ranSinceLastStatusReport = true;
}
public synchronized void reportStats() {
if (!ranSinceLastStatusReport) {
return;
}
BackupServiceConfigManager configMgr = BackupServiceConfigManager
.getInstance();
ranSinceLastStatusReport = false;
String rateLimitText = SizeUtil.prettyByteSize(
configMgr.getRateLimitKBps() * SizeUtil.BYTES_PER_KB);
long now = System.currentTimeMillis();
String timePeriod = TimeUtil.prettyDuration(now - lastStatusReportTime);
logger.info(String.format("Backup service activity for the last %s: ",
timePeriod));
int totalProcessedJobs = processedJobs.values().stream()
.mapToInt(Integer::intValue).sum();
for (BackupService.JobStatus status : BackupService.JobStatus
.values()) {
String msg = status + " jobs: " + processedJobs.get(status) + "/"
+ totalProcessedJobs;
logger.info(msg);
}
logger.info("Data sent: " + SizeUtil.prettyByteSize(bytesSent));
logger.info("Rate limit: " + rateLimitText + "/s");
logger.info("Backup hosts configured: "
+ configMgr.getBackupHosts().size());
resetStats();
}
}

View file

@ -1,54 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
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.
-->
<!--
This base file is not used. It only serves as a template for a site-level
file.
-->
<backupServiceConfig xmlns:ns2="group">
<!-- Hosts are in descending order of priority. Port is optional. -->
<!--
<hosts>
<host>
<name>edexcluster-oax</name>
<port>9581</port>
</host>
<host>
<name>edexcluster-dmx</name>
</host>
<host>
<name>edexcluster-gid</name>
</host>
</hosts>
-->
<!-- How often to check for new jobs -->
<!-- <pollIntervalSeconds>300</pollIntervalSeconds> -->
<!-- Limit sending of requests to this many kbytes per second on average -->
<!-- <rateLimitKBps>16</rateLimitKBps> -->
<!-- Log a warning before processing any job bigger than this (bytes) -->
<!-- <bigJobSize>5242880</bigJobSize> -->
</backupServiceConfig>

View file

@ -35,13 +35,6 @@
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.edex.backupsvc"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.common.dissemination"
download-size="0"
@ -70,13 +63,6 @@
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.common.backupsvc"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.common.sounding"
download-size="0"
@ -133,18 +119,4 @@
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.edex.localization.backup"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.common.localization.backup"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature>

View file

@ -213,12 +213,6 @@
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.common.plugin.hpe"
download-size="0"
install-size="0"
version="0.0.0"/>
<plugin
id="com.raytheon.uf.common.damagepath"
download-size="0"

View file

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

View file

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.raytheon.uf.edex.localization.backup</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

@ -1,10 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=11

View file

@ -1,18 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Localization Backup Plug-in
Bundle-SymbolicName: com.raytheon.uf.edex.localization.backup
Bundle-Version: 1.17.0.qualifier
Bundle-Vendor: RAYTHEON
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Require-Bundle: com.raytheon.uf.common.status,
com.raytheon.uf.common.serialization.comm,
org.apache.commons.io,
com.raytheon.uf.common.localization.backup,
com.raytheon.uf.common.localization,
com.raytheon.uf.common.backupsvc,
com.raytheon.uf.edex.core,
com.raytheon.uf.common.time,
org.slf4j,
com.raytheon.uf.common.util

View file

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

View file

@ -1,49 +0,0 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="localizationFileSaveHandler" class="com.raytheon.uf.edex.localization.backup.handlers.LocalizationFileSaveHandler" />
<bean factory-bean="handlerRegistry" factory-method="register">
<constructor-arg value="com.raytheon.uf.common.localization.backup.request.LocalizationFileSaveRequest"/>
<constructor-arg ref="localizationFileSaveHandler"/>
</bean>
<bean id="localizationFileDeleteHandler" class="com.raytheon.uf.edex.localization.backup.handlers.LocalizationFileDeleteHandler" />
<bean factory-bean="handlerRegistry" factory-method="register">
<constructor-arg value="com.raytheon.uf.common.localization.backup.request.LocalizationFileDeleteRequest"/>
<constructor-arg ref="localizationFileDeleteHandler"/>
</bean>
<bean id="localizationBackupService" class="com.raytheon.uf.edex.localization.backup.service.LocalizationBackupService" />
<camelContext id="clusteredLocalizationBackupContext"
xmlns="http://camel.apache.org/schema/spring"
errorHandlerRef="errorHandler">
<endpoint id="localizationBackupReloadCron"
uri="quartz://localizationBackupReloadScheduled/?cron=0+0/5+*+*+*+?)"/>
<route id="localizationBackupReloadScheduled">
<from uri="localizationBackupReloadCron" />
<doTry>
<bean ref="localizationBackupService" method="reloadConfig" />
<doCatch>
<exception>java.lang.Throwable</exception>
<to uri="log:localizationBackupService?level=ERROR"/>
</doCatch>
</doTry>
</route>
</camelContext>
<bean factory-bean="contextManager" factory-method="registerClusteredContext">
<constructor-arg ref="clusteredLocalizationBackupContext" />
</bean>
<bean factory-bean="contextManager" factory-method="registerContextStateProcessor">
<constructor-arg ref="clusteredLocalizationBackupContext"/>
<constructor-arg ref="localizationBackupService"/>
</bean>
</beans>

View file

@ -1,76 +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.uf.edex.localization.backup.handlers;
import com.raytheon.uf.common.localization.ILocalizationFile;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.backup.request.LocalizationFileDeleteRequest;
import com.raytheon.uf.common.localization.exception.LocalizationException;
import com.raytheon.uf.common.serialization.comm.IRequestHandler;
import com.raytheon.uf.common.serialization.comm.response.GenericResponse;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
/**
* Handler for LocalizationFileDeleteRequest
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 9, 2016 5937 tgurney Initial creation
*
* </pre>
*
* @author tgurney
*/
public class LocalizationFileDeleteHandler
implements IRequestHandler<LocalizationFileDeleteRequest> {
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(LocalizationFileDeleteHandler.class);
@Override
public GenericResponse handleRequest(LocalizationFileDeleteRequest request)
throws Exception {
IPathManager pathManager = PathManagerFactory.getPathManager();
ILocalizationFile file = pathManager
.getLocalizationFile(request.getContext(), request.getPath());
GenericResponse response = new GenericResponse();
try {
if (file != null) {
file.delete();
}
response.setSuccess(true);
} catch (LocalizationException e) {
String msg = "Failed to delete localization file " + file;
statusHandler.handle(Priority.PROBLEM, msg, e);
response.setSuccess(false);
response.setMessage(msg);
}
return response;
}
}

View file

@ -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.uf.edex.localization.backup.handlers;
import java.io.IOException;
import com.raytheon.uf.common.localization.ILocalizationFile;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.SaveableOutputStream;
import com.raytheon.uf.common.localization.backup.request.LocalizationFileSaveRequest;
import com.raytheon.uf.common.serialization.comm.IRequestHandler;
import com.raytheon.uf.common.serialization.comm.response.GenericResponse;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
/**
* Handler for LocalizationFileSaveRequest
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 9, 2016 5937 tgurney Initial creation
*
* </pre>
*
* @author tgurney
*/
public class LocalizationFileSaveHandler
implements IRequestHandler<LocalizationFileSaveRequest> {
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(LocalizationFileSaveHandler.class);
@Override
public GenericResponse handleRequest(LocalizationFileSaveRequest request)
throws Exception {
IPathManager pathManager = PathManagerFactory.getPathManager();
ILocalizationFile file = pathManager
.getLocalizationFile(request.getContext(), request.getPath());
GenericResponse response = new GenericResponse();
if (file == null) {
response.setSuccess(false);
response.setMessage(request.getContext() + IPathManager.SEPARATOR
+ request.getPath() + ": Localization file is null");
return response;
}
try (SaveableOutputStream outStream = file.openOutputStream()) {
try {
outStream.write(request.getBytes());
outStream.save();
response.setSuccess(true);
} catch (IOException e) {
String msg = "Failed to save localization file " + file;
statusHandler.handle(Priority.PROBLEM, msg, e);
response.setSuccess(false);
response.setMessage(msg);
}
}
return response;
}
}

View file

@ -1,136 +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.uf.edex.localization.backup.service;
import java.io.IOException;
import java.io.InputStream;
import java.util.Timer;
import com.raytheon.uf.common.localization.ILocalizationFile;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.exception.LocalizationException;
import com.raytheon.uf.common.localization.filter.LocalizationFileFilter;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.util.TimeUtil;
/**
* File filter for localization backup service. Uses one whitelist and one
* blacklist with optional site override. Automatically reloads filter lists
* when changed, and also at a fixed interval (CONFIG_RELOAD_INTERVAL_MS)
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 8, 2016 5937 tgurney Initial creation
*
* </pre>
*
* @author tgurney
*/
public class LocalizationBackupFileFilter {
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(LocalizationBackupFileFilter.class);
private static final String ACCEPT_LIST_PATH = "localizationBackup"
+ IPathManager.SEPARATOR + "localizationBackupList.txt";
private static final String REJECT_LIST_PATH = "localizationBackup"
+ IPathManager.SEPARATOR + "localizationBackupBlacklist.txt";
private static final LocalizationLevel[] SEARCH_LEVELS = new LocalizationLevel[] {
LocalizationLevel.BASE, LocalizationLevel.SITE };
private volatile LocalizationFileFilter filter;
private final Timer reloadTimer = new Timer();
private static final long CONFIG_RELOAD_INTERVAL_MS = 5
* TimeUtil.MILLIS_PER_MINUTE;
/**
* Constructor. Immediately loads all filter lists
*/
public LocalizationBackupFileFilter() {
filter = new LocalizationFileFilter();
reload();
PathManagerFactory.getPathManager()
.addLocalizationPathObserver(ACCEPT_LIST_PATH, (file) -> {
reload();
});
PathManagerFactory.getPathManager()
.addLocalizationPathObserver(REJECT_LIST_PATH, (file) -> {
reload();
});
}
private ILocalizationFile getFile(LocalizationLevel level, String path) {
IPathManager pathManager = PathManagerFactory.getPathManager();
LocalizationContext ctx = pathManager
.getContext(LocalizationType.COMMON_STATIC, level);
ILocalizationFile file = pathManager.getLocalizationFile(ctx, path);
return file;
}
/**
* Reload all filter lists. If any lists fail to load, fall back to an empty
* whitelist and an empty blacklist.
*/
public synchronized void reload() {
LocalizationFileFilter newFilter = new LocalizationFileFilter();
try {
for (LocalizationLevel level : SEARCH_LEVELS) {
ILocalizationFile acceptList = getFile(level, ACCEPT_LIST_PATH);
if (acceptList != null && acceptList.exists()) {
try (InputStream is = acceptList.openInputStream()) {
newFilter.addAcceptList(is);
}
}
ILocalizationFile rejectList = getFile(level, REJECT_LIST_PATH);
if (rejectList != null && rejectList.exists()) {
try (InputStream is = rejectList.openInputStream()) {
newFilter.addRejectList(is);
}
}
}
} catch (IOException | LocalizationException e) {
statusHandler.handle(Priority.PROBLEM, "Failed to load filter list",
e);
statusHandler.warn("Falling back to empty filter lists");
newFilter = new LocalizationFileFilter();
}
filter = newFilter;
}
public boolean accept(ILocalizationFile file) {
return filter.accept(file);
}
}

View file

@ -1,156 +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.uf.edex.localization.backup.service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.raytheon.uf.common.backupsvc.BackupHost;
import com.raytheon.uf.common.backupsvc.request.BackupEnqueueRequest;
import com.raytheon.uf.common.localization.ILocalizationFile;
import com.raytheon.uf.common.localization.ILocalizationPathObserver;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.backup.request.LocalizationFileDeleteRequest;
import com.raytheon.uf.common.localization.backup.request.LocalizationFileSaveRequest;
import com.raytheon.uf.common.serialization.comm.IServerRequest;
import com.raytheon.uf.common.serialization.comm.RequestRouter;
import com.raytheon.uf.edex.core.EDEXUtil;
import com.raytheon.uf.edex.core.IContextStateProcessor;
/**
* Service that listens for changes to localization files and pushes changed
* files to backup hosts.
*
* This is a clustered singleton service. It must only be instantiated from
* Spring and only in one place.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 9, 2016 5937 tgurney Initial creation
* Dec 20, 2016 5937 tgurney Fix reloadConfig() NPE
* Jul 20, 2017 6352 tgurney Specify required EDEX version on enqueue
* request
* Oct 3, 2019 7929 tgurney Set required version to be the sender's
* version at the time the job would be
* processed (not at the time the job
* is created).
*
* </pre>
*
* @author tgurney
*/
public class LocalizationBackupService implements IContextStateProcessor {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
private LocalizationBackupFileFilter filter;
private ILocalizationPathObserver pathObserver;
private IPathManager pathMgr = PathManagerFactory.getPathManager();
private boolean accept(ILocalizationFile file) {
LocalizationContext context = file.getContext();
if (context.getLocalizationLevel().equals(LocalizationLevel.BASE)) {
return false;
}
// Only accept SITE and CONFIGURED files if they are for our own site
if ((context.getLocalizationLevel().equals(LocalizationLevel.SITE)
|| context.getLocalizationLevel()
.equals(LocalizationLevel.CONFIGURED))
&& !context.getContextName().equals(EDEXUtil.getEdexSite())) {
return false;
}
if (!filter.accept(file)) {
return false;
}
return true;
}
private void process(ILocalizationFile file) {
if (accept(file)) {
try {
if (file.exists()) {
enqueue(new LocalizationFileSaveRequest(file), file);
} else {
enqueue(new LocalizationFileDeleteRequest(file), file);
}
} catch (Exception e) {
logger.warn("Failed to create backup service job for " + file,
e);
}
}
}
private void enqueue(IServerRequest request, ILocalizationFile file)
throws Exception {
BackupEnqueueRequest enqueueRequest = new BackupEnqueueRequest();
enqueueRequest.setJobName("LocalizationBackupService:" + file);
enqueueRequest.setPriority(0);
enqueueRequest.setRequest(request);
enqueueRequest.setMinVersionRequired(BackupHost.MY_VERSION);
enqueueRequest.setMaxVersionRequired(BackupHost.MY_VERSION);
RequestRouter.route(enqueueRequest);
}
/** Called from spring to reload at fixed interval */
public void reloadConfig() {
if (filter != null) {
filter.reload();
}
}
@Override
public void preStart() {
}
@Override
public void postStart() {
if (filter == null) {
filter = new LocalizationBackupFileFilter();
} else {
reloadConfig();
}
if (pathObserver == null) {
pathObserver = this::process;
}
pathMgr.addLocalizationPathObserver("", pathObserver);
}
@Override
public void preStop() {
if (pathObserver != null) {
pathMgr.removeLocalizationPathObserver(pathObserver);
}
}
@Override
public void postStop() {
}
}

View file

@ -1,23 +0,0 @@
# This file lists all localization paths that will NOT be sent to backup
# sites. This file overrides the whitelist in localizationBackupList.txt.
# That is, that file is checked first to determine which files are sent out,
# then this file determines which among those are NOT sent. The SITE version of
# this file adds to the BASE version, and all other levels are ignored.
#
# A line that starts with '#' is treated as a comment, and any other line is a
# localization level and path:
# localization_level:localization_type/subpath/to/file
#
# A simple example would be
# SITE:common_static/textdb/textCategoryClass.txt
#
# You can use * to match any level, type, or any part of a path. For example,
# to match all SITE afos2awips files:
# SITE:common_static/afos2awips/*
#
# BASE is hard-coded to never send to backup sites, but is included anyway
# for safety.
BASE:*
WORKSTATION:*
USER:*

View file

@ -1,18 +0,0 @@
# This file lists all localization paths that will be sent to backup sites
# when a file at any path changes. The SITE version of this file adds to the
# BASE version, and all other levels are ignored.
#
# A line that starts with '#' is treated as a comment, and any other line is a
# localization level and path:
# localization_level:localization_type/subpath/to/file
#
# A simple example would be
# SITE:common_static/textdb/textCategoryClass.txt
#
# You can use * to match any level, type, or any part of a path. For example,
# to match all SITE afos2awips files:
# SITE:common_static/afos2awips/*
#
# REGION:*
# SITE:*
# CONFIGURED:*

View file

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!--
This is an absolute override file, indicating that a higher priority
version of the file will completely replace a lower priority version
of the file.
-->
<bundle>
<displayList>
<displays xsi:type="mapRenderableDisplay"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<descriptor xsi:type="mapDescriptor">
<resource>
<loadProperties />
<resourceData xsi:type="nucapsSoundingMapResourceData">
<metadataMap>
<mapping key="pluginName">
<constraint constraintValue="nucaps"
constraintType="EQUALS" />
</mapping>
</metadataMap>
</resourceData>
</resource>
</descriptor>
</displays>
</displayList>
</bundle>

View file

@ -30,7 +30,7 @@
<descriptor xsi:type="mapDescriptor">
<resource>
<loadProperties />
<resourceData xsi:type="nucapsSoundingMapResourceData">
<resourceData xsi:type="nppSoundingMapResourceData">
<nsharpResourceData>${soundingResourceData}</nsharpResourceData>
<resourceName>${name;Unknown}</resourceName>
<metadataMap>

View file

@ -42,16 +42,17 @@
<mapping key="parameter">
<constraint constraintValue="0.7Ref" constraintType="EQUALS"/>
</mapping>
<mapping key="region">
<constraint constraintValue="${region}" constraintType="EQUALS"/>
</mapping>
<mapping key="pluginName">
<constraint constraintValue="viirs" constraintType="EQUALS"/>
</mapping>
<mapping key="region">
<constraint constraintValue="${region}" constraintType="EQUALS"/>
</mapping>
</metadataMap>
</resourceData>
</resource>
</descriptor>
</displays>
</displayList>
</bundle>
</bundle>

Some files were not shown because too many files have changed in this diff Show more