Issue #1528 Fix subscription priorities to be the same from domain object to GUI
Fix incorrect use of enum ordinal value mappings to priorities. Fix broken bandwidth priority scheduling. Change-Id: Ic9e220966c20e95fcc3f81f0c647ffcdb2fcbca5 Former-commit-id: b6dbc5f3117832ce8bda1698043d7941398f11b1
This commit is contained in:
parent
e49a718462
commit
f88a5c1b95
29 changed files with 253 additions and 183 deletions
|
@ -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.
|
||||||
|
@ -43,6 +44,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 on subscriptions.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -137,10 +139,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);
|
||||||
|
|
|
@ -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());
|
||||||
|
|
|
@ -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());
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -562,7 +562,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());
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -27,6 +27,7 @@ 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;
|
||||||
|
|
||||||
|
@ -41,6 +42,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* 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>
|
||||||
*
|
*
|
||||||
|
@ -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 + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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 */
|
||||||
|
@ -166,7 +236,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 +433,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 +443,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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,6 +96,7 @@ 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.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -796,7 +797,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()));
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,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 +82,7 @@ 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.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -313,7 +315,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,13 +337,13 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,7 +354,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 +391,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(
|
||||||
|
|
|
@ -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