Merge branch '13.2.1_delivery' into development
Conflicts: cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java Former-commit-id: 60b2fd0496097fb1086207cbb01779dbfea877a0
This commit is contained in:
commit
ec56acde81
72 changed files with 1810 additions and 824 deletions
|
@ -85,7 +85,7 @@
|
||||||
</mapping>
|
</mapping>
|
||||||
<mapping key="primaryElevationAngle">
|
<mapping key="primaryElevationAngle">
|
||||||
<constraint constraintValue="${elevation1}"
|
<constraint constraintValue="${elevation1}"
|
||||||
constraintType="IN" />
|
constraintType="BETWEEN" />
|
||||||
</mapping>
|
</mapping>
|
||||||
</metadataMap>
|
</metadataMap>
|
||||||
</resourceData>
|
</resourceData>
|
||||||
|
@ -119,7 +119,7 @@
|
||||||
</mapping>
|
</mapping>
|
||||||
<mapping key="primaryElevationAngle">
|
<mapping key="primaryElevationAngle">
|
||||||
<constraint constraintValue="${elevation1}"
|
<constraint constraintValue="${elevation1}"
|
||||||
constraintType="IN" />
|
constraintType="BETWEEN" />
|
||||||
</mapping>
|
</mapping>
|
||||||
</metadataMap>
|
</metadataMap>
|
||||||
</resourceData>
|
</resourceData>
|
||||||
|
@ -173,7 +173,7 @@
|
||||||
</mapping>
|
</mapping>
|
||||||
<mapping key="primaryElevationAngle">
|
<mapping key="primaryElevationAngle">
|
||||||
<constraint constraintValue="${elevation2}"
|
<constraint constraintValue="${elevation2}"
|
||||||
constraintType="IN" />
|
constraintType="BETWEEN" />
|
||||||
</mapping>
|
</mapping>
|
||||||
</metadataMap>
|
</metadataMap>
|
||||||
</resourceData>
|
</resourceData>
|
||||||
|
@ -207,7 +207,7 @@
|
||||||
</mapping>
|
</mapping>
|
||||||
<mapping key="primaryElevationAngle">
|
<mapping key="primaryElevationAngle">
|
||||||
<constraint constraintValue="${elevation2}"
|
<constraint constraintValue="${elevation2}"
|
||||||
constraintType="IN" />
|
constraintType="BETWEEN" />
|
||||||
</mapping>
|
</mapping>
|
||||||
</metadataMap>
|
</metadataMap>
|
||||||
</resourceData>
|
</resourceData>
|
||||||
|
@ -256,7 +256,7 @@
|
||||||
</mapping>
|
</mapping>
|
||||||
<mapping key="primaryElevationAngle">
|
<mapping key="primaryElevationAngle">
|
||||||
<constraint constraintValue="${elevation4}"
|
<constraint constraintValue="${elevation4}"
|
||||||
constraintType="IN" />
|
constraintType="BETWEEN" />
|
||||||
</mapping>
|
</mapping>
|
||||||
</metadataMap>
|
</metadataMap>
|
||||||
</resourceData>
|
</resourceData>
|
||||||
|
@ -290,7 +290,7 @@
|
||||||
</mapping>
|
</mapping>
|
||||||
<mapping key="primaryElevationAngle">
|
<mapping key="primaryElevationAngle">
|
||||||
<constraint constraintValue="${elevation4}"
|
<constraint constraintValue="${elevation4}"
|
||||||
constraintType="IN" />
|
constraintType="BETWEEN" />
|
||||||
</mapping>
|
</mapping>
|
||||||
</metadataMap>
|
</metadataMap>
|
||||||
</resourceData>
|
</resourceData>
|
||||||
|
@ -344,7 +344,7 @@
|
||||||
</mapping>
|
</mapping>
|
||||||
<mapping key="primaryElevationAngle">
|
<mapping key="primaryElevationAngle">
|
||||||
<constraint constraintValue="${elevation3}"
|
<constraint constraintValue="${elevation3}"
|
||||||
constraintType="IN" />
|
constraintType="BETWEEN" />
|
||||||
</mapping>
|
</mapping>
|
||||||
</metadataMap>
|
</metadataMap>
|
||||||
</resourceData>
|
</resourceData>
|
||||||
|
@ -378,7 +378,7 @@
|
||||||
</mapping>
|
</mapping>
|
||||||
<mapping key="primaryElevationAngle">
|
<mapping key="primaryElevationAngle">
|
||||||
<constraint constraintValue="${elevation3}"
|
<constraint constraintValue="${elevation3}"
|
||||||
constraintType="IN" />
|
constraintType="BETWEEN" />
|
||||||
</mapping>
|
</mapping>
|
||||||
</metadataMap>
|
</metadataMap>
|
||||||
</resourceData>
|
</resourceData>
|
||||||
|
|
|
@ -110,7 +110,7 @@
|
||||||
<substitute key="stationId" value="72233"/>
|
<substitute key="stationId" value="72233"/>
|
||||||
</contribute>
|
</contribute>
|
||||||
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
|
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
|
||||||
menuText="Wash-Dulles, VA (KLWX)" id="raobWash-Dulles"
|
menuText="Wash-Dulles, VA (KIAD)" id="raobWash-Dulles"
|
||||||
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
|
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
|
||||||
<substitute key="stationId" value="72403"/>
|
<substitute key="stationId" value="72403"/>
|
||||||
</contribute>
|
</contribute>
|
||||||
|
|
|
@ -91,6 +91,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
|
||||||
* Nov 6, 2012 1269 lvenable Initial creation.
|
* Nov 6, 2012 1269 lvenable Initial creation.
|
||||||
* Dec 13, 2012 1269 lvenable Fixes and updates.
|
* Dec 13, 2012 1269 lvenable Fixes and updates.
|
||||||
* Jan 07, 2013 1451 djohnson Use TimeUtil.newGmtCalendar().
|
* Jan 07, 2013 1451 djohnson Use TimeUtil.newGmtCalendar().
|
||||||
|
* Jan 28, 2013 1529 djohnson Disable menu items if no subscriptions selected.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -886,6 +887,7 @@ public class BandwidthCanvasComp extends Composite implements IDialogClosed,
|
||||||
|
|
||||||
MenuItem viewSubs = new MenuItem(m, SWT.NONE);
|
MenuItem viewSubs = new MenuItem(m, SWT.NONE);
|
||||||
viewSubs.setText("View Selected Subscriptions...");
|
viewSubs.setText("View Selected Subscriptions...");
|
||||||
|
viewSubs.setEnabled(imageMgr.hasSubscriptionNameChecked());
|
||||||
viewSubs.addListener(SWT.Selection, new Listener() {
|
viewSubs.addListener(SWT.Selection, new Listener() {
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(Event event) {
|
public void handleEvent(Event event) {
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
package com.raytheon.uf.viz.datadelivery.bandwidth.ui;
|
package com.raytheon.uf.viz.datadelivery.bandwidth.ui;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.EnumMap;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -30,7 +31,7 @@ import org.eclipse.swt.graphics.Rectangle;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
|
||||||
import com.raytheon.uf.common.datadelivery.bandwidth.data.BandwidthGraphData;
|
import com.raytheon.uf.common.datadelivery.bandwidth.data.BandwidthGraphData;
|
||||||
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryGUIUtils.SubscriptionPriority;
|
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bandwidth utilization graph image manager.
|
* Bandwidth utilization graph image manager.
|
||||||
|
@ -42,7 +43,9 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryGUIUtils.SubscriptionP
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Nov 28, 2012 1269 lvenable Initial creation
|
* Nov 28, 2012 1269 lvenable Initial creation
|
||||||
* Dec 13, 2012 1269 lvenable Fixes and updates.
|
* Dec 13, 2012 1269 lvenable Fixes and updates.
|
||||||
|
* Jan 25, 2013 1528 djohnson Subscription priority is now an enum on subscriptions.
|
||||||
|
* Jan 28, 2013 1529 djohnson Add hasSubscriptionNameChecked().
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -137,10 +140,11 @@ public class BandwidthImageMgr implements IGraphOptions {
|
||||||
private void init(Composite parentComp, BandwidthGraphData graphData,
|
private void init(Composite parentComp, BandwidthGraphData graphData,
|
||||||
Map<CanvasImages, CanvasSettings> canvasSettingsMap) {
|
Map<CanvasImages, CanvasSettings> canvasSettingsMap) {
|
||||||
|
|
||||||
priorityColorMap = new HashMap<SubscriptionPriority, RGB>();
|
priorityColorMap = new EnumMap<SubscriptionPriority, RGB>(
|
||||||
for (SubscriptionPriority priority : SubscriptionPriority.values()) {
|
SubscriptionPriority.class);
|
||||||
priorityColorMap.put(priority, priority.getColor());
|
priorityColorMap.put(SubscriptionPriority.LOW, new RGB(6, 122, 255));
|
||||||
}
|
priorityColorMap.put(SubscriptionPriority.NORMAL, new RGB(0, 255, 0));
|
||||||
|
priorityColorMap.put(SubscriptionPriority.HIGH, new RGB(255, 0, 0));
|
||||||
|
|
||||||
canvasImgMap = new HashMap<BandwidthImageMgr.CanvasImages, AbstractCanvasImage>();
|
canvasImgMap = new HashMap<BandwidthImageMgr.CanvasImages, AbstractCanvasImage>();
|
||||||
populateCanvasMap(parentComp, graphData, canvasSettingsMap);
|
populateCanvasMap(parentComp, graphData, canvasSettingsMap);
|
||||||
|
@ -488,4 +492,13 @@ public class BandwidthImageMgr implements IGraphOptions {
|
||||||
regenerateImage(CanvasImages.X_HEADER);
|
regenerateImage(CanvasImages.X_HEADER);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
|
* Check whether there is a checked subscription name.
|
||||||
|
*
|
||||||
|
* @return true if at least one subscription name is checked
|
||||||
|
*/
|
||||||
|
public boolean hasSubscriptionNameChecked() {
|
||||||
|
return checkMap.containsValue(Boolean.TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -34,9 +34,9 @@ import org.eclipse.swt.widgets.Composite;
|
||||||
|
|
||||||
import com.raytheon.uf.common.datadelivery.bandwidth.data.BandwidthGraphData;
|
import com.raytheon.uf.common.datadelivery.bandwidth.data.BandwidthGraphData;
|
||||||
import com.raytheon.uf.common.datadelivery.bandwidth.data.TimeWindowData;
|
import com.raytheon.uf.common.datadelivery.bandwidth.data.TimeWindowData;
|
||||||
|
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
|
||||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||||
import com.raytheon.uf.viz.datadelivery.bandwidth.ui.BandwidthImageMgr.SortBy;
|
import com.raytheon.uf.viz.datadelivery.bandwidth.ui.BandwidthImageMgr.SortBy;
|
||||||
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryGUIUtils.SubscriptionPriority;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The graph image class.
|
* The graph image class.
|
||||||
|
@ -51,6 +51,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryGUIUtils.SubscriptionP
|
||||||
* Dec 13, 2012 1269 lvenable Fixes and updates.
|
* Dec 13, 2012 1269 lvenable Fixes and updates.
|
||||||
* Jan 07, 2013 1451 djohnson Use TimeUtil.newGmtCalendar().
|
* Jan 07, 2013 1451 djohnson Use TimeUtil.newGmtCalendar().
|
||||||
* Jan 04, 2013 1420 mpduff Change default priority to normal priority.
|
* Jan 04, 2013 1420 mpduff Change default priority to normal priority.
|
||||||
|
* Jan 25, 2013 1528 djohnson Subscription priority is now an enum, remove incorrect use of ordinal values.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -171,20 +172,17 @@ public class GraphImage extends AbstractCanvasImage {
|
||||||
|
|
||||||
for (String subName : subscriptionList) {
|
for (String subName : subscriptionList) {
|
||||||
if (imageMgr.isColorByPriority()) {
|
if (imageMgr.isColorByPriority()) {
|
||||||
if (graphData.getPriority(subName) == SubscriptionPriority.NORMAL
|
if (graphData.getPriority(subName) == SubscriptionPriority.NORMAL) {
|
||||||
.ordinal()) {
|
|
||||||
c = new Color(
|
c = new Color(
|
||||||
display,
|
display,
|
||||||
imageMgr.getPriorityColor(SubscriptionPriority.NORMAL));
|
imageMgr.getPriorityColor(SubscriptionPriority.NORMAL));
|
||||||
gc.setBackground(c);
|
gc.setBackground(c);
|
||||||
} else if (graphData.getPriority(subName) == SubscriptionPriority.HIGH
|
} else if (graphData.getPriority(subName) == SubscriptionPriority.HIGH) {
|
||||||
.ordinal()) {
|
|
||||||
c = new Color(
|
c = new Color(
|
||||||
display,
|
display,
|
||||||
imageMgr.getPriorityColor(SubscriptionPriority.HIGH));
|
imageMgr.getPriorityColor(SubscriptionPriority.HIGH));
|
||||||
gc.setBackground(c);
|
gc.setBackground(c);
|
||||||
} else if (graphData.getPriority(subName) == SubscriptionPriority.LOW
|
} else if (graphData.getPriority(subName) == SubscriptionPriority.LOW) {
|
||||||
.ordinal()) {
|
|
||||||
c = new Color(display,
|
c = new Color(display,
|
||||||
imageMgr.getPriorityColor(SubscriptionPriority.LOW));
|
imageMgr.getPriorityColor(SubscriptionPriority.LOW));
|
||||||
gc.setBackground(c);
|
gc.setBackground(c);
|
||||||
|
|
|
@ -21,7 +21,7 @@ package com.raytheon.uf.viz.datadelivery.bandwidth.ui;
|
||||||
|
|
||||||
import org.eclipse.swt.graphics.RGB;
|
import org.eclipse.swt.graphics.RGB;
|
||||||
|
|
||||||
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryGUIUtils.SubscriptionPriority;
|
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Add Description
|
* TODO Add Description
|
||||||
|
|
|
@ -32,7 +32,7 @@ import org.eclipse.swt.widgets.ColorDialog;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
|
||||||
import com.raytheon.uf.common.datadelivery.bandwidth.data.BandwidthGraphData;
|
import com.raytheon.uf.common.datadelivery.bandwidth.data.BandwidthGraphData;
|
||||||
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryGUIUtils.SubscriptionPriority;
|
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Header image for X axis.
|
* Header image for X axis.
|
||||||
|
@ -45,6 +45,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryGUIUtils.SubscriptionP
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Nov 28, 2012 1269 lvenable Initial creation.
|
* Nov 28, 2012 1269 lvenable Initial creation.
|
||||||
* Dec 13, 2012 1269 lvenable Fixes and updates.
|
* Dec 13, 2012 1269 lvenable Fixes and updates.
|
||||||
|
* Jan 25, 2013 1528 djohnson Subscription priority is now an enum.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -75,7 +76,7 @@ public class XHeaderImage extends AbstractCanvasImage {
|
||||||
private final String sortBy = "Sort by: ";
|
private final String sortBy = "Sort by: ";
|
||||||
|
|
||||||
/** Map of rectangles and subscription priorities. */
|
/** Map of rectangles and subscription priorities. */
|
||||||
private Map<Rectangle, SubscriptionPriority> rectPriMap;
|
private final Map<Rectangle, SubscriptionPriority> rectPriMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
package com.raytheon.uf.viz.datadelivery.common.ui;
|
package com.raytheon.uf.viz.datadelivery.common.ui;
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.widgets.Combo;
|
import org.eclipse.swt.widgets.Combo;
|
||||||
|
@ -28,7 +30,7 @@ import org.eclipse.swt.widgets.Group;
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryGUIUtils.SubscriptionPriority;
|
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the priority group information composite. This class is intended to
|
* This is the priority group information composite. This class is intended to
|
||||||
|
@ -43,6 +45,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryGUIUtils.SubscriptionP
|
||||||
* Jun 27, 2012 702 jpiatt Initial creation.
|
* Jun 27, 2012 702 jpiatt Initial creation.
|
||||||
* Aug 21, 2012 712 mpduff Default to Default, and allow for setting the combo box.
|
* Aug 21, 2012 712 mpduff Default to Default, and allow for setting the combo box.
|
||||||
* Jan 04, 2013 1420 mpduff Add latency.
|
* Jan 04, 2013 1420 mpduff Add latency.
|
||||||
|
* Jan 25, 2013 1528 djohnson Use priority enum instead of raw integers.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -60,7 +63,7 @@ public class PriorityComp extends Composite {
|
||||||
private final int latency;
|
private final int latency;
|
||||||
|
|
||||||
/** The priority value */
|
/** The priority value */
|
||||||
private final int priority;
|
private SubscriptionPriority priority;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
@ -70,10 +73,11 @@ public class PriorityComp extends Composite {
|
||||||
* @param latency
|
* @param latency
|
||||||
* @param priority
|
* @param priority
|
||||||
*/
|
*/
|
||||||
public PriorityComp(Composite parent, int latency, int priority) {
|
public PriorityComp(Composite parent, int latency,
|
||||||
|
SubscriptionPriority priority) {
|
||||||
super(parent, SWT.NONE);
|
super(parent, SWT.NONE);
|
||||||
this.latency = latency;
|
this.latency = latency;
|
||||||
this.priority = priority - 1;
|
this.priority = priority;
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,9 +131,16 @@ public class PriorityComp extends Composite {
|
||||||
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||||
priorityCombo = new Combo(priorityComp, SWT.READ_ONLY);
|
priorityCombo = new Combo(priorityComp, SWT.READ_ONLY);
|
||||||
priorityCombo.setItems(priorities);
|
priorityCombo.setItems(priorities);
|
||||||
priorityCombo.select(this.priority);
|
|
||||||
priorityCombo.setLayoutData(gd);
|
priorityCombo.setLayoutData(gd);
|
||||||
priorityCombo.setToolTipText("Select a priority");
|
priorityCombo.setToolTipText("Select a priority");
|
||||||
|
priorityCombo.addSelectionListener(new SelectionAdapter() {
|
||||||
|
@Override
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
priority = SubscriptionPriority.fromPriorityName(priorityCombo
|
||||||
|
.getItem(priorityCombo.getSelectionIndex()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
setPriority(priority);
|
||||||
|
|
||||||
Composite latencyComp = new Composite(subPriorityGroup, SWT.NONE);
|
Composite latencyComp = new Composite(subPriorityGroup, SWT.NONE);
|
||||||
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||||
|
@ -153,8 +164,8 @@ public class PriorityComp extends Composite {
|
||||||
*
|
*
|
||||||
* @return priority
|
* @return priority
|
||||||
*/
|
*/
|
||||||
public int getPriorityIndex() {
|
public SubscriptionPriority getPriority() {
|
||||||
return priorityCombo.getSelectionIndex();
|
return priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -162,10 +173,9 @@ public class PriorityComp extends Composite {
|
||||||
*
|
*
|
||||||
* @param index
|
* @param index
|
||||||
*/
|
*/
|
||||||
public void setPriorityIndex(int index) {
|
public void setPriority(SubscriptionPriority priority) {
|
||||||
if (index <= priorityCombo.getItemCount()) {
|
priorityCombo.select(priorityCombo.indexOf(priority.getPriorityName()));
|
||||||
priorityCombo.select(index);
|
this.priority = priority;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -39,6 +39,7 @@ import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||||
|
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.ebxml.DataSetQuery;
|
import com.raytheon.uf.common.datadelivery.registry.ebxml.DataSetQuery;
|
||||||
import com.raytheon.uf.viz.datadelivery.common.ui.ActivePeriodComp;
|
import com.raytheon.uf.viz.datadelivery.common.ui.ActivePeriodComp;
|
||||||
import com.raytheon.uf.viz.datadelivery.common.ui.DeliveryOptionsComp;
|
import com.raytheon.uf.viz.datadelivery.common.ui.DeliveryOptionsComp;
|
||||||
|
@ -79,6 +80,7 @@ import com.raytheon.viz.ui.presenter.components.ComboBoxConf;
|
||||||
* Dec 13, 2012 1391 bgonzale Added cancel/ok selection status.
|
* Dec 13, 2012 1391 bgonzale Added cancel/ok selection status.
|
||||||
* Jan 02, 2013 1441 djohnson Add isGroupSelected().
|
* Jan 02, 2013 1441 djohnson Add isGroupSelected().
|
||||||
* Jan 04, 2013 1420 mpduff Add latency.
|
* Jan 04, 2013 1420 mpduff Add latency.
|
||||||
|
* Jan 25, 2013 1528 djohnson Use priority enum instead of raw integers.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -195,7 +197,8 @@ public class CreateSubscriptionDlg extends CaveSWTDialog implements
|
||||||
// Get latency value
|
// Get latency value
|
||||||
SystemRuleManager ruleManager = SystemRuleManager.getInstance();
|
SystemRuleManager ruleManager = SystemRuleManager.getInstance();
|
||||||
int latency = ruleManager.getLatency(this.subscription, cycleTimes);
|
int latency = ruleManager.getLatency(this.subscription, cycleTimes);
|
||||||
int priority = ruleManager.getPriority(this.subscription, cycleTimes);
|
SubscriptionPriority priority = ruleManager.getPriority(
|
||||||
|
this.subscription, cycleTimes);
|
||||||
priorityComp = new PriorityComp(mainComp, latency, priority);
|
priorityComp = new PriorityComp(mainComp, latency, priority);
|
||||||
|
|
||||||
this.createCycleGroup();
|
this.createCycleGroup();
|
||||||
|
@ -517,16 +520,16 @@ public class CreateSubscriptionDlg extends CaveSWTDialog implements
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int getPriority() {
|
public SubscriptionPriority getPriority() {
|
||||||
return priorityComp.getPriorityIndex();
|
return priorityComp.getPriority();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setPriority(int i) {
|
public void setPriority(SubscriptionPriority priority) {
|
||||||
priorityComp.setPriorityIndex(i);
|
priorityComp.setPriority(priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -842,14 +845,6 @@ public class CreateSubscriptionDlg extends CaveSWTDialog implements
|
||||||
this.subscription = subscription;
|
this.subscription = subscription;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int getPriorityValue() {
|
|
||||||
return priorityComp.getPriorityIndex();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -46,6 +46,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
|
||||||
* Aug 10, 2012 1002 mpduff Change dataset size from int to long.
|
* Aug 10, 2012 1002 mpduff Change dataset size from int to long.
|
||||||
* Aug 21, 2012 712 mpduff Make priorities display as 1, 2, 3.
|
* Aug 21, 2012 712 mpduff Make priorities display as 1, 2, 3.
|
||||||
* Oct 2, 2012 1103 jpiatt Remove unused methods, update enum, code clean up.
|
* Oct 2, 2012 1103 jpiatt Remove unused methods, update enum, code clean up.
|
||||||
|
* Jan 25, 2012 1528 djohnson Priorities no longer need incrementing for display.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author mpduff
|
* @author mpduff
|
||||||
|
@ -67,7 +68,7 @@ public class SubscriptionManagerRowData implements ITableData<SubscriptionManage
|
||||||
private boolean active = false;
|
private boolean active = false;
|
||||||
|
|
||||||
/** Subscription priority of fulfillment. */
|
/** Subscription priority of fulfillment. */
|
||||||
private int priority = 2;
|
private int priority;
|
||||||
|
|
||||||
/** Subscription description. */
|
/** Subscription description. */
|
||||||
private String description = null;
|
private String description = null;
|
||||||
|
@ -493,7 +494,7 @@ public class SubscriptionManagerRowData implements ITableData<SubscriptionManage
|
||||||
|
|
||||||
this.setName(subscription.getName());
|
this.setName(subscription.getName());
|
||||||
this.setOwner(subscription.getOwner());
|
this.setOwner(subscription.getOwner());
|
||||||
this.setPriority(subscription.getPriority() + 1);
|
this.setPriority(subscription.getPriority().getPriorityValue());
|
||||||
this.setSubscriptionStart(subscription.getSubscriptionStart());
|
this.setSubscriptionStart(subscription.getSubscriptionStart());
|
||||||
this.setSubscriptionEnd(subscription.getSubscriptionEnd());
|
this.setSubscriptionEnd(subscription.getSubscriptionEnd());
|
||||||
this.setActive(subscription.isActive());
|
this.setActive(subscription.isActive());
|
||||||
|
|
|
@ -71,6 +71,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
|
||||||
* Dec 18, 2012 1443 bgonzale Open force apply prompt pop-up on the UI thread.
|
* Dec 18, 2012 1443 bgonzale Open force apply prompt pop-up on the UI thread.
|
||||||
* Dec 20, 2012 1413 bgonzale Added new pending approve and denied request and responses.
|
* Dec 20, 2012 1413 bgonzale Added new pending approve and denied request and responses.
|
||||||
* Jan 04, 2013 1441 djohnson Separated out notification methods into their own service.
|
* Jan 04, 2013 1441 djohnson Separated out notification methods into their own service.
|
||||||
|
* Jan 28, 2013 1530 djohnson Reset unscheduled flag with each update.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -358,6 +359,7 @@ public class SubscriptionService implements ISubscriptionService {
|
||||||
final ServiceInteraction action = new ServiceInteraction() {
|
final ServiceInteraction action = new ServiceInteraction() {
|
||||||
@Override
|
@Override
|
||||||
public String call() throws RegistryHandlerException {
|
public String call() throws RegistryHandlerException {
|
||||||
|
subscription.setUnscheduled(false);
|
||||||
DataDeliveryHandlers.getSubscriptionHandler().update(
|
DataDeliveryHandlers.getSubscriptionHandler().update(
|
||||||
subscription);
|
subscription);
|
||||||
return successMessage;
|
return successMessage;
|
||||||
|
@ -380,6 +382,7 @@ public class SubscriptionService implements ISubscriptionService {
|
||||||
@Override
|
@Override
|
||||||
public String call() throws RegistryHandlerException {
|
public String call() throws RegistryHandlerException {
|
||||||
for (Subscription sub : subs) {
|
for (Subscription sub : subs) {
|
||||||
|
sub.setUnscheduled(false);
|
||||||
DataDeliveryHandlers.getSubscriptionHandler().update(sub);
|
DataDeliveryHandlers.getSubscriptionHandler().update(sub);
|
||||||
}
|
}
|
||||||
return successMessage;
|
return successMessage;
|
||||||
|
@ -439,6 +442,7 @@ public class SubscriptionService implements ISubscriptionService {
|
||||||
subscription).isAuthorized();
|
subscription).isAuthorized();
|
||||||
try {
|
try {
|
||||||
if (authorized) {
|
if (authorized) {
|
||||||
|
subscription.setUnscheduled(false);
|
||||||
DataDeliveryHandlers.getSubscriptionHandler()
|
DataDeliveryHandlers.getSubscriptionHandler()
|
||||||
.update(subscription);
|
.update(subscription);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -100,6 +100,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
|
||||||
* Dec 03, 2012 1279 mpduff Add ability to populate from a list of subscription names.
|
* Dec 03, 2012 1279 mpduff Add ability to populate from a list of subscription names.
|
||||||
* Dec 12, 2012 1391 bgonzale Added a job for subscription retrieves.
|
* Dec 12, 2012 1391 bgonzale Added a job for subscription retrieves.
|
||||||
* Jan 07, 2013 1437 bgonzale Added sort column direction updates.
|
* Jan 07, 2013 1437 bgonzale Added sort column direction updates.
|
||||||
|
* Jan 28, 2013 1529 djohnson Disable menu items if no subscriptions are selected.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -120,7 +121,7 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
|
||||||
* Subscription action callback that is called when there is a table
|
* Subscription action callback that is called when there is a table
|
||||||
* selection.
|
* selection.
|
||||||
*/
|
*/
|
||||||
private ISubscriptionAction subActionCallback;
|
private final ISubscriptionAction subActionCallback;
|
||||||
|
|
||||||
/** TableDataManager object. */
|
/** TableDataManager object. */
|
||||||
private TableDataManager<SubscriptionManagerRowData> subManagerData;
|
private TableDataManager<SubscriptionManagerRowData> subManagerData;
|
||||||
|
@ -756,11 +757,14 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
|
||||||
popupMenu.dispose();
|
popupMenu.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final boolean menuItemsEnabled = table.getSelectionIndices().length > 0;
|
||||||
|
|
||||||
// Detail popup menu
|
// Detail popup menu
|
||||||
popupMenu = new Menu(table);
|
popupMenu = new Menu(table);
|
||||||
MenuItem item1 = new MenuItem(popupMenu, SWT.PUSH);
|
MenuItem detailsItem = new MenuItem(popupMenu, SWT.PUSH);
|
||||||
item1.setText("Details... ");
|
detailsItem.setText("Details... ");
|
||||||
item1.addSelectionListener(new SelectionAdapter() {
|
detailsItem.setEnabled(menuItemsEnabled);
|
||||||
|
detailsItem.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
handleDetails();
|
handleDetails();
|
||||||
|
@ -770,6 +774,7 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
|
||||||
if (subType == SubscriptionType.MANAGER) {
|
if (subType == SubscriptionType.MANAGER) {
|
||||||
MenuItem editItem = new MenuItem(popupMenu, SWT.PUSH);
|
MenuItem editItem = new MenuItem(popupMenu, SWT.PUSH);
|
||||||
editItem.setText("Edit...");
|
editItem.setText("Edit...");
|
||||||
|
editItem.setEnabled(menuItemsEnabled);
|
||||||
editItem.addSelectionListener(new SelectionAdapter() {
|
editItem.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
@ -780,6 +785,7 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
|
||||||
// Add the selected row to a subscription group
|
// Add the selected row to a subscription group
|
||||||
MenuItem groupItem = new MenuItem(popupMenu, SWT.PUSH);
|
MenuItem groupItem = new MenuItem(popupMenu, SWT.PUSH);
|
||||||
groupItem.setText("Add to Group...");
|
groupItem.setText("Add to Group...");
|
||||||
|
groupItem.setEnabled(menuItemsEnabled);
|
||||||
groupItem.addSelectionListener(new SelectionAdapter() {
|
groupItem.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
|
|
@ -52,6 +52,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
||||||
* Jul 25, 2012 955 djohnson Use List instead of ArrayList.
|
* Jul 25, 2012 955 djohnson Use List instead of ArrayList.
|
||||||
* Sep 24, 2012 1157 mpduff Use InitialPendingSubsription.
|
* Sep 24, 2012 1157 mpduff Use InitialPendingSubsription.
|
||||||
* Dec 10, 2012 1259 bsteffen Switch Data Delivery from LatLon to referenced envelopes.
|
* Dec 10, 2012 1259 bsteffen Switch Data Delivery from LatLon to referenced envelopes.
|
||||||
|
* Jan 25, 2013 1528 djohnson Compare priorities as primitive ints.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -115,7 +116,7 @@ public class SubscriptionDiff {
|
||||||
|
|
||||||
getMap();
|
getMap();
|
||||||
|
|
||||||
if (!(sub.getPriority().equals(pendingSub.getPriority()))) {
|
if (sub.getPriority() != pendingSub.getPriority()) {
|
||||||
diffMap.put("priority", true);
|
diffMap.put("priority", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@ import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSet;
|
import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSet;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.PendingSubscription;
|
import com.raytheon.uf.common.datadelivery.registry.PendingSubscription;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||||
|
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.Utils.SubscriptionStatus;
|
import com.raytheon.uf.common.datadelivery.registry.Utils.SubscriptionStatus;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.handlers.IPendingSubscriptionHandler;
|
import com.raytheon.uf.common.datadelivery.registry.handlers.IPendingSubscriptionHandler;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler;
|
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler;
|
||||||
|
@ -102,6 +103,7 @@ import com.raytheon.viz.ui.presenter.components.WidgetConf;
|
||||||
* Jan 11, 2013 1453 djohnson Sets cycle times on construction.
|
* Jan 11, 2013 1453 djohnson Sets cycle times on construction.
|
||||||
* Jan 14, 2013 1286 djohnson Check that message to display is not null or empty, and
|
* Jan 14, 2013 1286 djohnson Check that message to display is not null or empty, and
|
||||||
* only send notification of subscription creation on OK status.
|
* only send notification of subscription creation on OK status.
|
||||||
|
* Jan 25, 2013 1528 djohnson Use priority enum instead of raw integers, default to existing priority on edit.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author mpduff
|
* @author mpduff
|
||||||
|
@ -373,6 +375,10 @@ public class CreateSubscriptionDlgPresenter {
|
||||||
view.setActiveEndDateBtnEnabled(false);
|
view.setActiveEndDateBtnEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!create) {
|
||||||
|
view.setPriority(subscription.getPriority());
|
||||||
|
}
|
||||||
|
|
||||||
List<Integer> cycleTimes = subscription.getTime().getCycleTimes();
|
List<Integer> cycleTimes = subscription.getTime().getCycleTimes();
|
||||||
if (cycleTimes != null) {
|
if (cycleTimes != null) {
|
||||||
List<String> cycleStrings = new ArrayList<String>();
|
List<String> cycleStrings = new ArrayList<String>();
|
||||||
|
@ -504,8 +510,8 @@ public class CreateSubscriptionDlgPresenter {
|
||||||
}
|
}
|
||||||
|
|
||||||
// priority
|
// priority
|
||||||
int priorityInd = view.getPriority();
|
SubscriptionPriority priority = view.getPriority();
|
||||||
subscription.setPriority(priorityInd);
|
subscription.setPriority(priority);
|
||||||
|
|
||||||
subscription.setOfficeID(LocalizationManager.getInstance()
|
subscription.setOfficeID(LocalizationManager.getInstance()
|
||||||
.getCurrentSite());
|
.getCurrentSite());
|
||||||
|
|
|
@ -84,6 +84,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
|
||||||
* Jan 04, 2013 1299 djohnson Add logging of invalid forecast hour information if it occurs again.
|
* Jan 04, 2013 1299 djohnson Add logging of invalid forecast hour information if it occurs again.
|
||||||
* Jan 04, 2013 1420 mpduff Pass cycles in for rules.
|
* Jan 04, 2013 1420 mpduff Pass cycles in for rules.
|
||||||
* Jan 18, 2013 1414 bsteffen Add ensemble tab.
|
* Jan 18, 2013 1414 bsteffen Add ensemble tab.
|
||||||
|
* Jan 28, 2013 1533 djohnson Update the calculated dataset size after loading subset xml.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -200,6 +201,7 @@ public class GriddedSubsetManagerDlg
|
||||||
if (ensembleTab != null) {
|
if (ensembleTab != null) {
|
||||||
ensembleTab.loadFromSubsetXML(subsetXml);
|
ensembleTab.loadFromSubsetXML(subsetXml);
|
||||||
}
|
}
|
||||||
|
updateDataSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -33,6 +33,7 @@ import org.eclipse.swt.widgets.List;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||||
|
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
|
||||||
import com.raytheon.uf.viz.datadelivery.common.ui.PriorityComp;
|
import com.raytheon.uf.viz.datadelivery.common.ui.PriorityComp;
|
||||||
import com.raytheon.uf.viz.datadelivery.subscription.subset.presenter.IGriddedTimingSelectionDlgView;
|
import com.raytheon.uf.viz.datadelivery.subscription.subset.presenter.IGriddedTimingSelectionDlgView;
|
||||||
import com.raytheon.uf.viz.datadelivery.system.SystemRuleManager;
|
import com.raytheon.uf.viz.datadelivery.system.SystemRuleManager;
|
||||||
|
@ -55,6 +56,7 @@ import com.raytheon.viz.ui.presenter.components.ListConf;
|
||||||
* Oct 11, 2012 1263 jpiatt Modified for cancel button
|
* Oct 11, 2012 1263 jpiatt Modified for cancel button
|
||||||
* Nov 20, 2012 1286 djohnson Implement displayYesNoPopup.
|
* Nov 20, 2012 1286 djohnson Implement displayYesNoPopup.
|
||||||
* Jan 04, 2013 1420 mpduff Add Priority Composite.
|
* Jan 04, 2013 1420 mpduff Add Priority Composite.
|
||||||
|
* Jan 25, 2013 1528 djohnson Subscription priority is now an enum.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -137,7 +139,8 @@ public class GriddedTimingSelectionDlg extends CaveSWTDialog implements
|
||||||
// Get latency value
|
// Get latency value
|
||||||
SystemRuleManager ruleManager = SystemRuleManager.getInstance();
|
SystemRuleManager ruleManager = SystemRuleManager.getInstance();
|
||||||
int latency = ruleManager.getLatency(this.subscription, cycleTimes);
|
int latency = ruleManager.getLatency(this.subscription, cycleTimes);
|
||||||
int priority = ruleManager.getPriority(this.subscription, cycleTimes);
|
SubscriptionPriority priority = ruleManager
|
||||||
|
.getPriority(this.subscription, cycleTimes);
|
||||||
priorityComp = new PriorityComp(shell, latency, priority);
|
priorityComp = new PriorityComp(shell, latency, priority);
|
||||||
|
|
||||||
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
|
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
|
||||||
|
@ -337,7 +340,7 @@ public class GriddedTimingSelectionDlg extends CaveSWTDialog implements
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int getPriority() {
|
public SubscriptionPriority getPriority() {
|
||||||
return priorityComp.getPriorityIndex();
|
return priorityComp.getPriority();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ package com.raytheon.uf.viz.datadelivery.subscription.subset;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -51,6 +52,7 @@ import com.raytheon.uf.common.datadelivery.registry.DataSet;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.DataType;
|
import com.raytheon.uf.common.datadelivery.registry.DataType;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.GriddedCoverage;
|
import com.raytheon.uf.common.datadelivery.registry.GriddedCoverage;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.GriddedDataSet;
|
import com.raytheon.uf.common.datadelivery.registry.GriddedDataSet;
|
||||||
|
import com.raytheon.uf.common.datadelivery.registry.Levels;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.Parameter;
|
import com.raytheon.uf.common.datadelivery.registry.Parameter;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.Time;
|
import com.raytheon.uf.common.datadelivery.registry.Time;
|
||||||
|
@ -123,6 +125,7 @@ import com.raytheon.viz.ui.presenter.IDisplay;
|
||||||
* Jan 02, 2012 1345 djohnson Use gui thread task executor.
|
* Jan 02, 2012 1345 djohnson Use gui thread task executor.
|
||||||
* Jan 04, 2012 1420 mpduff Pass the subscription in to the GriddedTimingSelectionDlg.
|
* Jan 04, 2012 1420 mpduff Pass the subscription in to the GriddedTimingSelectionDlg.
|
||||||
* Jan 10, 2013 1444 mpduff Fix the loading of saved subsets from the saved subset tab.
|
* Jan 10, 2013 1444 mpduff Fix the loading of saved subsets from the saved subset tab.
|
||||||
|
* Jan 28, 2013 1530 djohnson Break out long method chaining into local variables for debugging.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author mpduff
|
* @author mpduff
|
||||||
|
@ -562,7 +565,6 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
|
||||||
sub.setOfficeID(LocalizationManager.getInstance().getCurrentSite());
|
sub.setOfficeID(LocalizationManager.getInstance().getCurrentSite());
|
||||||
if (create) {
|
if (create) {
|
||||||
sub.setOwner(LocalizationManager.getInstance().getCurrentUser());
|
sub.setOwner(LocalizationManager.getInstance().getCurrentUser());
|
||||||
sub.setPriority(1);
|
|
||||||
} else {
|
} else {
|
||||||
sub.setOwner(this.subscription.getOwner());
|
sub.setOwner(this.subscription.getOwner());
|
||||||
sub.setGroupName(this.subscription.getGroupName());
|
sub.setGroupName(this.subscription.getGroupName());
|
||||||
|
@ -908,8 +910,11 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
|
||||||
// Data providers have parameters with multiple level types
|
// Data providers have parameters with multiple level types
|
||||||
// containing multiple levels
|
// containing multiple levels
|
||||||
if (levelType.getId() == 100) {
|
if (levelType.getId() == 100) {
|
||||||
for (int index : p.getLevels().getSelectedLevelIndices()) {
|
final Levels levels = p.getLevels();
|
||||||
v.addLevel(String.valueOf(p.getLevels().getLevel()
|
final List<Integer> selectedLevelIndices = levels
|
||||||
|
.getSelectedLevelIndices();
|
||||||
|
for (int index : selectedLevelIndices) {
|
||||||
|
v.addLevel(String.valueOf(levels.getLevel()
|
||||||
.get(index)));
|
.get(index)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.viz.datadelivery.subscription.subset.presenter;
|
package com.raytheon.uf.viz.datadelivery.subscription.subset.presenter;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
|
||||||
import com.raytheon.viz.ui.presenter.IPresenterView;
|
import com.raytheon.viz.ui.presenter.IPresenterView;
|
||||||
import com.raytheon.viz.ui.presenter.components.ButtonConf;
|
import com.raytheon.viz.ui.presenter.components.ButtonConf;
|
||||||
import com.raytheon.viz.ui.presenter.components.CheckBoxConf;
|
import com.raytheon.viz.ui.presenter.components.CheckBoxConf;
|
||||||
|
@ -119,9 +120,9 @@ public interface IGriddedTimingSelectionDlgView extends IPresenterView {
|
||||||
int getLatency();
|
int getLatency();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the priority value.
|
* Get the priority.
|
||||||
*
|
*
|
||||||
* @return priority value
|
* @return priority
|
||||||
*/
|
*/
|
||||||
int getPriority();
|
SubscriptionPriority getPriority();
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ import java.util.Set;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||||
|
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
|
||||||
import com.raytheon.viz.ui.presenter.IPresenterView;
|
import com.raytheon.viz.ui.presenter.IPresenterView;
|
||||||
import com.raytheon.viz.ui.presenter.components.ButtonConf;
|
import com.raytheon.viz.ui.presenter.components.ButtonConf;
|
||||||
import com.raytheon.viz.ui.presenter.components.CheckBoxConf;
|
import com.raytheon.viz.ui.presenter.components.CheckBoxConf;
|
||||||
|
@ -44,6 +45,7 @@ import com.raytheon.viz.ui.presenter.components.ComboBoxConf;
|
||||||
* Dec 13, 2012 1391 bgonzale Added status methods.
|
* Dec 13, 2012 1391 bgonzale Added status methods.
|
||||||
* Jan 02, 2013 1441 djohnson Add isGroupSelected.
|
* Jan 02, 2013 1441 djohnson Add isGroupSelected.
|
||||||
* Jan 04, 2013 1420 mpduff Added getters for latency and priority.
|
* Jan 04, 2013 1420 mpduff Added getters for latency and priority.
|
||||||
|
* Jan 25, 2013 1528 djohnson Subscription priority is now an enum.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -210,14 +212,14 @@ public interface ICreateSubscriptionDlgView extends IPresenterView {
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int getPriority();
|
SubscriptionPriority getPriority();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the priority selection
|
* Set the priority selection
|
||||||
*
|
*
|
||||||
* @param i
|
* @param subscriptionPriority
|
||||||
*/
|
*/
|
||||||
void setPriority(int i);
|
void setPriority(SubscriptionPriority subscriptionPriority);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open the dialog
|
* Open the dialog
|
||||||
|
@ -406,13 +408,6 @@ public interface ICreateSubscriptionDlgView extends IPresenterView {
|
||||||
*/
|
*/
|
||||||
int getLatencyValue();
|
int getLatencyValue();
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the priority value.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
int getPriorityValue();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Subscription.
|
* Set Subscription.
|
||||||
*
|
*
|
||||||
|
|
|
@ -24,6 +24,8 @@ import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Priority rule xml object.
|
* Priority rule xml object.
|
||||||
*
|
*
|
||||||
|
@ -34,6 +36,7 @@ import javax.xml.bind.annotation.XmlRootElement;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Dec 19, 2012 1420 mpduff Initial creation.
|
* Dec 19, 2012 1420 mpduff Initial creation.
|
||||||
|
* Jan 25, 2013 1528 djohnson Subscription priority is now an enum.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -44,20 +47,20 @@ import javax.xml.bind.annotation.XmlRootElement;
|
||||||
@XmlRootElement
|
@XmlRootElement
|
||||||
public class PriorityRuleXML extends RuleXML {
|
public class PriorityRuleXML extends RuleXML {
|
||||||
@XmlElement(name = "priority")
|
@XmlElement(name = "priority")
|
||||||
private Integer priority;
|
private SubscriptionPriority priority;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param priority
|
* @param priority
|
||||||
* the priority to set
|
* the priority to set
|
||||||
*/
|
*/
|
||||||
public void setPriority(Integer priority) {
|
public void setPriority(SubscriptionPriority priority) {
|
||||||
this.priority = priority;
|
this.priority = priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the priority
|
* @return the priority
|
||||||
*/
|
*/
|
||||||
public Integer getPriority() {
|
public SubscriptionPriority getPriority() {
|
||||||
return priority;
|
return priority;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ import org.eclipse.swt.widgets.Layout;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
|
||||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
import com.raytheon.uf.common.status.UFStatus;
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
import com.raytheon.uf.common.units.DataSizeUnit;
|
import com.raytheon.uf.common.units.DataSizeUnit;
|
||||||
|
@ -44,7 +45,6 @@ import com.raytheon.uf.viz.datadelivery.subscription.xml.OperatorAdapter;
|
||||||
import com.raytheon.uf.viz.datadelivery.subscription.xml.PriorityRuleXML;
|
import com.raytheon.uf.viz.datadelivery.subscription.xml.PriorityRuleXML;
|
||||||
import com.raytheon.uf.viz.datadelivery.subscription.xml.RuleXML;
|
import com.raytheon.uf.viz.datadelivery.subscription.xml.RuleXML;
|
||||||
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryGUIUtils;
|
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryGUIUtils;
|
||||||
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryGUIUtils.SubscriptionPriority;
|
|
||||||
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
|
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
|
||||||
import com.raytheon.uf.viz.datadelivery.utils.NameOperationItems;
|
import com.raytheon.uf.viz.datadelivery.utils.NameOperationItems;
|
||||||
import com.raytheon.uf.viz.datadelivery.utils.TypeOperationItems;
|
import com.raytheon.uf.viz.datadelivery.utils.TypeOperationItems;
|
||||||
|
@ -69,6 +69,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
* rules are only for future subscriptions.
|
* rules are only for future subscriptions.
|
||||||
* Jan 14, 2013 1286 djohnson Rule operators are now used as objects.
|
* Jan 14, 2013 1286 djohnson Rule operators are now used as objects.
|
||||||
* Jan 17, 2013 1357 mpduff Moved DataSizeUnit.
|
* Jan 17, 2013 1357 mpduff Moved DataSizeUnit.
|
||||||
|
* Jan 25, 2013 1528 djohnson Subscription priority is now an enum.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -543,17 +544,17 @@ public class CreateEditRuleDlg extends CaveSWTDialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PRIORITY_TYPE.equals(ruleType)) {
|
if (PRIORITY_TYPE.equals(ruleType)) {
|
||||||
Integer priority = ((PriorityRuleXML) ruleXml).getPriority();
|
SubscriptionPriority priority = ((PriorityRuleXML) ruleXml)
|
||||||
|
.getPriority();
|
||||||
|
|
||||||
int o = 0;
|
|
||||||
SubscriptionPriority[] priorityOptions = SubscriptionPriority
|
SubscriptionPriority[] priorityOptions = SubscriptionPriority
|
||||||
.values();
|
.values();
|
||||||
for (SubscriptionPriority item : priorityOptions) {
|
for (SubscriptionPriority item : priorityOptions) {
|
||||||
if (priority == item.getPriorityValue()) {
|
if (priority == item) {
|
||||||
priorityCombo.select(o);
|
priorityCombo.select(priorityCombo.indexOf(priority
|
||||||
|
.getPriorityName()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
o++;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Integer latency = ((LatencyRuleXML) ruleXml).getLatency();
|
Integer latency = ((LatencyRuleXML) ruleXml).getLatency();
|
||||||
|
@ -732,12 +733,11 @@ public class CreateEditRuleDlg extends CaveSWTDialog {
|
||||||
|
|
||||||
if (PRIORITY_TYPE.equals(ruleType)) {
|
if (PRIORITY_TYPE.equals(ruleType)) {
|
||||||
PriorityRuleXML rule = new PriorityRuleXML();
|
PriorityRuleXML rule = new PriorityRuleXML();
|
||||||
priorityVal = SubscriptionPriority.valueOf(priorityCombo.getText()
|
priorityVal = SubscriptionPriority.fromPriorityName(priorityCombo
|
||||||
.toUpperCase());
|
.getText());
|
||||||
for (SubscriptionPriority pri : SubscriptionPriority.values()) {
|
for (SubscriptionPriority pri : SubscriptionPriority.values()) {
|
||||||
if (pri.equals(priorityVal)) {
|
if (pri.equals(priorityVal)) {
|
||||||
priority = pri.getPriorityValue();
|
rule.setPriority(pri);
|
||||||
(rule).setPriority(priority);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ import javax.xml.bind.Unmarshaller;
|
||||||
import com.raytheon.uf.common.datadelivery.bandwidth.IBandwidthService;
|
import com.raytheon.uf.common.datadelivery.bandwidth.IBandwidthService;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.Network;
|
import com.raytheon.uf.common.datadelivery.registry.Network;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||||
|
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
|
||||||
import com.raytheon.uf.common.localization.FileUpdatedMessage;
|
import com.raytheon.uf.common.localization.FileUpdatedMessage;
|
||||||
import com.raytheon.uf.common.localization.ILocalizationFileObserver;
|
import com.raytheon.uf.common.localization.ILocalizationFileObserver;
|
||||||
import com.raytheon.uf.common.localization.IPathManager;
|
import com.raytheon.uf.common.localization.IPathManager;
|
||||||
|
@ -66,6 +67,7 @@ import com.raytheon.uf.viz.datadelivery.utils.TypeOperationItems;
|
||||||
* Sep 17, 2012 730 jpiatt Initial creation.
|
* Sep 17, 2012 730 jpiatt Initial creation.
|
||||||
* Oct 23, 2012 1286 djohnson Hook into bandwidth management.
|
* Oct 23, 2012 1286 djohnson Hook into bandwidth management.
|
||||||
* Jan 04, 2013 1420 mpduff Move rules into a single file.
|
* Jan 04, 2013 1420 mpduff Move rules into a single file.
|
||||||
|
* Jan 25, 2013 1528 djohnson Subscription priority is now an enum.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -498,22 +500,23 @@ public class SystemRuleManager {
|
||||||
* @param cycleTimes
|
* @param cycleTimes
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public int getPriority(Subscription sub, Set<Integer> cycleTimes) {
|
public SubscriptionPriority getPriority(Subscription sub,
|
||||||
|
Set<Integer> cycleTimes) {
|
||||||
PriorityRulesXML rulesXml = this.getPriorityRules(false);
|
PriorityRulesXML rulesXml = this.getPriorityRules(false);
|
||||||
int priority = 3;
|
SubscriptionPriority priority = null;
|
||||||
boolean found = false;
|
|
||||||
for (PriorityRuleXML rule : rulesXml.getRules()) {
|
for (PriorityRuleXML rule : rulesXml.getRules()) {
|
||||||
if (rule.matches(sub, cycleTimes)) {
|
if (rule.matches(sub, cycleTimes)) {
|
||||||
if (rule.getPriority() < priority) {
|
if (priority == null
|
||||||
|
|| rule.getPriority().getPriorityValue() < priority
|
||||||
|
.getPriorityValue()) {
|
||||||
priority = rule.getPriority();
|
priority = rule.getPriority();
|
||||||
found = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default to normal priority
|
// Default to normal priority
|
||||||
if (!found) {
|
if (priority == null) {
|
||||||
priority = 2;
|
priority = SubscriptionPriority.NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return priority;
|
return priority;
|
||||||
|
|
|
@ -25,10 +25,7 @@ import java.util.Date;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlEnumValue;
|
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.graphics.RGB;
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
|
@ -55,6 +52,7 @@ import com.raytheon.uf.viz.core.VizApp;
|
||||||
* Dec 17, 2012 1435 mpduff Fix ThreadLocal implementation.
|
* Dec 17, 2012 1435 mpduff Fix ThreadLocal implementation.
|
||||||
* Dec 18, 2012 1439 mpduff Change Regex to match invalid chars.
|
* Dec 18, 2012 1439 mpduff Change Regex to match invalid chars.
|
||||||
* Jan 04, 2013 1420 mpduff Change default priority to normal priority.
|
* Jan 04, 2013 1420 mpduff Change default priority to normal priority.
|
||||||
|
* Jan 25, 2013 1528 djohnson Subscription priority has moved up in the world to the Subscription class.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -108,67 +106,6 @@ public class DataDeliveryGUIUtils {
|
||||||
/** Name Required Message */
|
/** Name Required Message */
|
||||||
public static final String NAME_REQUIRED_MESSAGE = "Name required.\nA Subscription Name must be entered.";
|
public static final String NAME_REQUIRED_MESSAGE = "Name required.\nA Subscription Name must be entered.";
|
||||||
|
|
||||||
/** Enumeration to use for subscription priorities */
|
|
||||||
public static enum SubscriptionPriority {
|
|
||||||
/** High Priority */
|
|
||||||
@XmlEnumValue("High")
|
|
||||||
HIGH("High", 1, new RGB(255, 0, 0)),
|
|
||||||
/** Default Priority */
|
|
||||||
@XmlEnumValue("Normal")
|
|
||||||
NORMAL("Normal", 2, new RGB(0, 255, 0)),
|
|
||||||
/** Low Priority */
|
|
||||||
@XmlEnumValue("Low")
|
|
||||||
LOW("Low", 3, new RGB(6, 122, 255));
|
|
||||||
|
|
||||||
/** Priority Setting */
|
|
||||||
private final String priorityName;
|
|
||||||
|
|
||||||
/** Numeric Value of the priority */
|
|
||||||
private Integer priorityValue;
|
|
||||||
|
|
||||||
/** Priority color for ui */
|
|
||||||
private RGB color;
|
|
||||||
|
|
||||||
private SubscriptionPriority(String priorityName,
|
|
||||||
Integer priorityValue, RGB color) {
|
|
||||||
this.priorityName = priorityName;
|
|
||||||
this.priorityValue = priorityValue;
|
|
||||||
this.color = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get column name.
|
|
||||||
*
|
|
||||||
* @return Priority Name
|
|
||||||
*/
|
|
||||||
public String getPriorityName() {
|
|
||||||
return priorityName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the integer value of the priority
|
|
||||||
*
|
|
||||||
* @return The integer value of the priority.
|
|
||||||
*/
|
|
||||||
public Integer getPriorityValue() {
|
|
||||||
return priorityValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return priorityName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the color.
|
|
||||||
*
|
|
||||||
* @return the color
|
|
||||||
*/
|
|
||||||
public RGB getColor() {
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -453,7 +453,8 @@ public class DataDeliveryUtils {
|
||||||
.append(newline);
|
.append(newline);
|
||||||
fmtStr.append("Provider : ").append(sub.getProvider()).append(newline);
|
fmtStr.append("Provider : ").append(sub.getProvider()).append(newline);
|
||||||
fmtStr.append("Office ID: ").append(sub.getOfficeID()).append(newline);
|
fmtStr.append("Office ID: ").append(sub.getOfficeID()).append(newline);
|
||||||
fmtStr.append("Priority : ").append(sub.getPriority()).append(newline);
|
fmtStr.append("Priority : ")
|
||||||
|
.append(sub.getPriority().getPriorityValue()).append(newline);
|
||||||
|
|
||||||
fmtStr.append("Coverage: ").append(newline);
|
fmtStr.append("Coverage: ").append(newline);
|
||||||
final Coverage coverage = sub.getCoverage();
|
final Coverage coverage = sub.getCoverage();
|
||||||
|
|
|
@ -58,7 +58,6 @@ import org.eclipse.swt.widgets.Menu;
|
||||||
import org.eclipse.swt.widgets.MenuItem;
|
import org.eclipse.swt.widgets.MenuItem;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
import com.google.common.base.Strings;
|
|
||||||
import com.raytheon.uf.common.stats.data.DataPoint;
|
import com.raytheon.uf.common.stats.data.DataPoint;
|
||||||
import com.raytheon.uf.common.stats.data.GraphData;
|
import com.raytheon.uf.common.stats.data.GraphData;
|
||||||
import com.raytheon.uf.common.stats.data.StatsData;
|
import com.raytheon.uf.common.stats.data.StatsData;
|
||||||
|
@ -83,6 +82,7 @@ import com.raytheon.uf.viz.stats.display.ScaleManager;
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Oct 03, 2012 728 mpduff Initial creation.
|
* Oct 03, 2012 728 mpduff Initial creation.
|
||||||
* Jan 17, 2013 1357 mpduff Added mouse listeners.
|
* Jan 17, 2013 1357 mpduff Added mouse listeners.
|
||||||
|
* Jan 29, 2013 1523 mpduff Fix for count units.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -676,11 +676,10 @@ public class StatsDisplayCanvas extends Canvas {
|
||||||
String unit = graphData.getDisplayUnit();
|
String unit = graphData.getDisplayUnit();
|
||||||
StringBuilder yAxisLabel = new StringBuilder(graphTitle);
|
StringBuilder yAxisLabel = new StringBuilder(graphTitle);
|
||||||
|
|
||||||
if (!Strings.isNullOrEmpty(unit) && !unit.equalsIgnoreCase(COUNT)
|
if (isCount(unit)) {
|
||||||
&& !view.equals(DataView.COUNT)) {
|
|
||||||
yAxisLabel.append(" (").append(unit).append(")");
|
|
||||||
} else if (view.equals(DataView.COUNT)) {
|
|
||||||
yAxisLabel.append(" Counts");
|
yAxisLabel.append(" Counts");
|
||||||
|
} else {
|
||||||
|
yAxisLabel.append(" (").append(unit).append(")");
|
||||||
}
|
}
|
||||||
|
|
||||||
gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_BLACK));
|
gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_BLACK));
|
||||||
|
@ -700,6 +699,10 @@ public class StatsDisplayCanvas extends Canvas {
|
||||||
t.dispose();
|
t.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isCount(String unit) {
|
||||||
|
return view.equals(DataView.COUNT) || COUNT.equalsIgnoreCase(unit);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draw the data on the canvas.
|
* Draw the data on the canvas.
|
||||||
*
|
*
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
|
|
||||||
package com.raytheon.viz.gfe.actions;
|
package com.raytheon.viz.gfe.actions;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import com.raytheon.viz.gfe.Activator;
|
import com.raytheon.viz.gfe.Activator;
|
||||||
import org.eclipse.core.commands.AbstractHandler;
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
import org.eclipse.core.commands.ExecutionEvent;
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
|
@ -29,9 +31,8 @@ import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
import com.raytheon.viz.gfe.core.msgs.Message;
|
import com.raytheon.viz.gfe.core.msgs.Message;
|
||||||
import com.raytheon.viz.gfe.core.msgs.ShowISCGridsMsg;
|
import com.raytheon.viz.gfe.core.msgs.ShowISCGridsMsg;
|
||||||
|
|
||||||
import org.eclipse.swt.graphics.Image;
|
import org.eclipse.ui.commands.IElementUpdater;
|
||||||
import org.eclipse.swt.widgets.Event;
|
import org.eclipse.ui.menus.UIElement;
|
||||||
import org.eclipse.swt.widgets.ToolItem;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action to show the ISC grids
|
* Action to show the ISC grids
|
||||||
|
@ -44,44 +45,47 @@ import org.eclipse.swt.widgets.ToolItem;
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* 07/20/09 1995 bphillip Initial release
|
* 07/20/09 1995 bphillip Initial release
|
||||||
* 12/06/12 DR 15574 jzeng Change the image of
|
* 12/06/12 DR 15574 jzeng Change the image of
|
||||||
* the icon when it is activated
|
* the icon when it is activated
|
||||||
* 01/11/13 DR 15574 jzeng delete all fields to local variables
|
* 01/11/13 DR 15574 jzeng Change all fields to local variables
|
||||||
|
* 01/16/13 DR 15722 jzeng/randerson override updateElement()
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author bphillip
|
* @author bphillip
|
||||||
* @version 1
|
* @version 1
|
||||||
*/
|
*/
|
||||||
public class ShowISCGridsAction extends AbstractHandler {
|
public class ShowISCGridsAction extends AbstractHandler implements
|
||||||
|
IElementUpdater {
|
||||||
|
|
||||||
@Override
|
|
||||||
|
@Override
|
||||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||||
boolean current = Message.inquireLastMessage(ShowISCGridsMsg.class).show();
|
boolean current = Message.inquireLastMessage(ShowISCGridsMsg.class)
|
||||||
|
.show();
|
||||||
if (arg0.getTrigger() instanceof Event) {
|
|
||||||
Event e = (Event) arg0.getTrigger();
|
|
||||||
if ( e.widget instanceof ToolItem) {
|
|
||||||
ToolItem ti = (ToolItem) e.widget;
|
|
||||||
if (ti != null ){
|
|
||||||
ImageDescriptor id;
|
|
||||||
|
|
||||||
if (!current){
|
|
||||||
id = Activator.imageDescriptorFromPlugin(
|
|
||||||
Activator.PLUGIN_ID, "icons/isc1.gif" );
|
|
||||||
} else {
|
|
||||||
id = Activator.imageDescriptorFromPlugin(
|
|
||||||
Activator.PLUGIN_ID, "icons/isc0.gif" );
|
|
||||||
}
|
|
||||||
|
|
||||||
if (id != null){
|
|
||||||
Image img = id.createImage();
|
|
||||||
ti.setImage(img);
|
|
||||||
img.dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
new ShowISCGridsMsg(!current).send();
|
new ShowISCGridsMsg(!current).send();
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateElement(UIElement element,
|
||||||
|
@SuppressWarnings("rawtypes") Map parameters) {
|
||||||
|
|
||||||
|
boolean current = Message.inquireLastMessage(ShowISCGridsMsg.class)
|
||||||
|
.show();
|
||||||
|
|
||||||
|
ImageDescriptor id;
|
||||||
|
if (current) {
|
||||||
|
id = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID,
|
||||||
|
"icons/isc1.gif");
|
||||||
|
} else {
|
||||||
|
id = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID,
|
||||||
|
"icons/isc0.gif");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (id != null) {
|
||||||
|
element.setIcon(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,9 @@
|
||||||
**/
|
**/
|
||||||
package com.raytheon.viz.gfe.core.msgs;
|
package com.raytheon.viz.gfe.core.msgs;
|
||||||
|
|
||||||
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
import org.eclipse.ui.commands.ICommandService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Add Description
|
* TODO Add Description
|
||||||
*
|
*
|
||||||
|
@ -26,9 +29,12 @@ package com.raytheon.viz.gfe.core.msgs;
|
||||||
*
|
*
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ---------------- --------------------------
|
||||||
* Mar 30, 2011 randerso Initial creation
|
* 03/30/11 randerso Initial creation
|
||||||
|
* 01/16/13 DR15722 jzeng/randerso override send() to
|
||||||
|
* force the UI to update the button
|
||||||
|
* whenever the message is sent.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -50,4 +56,15 @@ public class ShowISCGridsMsg extends Message {
|
||||||
public boolean show() {
|
public boolean show() {
|
||||||
return showIscGrids;
|
return showIscGrids;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void send() {
|
||||||
|
super.send();
|
||||||
|
|
||||||
|
ICommandService service = (ICommandService) PlatformUI.getWorkbench()
|
||||||
|
.getService(ICommandService.class);
|
||||||
|
service.refreshElements("com.raytheon.viz.gfe.actions.showISCGrids",
|
||||||
|
null);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -623,6 +623,7 @@ public class DbParm extends Parm {
|
||||||
|
|
||||||
success &= allSaved;
|
success &= allSaved;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if any pending saves
|
// if any pending saves
|
||||||
if (sgr.size() > 0) {
|
if (sgr.size() > 0) {
|
||||||
if (doSave(sgr)) {
|
if (doSave(sgr)) {
|
||||||
|
@ -632,13 +633,7 @@ public class DbParm extends Parm {
|
||||||
} else {
|
} else {
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
}
|
pendingUnlocks.clear();
|
||||||
|
|
||||||
// if any pending saves
|
|
||||||
if (sgr.size() > 0) {
|
|
||||||
if (!doSave(sgr)) {
|
|
||||||
success = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
|
|
|
@ -23,6 +23,46 @@
|
||||||
id="${icao}fourPanel">
|
id="${icao}fourPanel">
|
||||||
<contribute xsi:type="titleItem" titleText="------ Z/V ------"
|
<contribute xsi:type="titleItem" titleText="------ Z/V ------"
|
||||||
id="${icao}Terminal4panelZV" />
|
id="${icao}Terminal4panelZV" />
|
||||||
|
<contribute xsi:type="bundleItem"
|
||||||
|
file="bundles/DefaultRadarFourPanelBlendedBestRes.xml" menuText="${elev1} ${elev2} ${elev6} ${elev8}"
|
||||||
|
id="${icao}${elev1}${elev2}${elev6}${elev8}Terminal4panelZV"
|
||||||
|
suppressErrors="${suppressErrors3}">
|
||||||
|
<substitute key="icao" value="${icao}" />
|
||||||
|
<substitute key="product1" value="180" />
|
||||||
|
<substitute key="product2" value="181" />
|
||||||
|
<substitute key="product3" value="" />
|
||||||
|
<substitute key="product4" value="" />
|
||||||
|
<substitute key="mode1" value="" />
|
||||||
|
<substitute key="product5" value="182" />
|
||||||
|
<substitute key="product6" value="183" />
|
||||||
|
<substitute key="product7" value="" />
|
||||||
|
<substitute key="product8" value="" />
|
||||||
|
<substitute key="mode2" value="" />
|
||||||
|
<substitute key="elevation1" value="${elev1}--${elev1}" />
|
||||||
|
<substitute key="elevation2" value="${elev2}--${elev2}" />
|
||||||
|
<substitute key="elevation3" value="${elev6}--${elev6}" />
|
||||||
|
<substitute key="elevation4" value="${elev8}--${elev8}" />
|
||||||
|
</contribute>
|
||||||
|
<contribute xsi:type="bundleItem"
|
||||||
|
file="bundles/DefaultRadarFourPanelBlendedBestRes.xml" menuText="${elev1} ${elev3} ${elev5} ${elev6}"
|
||||||
|
id="${icao}${elev1}${elev3}${elev5}${elev6}Terminal4panelZV"
|
||||||
|
suppressErrors="${suppressErrors3}">
|
||||||
|
<substitute key="icao" value="${icao}" />
|
||||||
|
<substitute key="product1" value="180" />
|
||||||
|
<substitute key="product2" value="181" />
|
||||||
|
<substitute key="product3" value="" />
|
||||||
|
<substitute key="product4" value="" />
|
||||||
|
<substitute key="mode1" value="" />
|
||||||
|
<substitute key="product5" value="182" />
|
||||||
|
<substitute key="product6" value="183" />
|
||||||
|
<substitute key="product7" value="" />
|
||||||
|
<substitute key="product8" value="" />
|
||||||
|
<substitute key="mode2" value="" />
|
||||||
|
<substitute key="elevation1" value="${elev1}--${elev1}" />
|
||||||
|
<substitute key="elevation2" value="${elev3}--${elev3}" />
|
||||||
|
<substitute key="elevation3" value="${elev5}--${elev5}" />
|
||||||
|
<substitute key="elevation4" value="${elev6}--${elev6}" />
|
||||||
|
</contribute>
|
||||||
<contribute xsi:type="bundleItem"
|
<contribute xsi:type="bundleItem"
|
||||||
file="bundles/DefaultRadarFourPanelBlendedBestRes.xml" menuText="${elev1} ${elev2} ${elev3} ${elev4}"
|
file="bundles/DefaultRadarFourPanelBlendedBestRes.xml" menuText="${elev1} ${elev2} ${elev3} ${elev4}"
|
||||||
id="${icao}${elev1}${elev2}${elev3}${elev4}Terminal4panelZV"
|
id="${icao}${elev1}${elev2}${elev3}${elev4}Terminal4panelZV"
|
||||||
|
@ -38,14 +78,94 @@
|
||||||
<substitute key="product7" value="" />
|
<substitute key="product7" value="" />
|
||||||
<substitute key="product8" value="" />
|
<substitute key="product8" value="" />
|
||||||
<substitute key="mode2" value="" />
|
<substitute key="mode2" value="" />
|
||||||
<substitute key="elevation1" value="${elev1}" />
|
<substitute key="elevation1" value="${elev1}--${elev1}" />
|
||||||
<substitute key="elevation2" value="${elev2}" />
|
<substitute key="elevation2" value="${elev2}--${elev2}" />
|
||||||
<substitute key="elevation3" value="${elev3}" />
|
<substitute key="elevation3" value="${elev3}--${elev3}" />
|
||||||
<substitute key="elevation4" value="${elev4}" />
|
<substitute key="elevation4" value="${elev4}--${elev4}" />
|
||||||
</contribute>
|
</contribute>
|
||||||
|
<contribute xsi:type="bundleItem"
|
||||||
|
file="bundles/DefaultRadarFourPanelBlendedBestRes.xml" menuText="${elev3} ${elev7} ${elev8} ${elev9}"
|
||||||
|
id="${icao}${elev3}${elev7}${elev8}${elev9}Terminal4panelZV"
|
||||||
|
suppressErrors="${suppressErrors3}">
|
||||||
|
<substitute key="icao" value="${icao}" />
|
||||||
|
<substitute key="product1" value="180" />
|
||||||
|
<substitute key="product2" value="181" />
|
||||||
|
<substitute key="product3" value="" />
|
||||||
|
<substitute key="product4" value="" />
|
||||||
|
<substitute key="mode1" value="" />
|
||||||
|
<substitute key="product5" value="182" />
|
||||||
|
<substitute key="product6" value="183" />
|
||||||
|
<substitute key="product7" value="" />
|
||||||
|
<substitute key="product8" value="" />
|
||||||
|
<substitute key="mode2" value="" />
|
||||||
|
<substitute key="elevation1" value="${elev3}--${elev3}" />
|
||||||
|
<substitute key="elevation2" value="${elev7}--${elev7}" />
|
||||||
|
<substitute key="elevation3" value="${elev8}--${elev8}" />
|
||||||
|
<substitute key="elevation4" value="${elev9}--${elev9}" />
|
||||||
|
</contribute>
|
||||||
|
<contribute xsi:type="bundleItem"
|
||||||
|
file="bundles/DefaultRadarFourPanelBlendedBestRes.xml" menuText="${elev8} ${elev9} ${elev10} ${elev12}"
|
||||||
|
id="${icao}${elev8}${elev9}${elev10}${elev12}Terminal4panelZV"
|
||||||
|
suppressErrors="${suppressErrors3}">
|
||||||
|
<substitute key="icao" value="${icao}" />
|
||||||
|
<substitute key="product1" value="180" />
|
||||||
|
<substitute key="product2" value="181" />
|
||||||
|
<substitute key="product3" value="" />
|
||||||
|
<substitute key="product4" value="" />
|
||||||
|
<substitute key="mode1" value="" />
|
||||||
|
<substitute key="product5" value="182" />
|
||||||
|
<substitute key="product6" value="183" />
|
||||||
|
<substitute key="product7" value="" />
|
||||||
|
<substitute key="product8" value="" />
|
||||||
|
<substitute key="mode2" value="" />
|
||||||
|
<substitute key="elevation1" value="${elev8}--${elev8}" />
|
||||||
|
<substitute key="elevation2" value="${elev9}--${elev9}" />
|
||||||
|
<substitute key="elevation3" value="${elev10}--${elev10}" />
|
||||||
|
<substitute key="elevation4" value="${elev12}--${elev12}" />
|
||||||
|
</contribute>
|
||||||
<contribute xsi:type="separator" id="below${icao}Terminal4panelZSRM8" />
|
<contribute xsi:type="separator" id="below${icao}Terminal4panelZSRM8" />
|
||||||
<contribute xsi:type="titleItem" titleText="------ Z/SRM8 ------"
|
<contribute xsi:type="titleItem" titleText="------ Z/SRM8 ------"
|
||||||
id="${icao}Terminal4panelZSRM8" />
|
id="${icao}Terminal4panelZSRM8" />
|
||||||
|
<contribute xsi:type="bundleItem"
|
||||||
|
file="bundles/DefaultRadarFourPanelBlendedBestRes.xml" menuText="${elev1} ${elev2} ${elev6} ${elev8}"
|
||||||
|
id="${icao}${elev1}${elev2}${elev6}${elev8}Terminal4panelZSRM8"
|
||||||
|
suppressErrors="${suppressErrors3}">
|
||||||
|
<substitute key="icao" value="${icao}" />
|
||||||
|
<substitute key="product1" value="180" />
|
||||||
|
<substitute key="product2" value="181" />
|
||||||
|
<substitute key="product3" value="" />
|
||||||
|
<substitute key="product4" value="" />
|
||||||
|
<substitute key="mode1" value="" />
|
||||||
|
<substitute key="product5" value="182" />
|
||||||
|
<substitute key="product6" value="" />
|
||||||
|
<substitute key="product7" value="" />
|
||||||
|
<substitute key="product8" value="" />
|
||||||
|
<substitute key="mode2" value="SRM8" />
|
||||||
|
<substitute key="elevation1" value="${elev1}--${elev1}" />
|
||||||
|
<substitute key="elevation2" value="${elev2}--${elev2}" />
|
||||||
|
<substitute key="elevation3" value="${elev6}--${elev6}" />
|
||||||
|
<substitute key="elevation4" value="${elev8}--${elev8}" />
|
||||||
|
</contribute>
|
||||||
|
<contribute xsi:type="bundleItem"
|
||||||
|
file="bundles/DefaultRadarFourPanelBlendedBestRes.xml" menuText="${elev1} ${elev3} ${elev5} ${elev6}"
|
||||||
|
id="${icao}${elev1}${elev3}${elev5}${elev6}Terminal4panelZSRM8"
|
||||||
|
suppressErrors="${suppressErrors3}">
|
||||||
|
<substitute key="icao" value="${icao}" />
|
||||||
|
<substitute key="product1" value="180" />
|
||||||
|
<substitute key="product2" value="181" />
|
||||||
|
<substitute key="product3" value="" />
|
||||||
|
<substitute key="product4" value="" />
|
||||||
|
<substitute key="mode1" value="" />
|
||||||
|
<substitute key="product5" value="182" />
|
||||||
|
<substitute key="product6" value="" />
|
||||||
|
<substitute key="product7" value="" />
|
||||||
|
<substitute key="product8" value="" />
|
||||||
|
<substitute key="mode2" value="SRM8" />
|
||||||
|
<substitute key="elevation1" value="${elev1}--${elev1}" />
|
||||||
|
<substitute key="elevation2" value="${elev3}--${elev3}" />
|
||||||
|
<substitute key="elevation3" value="${elev5}--${elev5}" />
|
||||||
|
<substitute key="elevation4" value="${elev6}--${elev6}" />
|
||||||
|
</contribute>
|
||||||
<contribute xsi:type="bundleItem"
|
<contribute xsi:type="bundleItem"
|
||||||
file="bundles/DefaultRadarFourPanelBlendedBestRes.xml" menuText="${elev1} ${elev2} ${elev3} ${elev4}"
|
file="bundles/DefaultRadarFourPanelBlendedBestRes.xml" menuText="${elev1} ${elev2} ${elev3} ${elev4}"
|
||||||
id="${icao}${elev1}${elev2}${elev3}${elev4}Terminal4panelZSRM8"
|
id="${icao}${elev1}${elev2}${elev3}${elev4}Terminal4panelZSRM8"
|
||||||
|
@ -60,11 +180,51 @@
|
||||||
<substitute key="product6" value="" />
|
<substitute key="product6" value="" />
|
||||||
<substitute key="product7" value="" />
|
<substitute key="product7" value="" />
|
||||||
<substitute key="product8" value="" />
|
<substitute key="product8" value="" />
|
||||||
|
<substitute key="mode2" value="SRM8" />
|
||||||
|
<substitute key="elevation1" value="${elev1}--${elev1}" />
|
||||||
|
<substitute key="elevation2" value="${elev2}--${elev2}" />
|
||||||
|
<substitute key="elevation3" value="${elev3}--${elev3}" />
|
||||||
|
<substitute key="elevation4" value="${elev4}--${elev4}" />
|
||||||
|
</contribute>
|
||||||
|
<contribute xsi:type="bundleItem"
|
||||||
|
file="bundles/DefaultRadarFourPanelBlendedBestRes.xml" menuText="${elev3} ${elev7} ${elev8} ${elev9}"
|
||||||
|
id="${icao}${elev3}${elev7}${elev8}${elev9}Terminal4panelZSRM8"
|
||||||
|
suppressErrors="${suppressErrors3}">
|
||||||
|
<substitute key="icao" value="${icao}" />
|
||||||
|
<substitute key="product1" value="180" />
|
||||||
|
<substitute key="product2" value="181" />
|
||||||
|
<substitute key="product3" value="" />
|
||||||
|
<substitute key="product4" value="" />
|
||||||
|
<substitute key="mode1" value="" />
|
||||||
|
<substitute key="product5" value="182" />
|
||||||
|
<substitute key="product6" value="" />
|
||||||
|
<substitute key="product7" value="" />
|
||||||
|
<substitute key="product8" value="" />
|
||||||
<substitute key="mode2" value="SRM8" />
|
<substitute key="mode2" value="SRM8" />
|
||||||
<substitute key="elevation1" value="${elev1}" />
|
<substitute key="elevation1" value="${elev3}--${elev3}" />
|
||||||
<substitute key="elevation2" value="${elev2}" />
|
<substitute key="elevation2" value="${elev7}--${elev7}" />
|
||||||
<substitute key="elevation3" value="${elev3}" />
|
<substitute key="elevation3" value="${elev8}--${elev8}" />
|
||||||
<substitute key="elevation4" value="${elev4}" />
|
<substitute key="elevation4" value="${elev9}--${elev9}" />
|
||||||
</contribute>
|
</contribute>
|
||||||
|
<contribute xsi:type="bundleItem"
|
||||||
|
file="bundles/DefaultRadarFourPanelBlendedBestRes.xml" menuText="${elev8} ${elev9} ${elev10} ${elev12}"
|
||||||
|
id="${icao}${elev8}${elev9}${elev10}${elev12}Terminal4panelZSRM8"
|
||||||
|
suppressErrors="${suppressErrors3}">
|
||||||
|
<substitute key="icao" value="${icao}" />
|
||||||
|
<substitute key="product1" value="180" />
|
||||||
|
<substitute key="product2" value="181" />
|
||||||
|
<substitute key="product3" value="" />
|
||||||
|
<substitute key="product4" value="" />
|
||||||
|
<substitute key="mode1" value="" />
|
||||||
|
<substitute key="product5" value="182" />
|
||||||
|
<substitute key="product6" value="" />
|
||||||
|
<substitute key="product7" value="" />
|
||||||
|
<substitute key="product8" value="" />
|
||||||
|
<substitute key="mode2" value="SRM8" />
|
||||||
|
<substitute key="elevation1" value="${elev8}--${elev8}" />
|
||||||
|
<substitute key="elevation2" value="${elev9}--${elev9}" />
|
||||||
|
<substitute key="elevation3" value="${elev10}--${elev10}" />
|
||||||
|
<substitute key="elevation4" value="${elev12}--${elev12}" />
|
||||||
|
</contribute>
|
||||||
</contribute>
|
</contribute>
|
||||||
</menuTemplate>
|
</menuTemplate>
|
||||||
|
|
|
@ -60,8 +60,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
* uses the font.
|
* uses the font.
|
||||||
* Feb 03, 2012 14317 mhuang Make alarm display window wider
|
* Feb 03, 2012 14317 mhuang Make alarm display window wider
|
||||||
* Sep 6, 2012 13365 rferrel Accumulate and Display fix.
|
* Sep 6, 2012 13365 rferrel Accumulate and Display fix.
|
||||||
* Sep 25, 2012 1196 lvenable Dialog refactor for AlarmDisplayWindow. Added DO_NOT_BLOCK.
|
* Sep 25, 2012 1196 lvenable Dialog refactor for AlarmDisplayWindow.Added DO_NOT_BLOCK.
|
||||||
* Dec 31, 2012 15651 mgamazaychikov Added an argument to re-factored PrintDisplay.print
|
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -199,7 +198,7 @@ public class AlarmDisplayWindow extends CaveSWTDialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintDisplay.print(lines.toString(), text.getFont()
|
PrintDisplay.print(lines.toString(), text.getFont()
|
||||||
.getFontData()[0], -1, UFStatus
|
.getFontData()[0], UFStatus
|
||||||
.getHandler(AlarmDisplayWindow.class));
|
.getHandler(AlarmDisplayWindow.class));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -208,7 +207,7 @@ public class AlarmDisplayWindow extends CaveSWTDialog {
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent event) {
|
public void widgetSelected(SelectionEvent event) {
|
||||||
PrintDisplay.print(text.getText(),
|
PrintDisplay.print(text.getText(),
|
||||||
text.getFont().getFontData()[0], -1,
|
text.getFont().getFontData()[0],
|
||||||
UFStatus.getHandler(AlarmDisplayWindow.class));
|
UFStatus.getHandler(AlarmDisplayWindow.class));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -309,8 +309,7 @@ import com.raytheon.viz.ui.dialogs.SWTMessageBox;
|
||||||
* 28Nov2012 14842 M.Gamazaychikov Re-wrote processPopup method
|
* 28Nov2012 14842 M.Gamazaychikov Re-wrote processPopup method
|
||||||
* 13Dec2012 1353 rferrel Change to make edit cancel message not
|
* 13Dec2012 1353 rferrel Change to make edit cancel message not
|
||||||
* dispaly the red had kill job message.
|
* dispaly the red had kill job message.
|
||||||
* 31Dec2012 15651 M.Gamazaychikov Added an argument to re-factored PrintDisplay.print
|
* 10JAN2012 15704 M.Gamazaychikov Added setting userKeyPressed to false in verifyText method
|
||||||
* 10JAN2012 15704 M.Gamazaychikov Added setting userKeyPressed to false in verifyText method.
|
|
||||||
* 22JAN2013 1496 rferrel Query for loading products no longer on the UI thread.
|
* 22JAN2013 1496 rferrel Query for loading products no longer on the UI thread.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -4443,8 +4442,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
||||||
*/
|
*/
|
||||||
private void printAllText() {
|
private void printAllText() {
|
||||||
FontData fontData = textEditor.getFont().getFontData()[0];
|
FontData fontData = textEditor.getFont().getFontData()[0];
|
||||||
PrintDisplay.print(textEditor.getText(), fontData, charWrapCol,
|
PrintDisplay.print(textEditor.getText(), fontData, statusHandler);
|
||||||
statusHandler);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4467,8 +4465,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
||||||
String tmpText = textEditor.getText();
|
String tmpText = textEditor.getText();
|
||||||
Point point = textEditor.getSelection();
|
Point point = textEditor.getSelection();
|
||||||
FontData fontData = textEditor.getFont().getFontData()[0];
|
FontData fontData = textEditor.getFont().getFontData()[0];
|
||||||
PrintDisplay.print(textEditor.getSelectionText(), fontData,
|
PrintDisplay.print(textEditor.getSelectionText(), fontData,
|
||||||
charWrapCol, statusHandler);
|
statusHandler);
|
||||||
textEditor.setText(tmpText);
|
textEditor.setText(tmpText);
|
||||||
textEditor.setSelection(point);
|
textEditor.setSelection(point);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
* Sep 15, 2011 10557 rferrel Initial creation
|
* Sep 15, 2011 10557 rferrel Initial creation
|
||||||
* Jul 17, 2012 14274 rferrel Now use eclipse Printer instead of awt.
|
* Jul 17, 2012 14274 rferrel Now use eclipse Printer instead of awt.
|
||||||
* Text is printed using same font as the GUI
|
* Text is printed using same font as the GUI
|
||||||
* Dec 31, 2012 15651 mgamazaychikov Added setFont method to scale font for printing
|
* Dec 31, 2012 15651 M Gamazaychikov Added setFont method to scale font for printing
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -53,7 +53,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
|
|
||||||
public class PrintDisplay {
|
public class PrintDisplay {
|
||||||
public static void print(final String printedText, final FontData fontData,
|
public static void print(final String printedText, final FontData fontData,
|
||||||
int aLineWidth, IUFStatusHandler statusHandler) {
|
IUFStatusHandler statusHandler) {
|
||||||
PrinterData data = Printer.getDefaultPrinterData();
|
PrinterData data = Printer.getDefaultPrinterData();
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
statusHandler.handle(Priority.PROBLEM,
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
|
@ -67,11 +67,9 @@ public class PrintDisplay {
|
||||||
}
|
}
|
||||||
|
|
||||||
final Printer printer = new Printer(data);
|
final Printer printer = new Printer(data);
|
||||||
PrintDisplay pd = new PrintDisplay(printer, printedText, fontData, aLineWidth);
|
PrintDisplay pd = new PrintDisplay(printer, printedText, fontData);
|
||||||
pd.printJob();
|
pd.printJob();
|
||||||
}
|
}
|
||||||
|
|
||||||
private int lineWidth;
|
|
||||||
|
|
||||||
private Printer printer;
|
private Printer printer;
|
||||||
|
|
||||||
|
@ -105,16 +103,10 @@ public class PrintDisplay {
|
||||||
|
|
||||||
int end;
|
int end;
|
||||||
|
|
||||||
private PrintDisplay(Printer printer, String text, FontData fontData, int aWidth) {
|
private PrintDisplay(Printer printer, String text, FontData fontData) {
|
||||||
this.printer = printer;
|
this.printer = printer;
|
||||||
this.textToPrint = text;
|
this.textToPrint = text;
|
||||||
this.printerFontData = fontData;
|
this.printerFontData = fontData;
|
||||||
if (aWidth == -1) {
|
|
||||||
this.lineWidth = 69;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.lineWidth = aWidth;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void printJob() {
|
private void printJob() {
|
||||||
|
@ -128,6 +120,19 @@ public class PrintDisplay {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setFont() {
|
protected void setFont() {
|
||||||
|
/*
|
||||||
|
* get the max number of characters in a line of text
|
||||||
|
* and add a length of tab
|
||||||
|
*/
|
||||||
|
String [] textLines = textToPrint.split("[\n]");
|
||||||
|
int maxChar = textLines[0].length();
|
||||||
|
for ( int counter=1; counter<textLines.length; counter++){
|
||||||
|
if (textLines[counter].length() > maxChar){
|
||||||
|
maxChar = textLines[counter].length();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
maxChar = maxChar + 4;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get the original font size and set the gc font.
|
* get the original font size and set the gc font.
|
||||||
*/
|
*/
|
||||||
|
@ -138,8 +143,8 @@ public class PrintDisplay {
|
||||||
/*
|
/*
|
||||||
* Create a buffer for computing line width in pixels.
|
* Create a buffer for computing line width in pixels.
|
||||||
*/
|
*/
|
||||||
StringBuilder aBuffer = new StringBuilder(lineWidth);
|
StringBuilder aBuffer = new StringBuilder(maxChar);
|
||||||
for (int i = 0; i < lineWidth; i++) {
|
for (int i = 0; i < maxChar; i++) {
|
||||||
aBuffer.append(' ');
|
aBuffer.append(' ');
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -136,6 +136,20 @@ public abstract class AbstractVizPerspectiveManager implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void partDeactivated(IWorkbenchPart part) {
|
public void partDeactivated(IWorkbenchPart part) {
|
||||||
|
// update editor on last selected modal tool
|
||||||
|
if (part instanceof IEditorPart
|
||||||
|
&& part instanceof IDisplayPaneContainer) {
|
||||||
|
AbstractVizPerspectiveManager mgr = VizPerspectiveListener
|
||||||
|
.getCurrentPerspectiveManager();
|
||||||
|
if (mgr != null) {
|
||||||
|
for (AbstractModalTool tool : mgr.getToolManager()
|
||||||
|
.getSelectedModalTools()) {
|
||||||
|
if (tool.getCurrentEditor() == part) {
|
||||||
|
tool.deactivate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -362,12 +376,6 @@ public abstract class AbstractVizPerspectiveManager implements
|
||||||
page.hideEditor(ref);
|
page.hideEditor(ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (AbstractModalTool tool : toolManager.getSelectedModalTools()) {
|
|
||||||
if (tool != null) {
|
|
||||||
tool.deactivate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
deactivateDialogs();
|
deactivateDialogs();
|
||||||
deactivateContexts();
|
deactivateContexts();
|
||||||
removeFromStatusLine();
|
removeFromStatusLine();
|
||||||
|
|
|
@ -156,6 +156,7 @@ public abstract class AbstractModalTool extends AbstractTool {
|
||||||
this.setEnabled(false);
|
this.setEnabled(false);
|
||||||
if (editor != null) {
|
if (editor != null) {
|
||||||
deactivateTool();
|
deactivateTool();
|
||||||
|
editor = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ import org.geotools.referencing.GeodeticCalculator;
|
||||||
|
|
||||||
import com.raytheon.uf.common.dataplugin.warning.config.PathcastConfiguration;
|
import com.raytheon.uf.common.dataplugin.warning.config.PathcastConfiguration;
|
||||||
import com.raytheon.uf.common.dataplugin.warning.config.PointSourceConfiguration;
|
import com.raytheon.uf.common.dataplugin.warning.config.PointSourceConfiguration;
|
||||||
|
import com.raytheon.uf.common.dataplugin.warning.gis.PreparedGeometryCollection;
|
||||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||||
import com.raytheon.uf.common.geospatial.SpatialQueryResult;
|
import com.raytheon.uf.common.geospatial.SpatialQueryResult;
|
||||||
import com.raytheon.uf.viz.core.exception.VizException;
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
|
@ -26,7 +27,6 @@ import com.vividsolutions.jts.geom.Coordinate;
|
||||||
import com.vividsolutions.jts.geom.Envelope;
|
import com.vividsolutions.jts.geom.Envelope;
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import com.vividsolutions.jts.geom.Geometry;
|
||||||
import com.vividsolutions.jts.geom.prep.PreparedGeometry;
|
import com.vividsolutions.jts.geom.prep.PreparedGeometry;
|
||||||
import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -146,7 +146,7 @@ public class DbAreaSourceDataAdaptor extends AbstractDbSourceDataAdaptor {
|
||||||
boolean userDirections = Boolean.valueOf(String.valueOf(attributes
|
boolean userDirections = Boolean.valueOf(String.valueOf(attributes
|
||||||
.get(useDirectionField)));
|
.get(useDirectionField)));
|
||||||
if (userDirections) {
|
if (userDirections) {
|
||||||
PreparedGeometry prepGeom = PreparedGeometryFactory.prepare(geom);
|
PreparedGeometry prepGeom = new PreparedGeometryCollection(geom);
|
||||||
if (prepGeom.intersects(searchArea) && !prepGeom.within(searchArea)) {
|
if (prepGeom.intersects(searchArea) && !prepGeom.within(searchArea)) {
|
||||||
Geometry intersection = searchArea.intersection(geom);
|
Geometry intersection = searchArea.intersection(geom);
|
||||||
partOfArea = GisUtil.asStringList(calculateLocationPortion(
|
partOfArea = GisUtil.asStringList(calculateLocationPortion(
|
||||||
|
|
|
@ -50,6 +50,7 @@ import com.raytheon.viz.warngen.gui.WarngenLayer;
|
||||||
import com.raytheon.viz.warngen.suppress.SuppressMap;
|
import com.raytheon.viz.warngen.suppress.SuppressMap;
|
||||||
import com.raytheon.viz.warngen.util.Abbreviation;
|
import com.raytheon.viz.warngen.util.Abbreviation;
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import com.vividsolutions.jts.geom.Geometry;
|
||||||
|
import com.vividsolutions.jts.geom.prep.PreparedGeometry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Area
|
* Area
|
||||||
|
@ -176,6 +177,7 @@ public class Area {
|
||||||
GeodeticCalculator gc = new GeodeticCalculator();
|
GeodeticCalculator gc = new GeodeticCalculator();
|
||||||
for (GeospatialData regionFeature : countyMap.values()) {
|
for (GeospatialData regionFeature : countyMap.values()) {
|
||||||
Geometry regionGeom = regionFeature.geometry;
|
Geometry regionGeom = regionFeature.geometry;
|
||||||
|
PreparedGeometry preparedRegionGeom = regionFeature.prepGeom;
|
||||||
AffectedAreas area = new AffectedAreas();
|
AffectedAreas area = new AffectedAreas();
|
||||||
area.name = regionFeature.attributes.get(areaField).toString();
|
area.name = regionFeature.attributes.get(areaField).toString();
|
||||||
area.fips = regionFeature.attributes.get(fipsField).toString();
|
area.fips = regionFeature.attributes.get(fipsField).toString();
|
||||||
|
@ -237,7 +239,7 @@ public class Area {
|
||||||
if (ptFeatures != null) {
|
if (ptFeatures != null) {
|
||||||
List<String> pointList = new ArrayList<String>();
|
List<String> pointList = new ArrayList<String>();
|
||||||
for (SpatialQueryResult ptRslt : ptFeatures) {
|
for (SpatialQueryResult ptRslt : ptFeatures) {
|
||||||
if (regionGeom.contains(ptRslt.geometry)) {
|
if (preparedRegionGeom.contains(ptRslt.geometry)) {
|
||||||
pointList.add(String.valueOf(ptRslt.attributes
|
pointList.add(String.valueOf(ptRslt.attributes
|
||||||
.get(pointField)));
|
.get(pointField)));
|
||||||
}
|
}
|
||||||
|
@ -331,7 +333,7 @@ public class Area {
|
||||||
}
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> converFeAreaToPartList(String feArea) {
|
public static List<String> converFeAreaToPartList(String feArea) {
|
||||||
final List<String> partList = new ArrayList<String>();
|
final List<String> partList = new ArrayList<String>();
|
||||||
if (feArea == null) {
|
if (feArea == null) {
|
||||||
|
|
|
@ -29,6 +29,7 @@ import java.util.List;
|
||||||
|
|
||||||
import org.geotools.referencing.GeodeticCalculator;
|
import org.geotools.referencing.GeodeticCalculator;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.dataplugin.warning.util.GeometryUtil;
|
||||||
import com.raytheon.viz.warngen.suppress.SuppressMap;
|
import com.raytheon.viz.warngen.suppress.SuppressMap;
|
||||||
import com.vividsolutions.jts.algorithm.CGAlgorithms;
|
import com.vividsolutions.jts.algorithm.CGAlgorithms;
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
import com.vividsolutions.jts.geom.Coordinate;
|
||||||
|
@ -37,7 +38,6 @@ import com.vividsolutions.jts.geom.Geometry;
|
||||||
import com.vividsolutions.jts.geom.GeometryCollection;
|
import com.vividsolutions.jts.geom.GeometryCollection;
|
||||||
import com.vividsolutions.jts.geom.GeometryFactory;
|
import com.vividsolutions.jts.geom.GeometryFactory;
|
||||||
import com.vividsolutions.jts.geom.LineString;
|
import com.vividsolutions.jts.geom.LineString;
|
||||||
import com.vividsolutions.jts.geom.MultiPolygon;
|
|
||||||
import com.vividsolutions.jts.geom.Polygon;
|
import com.vividsolutions.jts.geom.Polygon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -206,27 +206,21 @@ public class GisUtil {
|
||||||
yDirection = Direction.SOUTH;
|
yDirection = Direction.SOUTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<Geometry> geoms = new ArrayList<Geometry>(geom.getNumGeometries());
|
||||||
|
GeometryUtil.buildGeometryList(geoms, geom);
|
||||||
boolean isExtreme = false;
|
boolean isExtreme = false;
|
||||||
Coordinate[] coords;
|
|
||||||
if (geom instanceof Polygon) {
|
|
||||||
LineString lineString = ((Polygon) geom).getExteriorRing();
|
|
||||||
coords = lineString.getCoordinates();
|
|
||||||
isExtreme = isExtreme(coords, point,
|
|
||||||
(extremaThresholdX + extremaThresholdY) / 2.0);
|
|
||||||
} else if (geom instanceof MultiPolygon) {
|
|
||||||
int geoms = ((MultiPolygon) geom).getNumGeometries();
|
|
||||||
|
|
||||||
for (int i = 0; i < geoms; i++) {
|
for (Geometry g : geoms) {
|
||||||
LineString lineString = ((Polygon) ((MultiPolygon) geom)
|
if (g instanceof Polygon) {
|
||||||
.getGeometryN(i)).getExteriorRing();
|
LineString lineString = ((Polygon) g).getExteriorRing();
|
||||||
coords = lineString.getCoordinates();
|
if (isExtreme(lineString.getCoordinates(), point,
|
||||||
if (isExtreme(coords, point,
|
|
||||||
(extremaThresholdX + extremaThresholdY) / 2.0)) {
|
(extremaThresholdX + extremaThresholdY) / 2.0)) {
|
||||||
isExtreme = true;
|
isExtreme = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EnumSet<Direction> retVal = EnumSet.noneOf(Direction.class);
|
EnumSet<Direction> retVal = EnumSet.noneOf(Direction.class);
|
||||||
|
|
||||||
if (xDirection != null && !suppressType.equals(SuppressMap.EAST_WEST)
|
if (xDirection != null && !suppressType.equals(SuppressMap.EAST_WEST)
|
||||||
|
|
|
@ -30,6 +30,7 @@ import org.geotools.referencing.operation.DefaultMathTransformFactory;
|
||||||
import org.opengis.metadata.spatial.PixelOrientation;
|
import org.opengis.metadata.spatial.PixelOrientation;
|
||||||
import org.opengis.referencing.operation.MathTransform;
|
import org.opengis.referencing.operation.MathTransform;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.dataplugin.warning.gis.PreparedGeometryCollection;
|
||||||
import com.raytheon.uf.common.dataplugin.warning.util.GeometryUtil;
|
import com.raytheon.uf.common.dataplugin.warning.util.GeometryUtil;
|
||||||
import com.raytheon.uf.viz.core.IExtent;
|
import com.raytheon.uf.viz.core.IExtent;
|
||||||
import com.raytheon.uf.viz.core.exception.VizException;
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
|
@ -44,7 +45,6 @@ import com.vividsolutions.jts.geom.GeometryFactory;
|
||||||
import com.vividsolutions.jts.geom.LineSegment;
|
import com.vividsolutions.jts.geom.LineSegment;
|
||||||
import com.vividsolutions.jts.geom.Polygon;
|
import com.vividsolutions.jts.geom.Polygon;
|
||||||
import com.vividsolutions.jts.geom.prep.PreparedGeometry;
|
import com.vividsolutions.jts.geom.prep.PreparedGeometry;
|
||||||
import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility for polygon operations
|
* Utility for polygon operations
|
||||||
|
@ -57,7 +57,7 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Dec 1, 2010 mschenke Initial creation
|
* Dec 1, 2010 mschenke Initial creation
|
||||||
* 12/06/2012 DR 15559 Qinglu Lin Added round() methods.
|
* 12/06/2012 DR 15559 Qinglu Lin Added round() methods.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author mschenke
|
* @author mschenke
|
||||||
|
@ -850,7 +850,7 @@ public class PolygonUtil {
|
||||||
List<PreparedGeometry> prepped = new ArrayList<PreparedGeometry>(
|
List<PreparedGeometry> prepped = new ArrayList<PreparedGeometry>(
|
||||||
geomList.size());
|
geomList.size());
|
||||||
for (Geometry g : geomList) {
|
for (Geometry g : geomList) {
|
||||||
prepped.add(PreparedGeometryFactory.prepare(g));
|
prepped.add(new PreparedGeometryCollection(g));
|
||||||
}
|
}
|
||||||
|
|
||||||
GeometryFactory gf = warningArea.getFactory();
|
GeometryFactory gf = warningArea.getFactory();
|
||||||
|
@ -931,56 +931,54 @@ public class PolygonUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void truncate(List<Coordinate >coordinates, int decimalPlaces) {
|
public static void truncate(List<Coordinate> coordinates, int decimalPlaces) {
|
||||||
for (Coordinate coordinate : coordinates) {
|
for (Coordinate coordinate : coordinates) {
|
||||||
truncate(coordinate, decimalPlaces);
|
truncate(coordinate, decimalPlaces);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void truncate(Coordinate[] coordinates, int decimalPlaces) {
|
public static void truncate(Coordinate[] coordinates, int decimalPlaces) {
|
||||||
for (Coordinate coordinate : coordinates) {
|
for (Coordinate coordinate : coordinates) {
|
||||||
truncate(coordinate, decimalPlaces);
|
truncate(coordinate, decimalPlaces);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void truncate(Coordinate coordinate, int decimalPlaces) {
|
public static void truncate(Coordinate coordinate, int decimalPlaces) {
|
||||||
double x = coordinate.x * Math.pow(10, decimalPlaces);
|
double x = coordinate.x * Math.pow(10, decimalPlaces);
|
||||||
double y = coordinate.y * Math.pow(10, decimalPlaces);
|
double y = coordinate.y * Math.pow(10, decimalPlaces);
|
||||||
|
|
||||||
x = x >= 0 ? Math.floor(x) : Math.ceil(x);
|
x = x >= 0 ? Math.floor(x) : Math.ceil(x);
|
||||||
y = y >= 0 ? Math.floor(y) : Math.ceil(y);
|
y = y >= 0 ? Math.floor(y) : Math.ceil(y);
|
||||||
|
|
||||||
coordinate.x = x / Math.pow(10, decimalPlaces);
|
coordinate.x = x / Math.pow(10, decimalPlaces);
|
||||||
coordinate.y = y / Math.pow(10, decimalPlaces);
|
coordinate.y = y / Math.pow(10, decimalPlaces);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void round(List<Coordinate >coordinates, int decimalPlaces) {
|
public static void round(List<Coordinate> coordinates, int decimalPlaces) {
|
||||||
for (Coordinate coordinate : coordinates) {
|
for (Coordinate coordinate : coordinates) {
|
||||||
round(coordinate, decimalPlaces);
|
round(coordinate, decimalPlaces);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void round(Coordinate[] coordinates, int decimalPlaces) {
|
public static void round(Coordinate[] coordinates, int decimalPlaces) {
|
||||||
for (Coordinate coordinate : coordinates) {
|
for (Coordinate coordinate : coordinates) {
|
||||||
round(coordinate, decimalPlaces);
|
round(coordinate, decimalPlaces);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* round()
|
* round() Rounding coordinates, instead of truncating them.
|
||||||
* Rounding coordinates, instead of truncating them.
|
*
|
||||||
*
|
* History 12/06/2012 DR 15559 Qinglu Lin Created.
|
||||||
* History
|
|
||||||
* 12/06/2012 DR 15559 Qinglu Lin Created.
|
|
||||||
*/
|
*/
|
||||||
public static void round(Coordinate coordinate, int decimalPlaces) {
|
public static void round(Coordinate coordinate, int decimalPlaces) {
|
||||||
double x = coordinate.x * Math.pow(10, decimalPlaces);
|
double x = coordinate.x * Math.pow(10, decimalPlaces);
|
||||||
double y = coordinate.y * Math.pow(10, decimalPlaces);
|
double y = coordinate.y * Math.pow(10, decimalPlaces);
|
||||||
|
|
||||||
x = Math.round(x);
|
x = Math.round(x);
|
||||||
y = Math.round(y);
|
y = Math.round(y);
|
||||||
|
|
||||||
coordinate.x = x / Math.pow(10, decimalPlaces);
|
coordinate.x = x / Math.pow(10, decimalPlaces);
|
||||||
coordinate.y = y / Math.pow(10, decimalPlaces);
|
coordinate.y = y / Math.pow(10, decimalPlaces);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,13 +24,13 @@ import java.lang.reflect.Array;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
|
@ -40,10 +40,15 @@ import javax.measure.converter.UnitConverter;
|
||||||
import javax.measure.unit.NonSI;
|
import javax.measure.unit.NonSI;
|
||||||
import javax.measure.unit.SI;
|
import javax.measure.unit.SI;
|
||||||
|
|
||||||
|
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.jface.action.IMenuManager;
|
import org.eclipse.jface.action.IMenuManager;
|
||||||
import org.eclipse.swt.events.DisposeEvent;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.DisposeListener;
|
|
||||||
import org.eclipse.swt.graphics.RGB;
|
import org.eclipse.swt.graphics.RGB;
|
||||||
|
import org.eclipse.swt.widgets.Event;
|
||||||
|
import org.eclipse.swt.widgets.Listener;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.eclipse.ui.PlatformUI;
|
||||||
import org.geotools.geometry.jts.JTS;
|
import org.geotools.geometry.jts.JTS;
|
||||||
import org.geotools.referencing.GeodeticCalculator;
|
import org.geotools.referencing.GeodeticCalculator;
|
||||||
|
@ -60,6 +65,7 @@ import com.raytheon.uf.common.dataplugin.warning.config.WarngenConfiguration;
|
||||||
import com.raytheon.uf.common.dataplugin.warning.gis.GeospatialData;
|
import com.raytheon.uf.common.dataplugin.warning.gis.GeospatialData;
|
||||||
import com.raytheon.uf.common.dataplugin.warning.gis.GeospatialFactory;
|
import com.raytheon.uf.common.dataplugin.warning.gis.GeospatialFactory;
|
||||||
import com.raytheon.uf.common.dataplugin.warning.gis.GeospatialMetadata;
|
import com.raytheon.uf.common.dataplugin.warning.gis.GeospatialMetadata;
|
||||||
|
import com.raytheon.uf.common.dataplugin.warning.gis.PreparedGeometryCollection;
|
||||||
import com.raytheon.uf.common.dataplugin.warning.util.CountyUserData;
|
import com.raytheon.uf.common.dataplugin.warning.util.CountyUserData;
|
||||||
import com.raytheon.uf.common.dataplugin.warning.util.GeometryUtil;
|
import com.raytheon.uf.common.dataplugin.warning.util.GeometryUtil;
|
||||||
import com.raytheon.uf.common.geospatial.DestinationGeodeticCalculator;
|
import com.raytheon.uf.common.geospatial.DestinationGeodeticCalculator;
|
||||||
|
@ -118,7 +124,6 @@ import com.vividsolutions.jts.geom.Point;
|
||||||
import com.vividsolutions.jts.geom.Polygon;
|
import com.vividsolutions.jts.geom.Polygon;
|
||||||
import com.vividsolutions.jts.geom.TopologyException;
|
import com.vividsolutions.jts.geom.TopologyException;
|
||||||
import com.vividsolutions.jts.geom.prep.PreparedGeometry;
|
import com.vividsolutions.jts.geom.prep.PreparedGeometry;
|
||||||
import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
|
|
||||||
import com.vividsolutions.jts.io.ParseException;
|
import com.vividsolutions.jts.io.ParseException;
|
||||||
import com.vividsolutions.jts.io.WKTReader;
|
import com.vividsolutions.jts.io.WKTReader;
|
||||||
|
|
||||||
|
@ -152,8 +157,8 @@ import com.vividsolutions.jts.io.WKTReader;
|
||||||
* 12/13/2012 DR 15559 Qinglu Lin Added code to call WarngenUIState's adjustPolygon().
|
* 12/13/2012 DR 15559 Qinglu Lin Added code to call WarngenUIState's adjustPolygon().
|
||||||
* 12/17/2012 DR 15571 Qinglu Lin For hydro products,futurePoints is null. Resolved an issue caused by trying to get
|
* 12/17/2012 DR 15571 Qinglu Lin For hydro products,futurePoints is null. Resolved an issue caused by trying to get
|
||||||
* Coordinate[] from futurePoints.
|
* Coordinate[] from futurePoints.
|
||||||
* 12/18/2012 DR 15571 Qinglu Lin Resolved coordinate issue in TML line caused by clicking Restart button.
|
* 12/18/2012 DR 15571 Qinglu Lin Resolved coordinate issue in TML line caused by clicking Restart button.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author mschenke
|
* @author mschenke
|
||||||
|
@ -181,6 +186,60 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
int nx, ny;
|
int nx, ny;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class CustomMaps extends Job {
|
||||||
|
|
||||||
|
private Set<String> customMaps = new HashSet<String>();
|
||||||
|
|
||||||
|
private Set<String> mapsToLoad;
|
||||||
|
|
||||||
|
private MapManager manager;
|
||||||
|
|
||||||
|
public CustomMaps() {
|
||||||
|
super("Loading WarnGen Maps");
|
||||||
|
manager = MapManager.getInstance(descriptor);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
|
boolean done = false;
|
||||||
|
while (!done) {
|
||||||
|
Set<String> toLoad = null;
|
||||||
|
synchronized (this) {
|
||||||
|
if (mapsToLoad != null) {
|
||||||
|
toLoad = mapsToLoad;
|
||||||
|
mapsToLoad = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (toLoad != null) {
|
||||||
|
for (String loaded : customMaps) {
|
||||||
|
manager.unloadMap(loaded);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String load : toLoad) {
|
||||||
|
manager.loadMapByName(load);
|
||||||
|
}
|
||||||
|
|
||||||
|
issueRefresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
done = mapsToLoad == null;
|
||||||
|
}
|
||||||
|
return Status.OK_STATUS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadCustomMaps(Collection<String> maps) {
|
||||||
|
synchronized (this) {
|
||||||
|
mapsToLoad = new HashSet<String>(maps);
|
||||||
|
}
|
||||||
|
schedule();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearMaps() {
|
||||||
|
loadCustomMaps(new HashSet<String>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static Map<String, GeospatialDataList> siteMap = new HashMap<String, GeospatialDataList>();
|
private static Map<String, GeospatialDataList> siteMap = new HashMap<String, GeospatialDataList>();
|
||||||
|
|
||||||
private static Map<String, Geometry> timezoneMap = new HashMap<String, Geometry>();
|
private static Map<String, Geometry> timezoneMap = new HashMap<String, Geometry>();
|
||||||
|
@ -220,7 +279,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
|
|
||||||
private boolean boxEditable = true;
|
private boolean boxEditable = true;
|
||||||
|
|
||||||
private Map<MapDescriptor, Set<String>> loadedCustomMaps;
|
private CustomMaps customMaps;
|
||||||
|
|
||||||
protected Mode lastMode = null;
|
protected Mode lastMode = null;
|
||||||
|
|
||||||
|
@ -260,7 +319,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
super(resourceData, loadProperties, descriptor);
|
super(resourceData, loadProperties, descriptor);
|
||||||
displayState.displayType = DisplayType.POINT;
|
displayState.displayType = DisplayType.POINT;
|
||||||
getCapability(ColorableCapability.class).setColor(WHITE);
|
getCapability(ColorableCapability.class).setColor(WHITE);
|
||||||
loadedCustomMaps = new HashMap<MapDescriptor, Set<String>>();
|
customMaps = new CustomMaps();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
dialogConfig = DialogConfiguration
|
dialogConfig = DialogConfiguration
|
||||||
|
@ -385,13 +444,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void disposeInternal() {
|
protected void disposeInternal() {
|
||||||
for (Entry<MapDescriptor, Set<String>> entry : loadedCustomMaps
|
customMaps.clearMaps();
|
||||||
.entrySet()) {
|
|
||||||
for (String map : entry.getValue()) {
|
|
||||||
MapManager.getInstance(entry.getKey()).unloadMap(map);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
loadedCustomMaps.clear();
|
|
||||||
|
|
||||||
super.disposeInternal();
|
super.disposeInternal();
|
||||||
|
|
||||||
|
@ -432,7 +485,6 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
}
|
}
|
||||||
super.initInternal(target);
|
super.initInternal(target);
|
||||||
VizApp.runSync(new Runnable() {
|
VizApp.runSync(new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
createDialog();
|
createDialog();
|
||||||
|
@ -493,17 +545,17 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
displayState.geomChanged = false;
|
displayState.geomChanged = false;
|
||||||
}
|
}
|
||||||
if (warningAction == null || warningAction == WarningAction.NEW) {
|
if (warningAction == null || warningAction == WarningAction.NEW) {
|
||||||
// Initialize box
|
// Initialize box
|
||||||
if (((configuration.isTrackEnabled() == false || configuration
|
if (((configuration.isTrackEnabled() == false || configuration
|
||||||
.getPathcastConfig() == null) && this.displayState.displayType != DisplayType.POLY)
|
.getPathcastConfig() == null) && this.displayState.displayType != DisplayType.POLY)
|
||||||
|| frameCount == 1) {
|
|| frameCount == 1) {
|
||||||
createSquare();
|
createSquare();
|
||||||
resetInitialFrame();
|
resetInitialFrame();
|
||||||
} else {
|
} else {
|
||||||
redrawBoxFromTrack();
|
redrawBoxFromTrack();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
redrawBoxFromTrack();
|
redrawBoxFromTrack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -746,7 +798,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
local);
|
local);
|
||||||
gd.attributes.put(
|
gd.attributes.put(
|
||||||
GeospatialDataList.LOCAL_PREP_GEOM,
|
GeospatialDataList.LOCAL_PREP_GEOM,
|
||||||
PreparedGeometryFactory.prepare(local));
|
new PreparedGeometryCollection(local));
|
||||||
locals.add(local);
|
locals.add(local);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -825,43 +877,11 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
String areaSource = config.getGeospatialConfig().getAreaSource();
|
String areaSource = config.getGeospatialConfig().getAreaSource();
|
||||||
geoData = siteMap.get(areaSource + "." + site);
|
geoData = siteMap.get(areaSource + "." + site);
|
||||||
}// end synchronize
|
}// end synchronize
|
||||||
loadCustomMaps(descriptor, config);
|
customMaps.loadCustomMaps(Arrays.asList(config.getMaps()));
|
||||||
this.configuration = config;
|
|
||||||
System.out.println("Time to init warngen config: "
|
|
||||||
+ (System.currentTimeMillis() - t0));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void loadCustomMaps(MapDescriptor descriptor,
|
this.configuration = config;
|
||||||
WarngenConfiguration config) {
|
System.out.println("Total time to init warngen config = "
|
||||||
if (config == null || descriptor == null) {
|
+ (System.currentTimeMillis() - t0) + "ms");
|
||||||
return;
|
|
||||||
}
|
|
||||||
long t1 = System.currentTimeMillis();
|
|
||||||
MapManager mapManager = MapManager.getInstance(descriptor);
|
|
||||||
List<String> maps = Arrays.asList(config.getMaps());
|
|
||||||
Set<String> loadedCustomMaps = this.loadedCustomMaps.get(descriptor);
|
|
||||||
if (loadedCustomMaps == null) {
|
|
||||||
loadedCustomMaps = new HashSet<String>();
|
|
||||||
this.loadedCustomMaps.put(descriptor, loadedCustomMaps);
|
|
||||||
}
|
|
||||||
Iterator<String> it = loadedCustomMaps.iterator();
|
|
||||||
while (it.hasNext()) {
|
|
||||||
String map = it.next();
|
|
||||||
if (!maps.contains(map)) {
|
|
||||||
it.remove();
|
|
||||||
mapManager.unloadMap(map);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (String map : maps) {
|
|
||||||
if (!loadedCustomMaps.contains(map)) {
|
|
||||||
if (!mapManager.isMapLoaded(map)) {
|
|
||||||
mapManager.loadMapByName(map);
|
|
||||||
loadedCustomMaps.add(map);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
System.out.println("Time to load custom maps: "
|
|
||||||
+ (System.currentTimeMillis() - t1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public GeospatialData[] getGeodataFeatures(String key) {
|
public GeospatialData[] getGeodataFeatures(String key) {
|
||||||
|
@ -1103,30 +1123,17 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
dialog = new WarngenDialog(PlatformUI.getWorkbench()
|
dialog = new WarngenDialog(PlatformUI.getWorkbench()
|
||||||
.getActiveWorkbenchWindow().getShell(), this);
|
.getActiveWorkbenchWindow().getShell(), this);
|
||||||
dialog.open();
|
dialog.open();
|
||||||
addDialogDisposeListener(descriptor);
|
dialog.addListener(SWT.Dispose, new Listener() {
|
||||||
} else {
|
|
||||||
showDialog(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addDialogDisposeListener(final MapDescriptor descriptor) {
|
|
||||||
if (dialog != null) {
|
|
||||||
dialog.getShell().addDisposeListener(new DisposeListener() {
|
|
||||||
@Override
|
@Override
|
||||||
public void widgetDisposed(DisposeEvent e) {
|
public void handleEvent(Event event) {
|
||||||
descriptor.getResourceList().removeRsc(WarngenLayer.this);
|
descriptor.getResourceList().removeRsc(WarngenLayer.this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
showDialog(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setDescriptor(MapDescriptor descriptor) {
|
|
||||||
super.setDescriptor(descriptor);
|
|
||||||
addDialogDisposeListener(descriptor);
|
|
||||||
loadCustomMaps(descriptor, configuration);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the WarnGen dialog and move it to the front.
|
* Show the WarnGen dialog and move it to the front.
|
||||||
*/
|
*/
|
||||||
|
@ -1611,15 +1618,15 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
if (hatched != null) {
|
if (hatched != null) {
|
||||||
// DR 15559
|
// DR 15559
|
||||||
Coordinate[] coords = hatched.getCoordinates();
|
Coordinate[] coords = hatched.getCoordinates();
|
||||||
PolygonUtil.round(coords, 2);
|
PolygonUtil.round(coords, 2);
|
||||||
state.adjustPolygon(coords);
|
state.adjustPolygon(coords);
|
||||||
GeometryFactory gf = new GeometryFactory();
|
GeometryFactory gf = new GeometryFactory();
|
||||||
LinearRing lr = gf.createLinearRing(coords);
|
LinearRing lr = gf.createLinearRing(coords);
|
||||||
state.setWarningPolygon(gf.createPolygon(lr, null));
|
state.setWarningPolygon(gf.createPolygon(lr, null));
|
||||||
updateWarnedAreas(true, true);
|
updateWarnedAreas(true, true);
|
||||||
issueRefresh();
|
issueRefresh();
|
||||||
// End of DR 15559
|
// End of DR 15559
|
||||||
state.snappedToArea = true;
|
state.snappedToArea = true;
|
||||||
}
|
}
|
||||||
System.out.println("Time to createWarningPolygon: "
|
System.out.println("Time to createWarningPolygon: "
|
||||||
+ (System.currentTimeMillis() - t0) + "ms");
|
+ (System.currentTimeMillis() - t0) + "ms");
|
||||||
|
@ -1838,16 +1845,20 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
Coordinate[] cc = null;
|
Coordinate[] cc = null;
|
||||||
switch (stormTrackState.displayType) {
|
switch (stormTrackState.displayType) {
|
||||||
case POINT:
|
case POINT:
|
||||||
cc = new Coordinate[] { stormTrackState.futurePoints == null ? stormTrackState.dragMePoint
|
cc = new Coordinate[] { stormTrackState.futurePoints == null ? stormTrackState.dragMePoint
|
||||||
.getCoordinate() : stormTrackState.futurePoints[0].coord };
|
.getCoordinate() : stormTrackState.futurePoints[0].coord };
|
||||||
if (warningAction == null || warningAction == WarningAction.NEW || warningAction == WarningAction.CON
|
if (warningAction == null || warningAction == WarningAction.NEW
|
||||||
|| warningAction == WarningAction.CAN) {
|
|| warningAction == WarningAction.CON
|
||||||
Coordinate coord = new Coordinate(stormTrackState.dragMePoint.getCoordinate());
|
|| warningAction == WarningAction.CAN) {
|
||||||
DataTime currentDataTime = new DataTime(SimulatedTime.getSystemTime().getTime());
|
Coordinate coord = new Coordinate(
|
||||||
if (stormTrackState.compuateCurrentStormCenter(coord,currentDataTime))
|
stormTrackState.dragMePoint.getCoordinate());
|
||||||
cc = new Coordinate[] {coord};
|
DataTime currentDataTime = new DataTime(SimulatedTime
|
||||||
}
|
.getSystemTime().getTime());
|
||||||
break;
|
if (stormTrackState.compuateCurrentStormCenter(coord,
|
||||||
|
currentDataTime))
|
||||||
|
cc = new Coordinate[] { coord };
|
||||||
|
}
|
||||||
|
break;
|
||||||
case POLY:
|
case POLY:
|
||||||
Coordinate[] polyPoints = stormTrackState.dragMeLine
|
Coordinate[] polyPoints = stormTrackState.dragMeLine
|
||||||
.getCoordinates();
|
.getCoordinates();
|
||||||
|
@ -2357,8 +2368,8 @@ public class WarngenLayer extends AbstractStormTrackResource {
|
||||||
+ e.getLocalizedMessage(), e);
|
+ e.getLocalizedMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWarningAction(WarningAction warningAction) {
|
public void setWarningAction(WarningAction warningAction) {
|
||||||
this.warningAction = warningAction;
|
this.warningAction = warningAction;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
package com.raytheon.viz.warngen.util;
|
package com.raytheon.viz.warngen.util;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -37,8 +38,10 @@ import com.raytheon.uf.common.dataplugin.warning.UGCZone;
|
||||||
import com.raytheon.uf.common.dataplugin.warning.WarningRecord;
|
import com.raytheon.uf.common.dataplugin.warning.WarningRecord;
|
||||||
import com.raytheon.uf.common.dataplugin.warning.WarningRecord.WarningAction;
|
import com.raytheon.uf.common.dataplugin.warning.WarningRecord.WarningAction;
|
||||||
import com.raytheon.uf.common.dataplugin.warning.util.AnnotationUtil;
|
import com.raytheon.uf.common.dataplugin.warning.util.AnnotationUtil;
|
||||||
|
import com.raytheon.uf.common.dataquery.requests.DbQueryRequest;
|
||||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
|
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
|
||||||
|
import com.raytheon.uf.common.dataquery.responses.DbQueryResponse;
|
||||||
import com.raytheon.uf.common.site.SiteMap;
|
import com.raytheon.uf.common.site.SiteMap;
|
||||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
import com.raytheon.uf.common.status.UFStatus;
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
|
@ -46,10 +49,8 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
import com.raytheon.uf.common.time.SimulatedTime;
|
import com.raytheon.uf.common.time.SimulatedTime;
|
||||||
import com.raytheon.uf.common.time.TimeRange;
|
import com.raytheon.uf.common.time.TimeRange;
|
||||||
import com.raytheon.uf.viz.core.alerts.AlertMessage;
|
import com.raytheon.uf.viz.core.alerts.AlertMessage;
|
||||||
import com.raytheon.uf.viz.core.catalog.LayerProperty;
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
import com.raytheon.uf.viz.core.catalog.ScriptCreator;
|
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||||
import com.raytheon.uf.viz.core.comm.Connector;
|
|
||||||
import com.raytheon.uf.viz.core.rsc.ResourceType;
|
|
||||||
import com.raytheon.viz.alerts.IAlertObserver;
|
import com.raytheon.viz.alerts.IAlertObserver;
|
||||||
import com.raytheon.viz.alerts.observers.ProductAlertObserver;
|
import com.raytheon.viz.alerts.observers.ProductAlertObserver;
|
||||||
import com.raytheon.viz.core.mode.CAVEMode;
|
import com.raytheon.viz.core.mode.CAVEMode;
|
||||||
|
@ -187,7 +188,8 @@ public class CurrentWarnings {
|
||||||
* @param phenSigs
|
* @param phenSigs
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<AbstractWarningRecord> getCorrectableWarnings(AbstractWarningRecord warnRec) {
|
public List<AbstractWarningRecord> getCorrectableWarnings(
|
||||||
|
AbstractWarningRecord warnRec) {
|
||||||
List<AbstractWarningRecord> rval = new ArrayList<AbstractWarningRecord>();
|
List<AbstractWarningRecord> rval = new ArrayList<AbstractWarningRecord>();
|
||||||
Calendar current = Calendar.getInstance();
|
Calendar current = Calendar.getInstance();
|
||||||
Calendar end = Calendar.getInstance();
|
Calendar end = Calendar.getInstance();
|
||||||
|
@ -197,24 +199,28 @@ public class CurrentWarnings {
|
||||||
for (AbstractWarningRecord warning : records) {
|
for (AbstractWarningRecord warning : records) {
|
||||||
String phensig = warning.getPhensig();
|
String phensig = warning.getPhensig();
|
||||||
String etn = warning.getEtn();
|
String etn = warning.getEtn();
|
||||||
|
|
||||||
if (warnRec.getPhensig().equals(phensig) && warnRec.getEtn().equals(etn)) {
|
if (warnRec.getPhensig().equals(phensig)
|
||||||
WarningAction action = WarningAction.valueOf(warning.getAct());
|
&& warnRec.getEtn().equals(etn)) {
|
||||||
|
WarningAction action = WarningAction.valueOf(warning
|
||||||
|
.getAct());
|
||||||
end.setTime(warning.getStartTime().getTime());
|
end.setTime(warning.getStartTime().getTime());
|
||||||
end.add(Calendar.MINUTE, 10);
|
end.add(Calendar.MINUTE, 10);
|
||||||
TimeRange t = new TimeRange(warning.getStartTime().getTime(),
|
TimeRange t = new TimeRange(warning.getStartTime()
|
||||||
end.getTime());
|
.getTime(), end.getTime());
|
||||||
if ((action == WarningAction.NEW || action == WarningAction.CON || action == WarningAction.EXT)
|
if ((action == WarningAction.NEW
|
||||||
|
|| action == WarningAction.CON || action == WarningAction.EXT)
|
||||||
&& t.contains(current.getTime())) {
|
&& t.contains(current.getTime())) {
|
||||||
rval.add(warning);
|
rval.add(warning);
|
||||||
} else if (action == WarningAction.CAN || action == WarningAction.EXP) {
|
} else if (action == WarningAction.CAN
|
||||||
|
|| action == WarningAction.EXP) {
|
||||||
rval.clear();
|
rval.clear();
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,7 +259,7 @@ public class CurrentWarnings {
|
||||||
for (AbstractWarningRecord warning : warnings) {
|
for (AbstractWarningRecord warning : warnings) {
|
||||||
if (getAction(warning.getAct()) == WarningAction.CON) {
|
if (getAction(warning.getAct()) == WarningAction.CON) {
|
||||||
if (rval != null) {
|
if (rval != null) {
|
||||||
//rval.setAct("CON");
|
// rval.setAct("CON");
|
||||||
rval.setGeometry(warning.getGeometry());
|
rval.setGeometry(warning.getGeometry());
|
||||||
rval.setCountyheader(warning.getCountyheader());
|
rval.setCountyheader(warning.getCountyheader());
|
||||||
rval.setUgczones(warning.getUgczones());
|
rval.setUgczones(warning.getUgczones());
|
||||||
|
@ -421,7 +427,10 @@ public class CurrentWarnings {
|
||||||
Map<String, RequestConstraint> constraints = new HashMap<String, RequestConstraint>();
|
Map<String, RequestConstraint> constraints = new HashMap<String, RequestConstraint>();
|
||||||
constraints.put("officeid", new RequestConstraint(officeId));
|
constraints.put("officeid", new RequestConstraint(officeId));
|
||||||
|
|
||||||
|
long t0 = System.currentTimeMillis();
|
||||||
List<AbstractWarningRecord> warnings = requestRecords(constraints);
|
List<AbstractWarningRecord> warnings = requestRecords(constraints);
|
||||||
|
System.out.println("Time to request CurrentWarnings records: "
|
||||||
|
+ (System.currentTimeMillis() - t0) + "ms");
|
||||||
processRecords(warnings);
|
processRecords(warnings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -472,6 +481,10 @@ public class CurrentWarnings {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dataURIs.size() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Map<String, RequestConstraint> constraints = new HashMap<String, RequestConstraint>();
|
Map<String, RequestConstraint> constraints = new HashMap<String, RequestConstraint>();
|
||||||
RequestConstraint constraint = new RequestConstraint(null,
|
RequestConstraint constraint = new RequestConstraint(null,
|
||||||
ConstraintType.IN);
|
ConstraintType.IN);
|
||||||
|
@ -534,25 +547,16 @@ public class CurrentWarnings {
|
||||||
private static List<AbstractWarningRecord> requestRecords(
|
private static List<AbstractWarningRecord> requestRecords(
|
||||||
Map<String, RequestConstraint> constraints) {
|
Map<String, RequestConstraint> constraints) {
|
||||||
List<AbstractWarningRecord> newRecords = new ArrayList<AbstractWarningRecord>();
|
List<AbstractWarningRecord> newRecords = new ArrayList<AbstractWarningRecord>();
|
||||||
Object[] resp;
|
|
||||||
LayerProperty lp = new LayerProperty();
|
|
||||||
try {
|
try {
|
||||||
String tableName = AnnotationUtil.getTableName(getWarningClass());
|
DbQueryRequest request = new DbQueryRequest();
|
||||||
|
request.setConstraints(constraints);
|
||||||
constraints.put("pluginName", new RequestConstraint(tableName));
|
request.setEntityClass(getWarningClass());
|
||||||
lp.setDesiredProduct(ResourceType.PLAN_VIEW);
|
DbQueryResponse response = (DbQueryResponse) ThriftClient
|
||||||
lp.setEntryQueryParameters(constraints, false);
|
.sendRequest(request);
|
||||||
|
newRecords.addAll(Arrays.asList(response
|
||||||
lp.setNumberOfImages(9999);
|
.getEntityObjects(AbstractWarningRecord.class)));
|
||||||
|
} catch (VizException e) {
|
||||||
String script = ScriptCreator.createScript(lp);
|
|
||||||
if (script != null) {
|
|
||||||
resp = Connector.getInstance().connect(script, null, 60000);
|
|
||||||
for (int i = 0; i < resp.length; i++) {
|
|
||||||
newRecords.add((AbstractWarningRecord) resp[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
statusHandler.handle(Priority.PROBLEM, "Error retreiving warnings",
|
statusHandler.handle(Priority.PROBLEM, "Error retreiving warnings",
|
||||||
e);
|
e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,8 @@ package com.raytheon.viz.warnings.rsc;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
|
@ -33,14 +33,10 @@ import com.raytheon.uf.common.dataplugin.warning.AbstractWarningRecord;
|
||||||
import com.raytheon.uf.common.dataplugin.warning.WarningRecord.WarningAction;
|
import com.raytheon.uf.common.dataplugin.warning.WarningRecord.WarningAction;
|
||||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
import com.raytheon.uf.common.time.DataTime;
|
import com.raytheon.uf.common.time.DataTime;
|
||||||
import com.raytheon.uf.common.time.SimulatedTime;
|
|
||||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||||
import com.raytheon.uf.viz.core.VizApp;
|
|
||||||
import com.raytheon.uf.viz.core.drawables.IDescriptor.FramesInfo;
|
import com.raytheon.uf.viz.core.drawables.IDescriptor.FramesInfo;
|
||||||
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
|
|
||||||
import com.raytheon.uf.viz.core.drawables.IWireframeShape;
|
import com.raytheon.uf.viz.core.drawables.IWireframeShape;
|
||||||
import com.raytheon.uf.viz.core.exception.VizException;
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
|
||||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||||
import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
|
import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
|
||||||
import com.raytheon.viz.core.rsc.jts.JTSCompiler;
|
import com.raytheon.viz.core.rsc.jts.JTSCompiler;
|
||||||
|
@ -70,132 +66,38 @@ import com.vividsolutions.jts.geom.Geometry;
|
||||||
|
|
||||||
public class WarningsResource extends AbstractWWAResource {
|
public class WarningsResource extends AbstractWWAResource {
|
||||||
|
|
||||||
protected static class RepaintHeartbeat extends TimerTask {
|
protected static class RefreshTimerTask extends TimerTask {
|
||||||
|
|
||||||
private final HashSet<AbstractVizResource<?, ?>> resourceSet = new HashSet<AbstractVizResource<?, ?>>();
|
private final Set<WarningsResource> resourceSet = new HashSet<WarningsResource>();
|
||||||
|
|
||||||
private boolean cancelled = false;
|
|
||||||
|
|
||||||
public RepaintHeartbeat() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* copy resources from old task, just in case some were added after it
|
|
||||||
* should have been replaced (threads are fun)
|
|
||||||
**/
|
|
||||||
public void copyResourceSet(RepaintHeartbeat oldTask) {
|
|
||||||
// copy resources, in case one was added after a cancel
|
|
||||||
Set<AbstractVizResource<?, ?>> oldResourceSet = oldTask
|
|
||||||
.getResourceSet();
|
|
||||||
synchronized (oldResourceSet) {
|
|
||||||
for (AbstractVizResource<?, ?> rsc : oldResourceSet) {
|
|
||||||
this.addResource(rsc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<AbstractVizResource<?, ?>> getResourceSet() {
|
|
||||||
return resourceSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
// get the unique displays from all the added resources
|
List<WarningsResource> rscs;
|
||||||
ArrayList<IRenderableDisplay> displaysToRefresh = new ArrayList<IRenderableDisplay>(
|
|
||||||
1);
|
|
||||||
synchronized (resourceSet) {
|
synchronized (resourceSet) {
|
||||||
for (AbstractVizResource<?, ?> rsc : resourceSet) {
|
rscs = new ArrayList<WarningsResource>(resourceSet);
|
||||||
try {
|
|
||||||
IRenderableDisplay disp = rsc.getDescriptor()
|
|
||||||
.getRenderableDisplay();
|
|
||||||
if (!displaysToRefresh.contains(disp)) {
|
|
||||||
displaysToRefresh.add(disp);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
statusHandler
|
|
||||||
.handle(Priority.PROBLEM,
|
|
||||||
"Encountered error during Warnings Heartbeat, continuing with other Warnings ",
|
|
||||||
e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
for (WarningsResource rsc : rscs) {
|
||||||
// create an array with final modifier
|
rsc.issueRefresh();
|
||||||
final IRenderableDisplay[] refreshList = displaysToRefresh
|
|
||||||
.toArray(new IRenderableDisplay[displaysToRefresh.size()]);
|
|
||||||
|
|
||||||
// execute refersh in UI thread
|
|
||||||
VizApp.runAsync(new Runnable() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
for (IRenderableDisplay disp : refreshList) {
|
|
||||||
disp.refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
// cancel the task if there are no more resources
|
|
||||||
boolean cancel = false;
|
|
||||||
synchronized (resourceSet) {
|
|
||||||
if (resourceSet.size() < 1) {
|
|
||||||
cancel = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cancel) {
|
|
||||||
doCancel();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addResource(AbstractVizResource<?, ?> rsc) {
|
public void addResource(WarningsResource rsc) {
|
||||||
// if task has no resources then it needs to be started when the
|
|
||||||
// first is added
|
|
||||||
boolean start = false;
|
|
||||||
synchronized (resourceSet) {
|
synchronized (resourceSet) {
|
||||||
// if this is the first resource added to an empty set start the
|
|
||||||
// timer
|
|
||||||
if (resourceSet.size() < 1) {
|
|
||||||
start = true;
|
|
||||||
}
|
|
||||||
resourceSet.add(rsc);
|
resourceSet.add(rsc);
|
||||||
}
|
}
|
||||||
if (start) {
|
|
||||||
WarningsResource.scheduleHeartBeat();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeResource(AbstractVizResource<?, ?> rsc) {
|
public void removeResource(WarningsResource rsc) {
|
||||||
synchronized (resourceSet) {
|
synchronized (resourceSet) {
|
||||||
resourceSet.remove(rsc);
|
resourceSet.remove(rsc);
|
||||||
// cancel the task if there are no more resources
|
|
||||||
if (resourceSet.size() < 1) {
|
|
||||||
doCancel();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doCancel() {
|
|
||||||
synchronized (heartBeatChangeLock) {
|
|
||||||
if (cancelled == false) {
|
|
||||||
cancelled = true;
|
|
||||||
heartBeatTimer.cancel();
|
|
||||||
heartBeatTask = new RepaintHeartbeat();
|
|
||||||
heartBeatTimer = new Timer();
|
|
||||||
heartBeatTask.copyResourceSet(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** lock when changing heartBeatTask **/
|
protected static RefreshTimerTask refreshTask;
|
||||||
protected static final Object heartBeatChangeLock = new Object();
|
|
||||||
|
|
||||||
protected static RepaintHeartbeat heartBeatTask = null;
|
protected static Timer refreshTimer;
|
||||||
|
|
||||||
protected static Timer heartBeatTimer = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -207,14 +109,13 @@ public class WarningsResource extends AbstractWWAResource {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initInternal(IGraphicsTarget target) throws VizException {
|
protected void initInternal(IGraphicsTarget target) throws VizException {
|
||||||
DataTime earliest = this.descriptor.getFramesInfo().getFrameTimes()[0];
|
FramesInfo info = descriptor.getFramesInfo();
|
||||||
requestData(earliest);
|
DataTime[] times = info.getFrameTimes();
|
||||||
synchronized (heartBeatChangeLock) {
|
if (times != null && times.length > 0) {
|
||||||
if (heartBeatTask == null) {
|
// Request data for "earliest" time
|
||||||
heartBeatTask = new RepaintHeartbeat();
|
requestData(times[0]);
|
||||||
}
|
|
||||||
heartBeatTask.addResource(this);
|
|
||||||
}
|
}
|
||||||
|
scheduleRefreshTask(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -224,9 +125,7 @@ public class WarningsResource extends AbstractWWAResource {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void disposeInternal() {
|
protected void disposeInternal() {
|
||||||
synchronized (heartBeatChangeLock) {
|
cancelRefreshTask(this);
|
||||||
heartBeatTask.removeResource(this);
|
|
||||||
}
|
|
||||||
for (WarningEntry entry : entryMap.values()) {
|
for (WarningEntry entry : entryMap.values()) {
|
||||||
if (entry.shadedShape != null) {
|
if (entry.shadedShape != null) {
|
||||||
entry.shadedShape.dispose();
|
entry.shadedShape.dispose();
|
||||||
|
@ -404,43 +303,45 @@ public class WarningsResource extends AbstractWWAResource {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cancel the heart beat timer task
|
||||||
|
*
|
||||||
|
* @param resource
|
||||||
|
*/
|
||||||
|
protected static void cancelRefreshTask(WarningsResource resource) {
|
||||||
|
synchronized (RefreshTimerTask.class) {
|
||||||
|
if (refreshTask != null) {
|
||||||
|
refreshTask.removeResource(resource);
|
||||||
|
if (refreshTask.resourceSet.isEmpty()) {
|
||||||
|
refreshTimer.cancel();
|
||||||
|
refreshTimer = null;
|
||||||
|
refreshTask = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* schedule the heart beat for the next minute
|
* schedule the heart beat for the next minute
|
||||||
*/
|
*/
|
||||||
protected static void scheduleHeartBeat() {
|
protected static void scheduleRefreshTask(WarningsResource resource) {
|
||||||
// get simulated time
|
synchronized (RefreshTimerTask.class) {
|
||||||
Date currentTime = SimulatedTime.getSystemTime().getTime();
|
if (refreshTask == null) {
|
||||||
// get a calendar
|
refreshTimer = new Timer(true);
|
||||||
Calendar now = Calendar.getInstance();
|
refreshTask = new RefreshTimerTask();
|
||||||
// set calendar time to simulated time
|
|
||||||
now.setTime(currentTime);
|
// get a calendar
|
||||||
// add one to the minutes field
|
Calendar now = Calendar.getInstance();
|
||||||
now.add(Calendar.MINUTE, 1);
|
// add one to the minutes field
|
||||||
// reset second and milisecond to 0
|
now.add(Calendar.MINUTE, 1);
|
||||||
now.set(Calendar.SECOND, 0);
|
// reset second and milisecond to 0
|
||||||
now.set(Calendar.MILLISECOND, 0);
|
now.set(Calendar.SECOND, 0);
|
||||||
// schedule task to fire every minute
|
now.set(Calendar.MILLISECOND, 0);
|
||||||
synchronized (heartBeatChangeLock) {
|
|
||||||
try {
|
refreshTimer.scheduleAtFixedRate(refreshTask, now.getTime(),
|
||||||
if (heartBeatTimer == null) {
|
60 * 1000);
|
||||||
heartBeatTimer = new Timer();
|
|
||||||
}
|
|
||||||
// schedule on the minute every minute
|
|
||||||
heartBeatTimer.schedule(heartBeatTask, now.getTime(),
|
|
||||||
1 * 60 * 1000);
|
|
||||||
} catch (Exception e) {
|
|
||||||
try {
|
|
||||||
heartBeatTimer.cancel();
|
|
||||||
} catch (Exception e2) {
|
|
||||||
// ignore, we just want to make sure the timer is cancelled
|
|
||||||
} finally {
|
|
||||||
// create a new task if there was an error when scheduling
|
|
||||||
heartBeatTask = new RepaintHeartbeat();
|
|
||||||
heartBeatTimer = new Timer();
|
|
||||||
}
|
|
||||||
statusHandler.handle(Priority.SIGNIFICANT,
|
|
||||||
"Error scheduling warnings heart beat ", e);
|
|
||||||
}
|
}
|
||||||
|
refreshTask.addResource(resource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -192,6 +192,9 @@ public class WatchesResource extends AbstractWWAResource {
|
||||||
JTSCompiler jtsCompiler = new JTSCompiler(ss, null,
|
JTSCompiler jtsCompiler = new JTSCompiler(ss, null,
|
||||||
this.descriptor, PointStyle.CROSS);
|
this.descriptor, PointStyle.CROSS);
|
||||||
jtsCompiler.handle(geo, color);
|
jtsCompiler.handle(geo, color);
|
||||||
|
if (record.getPhen() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
ss.setFillPattern(FillPatterns.getGLPattern(record.getPhen()
|
ss.setFillPattern(FillPatterns.getGLPattern(record.getPhen()
|
||||||
.equals("TO") ? "VERTICAL" : "HORIZONTAL"));
|
.equals("TO") ? "VERTICAL" : "HORIZONTAL"));
|
||||||
ss.compile();
|
ss.compile();
|
||||||
|
|
|
@ -605,7 +605,7 @@ HRAP = ('HRAP', POLAR_STEREOGRAPHIC,
|
||||||
(-119.036, 23.097), (-75.945396, 53.480095),
|
(-119.036, 23.097), (-75.945396, 53.480095),
|
||||||
(0.0, 0.0), 0.0, 0.0, (1, 1), (801, 881), 0.0, 0.0, -105.0)
|
(0.0, 0.0), 0.0, 0.0, (1, 1), (801, 881), 0.0, 0.0, -105.0)
|
||||||
|
|
||||||
NDFD_Oceanic_10K = ('NDFD Oceanic 10km', MERCATOR,
|
NDFD_Oceanic_10K = ('NDFD_Oceanic_10km', MERCATOR,
|
||||||
(-230.094, -30.4192), (10.71, 67.03),
|
(-230.094, -30.4192), (10.71, 67.03),
|
||||||
(0.0, 0.0), 0.0, 0.0, (1, 1), (2517, 1289), 0.0, -109.962, 0.0)
|
(0.0, 0.0), 0.0, 0.0, (1, 1), (2517, 1289), 0.0, -109.962, 0.0)
|
||||||
|
|
||||||
|
|
|
@ -164,7 +164,7 @@ public class GfeScriptExecutor {
|
||||||
}
|
}
|
||||||
|
|
||||||
String fileContents = getFileContents(xmlFileName);
|
String fileContents = getFileContents(xmlFileName);
|
||||||
Pattern pat = Pattern.compile("<site>([A-Z]{3})</site>");
|
Pattern pat = Pattern.compile("<site>(.*?)</site>");
|
||||||
Matcher matcher = pat.matcher(fileContents);
|
Matcher matcher = pat.matcher(fileContents);
|
||||||
|
|
||||||
while (matcher.find()) {
|
while (matcher.find()) {
|
||||||
|
|
|
@ -334,4 +334,5 @@ com.raytheon.uf.common.dataplugin.shef.tables.YuniqueId
|
||||||
com.raytheon.uf.common.dataplugin.shef.tables.Zoneinfo
|
com.raytheon.uf.common.dataplugin.shef.tables.Zoneinfo
|
||||||
com.raytheon.uf.common.dataplugin.shef.tables.ZoneinfoId
|
com.raytheon.uf.common.dataplugin.shef.tables.ZoneinfoId
|
||||||
com.raytheon.uf.common.dataplugin.shef.tables.Zonenum
|
com.raytheon.uf.common.dataplugin.shef.tables.Zonenum
|
||||||
com.raytheon.uf.common.dataplugin.shef.tables.ZonenumId
|
com.raytheon.uf.common.dataplugin.shef.tables.ZonenumId
|
||||||
|
com.raytheon.edex.transform.shef.MetarToShefFilter
|
|
@ -28,7 +28,7 @@
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="metarToShefFilter"
|
<bean id="metarToShefFilter"
|
||||||
class="com.raytheon.uf.edex.decodertools.core.filterimpl.PluginDataObjectFilter">
|
class="com.raytheon.edex.transform.shef.MetarToShefFilter">
|
||||||
<constructor-arg type="java.lang.String" value="metarToShefFilter.xml" />
|
<constructor-arg type="java.lang.String" value="metarToShefFilter.xml" />
|
||||||
<constructor-arg type="java.lang.String" value="SITE" />
|
<constructor-arg type="java.lang.String" value="SITE" />
|
||||||
</bean>
|
</bean>
|
||||||
|
@ -133,7 +133,7 @@
|
||||||
<pipeline>
|
<pipeline>
|
||||||
<split streaming="true">
|
<split streaming="true">
|
||||||
<method bean="metarToShef" method="iterate" />
|
<method bean="metarToShef" method="iterate" />
|
||||||
<bean ref="metarToShef" method="transform" />
|
<bean ref="metarToShef" method="transformMetar" />
|
||||||
<to
|
<to
|
||||||
uri="jms-generic:queue:Ingest.ShefStaged?destinationResolver=#qpidDurableResolver" />
|
uri="jms-generic:queue:Ingest.ShefStaged?destinationResolver=#qpidDurableResolver" />
|
||||||
</split>
|
</split>
|
||||||
|
|
|
@ -483,7 +483,7 @@ public abstract class AbstractShefTransformer<T extends PluginDataObject>
|
||||||
/**
|
/**
|
||||||
* Create, or recreate and validate the shef archive directory.
|
* Create, or recreate and validate the shef archive directory.
|
||||||
*/
|
*/
|
||||||
private void configureArchiveDir() {
|
protected void configureArchiveDir() {
|
||||||
archiveEnabled = AppsDefaults.getInstance().getBoolean(OPT_ARC_ENABLE,
|
archiveEnabled = AppsDefaults.getInstance().getBoolean(OPT_ARC_ENABLE,
|
||||||
false);
|
false);
|
||||||
String arcDir = AppsDefaults.getInstance().getToken(OPT_SHEF_ARC_DIR);
|
String arcDir = AppsDefaults.getInstance().getToken(OPT_SHEF_ARC_DIR);
|
||||||
|
|
|
@ -0,0 +1,286 @@
|
||||||
|
/**
|
||||||
|
* 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.edex.transform.shef;
|
||||||
|
|
||||||
|
import static com.raytheon.uf.common.localization.LocalizationContext.LocalizationType.EDEX_STATIC;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.xml.bind.JAXBException;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||||
|
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.LocalizationContext.LocalizationLevel;
|
||||||
|
import com.raytheon.uf.common.serialization.SerializationUtil;
|
||||||
|
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||||
|
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||||
|
import com.raytheon.uf.common.ohd.AppsDefaults;
|
||||||
|
//import com.raytheon.edex.transform.shef.MetarToShefTransformer;
|
||||||
|
import com.raytheon.uf.edex.decodertools.core.filterimpl.AbstractFilterElement;
|
||||||
|
import com.raytheon.uf.edex.decodertools.core.filterimpl.AbstractObsFilter;
|
||||||
|
import com.raytheon.uf.edex.decodertools.core.filterimpl.PluginDataObjectFilter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use information in metarToShefFilter.xml, MetarToShefFilter filters out
|
||||||
|
* the metar messages before send the message to MetarToShefTransformer to
|
||||||
|
* encode to a SHEF message.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ---------- ------- -------- --------------------------
|
||||||
|
* 1/10/2013 15497 wkwock Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author wkwock
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
@XmlRootElement
|
||||||
|
@XmlAccessorType(XmlAccessType.NONE)
|
||||||
|
@DynamicSerialize
|
||||||
|
public class MetarToShefFilter {
|
||||||
|
@XmlElement
|
||||||
|
@DynamicSerializeElement
|
||||||
|
protected List<MetarToShefRun> metarToShefRun = new ArrayList<MetarToShefRun>();
|
||||||
|
|
||||||
|
private static final String ERROR_1_FMT = "Could not create {%s} context for file \"%s\"";
|
||||||
|
|
||||||
|
private static final String ERROR_2_FMT = "File %s does not exist";
|
||||||
|
|
||||||
|
private static final String METAR_CFG = "metar.cfg";
|
||||||
|
|
||||||
|
public static final String FILTERS_DIR = "plugin-filters";
|
||||||
|
|
||||||
|
private String metarToShefOptions = AppsDefaults.getInstance().getToken("metar2shef_options");
|
||||||
|
|
||||||
|
private Log logger = LogFactory.getLog(getClass());
|
||||||
|
|
||||||
|
private String filterConfigFile = null;
|
||||||
|
|
||||||
|
public MetarToShefFilter() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public MetarToShefFilter(String configFile, String localContext) {
|
||||||
|
filterConfigFile = configFile;
|
||||||
|
try {
|
||||||
|
File filterDir = null;
|
||||||
|
IPathManager manager = PathManagerFactory.getPathManager();
|
||||||
|
if(manager != null) {
|
||||||
|
LocalizationContext context = manager.getContext(EDEX_STATIC, LocalizationLevel.valueOf(localContext));
|
||||||
|
if(context != null) {
|
||||||
|
filterDir = manager.getFile(context, FILTERS_DIR);
|
||||||
|
if (filterDir.exists()) {
|
||||||
|
File srcFile = new File(filterDir, filterConfigFile);
|
||||||
|
|
||||||
|
byte[] data = new byte[(int) srcFile.length()];
|
||||||
|
|
||||||
|
InputStream stream = getInputStream(srcFile);
|
||||||
|
try {
|
||||||
|
stream.read(data);
|
||||||
|
stream.close();
|
||||||
|
Object obj = SerializationUtil
|
||||||
|
.unmarshalFromXml(new String(data));
|
||||||
|
if (obj instanceof PluginDataObjectFilter){
|
||||||
|
logger.info("Found "+filterConfigFile+" is PluginDataObjectFilter");
|
||||||
|
PluginDataObjectFilter pdof=(PluginDataObjectFilter) obj;
|
||||||
|
MetarToShefRun mtsr= new MetarToShefRun();
|
||||||
|
mtsr.setConfigFileName(METAR_CFG);
|
||||||
|
mtsr.setMetarToShefOptions(metarToShefOptions);
|
||||||
|
mtsr.setFilterElements(pdof.getFilterElements());
|
||||||
|
mtsr.setFilterName(pdof.getFilterName());
|
||||||
|
this.metarToShefRun.add(mtsr);
|
||||||
|
}else if (obj instanceof MetarToShefFilter) {
|
||||||
|
MetarToShefFilter filter = (MetarToShefFilter) obj;
|
||||||
|
this.metarToShefRun=filter.metarToShefRun;
|
||||||
|
logger.info("Found "+filterConfigFile+" is MetarToShefFilter");
|
||||||
|
}else {
|
||||||
|
logger.error("Found "+filterConfigFile+" is "+obj.getClass().getCanonicalName());
|
||||||
|
createDummyFilter();
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
logger.error("Unable to read filter config", e);
|
||||||
|
} catch (JAXBException e) {
|
||||||
|
logger.error("Unable to unmarshall filter config", e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logger.error(String.format(ERROR_2_FMT,filterDir.getPath()));
|
||||||
|
createDummyFilter();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logger.error(String.format(ERROR_1_FMT, localContext,configFile));
|
||||||
|
createDummyFilter();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Could not create PathManager
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(
|
||||||
|
"Error creating filter.", e);
|
||||||
|
createDummyFilter();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (MetarToShefRun mtsr: metarToShefRun){
|
||||||
|
logger.info("Filter name = " + mtsr.getFilterName()+" with config file: "+mtsr.getConfigFileName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private PluginDataObject[] filterARun(PluginDataObject[] reports, List<AbstractFilterElement> filterElements) {
|
||||||
|
int reportCount = 0;
|
||||||
|
if (reports != null) {
|
||||||
|
|
||||||
|
|
||||||
|
for (int i = 0; i < reports.length; i++) {
|
||||||
|
PluginDataObject r = null;
|
||||||
|
boolean keep = true;
|
||||||
|
for (AbstractFilterElement element : filterElements) {
|
||||||
|
r = element.filter(reports[i]);
|
||||||
|
|
||||||
|
// Only allow keep to be set to true. Once true it stays that way.
|
||||||
|
if(AbstractObsFilter.INCLUDE_TYPE.equals(element.getFilterType())) {
|
||||||
|
// Did the filter pass?
|
||||||
|
if(r == null) {
|
||||||
|
// If we fail an element, exit now.
|
||||||
|
keep = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if(AbstractObsFilter.EXCLUDE_TYPE.equals(element.getFilterType())) {
|
||||||
|
if(r != null) {
|
||||||
|
// There was a match, so we want to remove this item.
|
||||||
|
keep = false;
|
||||||
|
// And there's no reason for further checks.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (keep) {
|
||||||
|
reportCount++;
|
||||||
|
} else {
|
||||||
|
reports[i] = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (reportCount == 0) {
|
||||||
|
reports = new PluginDataObject[0];
|
||||||
|
} else {
|
||||||
|
PluginDataObject[] newReports = new PluginDataObject[reportCount];
|
||||||
|
int i = 0;
|
||||||
|
// Copy in the reports that passed filtering.
|
||||||
|
for (PluginDataObject report : reports) {
|
||||||
|
if (report != null) {
|
||||||
|
newReports[i++] = report;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reports = newReports;
|
||||||
|
}
|
||||||
|
return reports;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply the list of filters against given input data.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
// @Override
|
||||||
|
public PluginDataObject[] filter(PluginDataObject[] reports) {
|
||||||
|
PluginDataObject[] resultRpt=null;
|
||||||
|
for (MetarToShefRun mtsr : metarToShefRun) {
|
||||||
|
PluginDataObject[] tmpRprts = reports.clone();
|
||||||
|
resultRpt=filterARun(tmpRprts,mtsr.getFilterElements());
|
||||||
|
if (resultRpt!=null && resultRpt.length>=1) {
|
||||||
|
logger.info("Report matchs in filter "+mtsr.getFilterName());
|
||||||
|
MetarToShefTransformer.setCfgNOption(mtsr.getConfigFileName(),mtsr.getMetarToShefOptions());
|
||||||
|
break ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return resultRpt;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createDummyFilter() {
|
||||||
|
MetarToShefRun mtsr= new MetarToShefRun();
|
||||||
|
mtsr.setConfigFileName(METAR_CFG);
|
||||||
|
mtsr.setMetarToShefOptions(metarToShefOptions);
|
||||||
|
|
||||||
|
// Add a dummy element.
|
||||||
|
AbstractFilterElement dummy = new AbstractFilterElement() {
|
||||||
|
@Override
|
||||||
|
public PluginDataObject filter(PluginDataObject report) {
|
||||||
|
return report;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
dummy.setFilterType(AbstractObsFilter.INCLUDE_TYPE);
|
||||||
|
mtsr.getFilterElements().set(0, dummy);
|
||||||
|
mtsr.setFilterName("Created Pass-All filter");
|
||||||
|
this.metarToShefRun.add(mtsr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param file
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private static FileInputStream getInputStream(File file) {
|
||||||
|
FileInputStream fis = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
fis = new FileInputStream(file);
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return fis;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addMetarToShefRun(MetarToShefRun element) {
|
||||||
|
metarToShefRun.add(element);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<MetarToShefRun> getMetarToShefRun() {
|
||||||
|
return metarToShefRun;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param elements
|
||||||
|
*/
|
||||||
|
public void setMetarToShefRun(List<MetarToShefRun> elements) {
|
||||||
|
metarToShefRun = elements;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,150 @@
|
||||||
|
package com.raytheon.edex.transform.shef;
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
**/
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
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 com.raytheon.uf.common.serialization.ISerializableObject;
|
||||||
|
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||||
|
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||||
|
import com.raytheon.uf.edex.decodertools.core.filterimpl.AbstractFilterElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MetarToShefRun is for the metarToShefRun tag in Metar2ShefFilter tag
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ---------- ------- -------- --------------------------
|
||||||
|
* 1/10/2013 15497 wkwock Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author wkwock
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
@XmlAccessorType(XmlAccessType.NONE)
|
||||||
|
@DynamicSerialize
|
||||||
|
public class MetarToShefRun implements ISerializableObject{
|
||||||
|
public static final String INCLUDE_TYPE = "INCLUDE";
|
||||||
|
|
||||||
|
public static final String EXCLUDE_TYPE = "EXCLUDE";
|
||||||
|
@XmlElement
|
||||||
|
@DynamicSerializeElement
|
||||||
|
private String configFileName;
|
||||||
|
|
||||||
|
@XmlElement
|
||||||
|
@DynamicSerializeElement
|
||||||
|
private String metarToShefOptions;
|
||||||
|
|
||||||
|
@XmlElement
|
||||||
|
@DynamicSerializeElement
|
||||||
|
protected List<AbstractFilterElement> filterElements = new ArrayList<AbstractFilterElement>();
|
||||||
|
|
||||||
|
@XmlElement
|
||||||
|
@DynamicSerializeElement
|
||||||
|
private String filterName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param filterFile
|
||||||
|
*/
|
||||||
|
void createFilter(File filterFile) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getConfigFileName() {
|
||||||
|
return configFileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
*/
|
||||||
|
public void setConfigFileName(String name) {
|
||||||
|
configFileName = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getMetarToShefOptions() {
|
||||||
|
return metarToShefOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
*/
|
||||||
|
public void setMetarToShefOptions(String name) {
|
||||||
|
metarToShefOptions = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void addFilterElement(AbstractFilterElement element) {
|
||||||
|
filterElements.add(element);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<AbstractFilterElement> getFilterElements() {
|
||||||
|
return filterElements;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param elements
|
||||||
|
*/
|
||||||
|
public void setFilterElements(List<AbstractFilterElement> elements) {
|
||||||
|
filterElements = elements;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getFilterName() {
|
||||||
|
return filterName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
*/
|
||||||
|
public void setFilterName(String name) {
|
||||||
|
filterName = name;
|
||||||
|
}
|
||||||
|
}
|
|
@ -80,6 +80,10 @@ public class MetarToShefTransformer extends
|
||||||
private static final int P1_MIN = 50;
|
private static final int P1_MIN = 50;
|
||||||
private static final int P2_MAX = 5;
|
private static final int P2_MAX = 5;
|
||||||
|
|
||||||
|
private static String cfgFileName="metar.cfg";
|
||||||
|
private static String cmdLnOptions="";
|
||||||
|
private static boolean refreshOptions=true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct an instance of this transformer.
|
* Construct an instance of this transformer.
|
||||||
* @param cmdLine Command line options that may be used if these
|
* @param cmdLine Command line options that may be used if these
|
||||||
|
@ -411,4 +415,24 @@ public class MetarToShefTransformer extends
|
||||||
}
|
}
|
||||||
return sb;
|
return sb;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public final byte[] transformMetar(MetarRecord report, Headers headers)
|
||||||
|
throws TransformerException {
|
||||||
|
if (refreshOptions) {
|
||||||
|
logger.info("Metar to SHEF now use config file: "+cfgFileName+" with options:"+cmdLnOptions);
|
||||||
|
options.setCfgFileName(cfgFileName);
|
||||||
|
options.updateCommandLine(cmdLnOptions);
|
||||||
|
options.updateOptions();
|
||||||
|
refreshOptions=false;
|
||||||
|
}
|
||||||
|
configureArchiveDir();
|
||||||
|
|
||||||
|
return transformReport(report, headers);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setCfgNOption (String cfg, String options){
|
||||||
|
cfgFileName=cfg;
|
||||||
|
cmdLnOptions=options;
|
||||||
|
refreshOptions=true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -179,6 +179,7 @@ public class ObsToSHEFOptions {
|
||||||
|
|
||||||
public static final String OPT_NO_HR_TRACE = "optNoHourTrace";
|
public static final String OPT_NO_HR_TRACE = "optNoHourTrace";
|
||||||
|
|
||||||
|
private String cfgFileName=null;
|
||||||
// private static class PCReset {
|
// private static class PCReset {
|
||||||
//
|
//
|
||||||
// private final String stationId;
|
// private final String stationId;
|
||||||
|
@ -408,7 +409,11 @@ public class ObsToSHEFOptions {
|
||||||
initOptions();
|
initOptions();
|
||||||
parseCommandLine(cmdLine);
|
parseCommandLine(cmdLine);
|
||||||
if (useLocalized) {
|
if (useLocalized) {
|
||||||
readConfig(METAR_CFG, optConfigContext);
|
if (cfgFileName==null){
|
||||||
|
readConfig(METAR_CFG, optConfigContext);
|
||||||
|
} else {
|
||||||
|
readConfig(cfgFileName, optConfigContext);
|
||||||
|
}
|
||||||
updateTime = System.currentTimeMillis();
|
updateTime = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
localized = useLocalized;
|
localized = useLocalized;
|
||||||
|
@ -843,7 +848,11 @@ public class ObsToSHEFOptions {
|
||||||
long cTime = System.currentTimeMillis() - updateTime;
|
long cTime = System.currentTimeMillis() - updateTime;
|
||||||
if (cTime > UPDATE_DELTA) {
|
if (cTime > UPDATE_DELTA) {
|
||||||
if (loaded && localized) {
|
if (loaded && localized) {
|
||||||
readConfig(METAR_CFG, optConfigContext);
|
if (cfgFileName==null) {
|
||||||
|
readConfig(METAR_CFG, optConfigContext);
|
||||||
|
} else {
|
||||||
|
readConfig(cfgFileName, optConfigContext);
|
||||||
|
}
|
||||||
updateTime = System.currentTimeMillis();
|
updateTime = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -874,7 +883,11 @@ public class ObsToSHEFOptions {
|
||||||
if (SITE_CONTEXT.equals(optConfigContext)) {
|
if (SITE_CONTEXT.equals(optConfigContext)) {
|
||||||
// Retry from a base context.
|
// Retry from a base context.
|
||||||
optConfigContext = BASE_CONTEXT;
|
optConfigContext = BASE_CONTEXT;
|
||||||
readConfig(METAR_CFG, optConfigContext);
|
if (cfgFileName==null) {
|
||||||
|
readConfig(METAR_CFG, optConfigContext);
|
||||||
|
}else{
|
||||||
|
readConfig(cfgFileName, optConfigContext);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -973,6 +986,10 @@ public class ObsToSHEFOptions {
|
||||||
loaded = true;
|
loaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setCfgFileName(String fileName) {
|
||||||
|
cfgFileName=fileName;
|
||||||
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
|
@ -27,23 +27,25 @@ import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
|
||||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Response object for the GraphDataRequest.
|
* Response object for the GraphDataRequest.
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Nov 25, 2012 1269 lvenable Initial creation.
|
* Nov 25, 2012 1269 lvenable Initial creation.
|
||||||
* Dec 06, 2012 1397 djohnson Add dynamic serialize class annotation.
|
* Dec 06, 2012 1397 djohnson Add dynamic serialize class annotation.
|
||||||
*
|
* Jan 25, 2013 1528 djohnson Subscription priority is now an enum.
|
||||||
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author lvenable
|
* @author lvenable
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
@ -55,7 +57,7 @@ public class BandwidthGraphData {
|
||||||
|
|
||||||
/** Subscription Name -> Subscription Priority */
|
/** Subscription Name -> Subscription Priority */
|
||||||
@DynamicSerializeElement
|
@DynamicSerializeElement
|
||||||
private Map<String, Integer> priorityMap;
|
private Map<String, SubscriptionPriority> priorityMap;
|
||||||
|
|
||||||
/** Bin duration in minutes */
|
/** Bin duration in minutes */
|
||||||
@DynamicSerializeElement
|
@DynamicSerializeElement
|
||||||
|
@ -81,7 +83,7 @@ public class BandwidthGraphData {
|
||||||
public BandwidthGraphData(int binTimeMins) {
|
public BandwidthGraphData(int binTimeMins) {
|
||||||
this.binTimeInMins = binTimeMins;
|
this.binTimeInMins = binTimeMins;
|
||||||
dataMap = new HashMap<String, List<TimeWindowData>>();
|
dataMap = new HashMap<String, List<TimeWindowData>>();
|
||||||
priorityMap = new HashMap<String, Integer>();
|
priorityMap = new HashMap<String, SubscriptionPriority>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -102,7 +104,7 @@ public class BandwidthGraphData {
|
||||||
/**
|
/**
|
||||||
* @return the priorityMap
|
* @return the priorityMap
|
||||||
*/
|
*/
|
||||||
public Map<String, Integer> getPriorityMap() {
|
public Map<String, SubscriptionPriority> getPriorityMap() {
|
||||||
return priorityMap;
|
return priorityMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +112,7 @@ public class BandwidthGraphData {
|
||||||
* @param priorityMap
|
* @param priorityMap
|
||||||
* the priorityMap to set
|
* the priorityMap to set
|
||||||
*/
|
*/
|
||||||
public void setPriorityMap(Map<String, Integer> priorityMap) {
|
public void setPriorityMap(Map<String, SubscriptionPriority> priorityMap) {
|
||||||
this.priorityMap = priorityMap;
|
this.priorityMap = priorityMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +147,8 @@ public class BandwidthGraphData {
|
||||||
* @param priority
|
* @param priority
|
||||||
* @param dataArray
|
* @param dataArray
|
||||||
*/
|
*/
|
||||||
public void addGraphDataArray(String subscriptionName, int priority,
|
public void addGraphDataArray(String subscriptionName,
|
||||||
|
SubscriptionPriority priority,
|
||||||
List<TimeWindowData> dataArray) {
|
List<TimeWindowData> dataArray) {
|
||||||
dataMap.put(subscriptionName, dataArray);
|
dataMap.put(subscriptionName, dataArray);
|
||||||
priorityMap.put(subscriptionName, priority);
|
priorityMap.put(subscriptionName, priority);
|
||||||
|
@ -206,14 +209,15 @@ public class BandwidthGraphData {
|
||||||
* The subscription name.
|
* The subscription name.
|
||||||
* @return The priority number.
|
* @return The priority number.
|
||||||
*/
|
*/
|
||||||
public int getPriority(String subscriptionName) {
|
public SubscriptionPriority getPriority(String subscriptionName) {
|
||||||
if (priorityMap.containsKey(subscriptionName)) {
|
if (priorityMap.containsKey(subscriptionName)) {
|
||||||
return priorityMap.get(subscriptionName);
|
return priorityMap.get(subscriptionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This should never occur. A low priority number is being return rather
|
// This should never occur.
|
||||||
// than a null.
|
throw new IllegalArgumentException(
|
||||||
return 99;
|
"Unable to find a priority for subscription ["
|
||||||
|
+ subscriptionName + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -31,6 +31,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||||
* Code clean up.
|
* Code clean up.
|
||||||
* Set 06, 2012 1121 mpduff Added a unique key.
|
* Set 06, 2012 1121 mpduff Added a unique key.
|
||||||
* Nov 19, 2012 1166 djohnson Clean up JAXB representation of registry objects.
|
* Nov 19, 2012 1166 djohnson Clean up JAXB representation of registry objects.
|
||||||
|
* Jan 24, 2013 1527 dhladky Changed 0DEG to FRZ
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -110,7 +111,7 @@ public class DataLevelType implements ISerializableObject, Serializable {
|
||||||
"Cloud Level", 110), SIGL("sigma", "Sigma Level", 111), PVL(
|
"Cloud Level", 110), SIGL("sigma", "Sigma Level", 111), PVL(
|
||||||
"pv", "PV Level", 111), CTL("top", "Top Level", 112), MSL(
|
"pv", "PV Level", 111), CTL("top", "Top Level", 112), MSL(
|
||||||
"mean", "Mean Sea Level", 113), EA("entire",
|
"mean", "Mean Sea Level", 113), EA("entire",
|
||||||
"Entire Atmosphere (As Single Layer)", 114), ODEG("0c",
|
"Entire Atmosphere (As Single Layer)", 114), FRZ("0c",
|
||||||
"0c isotherm", 115), LCY("low", "Low Cloud Bottom Level", 116), MCY(
|
"0c isotherm", 115), LCY("low", "Low Cloud Bottom Level", 116), MCY(
|
||||||
"middle", "Middle Cloud Level", 117), HCY("high",
|
"middle", "Middle Cloud Level", 117), HCY("high",
|
||||||
"High Cloud Level", 118), PBL("planetary",
|
"High Cloud Level", 118), PBL("planetary",
|
||||||
|
@ -175,11 +176,8 @@ public class DataLevelType implements ISerializableObject, Serializable {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// special case since enums can't start with integers
|
if (rval == LevelType.U || rval == LevelType.V) {
|
||||||
if (rval == LevelType.ODEG) {
|
|
||||||
return "0DEG";
|
|
||||||
} else if (rval == LevelType.U || rval == LevelType.V) {
|
|
||||||
return LevelType.MAXW.toString();
|
return LevelType.MAXW.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||||
* Feb 08, 2011 191 dhladky Initial creation
|
* Feb 08, 2011 191 dhladky Initial creation
|
||||||
* Jul 24, 2012 955 djohnson Use List instead of ArrayList.
|
* Jul 24, 2012 955 djohnson Use List instead of ArrayList.
|
||||||
* Nov 19, 2012 1166 djohnson Clean up JAXB representation of registry objects.
|
* Nov 19, 2012 1166 djohnson Clean up JAXB representation of registry objects.
|
||||||
|
* Jan 28, 2013 1530 djohnson Never return null for selected level indices.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author dhladky
|
* @author dhladky
|
||||||
|
@ -67,7 +68,7 @@ public class Levels implements ISerializableObject, Serializable {
|
||||||
|
|
||||||
@XmlElements({ @XmlElement(name = "selectedLevelIndices", type = Integer.class) })
|
@XmlElements({ @XmlElement(name = "selectedLevelIndices", type = Integer.class) })
|
||||||
@DynamicSerializeElement
|
@DynamicSerializeElement
|
||||||
private List<Integer> selectedLevelIndices;
|
private List<Integer> selectedLevelIndices = new ArrayList<Integer>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy constructor
|
* Copy constructor
|
||||||
|
|
|
@ -11,6 +11,8 @@ import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlAttribute;
|
import javax.xml.bind.annotation.XmlAttribute;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlElements;
|
import javax.xml.bind.annotation.XmlElements;
|
||||||
|
import javax.xml.bind.annotation.XmlEnum;
|
||||||
|
import javax.xml.bind.annotation.XmlEnumValue;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
import javax.xml.bind.annotation.XmlSeeAlso;
|
import javax.xml.bind.annotation.XmlSeeAlso;
|
||||||
|
|
||||||
|
@ -50,6 +52,7 @@ import com.raytheon.uf.common.time.util.TimeUtil;
|
||||||
* Nov 20, 2012 1286 djohnson Add unscheduled.
|
* Nov 20, 2012 1286 djohnson Add unscheduled.
|
||||||
* Dec 12, 2012 1433 bgonzale Refactored Subscription copy ctor into two ctors.
|
* Dec 12, 2012 1433 bgonzale Refactored Subscription copy ctor into two ctors.
|
||||||
* Jan 03, 2013 1441 djohnson Default to no group.
|
* Jan 03, 2013 1441 djohnson Default to no group.
|
||||||
|
* Jan 25, 2013 1528 djohnson Subscription priority is now an enum.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -66,6 +69,73 @@ import com.raytheon.uf.common.time.util.TimeUtil;
|
||||||
Subscription.DATA_SET_SLOT, Subscription.OWNER_SLOT })
|
Subscription.DATA_SET_SLOT, Subscription.OWNER_SLOT })
|
||||||
public class Subscription implements ISerializableObject, Serializable {
|
public class Subscription implements ISerializableObject, Serializable {
|
||||||
|
|
||||||
|
/** Enumeration to use for subscription priorities */
|
||||||
|
@XmlEnum
|
||||||
|
public static enum SubscriptionPriority {
|
||||||
|
/** High Priority */
|
||||||
|
@XmlEnumValue("High")
|
||||||
|
HIGH("High", 1),
|
||||||
|
/** Default Priority */
|
||||||
|
@XmlEnumValue("Normal")
|
||||||
|
NORMAL("Normal", 2),
|
||||||
|
/** Low Priority */
|
||||||
|
@XmlEnumValue("Low")
|
||||||
|
LOW("Low", 3);
|
||||||
|
|
||||||
|
/** Priority Setting */
|
||||||
|
private final String priorityName;
|
||||||
|
|
||||||
|
/** Numeric Value of the priority */
|
||||||
|
private int priorityValue;
|
||||||
|
|
||||||
|
private SubscriptionPriority(String priorityName, Integer priorityValue) {
|
||||||
|
this.priorityName = priorityName;
|
||||||
|
this.priorityValue = priorityValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get column name.
|
||||||
|
*
|
||||||
|
* @return Priority Name
|
||||||
|
*/
|
||||||
|
public String getPriorityName() {
|
||||||
|
return priorityName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the integer value of the priority
|
||||||
|
*
|
||||||
|
* @return The integer value of the priority.
|
||||||
|
*/
|
||||||
|
public int getPriorityValue() {
|
||||||
|
return priorityValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return priorityName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the {@link SubscriptionPriority} by its string
|
||||||
|
* representation.
|
||||||
|
*
|
||||||
|
* @param string
|
||||||
|
* the string representation
|
||||||
|
* @return the {@link SubscriptionPriority}
|
||||||
|
*/
|
||||||
|
public static SubscriptionPriority fromPriorityName(String string) {
|
||||||
|
for (SubscriptionPriority potential : SubscriptionPriority.values()) {
|
||||||
|
if (potential.getPriorityName().equals(string)) {
|
||||||
|
return potential;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"Unable to find priority with priority name [" + string
|
||||||
|
+ "]");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static final long serialVersionUID = -6422673887457060034L;
|
private static final long serialVersionUID = -6422673887457060034L;
|
||||||
|
|
||||||
/** Dataset Name slot */
|
/** Dataset Name slot */
|
||||||
|
@ -133,6 +203,7 @@ public class Subscription implements ISerializableObject, Serializable {
|
||||||
this.setDataSetType(sub.getDataSetType());
|
this.setDataSetType(sub.getDataSetType());
|
||||||
this.setRoute(sub.getRoute());
|
this.setRoute(sub.getRoute());
|
||||||
this.setLatencyInMinutes(sub.getLatencyInMinutes());
|
this.setLatencyInMinutes(sub.getLatencyInMinutes());
|
||||||
|
this.setEnsemble(sub.getEnsemble());
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlAttribute
|
@XmlAttribute
|
||||||
|
@ -166,7 +237,7 @@ public class Subscription implements ISerializableObject, Serializable {
|
||||||
|
|
||||||
@XmlAttribute
|
@XmlAttribute
|
||||||
@DynamicSerializeElement
|
@DynamicSerializeElement
|
||||||
private Integer priority;
|
private SubscriptionPriority priority = SubscriptionPriority.NORMAL;
|
||||||
|
|
||||||
@XmlAttribute
|
@XmlAttribute
|
||||||
@DynamicSerializeElement
|
@DynamicSerializeElement
|
||||||
|
@ -363,7 +434,7 @@ public class Subscription implements ISerializableObject, Serializable {
|
||||||
*
|
*
|
||||||
* @return subscription name
|
* @return subscription name
|
||||||
*/
|
*/
|
||||||
public Integer getPriority() {
|
public SubscriptionPriority getPriority() {
|
||||||
return priority;
|
return priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,7 +444,7 @@ public class Subscription implements ISerializableObject, Serializable {
|
||||||
* @param priority
|
* @param priority
|
||||||
* priority
|
* priority
|
||||||
*/
|
*/
|
||||||
public void setPriority(Integer priority) {
|
public void setPriority(SubscriptionPriority priority) {
|
||||||
this.priority = priority;
|
this.priority = priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
import com.raytheon.uf.common.status.UFStatus;
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import com.vividsolutions.jts.geom.Geometry;
|
||||||
|
import com.vividsolutions.jts.geom.GeometryFactory;
|
||||||
import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
|
import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,7 +62,7 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
|
||||||
* Apr 11, 2012 #14691 Qinglu Lin For marine warnings, getFeAreaField() returns null.
|
* Apr 11, 2012 #14691 Qinglu Lin For marine warnings, getFeAreaField() returns null.
|
||||||
* So, do not add the returned value of getFeAreaField()
|
* So, do not add the returned value of getFeAreaField()
|
||||||
* to areaFields.
|
* to areaFields.
|
||||||
* Jan 9, 2013 15600 Qinglu Lin Execute "timezones = myTimeZones;" even if timezones != null.
|
* Jan 9, 2013 15600 Qinglu Lin Execute "timezones = myTimeZones;" even if timezones != null.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -87,13 +88,12 @@ public class GeospatialFactory {
|
||||||
boolean generate = true;
|
boolean generate = true;
|
||||||
if (lastRunTime != null) {
|
if (lastRunTime != null) {
|
||||||
System.out.println("Loading areas from disk");
|
System.out.println("Loading areas from disk");
|
||||||
|
|
||||||
// load from disk
|
// load from disk
|
||||||
try {
|
try {
|
||||||
long t0 = System.currentTimeMillis();
|
long t0 = System.currentTimeMillis();
|
||||||
dataSet = loadAreaGeoData(site, lastRunTime);
|
dataSet = loadAreaGeoData(site, lastRunTime);
|
||||||
System.out.println("Loading areas from disk took "
|
System.out.println("Loading areas from disk took "
|
||||||
+ (System.currentTimeMillis() - t0));
|
+ (System.currentTimeMillis() - t0) + "ms");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
statusHandler.handle(Priority.WARN,
|
statusHandler.handle(Priority.WARN,
|
||||||
"Failed to load area geometry files from disk", e);
|
"Failed to load area geometry files from disk", e);
|
||||||
|
@ -119,7 +119,7 @@ public class GeospatialFactory {
|
||||||
GeospatialData[] parentAreas = dataSet.getParentAreas();
|
GeospatialData[] parentAreas = dataSet.getParentAreas();
|
||||||
GeospatialData[] myTimeZones = dataSet.getTimezones();
|
GeospatialData[] myTimeZones = dataSet.getTimezones();
|
||||||
if (myTimeZones != null && myTimeZones.length > 0) {
|
if (myTimeZones != null && myTimeZones.length > 0) {
|
||||||
timezones = myTimeZones;
|
timezones = myTimeZones;
|
||||||
|
|
||||||
for (GeospatialData tz : myTimeZones) {
|
for (GeospatialData tz : myTimeZones) {
|
||||||
tz.prepGeom = PreparedGeometryFactory.prepare(tz.geometry);
|
tz.prepGeom = PreparedGeometryFactory.prepare(tz.geometry);
|
||||||
|
@ -138,7 +138,6 @@ public class GeospatialFactory {
|
||||||
|
|
||||||
list.add(data);
|
list.add(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
GeospatialData[] uniqueAreas = new GeospatialData[uniqueAreasMap.size()];
|
GeospatialData[] uniqueAreas = new GeospatialData[uniqueAreasMap.size()];
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (String key : uniqueAreasMap.keySet()) {
|
for (String key : uniqueAreasMap.keySet()) {
|
||||||
|
@ -148,34 +147,15 @@ public class GeospatialFactory {
|
||||||
// if multiple areas share a common fips ID, the smaller areas will
|
// if multiple areas share a common fips ID, the smaller areas will
|
||||||
// have to merge will the largest area
|
// have to merge will the largest area
|
||||||
if (list.size() > 1) {
|
if (list.size() > 1) {
|
||||||
double maxArea = -1;
|
// collect all individual geometries
|
||||||
for (GeospatialData item : list) {
|
|
||||||
double area = item.getGeometry().getArea();
|
|
||||||
if (area > maxArea) {
|
|
||||||
data = item;
|
|
||||||
maxArea = area;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// collect all individual geometries that are not a part
|
|
||||||
// of the maxArea
|
|
||||||
List<Geometry> geometries = new ArrayList<Geometry>();
|
List<Geometry> geometries = new ArrayList<Geometry>();
|
||||||
for (GeospatialData item : list) {
|
for (GeospatialData item : list) {
|
||||||
if (data != item) {
|
GeometryUtil.buildGeometryList(geometries, item.geometry);
|
||||||
GeometryUtil.buildGeometryList(geometries,
|
|
||||||
item.geometry);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < geometries.size(); i++) {
|
|
||||||
// convexHull will remove any side location conflicts
|
|
||||||
// convexHull the geometries individually because they are
|
|
||||||
// usually not next to each other.
|
|
||||||
// data.geometry = data.geometry.union(geometries.get(i)
|
|
||||||
// .convexHull());
|
|
||||||
data.geometry = data.geometry.union(geometries.get(i)
|
|
||||||
.convexHull());
|
|
||||||
}
|
}
|
||||||
|
// Create multi geometry out of combined areas
|
||||||
|
data.geometry = new GeometryFactory()
|
||||||
|
.createGeometryCollection(geometries
|
||||||
|
.toArray(new Geometry[0]));
|
||||||
}
|
}
|
||||||
uniqueAreas[index] = data;
|
uniqueAreas[index] = data;
|
||||||
index++;
|
index++;
|
||||||
|
@ -204,7 +184,7 @@ public class GeospatialFactory {
|
||||||
|
|
||||||
// Prepare the geometries
|
// Prepare the geometries
|
||||||
for (GeospatialData data : areas) {
|
for (GeospatialData data : areas) {
|
||||||
data.prepGeom = PreparedGeometryFactory.prepare(data.geometry);
|
data.prepGeom = new PreparedGeometryCollection(data.geometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
return areas;
|
return areas;
|
||||||
|
|
|
@ -0,0 +1,246 @@
|
||||||
|
/**
|
||||||
|
* 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.dataplugin.warning.gis;
|
||||||
|
|
||||||
|
import com.vividsolutions.jts.geom.Geometry;
|
||||||
|
import com.vividsolutions.jts.geom.GeometryCollection;
|
||||||
|
import com.vividsolutions.jts.geom.prep.PreparedGeometry;
|
||||||
|
import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link PreparedGeometry} implementation that can handle
|
||||||
|
* {@link GeometryCollection} objects
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Jan 28, 2013 mschenke Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author mschenke
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class PreparedGeometryCollection implements PreparedGeometry {
|
||||||
|
|
||||||
|
private Geometry geometry;
|
||||||
|
|
||||||
|
private PreparedGeometry[] prepared;
|
||||||
|
|
||||||
|
public PreparedGeometryCollection(Geometry geometry) {
|
||||||
|
this.geometry = geometry;
|
||||||
|
int numGeoms = geometry.getNumGeometries();
|
||||||
|
if (geometry.getClass() == GeometryCollection.class) {
|
||||||
|
prepared = new PreparedGeometry[numGeoms];
|
||||||
|
for (int i = 0; i < numGeoms; ++i) {
|
||||||
|
prepared[i] = PreparedGeometryFactory.prepare(geometry
|
||||||
|
.getGeometryN(i));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
prepared = new PreparedGeometry[] { PreparedGeometryFactory
|
||||||
|
.prepare(geometry) };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.vividsolutions.jts.geom.prep.PreparedGeometry#getGeometry()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Geometry getGeometry() {
|
||||||
|
return geometry;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.vividsolutions.jts.geom.prep.PreparedGeometry#contains(com.vividsolutions
|
||||||
|
* .jts.geom.Geometry)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean contains(Geometry geom) {
|
||||||
|
for (PreparedGeometry pg : prepared) {
|
||||||
|
if (pg.contains(geom)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.vividsolutions.jts.geom.prep.PreparedGeometry#containsProperly(com
|
||||||
|
* .vividsolutions.jts.geom.Geometry)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean containsProperly(Geometry geom) {
|
||||||
|
for (PreparedGeometry pg : prepared) {
|
||||||
|
if (pg.containsProperly(geom)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.vividsolutions.jts.geom.prep.PreparedGeometry#coveredBy(com.
|
||||||
|
* vividsolutions.jts.geom.Geometry)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean coveredBy(Geometry geom) {
|
||||||
|
boolean coveredBy = true;
|
||||||
|
for (PreparedGeometry pg : prepared) {
|
||||||
|
if (pg.coveredBy(geom) == false) {
|
||||||
|
coveredBy = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return coveredBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.vividsolutions.jts.geom.prep.PreparedGeometry#covers(com.vividsolutions
|
||||||
|
* .jts.geom.Geometry)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean covers(Geometry geom) {
|
||||||
|
throw new UnsupportedOperationException(
|
||||||
|
"PreparedGeometryCollection does not support PreparedGeometry.covers");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.vividsolutions.jts.geom.prep.PreparedGeometry#crosses(com.vividsolutions
|
||||||
|
* .jts.geom.Geometry)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean crosses(Geometry geom) {
|
||||||
|
for (PreparedGeometry pg : prepared) {
|
||||||
|
if (pg.crosses(geom)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.vividsolutions.jts.geom.prep.PreparedGeometry#disjoint(com.vividsolutions
|
||||||
|
* .jts.geom.Geometry)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean disjoint(Geometry geom) {
|
||||||
|
boolean disjoint = true;
|
||||||
|
for (PreparedGeometry pg : prepared) {
|
||||||
|
if (pg.disjoint(geom) == false) {
|
||||||
|
disjoint = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return disjoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.vividsolutions.jts.geom.prep.PreparedGeometry#intersects(com.
|
||||||
|
* vividsolutions.jts.geom.Geometry)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean intersects(Geometry geom) {
|
||||||
|
for (PreparedGeometry pg : prepared) {
|
||||||
|
if (pg.intersects(geom)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.vividsolutions.jts.geom.prep.PreparedGeometry#overlaps(com.vividsolutions
|
||||||
|
* .jts.geom.Geometry)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean overlaps(Geometry geom) {
|
||||||
|
for (PreparedGeometry pg : prepared) {
|
||||||
|
if (pg.overlaps(geom)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.vividsolutions.jts.geom.prep.PreparedGeometry#touches(com.vividsolutions
|
||||||
|
* .jts.geom.Geometry)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean touches(Geometry geom) {
|
||||||
|
for (PreparedGeometry pg : prepared) {
|
||||||
|
if (pg.touches(geom)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.vividsolutions.jts.geom.prep.PreparedGeometry#within(com.vividsolutions
|
||||||
|
* .jts.geom.Geometry)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean within(Geometry geom) {
|
||||||
|
boolean within = true;
|
||||||
|
for (PreparedGeometry pg : prepared) {
|
||||||
|
if (pg.within(geom) == false) {
|
||||||
|
within = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return within;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,24 +1,38 @@
|
||||||
package com.raytheon.uf.common.dataplugin.warning.util;
|
package com.raytheon.uf.common.dataplugin.warning.util;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import com.vividsolutions.jts.geom.Geometry;
|
||||||
import com.vividsolutions.jts.geom.GeometryCollection;
|
import com.vividsolutions.jts.geom.GeometryCollection;
|
||||||
import com.vividsolutions.jts.geom.GeometryFactory;
|
import com.vividsolutions.jts.geom.GeometryFactory;
|
||||||
import com.vividsolutions.jts.geom.LineString;
|
|
||||||
import com.vividsolutions.jts.geom.Polygon;
|
import com.vividsolutions.jts.geom.Polygon;
|
||||||
import com.vividsolutions.jts.geom.TopologyException;
|
|
||||||
import com.vividsolutions.jts.geom.prep.PreparedGeometry;
|
import com.vividsolutions.jts.geom.prep.PreparedGeometry;
|
||||||
import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
|
import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
|
||||||
import com.vividsolutions.jts.operation.overlay.snap.GeometrySnapper;
|
import com.vividsolutions.jts.operation.overlay.snap.GeometrySnapper;
|
||||||
import com.vividsolutions.jts.operation.polygonize.Polygonizer;
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Performs common geometry operations taking geometry collections into
|
||||||
|
* account for counties. Makes certain assumptions about these geometries that
|
||||||
|
* only apply to warngen
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Nov 15, 2010 mschenke Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author mschenke
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
public class GeometryUtil {
|
public class GeometryUtil {
|
||||||
|
|
||||||
private static final String SEPARATOR = "_";
|
private static final String SEPARATOR = "_";
|
||||||
|
@ -41,7 +55,7 @@ public class GeometryUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < list1.size(); ++i) {
|
for (int i = 0; i < list1.size(); ++i) {
|
||||||
if (list1.get(i).buffer(0).equals(list2.get(i).buffer(0)) == false) {
|
if (list1.get(i).equals(list2.get(i)) == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -190,12 +204,15 @@ public class GeometryUtil {
|
||||||
}
|
}
|
||||||
if ((g1Name == null || g2Name == null || g2Name
|
if ((g1Name == null || g2Name == null || g2Name
|
||||||
.startsWith(prefix))) {
|
.startsWith(prefix))) {
|
||||||
Geometry section = g1.intersection(g2);
|
if (g1.isValid() && g2.isValid()) {
|
||||||
if (section.isEmpty() == false) {
|
Geometry section = g1.intersection(g2);
|
||||||
section = section.buffer(0);
|
if (section.isEmpty() == false) {
|
||||||
setUserData(section, (CountyUserData) g2.getUserData());
|
section = section.buffer(0);
|
||||||
section.setUserData(g2.getUserData());
|
setUserData(section,
|
||||||
intersections.add(section);
|
(CountyUserData) g2.getUserData());
|
||||||
|
section.setUserData(g2.getUserData());
|
||||||
|
intersections.add(section);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -209,64 +226,31 @@ public class GeometryUtil {
|
||||||
intersection(g1.getGeometryN(i), pg, intersections);
|
intersection(g1.getGeometryN(i), pg, intersections);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Geometry g2 = pg.getGeometry();
|
if (pg.intersects(g1)) {
|
||||||
String g1Name = toString(g1.getUserData());
|
Geometry g2 = pg.getGeometry();
|
||||||
String g2Name = toString(g2.getUserData());
|
List<Geometry> sections = new ArrayList<Geometry>();
|
||||||
String prefix = null;
|
for (int n = 0; n < g2.getNumGeometries(); n++) {
|
||||||
if (g1Name != null && g2Name != null) {
|
Geometry section = g1.intersection(g2.getGeometryN(n));
|
||||||
prefix = getPrefix(g1Name);
|
if (section.isEmpty() == false) {
|
||||||
}
|
sections.add(section);
|
||||||
if (g1Name == null || g2Name == null || g2Name.startsWith(prefix)) {
|
|
||||||
if (pg.intersects(g1)) {
|
|
||||||
Geometry section = null;
|
|
||||||
try {
|
|
||||||
section = g1.intersection(g2);
|
|
||||||
} catch (TopologyException e) {
|
|
||||||
// This exception is due to g2 having interior
|
|
||||||
// intersections
|
|
||||||
section = clean(g1).intersection(g2.buffer(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (section != null) {
|
|
||||||
setUserData(section, (CountyUserData) g2.getUserData());
|
|
||||||
section.setUserData(g2.getUserData());
|
|
||||||
intersections.add(section);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Geometry section = null;
|
||||||
|
if (sections.size() == 1) {
|
||||||
|
section = sections.get(0);
|
||||||
|
} else if (sections.size() > 0) {
|
||||||
|
section = new GeometryFactory()
|
||||||
|
.createGeometryCollection(sections
|
||||||
|
.toArray(new Geometry[0]));
|
||||||
|
}
|
||||||
|
if (section != null && section.isEmpty() == false) {
|
||||||
|
setUserData(section, (CountyUserData) g2.getUserData());
|
||||||
|
intersections.add(section);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a geometry from the noded line strings of g.
|
|
||||||
*
|
|
||||||
* @param g
|
|
||||||
* geometry to be cleaned up
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private static Geometry clean(Geometry g) {
|
|
||||||
Coordinate[] coords = g.getCoordinates();
|
|
||||||
|
|
||||||
// create a line string
|
|
||||||
GeometryFactory gf = new GeometryFactory();
|
|
||||||
LineString ls = gf.createLineString(coords);
|
|
||||||
|
|
||||||
// node the line string (insert vertices where lines cross)
|
|
||||||
com.vividsolutions.jts.geom.Point pt = gf.createPoint(ls
|
|
||||||
.getCoordinate());
|
|
||||||
Geometry nodedLines = ls.union(pt);
|
|
||||||
|
|
||||||
// create the polygon(s) from the noded line
|
|
||||||
Polygonizer polygonizer = new Polygonizer();
|
|
||||||
polygonizer.add(nodedLines);
|
|
||||||
Collection<Polygon> polygons = polygonizer.getPolygons();
|
|
||||||
|
|
||||||
g = gf.createMultiPolygon(
|
|
||||||
polygons.toArray(new Polygon[polygons.size()])).buffer(0);
|
|
||||||
|
|
||||||
return g;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the difference between the 2 geometries
|
* Get the difference between the 2 geometries
|
||||||
*
|
*
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.common.dataquery.responses;
|
package com.raytheon.uf.common.dataquery.responses;
|
||||||
|
|
||||||
|
import java.lang.reflect.Array;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -47,15 +49,31 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||||
@DynamicSerialize
|
@DynamicSerialize
|
||||||
public class DbQueryResponse implements ISerializableObject {
|
public class DbQueryResponse implements ISerializableObject {
|
||||||
|
|
||||||
|
public static final String ENTITY_RESULT_KEY = null;
|
||||||
|
|
||||||
@DynamicSerializeElement
|
@DynamicSerializeElement
|
||||||
private List<Map<String, Object>> results;
|
private List<Map<String, Object>> results;
|
||||||
|
|
||||||
public List<Map<String, Object>> getResults() {
|
public List<Map<String, Object>> getResults() {
|
||||||
return results;
|
return results == null ? new ArrayList<Map<String, Object>>() : results;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setResults(List<Map<String, Object>> results) {
|
public void setResults(List<Map<String, Object>> results) {
|
||||||
this.results = results;
|
this.results = results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getNumResults() {
|
||||||
|
return getResults().size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public <T> T[] getEntityObjects(Class<T> entityType) {
|
||||||
|
List<Map<String, Object>> results = getResults();
|
||||||
|
T[] entities = (T[]) Array.newInstance(entityType, results.size());
|
||||||
|
int i = 0;
|
||||||
|
for (Map<String, Object> result : results) {
|
||||||
|
entities[i++] = entityType.cast(result.get(ENTITY_RESULT_KEY));
|
||||||
|
}
|
||||||
|
return entities;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,11 @@ import com.google.common.collect.ArrayListMultimap;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import com.raytheon.uf.common.datadelivery.bandwidth.data.BandwidthGraphData;
|
import com.raytheon.uf.common.datadelivery.bandwidth.data.BandwidthGraphData;
|
||||||
import com.raytheon.uf.common.datadelivery.bandwidth.data.TimeWindowData;
|
import com.raytheon.uf.common.datadelivery.bandwidth.data.TimeWindowData;
|
||||||
|
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
|
||||||
|
import com.raytheon.uf.common.serialization.SerializationException;
|
||||||
|
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;
|
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthAllocation;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthAllocation;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionDao;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionDao;
|
||||||
|
@ -50,7 +55,8 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalPlan.Bandw
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Dec 6, 2012 1397 djohnson Initial creation
|
* Dec 06, 2012 1397 djohnson Initial creation
|
||||||
|
* Jan 25, 2013 1528 djohnson Subscription priority is now an enum.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -59,6 +65,8 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalPlan.Bandw
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class BandwidthGraphDataAdapter {
|
class BandwidthGraphDataAdapter {
|
||||||
|
private static final IUFStatusHandler statusHandler = UFStatus
|
||||||
|
.getHandler(BandwidthGraphDataAdapter.class);
|
||||||
|
|
||||||
private final RetrievalManager retrievalManager;
|
private final RetrievalManager retrievalManager;
|
||||||
|
|
||||||
|
@ -88,7 +96,7 @@ class BandwidthGraphDataAdapter {
|
||||||
.getBucketMinutes());
|
.getBucketMinutes());
|
||||||
|
|
||||||
Map<String, List<TimeWindowData>> dataMap = new HashMap<String, List<TimeWindowData>>();
|
Map<String, List<TimeWindowData>> dataMap = new HashMap<String, List<TimeWindowData>>();
|
||||||
Map<String, Integer> priorityMap = new HashMap<String, Integer>();
|
Map<String, SubscriptionPriority> priorityMap = new HashMap<String, SubscriptionPriority>();
|
||||||
|
|
||||||
Map<Long, SubscriptionRetrieval> retrievals = new HashMap<Long, SubscriptionRetrieval>();
|
Map<Long, SubscriptionRetrieval> retrievals = new HashMap<Long, SubscriptionRetrieval>();
|
||||||
Multimap<Long, BandwidthReservation> reservations = ArrayListMultimap
|
Multimap<Long, BandwidthReservation> reservations = ArrayListMultimap
|
||||||
|
@ -133,7 +141,16 @@ class BandwidthGraphDataAdapter {
|
||||||
final SubscriptionRetrieval value = entry.getValue();
|
final SubscriptionRetrieval value = entry.getValue();
|
||||||
SubscriptionDao dao = value.getSubscriptionDao();
|
SubscriptionDao dao = value.getSubscriptionDao();
|
||||||
final String subName = dao.getName();
|
final String subName = dao.getName();
|
||||||
priorityMap.put(subName, Integer.valueOf((int) dao.getPriority()));
|
try {
|
||||||
|
priorityMap.put(subName, dao.getSubscription().getPriority());
|
||||||
|
} catch (SerializationException e) {
|
||||||
|
statusHandler
|
||||||
|
.handle(Priority.PROBLEM,
|
||||||
|
"Unable to get access to the actual subscription for ["
|
||||||
|
+ subName + "], skipping...",
|
||||||
|
e);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
List<TimeWindowData> timeWindows = dataMap.get(subName);
|
List<TimeWindowData> timeWindows = dataMap.get(subName);
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,9 @@ import com.raytheon.uf.edex.event.EventBus;
|
||||||
* Dec 06, 2012 1397 djohnson Add ability to get bandwidth graph data.
|
* Dec 06, 2012 1397 djohnson Add ability to get bandwidth graph data.
|
||||||
* Dec 11, 2012 1403 djohnson Adhoc subscriptions no longer go to the registry.
|
* Dec 11, 2012 1403 djohnson Adhoc subscriptions no longer go to the registry.
|
||||||
* Dec 12, 2012 1286 djohnson Remove shutdown hook and finalize().
|
* Dec 12, 2012 1286 djohnson Remove shutdown hook and finalize().
|
||||||
*
|
* Jan 25, 2013 1528 djohnson Compare priorities as primitive ints.
|
||||||
|
* Jan 28, 2013 1530 djohnson Unschedule all allocations for a subscription that does not fully schedule.
|
||||||
|
* Jan 30, 2013 1501 djohnson Fix broken calculations for determining required latency.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author dhladky
|
* @author dhladky
|
||||||
|
@ -567,9 +569,45 @@ abstract class BandwidthManager extends
|
||||||
.getCycleTimes());
|
.getCycleTimes());
|
||||||
List<BandwidthAllocation> unscheduled = schedule(subscription, cycles);
|
List<BandwidthAllocation> unscheduled = schedule(subscription, cycles);
|
||||||
|
|
||||||
|
unscheduleSubscriptionsForAllocations(unscheduled);
|
||||||
|
|
||||||
return unscheduled;
|
return unscheduled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unschedules all subscriptions the allocations are associated to.
|
||||||
|
*
|
||||||
|
* @param unscheduled
|
||||||
|
* the unscheduled allocations
|
||||||
|
*/
|
||||||
|
private void unscheduleSubscriptionsForAllocations(
|
||||||
|
List<BandwidthAllocation> unscheduled) {
|
||||||
|
Set<Subscription> subscriptionsToUnschedule = Sets.newHashSet();
|
||||||
|
for (BandwidthAllocation unscheduledAllocation : unscheduled) {
|
||||||
|
if (unscheduledAllocation instanceof SubscriptionRetrieval) {
|
||||||
|
SubscriptionRetrieval retrieval = (SubscriptionRetrieval) unscheduledAllocation;
|
||||||
|
try {
|
||||||
|
subscriptionsToUnschedule.add(retrieval.getSubscription());
|
||||||
|
} catch (SerializationException e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
|
"Unable to deserialize a subscription", e);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Subscription sub : subscriptionsToUnschedule) {
|
||||||
|
sub.setUnscheduled(true);
|
||||||
|
try {
|
||||||
|
subscriptionUpdated(sub);
|
||||||
|
} catch (SerializationException e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
|
"Unable to deserialize a subscription", e);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*
|
*
|
||||||
|
@ -658,7 +696,8 @@ abstract class BandwidthManager extends
|
||||||
|
|
||||||
// If BandwidthManager does not know about the subscription, and
|
// If BandwidthManager does not know about the subscription, and
|
||||||
// it's active, attempt to add it..
|
// it's active, attempt to add it..
|
||||||
if (subscriptionDaos.isEmpty() && subscription.isActive()) {
|
if (subscriptionDaos.isEmpty() && subscription.isActive()
|
||||||
|
&& !subscription.isUnscheduled()) {
|
||||||
final boolean subscribedToCycles = !subscription.getTime()
|
final boolean subscribedToCycles = !subscription.getTime()
|
||||||
.getCycleTimes().isEmpty();
|
.getCycleTimes().isEmpty();
|
||||||
final boolean useMostRecentDataSetUpdate = !subscribedToCycles;
|
final boolean useMostRecentDataSetUpdate = !subscribedToCycles;
|
||||||
|
@ -687,8 +726,8 @@ abstract class BandwidthManager extends
|
||||||
unscheduled = schedule(adhoc);
|
unscheduled = schedule(adhoc);
|
||||||
}
|
}
|
||||||
return unscheduled;
|
return unscheduled;
|
||||||
} else if (!subscription.isActive()) {
|
} else if (!subscription.isActive() || subscription.isUnscheduled()) {
|
||||||
// See if the subscription was inactivated..
|
// See if the subscription was inactivated or unscheduled..
|
||||||
// Need to remove BandwidthReservations for this
|
// Need to remove BandwidthReservations for this
|
||||||
// subscription.
|
// subscription.
|
||||||
return remove(subscriptionDaos, true);
|
return remove(subscriptionDaos, true);
|
||||||
|
@ -796,7 +835,7 @@ abstract class BandwidthManager extends
|
||||||
boolean requiresReschedule = (old.getDataSetSize() != subscription
|
boolean requiresReschedule = (old.getDataSetSize() != subscription
|
||||||
.getDataSetSize())
|
.getDataSetSize())
|
||||||
// Priority is different
|
// Priority is different
|
||||||
|| (!old.getPriority().equals(subscription.getPriority()))
|
|| (old.getPriority() != subscription.getPriority())
|
||||||
// Latency is different
|
// Latency is different
|
||||||
|| (!(old.getLatencyInMinutes() == subscription
|
|| (!(old.getLatencyInMinutes() == subscription
|
||||||
.getLatencyInMinutes()));
|
.getLatencyInMinutes()));
|
||||||
|
@ -1121,8 +1160,7 @@ abstract class BandwidthManager extends
|
||||||
* @return the graph data
|
* @return the graph data
|
||||||
*/
|
*/
|
||||||
private BandwidthGraphData getBandwidthGraphData() {
|
private BandwidthGraphData getBandwidthGraphData() {
|
||||||
return new BandwidthGraphDataAdapter(retrievalManager)
|
return new BandwidthGraphDataAdapter(retrievalManager).get();
|
||||||
.get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1505,95 +1543,86 @@ abstract class BandwidthManager extends
|
||||||
* @return the required latency, in minutes
|
* @return the required latency, in minutes
|
||||||
*/
|
*/
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
int determineRequiredLatency(Subscription subscription) {
|
int determineRequiredLatency(final Subscription subscription) {
|
||||||
ITimer timer = TimeUtil.getTimer();
|
ITimer timer = TimeUtil.getTimer();
|
||||||
timer.start();
|
timer.start();
|
||||||
try {
|
|
||||||
final Subscription clone = BandwidthUtil.cheapClone(
|
|
||||||
Subscription.class, subscription);
|
|
||||||
|
|
||||||
if (clone.getLatencyInMinutes() < 1) {
|
boolean foundLatency = false;
|
||||||
clone.setLatencyInMinutes(1);
|
int latency = subscription.getLatencyInMinutes();
|
||||||
}
|
if (latency < 1) {
|
||||||
|
latency = 1;
|
||||||
boolean foundLatency = false;
|
|
||||||
int latency = clone.getLatencyInMinutes();
|
|
||||||
int previousLatency = latency;
|
|
||||||
do {
|
|
||||||
// Double the latency until we have two values we can binary
|
|
||||||
// search between...
|
|
||||||
previousLatency = latency;
|
|
||||||
latency *= 2;
|
|
||||||
clone.setLatencyInMinutes(latency);
|
|
||||||
foundLatency = isSchedulableWithoutConflict(clone);
|
|
||||||
} while (!foundLatency);
|
|
||||||
|
|
||||||
SortedSet<Integer> possibleLatencies = new TreeSet<Integer>();
|
|
||||||
for (int i = previousLatency; i < (latency + 1); i++) {
|
|
||||||
possibleLatencies.add(Integer.valueOf(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
IBinarySearchResponse<Integer> response = AlgorithmUtil
|
|
||||||
.binarySearch(possibleLatencies, new Comparable<Integer>() {
|
|
||||||
@Override
|
|
||||||
public int compareTo(Integer valueToCheck) {
|
|
||||||
clone.setLatencyInMinutes(valueToCheck);
|
|
||||||
|
|
||||||
boolean latencyWouldWork = isSchedulableWithoutConflict(clone);
|
|
||||||
|
|
||||||
// Check if one value less would not work, if so
|
|
||||||
// then this is the required latency, otherwise keep
|
|
||||||
// searching
|
|
||||||
if (latencyWouldWork) {
|
|
||||||
clone.setLatencyInMinutes(clone
|
|
||||||
.getLatencyInMinutes() - 1);
|
|
||||||
|
|
||||||
return (isSchedulableWithoutConflict(clone)) ? 1
|
|
||||||
: 0;
|
|
||||||
} else {
|
|
||||||
// Still too low, stuff would be unscheduled
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
final Integer binarySearchedLatency = response.getItem();
|
|
||||||
if (binarySearchedLatency != null) {
|
|
||||||
latency = binarySearchedLatency.intValue();
|
|
||||||
|
|
||||||
if (statusHandler.isPriorityEnabled(Priority.DEBUG)) {
|
|
||||||
statusHandler
|
|
||||||
.debug(String
|
|
||||||
.format("Found required latency of [%s] in [%s] iterations",
|
|
||||||
binarySearchedLatency,
|
|
||||||
response.getIterations()));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
statusHandler
|
|
||||||
.warn(String
|
|
||||||
.format("Unable to find the required latency with a binary search, using required latency [%s]",
|
|
||||||
latency));
|
|
||||||
}
|
|
||||||
|
|
||||||
timer.stop();
|
|
||||||
|
|
||||||
int bufferRoomInMinutes = retrievalManager.getPlan(
|
|
||||||
subscription.getRoute()).getBucketMinutes();
|
|
||||||
|
|
||||||
final String logMsg = String
|
|
||||||
.format("Determined required latency of [%s] in [%s] ms. Adding buffer room of [%s] minutes",
|
|
||||||
latency, timer.getElapsedTime(),
|
|
||||||
bufferRoomInMinutes);
|
|
||||||
statusHandler.info(logMsg);
|
|
||||||
|
|
||||||
latency += bufferRoomInMinutes;
|
|
||||||
|
|
||||||
return latency;
|
|
||||||
} catch (SerializationException e) {
|
|
||||||
statusHandler.handle(Priority.PROBLEM,
|
|
||||||
"Unable to serialize a Subscription", e);
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
int previousLatency = latency;
|
||||||
|
do {
|
||||||
|
// Double the latency until we have two values we can binary
|
||||||
|
// search between...
|
||||||
|
previousLatency = latency;
|
||||||
|
latency *= 2;
|
||||||
|
|
||||||
|
Subscription clone = new Subscription(subscription);
|
||||||
|
clone.setLatencyInMinutes(latency);
|
||||||
|
foundLatency = isSchedulableWithoutConflict(clone);
|
||||||
|
} while (!foundLatency);
|
||||||
|
|
||||||
|
SortedSet<Integer> possibleLatencies = new TreeSet<Integer>();
|
||||||
|
for (int i = previousLatency; i < (latency + 1); i++) {
|
||||||
|
possibleLatencies.add(Integer.valueOf(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
IBinarySearchResponse<Integer> response = AlgorithmUtil.binarySearch(
|
||||||
|
possibleLatencies, new Comparable<Integer>() {
|
||||||
|
@Override
|
||||||
|
public int compareTo(Integer valueToCheck) {
|
||||||
|
Subscription clone = new Subscription(subscription);
|
||||||
|
clone.setLatencyInMinutes(valueToCheck);
|
||||||
|
|
||||||
|
boolean latencyWouldWork = isSchedulableWithoutConflict(clone);
|
||||||
|
|
||||||
|
// Check if one value less would not work, if so
|
||||||
|
// then this is the required latency, otherwise keep
|
||||||
|
// searching
|
||||||
|
if (latencyWouldWork) {
|
||||||
|
clone.setLatencyInMinutes(clone
|
||||||
|
.getLatencyInMinutes() - 1);
|
||||||
|
|
||||||
|
return (isSchedulableWithoutConflict(clone)) ? 1
|
||||||
|
: 0;
|
||||||
|
} else {
|
||||||
|
// Still too low, stuff would be unscheduled
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
final Integer binarySearchedLatency = response.getItem();
|
||||||
|
if (binarySearchedLatency != null) {
|
||||||
|
latency = binarySearchedLatency.intValue();
|
||||||
|
|
||||||
|
if (statusHandler.isPriorityEnabled(Priority.DEBUG)) {
|
||||||
|
statusHandler.debug(String.format(
|
||||||
|
"Found required latency of [%s] in [%s] iterations",
|
||||||
|
binarySearchedLatency, response.getIterations()));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
statusHandler
|
||||||
|
.warn(String
|
||||||
|
.format("Unable to find the required latency with a binary search, using required latency [%s]",
|
||||||
|
latency));
|
||||||
|
}
|
||||||
|
|
||||||
|
timer.stop();
|
||||||
|
|
||||||
|
int bufferRoomInMinutes = retrievalManager.getPlan(
|
||||||
|
subscription.getRoute()).getBucketMinutes();
|
||||||
|
|
||||||
|
final String logMsg = String
|
||||||
|
.format("Determined required latency of [%s] in [%s] ms. Adding buffer room of [%s] minutes",
|
||||||
|
latency, timer.getElapsedTime(), bufferRoomInMinutes);
|
||||||
|
statusHandler.info(logMsg);
|
||||||
|
|
||||||
|
latency += bufferRoomInMinutes;
|
||||||
|
|
||||||
|
return latency;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -298,4 +298,16 @@ public class BandwidthAllocation implements IPersistableDataObject<Long>,
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether this allocation is higher priority than another.
|
||||||
|
*
|
||||||
|
* @param other
|
||||||
|
* the other
|
||||||
|
* @return true if this allocation is higher priority than the other one
|
||||||
|
*/
|
||||||
|
public boolean isHigherPriorityThan(BandwidthAllocation other) {
|
||||||
|
// A lower priority value means it's higher priority
|
||||||
|
return this.getPriority() < other.getPriority();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -28,7 +28,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
||||||
* Aug 27, 2012 726 jspinks Initial release.
|
* Aug 27, 2012 726 jspinks Initial release.
|
||||||
* Oct 17, 2012 0726 djohnson If unable to find a bucket with floorKey, use ceilingKey.
|
* Oct 17, 2012 0726 djohnson If unable to find a bucket with floorKey, use ceilingKey.
|
||||||
* Oct 26, 2012 1286 djohnson Return list of unscheduled allocations.
|
* Oct 26, 2012 1286 djohnson Return list of unscheduled allocations.
|
||||||
*
|
* Jan 25, 2013 1528 djohnson Lower priority requests should not be able to unschedule higher priority requests.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
|
@ -180,7 +180,10 @@ public class PriorityRetrievalScheduler implements IRetrievalScheduler {
|
||||||
for (BandwidthBucket bucket : window) {
|
for (BandwidthBucket bucket : window) {
|
||||||
for (BandwidthAllocation o : bucket.getRequests()) {
|
for (BandwidthAllocation o : bucket.getRequests()) {
|
||||||
long estimatedSizeInBytes = o.getEstimatedSizeInBytes();
|
long estimatedSizeInBytes = o.getEstimatedSizeInBytes();
|
||||||
if (request.getPriority() > o.getPriority()) {
|
// This was bad... we just about released giving lower
|
||||||
|
// priority requests the ability to unschedule higher priority
|
||||||
|
// requests....
|
||||||
|
if (request.isHigherPriorityThan(o)) {
|
||||||
total += estimatedSizeInBytes;
|
total += estimatedSizeInBytes;
|
||||||
lowerPriorityRequests.add(o);
|
lowerPriorityRequests.add(o);
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,7 +207,7 @@ public class BandwidthUtil {
|
||||||
// will have to revisit when other data type are introduced.
|
// will have to revisit when other data type are introduced.
|
||||||
// perhaps minute of the day?
|
// perhaps minute of the day?
|
||||||
dao.setCycle(baseReferenceTime.get(Calendar.HOUR_OF_DAY));
|
dao.setCycle(baseReferenceTime.get(Calendar.HOUR_OF_DAY));
|
||||||
dao.setPriority(subscription.getPriority());
|
dao.setPriority(subscription.getPriority().getPriorityValue());
|
||||||
dao.setRegistryId(subscription.getId());
|
dao.setRegistryId(subscription.getId());
|
||||||
return dao;
|
return dao;
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,6 +90,7 @@ import dods.dap.DAS;
|
||||||
* Dec 10, 2012 1259 bsteffen Switch Data Delivery from LatLon to referenced envelopes.
|
* Dec 10, 2012 1259 bsteffen Switch Data Delivery from LatLon to referenced envelopes.
|
||||||
* Jan 08, 2013 dhladky Performance enhancements, specific model fixes.
|
* Jan 08, 2013 dhladky Performance enhancements, specific model fixes.
|
||||||
* Jan 18, 2013 1513 dhladky Level look up improvements.
|
* Jan 18, 2013 1513 dhladky Level look up improvements.
|
||||||
|
* Jan 24, 2013 1527 dhladky Changed 0DEG to FRZ
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -419,7 +420,6 @@ class OpenDAPMetaDataParser extends MetaDataParser {
|
||||||
parm.setLevels(getLevels(type, collectionName, gdsmd, dz,
|
parm.setLevels(getLevels(type, collectionName, gdsmd, dz,
|
||||||
levMin, levMax));
|
levMin, levMax));
|
||||||
parm.addLevelType(type);
|
parm.addLevelType(type);
|
||||||
|
|
||||||
parameters.put(name, parm);
|
parameters.put(name, parm);
|
||||||
|
|
||||||
} catch (Exception le) {
|
} catch (Exception le) {
|
||||||
|
@ -494,6 +494,11 @@ class OpenDAPMetaDataParser extends MetaDataParser {
|
||||||
type.addLayer(new Double(10).doubleValue());
|
type.addLayer(new Double(10).doubleValue());
|
||||||
type.setUnit(serviceConfig.getConstantValue("METER"));
|
type.setUnit(serviceConfig.getConstantValue("METER"));
|
||||||
}
|
}
|
||||||
|
// FRZ freezing level, catches one's with on the end of the param name
|
||||||
|
// hgt0c etc
|
||||||
|
else if (param.getProviderName().endsWith(LevelType.FRZ.getLevelType())) {
|
||||||
|
type = new DataLevelType(LevelType.FRZ);
|
||||||
|
}
|
||||||
|
|
||||||
// Really special cases presented by NOMADS data sets
|
// Really special cases presented by NOMADS data sets
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
|
@ -573,8 +578,8 @@ class OpenDAPMetaDataParser extends MetaDataParser {
|
||||||
type = new DataLevelType(LevelType.MSL);
|
type = new DataLevelType(LevelType.MSL);
|
||||||
} else if (w1.equals(LevelType.EA.getLevelType())) {
|
} else if (w1.equals(LevelType.EA.getLevelType())) {
|
||||||
type = new DataLevelType(LevelType.EA);
|
type = new DataLevelType(LevelType.EA);
|
||||||
} else if (w1.equals(LevelType.ODEG.getLevelType())) {
|
} else if (w1.equals(LevelType.FRZ.getLevelType())) {
|
||||||
type = new DataLevelType(LevelType.ODEG);
|
type = new DataLevelType(LevelType.FRZ);
|
||||||
} else if (w1.equals(LevelType.LCY.getLevelType())) {
|
} else if (w1.equals(LevelType.LCY.getLevelType())) {
|
||||||
type = new DataLevelType(LevelType.LCY);
|
type = new DataLevelType(LevelType.LCY);
|
||||||
} else if (w1.equals(LevelType.MCY.getLevelType())) {
|
} else if (w1.equals(LevelType.MCY.getLevelType())) {
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
# 06/16/10 njensen Initial Creation.
|
# 06/16/10 njensen Initial Creation.
|
||||||
# 05/03/11 9134 njensen Optimized for pointdata
|
# 05/03/11 9134 njensen Optimized for pointdata
|
||||||
# 10/09/12 rjpeter Optimized __getGroup for retrievals
|
# 10/09/12 rjpeter Optimized __getGroup for retrievals
|
||||||
|
# 01/17/13 DR 15294 D. Friedman Clear out data in response
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
@ -94,6 +95,9 @@ class H5pyDataStore(IDataStore.IDataStore):
|
||||||
except:
|
except:
|
||||||
logger.warn("Exception occurred on file " + fn + ":" + IDataStore._exc())
|
logger.warn("Exception occurred on file " + fn + ":" + IDataStore._exc())
|
||||||
exc.append(IDataStore._exc())
|
exc.append(IDataStore._exc())
|
||||||
|
# Clear out data so we don't send the whole thing back to the client.
|
||||||
|
# NOTE: This assumes pypies no longer needs the data
|
||||||
|
r.putDataObject(None)
|
||||||
failRecs.append(r)
|
failRecs.append(r)
|
||||||
|
|
||||||
if ss:
|
if ss:
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
Name: awips2-ldm
|
Name: awips2-ldm
|
||||||
Summary: AWIPS II LDM Distribution
|
Summary: AWIPS II LDM Distribution
|
||||||
Version: 6.8.1
|
Version: 6.8.1
|
||||||
Release: 28
|
Release: 29
|
||||||
Group: AWIPSII
|
Group: AWIPSII
|
||||||
BuildRoot: /tmp
|
BuildRoot: /tmp
|
||||||
URL: N/A
|
URL: N/A
|
||||||
|
|
|
@ -151,7 +151,15 @@ public abstract class AbstractBandwidthManagerIntTest {
|
||||||
*/
|
*/
|
||||||
protected Subscription createSubscriptionThatFillsUpABucket() {
|
protected Subscription createSubscriptionThatFillsUpABucket() {
|
||||||
return createSubscriptionWithDataSetSizeInBytes(fullBucketSize);
|
return createSubscriptionWithDataSetSizeInBytes(fullBucketSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a subscription the fills up ten buckets.
|
||||||
|
*
|
||||||
|
* @return the subscription
|
||||||
|
*/
|
||||||
|
protected Subscription createSubscriptionThatFillsUpTenBuckets() {
|
||||||
|
return createSubscriptionWithDataSetSizeInBytes(fullBucketSize * 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -19,8 +19,11 @@
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.edex.datadelivery.bandwidth;
|
package com.raytheon.uf.edex.datadelivery.bandwidth;
|
||||||
|
|
||||||
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
import static org.hamcrest.Matchers.is;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
|
import static org.junit.Assert.assertThat;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
|
@ -47,6 +50,7 @@ import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSetMetaDat
|
||||||
import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSetMetaDataFixture;
|
import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSetMetaDataFixture;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.ParameterFixture;
|
import com.raytheon.uf.common.datadelivery.registry.ParameterFixture;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||||
|
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.SubscriptionFixture;
|
import com.raytheon.uf.common.datadelivery.registry.SubscriptionFixture;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.Time;
|
import com.raytheon.uf.common.datadelivery.registry.Time;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
|
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
|
||||||
|
@ -81,6 +85,9 @@ import com.raytheon.uf.edex.datadelivery.retrieval.RetrievalManagerNotifyEvent;
|
||||||
* Oct 12, 2012 0726 djohnson Initial creation
|
* Oct 12, 2012 0726 djohnson Initial creation
|
||||||
* Oct 23, 2012 1286 djohnson Create reusable abstract int test.
|
* Oct 23, 2012 1286 djohnson Create reusable abstract int test.
|
||||||
* Dec 11, 2012 1286 djohnson Add test verifying fulfilled retrievals won't cause NPEs when the subscription is updated.
|
* Dec 11, 2012 1286 djohnson Add test verifying fulfilled retrievals won't cause NPEs when the subscription is updated.
|
||||||
|
* Jan 25, 2013 1528 djohnson Compare priorities as primitive ints.
|
||||||
|
* Jan 28, 2013 1530 djohnson Test that all allocations are unscheduled for subscription that doesn't fully schedule.
|
||||||
|
* Jan 30, 2013 1501 djohnson Fix broken calculations for determining required latency.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -313,7 +320,7 @@ public class BandwidthManagerIntTest extends AbstractBandwidthManagerIntTest {
|
||||||
Subscription subscription2 = createSubscriptionThatFillsUpABucket();
|
Subscription subscription2 = createSubscriptionThatFillsUpABucket();
|
||||||
|
|
||||||
// subscription2 will have higher priority
|
// subscription2 will have higher priority
|
||||||
subscription2.setPriority(subscription.getPriority() + 1);
|
subscription2.setPriority(SubscriptionPriority.HIGH);
|
||||||
|
|
||||||
// they conflict for cycle hour 8
|
// they conflict for cycle hour 8
|
||||||
subscription.getTime().setCycleTimes(
|
subscription.getTime().setCycleTimes(
|
||||||
|
@ -335,16 +342,45 @@ public class BandwidthManagerIntTest extends AbstractBandwidthManagerIntTest {
|
||||||
BandwidthAllocation unscheduledAllocation = iter.next();
|
BandwidthAllocation unscheduledAllocation = iter.next();
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"The first subscription with lower priority should have been the one unscheduled.",
|
"The first subscription with lower priority should have been the one unscheduled.",
|
||||||
subscription.getPriority().intValue(),
|
subscription.getPriority().getPriorityValue(),
|
||||||
unscheduledAllocation.getPriority(), 0.0);
|
unscheduledAllocation.getPriority(), 0.0);
|
||||||
|
|
||||||
unscheduledAllocation = iter.next();
|
unscheduledAllocation = iter.next();
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"The first subscription with lower priority should have been the one unscheduled.",
|
"The first subscription with lower priority should have been the one unscheduled.",
|
||||||
subscription.getPriority().intValue(),
|
subscription.getPriority().getPriorityValue(),
|
||||||
unscheduledAllocation.getPriority(), 0.0);
|
unscheduledAllocation.getPriority(), 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void unscheduledSubscriptionUnschedulesAllAllocations() {
|
||||||
|
String unscheduledSubDataSetName = "willBeUnscheduled";
|
||||||
|
Subscription subscription = createSubscriptionThatFillsUpABucket();
|
||||||
|
subscription.setDataSetName(unscheduledSubDataSetName);
|
||||||
|
Subscription subscription2 = createSubscriptionThatFillsUpABucket();
|
||||||
|
|
||||||
|
// subscription2 will have higher priority
|
||||||
|
subscription2.setPriority(SubscriptionPriority.HIGH);
|
||||||
|
|
||||||
|
// they conflict for cycle hour 8
|
||||||
|
subscription.getTime().setCycleTimes(
|
||||||
|
Arrays.asList(Integer.valueOf(6), Integer.valueOf(8)));
|
||||||
|
subscription2.getTime().setCycleTimes(
|
||||||
|
Arrays.asList(Integer.valueOf(3), Integer.valueOf(8)));
|
||||||
|
|
||||||
|
bandwidthManager.schedule(subscription);
|
||||||
|
bandwidthManager.schedule(subscription2);
|
||||||
|
|
||||||
|
final List<SubscriptionRetrieval> subscriptionRetrievals = bandwidthDao
|
||||||
|
.getSubscriptionRetrievals(subscription.getProvider(),
|
||||||
|
unscheduledSubDataSetName);
|
||||||
|
|
||||||
|
for (SubscriptionRetrieval subscriptionRetrieval : subscriptionRetrievals) {
|
||||||
|
assertThat(subscriptionRetrieval.getStatus(),
|
||||||
|
is(equalTo(RetrievalStatus.UNSCHEDULED)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testScheduleSubscriptionWithHigherPrioritySetsOtherAllocationsToUnscheduled() {
|
public void testScheduleSubscriptionWithHigherPrioritySetsOtherAllocationsToUnscheduled() {
|
||||||
|
|
||||||
|
@ -352,7 +388,7 @@ public class BandwidthManagerIntTest extends AbstractBandwidthManagerIntTest {
|
||||||
Subscription subscription2 = createSubscriptionThatFillsUpABucket();
|
Subscription subscription2 = createSubscriptionThatFillsUpABucket();
|
||||||
|
|
||||||
// subscription2 will have higher priority
|
// subscription2 will have higher priority
|
||||||
subscription2.setPriority(subscription.getPriority() + 1);
|
subscription2.setPriority(SubscriptionPriority.HIGH);
|
||||||
|
|
||||||
// they conflict for cycle hour 8
|
// they conflict for cycle hour 8
|
||||||
subscription.getTime().setCycleTimes(
|
subscription.getTime().setCycleTimes(
|
||||||
|
@ -389,7 +425,7 @@ public class BandwidthManagerIntTest extends AbstractBandwidthManagerIntTest {
|
||||||
Subscription subscription2 = createSubscriptionThatFillsUpABucket();
|
Subscription subscription2 = createSubscriptionThatFillsUpABucket();
|
||||||
|
|
||||||
// subscription2 will have higher priority
|
// subscription2 will have higher priority
|
||||||
subscription2.setPriority(subscription.getPriority() + 1);
|
subscription2.setPriority(SubscriptionPriority.HIGH);
|
||||||
|
|
||||||
// they conflict for cycle hour 8
|
// they conflict for cycle hour 8
|
||||||
subscription.getTime().setCycleTimes(
|
subscription.getTime().setCycleTimes(
|
||||||
|
@ -419,8 +455,6 @@ public class BandwidthManagerIntTest extends AbstractBandwidthManagerIntTest {
|
||||||
|
|
||||||
// Subscription starts out too big
|
// Subscription starts out too big
|
||||||
Subscription subscription = createSubscriptionThatFillsUpTwoBuckets();
|
Subscription subscription = createSubscriptionThatFillsUpTwoBuckets();
|
||||||
|
|
||||||
// they conflict for cycle hour 8
|
|
||||||
subscription.getTime().setCycleTimes(Arrays.asList(Integer.valueOf(6)));
|
subscription.getTime().setCycleTimes(Arrays.asList(Integer.valueOf(6)));
|
||||||
|
|
||||||
List<BandwidthAllocation> unscheduled = bandwidthManager
|
List<BandwidthAllocation> unscheduled = bandwidthManager
|
||||||
|
@ -432,6 +466,7 @@ public class BandwidthManagerIntTest extends AbstractBandwidthManagerIntTest {
|
||||||
|
|
||||||
// Hey look, this subscription will fit now!
|
// Hey look, this subscription will fit now!
|
||||||
subscription.setDataSetSize(subscription.getDataSetSize() / 2);
|
subscription.setDataSetSize(subscription.getDataSetSize() / 2);
|
||||||
|
subscription.setUnscheduled(false);
|
||||||
|
|
||||||
unscheduled = bandwidthManager.subscriptionUpdated(subscription);
|
unscheduled = bandwidthManager.subscriptionUpdated(subscription);
|
||||||
|
|
||||||
|
@ -456,15 +491,14 @@ public class BandwidthManagerIntTest extends AbstractBandwidthManagerIntTest {
|
||||||
public void testDetermineRequiredLatencyReturnsNecessaryLatency()
|
public void testDetermineRequiredLatencyReturnsNecessaryLatency()
|
||||||
throws SerializationException {
|
throws SerializationException {
|
||||||
|
|
||||||
// Subscription starts out too big
|
Subscription subscription = createSubscriptionThatFillsUpTenBuckets();
|
||||||
Subscription subscription = createSubscriptionThatFillsUpTwoBuckets();
|
|
||||||
subscription.getTime().setCycleTimes(Arrays.asList(Integer.valueOf(0)));
|
subscription.getTime().setCycleTimes(Arrays.asList(Integer.valueOf(0)));
|
||||||
subscription.setLatencyInMinutes(0);
|
subscription.setLatencyInMinutes(0);
|
||||||
|
|
||||||
int requiredLatency = bandwidthManager
|
int requiredLatency = bandwidthManager
|
||||||
.determineRequiredLatency(subscription);
|
.determineRequiredLatency(subscription);
|
||||||
|
|
||||||
assertEquals("The required latency was calculated incorrectly", 6,
|
assertEquals("The required latency was calculated incorrectly", 30,
|
||||||
requiredLatency);
|
requiredLatency);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -712,7 +746,7 @@ public class BandwidthManagerIntTest extends AbstractBandwidthManagerIntTest {
|
||||||
final List<BandwidthAllocation> bandwidthAllocations = bandwidthDao
|
final List<BandwidthAllocation> bandwidthAllocations = bandwidthDao
|
||||||
.getBandwidthAllocations(subscription.getRoute());
|
.getBandwidthAllocations(subscription.getRoute());
|
||||||
|
|
||||||
assertEquals("Incorrect number of allocations found.", 4,
|
assertEquals("Incorrect number of allocations found.", 0,
|
||||||
bandwidthAllocations.size());
|
bandwidthAllocations.size());
|
||||||
|
|
||||||
sendDeletedSubscriptionEvent(subscription);
|
sendDeletedSubscriptionEvent(subscription);
|
||||||
|
@ -745,7 +779,7 @@ public class BandwidthManagerIntTest extends AbstractBandwidthManagerIntTest {
|
||||||
final List<SubscriptionDao> subscriptionDaos = bandwidthDao
|
final List<SubscriptionDao> subscriptionDaos = bandwidthDao
|
||||||
.getSubscriptionDao(subscription);
|
.getSubscriptionDao(subscription);
|
||||||
|
|
||||||
assertEquals("Incorrect number of subscription daos found.", 4,
|
assertEquals("Incorrect number of subscription daos found.", 0,
|
||||||
subscriptionDaos.size());
|
subscriptionDaos.size());
|
||||||
|
|
||||||
sendDeletedSubscriptionEvent(subscription);
|
sendDeletedSubscriptionEvent(subscription);
|
||||||
|
|
|
@ -47,6 +47,7 @@ import com.raytheon.uf.common.datadelivery.registry.AdhocSubscription;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.AdhocSubscriptionFixture;
|
import com.raytheon.uf.common.datadelivery.registry.AdhocSubscriptionFixture;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.Network;
|
import com.raytheon.uf.common.datadelivery.registry.Network;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||||
|
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
|
||||||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
import com.raytheon.uf.common.serialization.SerializationUtil;
|
||||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthAllocation;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthAllocation;
|
||||||
|
@ -425,7 +426,7 @@ public class BandwidthServiceIntTest extends AbstractBandwidthManagerIntTest {
|
||||||
|
|
||||||
Subscription subscription = createSubscriptionThatFillsUpTwoBuckets();
|
Subscription subscription = createSubscriptionThatFillsUpTwoBuckets();
|
||||||
subscription.setLatencyInMinutes(6);
|
subscription.setLatencyInMinutes(6);
|
||||||
subscription.setPriority(2);
|
subscription.setPriority(SubscriptionPriority.HIGH);
|
||||||
|
|
||||||
// Reserves a full bucket at 19700103 18:03:00 which fragments the
|
// Reserves a full bucket at 19700103 18:03:00 which fragments the
|
||||||
// subscription to 19700103 18:00:00 and 18:06:00
|
// subscription to 19700103 18:00:00 and 18:06:00
|
||||||
|
@ -538,9 +539,9 @@ public class BandwidthServiceIntTest extends AbstractBandwidthManagerIntTest {
|
||||||
|
|
||||||
// Two subscriptions that will fill up a bucket exactly
|
// Two subscriptions that will fill up a bucket exactly
|
||||||
Subscription subscription = createSubscriptionThatFillsUpABucket();
|
Subscription subscription = createSubscriptionThatFillsUpABucket();
|
||||||
subscription.setPriority(2);
|
subscription.setPriority(SubscriptionPriority.NORMAL);
|
||||||
Subscription subscription2 = createSubscriptionThatFillsUpABucket();
|
Subscription subscription2 = createSubscriptionThatFillsUpABucket();
|
||||||
subscription.setPriority(4);
|
subscription.setPriority(SubscriptionPriority.HIGH);
|
||||||
|
|
||||||
// subscription2 will not be able to schedule for cycle hour 8
|
// subscription2 will not be able to schedule for cycle hour 8
|
||||||
subscription.getTime().setCycleTimes(
|
subscription.getTime().setCycleTimes(
|
||||||
|
@ -552,7 +553,8 @@ public class BandwidthServiceIntTest extends AbstractBandwidthManagerIntTest {
|
||||||
service.schedule(subscription2);
|
service.schedule(subscription2);
|
||||||
|
|
||||||
BandwidthGraphData graphData = service.getBandwidthGraphData();
|
BandwidthGraphData graphData = service.getBandwidthGraphData();
|
||||||
final Map<String, Integer> priorityMap = graphData.getPriorityMap();
|
final Map<String, SubscriptionPriority> priorityMap = graphData
|
||||||
|
.getPriorityMap();
|
||||||
|
|
||||||
assertThat(priorityMap.get(subscription.getName()),
|
assertThat(priorityMap.get(subscription.getName()),
|
||||||
is(equalTo(subscription.getPriority())));
|
is(equalTo(subscription.getPriority())));
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.util.Date;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
|
||||||
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
||||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||||
import com.raytheon.uf.common.util.AbstractFixture;
|
import com.raytheon.uf.common.util.AbstractFixture;
|
||||||
|
@ -79,7 +80,7 @@ public abstract class BaseSubscriptionFixture<T extends Subscription> extends
|
||||||
subscription.setParameter(Lists.<Parameter> newArrayList());
|
subscription.setParameter(Lists.<Parameter> newArrayList());
|
||||||
// Same priority for all, individual tests needing to test specific
|
// Same priority for all, individual tests needing to test specific
|
||||||
// priorities should set it manually anyway
|
// priorities should set it manually anyway
|
||||||
subscription.setPriority(1);
|
subscription.setPriority(SubscriptionPriority.NORMAL);
|
||||||
subscription.setProvider(ProviderFixture.INSTANCE.get(seedValue)
|
subscription.setProvider(ProviderFixture.INSTANCE.get(seedValue)
|
||||||
.getName());
|
.getName());
|
||||||
subscription.setSubscriptionStart(subscription.getActivePeriodStart());
|
subscription.setSubscriptionStart(subscription.getActivePeriodStart());
|
||||||
|
|
|
@ -21,6 +21,7 @@ package com.raytheon.uf.common.datadelivery.registry;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
|
||||||
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
||||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||||
|
|
||||||
|
@ -73,7 +74,7 @@ public class SubscriptionBuilder {
|
||||||
|
|
||||||
private String owner = "your_user";
|
private String owner = "your_user";
|
||||||
|
|
||||||
private int priority = 1;
|
private SubscriptionPriority priority = SubscriptionPriority.NORMAL;
|
||||||
|
|
||||||
private Date subscriptionStart = TimeUtil.newDate();
|
private Date subscriptionStart = TimeUtil.newDate();
|
||||||
|
|
||||||
|
@ -256,7 +257,7 @@ public class SubscriptionBuilder {
|
||||||
* @param priority
|
* @param priority
|
||||||
* the priority to set
|
* the priority to set
|
||||||
*/
|
*/
|
||||||
public SubscriptionBuilder withPriority(int priority) {
|
public SubscriptionBuilder withPriority(SubscriptionPriority priority) {
|
||||||
this.priority = priority;
|
this.priority = priority;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue