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:41c0ff85ff
[formerly41c0ff85ff
[formerly b6dbc5f3117832ce8bda1698043d7941398f11b1]] Former-commit-id:f88a5c1b95
Former-commit-id:4465094fe9
This commit is contained in:
parent
45eaf08797
commit
b78257ab11
29 changed files with 253 additions and 183 deletions
|
@ -20,6 +20,7 @@
|
|||
package com.raytheon.uf.viz.datadelivery.bandwidth.ui;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -30,7 +31,7 @@ import org.eclipse.swt.graphics.Rectangle;
|
|||
import org.eclipse.swt.widgets.Composite;
|
||||
|
||||
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.
|
||||
|
@ -42,7 +43,8 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryGUIUtils.SubscriptionP
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 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>
|
||||
*
|
||||
|
@ -137,10 +139,11 @@ public class BandwidthImageMgr implements IGraphOptions {
|
|||
private void init(Composite parentComp, BandwidthGraphData graphData,
|
||||
Map<CanvasImages, CanvasSettings> canvasSettingsMap) {
|
||||
|
||||
priorityColorMap = new HashMap<SubscriptionPriority, RGB>();
|
||||
for (SubscriptionPriority priority : SubscriptionPriority.values()) {
|
||||
priorityColorMap.put(priority, priority.getColor());
|
||||
}
|
||||
priorityColorMap = new EnumMap<SubscriptionPriority, RGB>(
|
||||
SubscriptionPriority.class);
|
||||
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>();
|
||||
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.TimeWindowData;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.viz.datadelivery.bandwidth.ui.BandwidthImageMgr.SortBy;
|
||||
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryGUIUtils.SubscriptionPriority;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* Jan 07, 2013 1451 djohnson Use TimeUtil.newGmtCalendar().
|
||||
* 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>
|
||||
*
|
||||
|
@ -171,20 +172,17 @@ public class GraphImage extends AbstractCanvasImage {
|
|||
|
||||
for (String subName : subscriptionList) {
|
||||
if (imageMgr.isColorByPriority()) {
|
||||
if (graphData.getPriority(subName) == SubscriptionPriority.NORMAL
|
||||
.ordinal()) {
|
||||
if (graphData.getPriority(subName) == SubscriptionPriority.NORMAL) {
|
||||
c = new Color(
|
||||
display,
|
||||
imageMgr.getPriorityColor(SubscriptionPriority.NORMAL));
|
||||
gc.setBackground(c);
|
||||
} else if (graphData.getPriority(subName) == SubscriptionPriority.HIGH
|
||||
.ordinal()) {
|
||||
} else if (graphData.getPriority(subName) == SubscriptionPriority.HIGH) {
|
||||
c = new Color(
|
||||
display,
|
||||
imageMgr.getPriorityColor(SubscriptionPriority.HIGH));
|
||||
gc.setBackground(c);
|
||||
} else if (graphData.getPriority(subName) == SubscriptionPriority.LOW
|
||||
.ordinal()) {
|
||||
} else if (graphData.getPriority(subName) == SubscriptionPriority.LOW) {
|
||||
c = new Color(display,
|
||||
imageMgr.getPriorityColor(SubscriptionPriority.LOW));
|
||||
gc.setBackground(c);
|
||||
|
|
|
@ -21,7 +21,7 @@ package com.raytheon.uf.viz.datadelivery.bandwidth.ui;
|
|||
|
||||
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
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.eclipse.swt.widgets.ColorDialog;
|
|||
import org.eclipse.swt.widgets.Composite;
|
||||
|
||||
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.
|
||||
|
@ -45,6 +45,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryGUIUtils.SubscriptionP
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 28, 2012 1269 lvenable Initial creation.
|
||||
* Dec 13, 2012 1269 lvenable Fixes and updates.
|
||||
* Jan 25, 2013 1528 djohnson Subscription priority is now an enum.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -75,7 +76,7 @@ public class XHeaderImage extends AbstractCanvasImage {
|
|||
private final String sortBy = "Sort by: ";
|
||||
|
||||
/** Map of rectangles and subscription priorities. */
|
||||
private Map<Rectangle, SubscriptionPriority> rectPriMap;
|
||||
private final Map<Rectangle, SubscriptionPriority> rectPriMap;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
package com.raytheon.uf.viz.datadelivery.common.ui;
|
||||
|
||||
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.GridLayout;
|
||||
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.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
|
||||
|
@ -43,6 +45,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryGUIUtils.SubscriptionP
|
|||
* Jun 27, 2012 702 jpiatt Initial creation.
|
||||
* Aug 21, 2012 712 mpduff Default to Default, and allow for setting the combo box.
|
||||
* Jan 04, 2013 1420 mpduff Add latency.
|
||||
* Jan 25, 2013 1528 djohnson Use priority enum instead of raw integers.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -60,7 +63,7 @@ public class PriorityComp extends Composite {
|
|||
private final int latency;
|
||||
|
||||
/** The priority value */
|
||||
private final int priority;
|
||||
private SubscriptionPriority priority;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -70,10 +73,11 @@ public class PriorityComp extends Composite {
|
|||
* @param latency
|
||||
* @param priority
|
||||
*/
|
||||
public PriorityComp(Composite parent, int latency, int priority) {
|
||||
public PriorityComp(Composite parent, int latency,
|
||||
SubscriptionPriority priority) {
|
||||
super(parent, SWT.NONE);
|
||||
this.latency = latency;
|
||||
this.priority = priority - 1;
|
||||
this.priority = priority;
|
||||
init();
|
||||
}
|
||||
|
||||
|
@ -127,9 +131,16 @@ public class PriorityComp extends Composite {
|
|||
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
priorityCombo = new Combo(priorityComp, SWT.READ_ONLY);
|
||||
priorityCombo.setItems(priorities);
|
||||
priorityCombo.select(this.priority);
|
||||
priorityCombo.setLayoutData(gd);
|
||||
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);
|
||||
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
|
@ -153,8 +164,8 @@ public class PriorityComp extends Composite {
|
|||
*
|
||||
* @return priority
|
||||
*/
|
||||
public int getPriorityIndex() {
|
||||
return priorityCombo.getSelectionIndex();
|
||||
public SubscriptionPriority getPriority() {
|
||||
return priority;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -162,10 +173,9 @@ public class PriorityComp extends Composite {
|
|||
*
|
||||
* @param index
|
||||
*/
|
||||
public void setPriorityIndex(int index) {
|
||||
if (index <= priorityCombo.getItemCount()) {
|
||||
priorityCombo.select(index);
|
||||
}
|
||||
public void setPriority(SubscriptionPriority priority) {
|
||||
priorityCombo.select(priorityCombo.indexOf(priority.getPriorityName()));
|
||||
this.priority = priority;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -39,6 +39,7 @@ import org.eclipse.swt.widgets.Shell;
|
|||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
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.viz.datadelivery.common.ui.ActivePeriodComp;
|
||||
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.
|
||||
* Jan 02, 2013 1441 djohnson Add isGroupSelected().
|
||||
* Jan 04, 2013 1420 mpduff Add latency.
|
||||
* Jan 25, 2013 1528 djohnson Use priority enum instead of raw integers.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -195,7 +197,8 @@ public class CreateSubscriptionDlg extends CaveSWTDialog implements
|
|||
// Get latency value
|
||||
SystemRuleManager ruleManager = SystemRuleManager.getInstance();
|
||||
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);
|
||||
|
||||
this.createCycleGroup();
|
||||
|
@ -517,16 +520,16 @@ public class CreateSubscriptionDlg extends CaveSWTDialog implements
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int getPriority() {
|
||||
return priorityComp.getPriorityIndex();
|
||||
public SubscriptionPriority getPriority() {
|
||||
return priorityComp.getPriority();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setPriority(int i) {
|
||||
priorityComp.setPriorityIndex(i);
|
||||
public void setPriority(SubscriptionPriority priority) {
|
||||
priorityComp.setPriority(priority);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -842,14 +845,6 @@ public class CreateSubscriptionDlg extends CaveSWTDialog implements
|
|||
this.subscription = subscription;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int getPriorityValue() {
|
||||
return priorityComp.getPriorityIndex();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@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 21, 2012 712 mpduff Make priorities display as 1, 2, 3.
|
||||
* 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>
|
||||
*
|
||||
* @author mpduff
|
||||
|
@ -67,7 +68,7 @@ public class SubscriptionManagerRowData implements ITableData<SubscriptionManage
|
|||
private boolean active = false;
|
||||
|
||||
/** Subscription priority of fulfillment. */
|
||||
private int priority = 2;
|
||||
private int priority;
|
||||
|
||||
/** Subscription description. */
|
||||
private String description = null;
|
||||
|
@ -493,7 +494,7 @@ public class SubscriptionManagerRowData implements ITableData<SubscriptionManage
|
|||
|
||||
this.setName(subscription.getName());
|
||||
this.setOwner(subscription.getOwner());
|
||||
this.setPriority(subscription.getPriority() + 1);
|
||||
this.setPriority(subscription.getPriority().getPriorityValue());
|
||||
this.setSubscriptionStart(subscription.getSubscriptionStart());
|
||||
this.setSubscriptionEnd(subscription.getSubscriptionEnd());
|
||||
this.setActive(subscription.isActive());
|
||||
|
|
|
@ -52,6 +52,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* Jul 25, 2012 955 djohnson Use List instead of ArrayList.
|
||||
* Sep 24, 2012 1157 mpduff Use InitialPendingSubsription.
|
||||
* Dec 10, 2012 1259 bsteffen Switch Data Delivery from LatLon to referenced envelopes.
|
||||
* Jan 25, 2013 1528 djohnson Compare priorities as primitive ints.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -115,7 +116,7 @@ public class SubscriptionDiff {
|
|||
|
||||
getMap();
|
||||
|
||||
if (!(sub.getPriority().equals(pendingSub.getPriority()))) {
|
||||
if (sub.getPriority() != pendingSub.getPriority()) {
|
||||
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.PendingSubscription;
|
||||
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.handlers.IPendingSubscriptionHandler;
|
||||
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 14, 2013 1286 djohnson Check that message to display is not null or empty, and
|
||||
* 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>
|
||||
*
|
||||
* @author mpduff
|
||||
|
@ -373,6 +375,10 @@ public class CreateSubscriptionDlgPresenter {
|
|||
view.setActiveEndDateBtnEnabled(false);
|
||||
}
|
||||
|
||||
if (!create) {
|
||||
view.setPriority(subscription.getPriority());
|
||||
}
|
||||
|
||||
List<Integer> cycleTimes = subscription.getTime().getCycleTimes();
|
||||
if (cycleTimes != null) {
|
||||
List<String> cycleStrings = new ArrayList<String>();
|
||||
|
@ -504,8 +510,8 @@ public class CreateSubscriptionDlgPresenter {
|
|||
}
|
||||
|
||||
// priority
|
||||
int priorityInd = view.getPriority();
|
||||
subscription.setPriority(priorityInd);
|
||||
SubscriptionPriority priority = view.getPriority();
|
||||
subscription.setPriority(priority);
|
||||
|
||||
subscription.setOfficeID(LocalizationManager.getInstance()
|
||||
.getCurrentSite());
|
||||
|
|
|
@ -33,6 +33,7 @@ import org.eclipse.swt.widgets.List;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
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.subscription.subset.presenter.IGriddedTimingSelectionDlgView;
|
||||
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
|
||||
* Nov 20, 2012 1286 djohnson Implement displayYesNoPopup.
|
||||
* Jan 04, 2013 1420 mpduff Add Priority Composite.
|
||||
* Jan 25, 2013 1528 djohnson Subscription priority is now an enum.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -137,7 +139,8 @@ public class GriddedTimingSelectionDlg extends CaveSWTDialog implements
|
|||
// Get latency value
|
||||
SystemRuleManager ruleManager = SystemRuleManager.getInstance();
|
||||
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);
|
||||
|
||||
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
|
||||
|
@ -337,7 +340,7 @@ public class GriddedTimingSelectionDlg extends CaveSWTDialog implements
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int getPriority() {
|
||||
return priorityComp.getPriorityIndex();
|
||||
public SubscriptionPriority getPriority() {
|
||||
return priorityComp.getPriority();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -562,7 +562,6 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
|
|||
sub.setOfficeID(LocalizationManager.getInstance().getCurrentSite());
|
||||
if (create) {
|
||||
sub.setOwner(LocalizationManager.getInstance().getCurrentUser());
|
||||
sub.setPriority(1);
|
||||
} else {
|
||||
sub.setOwner(this.subscription.getOwner());
|
||||
sub.setGroupName(this.subscription.getGroupName());
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
**/
|
||||
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.components.ButtonConf;
|
||||
import com.raytheon.viz.ui.presenter.components.CheckBoxConf;
|
||||
|
@ -119,9 +120,9 @@ public interface IGriddedTimingSelectionDlgView extends IPresenterView {
|
|||
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 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.components.ButtonConf;
|
||||
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.
|
||||
* Jan 02, 2013 1441 djohnson Add isGroupSelected.
|
||||
* Jan 04, 2013 1420 mpduff Added getters for latency and priority.
|
||||
* Jan 25, 2013 1528 djohnson Subscription priority is now an enum.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -210,14 +212,14 @@ public interface ICreateSubscriptionDlgView extends IPresenterView {
|
|||
*
|
||||
* @return
|
||||
*/
|
||||
int getPriority();
|
||||
SubscriptionPriority getPriority();
|
||||
|
||||
/**
|
||||
* Set the priority selection
|
||||
*
|
||||
* @param i
|
||||
* @param subscriptionPriority
|
||||
*/
|
||||
void setPriority(int i);
|
||||
void setPriority(SubscriptionPriority subscriptionPriority);
|
||||
|
||||
/**
|
||||
* Open the dialog
|
||||
|
@ -406,13 +408,6 @@ public interface ICreateSubscriptionDlgView extends IPresenterView {
|
|||
*/
|
||||
int getLatencyValue();
|
||||
|
||||
/**
|
||||
* Get the priority value.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int getPriorityValue();
|
||||
|
||||
/**
|
||||
* Set Subscription.
|
||||
*
|
||||
|
|
|
@ -24,6 +24,8 @@ import javax.xml.bind.annotation.XmlAccessorType;
|
|||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
|
||||
|
||||
/**
|
||||
* Priority rule xml object.
|
||||
*
|
||||
|
@ -34,6 +36,7 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 19, 2012 1420 mpduff Initial creation.
|
||||
* Jan 25, 2013 1528 djohnson Subscription priority is now an enum.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -44,20 +47,20 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||
@XmlRootElement
|
||||
public class PriorityRuleXML extends RuleXML {
|
||||
@XmlElement(name = "priority")
|
||||
private Integer priority;
|
||||
private SubscriptionPriority priority;
|
||||
|
||||
/**
|
||||
* @param priority
|
||||
* the priority to set
|
||||
*/
|
||||
public void setPriority(Integer priority) {
|
||||
public void setPriority(SubscriptionPriority priority) {
|
||||
this.priority = priority;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the priority
|
||||
*/
|
||||
public Integer getPriority() {
|
||||
public SubscriptionPriority getPriority() {
|
||||
return priority;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.eclipse.swt.widgets.Layout;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
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.UFStatus;
|
||||
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.RuleXML;
|
||||
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.NameOperationItems;
|
||||
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.
|
||||
* Jan 14, 2013 1286 djohnson Rule operators are now used as objects.
|
||||
* Jan 17, 2013 1357 mpduff Moved DataSizeUnit.
|
||||
* Jan 25, 2013 1528 djohnson Subscription priority is now an enum.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -543,17 +544,17 @@ public class CreateEditRuleDlg extends CaveSWTDialog {
|
|||
}
|
||||
|
||||
if (PRIORITY_TYPE.equals(ruleType)) {
|
||||
Integer priority = ((PriorityRuleXML) ruleXml).getPriority();
|
||||
SubscriptionPriority priority = ((PriorityRuleXML) ruleXml)
|
||||
.getPriority();
|
||||
|
||||
int o = 0;
|
||||
SubscriptionPriority[] priorityOptions = SubscriptionPriority
|
||||
.values();
|
||||
for (SubscriptionPriority item : priorityOptions) {
|
||||
if (priority == item.getPriorityValue()) {
|
||||
priorityCombo.select(o);
|
||||
if (priority == item) {
|
||||
priorityCombo.select(priorityCombo.indexOf(priority
|
||||
.getPriorityName()));
|
||||
break;
|
||||
}
|
||||
o++;
|
||||
}
|
||||
} else {
|
||||
Integer latency = ((LatencyRuleXML) ruleXml).getLatency();
|
||||
|
@ -732,12 +733,11 @@ public class CreateEditRuleDlg extends CaveSWTDialog {
|
|||
|
||||
if (PRIORITY_TYPE.equals(ruleType)) {
|
||||
PriorityRuleXML rule = new PriorityRuleXML();
|
||||
priorityVal = SubscriptionPriority.valueOf(priorityCombo.getText()
|
||||
.toUpperCase());
|
||||
priorityVal = SubscriptionPriority.fromPriorityName(priorityCombo
|
||||
.getText());
|
||||
for (SubscriptionPriority pri : SubscriptionPriority.values()) {
|
||||
if (pri.equals(priorityVal)) {
|
||||
priority = pri.getPriorityValue();
|
||||
(rule).setPriority(priority);
|
||||
rule.setPriority(pri);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import javax.xml.bind.Unmarshaller;
|
|||
import com.raytheon.uf.common.datadelivery.bandwidth.IBandwidthService;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Network;
|
||||
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.ILocalizationFileObserver;
|
||||
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.
|
||||
* Oct 23, 2012 1286 djohnson Hook into bandwidth management.
|
||||
* Jan 04, 2013 1420 mpduff Move rules into a single file.
|
||||
* Jan 25, 2013 1528 djohnson Subscription priority is now an enum.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -498,22 +500,23 @@ public class SystemRuleManager {
|
|||
* @param cycleTimes
|
||||
* @return
|
||||
*/
|
||||
public int getPriority(Subscription sub, Set<Integer> cycleTimes) {
|
||||
public SubscriptionPriority getPriority(Subscription sub,
|
||||
Set<Integer> cycleTimes) {
|
||||
PriorityRulesXML rulesXml = this.getPriorityRules(false);
|
||||
int priority = 3;
|
||||
boolean found = false;
|
||||
SubscriptionPriority priority = null;
|
||||
for (PriorityRuleXML rule : rulesXml.getRules()) {
|
||||
if (rule.matches(sub, cycleTimes)) {
|
||||
if (rule.getPriority() < priority) {
|
||||
if (priority == null
|
||||
|| rule.getPriority().getPriorityValue() < priority
|
||||
.getPriorityValue()) {
|
||||
priority = rule.getPriority();
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Default to normal priority
|
||||
if (!found) {
|
||||
priority = 2;
|
||||
if (priority == null) {
|
||||
priority = SubscriptionPriority.NORMAL;
|
||||
}
|
||||
|
||||
return priority;
|
||||
|
|
|
@ -25,10 +25,7 @@ import java.util.Date;
|
|||
import java.util.TimeZone;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.xml.bind.annotation.XmlEnumValue;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
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 18, 2012 1439 mpduff Change Regex to match invalid chars.
|
||||
* 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>
|
||||
*
|
||||
|
@ -108,67 +106,6 @@ public class DataDeliveryGUIUtils {
|
|||
/** Name Required Message */
|
||||
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.
|
||||
*/
|
||||
|
|
|
@ -453,7 +453,8 @@ public class DataDeliveryUtils {
|
|||
.append(newline);
|
||||
fmtStr.append("Provider : ").append(sub.getProvider()).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);
|
||||
final Coverage coverage = sub.getCoverage();
|
||||
|
|
|
@ -27,23 +27,25 @@ import java.util.Map;
|
|||
import java.util.Map.Entry;
|
||||
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.DynamicSerializeElement;
|
||||
|
||||
/**
|
||||
* Response object for the GraphDataRequest.
|
||||
*
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 25, 2012 1269 lvenable Initial creation.
|
||||
* Dec 06, 2012 1397 djohnson Add dynamic serialize class annotation.
|
||||
*
|
||||
* Jan 25, 2013 1528 djohnson Subscription priority is now an enum.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @author lvenable
|
||||
* @version 1.0
|
||||
*/
|
||||
|
@ -55,7 +57,7 @@ public class BandwidthGraphData {
|
|||
|
||||
/** Subscription Name -> Subscription Priority */
|
||||
@DynamicSerializeElement
|
||||
private Map<String, Integer> priorityMap;
|
||||
private Map<String, SubscriptionPriority> priorityMap;
|
||||
|
||||
/** Bin duration in minutes */
|
||||
@DynamicSerializeElement
|
||||
|
@ -81,7 +83,7 @@ public class BandwidthGraphData {
|
|||
public BandwidthGraphData(int binTimeMins) {
|
||||
this.binTimeInMins = binTimeMins;
|
||||
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
|
||||
*/
|
||||
public Map<String, Integer> getPriorityMap() {
|
||||
public Map<String, SubscriptionPriority> getPriorityMap() {
|
||||
return priorityMap;
|
||||
}
|
||||
|
||||
|
@ -110,7 +112,7 @@ public class BandwidthGraphData {
|
|||
* @param priorityMap
|
||||
* the priorityMap to set
|
||||
*/
|
||||
public void setPriorityMap(Map<String, Integer> priorityMap) {
|
||||
public void setPriorityMap(Map<String, SubscriptionPriority> priorityMap) {
|
||||
this.priorityMap = priorityMap;
|
||||
}
|
||||
|
||||
|
@ -145,7 +147,8 @@ public class BandwidthGraphData {
|
|||
* @param priority
|
||||
* @param dataArray
|
||||
*/
|
||||
public void addGraphDataArray(String subscriptionName, int priority,
|
||||
public void addGraphDataArray(String subscriptionName,
|
||||
SubscriptionPriority priority,
|
||||
List<TimeWindowData> dataArray) {
|
||||
dataMap.put(subscriptionName, dataArray);
|
||||
priorityMap.put(subscriptionName, priority);
|
||||
|
@ -206,14 +209,15 @@ public class BandwidthGraphData {
|
|||
* The subscription name.
|
||||
* @return The priority number.
|
||||
*/
|
||||
public int getPriority(String subscriptionName) {
|
||||
public SubscriptionPriority getPriority(String subscriptionName) {
|
||||
if (priorityMap.containsKey(subscriptionName)) {
|
||||
return priorityMap.get(subscriptionName);
|
||||
}
|
||||
|
||||
// This should never occur. A low priority number is being return rather
|
||||
// than a null.
|
||||
return 99;
|
||||
// This should never occur.
|
||||
throw new IllegalArgumentException(
|
||||
"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.XmlElement;
|
||||
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.XmlSeeAlso;
|
||||
|
||||
|
@ -50,6 +52,7 @@ import com.raytheon.uf.common.time.util.TimeUtil;
|
|||
* Nov 20, 2012 1286 djohnson Add unscheduled.
|
||||
* Dec 12, 2012 1433 bgonzale Refactored Subscription copy ctor into two ctors.
|
||||
* Jan 03, 2013 1441 djohnson Default to no group.
|
||||
* Jan 25, 2013 1528 djohnson Subscription priority is now an enum.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -66,6 +69,73 @@ import com.raytheon.uf.common.time.util.TimeUtil;
|
|||
Subscription.DATA_SET_SLOT, Subscription.OWNER_SLOT })
|
||||
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;
|
||||
|
||||
/** Dataset Name slot */
|
||||
|
@ -166,7 +236,7 @@ public class Subscription implements ISerializableObject, Serializable {
|
|||
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private Integer priority;
|
||||
private SubscriptionPriority priority = SubscriptionPriority.NORMAL;
|
||||
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
|
@ -363,7 +433,7 @@ public class Subscription implements ISerializableObject, Serializable {
|
|||
*
|
||||
* @return subscription name
|
||||
*/
|
||||
public Integer getPriority() {
|
||||
public SubscriptionPriority getPriority() {
|
||||
return priority;
|
||||
}
|
||||
|
||||
|
@ -373,7 +443,7 @@ public class Subscription implements ISerializableObject, Serializable {
|
|||
* @param priority
|
||||
* priority
|
||||
*/
|
||||
public void setPriority(Integer priority) {
|
||||
public void setPriority(SubscriptionPriority priority) {
|
||||
this.priority = priority;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,11 @@ import com.google.common.collect.ArrayListMultimap;
|
|||
import com.google.common.collect.Multimap;
|
||||
import com.raytheon.uf.common.datadelivery.bandwidth.data.BandwidthGraphData;
|
||||
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.edex.datadelivery.bandwidth.dao.BandwidthAllocation;
|
||||
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
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 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>
|
||||
*
|
||||
|
@ -59,6 +65,8 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalPlan.Bandw
|
|||
*/
|
||||
|
||||
class BandwidthGraphDataAdapter {
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(BandwidthGraphDataAdapter.class);
|
||||
|
||||
private final RetrievalManager retrievalManager;
|
||||
|
||||
|
@ -88,7 +96,7 @@ class BandwidthGraphDataAdapter {
|
|||
.getBucketMinutes());
|
||||
|
||||
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>();
|
||||
Multimap<Long, BandwidthReservation> reservations = ArrayListMultimap
|
||||
|
@ -133,7 +141,16 @@ class BandwidthGraphDataAdapter {
|
|||
final SubscriptionRetrieval value = entry.getValue();
|
||||
SubscriptionDao dao = value.getSubscriptionDao();
|
||||
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);
|
||||
|
||||
|
|
|
@ -96,6 +96,7 @@ import com.raytheon.uf.edex.event.EventBus;
|
|||
* 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 12, 2012 1286 djohnson Remove shutdown hook and finalize().
|
||||
* Jan 25, 2013 1528 djohnson Compare priorities as primitive ints.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -796,7 +797,7 @@ abstract class BandwidthManager extends
|
|||
boolean requiresReschedule = (old.getDataSetSize() != subscription
|
||||
.getDataSetSize())
|
||||
// Priority is different
|
||||
|| (!old.getPriority().equals(subscription.getPriority()))
|
||||
|| (old.getPriority() != subscription.getPriority())
|
||||
// Latency is different
|
||||
|| (!(old.getLatencyInMinutes() == subscription
|
||||
.getLatencyInMinutes()));
|
||||
|
|
|
@ -298,4 +298,16 @@ public class BandwidthAllocation implements IPersistableDataObject<Long>,
|
|||
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.
|
||||
* 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.
|
||||
*
|
||||
* Jan 25, 2013 1528 djohnson Lower priority requests should not be able to unschedule higher priority requests.
|
||||
* </pre>
|
||||
*
|
||||
* @version 1.0
|
||||
|
@ -180,7 +180,10 @@ public class PriorityRetrievalScheduler implements IRetrievalScheduler {
|
|||
for (BandwidthBucket bucket : window) {
|
||||
for (BandwidthAllocation o : bucket.getRequests()) {
|
||||
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;
|
||||
lowerPriorityRequests.add(o);
|
||||
}
|
||||
|
|
|
@ -207,7 +207,7 @@ public class BandwidthUtil {
|
|||
// will have to revisit when other data type are introduced.
|
||||
// perhaps minute of the day?
|
||||
dao.setCycle(baseReferenceTime.get(Calendar.HOUR_OF_DAY));
|
||||
dao.setPriority(subscription.getPriority());
|
||||
dao.setPriority(subscription.getPriority().getPriorityValue());
|
||||
dao.setRegistryId(subscription.getId());
|
||||
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.ParameterFixture;
|
||||
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.Time;
|
||||
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 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.
|
||||
* Jan 25, 2013 1528 djohnson Compare priorities as primitive ints.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -313,7 +315,7 @@ public class BandwidthManagerIntTest extends AbstractBandwidthManagerIntTest {
|
|||
Subscription subscription2 = createSubscriptionThatFillsUpABucket();
|
||||
|
||||
// subscription2 will have higher priority
|
||||
subscription2.setPriority(subscription.getPriority() + 1);
|
||||
subscription2.setPriority(SubscriptionPriority.HIGH);
|
||||
|
||||
// they conflict for cycle hour 8
|
||||
subscription.getTime().setCycleTimes(
|
||||
|
@ -335,13 +337,13 @@ public class BandwidthManagerIntTest extends AbstractBandwidthManagerIntTest {
|
|||
BandwidthAllocation unscheduledAllocation = iter.next();
|
||||
assertEquals(
|
||||
"The first subscription with lower priority should have been the one unscheduled.",
|
||||
subscription.getPriority().intValue(),
|
||||
subscription.getPriority().getPriorityValue(),
|
||||
unscheduledAllocation.getPriority(), 0.0);
|
||||
|
||||
unscheduledAllocation = iter.next();
|
||||
assertEquals(
|
||||
"The first subscription with lower priority should have been the one unscheduled.",
|
||||
subscription.getPriority().intValue(),
|
||||
subscription.getPriority().getPriorityValue(),
|
||||
unscheduledAllocation.getPriority(), 0.0);
|
||||
}
|
||||
|
||||
|
@ -352,7 +354,7 @@ public class BandwidthManagerIntTest extends AbstractBandwidthManagerIntTest {
|
|||
Subscription subscription2 = createSubscriptionThatFillsUpABucket();
|
||||
|
||||
// subscription2 will have higher priority
|
||||
subscription2.setPriority(subscription.getPriority() + 1);
|
||||
subscription2.setPriority(SubscriptionPriority.HIGH);
|
||||
|
||||
// they conflict for cycle hour 8
|
||||
subscription.getTime().setCycleTimes(
|
||||
|
@ -389,7 +391,7 @@ public class BandwidthManagerIntTest extends AbstractBandwidthManagerIntTest {
|
|||
Subscription subscription2 = createSubscriptionThatFillsUpABucket();
|
||||
|
||||
// subscription2 will have higher priority
|
||||
subscription2.setPriority(subscription.getPriority() + 1);
|
||||
subscription2.setPriority(SubscriptionPriority.HIGH);
|
||||
|
||||
// they conflict for cycle hour 8
|
||||
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.Network;
|
||||
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.time.util.TimeUtil;
|
||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthAllocation;
|
||||
|
@ -425,7 +426,7 @@ public class BandwidthServiceIntTest extends AbstractBandwidthManagerIntTest {
|
|||
|
||||
Subscription subscription = createSubscriptionThatFillsUpTwoBuckets();
|
||||
subscription.setLatencyInMinutes(6);
|
||||
subscription.setPriority(2);
|
||||
subscription.setPriority(SubscriptionPriority.HIGH);
|
||||
|
||||
// Reserves a full bucket at 19700103 18:03:00 which fragments the
|
||||
// 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
|
||||
Subscription subscription = createSubscriptionThatFillsUpABucket();
|
||||
subscription.setPriority(2);
|
||||
subscription.setPriority(SubscriptionPriority.NORMAL);
|
||||
Subscription subscription2 = createSubscriptionThatFillsUpABucket();
|
||||
subscription.setPriority(4);
|
||||
subscription.setPriority(SubscriptionPriority.HIGH);
|
||||
|
||||
// subscription2 will not be able to schedule for cycle hour 8
|
||||
subscription.getTime().setCycleTimes(
|
||||
|
@ -552,7 +553,8 @@ public class BandwidthServiceIntTest extends AbstractBandwidthManagerIntTest {
|
|||
service.schedule(subscription2);
|
||||
|
||||
BandwidthGraphData graphData = service.getBandwidthGraphData();
|
||||
final Map<String, Integer> priorityMap = graphData.getPriorityMap();
|
||||
final Map<String, SubscriptionPriority> priorityMap = graphData
|
||||
.getPriorityMap();
|
||||
|
||||
assertThat(priorityMap.get(subscription.getName()),
|
||||
is(equalTo(subscription.getPriority())));
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.util.Date;
|
|||
import java.util.Random;
|
||||
|
||||
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.time.util.TimeUtil;
|
||||
import com.raytheon.uf.common.util.AbstractFixture;
|
||||
|
@ -79,7 +80,7 @@ public abstract class BaseSubscriptionFixture<T extends Subscription> extends
|
|||
subscription.setParameter(Lists.<Parameter> newArrayList());
|
||||
// Same priority for all, individual tests needing to test specific
|
||||
// priorities should set it manually anyway
|
||||
subscription.setPriority(1);
|
||||
subscription.setPriority(SubscriptionPriority.NORMAL);
|
||||
subscription.setProvider(ProviderFixture.INSTANCE.get(seedValue)
|
||||
.getName());
|
||||
subscription.setSubscriptionStart(subscription.getActivePeriodStart());
|
||||
|
|
|
@ -21,6 +21,7 @@ package com.raytheon.uf.common.datadelivery.registry;
|
|||
|
||||
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.time.util.TimeUtil;
|
||||
|
||||
|
@ -73,7 +74,7 @@ public class SubscriptionBuilder {
|
|||
|
||||
private String owner = "your_user";
|
||||
|
||||
private int priority = 1;
|
||||
private SubscriptionPriority priority = SubscriptionPriority.NORMAL;
|
||||
|
||||
private Date subscriptionStart = TimeUtil.newDate();
|
||||
|
||||
|
@ -256,7 +257,7 @@ public class SubscriptionBuilder {
|
|||
* @param priority
|
||||
* the priority to set
|
||||
*/
|
||||
public SubscriptionBuilder withPriority(int priority) {
|
||||
public SubscriptionBuilder withPriority(SubscriptionPriority priority) {
|
||||
this.priority = priority;
|
||||
return this;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue