Issue #1653 - Add a subscription summary
Change-Id: I677ae6d472a4de5bd8905650b2e13ffc1e2af149 Former-commit-id: d64a7895e08df47feedfb95edec033d0c87384c1
This commit is contained in:
parent
6f6da35020
commit
823f064ef8
13 changed files with 621 additions and 32 deletions
|
@ -21,6 +21,7 @@ package com.raytheon.uf.viz.datadelivery.subscription;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.datadelivery.bandwidth.data.SubscriptionStatusSummary;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.AdhocSubscription;
|
import com.raytheon.uf.common.datadelivery.registry.AdhocSubscription;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||||
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
||||||
|
@ -38,6 +39,7 @@ import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionService.IForceA
|
||||||
* Nov 7, 2012 1286 djohnson Initial creation
|
* Nov 7, 2012 1286 djohnson Initial creation
|
||||||
* Nov 20, 2012 1286 djohnson Use IDisplay to display yes/no prompt.
|
* Nov 20, 2012 1286 djohnson Use IDisplay to display yes/no prompt.
|
||||||
* Nov 28, 2012 1286 djohnson Consolidate more notifications.
|
* Nov 28, 2012 1286 djohnson Consolidate more notifications.
|
||||||
|
* Jul 18, 2013 1653 mpduff Added SubscriptionStatusSummary to ISubscriptionServiceResult
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -73,6 +75,13 @@ public interface ISubscriptionService {
|
||||||
* @return the message to display
|
* @return the message to display
|
||||||
*/
|
*/
|
||||||
String getMessageToDisplay();
|
String getMessageToDisplay();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the subscription status summary.
|
||||||
|
*
|
||||||
|
* @return The SubscriptionStatusSummary
|
||||||
|
*/
|
||||||
|
SubscriptionStatusSummary getSubscriptionStatusSummary();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -40,6 +40,7 @@ import com.google.common.collect.Sets;
|
||||||
import com.raytheon.uf.common.auth.user.IUser;
|
import com.raytheon.uf.common.auth.user.IUser;
|
||||||
import com.raytheon.uf.common.datadelivery.bandwidth.IBandwidthService;
|
import com.raytheon.uf.common.datadelivery.bandwidth.IBandwidthService;
|
||||||
import com.raytheon.uf.common.datadelivery.bandwidth.IProposeScheduleResponse;
|
import com.raytheon.uf.common.datadelivery.bandwidth.IProposeScheduleResponse;
|
||||||
|
import com.raytheon.uf.common.datadelivery.bandwidth.data.SubscriptionStatusSummary;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.AdhocSubscription;
|
import com.raytheon.uf.common.datadelivery.registry.AdhocSubscription;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription;
|
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.PendingSubscription;
|
import com.raytheon.uf.common.datadelivery.registry.PendingSubscription;
|
||||||
|
@ -84,6 +85,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
|
||||||
* May 14, 2013 2000 djohnson Check for subscription overlap/duplication.
|
* May 14, 2013 2000 djohnson Check for subscription overlap/duplication.
|
||||||
* May 23, 2013 1650 djohnson Move out some presentation logic to DisplayForceApplyPromptDialog.
|
* May 23, 2013 1650 djohnson Move out some presentation logic to DisplayForceApplyPromptDialog.
|
||||||
* Jun 12, 2013 2038 djohnson Launch subscription manager on the UI thread.
|
* Jun 12, 2013 2038 djohnson Launch subscription manager on the UI thread.
|
||||||
|
* Jul 18, 2013 1653 mpduff Add SubscriptionStatusSummary.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -171,6 +173,8 @@ public class SubscriptionService implements ISubscriptionService {
|
||||||
|
|
||||||
private final String message;
|
private final String message;
|
||||||
|
|
||||||
|
private SubscriptionStatusSummary subStatusSummary;
|
||||||
|
|
||||||
private SubscriptionServiceResult(String message) {
|
private SubscriptionServiceResult(String message) {
|
||||||
this(false, message);
|
this(false, message);
|
||||||
}
|
}
|
||||||
|
@ -211,6 +215,16 @@ public class SubscriptionService implements ISubscriptionService {
|
||||||
public String getMessageToDisplay() {
|
public String getMessageToDisplay() {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SubscriptionStatusSummary getSubscriptionStatusSummary() {
|
||||||
|
return this.subStatusSummary;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSubscriptionStatusSummary(
|
||||||
|
SubscriptionStatusSummary subscriptionStatusSummary) {
|
||||||
|
this.subStatusSummary = subscriptionStatusSummary;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -371,7 +385,15 @@ public class SubscriptionService implements ISubscriptionService {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return performAction(subscriptions, action, displayTextStrategy);
|
SubscriptionServiceResult result = performAction(subscriptions, action,
|
||||||
|
displayTextStrategy);
|
||||||
|
|
||||||
|
if (!result.allowFurtherEditing) {
|
||||||
|
result.setSubscriptionStatusSummary(bandwidthService
|
||||||
|
.getSubscriptionStatusSummary(subscription));
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,184 @@
|
||||||
|
/**
|
||||||
|
* This software was developed and / or modified by Raytheon Company,
|
||||||
|
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||||
|
*
|
||||||
|
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||||
|
* This software product contains export-restricted data whose
|
||||||
|
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||||
|
* to non-U.S. persons whether in the United States or abroad requires
|
||||||
|
* an export license or other authorization.
|
||||||
|
*
|
||||||
|
* Contractor Name: Raytheon Company
|
||||||
|
* Contractor Address: 6825 Pine Street, Suite 340
|
||||||
|
* Mail Stop B8
|
||||||
|
* Omaha, NE 68106
|
||||||
|
* 402.291.0100
|
||||||
|
*
|
||||||
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
|
* further licensing information.
|
||||||
|
**/
|
||||||
|
package com.raytheon.uf.viz.datadelivery.subscription;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.TimeZone;
|
||||||
|
|
||||||
|
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.Button;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
import org.eclipse.swt.widgets.Layout;
|
||||||
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.datadelivery.bandwidth.data.SubscriptionStatusSummary;
|
||||||
|
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||||
|
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subscription Status Summary dialog.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Jul 18, 2013 1653 mpduff Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author mpduff
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class SubscriptionStatusDlg extends CaveSWTDialog {
|
||||||
|
|
||||||
|
/** The subscription status object */
|
||||||
|
private final SubscriptionStatusSummary summary;
|
||||||
|
|
||||||
|
/** The status message */
|
||||||
|
private final String statusMsg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param parent
|
||||||
|
* The parent shell
|
||||||
|
* @param summary
|
||||||
|
* The summary object
|
||||||
|
* @param statusMsg
|
||||||
|
* The status message
|
||||||
|
*/
|
||||||
|
public SubscriptionStatusDlg(Shell parent,
|
||||||
|
SubscriptionStatusSummary summary, String statusMsg) {
|
||||||
|
super(parent, SWT.DIALOG_TRIM);
|
||||||
|
|
||||||
|
this.summary = summary;
|
||||||
|
this.statusMsg = statusMsg;
|
||||||
|
this.setText("Subscription Summary");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected Layout constructShellLayout() {
|
||||||
|
return new GridLayout(1, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayoutData()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected Object constructShellLayoutData() {
|
||||||
|
return new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void initializeComponents(Shell shell) {
|
||||||
|
GridData gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
|
||||||
|
GridLayout gl = new GridLayout(1, false);
|
||||||
|
Composite mainComp = new Composite(shell, SWT.NONE);
|
||||||
|
mainComp.setLayout(gl);
|
||||||
|
mainComp.setLayoutData(gd);
|
||||||
|
|
||||||
|
Label msgLabel = new Label(mainComp, SWT.NONE);
|
||||||
|
msgLabel.setText(statusMsg);
|
||||||
|
msgLabel.setLayoutData(new GridData(SWT.CENTER, SWT.DEFAULT, true, true));
|
||||||
|
|
||||||
|
createSummary(mainComp);
|
||||||
|
|
||||||
|
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
|
||||||
|
gd.widthHint = 75;
|
||||||
|
Button okBtn = new Button(mainComp, SWT.PUSH);
|
||||||
|
okBtn.setLayoutData(gd);
|
||||||
|
okBtn.setText(" OK ");
|
||||||
|
okBtn.addSelectionListener(new SelectionAdapter() {
|
||||||
|
@Override
|
||||||
|
public void widgetSelected(SelectionEvent event) {
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the summary.
|
||||||
|
*/
|
||||||
|
private void createSummary(Composite mainComp) {
|
||||||
|
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||||
|
GridLayout gl = new GridLayout(2, false);
|
||||||
|
Composite sumComp = new Composite(mainComp, SWT.NONE);
|
||||||
|
sumComp.setLayout(gl);
|
||||||
|
sumComp.setLayoutData(gd);
|
||||||
|
|
||||||
|
Label l1 = new Label(sumComp, SWT.NONE);
|
||||||
|
l1.setLayoutData(new GridData(SWT.LEFT, SWT.DEFAULT, false, false));
|
||||||
|
l1.setText("Dataset Size: ");
|
||||||
|
|
||||||
|
Label l11 = new Label(sumComp, SWT.NONE);
|
||||||
|
l11.setLayoutData(new GridData(SWT.LEFT, SWT.DEFAULT, true, false));
|
||||||
|
l11.setText(summary.getDataSize() + " kB");
|
||||||
|
|
||||||
|
Label l2 = new Label(sumComp, SWT.NONE);
|
||||||
|
l2.setLayoutData(new GridData(SWT.LEFT, SWT.DEFAULT, false, false));
|
||||||
|
l2.setText("Latency: ");
|
||||||
|
|
||||||
|
Label l22 = new Label(sumComp, SWT.NONE);
|
||||||
|
l22.setLayoutData(new GridData(SWT.LEFT, SWT.DEFAULT, true, false));
|
||||||
|
l22.setText(summary.getLatency() + " seconds");
|
||||||
|
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||||
|
|
||||||
|
Label l3 = new Label(sumComp, SWT.NONE);
|
||||||
|
l3.setLayoutData(new GridData(SWT.LEFT, SWT.DEFAULT, false, false));
|
||||||
|
l3.setText("Start Time: ");
|
||||||
|
|
||||||
|
Calendar cal = TimeUtil.newGmtCalendar();
|
||||||
|
cal.setTimeInMillis(summary.getStartTime());
|
||||||
|
Label l33 = new Label(sumComp, SWT.NONE);
|
||||||
|
l33.setLayoutData(new GridData(SWT.LEFT, SWT.DEFAULT, true, false));
|
||||||
|
l33.setText(sdf.format(cal.getTime()));
|
||||||
|
|
||||||
|
Label l4 = new Label(sumComp, SWT.NONE);
|
||||||
|
l4.setLayoutData(new GridData(SWT.LEFT, SWT.DEFAULT, false, false));
|
||||||
|
l4.setText("End Time: ");
|
||||||
|
|
||||||
|
cal.setTimeInMillis(summary.getEndTime());
|
||||||
|
Label l44 = new Label(sumComp, SWT.NONE);
|
||||||
|
l44.setLayoutData(new GridData(SWT.LEFT, SWT.DEFAULT, true, false));
|
||||||
|
l44.setText(sdf.format(cal.getTime()));
|
||||||
|
}
|
||||||
|
}
|
|
@ -25,6 +25,8 @@ import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.ArrayBlockingQueue;
|
||||||
|
import java.util.concurrent.BlockingQueue;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
@ -38,6 +40,7 @@ import com.google.common.annotations.VisibleForTesting;
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.raytheon.uf.common.auth.user.IUser;
|
import com.raytheon.uf.common.auth.user.IUser;
|
||||||
|
import com.raytheon.uf.common.datadelivery.bandwidth.data.SubscriptionStatusSummary;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.DataSet;
|
import com.raytheon.uf.common.datadelivery.registry.DataSet;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.DataType;
|
import com.raytheon.uf.common.datadelivery.registry.DataType;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.GroupDefinition;
|
import com.raytheon.uf.common.datadelivery.registry.GroupDefinition;
|
||||||
|
@ -70,6 +73,7 @@ import com.raytheon.uf.viz.datadelivery.subscription.CancelForceApplyAndIncrease
|
||||||
import com.raytheon.uf.viz.datadelivery.subscription.GroupDefinitionManager;
|
import com.raytheon.uf.viz.datadelivery.subscription.GroupDefinitionManager;
|
||||||
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService;
|
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService;
|
||||||
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService.ISubscriptionServiceResult;
|
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService.ISubscriptionServiceResult;
|
||||||
|
import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionStatusDlg;
|
||||||
import com.raytheon.uf.viz.datadelivery.subscription.view.ICreateSubscriptionDlgView;
|
import com.raytheon.uf.viz.datadelivery.subscription.view.ICreateSubscriptionDlgView;
|
||||||
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryGUIUtils;
|
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryGUIUtils;
|
||||||
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
|
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
|
||||||
|
@ -112,6 +116,7 @@ import com.raytheon.viz.ui.presenter.components.ComboBoxConf;
|
||||||
* Apr 08, 2013 1826 djohnson Remove delivery options.
|
* Apr 08, 2013 1826 djohnson Remove delivery options.
|
||||||
* May 15, 2013 1040 mpduff Add shared sites.
|
* May 15, 2013 1040 mpduff Add shared sites.
|
||||||
* Jun 04, 2013 223 mpduff Add point data.
|
* Jun 04, 2013 223 mpduff Add point data.
|
||||||
|
* Jul 18, 2013 1653 mpduff Add SubscriptionStatusSummary and the display dialog.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author mpduff
|
* @author mpduff
|
||||||
|
@ -551,6 +556,9 @@ public class CreateSubscriptionDlgPresenter {
|
||||||
setSubscriptionId(subscription);
|
setSubscriptionId(subscription);
|
||||||
|
|
||||||
if (autoApprove) {
|
if (autoApprove) {
|
||||||
|
final BlockingQueue<SubscriptionStatusSummary> exchanger = new ArrayBlockingQueue<SubscriptionStatusSummary>(
|
||||||
|
1);
|
||||||
|
|
||||||
final Shell jobShell = view.getShell();
|
final Shell jobShell = view.getShell();
|
||||||
Job job = new Job("Creating Subscription...") {
|
Job job = new Job("Creating Subscription...") {
|
||||||
@Override
|
@Override
|
||||||
|
@ -566,6 +574,10 @@ public class CreateSubscriptionDlgPresenter {
|
||||||
.getName(), result
|
.getName(), result
|
||||||
.getMessageToDisplay());
|
.getMessageToDisplay());
|
||||||
} else {
|
} else {
|
||||||
|
SubscriptionStatusSummary sum = result
|
||||||
|
.getSubscriptionStatusSummary();
|
||||||
|
|
||||||
|
exchanger.add(sum);
|
||||||
return new Status(
|
return new Status(
|
||||||
Status.OK,
|
Status.OK,
|
||||||
CreateSubscriptionDlgPresenter.class
|
CreateSubscriptionDlgPresenter.class
|
||||||
|
@ -600,9 +612,18 @@ public class CreateSubscriptionDlgPresenter {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!view.isDisposed()) {
|
if (!view.isDisposed()) {
|
||||||
if (subscriptionCreated) {
|
if (subscriptionCreated) {
|
||||||
view.displayPopup(
|
try {
|
||||||
CREATED_TITLE,
|
displaySummary(
|
||||||
status.getMessage());
|
exchanger
|
||||||
|
.take(),
|
||||||
|
status.getMessage());
|
||||||
|
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
statusHandler
|
||||||
|
.handle(Priority.PROBLEM,
|
||||||
|
e.getLocalizedMessage(),
|
||||||
|
e);
|
||||||
|
}
|
||||||
view.setStatus(Status.OK);
|
view.setStatus(Status.OK);
|
||||||
view.closeDlg();
|
view.closeDlg();
|
||||||
} else {
|
} else {
|
||||||
|
@ -732,6 +753,15 @@ public class CreateSubscriptionDlgPresenter {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the summary dialog
|
||||||
|
*/
|
||||||
|
private void displaySummary(SubscriptionStatusSummary summary, String msg) {
|
||||||
|
SubscriptionStatusDlg dlg = new SubscriptionStatusDlg(view.getShell(),
|
||||||
|
summary, msg);
|
||||||
|
dlg.open();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Store the subscription for the user.
|
* Store the subscription for the user.
|
||||||
*
|
*
|
||||||
|
|
|
@ -28,6 +28,7 @@ import java.util.Set;
|
||||||
import com.raytheon.uf.common.auth.req.BasePrivilegedServerService;
|
import com.raytheon.uf.common.auth.req.BasePrivilegedServerService;
|
||||||
import com.raytheon.uf.common.datadelivery.bandwidth.IBandwidthRequest.RequestType;
|
import com.raytheon.uf.common.datadelivery.bandwidth.IBandwidthRequest.RequestType;
|
||||||
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.SubscriptionStatusSummary;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.AdhocSubscription;
|
import com.raytheon.uf.common.datadelivery.registry.AdhocSubscription;
|
||||||
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;
|
||||||
|
@ -50,6 +51,7 @@ import com.raytheon.uf.common.util.LogUtil;
|
||||||
* Nov 20, 2012 1286 djohnson Add proposeSchedule methods.
|
* Nov 20, 2012 1286 djohnson Add proposeSchedule methods.
|
||||||
* Dec 06, 2012 1397 djohnson Add ability to get bandwidth graph data.
|
* Dec 06, 2012 1397 djohnson Add ability to get bandwidth graph data.
|
||||||
* Feb 27, 2013 1644 djohnson Now abstract, sub-classes provide specific service lookup keys.
|
* Feb 27, 2013 1644 djohnson Now abstract, sub-classes provide specific service lookup keys.
|
||||||
|
* Jul 18, 2013 1653 mpduff Add getSubscriptionStatusSummary method.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -96,8 +98,8 @@ public abstract class BandwidthService extends
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public Set<String> proposeBandwidthForNetworkInKilobytes(
|
public Set<String> proposeBandwidthForNetworkInKilobytes(Network network,
|
||||||
Network network, int bandwidth) {
|
int bandwidth) {
|
||||||
IBandwidthRequest request = new IBandwidthRequest();
|
IBandwidthRequest request = new IBandwidthRequest();
|
||||||
request.setRequestType(RequestType.PROPOSE_SET_BANDWIDTH);
|
request.setRequestType(RequestType.PROPOSE_SET_BANDWIDTH);
|
||||||
request.setNetwork(network);
|
request.setNetwork(network);
|
||||||
|
@ -252,4 +254,21 @@ public abstract class BandwidthService extends
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SubscriptionStatusSummary getSubscriptionStatusSummary(
|
||||||
|
Subscription subscription) {
|
||||||
|
IBandwidthRequest request = new IBandwidthRequest();
|
||||||
|
request.setSubscriptions(Arrays.<Subscription> asList(subscription));
|
||||||
|
request.setRequestType(RequestType.GET_SUBSCRIPTION_STATUS);
|
||||||
|
try {
|
||||||
|
return sendRequest(request, SubscriptionStatusSummary.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
statusHandler
|
||||||
|
.handle(Priority.PROBLEM,
|
||||||
|
"Unable to retrieve the estimated completion time, returning the current time.",
|
||||||
|
e);
|
||||||
|
return new SubscriptionStatusSummary();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||||
* Oct 23, 2012 1286 djohnson Add SW history, move to common plugin.
|
* Oct 23, 2012 1286 djohnson Add SW history, move to common plugin.
|
||||||
* Nov 20, 2012 1286 djohnson Add PROPOSE_SCHEDULE_SUBSCRIPTION.
|
* Nov 20, 2012 1286 djohnson Add PROPOSE_SCHEDULE_SUBSCRIPTION.
|
||||||
* Dec 06, 2012 1397 djohnson Add GET_BANDWIDTH_GRAPH_DATA.
|
* Dec 06, 2012 1397 djohnson Add GET_BANDWIDTH_GRAPH_DATA.
|
||||||
|
* Jul 18, 2013 1653 mpduff Add GET_SUBSCRIPTION_STATUS.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -39,7 +40,7 @@ public class IBandwidthRequest extends AbstractPrivilegedRequest {
|
||||||
/**
|
/**
|
||||||
* Schedule a subscription.
|
* Schedule a subscription.
|
||||||
*/
|
*/
|
||||||
SCHEDULE_SUBSCRIPTION, SHOW_BUCKET, SHOW_DEFERRED, GET_BANDWIDTH, FORCE_SET_BANDWIDTH, PROPOSE_SET_BANDWIDTH, PROPOSE_SCHEDULE_SUBSCRIPTION, REINITIALIZE, GET_ESTIMATED_COMPLETION, GET_BANDWIDTH_GRAPH_DATA
|
SCHEDULE_SUBSCRIPTION, SHOW_BUCKET, SHOW_DEFERRED, GET_BANDWIDTH, FORCE_SET_BANDWIDTH, PROPOSE_SET_BANDWIDTH, PROPOSE_SCHEDULE_SUBSCRIPTION, REINITIALIZE, GET_ESTIMATED_COMPLETION, GET_BANDWIDTH_GRAPH_DATA, GET_SUBSCRIPTION_STATUS
|
||||||
}
|
}
|
||||||
|
|
||||||
@DynamicSerializeElement
|
@DynamicSerializeElement
|
||||||
|
|
|
@ -24,6 +24,7 @@ import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
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.SubscriptionStatusSummary;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.AdhocSubscription;
|
import com.raytheon.uf.common.datadelivery.registry.AdhocSubscription;
|
||||||
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;
|
||||||
|
@ -41,6 +42,7 @@ import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||||
* Nov 20, 2012 1286 djohnson Add proposeSchedule methods.
|
* Nov 20, 2012 1286 djohnson Add proposeSchedule methods.
|
||||||
* Dec 06, 2012 1397 djohnson Add ability to get bandwidth graph data.
|
* Dec 06, 2012 1397 djohnson Add ability to get bandwidth graph data.
|
||||||
* Jul 11, 2013 2106 djohnson Bandwidth service now returns names of subscriptions for proposing bandwidth availability.
|
* Jul 11, 2013 2106 djohnson Bandwidth service now returns names of subscriptions for proposing bandwidth availability.
|
||||||
|
* Jul 18, 2013 1653 mpduff Added getSubscriptionStatusSummary.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -143,4 +145,15 @@ public interface IBandwidthService {
|
||||||
* @return bandwidth graph data
|
* @return bandwidth graph data
|
||||||
*/
|
*/
|
||||||
BandwidthGraphData getBandwidthGraphData();
|
BandwidthGraphData getBandwidthGraphData();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Subscription status summary.
|
||||||
|
*
|
||||||
|
* @param subscription
|
||||||
|
* The subscription
|
||||||
|
*
|
||||||
|
* @return The summary
|
||||||
|
*/
|
||||||
|
SubscriptionStatusSummary getSubscriptionStatusSummary(
|
||||||
|
Subscription subscription);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,143 @@
|
||||||
|
/**
|
||||||
|
* This software was developed and / or modified by Raytheon Company,
|
||||||
|
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||||
|
*
|
||||||
|
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||||
|
* This software product contains export-restricted data whose
|
||||||
|
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||||
|
* to non-U.S. persons whether in the United States or abroad requires
|
||||||
|
* an export license or other authorization.
|
||||||
|
*
|
||||||
|
* Contractor Name: Raytheon Company
|
||||||
|
* Contractor Address: 6825 Pine Street, Suite 340
|
||||||
|
* Mail Stop B8
|
||||||
|
* Omaha, NE 68106
|
||||||
|
* 402.291.0100
|
||||||
|
*
|
||||||
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
|
* further licensing information.
|
||||||
|
**/
|
||||||
|
package com.raytheon.uf.common.datadelivery.bandwidth.data;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||||
|
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||||
|
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||||
|
import com.raytheon.uf.common.util.StringUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subscription status summary.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Jul 17, 2013 1653 mpduff Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author mpduff
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
@DynamicSerialize
|
||||||
|
public class SubscriptionStatusSummary {
|
||||||
|
@DynamicSerializeElement
|
||||||
|
private long dataSize;
|
||||||
|
|
||||||
|
@DynamicSerializeElement
|
||||||
|
private long startTime;
|
||||||
|
|
||||||
|
@DynamicSerializeElement
|
||||||
|
private long endTime;
|
||||||
|
|
||||||
|
@DynamicSerializeElement
|
||||||
|
private long latency;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the dataSize
|
||||||
|
*/
|
||||||
|
public long getDataSize() {
|
||||||
|
return dataSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param dataSize
|
||||||
|
* the dataSize to set
|
||||||
|
*/
|
||||||
|
public void setDataSize(long dataSize) {
|
||||||
|
this.dataSize = dataSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the startTime
|
||||||
|
*/
|
||||||
|
public long getStartTime() {
|
||||||
|
return startTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param startTime
|
||||||
|
* the startTime to set
|
||||||
|
*/
|
||||||
|
public void setStartTime(long startTime) {
|
||||||
|
this.startTime = startTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the latency
|
||||||
|
*/
|
||||||
|
public long getLatency() {
|
||||||
|
return latency;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param latency
|
||||||
|
* the latency to set
|
||||||
|
*/
|
||||||
|
public void setLatency(long latency) {
|
||||||
|
this.latency = latency;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the endTime
|
||||||
|
*/
|
||||||
|
public long getEndTime() {
|
||||||
|
return endTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param endTime
|
||||||
|
* the endTime to set
|
||||||
|
*/
|
||||||
|
public void setEndTime(long endTime) {
|
||||||
|
this.endTime = endTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see java.lang.Object#toString()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("Data size: ").append(this.dataSize)
|
||||||
|
.append(StringUtil.NEWLINE);
|
||||||
|
sb.append("Latency: ").append(this.latency)
|
||||||
|
.append(StringUtil.NEWLINE);
|
||||||
|
|
||||||
|
Calendar cal = TimeUtil.newGmtCalendar();
|
||||||
|
cal.setTimeInMillis(this.startTime);
|
||||||
|
|
||||||
|
sb.append("Start Time: ").append(cal.getTime())
|
||||||
|
.append(StringUtil.NEWLINE);
|
||||||
|
|
||||||
|
cal.setTimeInMillis(this.endTime);
|
||||||
|
sb.append("End Time: ").append(cal.getTime())
|
||||||
|
.append(StringUtil.NEWLINE);
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
}
|
|
@ -107,6 +107,7 @@ import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
|
||||||
* Jun 24, 2013 2106 djohnson Access BandwidthBucket contents through RetrievalPlan.
|
* Jun 24, 2013 2106 djohnson Access BandwidthBucket contents through RetrievalPlan.
|
||||||
* Jul 10, 2013 2106 djohnson Move EDEX instance specific code into its own class.
|
* Jul 10, 2013 2106 djohnson Move EDEX instance specific code into its own class.
|
||||||
* Jul 11, 2013 2106 djohnson Propose changing available bandwidth returns subscription names.
|
* Jul 11, 2013 2106 djohnson Propose changing available bandwidth returns subscription names.
|
||||||
|
* Jul 18, 2013 1653 mpduff Added case GET_SUBSCRIPTION_STATUS.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author dhladky
|
* @author dhladky
|
||||||
|
@ -743,6 +744,15 @@ public abstract class BandwidthManager extends
|
||||||
case GET_BANDWIDTH_GRAPH_DATA:
|
case GET_BANDWIDTH_GRAPH_DATA:
|
||||||
response = getBandwidthGraphData();
|
response = getBandwidthGraphData();
|
||||||
break;
|
break;
|
||||||
|
case GET_SUBSCRIPTION_STATUS:
|
||||||
|
Subscription sub = null;
|
||||||
|
if (subscriptions.size() != 1
|
||||||
|
|| (!((sub = subscriptions.get(0)) instanceof Subscription))) {
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"Must supply one, and only one, subscription to get the status summary.");
|
||||||
|
}
|
||||||
|
response = bandwidthDao.getSubscriptionStatusSummary(sub);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Dont know how to handle request type [" + requestType
|
"Dont know how to handle request type [" + requestType
|
||||||
|
|
|
@ -33,6 +33,7 @@ import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
import com.raytheon.uf.common.datadelivery.bandwidth.data.SubscriptionStatusSummary;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.DataSetMetaData;
|
import com.raytheon.uf.common.datadelivery.registry.DataSetMetaData;
|
||||||
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;
|
||||||
|
@ -63,6 +64,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
||||||
* Jun 13, 2013 2095 djohnson Implement ability to store a collection of subscriptions.
|
* Jun 13, 2013 2095 djohnson Implement ability to store a collection of subscriptions.
|
||||||
* Jul 09, 2013 2106 djohnson Rather than copy all elements and remove unnecessary, just copy the ones that apply.
|
* Jul 09, 2013 2106 djohnson Rather than copy all elements and remove unnecessary, just copy the ones that apply.
|
||||||
* Jul 11, 2013 2106 djohnson Use BandwidthSubscription instead of Subscription.
|
* Jul 11, 2013 2106 djohnson Use BandwidthSubscription instead of Subscription.
|
||||||
|
* Jul 18, 2013 1653 mpduff Implemented method.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -656,4 +658,11 @@ class InMemoryBandwidthDao implements IBandwidthDao {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SubscriptionStatusSummary getSubscriptionStatusSummary(
|
||||||
|
Subscription sub) {
|
||||||
|
// Does nothing
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.datadelivery.bandwidth.data.SubscriptionStatusSummary;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.DataSetMetaData;
|
import com.raytheon.uf.common.datadelivery.registry.DataSetMetaData;
|
||||||
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;
|
||||||
|
@ -47,6 +48,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalStatus;
|
||||||
* Jun 03, 2013 2038 djohnson Add method to get subscription retrievals by provider, dataset, and status.
|
* Jun 03, 2013 2038 djohnson Add method to get subscription retrievals by provider, dataset, and status.
|
||||||
* Jun 13, 2013 2095 djohnson Implement ability to store a collection of subscriptions.
|
* Jun 13, 2013 2095 djohnson Implement ability to store a collection of subscriptions.
|
||||||
* Jun 24, 2013 2106 djohnson Add more methods.
|
* Jun 24, 2013 2106 djohnson Add more methods.
|
||||||
|
* Jul 18, 2013 1653 mpduff Added getSubscriptionStatusSummary.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -122,10 +124,11 @@ public interface IBandwidthDao {
|
||||||
* Get a BandwidthSubscription.
|
* Get a BandwidthSubscription.
|
||||||
*
|
*
|
||||||
* @param identifier
|
* @param identifier
|
||||||
* Retrieve the BandwidthSubscription with the specified identifier.
|
* Retrieve the BandwidthSubscription with the specified
|
||||||
|
* identifier.
|
||||||
*
|
*
|
||||||
* @return The BandwidthSubscription that has the specified identifier or null if
|
* @return The BandwidthSubscription that has the specified identifier or
|
||||||
* no such BandwidthSubscription exists.
|
* null if no such BandwidthSubscription exists.
|
||||||
*/
|
*/
|
||||||
BandwidthSubscription getBandwidthSubscription(long identifier);
|
BandwidthSubscription getBandwidthSubscription(long identifier);
|
||||||
|
|
||||||
|
@ -133,13 +136,15 @@ public interface IBandwidthDao {
|
||||||
* Get a BandwidthSubscription.
|
* Get a BandwidthSubscription.
|
||||||
*
|
*
|
||||||
* @param registryId
|
* @param registryId
|
||||||
* Retrieve the BandwidthSubscription with the specified registryId.
|
* Retrieve the BandwidthSubscription with the specified
|
||||||
|
* registryId.
|
||||||
* @param baseReferenceTime
|
* @param baseReferenceTime
|
||||||
* Retrieve the BandwidthSubscription with the specified
|
* Retrieve the BandwidthSubscription with the specified
|
||||||
* baseReferenceTime.
|
* baseReferenceTime.
|
||||||
*
|
*
|
||||||
* @return The BandwidthSubscription that has the specified identifier and
|
* @return The BandwidthSubscription that has the specified identifier and
|
||||||
* baseReferenceTime or null if no such BandwidthSubscription exists.
|
* baseReferenceTime or null if no such BandwidthSubscription
|
||||||
|
* exists.
|
||||||
*/
|
*/
|
||||||
BandwidthSubscription getBandwidthSubscription(String registryId,
|
BandwidthSubscription getBandwidthSubscription(String registryId,
|
||||||
Calendar baseReferenceTime);
|
Calendar baseReferenceTime);
|
||||||
|
@ -154,7 +159,8 @@ public interface IBandwidthDao {
|
||||||
* @return A List of BandwidthSubscriptions that have the same owner,
|
* @return A List of BandwidthSubscriptions that have the same owner,
|
||||||
* provider, name and dataSetName and the specified subscription.
|
* provider, name and dataSetName and the specified subscription.
|
||||||
*/
|
*/
|
||||||
List<BandwidthSubscription> getBandwidthSubscription(Subscription subscription);
|
List<BandwidthSubscription> getBandwidthSubscription(
|
||||||
|
Subscription subscription);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a BandwidthSubscriptions.
|
* Get a BandwidthSubscriptions.
|
||||||
|
@ -166,7 +172,8 @@ public interface IBandwidthDao {
|
||||||
* @return A List of BandwidthSubscriptions that has the specified
|
* @return A List of BandwidthSubscriptions that has the specified
|
||||||
* registryId or null if no such BandwidthSubscription exists.
|
* registryId or null if no such BandwidthSubscription exists.
|
||||||
*/
|
*/
|
||||||
List<BandwidthSubscription> getBandwidthSubscriptionByRegistryId(String registryId);
|
List<BandwidthSubscription> getBandwidthSubscriptionByRegistryId(
|
||||||
|
String registryId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve a SubscriptionRetrieval Object from the database given an
|
* Retrieve a SubscriptionRetrieval Object from the database given an
|
||||||
|
@ -263,8 +270,8 @@ public interface IBandwidthDao {
|
||||||
String dataSetName);
|
String dataSetName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return all the BandwidthSubscription Objects in the database in ascending order
|
* Return all the BandwidthSubscription Objects in the database in ascending
|
||||||
* based on the BandwidthSubscription's baseReferenceTime attribute.
|
* order based on the BandwidthSubscription's baseReferenceTime attribute.
|
||||||
*
|
*
|
||||||
* @return A List of BandwidthSubscription Objects.
|
* @return A List of BandwidthSubscription Objects.
|
||||||
*/
|
*/
|
||||||
|
@ -286,28 +293,29 @@ public interface IBandwidthDao {
|
||||||
* @return All the SubscriptionRetrievals that are scheduled for the
|
* @return All the SubscriptionRetrievals that are scheduled for the
|
||||||
* specified time.
|
* specified time.
|
||||||
*/
|
*/
|
||||||
List<BandwidthSubscription> getBandwidthSubscriptions(String provider, String dataSetName,
|
List<BandwidthSubscription> getBandwidthSubscriptions(String provider,
|
||||||
Calendar baseReferenceTime);
|
String dataSetName, Calendar baseReferenceTime);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new BandwidthDataSetUpdate Object based on the dataSetMetaData
|
* Create a new BandwidthDataSetUpdate Object based on the dataSetMetaData
|
||||||
* Object provided.
|
* Object provided.
|
||||||
*
|
*
|
||||||
* @param dataSetMetaData
|
* @param dataSetMetaData
|
||||||
* The DataSetMetaData Object to create the BandwidthDataSetUpdate
|
* The DataSetMetaData Object to create the
|
||||||
* Object from.
|
* BandwidthDataSetUpdate Object from.
|
||||||
*
|
*
|
||||||
* @return A newly created and persisted BandwidthDataSetUpdate Object.
|
* @return A newly created and persisted BandwidthDataSetUpdate Object.
|
||||||
*/
|
*/
|
||||||
BandwidthDataSetUpdate newBandwidthDataSetUpdate(DataSetMetaData dataSetMetaData);
|
BandwidthDataSetUpdate newBandwidthDataSetUpdate(
|
||||||
|
DataSetMetaData dataSetMetaData);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new BandwidthSubscription Object based on the Subscription and
|
* Create a new BandwidthSubscription Object based on the Subscription and
|
||||||
* Calendar Objects provided.
|
* Calendar Objects provided.
|
||||||
*
|
*
|
||||||
* @param Subscription
|
* @param Subscription
|
||||||
* The Subscription Object to create the BandwidthSubscription Object
|
* The Subscription Object to create the BandwidthSubscription
|
||||||
* from.
|
* Object from.
|
||||||
*
|
*
|
||||||
* @param baseReferenceTime
|
* @param baseReferenceTime
|
||||||
* The base reference time to set on the newly created
|
* The base reference time to set on the newly created
|
||||||
|
@ -467,4 +475,14 @@ public interface IBandwidthDao {
|
||||||
*/
|
*/
|
||||||
SubscriptionRetrievalAttributes getSubscriptionRetrievalAttributes(
|
SubscriptionRetrievalAttributes getSubscriptionRetrievalAttributes(
|
||||||
SubscriptionRetrieval retrieval);
|
SubscriptionRetrieval retrieval);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the subscription status summary.
|
||||||
|
*
|
||||||
|
* @param sub
|
||||||
|
* The subscription
|
||||||
|
*
|
||||||
|
* @return the SubscriptionStatusSummary
|
||||||
|
*/
|
||||||
|
SubscriptionStatusSummary getSubscriptionStatusSummary(Subscription sub);
|
||||||
}
|
}
|
|
@ -21,6 +21,8 @@ package com.raytheon.uf.edex.datadelivery.bandwidth.hibernate;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
|
@ -30,6 +32,7 @@ import org.hibernate.jdbc.Work;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.datadelivery.bandwidth.data.SubscriptionStatusSummary;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.DataSetMetaData;
|
import com.raytheon.uf.common.datadelivery.registry.DataSetMetaData;
|
||||||
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;
|
||||||
|
@ -58,6 +61,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
||||||
* Jun 03, 2013 2038 djohnson Add method to get subscription retrievals by provider, dataset, and status.
|
* Jun 03, 2013 2038 djohnson Add method to get subscription retrievals by provider, dataset, and status.
|
||||||
* Jun 13, 2013 2095 djohnson Implement ability to store a collection of subscriptions.
|
* Jun 13, 2013 2095 djohnson Implement ability to store a collection of subscriptions.
|
||||||
* Jun 24, 2013 2106 djohnson Implement new methods.
|
* Jun 24, 2013 2106 djohnson Implement new methods.
|
||||||
|
* Jul 18, 2013 1653 mpduff Added getSubscriptionStatusSummary.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -514,4 +518,60 @@ public class HibernateBandwidthDao implements IBandwidthDao {
|
||||||
.getBySubscriptionRetrieval(retrieval);
|
.getBySubscriptionRetrieval(retrieval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SubscriptionStatusSummary getSubscriptionStatusSummary(
|
||||||
|
Subscription sub) {
|
||||||
|
SubscriptionStatusSummary summary = new SubscriptionStatusSummary();
|
||||||
|
|
||||||
|
List<BandwidthSubscription> bandwidthSubList = this
|
||||||
|
.getBandwidthSubscription(sub);
|
||||||
|
Collections.sort(bandwidthSubList,
|
||||||
|
new Comparator<BandwidthSubscription>() {
|
||||||
|
@Override
|
||||||
|
public int compare(BandwidthSubscription o1,
|
||||||
|
BandwidthSubscription o2) {
|
||||||
|
Calendar date1 = o1.getBaseReferenceTime();
|
||||||
|
Calendar date2 = o2.getBaseReferenceTime();
|
||||||
|
if (date1.before(date2)) {
|
||||||
|
return -1;
|
||||||
|
} else if (date1.after(date2)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
List<SubscriptionRetrieval> subRetrievalList = this
|
||||||
|
.querySubscriptionRetrievals(bandwidthSubList.get(0));
|
||||||
|
Collections.sort(subRetrievalList,
|
||||||
|
new Comparator<SubscriptionRetrieval>() {
|
||||||
|
@Override
|
||||||
|
public int compare(SubscriptionRetrieval o1,
|
||||||
|
SubscriptionRetrieval o2) {
|
||||||
|
Calendar date1 = o1.getStartTime();
|
||||||
|
Calendar date2 = o2.getStartTime();
|
||||||
|
if (date1.before(date2)) {
|
||||||
|
return -1;
|
||||||
|
} else if (date1.after(date2)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
summary.setStartTime(subRetrievalList.get(0).getStartTime()
|
||||||
|
.getTimeInMillis());
|
||||||
|
summary.setEndTime(subRetrievalList.get(subRetrievalList.size() - 1)
|
||||||
|
.getEndTime().getTimeInMillis());
|
||||||
|
summary.setDataSize(sub.getDataSetSize());
|
||||||
|
summary.setLatency(sub.getLatencyInMinutes());
|
||||||
|
|
||||||
|
return summary;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ import com.raytheon.uf.common.datadelivery.bandwidth.IBandwidthRequest;
|
||||||
import com.raytheon.uf.common.datadelivery.bandwidth.IProposeScheduleResponse;
|
import com.raytheon.uf.common.datadelivery.bandwidth.IProposeScheduleResponse;
|
||||||
import com.raytheon.uf.common.datadelivery.bandwidth.WfoBandwidthService;
|
import com.raytheon.uf.common.datadelivery.bandwidth.WfoBandwidthService;
|
||||||
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.SubscriptionStatusSummary;
|
||||||
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.AdhocSubscription;
|
import com.raytheon.uf.common.datadelivery.registry.AdhocSubscription;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.AdhocSubscriptionFixture;
|
import com.raytheon.uf.common.datadelivery.registry.AdhocSubscriptionFixture;
|
||||||
|
@ -79,7 +80,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
||||||
* Jun 12, 2013 2038 djohnson Add test for returning required dataset size on subscription update.
|
* Jun 12, 2013 2038 djohnson Add test for returning required dataset size on subscription update.
|
||||||
* Jun 25, 2013 2106 djohnson BandwidthBucket is a big boy class now.
|
* Jun 25, 2013 2106 djohnson BandwidthBucket is a big boy class now.
|
||||||
* Jul 11, 2013 2106 djohnson Use SubscriptionPriority enum.
|
* Jul 11, 2013 2106 djohnson Use SubscriptionPriority enum.
|
||||||
*
|
* Jul 18, 2013 1653 mpduff Added test for sub status summary.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author djohnson
|
* @author djohnson
|
||||||
|
@ -127,10 +128,9 @@ public class BandwidthServiceIntTest extends AbstractWfoBandwidthManagerIntTest
|
||||||
bandwidthManager.schedule(subscription2);
|
bandwidthManager.schedule(subscription2);
|
||||||
|
|
||||||
// Now we propose dropping the bandwidth by just one kb/s
|
// Now we propose dropping the bandwidth by just one kb/s
|
||||||
Set<String> results = service
|
Set<String> results = service.proposeBandwidthForNetworkInKilobytes(
|
||||||
.proposeBandwidthForNetworkInKilobytes(Network.OPSNET,
|
Network.OPSNET, retrievalManager.getPlan(Network.OPSNET)
|
||||||
retrievalManager.getPlan(Network.OPSNET)
|
.getDefaultBandwidth() - 1);
|
||||||
.getDefaultBandwidth() - 1);
|
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"Expected one subscription to not have been able to fit with the new bandwidth!",
|
"Expected one subscription to not have been able to fit with the new bandwidth!",
|
||||||
|
@ -154,10 +154,9 @@ public class BandwidthServiceIntTest extends AbstractWfoBandwidthManagerIntTest
|
||||||
bandwidthManager.schedule(subscription2);
|
bandwidthManager.schedule(subscription2);
|
||||||
|
|
||||||
// Now we propose dropping the bandwidth by just one kb/s
|
// Now we propose dropping the bandwidth by just one kb/s
|
||||||
Set<String> results = service
|
Set<String> results = service.proposeBandwidthForNetworkInKilobytes(
|
||||||
.proposeBandwidthForNetworkInKilobytes(Network.OPSNET,
|
Network.OPSNET, retrievalManager.getPlan(Network.OPSNET)
|
||||||
retrievalManager.getPlan(Network.OPSNET)
|
.getDefaultBandwidth() - 1);
|
||||||
.getDefaultBandwidth() - 1);
|
|
||||||
|
|
||||||
assertTrue(
|
assertTrue(
|
||||||
"Expected to be able to fit all subscriptions with the new bandwidth!",
|
"Expected to be able to fit all subscriptions with the new bandwidth!",
|
||||||
|
@ -678,6 +677,78 @@ public class BandwidthServiceIntTest extends AbstractWfoBandwidthManagerIntTest
|
||||||
is(equalTo(subscription2.getPriority())));
|
is(equalTo(subscription2.getPriority())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testProposeScheduleSubscriptionsReturnsStatusSummary() {
|
||||||
|
Subscription subscription = createSubscriptionThatFillsUpTwoBuckets();
|
||||||
|
|
||||||
|
subscription.getTime().setCycleTimes(
|
||||||
|
Arrays.asList(Integer.valueOf(6), Integer.valueOf(8)));
|
||||||
|
subscription.setLatencyInMinutes(3);
|
||||||
|
|
||||||
|
IProposeScheduleResponse response = service
|
||||||
|
.proposeSchedule(subscription);
|
||||||
|
|
||||||
|
SubscriptionStatusSummary sum = service
|
||||||
|
.getSubscriptionStatusSummary(subscription);
|
||||||
|
|
||||||
|
List<BandwidthAllocation> allocationList = bandwidthDao
|
||||||
|
.getBandwidthAllocations(Network.OPSNET);
|
||||||
|
long actualStartTime = allocationList.get(0).getStartTime()
|
||||||
|
.getTimeInMillis();
|
||||||
|
long actualEndTime = allocationList.get(0).getEndTime()
|
||||||
|
.getTimeInMillis();
|
||||||
|
|
||||||
|
assertEquals("DataSize does not match", subscription.getDataSetSize(),
|
||||||
|
sum.getDataSize());
|
||||||
|
assertEquals("Latency does not match",
|
||||||
|
subscription.getLatencyInMinutes(), sum.getLatency());
|
||||||
|
assertEquals("Start time does not match", actualStartTime,
|
||||||
|
sum.getStartTime());
|
||||||
|
assertEquals("End time does not match", actualEndTime, sum.getEndTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testProposeScheduleFragmentedSubscriptionReturnsStatusSummary() {
|
||||||
|
Subscription subscription = createSubscriptionThatFillsUpTwoBuckets();
|
||||||
|
subscription.setLatencyInMinutes(6);
|
||||||
|
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
|
||||||
|
BandwidthAllocation allocation = createAllocationToReserveMiddleBucket(subscription);
|
||||||
|
|
||||||
|
retrievalManager.schedule(Arrays.asList(allocation));
|
||||||
|
|
||||||
|
IProposeScheduleResponse response = service
|
||||||
|
.proposeSchedule(subscription);
|
||||||
|
|
||||||
|
SubscriptionStatusSummary sum = service
|
||||||
|
.getSubscriptionStatusSummary(subscription);
|
||||||
|
|
||||||
|
List<BandwidthAllocation> allocationList = bandwidthDao
|
||||||
|
.getBandwidthAllocations(Network.OPSNET);
|
||||||
|
for (BandwidthAllocation ba : allocationList) {
|
||||||
|
System.out.println(ba);
|
||||||
|
}
|
||||||
|
long actualStartTime = -1;
|
||||||
|
long actualEndTime = -1;
|
||||||
|
|
||||||
|
for (BandwidthAllocation ba : allocationList) {
|
||||||
|
if (ba instanceof SubscriptionRetrieval) {
|
||||||
|
actualStartTime = ba.getStartTime().getTimeInMillis();
|
||||||
|
actualEndTime = ba.getEndTime().getTimeInMillis();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assertEquals("DataSize does not match", subscription.getDataSetSize(),
|
||||||
|
sum.getDataSize());
|
||||||
|
assertEquals("Latency does not match",
|
||||||
|
subscription.getLatencyInMinutes(), sum.getLatency());
|
||||||
|
assertEquals("Start time does not match", actualStartTime,
|
||||||
|
sum.getStartTime());
|
||||||
|
assertEquals("End time does not match", actualEndTime, sum.getEndTime());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a BandwidthAllocation that will fill up a bucket and reserve
|
* Creates a BandwidthAllocation that will fill up a bucket and reserve
|
||||||
* itself for 01/03/1970 18:03:00
|
* itself for 01/03/1970 18:03:00
|
||||||
|
|
Loading…
Add table
Reference in a new issue