Issue #2106 Create SubscriptionRetrievalAttributes to only load Subscription objects when required
Amend: Peer review comments, also fixed bug where subscriptions weren't being loaded on changing bandwidth Change-Id: I8b5a122b0434d54dcfcbff9df6283edad68d7eb1 Former-commit-id:5f38365571
[formerly050b38fa9a
[formerly 4da045d4c13a7d14cdbea3269409f2020e0c78f1]] Former-commit-id:050b38fa9a
Former-commit-id:a821cdac28
This commit is contained in:
parent
285d121278
commit
aa7c916c05
38 changed files with 1033 additions and 543 deletions
|
@ -30,7 +30,6 @@ import org.eclipse.swt.widgets.Label;
|
||||||
import org.eclipse.swt.widgets.Spinner;
|
import org.eclipse.swt.widgets.Spinner;
|
||||||
|
|
||||||
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.status.IUFStatusHandler;
|
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
import com.raytheon.uf.common.status.UFStatus;
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
|
@ -50,6 +49,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
|
||||||
* May 14, 2013 2000 djohnson Initial creation
|
* May 14, 2013 2000 djohnson Initial creation
|
||||||
* May 23, 2013 1650 djohnson Reword change bandwidth message.
|
* May 23, 2013 1650 djohnson Reword change bandwidth message.
|
||||||
* Jun 12, 2013 2064 mpduff Update label.
|
* Jun 12, 2013 2064 mpduff Update label.
|
||||||
|
* Jul 11, 2013 2106 djohnson SystemRuleManager now returns names of subscriptions.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -149,15 +149,13 @@ public class BandwidthTab extends SystemApplyCancelTab {
|
||||||
boolean changesApplied = false;
|
boolean changesApplied = false;
|
||||||
final int bandwidth = availBandwidthSpinner.getSelection();
|
final int bandwidth = availBandwidthSpinner.getSelection();
|
||||||
|
|
||||||
Set<Subscription> unscheduledSubscriptions = SystemRuleManager
|
Set<String> unscheduledSubscriptions = SystemRuleManager
|
||||||
.setAvailableBandwidth(Network.OPSNET, bandwidth);
|
.setAvailableBandwidth(Network.OPSNET, bandwidth);
|
||||||
if (unscheduledSubscriptions.isEmpty()) {
|
if (unscheduledSubscriptions.isEmpty()) {
|
||||||
changesApplied = true;
|
changesApplied = true;
|
||||||
} else {
|
} else {
|
||||||
Set<String> subscriptionNames = new TreeSet<String>();
|
Set<String> subscriptionNames = new TreeSet<String>(
|
||||||
for (Subscription subscription : unscheduledSubscriptions) {
|
unscheduledSubscriptions);
|
||||||
subscriptionNames.add(subscription.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder(StringUtil.createMessage(
|
StringBuilder sb = new StringBuilder(StringUtil.createMessage(
|
||||||
"Changing the bandwidth for " + Network.OPSNET
|
"Changing the bandwidth for " + Network.OPSNET
|
||||||
|
|
|
@ -70,6 +70,7 @@ import com.raytheon.uf.viz.datadelivery.utils.TypeOperationItems;
|
||||||
* Jan 04, 2013 1420 mpduff Move rules into a single file.
|
* Jan 04, 2013 1420 mpduff Move rules into a single file.
|
||||||
* Jan 25, 2013 1528 djohnson Subscription priority is now an enum.
|
* Jan 25, 2013 1528 djohnson Subscription priority is now an enum.
|
||||||
* Jun 04, 2013 223 mpduff Implement point data types.
|
* Jun 04, 2013 223 mpduff Implement point data types.
|
||||||
|
* Jul 11, 2013 2106 djohnson setAvailableBandwidth service now returns names of subscriptions.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -625,9 +626,9 @@ public class SystemRuleManager {
|
||||||
* @param bandwidth
|
* @param bandwidth
|
||||||
* the available bandwidth
|
* the available bandwidth
|
||||||
* @return empty list if successfully applied, otherwise the set of
|
* @return empty list if successfully applied, otherwise the set of
|
||||||
* subscriptions that would be unscheduled
|
* subscription names that would be unscheduled
|
||||||
*/
|
*/
|
||||||
public static Set<Subscription> setAvailableBandwidth(Network network,
|
public static Set<String> setAvailableBandwidth(Network network,
|
||||||
int bandwidth) {
|
int bandwidth) {
|
||||||
return getInstance().bandwidthService
|
return getInstance().bandwidthService
|
||||||
.proposeBandwidthForNetworkInKilobytes(network, bandwidth);
|
.proposeBandwidthForNetworkInKilobytes(network, bandwidth);
|
||||||
|
|
|
@ -96,7 +96,7 @@ public abstract class BandwidthService extends
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public Set<Subscription> proposeBandwidthForNetworkInKilobytes(
|
public Set<String> proposeBandwidthForNetworkInKilobytes(
|
||||||
Network network, int bandwidth) {
|
Network network, int bandwidth) {
|
||||||
IBandwidthRequest request = new IBandwidthRequest();
|
IBandwidthRequest request = new IBandwidthRequest();
|
||||||
request.setRequestType(RequestType.PROPOSE_SET_BANDWIDTH);
|
request.setRequestType(RequestType.PROPOSE_SET_BANDWIDTH);
|
||||||
|
|
|
@ -40,6 +40,7 @@ import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||||
* Oct 22, 2012 1286 djohnson Initial creation
|
* Oct 22, 2012 1286 djohnson Initial creation
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -76,10 +77,10 @@ public interface IBandwidthService {
|
||||||
* the network
|
* the network
|
||||||
* @param bandwidth
|
* @param bandwidth
|
||||||
* the bandwidth
|
* the bandwidth
|
||||||
* @return the set of current subscriptions which would be unable to fit
|
* @return the set of current subscription names which would be unable to
|
||||||
* into the retrieval plan with the new bandwidth amount
|
* fit into the retrieval plan with the new bandwidth amount
|
||||||
*/
|
*/
|
||||||
Set<Subscription> proposeBandwidthForNetworkInKilobytes(Network network,
|
Set<String> proposeBandwidthForNetworkInKilobytes(Network network,
|
||||||
int bandwidth);
|
int bandwidth);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -38,6 +38,7 @@ import javax.xml.bind.annotation.XmlEnumValue;
|
||||||
* Mar 25, 2013 1841 djohnson Extracted from UserSubscription.
|
* Mar 25, 2013 1841 djohnson Extracted from UserSubscription.
|
||||||
* Apr 08, 2013 1826 djohnson Remove delivery options.
|
* Apr 08, 2013 1826 djohnson Remove delivery options.
|
||||||
* May 15, 2013 1040 mpduff Changed officeId to a set.
|
* May 15, 2013 1040 mpduff Changed officeId to a set.
|
||||||
|
* Jul 11, 2013 2106 djohnson SubscriptionPriority allows comparison.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -94,6 +95,17 @@ public interface Subscription {
|
||||||
return priorityName;
|
return priorityName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether this priority is higher than the other priority.
|
||||||
|
*
|
||||||
|
* @param other
|
||||||
|
* the other priority
|
||||||
|
* @return true if higher priority
|
||||||
|
*/
|
||||||
|
public boolean isHigherPriorityThan(SubscriptionPriority other) {
|
||||||
|
return this.priorityValue < other.priorityValue;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the {@link SubscriptionPriority} by its string
|
* Retrieve the {@link SubscriptionPriority} by its string
|
||||||
* representation.
|
* representation.
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.raytheon.uf.common.datadelivery.registry;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
|
||||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||||
|
@ -18,6 +19,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Nov 19, 2012 1166 djohnson Clean up JAXB representation of registry objects.
|
* Nov 19, 2012 1166 djohnson Clean up JAXB representation of registry objects.
|
||||||
* Mar 29, 2013 1841 djohnson Remove JAXB annotations.
|
* Mar 29, 2013 1841 djohnson Remove JAXB annotations.
|
||||||
|
* Jul 11, 2013 2106 djohnson Use SubscriptionPriority.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -45,7 +47,7 @@ public class SubscriptionBundle implements ISerializableObject {
|
||||||
private String bundleId;
|
private String bundleId;
|
||||||
|
|
||||||
@DynamicSerializeElement
|
@DynamicSerializeElement
|
||||||
private Integer priority;
|
private SubscriptionPriority priority;
|
||||||
|
|
||||||
@DynamicSerializeElement
|
@DynamicSerializeElement
|
||||||
private Connection connection;
|
private Connection connection;
|
||||||
|
@ -77,11 +79,11 @@ public class SubscriptionBundle implements ISerializableObject {
|
||||||
this.bundleId = bundleId;
|
this.bundleId = bundleId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getPriority() {
|
public SubscriptionPriority getPriority() {
|
||||||
return priority;
|
return priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPriority(Integer priority) {
|
public void setPriority(SubscriptionPriority priority) {
|
||||||
this.priority = priority;
|
this.priority = priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,3 +3,4 @@ com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthSubscription
|
||||||
com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrieval
|
com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrieval
|
||||||
com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthAllocation
|
com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthAllocation
|
||||||
com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.BandwidthMap
|
com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.BandwidthMap
|
||||||
|
com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrievalAttributes
|
|
@ -17,6 +17,11 @@
|
||||||
<property name="sessionFactory" ref="metadataSessionFactory" />
|
<property name="sessionFactory" ref="metadataSessionFactory" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<bean id="subscriptionRetrievalAttributesDao"
|
||||||
|
class="com.raytheon.uf.edex.datadelivery.bandwidth.hibernate.SubscriptionRetrievalAttributesDao">
|
||||||
|
<property name="sessionFactory" ref="metadataSessionFactory" />
|
||||||
|
</bean>
|
||||||
|
|
||||||
<bean id="bandwidthDataSetUpdateDao"
|
<bean id="bandwidthDataSetUpdateDao"
|
||||||
class="com.raytheon.uf.edex.datadelivery.bandwidth.hibernate.BandwidthDataSetUpdateDao">
|
class="com.raytheon.uf.edex.datadelivery.bandwidth.hibernate.BandwidthDataSetUpdateDao">
|
||||||
<property name="sessionFactory" ref="metadataSessionFactory" />
|
<property name="sessionFactory" ref="metadataSessionFactory" />
|
||||||
|
@ -27,6 +32,7 @@
|
||||||
<property name="bandwidthAllocationDao" ref="bandwidthAllocationDao" />
|
<property name="bandwidthAllocationDao" ref="bandwidthAllocationDao" />
|
||||||
<property name="bandwidthSubscriptionDao" ref="bandwidthSubscriptionDao" />
|
<property name="bandwidthSubscriptionDao" ref="bandwidthSubscriptionDao" />
|
||||||
<property name="subscriptionRetrievalDao" ref="subscriptionRetrievalDao" />
|
<property name="subscriptionRetrievalDao" ref="subscriptionRetrievalDao" />
|
||||||
|
<property name="subscriptionRetrievalAttributesDao" ref="subscriptionRetrievalAttributesDao" />
|
||||||
<property name="bandwidthDataSetUpdateDao" ref="bandwidthDataSetUpdateDao" />
|
<property name="bandwidthDataSetUpdateDao" ref="bandwidthDataSetUpdateDao" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
|
|
@ -32,10 +32,8 @@ import com.google.common.collect.Multimap;
|
||||||
import com.raytheon.uf.common.datadelivery.bandwidth.data.BandwidthGraphData;
|
import com.raytheon.uf.common.datadelivery.bandwidth.data.BandwidthGraphData;
|
||||||
import com.raytheon.uf.common.datadelivery.bandwidth.data.TimeWindowData;
|
import com.raytheon.uf.common.datadelivery.bandwidth.data.TimeWindowData;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
|
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
|
||||||
import com.raytheon.uf.common.serialization.SerializationException;
|
|
||||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
import com.raytheon.uf.common.status.UFStatus;
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
|
||||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthAllocation;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthAllocation;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthBucket;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthBucket;
|
||||||
|
@ -58,6 +56,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalPlan;
|
||||||
* Dec 06, 2012 1397 djohnson Initial creation
|
* Dec 06, 2012 1397 djohnson Initial creation
|
||||||
* Jan 25, 2013 1528 djohnson Subscription priority is now an enum.
|
* Jan 25, 2013 1528 djohnson Subscription priority is now an enum.
|
||||||
* Jun 24, 2013 2106 djohnson Access bucket allocations through RetrievalPlan.
|
* Jun 24, 2013 2106 djohnson Access bucket allocations through RetrievalPlan.
|
||||||
|
* Jul 11, 2013 2106 djohnson Use priority straight from the BandwidthSubscription.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -125,7 +124,8 @@ class BandwidthGraphDataAdapter {
|
||||||
final SubscriptionRetrieval subRetrieval = (SubscriptionRetrieval) allocation;
|
final SubscriptionRetrieval subRetrieval = (SubscriptionRetrieval) allocation;
|
||||||
retrievals.put(allocation.getId(), subRetrieval);
|
retrievals.put(allocation.getId(), subRetrieval);
|
||||||
subNameToRetrievals.put(subRetrieval
|
subNameToRetrievals.put(subRetrieval
|
||||||
.getBandwidthSubscription().getName(), subRetrieval);
|
.getBandwidthSubscription().getName(),
|
||||||
|
subRetrieval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,16 +144,7 @@ class BandwidthGraphDataAdapter {
|
||||||
final SubscriptionRetrieval value = entry.getValue();
|
final SubscriptionRetrieval value = entry.getValue();
|
||||||
BandwidthSubscription dao = value.getBandwidthSubscription();
|
BandwidthSubscription dao = value.getBandwidthSubscription();
|
||||||
final String subName = dao.getName();
|
final String subName = dao.getName();
|
||||||
try {
|
priorityMap.put(subName, dao.getPriority());
|
||||||
priorityMap.put(subName, dao.getSubscription().getPriority());
|
|
||||||
} catch (SerializationException e) {
|
|
||||||
statusHandler
|
|
||||||
.handle(Priority.PROBLEM,
|
|
||||||
"Unable to get access to the actual subscription for ["
|
|
||||||
+ subName + "], skipping...",
|
|
||||||
e);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<TimeWindowData> timeWindows = dataMap.get(subName);
|
List<TimeWindowData> timeWindows = dataMap.get(subName);
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,8 @@ import com.raytheon.uf.common.datadelivery.registry.PointTime;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
|
import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.Time;
|
import com.raytheon.uf.common.datadelivery.registry.Time;
|
||||||
|
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
|
||||||
|
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
||||||
import com.raytheon.uf.common.serialization.SerializationException;
|
import com.raytheon.uf.common.serialization.SerializationException;
|
||||||
import com.raytheon.uf.common.status.IPerformanceStatusHandler;
|
import com.raytheon.uf.common.status.IPerformanceStatusHandler;
|
||||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
|
@ -54,8 +56,10 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthSubscription;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.IBandwidthDao;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.IBandwidthDao;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.IBandwidthDbInit;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.IBandwidthDbInit;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrieval;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrieval;
|
||||||
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrievalAttributes;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.interfaces.BandwidthInitializer;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.interfaces.BandwidthInitializer;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.interfaces.ISubscriptionAggregator;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.interfaces.ISubscriptionAggregator;
|
||||||
|
import com.raytheon.uf.edex.datadelivery.bandwidth.processing.BandwidthSubscriptionContainer;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.processing.SimpleSubscriptionAggregator;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.processing.SimpleSubscriptionAggregator;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.BandwidthMap;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.BandwidthMap;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.BandwidthRoute;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.BandwidthRoute;
|
||||||
|
@ -64,6 +68,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalPlan;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalStatus;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalStatus;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthDaoUtil;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthDaoUtil;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
||||||
|
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract {@link IBandwidthManager} implementation which provides core
|
* Abstract {@link IBandwidthManager} implementation which provides core
|
||||||
|
@ -101,6 +106,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
||||||
* Jun 20, 2013 1802 djohnson Check several times for the metadata for now.
|
* Jun 20, 2013 1802 djohnson Check several times for the metadata for now.
|
||||||
* 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.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author dhladky
|
* @author dhladky
|
||||||
|
@ -202,23 +208,17 @@ public abstract class BandwidthManager extends
|
||||||
|
|
||||||
// Add the current subscription to the ones BandwidthManager already
|
// Add the current subscription to the ones BandwidthManager already
|
||||||
// knows about.
|
// knows about.
|
||||||
try {
|
|
||||||
newSubscriptions.add(BandwidthUtil
|
newSubscriptions.add(BandwidthUtil
|
||||||
.getSubscriptionDaoForSubscription(subscription,
|
.getSubscriptionDaoForSubscription(subscription,
|
||||||
retrievalTime));
|
retrievalTime));
|
||||||
} catch (SerializationException e) {
|
|
||||||
statusHandler.error(
|
|
||||||
"Trapped Exception trying to schedule Subscription["
|
|
||||||
+ subscription.getName() + "]", e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
timer.lap("createBandwidthSubscriptions");
|
timer.lap("createBandwidthSubscriptions");
|
||||||
|
|
||||||
bandwidthDao.storeBandwidthSubscriptions(newSubscriptions);
|
bandwidthDao.storeBandwidthSubscriptions(newSubscriptions);
|
||||||
timer.lap("storeBandwidthSubscriptions");
|
timer.lap("storeBandwidthSubscriptions");
|
||||||
|
|
||||||
unscheduled.addAll(aggregate(newSubscriptions));
|
unscheduled.addAll(aggregate(new BandwidthSubscriptionContainer(
|
||||||
|
subscription, newSubscriptions)));
|
||||||
timer.lap("aggregate");
|
timer.lap("aggregate");
|
||||||
|
|
||||||
timer.stop();
|
timer.stop();
|
||||||
|
@ -229,7 +229,8 @@ public abstract class BandwidthManager extends
|
||||||
return unscheduled;
|
return unscheduled;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List<BandwidthAllocation> schedule(BandwidthSubscription dao) {
|
protected List<BandwidthAllocation> schedule(Subscription subscription,
|
||||||
|
BandwidthSubscription dao) {
|
||||||
Calendar retrievalTime = dao.getBaseReferenceTime();
|
Calendar retrievalTime = dao.getBaseReferenceTime();
|
||||||
|
|
||||||
// Retrieve all the current subscriptions by provider, dataset name and
|
// Retrieve all the current subscriptions by provider, dataset name and
|
||||||
|
@ -244,7 +245,8 @@ public abstract class BandwidthManager extends
|
||||||
"] baseReferenceTime [%1$tY%1$tm%1$td%1$tH%1$tM",
|
"] baseReferenceTime [%1$tY%1$tm%1$td%1$tH%1$tM",
|
||||||
retrievalTime));
|
retrievalTime));
|
||||||
|
|
||||||
return aggregate(subscriptions);
|
return aggregate(new BandwidthSubscriptionContainer(subscription,
|
||||||
|
subscriptions));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -255,7 +257,7 @@ public abstract class BandwidthManager extends
|
||||||
* dataset.
|
* dataset.
|
||||||
*/
|
*/
|
||||||
private List<BandwidthAllocation> aggregate(
|
private List<BandwidthAllocation> aggregate(
|
||||||
List<BandwidthSubscription> bandwidthSubscriptions) {
|
BandwidthSubscriptionContainer bandwidthSubscriptions) {
|
||||||
IPerformanceTimer timer = TimeUtil.getPerformanceTimer();
|
IPerformanceTimer timer = TimeUtil.getPerformanceTimer();
|
||||||
timer.start();
|
timer.start();
|
||||||
|
|
||||||
|
@ -346,13 +348,30 @@ public abstract class BandwidthManager extends
|
||||||
bandwidthDao.store(reservations);
|
bandwidthDao.store(reservations);
|
||||||
timer.lap("storing retrievals");
|
timer.lap("storing retrievals");
|
||||||
|
|
||||||
|
List<SubscriptionRetrievalAttributes> attributes = Lists
|
||||||
|
.newArrayListWithCapacity(reservations.size());
|
||||||
|
for (SubscriptionRetrieval retrieval : reservations) {
|
||||||
|
final SubscriptionRetrievalAttributes attribute = new SubscriptionRetrievalAttributes();
|
||||||
|
try {
|
||||||
|
attribute.setSubscription(bandwidthSubscriptions.subscription);
|
||||||
|
} catch (SerializationException e) {
|
||||||
|
throw new IllegalStateException(
|
||||||
|
"Unable to serialize the subscription, these retrievals will not be processed!");
|
||||||
|
}
|
||||||
|
attribute.setSubscriptionRetrieval(retrieval);
|
||||||
|
attributes.add(attribute);
|
||||||
|
}
|
||||||
|
|
||||||
|
bandwidthDao.storeSubscriptionRetrievalAttributes(attributes);
|
||||||
|
timer.lap("storing retrieval attributes");
|
||||||
|
|
||||||
List<BandwidthAllocation> unscheduled = (reservations.isEmpty()) ? Collections
|
List<BandwidthAllocation> unscheduled = (reservations.isEmpty()) ? Collections
|
||||||
.<BandwidthAllocation> emptyList() : retrievalManager
|
.<BandwidthAllocation> emptyList() : retrievalManager
|
||||||
.schedule(reservations);
|
.schedule(reservations);
|
||||||
timer.lap("scheduling retrievals");
|
timer.lap("scheduling retrievals");
|
||||||
|
|
||||||
timer.stop();
|
timer.stop();
|
||||||
final int numberOfBandwidthSubscriptions = bandwidthSubscriptions
|
final int numberOfBandwidthSubscriptions = bandwidthSubscriptions.newSubscriptions
|
||||||
.size();
|
.size();
|
||||||
timer.logLaps("aggregate() bandwidthSubscriptions ["
|
timer.logLaps("aggregate() bandwidthSubscriptions ["
|
||||||
+ numberOfBandwidthSubscriptions + "]", performanceHandler);
|
+ numberOfBandwidthSubscriptions + "]", performanceHandler);
|
||||||
|
@ -397,33 +416,8 @@ public abstract class BandwidthManager extends
|
||||||
* @param unscheduled
|
* @param unscheduled
|
||||||
* the unscheduled allocations
|
* the unscheduled allocations
|
||||||
*/
|
*/
|
||||||
private void unscheduleSubscriptionsForAllocations(
|
protected abstract void unscheduleSubscriptionsForAllocations(
|
||||||
List<BandwidthAllocation> unscheduled) {
|
List<BandwidthAllocation> unscheduled);
|
||||||
Set<Subscription> subscriptionsToUnschedule = Sets.newHashSet();
|
|
||||||
for (BandwidthAllocation unscheduledAllocation : unscheduled) {
|
|
||||||
if (unscheduledAllocation instanceof SubscriptionRetrieval) {
|
|
||||||
SubscriptionRetrieval retrieval = (SubscriptionRetrieval) unscheduledAllocation;
|
|
||||||
try {
|
|
||||||
subscriptionsToUnschedule.add(retrieval.getSubscription());
|
|
||||||
} catch (SerializationException e) {
|
|
||||||
statusHandler.handle(Priority.PROBLEM,
|
|
||||||
"Unable to deserialize a subscription", e);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Subscription sub : subscriptionsToUnschedule) {
|
|
||||||
sub.setUnscheduled(true);
|
|
||||||
try {
|
|
||||||
subscriptionUpdated(sub);
|
|
||||||
} catch (SerializationException e) {
|
|
||||||
statusHandler.handle(Priority.PROBLEM,
|
|
||||||
"Unable to deserialize a subscription", e);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
|
@ -436,15 +430,8 @@ public abstract class BandwidthManager extends
|
||||||
List<BandwidthSubscription> subscriptions = new ArrayList<BandwidthSubscription>();
|
List<BandwidthSubscription> subscriptions = new ArrayList<BandwidthSubscription>();
|
||||||
Calendar now = BandwidthUtil.now();
|
Calendar now = BandwidthUtil.now();
|
||||||
// Store the AdhocSubscription with a base time of now..
|
// Store the AdhocSubscription with a base time of now..
|
||||||
try {
|
subscriptions.add(bandwidthDao.newBandwidthSubscription(subscription,
|
||||||
subscriptions.add(bandwidthDao.newBandwidthSubscription(
|
now));
|
||||||
subscription, now));
|
|
||||||
} catch (SerializationException e) {
|
|
||||||
statusHandler.error(
|
|
||||||
"Trapped Exception trying to schedule AdhocSubscription["
|
|
||||||
+ subscription.getName() + "]", e);
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check start time in Time, if it is blank, we need to add the most
|
// Check start time in Time, if it is blank, we need to add the most
|
||||||
// recent MetaData for the DataSet subscribed to.
|
// recent MetaData for the DataSet subscribed to.
|
||||||
|
@ -459,7 +446,9 @@ public abstract class BandwidthManager extends
|
||||||
SimpleSubscriptionAggregator a = new SimpleSubscriptionAggregator(
|
SimpleSubscriptionAggregator a = new SimpleSubscriptionAggregator(
|
||||||
bandwidthDao);
|
bandwidthDao);
|
||||||
List<BandwidthAllocation> reservations = new ArrayList<BandwidthAllocation>();
|
List<BandwidthAllocation> reservations = new ArrayList<BandwidthAllocation>();
|
||||||
List<SubscriptionRetrieval> retrievals = a.aggregate(subscriptions);
|
List<SubscriptionRetrieval> retrievals = a
|
||||||
|
.aggregate(new BandwidthSubscriptionContainer(subscription,
|
||||||
|
subscriptions));
|
||||||
|
|
||||||
for (SubscriptionRetrieval retrieval : retrievals) {
|
for (SubscriptionRetrieval retrieval : retrievals) {
|
||||||
retrieval.setStartTime(now);
|
retrieval.setStartTime(now);
|
||||||
|
@ -481,6 +470,20 @@ public abstract class BandwidthManager extends
|
||||||
for (SubscriptionRetrieval retrieval : retrievals) {
|
for (SubscriptionRetrieval retrieval : retrievals) {
|
||||||
|
|
||||||
if (retrieval.getStatus().equals(RetrievalStatus.SCHEDULED)) {
|
if (retrieval.getStatus().equals(RetrievalStatus.SCHEDULED)) {
|
||||||
|
SubscriptionRetrievalAttributes attributes = new SubscriptionRetrievalAttributes();
|
||||||
|
attributes.setSubscriptionRetrieval(retrieval);
|
||||||
|
|
||||||
|
try {
|
||||||
|
attributes.setSubscription(subscription);
|
||||||
|
|
||||||
|
bandwidthDao.store(attributes);
|
||||||
|
} catch (SerializationException e) {
|
||||||
|
statusHandler.error(
|
||||||
|
"Trapped Exception trying to schedule AdhocSubscription["
|
||||||
|
+ subscription.getName() + "]", e);
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
retrieval.setStatus(RetrievalStatus.READY);
|
retrieval.setStatus(RetrievalStatus.READY);
|
||||||
bandwidthDaoUtil.update(retrieval);
|
bandwidthDaoUtil.update(retrieval);
|
||||||
}
|
}
|
||||||
|
@ -498,7 +501,7 @@ public abstract class BandwidthManager extends
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<BandwidthAllocation> subscriptionUpdated(
|
public List<BandwidthAllocation> subscriptionUpdated(
|
||||||
Subscription subscription) throws SerializationException {
|
Subscription subscription) {
|
||||||
// Since AdhocSubscription extends Subscription it is not possible to
|
// Since AdhocSubscription extends Subscription it is not possible to
|
||||||
// separate the processing of those Objects in EventBus. So, handle the
|
// separate the processing of those Objects in EventBus. So, handle the
|
||||||
// case where the updated subscription is actually an AdhocSubscription
|
// case where the updated subscription is actually an AdhocSubscription
|
||||||
|
@ -697,7 +700,7 @@ public abstract class BandwidthManager extends
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PROPOSE_SET_BANDWIDTH:
|
case PROPOSE_SET_BANDWIDTH:
|
||||||
Set<Subscription> unscheduledSubscriptions = proposeSetBandwidth(
|
Set<String> unscheduledSubscriptions = proposeSetBandwidth(
|
||||||
requestNetwork, bandwidth);
|
requestNetwork, bandwidth);
|
||||||
response = unscheduledSubscriptions;
|
response = unscheduledSubscriptions;
|
||||||
if (unscheduledSubscriptions.isEmpty()) {
|
if (unscheduledSubscriptions.isEmpty()) {
|
||||||
|
@ -890,8 +893,8 @@ public abstract class BandwidthManager extends
|
||||||
for (BandwidthAllocation allocation : unscheduledAllocations) {
|
for (BandwidthAllocation allocation : unscheduledAllocations) {
|
||||||
if (allocation instanceof SubscriptionRetrieval) {
|
if (allocation instanceof SubscriptionRetrieval) {
|
||||||
SubscriptionRetrieval retrieval = (SubscriptionRetrieval) allocation;
|
SubscriptionRetrieval retrieval = (SubscriptionRetrieval) allocation;
|
||||||
unscheduledSubscriptions.add(retrieval.getSubscription()
|
unscheduledSubscriptions.add(retrieval
|
||||||
.getName());
|
.getBandwidthSubscription().getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -974,14 +977,14 @@ public abstract class BandwidthManager extends
|
||||||
*
|
*
|
||||||
* @throws SerializationException
|
* @throws SerializationException
|
||||||
*/
|
*/
|
||||||
private Set<Subscription> proposeSetBandwidth(Network requestNetwork,
|
private Set<String> proposeSetBandwidth(Network requestNetwork,
|
||||||
int bandwidth) throws SerializationException {
|
int bandwidth) throws SerializationException {
|
||||||
BandwidthMap copyOfCurrentMap = BandwidthMap
|
BandwidthMap copyOfCurrentMap = BandwidthMap
|
||||||
.load(EdexBandwidthContextFactory.getBandwidthMapConfig());
|
.load(EdexBandwidthContextFactory.getBandwidthMapConfig());
|
||||||
BandwidthRoute route = copyOfCurrentMap.getRoute(requestNetwork);
|
BandwidthRoute route = copyOfCurrentMap.getRoute(requestNetwork);
|
||||||
route.setDefaultBandwidth(bandwidth);
|
route.setDefaultBandwidth(bandwidth);
|
||||||
|
|
||||||
Set<Subscription> subscriptions = new HashSet<Subscription>();
|
Set<String> subscriptions = new HashSet<String>();
|
||||||
BandwidthManager proposedBwManager = null;
|
BandwidthManager proposedBwManager = null;
|
||||||
try {
|
try {
|
||||||
proposedBwManager = startProposedBandwidthManager(copyOfCurrentMap);
|
proposedBwManager = startProposedBandwidthManager(copyOfCurrentMap);
|
||||||
|
@ -1008,7 +1011,7 @@ public abstract class BandwidthManager extends
|
||||||
for (BandwidthAllocation allocation : unscheduledAllocations) {
|
for (BandwidthAllocation allocation : unscheduledAllocations) {
|
||||||
if (allocation instanceof SubscriptionRetrieval) {
|
if (allocation instanceof SubscriptionRetrieval) {
|
||||||
subscriptions.add(((SubscriptionRetrieval) allocation)
|
subscriptions.add(((SubscriptionRetrieval) allocation)
|
||||||
.getSubscription());
|
.getBandwidthSubscription().getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1082,7 +1085,18 @@ public abstract class BandwidthManager extends
|
||||||
try {
|
try {
|
||||||
ctx = new ClassPathXmlApplicationContext(springFiles,
|
ctx = new ClassPathXmlApplicationContext(springFiles,
|
||||||
EDEXUtil.getSpringContext());
|
EDEXUtil.getSpringContext());
|
||||||
return ctx.getBean("bandwidthManager", BandwidthManager.class);
|
final BandwidthManager bwManager = ctx.getBean("bandwidthManager",
|
||||||
|
BandwidthManager.class);
|
||||||
|
try {
|
||||||
|
bwManager.initializer.executeAfterRegistryInit();
|
||||||
|
return bwManager;
|
||||||
|
} catch (EbxmlRegistryException e) {
|
||||||
|
statusHandler
|
||||||
|
.handle(Priority.PROBLEM,
|
||||||
|
"Error loading subscriptions after starting the new bandwidth manager! Returning null reference.",
|
||||||
|
e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
if (close) {
|
if (close) {
|
||||||
Util.close(ctx);
|
Util.close(ctx);
|
||||||
|
@ -1158,17 +1172,22 @@ public abstract class BandwidthManager extends
|
||||||
// Proposing bandwidth changes requires the old way of bringing up a
|
// Proposing bandwidth changes requires the old way of bringing up a
|
||||||
// fresh bandwidth manager and trying the change from scratch
|
// fresh bandwidth manager and trying the change from scratch
|
||||||
unscheduled = Lists.newArrayList();
|
unscheduled = Lists.newArrayList();
|
||||||
Set<Subscription> actualSubscriptions = new HashSet<Subscription>();
|
Set<String> subscriptionNames = Sets.newHashSet();
|
||||||
for (BandwidthSubscription subscription : fromDao
|
for (BandwidthSubscription subscription : fromDao
|
||||||
.getBandwidthSubscriptions()) {
|
.getBandwidthSubscriptions()) {
|
||||||
|
subscriptionNames.add(subscription.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
Set<Subscription> actualSubscriptions = Sets.newHashSet();
|
||||||
|
for (String subName : subscriptionNames) {
|
||||||
try {
|
try {
|
||||||
Subscription actualSubscription = subscription
|
Subscription actualSubscription = DataDeliveryHandlers
|
||||||
.getSubscription();
|
.getSubscriptionHandler().getByName(subName);
|
||||||
actualSubscriptions.add(actualSubscription);
|
actualSubscriptions.add(actualSubscription);
|
||||||
} catch (SerializationException e) {
|
} catch (RegistryHandlerException e) {
|
||||||
statusHandler
|
statusHandler
|
||||||
.handle(Priority.PROBLEM,
|
.handle(Priority.PROBLEM,
|
||||||
"Unable to deserialize a subscription, results may not be accurate for modeling bandwidth changes.",
|
"Unable to lookup the subscription, results may not be accurate for modeling bandwidth changes.",
|
||||||
e);
|
e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1180,9 +1199,17 @@ public abstract class BandwidthManager extends
|
||||||
} else {
|
} else {
|
||||||
// Otherwise we can just copy the entire state of the current system
|
// Otherwise we can just copy the entire state of the current system
|
||||||
// and attempt the proposed changes
|
// and attempt the proposed changes
|
||||||
bandwidthDao.storeBandwidthSubscriptions(fromDao
|
final List<SubscriptionRetrieval> subscriptionRetrievals = fromDao
|
||||||
.getBandwidthSubscriptions());
|
.getSubscriptionRetrievals();
|
||||||
bandwidthDao.store(fromDao.getSubscriptionRetrievals());
|
List<BandwidthSubscription> bandwidthSubscriptions = Lists
|
||||||
|
.newArrayListWithCapacity(subscriptionRetrievals.size());
|
||||||
|
for (SubscriptionRetrieval retrieval : subscriptionRetrievals) {
|
||||||
|
bandwidthSubscriptions
|
||||||
|
.add(retrieval.getBandwidthSubscription());
|
||||||
|
}
|
||||||
|
bandwidthDao.storeBandwidthSubscriptions(bandwidthSubscriptions);
|
||||||
|
|
||||||
|
bandwidthDao.store(subscriptionRetrievals);
|
||||||
|
|
||||||
RetrievalManager fromRetrievalManager = copyFrom.retrievalManager;
|
RetrievalManager fromRetrievalManager = copyFrom.retrievalManager;
|
||||||
this.retrievalManager.copyState(fromRetrievalManager);
|
this.retrievalManager.copyState(fromRetrievalManager);
|
||||||
|
|
|
@ -22,7 +22,9 @@ package com.raytheon.uf.edex.datadelivery.bandwidth;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
@ -32,6 +34,7 @@ import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.eventbus.AllowConcurrentEvents;
|
import com.google.common.eventbus.AllowConcurrentEvents;
|
||||||
import com.google.common.eventbus.Subscribe;
|
import com.google.common.eventbus.Subscribe;
|
||||||
import com.raytheon.uf.common.datadelivery.bandwidth.IBandwidthRequest;
|
import com.raytheon.uf.common.datadelivery.bandwidth.IBandwidthRequest;
|
||||||
|
@ -64,6 +67,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthSubscription;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.IBandwidthDao;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.IBandwidthDao;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.IBandwidthDbInit;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.IBandwidthDbInit;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrieval;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrieval;
|
||||||
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrievalAttributes;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.notification.BandwidthEventBus;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.notification.BandwidthEventBus;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalManager;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalManager;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalPlan;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalPlan;
|
||||||
|
@ -84,6 +88,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Jul 10, 2013 2106 djohnson Extracted from {@link BandwidthManager}.
|
* Jul 10, 2013 2106 djohnson Extracted from {@link BandwidthManager}.
|
||||||
|
* Jul 11, 2013 2106 djohnson Look up subscription from the handler directly.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -226,14 +231,12 @@ public abstract class EdexBandwidthManager extends BandwidthManager {
|
||||||
|
|
||||||
// Schedule the next iteration of the subscription
|
// Schedule the next iteration of the subscription
|
||||||
BandwidthSubscription dao = sr.getBandwidthSubscription();
|
BandwidthSubscription dao = sr.getBandwidthSubscription();
|
||||||
Subscription subscription = null;
|
Subscription subscription;
|
||||||
try {
|
try {
|
||||||
subscription = dao.getSubscription();
|
subscription = subscriptionHandler.getByName(dao.getName());
|
||||||
} catch (SerializationException e) {
|
} catch (RegistryHandlerException e1) {
|
||||||
statusHandler.error(
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
"Failed to extract Subscription from BandwidthSubscription ["
|
"Unable to retrieve the subscription by name!", e1);
|
||||||
+ dao.getIdentifier() + "]", e);
|
|
||||||
// No sense in continuing
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,19 +264,10 @@ public abstract class EdexBandwidthManager extends BandwidthManager {
|
||||||
if (a == null) {
|
if (a == null) {
|
||||||
// Create the new BandwidthSubscription record with the next
|
// Create the new BandwidthSubscription record with the next
|
||||||
// time..
|
// time..
|
||||||
try {
|
|
||||||
a = bandwidthDao.newBandwidthSubscription(subscription,
|
a = bandwidthDao.newBandwidthSubscription(subscription,
|
||||||
next);
|
next);
|
||||||
} catch (SerializationException e) {
|
|
||||||
|
|
||||||
statusHandler.error(
|
schedule(subscription, a);
|
||||||
"Failed to create new BandwidthSubscription from Subscription ["
|
|
||||||
+ subscription.getId()
|
|
||||||
+ "] baseReferenceTime ["
|
|
||||||
+ BandwidthUtil.format(next) + "]", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
schedule(a);
|
|
||||||
} else {
|
} else {
|
||||||
statusHandler
|
statusHandler
|
||||||
.info("Subscription ["
|
.info("Subscription ["
|
||||||
|
@ -302,7 +296,7 @@ public abstract class EdexBandwidthManager extends BandwidthManager {
|
||||||
|| DataDeliveryRegistryObjectTypes.SHARED_SUBSCRIPTION
|
|| DataDeliveryRegistryObjectTypes.SHARED_SUBSCRIPTION
|
||||||
.equals(objectType)) {
|
.equals(objectType)) {
|
||||||
statusHandler
|
statusHandler
|
||||||
.info("Recieved Subscription removal notification for Subscription ["
|
.info("Received Subscription removal notification for Subscription ["
|
||||||
+ event.getId() + "]");
|
+ event.getId() + "]");
|
||||||
// Need to locate and remove all BandwidthReservations for the
|
// Need to locate and remove all BandwidthReservations for the
|
||||||
// given subscription..
|
// given subscription..
|
||||||
|
@ -455,17 +449,24 @@ public abstract class EdexBandwidthManager extends BandwidthManager {
|
||||||
try {
|
try {
|
||||||
// Update the retrieval times on the subscription object
|
// Update the retrieval times on the subscription object
|
||||||
// which goes through the retrieval process
|
// which goes through the retrieval process
|
||||||
final Subscription subscription = retrieval
|
final SubscriptionRetrievalAttributes subscriptionRetrievalAttributes = bandwidthDao
|
||||||
|
.getSubscriptionRetrievalAttributes(retrieval);
|
||||||
|
final Subscription subscription = subscriptionRetrievalAttributes
|
||||||
.getSubscription();
|
.getSubscription();
|
||||||
subscription.setUrl(dataSetMetaData.getUrl());
|
|
||||||
subscription.setProvider(dataSetMetaData.getProviderName());
|
|
||||||
|
|
||||||
if (subscription.getTime() instanceof PointTime) {
|
if (subscription.getTime() instanceof PointTime) {
|
||||||
final PointTime subTime = (PointTime) subscription
|
final PointTime subTime = (PointTime) subscription
|
||||||
.getTime();
|
.getTime();
|
||||||
|
subscription.setUrl(dataSetMetaData.getUrl());
|
||||||
|
subscription.setProvider(dataSetMetaData
|
||||||
|
.getProviderName());
|
||||||
|
|
||||||
subTime.setRequestStartAsDate(earliestRetrievalDataTime);
|
subTime.setRequestStartAsDate(earliestRetrievalDataTime);
|
||||||
subTime.setRequestEndAsDate(latestRetrievalDataTime);
|
subTime.setRequestEndAsDate(latestRetrievalDataTime);
|
||||||
subTime.setTimes(time.getTimes());
|
subTime.setTimes(time.getTimes());
|
||||||
|
|
||||||
|
bandwidthDao.update(subscriptionRetrievalAttributes);
|
||||||
|
|
||||||
// Now update the retrieval to be ready
|
// Now update the retrieval to be ready
|
||||||
retrieval.setStatus(RetrievalStatus.READY);
|
retrieval.setStatus(RetrievalStatus.READY);
|
||||||
bandwidthDaoUtil.update(retrieval);
|
bandwidthDaoUtil.update(retrieval);
|
||||||
|
@ -561,14 +562,20 @@ public abstract class EdexBandwidthManager extends BandwidthManager {
|
||||||
// Need to update the Subscription Object in the
|
// Need to update the Subscription Object in the
|
||||||
// SubscriptionRetrieval with the current DataSetMetaData
|
// SubscriptionRetrieval with the current DataSetMetaData
|
||||||
// URL and time Object
|
// URL and time Object
|
||||||
|
|
||||||
|
SubscriptionRetrievalAttributes attributes = bandwidthDao
|
||||||
|
.getSubscriptionRetrievalAttributes(retrieval);
|
||||||
|
|
||||||
Subscription sub;
|
Subscription sub;
|
||||||
try {
|
try {
|
||||||
sub = updateSubscriptionWithDataSetMetaData(
|
sub = updateSubscriptionWithDataSetMetaData(
|
||||||
retrieval.getSubscription(), dataSetMetaData);
|
attributes.getSubscription(), dataSetMetaData);
|
||||||
|
|
||||||
// Update the SubscriptionRetrieval record with the new
|
// Update the SubscriptionRetrieval record with the new
|
||||||
// data...
|
// data...
|
||||||
retrieval.setSubscription(sub);
|
attributes.setSubscription(sub);
|
||||||
|
|
||||||
|
bandwidthDao.update(attributes);
|
||||||
} catch (SerializationException e) {
|
} catch (SerializationException e) {
|
||||||
statusHandler
|
statusHandler
|
||||||
.handle(Priority.PROBLEM,
|
.handle(Priority.PROBLEM,
|
||||||
|
@ -607,6 +614,40 @@ public abstract class EdexBandwidthManager extends BandwidthManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void unscheduleSubscriptionsForAllocations(
|
||||||
|
List<BandwidthAllocation> unscheduled) {
|
||||||
|
List<SubscriptionRetrieval> retrievals = Lists.newArrayList();
|
||||||
|
for (BandwidthAllocation unscheduledAllocation : unscheduled) {
|
||||||
|
if (unscheduledAllocation instanceof SubscriptionRetrieval) {
|
||||||
|
SubscriptionRetrieval retrieval = (SubscriptionRetrieval) unscheduledAllocation;
|
||||||
|
retrievals.add(retrieval);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Set<Subscription> subscriptions = new HashSet<Subscription>();
|
||||||
|
for (SubscriptionRetrieval retrieval : retrievals) {
|
||||||
|
try {
|
||||||
|
final Subscription sub = bandwidthDao
|
||||||
|
.getSubscriptionRetrievalAttributes(retrieval)
|
||||||
|
.getSubscription();
|
||||||
|
subscriptions.add(sub);
|
||||||
|
} catch (SerializationException e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
|
"Unable to deserialize a subscription", e);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Subscription subscription : subscriptions) {
|
||||||
|
subscription.setUnscheduled(true);
|
||||||
|
subscriptionUpdated(subscription);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates a {@link Subscription) to reflect important attributes of the
|
* Updates a {@link Subscription) to reflect important attributes of the
|
||||||
* specified {@link DataSetMetaData}.
|
* specified {@link DataSetMetaData}.
|
||||||
|
|
|
@ -37,16 +37,13 @@ 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;
|
||||||
import com.raytheon.uf.common.dataplugin.persist.IPersistableDataObject;
|
import com.raytheon.uf.common.dataplugin.persist.IPersistableDataObject;
|
||||||
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.util.ReflectionUtil;
|
import com.raytheon.uf.common.util.ReflectionUtil;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthAllocation;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthAllocation;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthDataSetUpdate;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthDataSetUpdate;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthSubscription;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthSubscription;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.IBandwidthDao;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.IBandwidthDao;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrieval;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrieval;
|
||||||
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrievalAttributes;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalStatus;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalStatus;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
||||||
|
|
||||||
|
@ -65,6 +62,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.
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -73,9 +71,6 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
||||||
*/
|
*/
|
||||||
class InMemoryBandwidthDao implements IBandwidthDao {
|
class InMemoryBandwidthDao implements IBandwidthDao {
|
||||||
|
|
||||||
private static final IUFStatusHandler statusHandler = UFStatus
|
|
||||||
.getHandler(InMemoryBandwidthDao.class);
|
|
||||||
|
|
||||||
private static final AtomicLong idSequence = new AtomicLong(1);
|
private static final AtomicLong idSequence = new AtomicLong(1);
|
||||||
|
|
||||||
// Explicitly ConcurrentLinkedQueue so we can use methods that require that
|
// Explicitly ConcurrentLinkedQueue so we can use methods that require that
|
||||||
|
@ -275,25 +270,16 @@ class InMemoryBandwidthDao implements IBandwidthDao {
|
||||||
|
|
||||||
for (BandwidthAllocation current : bandwidthAllocations) {
|
for (BandwidthAllocation current : bandwidthAllocations) {
|
||||||
if (current instanceof SubscriptionRetrieval) {
|
if (current instanceof SubscriptionRetrieval) {
|
||||||
Subscription subscription;
|
BandwidthSubscription subscription;
|
||||||
try {
|
|
||||||
final SubscriptionRetrieval subscriptionRetrieval = (SubscriptionRetrieval) current;
|
final SubscriptionRetrieval subscriptionRetrieval = (SubscriptionRetrieval) current;
|
||||||
subscription = subscriptionRetrieval.getSubscription();
|
subscription = subscriptionRetrieval.getBandwidthSubscription();
|
||||||
if (provider.equals(subscription.getProvider())
|
if (provider.equals(subscription.getProvider())
|
||||||
&& dataSetName
|
&& dataSetName.equals(subscription.getDataSetName())
|
||||||
.equals(subscription.getDataSetName())
|
|
||||||
&& baseReferenceTime.getTimeInMillis() == subscriptionRetrieval
|
&& baseReferenceTime.getTimeInMillis() == subscriptionRetrieval
|
||||||
.getBandwidthSubscription()
|
.getBandwidthSubscription()
|
||||||
.getBaseReferenceTime().getTimeInMillis()) {
|
.getBaseReferenceTime().getTimeInMillis()) {
|
||||||
results.add(subscriptionRetrieval.copy());
|
results.add(subscriptionRetrieval.copy());
|
||||||
}
|
}
|
||||||
} catch (SerializationException e) {
|
|
||||||
statusHandler
|
|
||||||
.handle(Priority.PROBLEM,
|
|
||||||
"Unable to deserialize the retrieval's subscription, skipping it...",
|
|
||||||
e);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,22 +296,13 @@ class InMemoryBandwidthDao implements IBandwidthDao {
|
||||||
|
|
||||||
for (BandwidthAllocation current : bandwidthAllocations) {
|
for (BandwidthAllocation current : bandwidthAllocations) {
|
||||||
if (current instanceof SubscriptionRetrieval) {
|
if (current instanceof SubscriptionRetrieval) {
|
||||||
Subscription subscription;
|
BandwidthSubscription subscription;
|
||||||
try {
|
|
||||||
final SubscriptionRetrieval subscriptionRetrieval = (SubscriptionRetrieval) current;
|
final SubscriptionRetrieval subscriptionRetrieval = (SubscriptionRetrieval) current;
|
||||||
subscription = subscriptionRetrieval.getSubscription();
|
subscription = subscriptionRetrieval.getBandwidthSubscription();
|
||||||
if (provider.equals(subscription.getProvider())
|
if (provider.equals(subscription.getProvider())
|
||||||
&& dataSetName
|
&& dataSetName.equals(subscription.getDataSetName())) {
|
||||||
.equals(subscription.getDataSetName())) {
|
|
||||||
results.add(subscriptionRetrieval.copy());
|
results.add(subscriptionRetrieval.copy());
|
||||||
}
|
}
|
||||||
} catch (SerializationException e) {
|
|
||||||
statusHandler
|
|
||||||
.handle(Priority.PROBLEM,
|
|
||||||
"Unable to deserialize the retrieval's subscription, skipping it...",
|
|
||||||
e);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -385,8 +362,7 @@ class InMemoryBandwidthDao implements IBandwidthDao {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public BandwidthSubscription newBandwidthSubscription(
|
public BandwidthSubscription newBandwidthSubscription(
|
||||||
Subscription subscription, Calendar baseReferenceTime)
|
Subscription subscription, Calendar baseReferenceTime) {
|
||||||
throws SerializationException {
|
|
||||||
BandwidthSubscription entity = BandwidthUtil
|
BandwidthSubscription entity = BandwidthUtil
|
||||||
.getSubscriptionDaoForSubscription(subscription,
|
.getSubscriptionDaoForSubscription(subscription,
|
||||||
baseReferenceTime);
|
baseReferenceTime);
|
||||||
|
@ -541,23 +517,14 @@ class InMemoryBandwidthDao implements IBandwidthDao {
|
||||||
|
|
||||||
for (BandwidthAllocation current : bandwidthAllocations) {
|
for (BandwidthAllocation current : bandwidthAllocations) {
|
||||||
if (current instanceof SubscriptionRetrieval) {
|
if (current instanceof SubscriptionRetrieval) {
|
||||||
Subscription subscription;
|
BandwidthSubscription subscription;
|
||||||
try {
|
|
||||||
final SubscriptionRetrieval subscriptionRetrieval = (SubscriptionRetrieval) current;
|
final SubscriptionRetrieval subscriptionRetrieval = (SubscriptionRetrieval) current;
|
||||||
subscription = subscriptionRetrieval.getSubscription();
|
subscription = subscriptionRetrieval.getBandwidthSubscription();
|
||||||
if (provider.equals(subscription.getProvider())
|
if (provider.equals(subscription.getProvider())
|
||||||
&& dataSetName
|
&& dataSetName.equals(subscription.getDataSetName())
|
||||||
.equals(subscription.getDataSetName())
|
|
||||||
&& status.equals(subscriptionRetrieval.getStatus())) {
|
&& status.equals(subscriptionRetrieval.getStatus())) {
|
||||||
results.add(subscriptionRetrieval.copy());
|
results.add(subscriptionRetrieval.copy());
|
||||||
}
|
}
|
||||||
} catch (SerializationException e) {
|
|
||||||
statusHandler
|
|
||||||
.handle(Priority.PROBLEM,
|
|
||||||
"Unable to deserialize the retrieval's subscription, skipping it...",
|
|
||||||
e);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -587,10 +554,9 @@ class InMemoryBandwidthDao implements IBandwidthDao {
|
||||||
|
|
||||||
for (BandwidthAllocation current : bandwidthAllocations) {
|
for (BandwidthAllocation current : bandwidthAllocations) {
|
||||||
if (current instanceof SubscriptionRetrieval) {
|
if (current instanceof SubscriptionRetrieval) {
|
||||||
Subscription subscription;
|
BandwidthSubscription subscription;
|
||||||
try {
|
|
||||||
final SubscriptionRetrieval subscriptionRetrieval = (SubscriptionRetrieval) current;
|
final SubscriptionRetrieval subscriptionRetrieval = (SubscriptionRetrieval) current;
|
||||||
subscription = subscriptionRetrieval.getSubscription();
|
subscription = subscriptionRetrieval.getBandwidthSubscription();
|
||||||
|
|
||||||
final Date subRetrievalStartTime = subscriptionRetrieval
|
final Date subRetrievalStartTime = subscriptionRetrieval
|
||||||
.getStartTime().getTime();
|
.getStartTime().getTime();
|
||||||
|
@ -599,19 +565,11 @@ class InMemoryBandwidthDao implements IBandwidthDao {
|
||||||
.before(subRetrievalStartTime));
|
.before(subRetrievalStartTime));
|
||||||
|
|
||||||
if (provider.equals(subscription.getProvider())
|
if (provider.equals(subscription.getProvider())
|
||||||
&& dataSetName
|
&& dataSetName.equals(subscription.getDataSetName())
|
||||||
.equals(subscription.getDataSetName())
|
|
||||||
&& status.equals(subscriptionRetrieval.getStatus())
|
&& status.equals(subscriptionRetrieval.getStatus())
|
||||||
&& withinTimeLimits) {
|
&& withinTimeLimits) {
|
||||||
results.add(subscriptionRetrieval.copy());
|
results.add(subscriptionRetrieval.copy());
|
||||||
}
|
}
|
||||||
} catch (SerializationException e) {
|
|
||||||
statusHandler
|
|
||||||
.handle(Priority.PROBLEM,
|
|
||||||
"Unable to deserialize the retrieval's subscription, skipping it...",
|
|
||||||
e);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -664,4 +622,38 @@ class InMemoryBandwidthDao implements IBandwidthDao {
|
||||||
return allocations;
|
return allocations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void store(SubscriptionRetrievalAttributes attributes) {
|
||||||
|
// Does nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void storeSubscriptionRetrievalAttributes(
|
||||||
|
List<SubscriptionRetrievalAttributes> retrievalAttributes) {
|
||||||
|
// Does nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void update(SubscriptionRetrievalAttributes attributes) {
|
||||||
|
// Does nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SubscriptionRetrievalAttributes getSubscriptionRetrievalAttributes(
|
||||||
|
SubscriptionRetrieval retrieval) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,4 +155,13 @@ class InMemoryBandwidthManager extends BandwidthManager {
|
||||||
// Nothing to do for in-memory version
|
// Nothing to do for in-memory version
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void unscheduleSubscriptionsForAllocations(
|
||||||
|
List<BandwidthAllocation> unscheduled) {
|
||||||
|
// Nothing to do for in-memory version
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ import javax.persistence.SequenceGenerator;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import com.raytheon.uf.common.datadelivery.registry.Network;
|
import com.raytheon.uf.common.datadelivery.registry.Network;
|
||||||
|
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
|
||||||
import com.raytheon.uf.common.dataplugin.persist.IPersistableDataObject;
|
import com.raytheon.uf.common.dataplugin.persist.IPersistableDataObject;
|
||||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||||
|
@ -39,6 +40,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Oct 12, 2012 0726 djohnson Add SW history, use string version of enum.
|
* Oct 12, 2012 0726 djohnson Add SW history, use string version of enum.
|
||||||
* Jun 24, 2013 2106 djohnson Add copy constructor.
|
* Jun 24, 2013 2106 djohnson Add copy constructor.
|
||||||
|
* Jul 11, 2013 2106 djohnson Use SubscriptionPriority enum.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -89,7 +91,8 @@ public class BandwidthAllocation implements IPersistableDataObject<Long>,
|
||||||
|
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
@DynamicSerializeElement
|
@DynamicSerializeElement
|
||||||
private double priority;
|
@Enumerated(EnumType.STRING)
|
||||||
|
private SubscriptionPriority priority;
|
||||||
|
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
|
@ -203,7 +206,7 @@ public class BandwidthAllocation implements IPersistableDataObject<Long>,
|
||||||
return Long.valueOf(id);
|
return Long.valueOf(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getPriority() {
|
public SubscriptionPriority getPriority() {
|
||||||
return priority;
|
return priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,7 +276,7 @@ public class BandwidthAllocation implements IPersistableDataObject<Long>,
|
||||||
setId(identifier.longValue());
|
setId(identifier.longValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPriority(double priority) {
|
public void setPriority(SubscriptionPriority priority) {
|
||||||
this.priority = priority;
|
this.priority = priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,8 +344,7 @@ public class BandwidthAllocation implements IPersistableDataObject<Long>,
|
||||||
* @return true if this allocation is higher priority than the other one
|
* @return true if this allocation is higher priority than the other one
|
||||||
*/
|
*/
|
||||||
public boolean isHigherPriorityThan(BandwidthAllocation other) {
|
public boolean isHigherPriorityThan(BandwidthAllocation other) {
|
||||||
// A lower priority value means it's higher priority
|
return this.getPriority().isHigherPriorityThan(other.getPriority());
|
||||||
return this.getPriority() < other.getPriority();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -12,19 +12,13 @@ import javax.persistence.GenerationType;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.SequenceGenerator;
|
import javax.persistence.SequenceGenerator;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.persistence.Transient;
|
|
||||||
|
|
||||||
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.SubscriptionPriority;
|
||||||
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
|
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
|
||||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||||
import com.raytheon.uf.common.serialization.SerializationException;
|
|
||||||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
|
||||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||||
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.util.IDeepCopyable;
|
import com.raytheon.uf.common.util.IDeepCopyable;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
||||||
|
|
||||||
|
@ -42,6 +36,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
||||||
* Nov 09, 2012 1286 djohnson Add convenience methods for retrieving the subscription.
|
* Nov 09, 2012 1286 djohnson Add convenience methods for retrieving the subscription.
|
||||||
* Jun 13, 2013 2095 djohnson Add flag for whether or not data set update should be looked for on aggregating.
|
* Jun 13, 2013 2095 djohnson Add flag for whether or not data set update should be looked for on aggregating.
|
||||||
* Jun 24, 2013 2106 djohnson Add copy constructor.
|
* Jun 24, 2013 2106 djohnson Add copy constructor.
|
||||||
|
* Jul 11, 2013 2106 djohnson Use SubscriptionPriority enum, remove the Subscription.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -56,9 +51,6 @@ public class BandwidthSubscription extends PersistableDataObject<Long>
|
||||||
implements Serializable, ISerializableObject,
|
implements Serializable, ISerializableObject,
|
||||||
IDeepCopyable<BandwidthSubscription> {
|
IDeepCopyable<BandwidthSubscription> {
|
||||||
|
|
||||||
private static final IUFStatusHandler statusHandler = UFStatus
|
|
||||||
.getHandler(BandwidthSubscription.class);
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 20120723L;
|
private static final long serialVersionUID = 20120723L;
|
||||||
|
|
||||||
@DynamicSerializeElement
|
@DynamicSerializeElement
|
||||||
|
@ -102,7 +94,8 @@ public class BandwidthSubscription extends PersistableDataObject<Long>
|
||||||
|
|
||||||
@DynamicSerializeElement
|
@DynamicSerializeElement
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private double priority;
|
@Enumerated(EnumType.STRING)
|
||||||
|
private SubscriptionPriority priority;
|
||||||
|
|
||||||
@DynamicSerializeElement
|
@DynamicSerializeElement
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
|
@ -112,52 +105,10 @@ public class BandwidthSubscription extends PersistableDataObject<Long>
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private boolean checkForDataSetUpdate;
|
private boolean checkForDataSetUpdate;
|
||||||
|
|
||||||
@DynamicSerializeElement
|
|
||||||
@Column(nullable = false, length = 100000)
|
|
||||||
private byte[] subSubscription;
|
|
||||||
|
|
||||||
@Transient
|
|
||||||
private transient Subscription subscription;
|
|
||||||
|
|
||||||
public void setRegistryId(String registryId) {
|
public void setRegistryId(String registryId) {
|
||||||
this.registryId = registryId;
|
this.registryId = registryId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the subSubscription
|
|
||||||
* @throws SerializationException
|
|
||||||
*/
|
|
||||||
public Subscription getSubscription() throws SerializationException {
|
|
||||||
if (subscription == null) {
|
|
||||||
if (subSubscription != null) {
|
|
||||||
subscription = SerializationUtil.transformFromThrift(
|
|
||||||
Subscription.class, subSubscription);
|
|
||||||
} else {
|
|
||||||
statusHandler.handle(Priority.WARN,
|
|
||||||
"Null subSubscription as field, not deserializing.");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
return subscription;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param sub
|
|
||||||
* @throws SerializationException
|
|
||||||
*/
|
|
||||||
public void setSubscription(Subscription sub) throws SerializationException {
|
|
||||||
// Set the transient field subscription so that we don't
|
|
||||||
// have to deserialize the subscription if it was set
|
|
||||||
// already.
|
|
||||||
this.subscription = sub;
|
|
||||||
if (sub != null) {
|
|
||||||
this.subSubscription = SerializationUtil.transformToThrift(sub);
|
|
||||||
} else {
|
|
||||||
statusHandler.handle(Priority.WARN,
|
|
||||||
"Null subscription passed as parameter, not serializing.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public BandwidthSubscription() {
|
public BandwidthSubscription() {
|
||||||
// Bean constructor
|
// Bean constructor
|
||||||
}
|
}
|
||||||
|
@ -180,13 +131,6 @@ public class BandwidthSubscription extends PersistableDataObject<Long>
|
||||||
this.provider = bandwidthSubscription.provider;
|
this.provider = bandwidthSubscription.provider;
|
||||||
this.registryId = bandwidthSubscription.registryId;
|
this.registryId = bandwidthSubscription.registryId;
|
||||||
this.route = bandwidthSubscription.route;
|
this.route = bandwidthSubscription.route;
|
||||||
|
|
||||||
if (bandwidthSubscription.subSubscription != null) {
|
|
||||||
final int srcLength = bandwidthSubscription.subSubscription.length;
|
|
||||||
this.subSubscription = new byte[srcLength];
|
|
||||||
System.arraycopy(bandwidthSubscription.subSubscription, 0,
|
|
||||||
this.subSubscription, 0, srcLength);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -309,11 +253,11 @@ public class BandwidthSubscription extends PersistableDataObject<Long>
|
||||||
return baseReferenceTime;
|
return baseReferenceTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPriority(double priority) {
|
public void setPriority(SubscriptionPriority priority) {
|
||||||
this.priority = priority;
|
this.priority = priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getPriority() {
|
public SubscriptionPriority getPriority() {
|
||||||
return priority;
|
return priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,31 +295,6 @@ public class BandwidthSubscription extends PersistableDataObject<Long>
|
||||||
this.checkForDataSetUpdate = checkForDataSetUpdate;
|
this.checkForDataSetUpdate = checkForDataSetUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Added only to comply with DynamicSerialize, use
|
|
||||||
* {@link #getSubscription()} instead.
|
|
||||||
*
|
|
||||||
* @deprecated
|
|
||||||
* @return the subSubscription the raw bytes of the serialized subscription
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public byte[] getSubSubscription() {
|
|
||||||
return subSubscription;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Added only to comply with DynamicSerialize, use
|
|
||||||
* {@link #setSubscription()} instead.
|
|
||||||
*
|
|
||||||
* @deprecated
|
|
||||||
* @param subSubscription
|
|
||||||
* the subSubscription to set
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public void setSubSubscription(byte[] subSubscription) {
|
|
||||||
this.subSubscription = subSubscription;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -28,7 +28,6 @@ import java.util.SortedSet;
|
||||||
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;
|
||||||
import com.raytheon.uf.common.serialization.SerializationException;
|
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.BandwidthManager;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.BandwidthManager;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalStatus;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalStatus;
|
||||||
|
|
||||||
|
@ -317,7 +316,7 @@ public interface IBandwidthDao {
|
||||||
* @return A newly created and persisted BandwidthSubscription Object.
|
* @return A newly created and persisted BandwidthSubscription Object.
|
||||||
*/
|
*/
|
||||||
BandwidthSubscription newBandwidthSubscription(Subscription subscription,
|
BandwidthSubscription newBandwidthSubscription(Subscription subscription,
|
||||||
Calendar baseReferenceTime) throws SerializationException;
|
Calendar baseReferenceTime);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a SubscriptionRetrievals.
|
* Get a SubscriptionRetrievals.
|
||||||
|
@ -358,6 +357,14 @@ public interface IBandwidthDao {
|
||||||
*/
|
*/
|
||||||
void store(BandwidthAllocation bandwidthAllocation);
|
void store(BandwidthAllocation bandwidthAllocation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Persist a SubscriptionRetrievalAttributes to the database.
|
||||||
|
*
|
||||||
|
* @param attributes
|
||||||
|
* The SubscriptionRetrievalAttributes to store.
|
||||||
|
*/
|
||||||
|
void store(SubscriptionRetrievalAttributes attributes);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Persist a List of SubscriptionRetrievals to the database.
|
* Persist a List of SubscriptionRetrievals to the database.
|
||||||
*
|
*
|
||||||
|
@ -366,6 +373,15 @@ public interface IBandwidthDao {
|
||||||
*/
|
*/
|
||||||
void store(List<SubscriptionRetrieval> retrievals);
|
void store(List<SubscriptionRetrieval> retrievals);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Persist a list of objects to the database.
|
||||||
|
*
|
||||||
|
* @param entities
|
||||||
|
* The entities to store.
|
||||||
|
*/
|
||||||
|
void storeSubscriptionRetrievalAttributes(
|
||||||
|
List<SubscriptionRetrievalAttributes> retrievalAttributes);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Persist a {@link BandwidthSubscription} to the database.
|
* Persist a {@link BandwidthSubscription} to the database.
|
||||||
*
|
*
|
||||||
|
@ -436,4 +452,19 @@ public interface IBandwidthDao {
|
||||||
*/
|
*/
|
||||||
List<BandwidthAllocation> getBandwidthAllocationsForNetworkAndBucketStartTime(
|
List<BandwidthAllocation> getBandwidthAllocationsForNetworkAndBucketStartTime(
|
||||||
Network network, long bucketStartTime);
|
Network network, long bucketStartTime);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param attributes
|
||||||
|
*/
|
||||||
|
void update(SubscriptionRetrievalAttributes attributes);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the {@link SubscriptionRetrievalAttributes} for the
|
||||||
|
* {@link SubscriptionRetrieval}.
|
||||||
|
*
|
||||||
|
* @param retrieval
|
||||||
|
* @return the attributes
|
||||||
|
*/
|
||||||
|
SubscriptionRetrievalAttributes getSubscriptionRetrievalAttributes(
|
||||||
|
SubscriptionRetrieval retrieval);
|
||||||
}
|
}
|
|
@ -1,22 +1,16 @@
|
||||||
package com.raytheon.uf.edex.datadelivery.bandwidth.dao;
|
package com.raytheon.uf.edex.datadelivery.bandwidth.dao;
|
||||||
|
|
||||||
|
import javax.persistence.CascadeType;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.DiscriminatorValue;
|
import javax.persistence.DiscriminatorValue;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.FetchType;
|
import javax.persistence.FetchType;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
import javax.persistence.Transient;
|
|
||||||
|
|
||||||
import org.hibernate.annotations.IndexColumn;
|
import org.hibernate.annotations.IndexColumn;
|
||||||
|
|
||||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
|
||||||
import com.raytheon.uf.common.serialization.SerializationException;
|
|
||||||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
|
||||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
|
||||||
import com.raytheon.uf.common.status.UFStatus;
|
|
||||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class representing a Subscription that may have been aggregated with other
|
* Class representing a Subscription that may have been aggregated with other
|
||||||
|
@ -32,6 +26,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
* made it nullable for single table strategy.
|
* made it nullable for single table strategy.
|
||||||
* Nov 09, 2012 1286 djohnson Add reference back to owning BandwidthSubscription.
|
* Nov 09, 2012 1286 djohnson Add reference back to owning BandwidthSubscription.
|
||||||
* Jun 24, 2013 2106 djohnson Add copy constructor.
|
* Jun 24, 2013 2106 djohnson Add copy constructor.
|
||||||
|
* Jul 11, 2013 2106 djohnson Use SubscriptionPriority enum, lazy load the Subscription object.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -44,23 +39,15 @@ public class SubscriptionRetrieval extends BandwidthAllocation {
|
||||||
|
|
||||||
private static final long serialVersionUID = 4563049024191145668L;
|
private static final long serialVersionUID = 4563049024191145668L;
|
||||||
|
|
||||||
private static final IUFStatusHandler statusHandler = UFStatus
|
|
||||||
.getHandler(SubscriptionRetrieval.class);
|
|
||||||
|
|
||||||
@Column
|
@Column
|
||||||
@DynamicSerializeElement
|
@DynamicSerializeElement
|
||||||
private int dataSetAvailablityDelay;
|
private int dataSetAvailablityDelay;
|
||||||
|
|
||||||
@DynamicSerializeElement
|
|
||||||
// Must be nullable because we use a single table strategy
|
|
||||||
@Column(nullable = true, length = 100000)
|
|
||||||
private byte[] subSubscription;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A link to the owning BandwidthSubscription entity.
|
* A link to the owning BandwidthSubscription entity.
|
||||||
*/
|
*/
|
||||||
@DynamicSerializeElement
|
@DynamicSerializeElement
|
||||||
@ManyToOne(fetch = FetchType.EAGER, optional = true)
|
@ManyToOne(fetch = FetchType.EAGER, optional = true, cascade = CascadeType.PERSIST)
|
||||||
// Must be nullable because we use a single table strategy
|
// Must be nullable because we use a single table strategy
|
||||||
@IndexColumn(name = "subscriptionid_fk", nullable = true)
|
@IndexColumn(name = "subscriptionid_fk", nullable = true)
|
||||||
private BandwidthSubscription bandwidthSubscription;
|
private BandwidthSubscription bandwidthSubscription;
|
||||||
|
@ -73,9 +60,6 @@ public class SubscriptionRetrieval extends BandwidthAllocation {
|
||||||
@DynamicSerializeElement
|
@DynamicSerializeElement
|
||||||
private String subsumedBy;
|
private String subsumedBy;
|
||||||
|
|
||||||
@Transient
|
|
||||||
private transient Subscription subscription;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
|
@ -94,13 +78,6 @@ public class SubscriptionRetrieval extends BandwidthAllocation {
|
||||||
this.setDataSetAvailablityDelay(from.dataSetAvailablityDelay);
|
this.setDataSetAvailablityDelay(from.dataSetAvailablityDelay);
|
||||||
this.setSubscriptionLatency(from.getSubscriptionLatency());
|
this.setSubscriptionLatency(from.getSubscriptionLatency());
|
||||||
this.setSubsumedBy(from.getSubsumedBy());
|
this.setSubsumedBy(from.getSubsumedBy());
|
||||||
|
|
||||||
if (from.subSubscription != null) {
|
|
||||||
final int srcLength = from.subSubscription.length;
|
|
||||||
this.subSubscription = new byte[srcLength];
|
|
||||||
System.arraycopy(from.subSubscription, 0, this.subSubscription, 0,
|
|
||||||
srcLength);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -161,66 +138,6 @@ public class SubscriptionRetrieval extends BandwidthAllocation {
|
||||||
this.bandwidthSubscription = bandwidthSubscription;
|
this.bandwidthSubscription = bandwidthSubscription;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the subSubscription
|
|
||||||
* @throws SerializationException
|
|
||||||
*/
|
|
||||||
public Subscription getSubscription() throws SerializationException {
|
|
||||||
if (subscription == null) {
|
|
||||||
if (subSubscription != null) {
|
|
||||||
subscription = SerializationUtil.transformFromThrift(
|
|
||||||
Subscription.class, subSubscription);
|
|
||||||
} else {
|
|
||||||
statusHandler.handle(Priority.WARN,
|
|
||||||
"Null subSubscription as field, not deserializing.");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
return subscription;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param sub
|
|
||||||
* @throws SerializationException
|
|
||||||
*/
|
|
||||||
public void setSubscription(Subscription sub) throws SerializationException {
|
|
||||||
// Set the transient field subscription so that we don't
|
|
||||||
// have to deserialize the subscription if it was set
|
|
||||||
// already.
|
|
||||||
this.subscription = sub;
|
|
||||||
if (sub != null) {
|
|
||||||
this.subSubscription = SerializationUtil.transformToThrift(sub);
|
|
||||||
} else {
|
|
||||||
statusHandler.handle(Priority.WARN,
|
|
||||||
"Null subscription passed as parameter, not serializing.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Added only to comply with DynamicSerialize, use
|
|
||||||
* {@link #getSubscription()} instead.
|
|
||||||
*
|
|
||||||
* @deprecated
|
|
||||||
* @return the subSubscription the raw bytes of the serialized subscription
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public byte[] getSubSubscription() {
|
|
||||||
return subSubscription;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Added only to comply with DynamicSerialize, use
|
|
||||||
* {@link #setSubscription()} instead.
|
|
||||||
*
|
|
||||||
* @deprecated
|
|
||||||
* @param subSubscription
|
|
||||||
* the subSubscription to set
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public void setSubSubscription(byte[] subSubscription) {
|
|
||||||
this.subSubscription = subSubscription;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,204 @@
|
||||||
|
package com.raytheon.uf.edex.datadelivery.bandwidth.dao;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.persistence.CascadeType;
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.FetchType;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.OneToOne;
|
||||||
|
import javax.persistence.SequenceGenerator;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import javax.persistence.Transient;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||||
|
import com.raytheon.uf.common.dataplugin.persist.IPersistableDataObject;
|
||||||
|
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||||
|
import com.raytheon.uf.common.serialization.SerializationException;
|
||||||
|
import com.raytheon.uf.common.serialization.SerializationUtil;
|
||||||
|
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||||
|
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||||
|
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
|
import com.raytheon.uf.common.util.IDeepCopyable;
|
||||||
|
import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds attributes for {@link SubscriptionRetrieval} instances that should be
|
||||||
|
* only loaded on-demand.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Jul 11, 2013 2106 djohnson Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Table(name = "bandwidth_subscription_retrieval_attributes")
|
||||||
|
@SequenceGenerator(name = "BANDWIDTH_SEQ", sequenceName = "bandwidth_seq", allocationSize = 1, initialValue = 1)
|
||||||
|
@DynamicSerialize
|
||||||
|
public class SubscriptionRetrievalAttributes implements
|
||||||
|
IPersistableDataObject<Long>, Serializable, ISerializableObject,
|
||||||
|
IDeepCopyable<SubscriptionRetrievalAttributes> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4563049024191145668L;
|
||||||
|
|
||||||
|
private static final IUFStatusHandler statusHandler = UFStatus
|
||||||
|
.getHandler(SubscriptionRetrievalAttributes.class);
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Column(name = "identifier")
|
||||||
|
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "BANDWIDTH_SEQ")
|
||||||
|
@DynamicSerializeElement
|
||||||
|
private long id = BandwidthUtil.DEFAULT_IDENTIFIER;
|
||||||
|
|
||||||
|
@DynamicSerializeElement
|
||||||
|
// Must be nullable because we use a single table strategy
|
||||||
|
@Column(nullable = true)
|
||||||
|
private byte[] subSubscription;
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
private transient Subscription subscription;
|
||||||
|
|
||||||
|
@DynamicSerializeElement
|
||||||
|
@OneToOne(fetch = FetchType.EAGER, optional = false, cascade = CascadeType.PERSIST)
|
||||||
|
private SubscriptionRetrieval subscriptionRetrieval;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*/
|
||||||
|
public SubscriptionRetrievalAttributes() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy constructor.
|
||||||
|
*
|
||||||
|
* @param from
|
||||||
|
* the instance to copy from
|
||||||
|
*/
|
||||||
|
public SubscriptionRetrievalAttributes(SubscriptionRetrievalAttributes from) {
|
||||||
|
if (from.subSubscription != null) {
|
||||||
|
final int srcLength = from.subSubscription.length;
|
||||||
|
this.subSubscription = new byte[srcLength];
|
||||||
|
System.arraycopy(from.subSubscription, 0, this.subSubscription, 0,
|
||||||
|
srcLength);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SubscriptionRetrievalAttributes copy() {
|
||||||
|
return new SubscriptionRetrievalAttributes(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the subSubscription
|
||||||
|
* @throws SerializationException
|
||||||
|
*/
|
||||||
|
public Subscription getSubscription() throws SerializationException {
|
||||||
|
if (subscription == null) {
|
||||||
|
if (subSubscription != null) {
|
||||||
|
subscription = SerializationUtil.transformFromThrift(
|
||||||
|
Subscription.class, subSubscription);
|
||||||
|
} else {
|
||||||
|
statusHandler.handle(Priority.WARN,
|
||||||
|
"Null subSubscription as field, not deserializing.");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return subscription;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param sub
|
||||||
|
* @throws SerializationException
|
||||||
|
*/
|
||||||
|
public void setSubscription(Subscription sub) throws SerializationException {
|
||||||
|
// Set the transient field subscription so that we don't
|
||||||
|
// have to deserialize the subscription if it was set
|
||||||
|
// already.
|
||||||
|
this.subscription = sub;
|
||||||
|
if (sub != null) {
|
||||||
|
this.subSubscription = SerializationUtil.transformToThrift(sub);
|
||||||
|
} else {
|
||||||
|
statusHandler.handle(Priority.WARN,
|
||||||
|
"Null subscription passed as parameter, not serializing.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Added only to comply with DynamicSerialize, use
|
||||||
|
* {@link #getSubscription()} instead.
|
||||||
|
*
|
||||||
|
* @deprecated
|
||||||
|
* @return the subSubscription the raw bytes of the serialized subscription
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public byte[] getSubSubscription() {
|
||||||
|
return subSubscription;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Added only to comply with DynamicSerialize, use
|
||||||
|
* {@link #setSubscription()} instead.
|
||||||
|
*
|
||||||
|
* @deprecated
|
||||||
|
* @param subSubscription
|
||||||
|
* the subSubscription to set
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public void setSubSubscription(byte[] subSubscription) {
|
||||||
|
this.subSubscription = subSubscription;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Long getIdentifier() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the id
|
||||||
|
*/
|
||||||
|
public long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param id
|
||||||
|
* the id to set
|
||||||
|
*/
|
||||||
|
public void setId(long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param subscriptionRetrieval
|
||||||
|
*/
|
||||||
|
public void setSubscriptionRetrieval(
|
||||||
|
SubscriptionRetrieval subscriptionRetrieval) {
|
||||||
|
this.subscriptionRetrieval = subscriptionRetrieval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public SubscriptionRetrieval getSubscriptionRetrieval() {
|
||||||
|
return this.subscriptionRetrieval;
|
||||||
|
}
|
||||||
|
}
|
|
@ -33,12 +33,12 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
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;
|
||||||
import com.raytheon.uf.common.serialization.SerializationException;
|
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthAllocation;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthAllocation;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthDataSetUpdate;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthDataSetUpdate;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthSubscription;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthSubscription;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.IBandwidthDao;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.IBandwidthDao;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrieval;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrieval;
|
||||||
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrievalAttributes;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalStatus;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalStatus;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
||||||
|
|
||||||
|
@ -76,6 +76,8 @@ public class HibernateBandwidthDao implements IBandwidthDao {
|
||||||
|
|
||||||
private IBandwidthDataSetUpdateDao bandwidthDataSetUpdateDao;
|
private IBandwidthDataSetUpdateDao bandwidthDataSetUpdateDao;
|
||||||
|
|
||||||
|
private ISubscriptionRetrievalAttributesDao subscriptionRetrievalAttributesDao;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
|
@ -269,8 +271,7 @@ public class HibernateBandwidthDao implements IBandwidthDao {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public BandwidthSubscription newBandwidthSubscription(
|
public BandwidthSubscription newBandwidthSubscription(
|
||||||
Subscription subscription, Calendar baseReferenceTime)
|
Subscription subscription, Calendar baseReferenceTime) {
|
||||||
throws SerializationException {
|
|
||||||
BandwidthSubscription entity = BandwidthUtil
|
BandwidthSubscription entity = BandwidthUtil
|
||||||
.getSubscriptionDaoForSubscription(subscription,
|
.getSubscriptionDaoForSubscription(subscription,
|
||||||
baseReferenceTime);
|
baseReferenceTime);
|
||||||
|
@ -305,6 +306,11 @@ public class HibernateBandwidthDao implements IBandwidthDao {
|
||||||
public void remove(BandwidthSubscription subscriptionDao) {
|
public void remove(BandwidthSubscription subscriptionDao) {
|
||||||
List<SubscriptionRetrieval> bandwidthReservations = subscriptionRetrievalDao
|
List<SubscriptionRetrieval> bandwidthReservations = subscriptionRetrievalDao
|
||||||
.getBySubscriptionId(subscriptionDao.getIdentifier());
|
.getBySubscriptionId(subscriptionDao.getIdentifier());
|
||||||
|
for (SubscriptionRetrieval retrieval : bandwidthReservations) {
|
||||||
|
subscriptionRetrievalAttributesDao
|
||||||
|
.delete(subscriptionRetrievalAttributesDao
|
||||||
|
.getBySubscriptionRetrieval(retrieval));
|
||||||
|
}
|
||||||
subscriptionRetrievalDao.deleteAll(bandwidthReservations);
|
subscriptionRetrievalDao.deleteAll(bandwidthReservations);
|
||||||
bandwidthSubscriptionDao.delete(subscriptionDao);
|
bandwidthSubscriptionDao.delete(subscriptionDao);
|
||||||
}
|
}
|
||||||
|
@ -442,6 +448,22 @@ public class HibernateBandwidthDao implements IBandwidthDao {
|
||||||
this.bandwidthDataSetUpdateDao = bandwidthDataSetUpdateDao;
|
this.bandwidthDataSetUpdateDao = bandwidthDataSetUpdateDao;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the subscriptionRetrievalAttributesDao
|
||||||
|
*/
|
||||||
|
public ISubscriptionRetrievalAttributesDao getSubscriptionRetrievalAttributesDao() {
|
||||||
|
return subscriptionRetrievalAttributesDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param subscriptionRetrievalAttributesDao
|
||||||
|
* the subscriptionRetrievalAttributesDao to set
|
||||||
|
*/
|
||||||
|
public void setSubscriptionRetrievalAttributesDao(
|
||||||
|
ISubscriptionRetrievalAttributesDao subscriptionRetrievalAttributesDao) {
|
||||||
|
this.subscriptionRetrievalAttributesDao = subscriptionRetrievalAttributesDao;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
@ -456,8 +478,40 @@ public class HibernateBandwidthDao implements IBandwidthDao {
|
||||||
@Override
|
@Override
|
||||||
public List<BandwidthAllocation> getBandwidthAllocationsForNetworkAndBucketStartTime(
|
public List<BandwidthAllocation> getBandwidthAllocationsForNetworkAndBucketStartTime(
|
||||||
Network network, long bucketStartTime) {
|
Network network, long bucketStartTime) {
|
||||||
return bandwidthAllocationDao.getByNetworkAndBucketStartTime(
|
return bandwidthAllocationDao.getByNetworkAndBucketStartTime(network,
|
||||||
network, bucketStartTime);
|
bucketStartTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void store(SubscriptionRetrievalAttributes attributes) {
|
||||||
|
subscriptionRetrievalAttributesDao.create(attributes);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void storeSubscriptionRetrievalAttributes(
|
||||||
|
List<SubscriptionRetrievalAttributes> retrievalAttributes) {
|
||||||
|
subscriptionRetrievalAttributesDao.persistAll(retrievalAttributes);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(SubscriptionRetrievalAttributes attributes) {
|
||||||
|
subscriptionRetrievalAttributesDao.update(attributes);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SubscriptionRetrievalAttributes getSubscriptionRetrievalAttributes(
|
||||||
|
SubscriptionRetrieval retrieval) {
|
||||||
|
return subscriptionRetrievalAttributesDao
|
||||||
|
.getBySubscriptionRetrieval(retrieval);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import com.raytheon.uf.edex.database.init.DbInit;
|
import com.raytheon.uf.edex.database.init.DbInit;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthBucket;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthBucket;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.IBandwidthDbInit;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.IBandwidthDbInit;
|
||||||
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrievalAttributes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The DbInit class is responsible for ensuring that the appropriate tables are
|
* The DbInit class is responsible for ensuring that the appropriate tables are
|
||||||
|
@ -42,6 +43,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.dao.IBandwidthDbInit;
|
||||||
* Oct 26, 2012 1286 djohnson Renamed to Hibernate specific.
|
* Oct 26, 2012 1286 djohnson Renamed to Hibernate specific.
|
||||||
* Apr 30, 2013 1960 djohnson Extend the generalized DbInit.
|
* Apr 30, 2013 1960 djohnson Extend the generalized DbInit.
|
||||||
* Jun 24, 2013 2106 djohnson Add {@link BandwidthBucket} to annotated classes.
|
* Jun 24, 2013 2106 djohnson Add {@link BandwidthBucket} to annotated classes.
|
||||||
|
* Jul 11, 2013 2106 djohnson Add {@link SubscriptionRetrievalAttributes}.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author jspinks
|
* @author jspinks
|
||||||
|
@ -79,6 +81,7 @@ public class HibernateBandwidthDbInit extends DbInit implements
|
||||||
aConfig.addAnnotatedClass(com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthSubscription.class);
|
aConfig.addAnnotatedClass(com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthSubscription.class);
|
||||||
aConfig.addAnnotatedClass(com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrieval.class);
|
aConfig.addAnnotatedClass(com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrieval.class);
|
||||||
aConfig.addAnnotatedClass(com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthAllocation.class);
|
aConfig.addAnnotatedClass(com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthAllocation.class);
|
||||||
|
aConfig.addAnnotatedClass(com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrievalAttributes.class);
|
||||||
return aConfig;
|
return aConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
/**
|
||||||
|
* This software was developed and / or modified by Raytheon Company,
|
||||||
|
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||||
|
*
|
||||||
|
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||||
|
* This software product contains export-restricted data whose
|
||||||
|
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||||
|
* to non-U.S. persons whether in the United States or abroad requires
|
||||||
|
* an export license or other authorization.
|
||||||
|
*
|
||||||
|
* Contractor Name: Raytheon Company
|
||||||
|
* Contractor Address: 6825 Pine Street, Suite 340
|
||||||
|
* Mail Stop B8
|
||||||
|
* Omaha, NE 68106
|
||||||
|
* 402.291.0100
|
||||||
|
*
|
||||||
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
|
* further licensing information.
|
||||||
|
**/
|
||||||
|
package com.raytheon.uf.edex.datadelivery.bandwidth.hibernate;
|
||||||
|
|
||||||
|
import com.raytheon.uf.edex.database.dao.ISessionManagedDao;
|
||||||
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrieval;
|
||||||
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrievalAttributes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DAO for {@link SubscriptionRetrievalAttributes} instances.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Jul 11, 2013 2106 djohnson Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author djohnson
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
interface ISubscriptionRetrievalAttributesDao extends
|
||||||
|
ISessionManagedDao<Long, SubscriptionRetrievalAttributes> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param retrieval
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
SubscriptionRetrievalAttributes getBySubscriptionRetrieval(
|
||||||
|
SubscriptionRetrieval retrieval);
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
/**
|
||||||
|
* This software was developed and / or modified by Raytheon Company,
|
||||||
|
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||||
|
*
|
||||||
|
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||||
|
* This software product contains export-restricted data whose
|
||||||
|
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||||
|
* to non-U.S. persons whether in the United States or abroad requires
|
||||||
|
* an export license or other authorization.
|
||||||
|
*
|
||||||
|
* Contractor Name: Raytheon Company
|
||||||
|
* Contractor Address: 6825 Pine Street, Suite 340
|
||||||
|
* Mail Stop B8
|
||||||
|
* Omaha, NE 68106
|
||||||
|
* 402.291.0100
|
||||||
|
*
|
||||||
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
|
* further licensing information.
|
||||||
|
**/
|
||||||
|
package com.raytheon.uf.edex.datadelivery.bandwidth.hibernate;
|
||||||
|
|
||||||
|
import com.raytheon.uf.edex.database.dao.SessionManagedDao;
|
||||||
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrieval;
|
||||||
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrievalAttributes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * DAO that handles {@link SubscriptionRetrievalAttributes} instances.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Jul 11, 2013 2106 djohnson Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author djohnson
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
public class SubscriptionRetrievalAttributesDao extends
|
||||||
|
SessionManagedDao<Long, SubscriptionRetrievalAttributes> implements
|
||||||
|
ISubscriptionRetrievalAttributesDao {
|
||||||
|
|
||||||
|
private static final String GET_BY_SUBSCRIPTIONRETRIEVAL = "from SubscriptionRetrievalAttributes sr where "
|
||||||
|
+ "sr.subscriptionRetrieval.id = :id";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected Class<SubscriptionRetrievalAttributes> getEntityClass() {
|
||||||
|
return SubscriptionRetrievalAttributes.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SubscriptionRetrievalAttributes getBySubscriptionRetrieval(
|
||||||
|
SubscriptionRetrieval retrieval) {
|
||||||
|
return uniqueResult(GET_BY_SUBSCRIPTIONRETRIEVAL, "id",
|
||||||
|
retrieval.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
||||||
|
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthSubscription;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthSubscription;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrieval;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrieval;
|
||||||
|
import com.raytheon.uf.edex.datadelivery.bandwidth.processing.BandwidthSubscriptionContainer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -33,13 +34,15 @@ public interface ISubscriptionAggregator {
|
||||||
* Generate a List of SubscriptionRetrieval Object for the provided
|
* Generate a List of SubscriptionRetrieval Object for the provided
|
||||||
* BandwidthSubscription Objects.
|
* BandwidthSubscription Objects.
|
||||||
*
|
*
|
||||||
* @param newSubscriptions
|
* @param container
|
||||||
* A List of BandwidthSubscription Objects which were just added
|
* A container with a List of BandwidthSubscription Objects which
|
||||||
|
* were just added, and their subscription
|
||||||
*
|
*
|
||||||
* @return The SubscriptionRetrieval Objects used to fulfill the
|
* @return The SubscriptionRetrieval Objects used to fulfill the
|
||||||
* BandwidthSubscription Objects provided.
|
* BandwidthSubscription Objects provided.
|
||||||
*/
|
*/
|
||||||
List<SubscriptionRetrieval> aggregate(List<BandwidthSubscription> newSubscriptions);
|
List<SubscriptionRetrieval> aggregate(
|
||||||
|
BandwidthSubscriptionContainer container);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is called once all the SubscriptionRetrievals for a
|
* This method is called once all the SubscriptionRetrievals for a
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
/**
|
||||||
|
* This software was developed and / or modified by Raytheon Company,
|
||||||
|
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||||
|
*
|
||||||
|
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||||
|
* This software product contains export-restricted data whose
|
||||||
|
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||||
|
* to non-U.S. persons whether in the United States or abroad requires
|
||||||
|
* an export license or other authorization.
|
||||||
|
*
|
||||||
|
* Contractor Name: Raytheon Company
|
||||||
|
* Contractor Address: 6825 Pine Street, Suite 340
|
||||||
|
* Mail Stop B8
|
||||||
|
* Omaha, NE 68106
|
||||||
|
* 402.291.0100
|
||||||
|
*
|
||||||
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
|
* further licensing information.
|
||||||
|
**/
|
||||||
|
package com.raytheon.uf.edex.datadelivery.bandwidth.processing;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||||
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthSubscription;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Container class to transport {@link BandwidthSubscription} instances with
|
||||||
|
* their {@link Subscription} since they no longer embed a copy.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Jul 11, 2013 2106 djohnson Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author djohnson
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
public class BandwidthSubscriptionContainer {
|
||||||
|
public final Subscription subscription;
|
||||||
|
|
||||||
|
public final List<BandwidthSubscription> newSubscriptions;
|
||||||
|
|
||||||
|
public BandwidthSubscriptionContainer(Subscription subscription,
|
||||||
|
List<BandwidthSubscription> newSubscriptions) {
|
||||||
|
this.subscription = subscription;
|
||||||
|
this.newSubscriptions = newSubscriptions;
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||||
import com.raytheon.uf.common.serialization.SerializationException;
|
|
||||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
import com.raytheon.uf.common.status.UFStatus;
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
|
@ -32,6 +31,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
||||||
* Nov 09, 2012 1286 djohnson Rename interface to comply with standards.
|
* Nov 09, 2012 1286 djohnson Rename interface to comply with standards.
|
||||||
* Nov 20, 2012 1286 djohnson Change some logging to debug.
|
* Nov 20, 2012 1286 djohnson Change some logging to debug.
|
||||||
* Jun 13, 2013 2095 djohnson No need to query the database, we are only receiving new bandwidth subscriptions.
|
* Jun 13, 2013 2095 djohnson No need to query the database, we are only receiving new bandwidth subscriptions.
|
||||||
|
* Jul 11, 2013 2106 djohnson aggregate() signature changed.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -51,7 +51,7 @@ public class SimpleSubscriptionAggregator implements ISubscriptionAggregator {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SubscriptionRetrieval> aggregate(
|
public List<SubscriptionRetrieval> aggregate(
|
||||||
List<BandwidthSubscription> newSubscriptions) {
|
BandwidthSubscriptionContainer container) {
|
||||||
|
|
||||||
List<SubscriptionRetrieval> subscriptionRetrievals = new ArrayList<SubscriptionRetrieval>();
|
List<SubscriptionRetrieval> subscriptionRetrievals = new ArrayList<SubscriptionRetrieval>();
|
||||||
|
|
||||||
|
@ -59,13 +59,12 @@ public class SimpleSubscriptionAggregator implements ISubscriptionAggregator {
|
||||||
// necessary retrievals without regards to 'sharing' retrievals across
|
// necessary retrievals without regards to 'sharing' retrievals across
|
||||||
// subscriptions.
|
// subscriptions.
|
||||||
|
|
||||||
for (BandwidthSubscription subDao : newSubscriptions) {
|
for (BandwidthSubscription subDao : container.newSubscriptions) {
|
||||||
|
|
||||||
// First check to see if the Object already was scheduled
|
// First check to see if the Object already was scheduled
|
||||||
// (i.e. has SubscriptionRetrievals associated with it) if
|
// (i.e. has SubscriptionRetrievals associated with it) if
|
||||||
// not, create a SubscriptionRetrieval for the subscription
|
// not, create a SubscriptionRetrieval for the subscription
|
||||||
|
|
||||||
try {
|
|
||||||
SubscriptionRetrieval subscriptionRetrieval = new SubscriptionRetrieval();
|
SubscriptionRetrieval subscriptionRetrieval = new SubscriptionRetrieval();
|
||||||
// Link this SubscriptionRetrieval with the subscription.
|
// Link this SubscriptionRetrieval with the subscription.
|
||||||
subscriptionRetrieval.setBandwidthSubscription(subDao);
|
subscriptionRetrieval.setBandwidthSubscription(subDao);
|
||||||
|
@ -74,28 +73,18 @@ public class SimpleSubscriptionAggregator implements ISubscriptionAggregator {
|
||||||
.setAgentType(SubscriptionRetrievalAgent.SUBSCRIPTION_AGENT);
|
.setAgentType(SubscriptionRetrievalAgent.SUBSCRIPTION_AGENT);
|
||||||
subscriptionRetrieval.setStatus(RetrievalStatus.PROCESSING);
|
subscriptionRetrieval.setStatus(RetrievalStatus.PROCESSING);
|
||||||
subscriptionRetrieval.setPriority(subDao.getPriority());
|
subscriptionRetrieval.setPriority(subDao.getPriority());
|
||||||
subscriptionRetrieval.setEstimatedSize(subDao
|
subscriptionRetrieval.setEstimatedSize(subDao.getEstimatedSize());
|
||||||
.getEstimatedSize());
|
|
||||||
|
|
||||||
// Create a Retrieval Object for the Subscription
|
// Create a Retrieval Object for the Subscription
|
||||||
Subscription sub = subDao.getSubscription();
|
Subscription sub = container.subscription;
|
||||||
|
|
||||||
subscriptionRetrieval.setSubscriptionLatency(BandwidthUtil
|
subscriptionRetrieval.setSubscriptionLatency(BandwidthUtil
|
||||||
.getSubscriptionLatency(sub));
|
.getSubscriptionLatency(sub));
|
||||||
subscriptionRetrieval
|
subscriptionRetrieval.setDataSetAvailablityDelay(BandwidthUtil
|
||||||
.setDataSetAvailablityDelay(BandwidthUtil
|
|
||||||
.getDataSetAvailablityDelay(sub));
|
.getDataSetAvailablityDelay(sub));
|
||||||
|
|
||||||
subscriptionRetrieval.setSubscription(sub);
|
|
||||||
subscriptionRetrievals.add(subscriptionRetrieval);
|
subscriptionRetrievals.add(subscriptionRetrieval);
|
||||||
|
|
||||||
} catch (SerializationException e) {
|
|
||||||
statusHandler
|
|
||||||
.warn("Trapped SerializationException attempting to process subscription ["
|
|
||||||
+ subDao.getIdentifier()
|
|
||||||
+ "]: Subscription will not be scheduled.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (statusHandler.isPriorityEnabled(Priority.DEBUG)) {
|
if (statusHandler.isPriorityEnabled(Priority.DEBUG)) {
|
||||||
statusHandler
|
statusHandler
|
||||||
.debug("Created ["
|
.debug("Created ["
|
||||||
|
|
|
@ -4,6 +4,7 @@ import java.io.Serializable;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
|
||||||
import com.raytheon.uf.common.datadelivery.registry.Network;
|
import com.raytheon.uf.common.datadelivery.registry.Network;
|
||||||
|
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
|
||||||
import com.raytheon.uf.common.util.IDeepCopyable;
|
import com.raytheon.uf.common.util.IDeepCopyable;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthAllocation;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthAllocation;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
||||||
|
@ -20,6 +21,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
||||||
* Oct 02, 2012 726 jspinks Initial release.
|
* Oct 02, 2012 726 jspinks Initial release.
|
||||||
* Nov 09, 2012 1286 djohnson Add getters for bytes.
|
* Nov 09, 2012 1286 djohnson Add getters for bytes.
|
||||||
* Jun 24, 2013 2106 djohnson Add copy constructor.
|
* Jun 24, 2013 2106 djohnson Add copy constructor.
|
||||||
|
* Jul 11, 2013 2106 djohnson Use SubscriptionPriority enum.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -35,7 +37,7 @@ public class BandwidthReservation implements Serializable,
|
||||||
|
|
||||||
private Network network;
|
private Network network;
|
||||||
|
|
||||||
private double priority;
|
private SubscriptionPriority priority;
|
||||||
|
|
||||||
private long size;
|
private long size;
|
||||||
|
|
||||||
|
@ -125,14 +127,14 @@ public class BandwidthReservation implements Serializable,
|
||||||
* @param priority
|
* @param priority
|
||||||
* the priority to set
|
* the priority to set
|
||||||
*/
|
*/
|
||||||
public void setPriority(double priority) {
|
public void setPriority(SubscriptionPriority priority) {
|
||||||
this.priority = priority;
|
this.priority = priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the priority
|
* @return the priority
|
||||||
*/
|
*/
|
||||||
public double getPriority() {
|
public SubscriptionPriority getPriority() {
|
||||||
return priority;
|
return priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,7 @@ import com.raytheon.uf.edex.datadelivery.retrieval.db.RetrievalRequestRecord;
|
||||||
* Feb 05, 2013 1580 mpduff EventBus refactor.
|
* Feb 05, 2013 1580 mpduff EventBus refactor.
|
||||||
* Jun 24, 2013 2106 djohnson Set actual start time when sending to retrieval rather than overwrite scheduled start.
|
* Jun 24, 2013 2106 djohnson Set actual start time when sending to retrieval rather than overwrite scheduled start.
|
||||||
* Jul 09, 2013 2106 djohnson Dependency inject registry handlers.
|
* Jul 09, 2013 2106 djohnson Dependency inject registry handlers.
|
||||||
|
* Jul 11, 2013 2106 djohnson Use SubscriptionPriority enum.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -87,7 +88,8 @@ public class SubscriptionRetrievalAgent extends
|
||||||
throws EdexException {
|
throws EdexException {
|
||||||
Subscription sub;
|
Subscription sub;
|
||||||
try {
|
try {
|
||||||
sub = retrieval.getSubscription();
|
sub = bandwidthDao.getSubscriptionRetrievalAttributes(retrieval)
|
||||||
|
.getSubscription();
|
||||||
} catch (SerializationException e) {
|
} catch (SerializationException e) {
|
||||||
throw new EdexException("Unable to deserialize the subscription.",
|
throw new EdexException("Unable to deserialize the subscription.",
|
||||||
e);
|
e);
|
||||||
|
@ -102,7 +104,7 @@ public class SubscriptionRetrievalAgent extends
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bundle.setBundleId(sub.getSubscriptionId());
|
bundle.setBundleId(sub.getSubscriptionId());
|
||||||
bundle.setPriority((int) retrieval.getPriority());
|
bundle.setPriority(retrieval.getPriority());
|
||||||
bundle.setProvider(provider);
|
bundle.setProvider(provider);
|
||||||
bundle.setConnection(provider.getConnection());
|
bundle.setConnection(provider.getConnection());
|
||||||
bundle.setSubscription(sub);
|
bundle.setSubscription(sub);
|
||||||
|
@ -178,11 +180,8 @@ public class SubscriptionRetrievalAgent extends
|
||||||
String owner = bundle.getSubscription().getOwner();
|
String owner = bundle.getSubscription().getOwner();
|
||||||
String provider = bundle.getSubscription().getProvider();
|
String provider = bundle.getSubscription().getProvider();
|
||||||
|
|
||||||
int priority = defaultPriority;
|
int priority = (bundle.getPriority() != null) ? bundle
|
||||||
Integer bundlePriority = bundle.getPriority();
|
.getPriority().getPriorityValue() : defaultPriority;
|
||||||
if (bundlePriority != null) {
|
|
||||||
priority = bundlePriority.intValue();
|
|
||||||
}
|
|
||||||
Date insertTime = TimeUtil.newCalendar().getTime();
|
Date insertTime = TimeUtil.newCalendar().getTime();
|
||||||
|
|
||||||
List<RetrievalRequestRecord> requestRecords = new ArrayList<RetrievalRequestRecord>(
|
List<RetrievalRequestRecord> requestRecords = new ArrayList<RetrievalRequestRecord>(
|
||||||
|
|
|
@ -27,6 +27,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthSubscription;
|
||||||
* Feb 14, 2013 1595 djohnson Use subscription rescheduling strategy.
|
* Feb 14, 2013 1595 djohnson Use subscription rescheduling strategy.
|
||||||
* Jun 13, 2013 2095 djohnson Point subscriptions don't check for dataset updates on aggregation.
|
* Jun 13, 2013 2095 djohnson Point subscriptions don't check for dataset updates on aggregation.
|
||||||
* Jun 25, 2013 2106 djohnson CheapClone was cheap in ease, not performance.
|
* Jun 25, 2013 2106 djohnson CheapClone was cheap in ease, not performance.
|
||||||
|
* Jul 11, 2013 2106 djohnson Use SubscriptionPriority enum.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -204,8 +205,7 @@ public class BandwidthUtil {
|
||||||
* on error serializing the subscription
|
* on error serializing the subscription
|
||||||
*/
|
*/
|
||||||
public static BandwidthSubscription getSubscriptionDaoForSubscription(
|
public static BandwidthSubscription getSubscriptionDaoForSubscription(
|
||||||
Subscription subscription, Calendar baseReferenceTime)
|
Subscription subscription, Calendar baseReferenceTime) {
|
||||||
throws SerializationException {
|
|
||||||
BandwidthSubscription dao = new BandwidthSubscription();
|
BandwidthSubscription dao = new BandwidthSubscription();
|
||||||
|
|
||||||
dao.setDataSetName(subscription.getDataSetName());
|
dao.setDataSetName(subscription.getDataSetName());
|
||||||
|
@ -213,11 +213,10 @@ public class BandwidthUtil {
|
||||||
dao.setOwner(subscription.getOwner());
|
dao.setOwner(subscription.getOwner());
|
||||||
dao.setName(subscription.getName());
|
dao.setName(subscription.getName());
|
||||||
dao.setEstimatedSize(subscription.getDataSetSize());
|
dao.setEstimatedSize(subscription.getDataSetSize());
|
||||||
dao.setSubscription(subscription);
|
|
||||||
dao.setRoute(subscription.getRoute());
|
dao.setRoute(subscription.getRoute());
|
||||||
dao.setBaseReferenceTime(baseReferenceTime);
|
dao.setBaseReferenceTime(baseReferenceTime);
|
||||||
dao.setCycle(baseReferenceTime.get(Calendar.HOUR_OF_DAY));
|
dao.setCycle(baseReferenceTime.get(Calendar.HOUR_OF_DAY));
|
||||||
dao.setPriority(subscription.getPriority().getPriorityValue());
|
dao.setPriority(subscription.getPriority());
|
||||||
dao.setRegistryId(subscription.getId());
|
dao.setRegistryId(subscription.getId());
|
||||||
dao.setCheckForDataSetUpdate(subscription.getDataSetType() != DataType.POINT);
|
dao.setCheckForDataSetUpdate(subscription.getDataSetType() != DataType.POINT);
|
||||||
return dao;
|
return dao;
|
||||||
|
|
|
@ -71,6 +71,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthAllocation;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthBucket;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthBucket;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthSubscription;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthSubscription;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrieval;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrieval;
|
||||||
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrievalAttributes;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalPlan;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalPlan;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalPlanTest;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalPlanTest;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalStatus;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalStatus;
|
||||||
|
@ -100,6 +101,7 @@ import com.raytheon.uf.edex.datadelivery.retrieval.RetrievalManagerNotifyEvent;
|
||||||
* Jun 03, 2013 2095 djohnson Move getPointDataSet to superclass.
|
* Jun 03, 2013 2095 djohnson Move getPointDataSet to superclass.
|
||||||
* Jun 25, 2013 2106 djohnson Set subscription latency, access bucket allocations through RetrievalPlan.
|
* Jun 25, 2013 2106 djohnson Set subscription latency, access bucket allocations through RetrievalPlan.
|
||||||
* Jul 09, 2013 2106 djohnson InMemoryBandwidthManager no longer receives updates from the EventBus.
|
* Jul 09, 2013 2106 djohnson InMemoryBandwidthManager no longer receives updates from the EventBus.
|
||||||
|
* Jul 11, 2013 2106 djohnson Use SubscriptionPriority enum.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -251,10 +253,14 @@ public class BandwidthManagerIntTest extends AbstractWfoBandwidthManagerIntTest
|
||||||
subscription.getDataSetName(), cal);
|
subscription.getDataSetName(), cal);
|
||||||
assertEquals("Didn't find the subscription retrieval as expected!", 1,
|
assertEquals("Didn't find the subscription retrieval as expected!", 1,
|
||||||
bandwidthAllocations.size());
|
bandwidthAllocations.size());
|
||||||
|
|
||||||
|
SubscriptionRetrievalAttributes attributes = bandwidthDao
|
||||||
|
.getSubscriptionRetrievalAttributes(bandwidthAllocations
|
||||||
|
.iterator().next());
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"Didn't find the metadata date on the retrieval's subscription!",
|
"Didn't find the metadata date on the retrieval's subscription!",
|
||||||
metadata.getDate(), bandwidthAllocations.iterator().next()
|
metadata.getDate(), attributes.getSubscription().getTime()
|
||||||
.getSubscription().getTime().getStartDate());
|
.getStartDate());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -283,7 +289,11 @@ public class BandwidthManagerIntTest extends AbstractWfoBandwidthManagerIntTest
|
||||||
assertEquals("Incorrect number of subscription retrievals generated!",
|
assertEquals("Incorrect number of subscription retrievals generated!",
|
||||||
1, retrievals.size());
|
1, retrievals.size());
|
||||||
SubscriptionRetrieval retrieval = retrievals.iterator().next();
|
SubscriptionRetrieval retrieval = retrievals.iterator().next();
|
||||||
Subscription retrievalSub = retrieval.getSubscription();
|
|
||||||
|
Subscription retrievalSub = bandwidthDao
|
||||||
|
.getSubscriptionRetrievalAttributes(retrieval)
|
||||||
|
.getSubscription();
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"The update's url doesn't seem to have been persisted to the retrieval!",
|
"The update's url doesn't seem to have been persisted to the retrieval!",
|
||||||
update.getUrl(), retrievalSub.getUrl());
|
update.getUrl(), retrievalSub.getUrl());
|
||||||
|
@ -431,14 +441,12 @@ public class BandwidthManagerIntTest extends AbstractWfoBandwidthManagerIntTest
|
||||||
BandwidthAllocation unscheduledAllocation = iter.next();
|
BandwidthAllocation unscheduledAllocation = iter.next();
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"The first subscription with lower priority should have been the one unscheduled.",
|
"The first subscription with lower priority should have been the one unscheduled.",
|
||||||
subscription.getPriority().getPriorityValue(),
|
subscription.getPriority(), unscheduledAllocation.getPriority());
|
||||||
unscheduledAllocation.getPriority(), 0.0);
|
|
||||||
|
|
||||||
unscheduledAllocation = iter.next();
|
unscheduledAllocation = iter.next();
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"The first subscription with lower priority should have been the one unscheduled.",
|
"The first subscription with lower priority should have been the one unscheduled.",
|
||||||
subscription.getPriority().getPriorityValue(),
|
subscription.getPriority(), unscheduledAllocation.getPriority());
|
||||||
unscheduledAllocation.getPriority(), 0.0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -49,6 +49,9 @@ import com.raytheon.uf.common.datadelivery.registry.AdhocSubscriptionFixture;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.Network;
|
import com.raytheon.uf.common.datadelivery.registry.Network;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
|
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
|
||||||
|
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
|
||||||
|
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler;
|
||||||
|
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
||||||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
import com.raytheon.uf.common.serialization.SerializationUtil;
|
||||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthAllocation;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthAllocation;
|
||||||
|
@ -75,6 +78,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
||||||
* May 20, 2013 1650 djohnson Add test for returning required dataset size.
|
* May 20, 2013 1650 djohnson Add test for returning required dataset size.
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -107,17 +111,23 @@ public class BandwidthServiceIntTest extends AbstractWfoBandwidthManagerIntTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testProposeNetworkBandwidthReturnsSubscriptionsUnableToFit() {
|
public void testProposeNetworkBandwidthReturnsSubscriptionsUnableToFit()
|
||||||
|
throws RegistryHandlerException {
|
||||||
|
|
||||||
// Two subscriptions that will fill up a bucket exactly
|
// Two subscriptions that will fill up a bucket exactly
|
||||||
Subscription subscription = createSubscriptionThatFillsHalfABucket();
|
Subscription subscription = createSubscriptionThatFillsHalfABucket();
|
||||||
Subscription subscription2 = createSubscriptionThatFillsHalfABucket();
|
Subscription subscription2 = createSubscriptionThatFillsHalfABucket();
|
||||||
|
|
||||||
|
final ISubscriptionHandler subscriptionHandler = DataDeliveryHandlers
|
||||||
|
.getSubscriptionHandler();
|
||||||
|
subscriptionHandler.store(subscription);
|
||||||
|
subscriptionHandler.store(subscription2);
|
||||||
|
|
||||||
bandwidthManager.schedule(subscription);
|
bandwidthManager.schedule(subscription);
|
||||||
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<Subscription> results = service
|
Set<String> results = service
|
||||||
.proposeBandwidthForNetworkInKilobytes(Network.OPSNET,
|
.proposeBandwidthForNetworkInKilobytes(Network.OPSNET,
|
||||||
retrievalManager.getPlan(Network.OPSNET)
|
retrievalManager.getPlan(Network.OPSNET)
|
||||||
.getDefaultBandwidth() - 1);
|
.getDefaultBandwidth() - 1);
|
||||||
|
@ -128,17 +138,23 @@ public class BandwidthServiceIntTest extends AbstractWfoBandwidthManagerIntTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testProposeNetworkBandwidthReturnsNoSubscriptionsWhenAbleToFit() {
|
public void testProposeNetworkBandwidthReturnsNoSubscriptionsWhenAbleToFit()
|
||||||
|
throws RegistryHandlerException {
|
||||||
|
|
||||||
// Two subscriptions that will fill up only a third of a bucket
|
// Two subscriptions that will fill up only a third of a bucket
|
||||||
Subscription subscription = createSubscriptionThatFillsAThirdOfABucket();
|
Subscription subscription = createSubscriptionThatFillsAThirdOfABucket();
|
||||||
Subscription subscription2 = createSubscriptionThatFillsAThirdOfABucket();
|
Subscription subscription2 = createSubscriptionThatFillsAThirdOfABucket();
|
||||||
|
|
||||||
|
ISubscriptionHandler subscriptionHandler = DataDeliveryHandlers
|
||||||
|
.getSubscriptionHandler();
|
||||||
|
subscriptionHandler.store(subscription);
|
||||||
|
subscriptionHandler.store(subscription2);
|
||||||
|
|
||||||
bandwidthManager.schedule(subscription);
|
bandwidthManager.schedule(subscription);
|
||||||
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<Subscription> results = service
|
Set<String> results = service
|
||||||
.proposeBandwidthForNetworkInKilobytes(Network.OPSNET,
|
.proposeBandwidthForNetworkInKilobytes(Network.OPSNET,
|
||||||
retrievalManager.getPlan(Network.OPSNET)
|
retrievalManager.getPlan(Network.OPSNET)
|
||||||
.getDefaultBandwidth() - 1);
|
.getDefaultBandwidth() - 1);
|
||||||
|
@ -683,7 +699,7 @@ public class BandwidthServiceIntTest extends AbstractWfoBandwidthManagerIntTest
|
||||||
allocation.setStartTime(cal);
|
allocation.setStartTime(cal);
|
||||||
allocation.setEndTime(cal);
|
allocation.setEndTime(cal);
|
||||||
allocation.setNetwork(subscription.getRoute());
|
allocation.setNetwork(subscription.getRoute());
|
||||||
allocation.setPriority(2);
|
allocation.setPriority(SubscriptionPriority.NORMAL);
|
||||||
allocation.setAgentType("someAgent");
|
allocation.setAgentType("someAgent");
|
||||||
allocation.setEstimatedSize(subscription.getDataSetSize() / 2);
|
allocation.setEstimatedSize(subscription.getDataSetSize() / 2);
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ import org.hibernate.HibernateException;
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
public class H2Dialect extends org.hibernate.dialect.H2Dialect {
|
public class H2Dialect extends org.hibernate.dialect.H2Dialect {
|
||||||
private static final int LARGE_DEFAULT_LENGTH = 3000;
|
private static final int LARGE_DEFAULT_LENGTH = 10000;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTypeName(int code, int length, int precision, int scale)
|
public String getTypeName(int code, int length, int precision, int scale)
|
||||||
|
|
|
@ -55,6 +55,8 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthDataSetUpdate;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthSubscription;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthSubscription;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.IBandwidthDao;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.IBandwidthDao;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrieval;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrieval;
|
||||||
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrievalAttributes;
|
||||||
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrievalAttributesFixture;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrievalFixture;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrievalFixture;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalStatus;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalStatus;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
||||||
|
@ -375,19 +377,26 @@ public abstract class AbstractBandwidthDaoTest<T extends IBandwidthDao> {
|
||||||
@Test
|
@Test
|
||||||
public void testGetSubscriptionRetrievalsByProviderAndDataSet()
|
public void testGetSubscriptionRetrievalsByProviderAndDataSet()
|
||||||
throws SerializationException {
|
throws SerializationException {
|
||||||
|
|
||||||
// These two have the same dataset name and provider
|
// These two have the same dataset name and provider
|
||||||
SubscriptionRetrieval entity1 = SubscriptionRetrievalFixture.INSTANCE
|
SubscriptionRetrievalAttributes entity1 = SubscriptionRetrievalAttributesFixture.INSTANCE
|
||||||
.get(1);
|
.get(1);
|
||||||
SubscriptionRetrieval entity2 = SubscriptionRetrievalFixture.INSTANCE
|
SubscriptionRetrievalAttributes entity2 = SubscriptionRetrievalAttributesFixture.INSTANCE
|
||||||
.get(1);
|
.get(1);
|
||||||
// This one does not
|
// This one does not
|
||||||
SubscriptionRetrieval entity3 = SubscriptionRetrievalFixture.INSTANCE
|
SubscriptionRetrievalAttributes entity3 = SubscriptionRetrievalAttributesFixture.INSTANCE
|
||||||
.get(2);
|
.get(2);
|
||||||
|
|
||||||
dao.store(entity1.getBandwidthSubscription());
|
dao.storeBandwidthSubscriptions(Arrays.asList(entity1
|
||||||
dao.store(entity2.getBandwidthSubscription());
|
.getSubscriptionRetrieval().getBandwidthSubscription(), entity2
|
||||||
dao.store(entity3.getBandwidthSubscription());
|
.getSubscriptionRetrieval().getBandwidthSubscription(), entity3
|
||||||
dao.store(Arrays.asList(entity1, entity2, entity3));
|
.getSubscriptionRetrieval().getBandwidthSubscription()));
|
||||||
|
dao.store(Arrays.<SubscriptionRetrieval> asList(
|
||||||
|
entity1.getSubscriptionRetrieval(),
|
||||||
|
entity2.getSubscriptionRetrieval(),
|
||||||
|
entity3.getSubscriptionRetrieval()));
|
||||||
|
dao.storeSubscriptionRetrievalAttributes(Arrays.asList(entity1,
|
||||||
|
entity2, entity3));
|
||||||
|
|
||||||
final Subscription subscription = entity1.getSubscription();
|
final Subscription subscription = entity1.getSubscription();
|
||||||
final String expectedProvider = subscription.getProvider();
|
final String expectedProvider = subscription.getProvider();
|
||||||
|
@ -401,10 +410,11 @@ public abstract class AbstractBandwidthDaoTest<T extends IBandwidthDao> {
|
||||||
|
|
||||||
for (SubscriptionRetrieval retrieval : results) {
|
for (SubscriptionRetrieval retrieval : results) {
|
||||||
assertEquals("Incorrect provider found.",
|
assertEquals("Incorrect provider found.",
|
||||||
subscription.getProvider(), retrieval.getSubscription()
|
subscription.getProvider(), retrieval
|
||||||
.getProvider());
|
.getBandwidthSubscription().getProvider());
|
||||||
assertEquals("Incorrect data set found.",
|
assertEquals("Incorrect data set found.",
|
||||||
subscription.getDataSetName(), retrieval.getSubscription()
|
subscription.getDataSetName(), retrieval
|
||||||
|
.getBandwidthSubscription()
|
||||||
.getDataSetName());
|
.getDataSetName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -413,20 +423,22 @@ public abstract class AbstractBandwidthDaoTest<T extends IBandwidthDao> {
|
||||||
public void testGetSubscriptionRetrievalsByProviderDataSetAndBaseReferenceTime()
|
public void testGetSubscriptionRetrievalsByProviderDataSetAndBaseReferenceTime()
|
||||||
throws SerializationException {
|
throws SerializationException {
|
||||||
// These two have the same dataset name and provider
|
// These two have the same dataset name and provider
|
||||||
SubscriptionRetrieval entity1 = SubscriptionRetrievalFixture.INSTANCE
|
SubscriptionRetrievalAttributes entity1 = SubscriptionRetrievalAttributesFixture.INSTANCE
|
||||||
.get(1);
|
.get(1);
|
||||||
SubscriptionRetrieval entity2 = SubscriptionRetrievalFixture.INSTANCE
|
SubscriptionRetrievalAttributes entity2 = SubscriptionRetrievalAttributesFixture.INSTANCE
|
||||||
.get(1);
|
.get(1);
|
||||||
// This one does not
|
// This one does not
|
||||||
SubscriptionRetrieval entity3 = SubscriptionRetrievalFixture.INSTANCE
|
SubscriptionRetrievalAttributes entity3 = SubscriptionRetrievalAttributesFixture.INSTANCE
|
||||||
.get(2);
|
.get(2);
|
||||||
|
|
||||||
// Still have to persist the actual subscription daos
|
|
||||||
final BandwidthSubscription subDao1 = entity1
|
final BandwidthSubscription subDao1 = entity1
|
||||||
|
.getSubscriptionRetrieval()
|
||||||
.getBandwidthSubscription();
|
.getBandwidthSubscription();
|
||||||
final BandwidthSubscription subDao2 = entity2
|
final BandwidthSubscription subDao2 = entity2
|
||||||
|
.getSubscriptionRetrieval()
|
||||||
.getBandwidthSubscription();
|
.getBandwidthSubscription();
|
||||||
final BandwidthSubscription subDao3 = entity3
|
final BandwidthSubscription subDao3 = entity3
|
||||||
|
.getSubscriptionRetrieval()
|
||||||
.getBandwidthSubscription();
|
.getBandwidthSubscription();
|
||||||
|
|
||||||
// Give each a unique time
|
// Give each a unique time
|
||||||
|
@ -439,16 +451,14 @@ public abstract class AbstractBandwidthDaoTest<T extends IBandwidthDao> {
|
||||||
three.add(Calendar.HOUR, 1);
|
three.add(Calendar.HOUR, 1);
|
||||||
subDao3.setBaseReferenceTime(three);
|
subDao3.setBaseReferenceTime(three);
|
||||||
|
|
||||||
// This persists the subscription dao objects and sets them on the
|
dao.storeBandwidthSubscriptions(Arrays
|
||||||
// retrievals
|
.asList(subDao1, subDao2, subDao3));
|
||||||
entity1.setBandwidthSubscription(dao.newBandwidthSubscription(
|
dao.store(Arrays.<SubscriptionRetrieval> asList(
|
||||||
subDao1.getSubscription(), subDao1.getBaseReferenceTime()));
|
entity1.getSubscriptionRetrieval(),
|
||||||
entity2.setBandwidthSubscription(dao.newBandwidthSubscription(
|
entity2.getSubscriptionRetrieval(),
|
||||||
subDao2.getSubscription(), subDao2.getBaseReferenceTime()));
|
entity3.getSubscriptionRetrieval()));
|
||||||
entity3.setBandwidthSubscription(dao.newBandwidthSubscription(
|
dao.storeSubscriptionRetrievalAttributes(Arrays.asList(entity1,
|
||||||
subDao3.getSubscription(), subDao3.getBaseReferenceTime()));
|
entity2, entity3));
|
||||||
|
|
||||||
dao.store(Arrays.asList(entity1, entity2, entity3));
|
|
||||||
|
|
||||||
final Subscription subscription = entity1.getSubscription();
|
final Subscription subscription = entity1.getSubscription();
|
||||||
final String expectedProvider = subscription.getProvider();
|
final String expectedProvider = subscription.getProvider();
|
||||||
|
@ -461,7 +471,8 @@ public abstract class AbstractBandwidthDaoTest<T extends IBandwidthDao> {
|
||||||
1, results.size());
|
1, results.size());
|
||||||
|
|
||||||
SubscriptionRetrieval result = results.iterator().next();
|
SubscriptionRetrieval result = results.iterator().next();
|
||||||
final Subscription resultSubscription = result.getSubscription();
|
final BandwidthSubscription resultSubscription = result
|
||||||
|
.getBandwidthSubscription();
|
||||||
assertEquals("Incorrect provider found.", subscription.getProvider(),
|
assertEquals("Incorrect provider found.", subscription.getProvider(),
|
||||||
resultSubscription.getProvider());
|
resultSubscription.getProvider());
|
||||||
assertEquals("Incorrect data set found.",
|
assertEquals("Incorrect data set found.",
|
||||||
|
@ -520,41 +531,36 @@ public abstract class AbstractBandwidthDaoTest<T extends IBandwidthDao> {
|
||||||
public void testQuerySubscriptionRetrievalsBySubscriptionId()
|
public void testQuerySubscriptionRetrievalsBySubscriptionId()
|
||||||
throws SerializationException {
|
throws SerializationException {
|
||||||
// These two have the same dataset name and provider
|
// These two have the same dataset name and provider
|
||||||
SubscriptionRetrieval entity1 = SubscriptionRetrievalFixture.INSTANCE
|
SubscriptionRetrievalAttributes entity1 = SubscriptionRetrievalAttributesFixture.INSTANCE
|
||||||
.get(1);
|
.get(1);
|
||||||
SubscriptionRetrieval entity2 = SubscriptionRetrievalFixture.INSTANCE
|
SubscriptionRetrievalAttributes entity2 = SubscriptionRetrievalAttributesFixture.INSTANCE
|
||||||
.get(1);
|
.get(1);
|
||||||
// This one does not
|
// This one does not
|
||||||
SubscriptionRetrieval entity3 = SubscriptionRetrievalFixture.INSTANCE
|
SubscriptionRetrievalAttributes entity3 = SubscriptionRetrievalAttributesFixture.INSTANCE
|
||||||
.get(2);
|
.get(2);
|
||||||
|
|
||||||
// Still have to persist the actual subscription daos
|
dao.storeBandwidthSubscriptions(Arrays.asList(entity1
|
||||||
final BandwidthSubscription subDao1 = entity1
|
.getSubscriptionRetrieval().getBandwidthSubscription(), entity2
|
||||||
.getBandwidthSubscription();
|
.getSubscriptionRetrieval().getBandwidthSubscription(), entity3
|
||||||
final BandwidthSubscription subDao2 = entity2
|
.getSubscriptionRetrieval().getBandwidthSubscription()));
|
||||||
.getBandwidthSubscription();
|
dao.store(Arrays.<SubscriptionRetrieval> asList(
|
||||||
final BandwidthSubscription subDao3 = entity3
|
entity1.getSubscriptionRetrieval(),
|
||||||
.getBandwidthSubscription();
|
entity2.getSubscriptionRetrieval(),
|
||||||
|
entity3.getSubscriptionRetrieval()));
|
||||||
|
dao.storeSubscriptionRetrievalAttributes(Arrays.asList(entity1,
|
||||||
|
entity2, entity3));
|
||||||
|
|
||||||
// This persists the subscription dao objects and sets them on the
|
|
||||||
// retrievals
|
|
||||||
entity1.setBandwidthSubscription(dao.newBandwidthSubscription(
|
|
||||||
subDao1.getSubscription(), subDao1.getBaseReferenceTime()));
|
|
||||||
entity2.setBandwidthSubscription(dao.newBandwidthSubscription(
|
|
||||||
subDao2.getSubscription(), subDao2.getBaseReferenceTime()));
|
|
||||||
entity3.setBandwidthSubscription(dao.newBandwidthSubscription(
|
|
||||||
subDao3.getSubscription(), subDao3.getBaseReferenceTime()));
|
|
||||||
|
|
||||||
dao.store(Arrays.asList(entity1, entity2, entity3));
|
|
||||||
final List<SubscriptionRetrieval> results = dao
|
final List<SubscriptionRetrieval> results = dao
|
||||||
.querySubscriptionRetrievals(entity2.getBandwidthSubscription()
|
.querySubscriptionRetrievals(entity2.getSubscriptionRetrieval()
|
||||||
|
.getBandwidthSubscription()
|
||||||
.getId());
|
.getId());
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"Should have returned one entity for the subscriptionDao id!",
|
"Should have returned one entity for the subscriptionDao id!",
|
||||||
1, results.size());
|
1, results.size());
|
||||||
|
|
||||||
SubscriptionRetrieval result = results.iterator().next();
|
SubscriptionRetrieval result = results.iterator().next();
|
||||||
assertEquals("Incorrect id found.", entity2.getId(), result.getId());
|
assertEquals("Incorrect id found.", entity2.getSubscriptionRetrieval()
|
||||||
|
.getId(), result.getId());
|
||||||
assertNotSame(entity2, result);
|
assertNotSame(entity2, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -562,40 +568,44 @@ public abstract class AbstractBandwidthDaoTest<T extends IBandwidthDao> {
|
||||||
public void testQuerySubscriptionRetrievalsBySubscription()
|
public void testQuerySubscriptionRetrievalsBySubscription()
|
||||||
throws SerializationException {
|
throws SerializationException {
|
||||||
// These two have the same dataset name and provider
|
// These two have the same dataset name and provider
|
||||||
SubscriptionRetrieval entity1 = SubscriptionRetrievalFixture.INSTANCE
|
SubscriptionRetrievalAttributes entity1 = SubscriptionRetrievalAttributesFixture.INSTANCE
|
||||||
.get(1);
|
.get(1);
|
||||||
SubscriptionRetrieval entity2 = SubscriptionRetrievalFixture.INSTANCE
|
SubscriptionRetrievalAttributes entity2 = SubscriptionRetrievalAttributesFixture.INSTANCE
|
||||||
.get(1);
|
.get(1);
|
||||||
// This one does not
|
// This one does not
|
||||||
SubscriptionRetrieval entity3 = SubscriptionRetrievalFixture.INSTANCE
|
SubscriptionRetrievalAttributes entity3 = SubscriptionRetrievalAttributesFixture.INSTANCE
|
||||||
.get(2);
|
.get(2);
|
||||||
|
|
||||||
// Still have to persist the actual subscription daos
|
// Still have to persist the actual subscription daos
|
||||||
final BandwidthSubscription subDao1 = entity1
|
final BandwidthSubscription subDao1 = entity1
|
||||||
|
.getSubscriptionRetrieval()
|
||||||
.getBandwidthSubscription();
|
.getBandwidthSubscription();
|
||||||
final BandwidthSubscription subDao2 = entity2
|
final BandwidthSubscription subDao2 = entity2
|
||||||
|
.getSubscriptionRetrieval()
|
||||||
.getBandwidthSubscription();
|
.getBandwidthSubscription();
|
||||||
final BandwidthSubscription subDao3 = entity3
|
final BandwidthSubscription subDao3 = entity3
|
||||||
|
.getSubscriptionRetrieval()
|
||||||
.getBandwidthSubscription();
|
.getBandwidthSubscription();
|
||||||
|
|
||||||
// This persists the subscription dao objects and sets them on the
|
|
||||||
// retrievals
|
|
||||||
entity1.setBandwidthSubscription(dao.newBandwidthSubscription(
|
|
||||||
subDao1.getSubscription(), subDao1.getBaseReferenceTime()));
|
|
||||||
entity2.setBandwidthSubscription(dao.newBandwidthSubscription(
|
|
||||||
subDao2.getSubscription(), subDao2.getBaseReferenceTime()));
|
|
||||||
entity3.setBandwidthSubscription(dao.newBandwidthSubscription(
|
|
||||||
subDao3.getSubscription(), subDao3.getBaseReferenceTime()));
|
|
||||||
|
|
||||||
dao.store(Arrays.asList(entity1, entity2, entity3));
|
dao.storeBandwidthSubscriptions(Arrays
|
||||||
|
.asList(subDao1, subDao2, subDao3));
|
||||||
|
dao.store(Arrays.<SubscriptionRetrieval> asList(
|
||||||
|
entity1.getSubscriptionRetrieval(),
|
||||||
|
entity2.getSubscriptionRetrieval(),
|
||||||
|
entity3.getSubscriptionRetrieval()));
|
||||||
|
dao.storeSubscriptionRetrievalAttributes(Arrays.asList(entity1,
|
||||||
|
entity2, entity3));
|
||||||
final List<SubscriptionRetrieval> results = dao
|
final List<SubscriptionRetrieval> results = dao
|
||||||
.querySubscriptionRetrievals(entity2.getBandwidthSubscription());
|
.querySubscriptionRetrievals(entity2.getSubscriptionRetrieval()
|
||||||
|
.getBandwidthSubscription());
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"Should have returned one entity for the subscriptionDao!", 1,
|
"Should have returned one entity for the subscriptionDao!", 1,
|
||||||
results.size());
|
results.size());
|
||||||
|
|
||||||
SubscriptionRetrieval result = results.iterator().next();
|
SubscriptionRetrieval result = results.iterator().next();
|
||||||
assertEquals("Incorrect id found.", entity2.getId(), result.getId());
|
assertEquals("Incorrect id found.", entity2.getSubscriptionRetrieval()
|
||||||
|
.getId(), result.getId());
|
||||||
assertNotSame(entity2, result);
|
assertNotSame(entity2, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -783,9 +793,10 @@ public abstract class AbstractBandwidthDaoTest<T extends IBandwidthDao> {
|
||||||
final Date startTime = iter.next().getStartTime().getTime();
|
final Date startTime = iter.next().getStartTime().getTime();
|
||||||
final Date endTime = iter.next().getEndTime().getTime();
|
final Date endTime = iter.next().getEndTime().getTime();
|
||||||
|
|
||||||
final SortedSet<SubscriptionRetrieval> actualReceived = dao.getSubscriptionRetrievals(bandwidthSubscription.getProvider(),
|
final SortedSet<SubscriptionRetrieval> actualReceived = dao
|
||||||
bandwidthSubscription.getDataSetName(), RetrievalStatus.READY,
|
.getSubscriptionRetrievals(bandwidthSubscription.getProvider(),
|
||||||
startTime, endTime);
|
bandwidthSubscription.getDataSetName(),
|
||||||
|
RetrievalStatus.READY, startTime, endTime);
|
||||||
|
|
||||||
// Verify the correct number of retrievals were returned
|
// Verify the correct number of retrievals were returned
|
||||||
assertThat(actualReceived, hasSize(expectToGet.size()));
|
assertThat(actualReceived, hasSize(expectToGet.size()));
|
||||||
|
|
|
@ -22,13 +22,14 @@ package com.raytheon.uf.edex.datadelivery.bandwidth.dao;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import com.raytheon.uf.common.datadelivery.registry.Network;
|
import com.raytheon.uf.common.datadelivery.registry.Network;
|
||||||
|
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
|
||||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||||
import com.raytheon.uf.common.util.AbstractFixture;
|
import com.raytheon.uf.common.util.AbstractFixture;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalStatus;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalStatus;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Add Description
|
* Creates {@link BandwidthAllocation} instances.
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
|
@ -37,6 +38,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Nov 13, 2012 djohnson Initial creation
|
* Nov 13, 2012 djohnson Initial creation
|
||||||
|
* Jul 11, 2013 2106 djohnson Use SubscriptionPriority enum.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -57,7 +59,7 @@ public abstract class BaseBandwidthAllocationFixture<T extends BandwidthAllocati
|
||||||
entity.setActualEnd(BandwidthUtil.now());
|
entity.setActualEnd(BandwidthUtil.now());
|
||||||
entity.setBandwidthBucket(TimeUtil.currentTimeMillis());
|
entity.setBandwidthBucket(TimeUtil.currentTimeMillis());
|
||||||
entity.setNetwork(Network.OPSNET);
|
entity.setNetwork(Network.OPSNET);
|
||||||
entity.setPriority(1.0);
|
entity.setPriority(SubscriptionPriority.HIGH);
|
||||||
entity.setStatus(RetrievalStatus.DEFERRED);
|
entity.setStatus(RetrievalStatus.DEFERRED);
|
||||||
entity.setStartTime(BandwidthUtil.now());
|
entity.setStartTime(BandwidthUtil.now());
|
||||||
entity.setEndTime(BandwidthUtil.now());
|
entity.setEndTime(BandwidthUtil.now());
|
||||||
|
|
|
@ -21,9 +21,8 @@ package com.raytheon.uf.edex.datadelivery.bandwidth.dao;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
|
||||||
import com.raytheon.uf.common.datadelivery.registry.SiteSubscriptionFixture;
|
import com.raytheon.uf.common.datadelivery.registry.SiteSubscriptionFixture;
|
||||||
import com.raytheon.uf.common.serialization.SerializationException;
|
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||||
import com.raytheon.uf.common.util.AbstractFixture;
|
import com.raytheon.uf.common.util.AbstractFixture;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
||||||
|
|
||||||
|
@ -44,7 +43,8 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class SubscriptionDaoFixture extends AbstractFixture<BandwidthSubscription> {
|
public class SubscriptionDaoFixture extends
|
||||||
|
AbstractFixture<BandwidthSubscription> {
|
||||||
|
|
||||||
public static final SubscriptionDaoFixture INSTANCE = new SubscriptionDaoFixture();
|
public static final SubscriptionDaoFixture INSTANCE = new SubscriptionDaoFixture();
|
||||||
|
|
||||||
|
@ -61,12 +61,8 @@ public class SubscriptionDaoFixture extends AbstractFixture<BandwidthSubscriptio
|
||||||
@Override
|
@Override
|
||||||
public BandwidthSubscription getInstance(long seedValue, Random random) {
|
public BandwidthSubscription getInstance(long seedValue, Random random) {
|
||||||
Subscription sub = SiteSubscriptionFixture.INSTANCE.get(seedValue);
|
Subscription sub = SiteSubscriptionFixture.INSTANCE.get(seedValue);
|
||||||
try {
|
|
||||||
return BandwidthUtil.getSubscriptionDaoForSubscription(sub,
|
return BandwidthUtil.getSubscriptionDaoForSubscription(sub,
|
||||||
BandwidthUtil.now());
|
BandwidthUtil.now());
|
||||||
} catch (SerializationException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,78 @@
|
||||||
|
/**
|
||||||
|
* This software was developed and / or modified by Raytheon Company,
|
||||||
|
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||||
|
*
|
||||||
|
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||||
|
* This software product contains export-restricted data whose
|
||||||
|
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||||
|
* to non-U.S. persons whether in the United States or abroad requires
|
||||||
|
* an export license or other authorization.
|
||||||
|
*
|
||||||
|
* Contractor Name: Raytheon Company
|
||||||
|
* Contractor Address: 6825 Pine Street, Suite 340
|
||||||
|
* Mail Stop B8
|
||||||
|
* Omaha, NE 68106
|
||||||
|
* 402.291.0100
|
||||||
|
*
|
||||||
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
|
* further licensing information.
|
||||||
|
**/
|
||||||
|
package com.raytheon.uf.edex.datadelivery.bandwidth.dao;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.datadelivery.registry.SiteSubscriptionFixture;
|
||||||
|
import com.raytheon.uf.common.serialization.SerializationException;
|
||||||
|
import com.raytheon.uf.common.util.AbstractFixture;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fixture for {@link SubscriptionRetrievalAttributes}.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Jul 11, 2013 2106 djohnson Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author djohnson
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class SubscriptionRetrievalAttributesFixture extends
|
||||||
|
AbstractFixture<SubscriptionRetrievalAttributes> {
|
||||||
|
|
||||||
|
public static final SubscriptionRetrievalAttributesFixture INSTANCE = new SubscriptionRetrievalAttributesFixture();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Private.
|
||||||
|
*/
|
||||||
|
private SubscriptionRetrievalAttributesFixture() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SubscriptionRetrievalAttributes getInstance(long seedValue,
|
||||||
|
Random random) {
|
||||||
|
SubscriptionRetrieval retrieval = SubscriptionRetrievalFixture.INSTANCE
|
||||||
|
.get(seedValue);
|
||||||
|
|
||||||
|
SubscriptionRetrievalAttributes entity = new SubscriptionRetrievalAttributes();
|
||||||
|
entity.setSubscriptionRetrieval(retrieval);
|
||||||
|
try {
|
||||||
|
entity.setSubscription(SiteSubscriptionFixture.INSTANCE
|
||||||
|
.get(seedValue));
|
||||||
|
} catch (SerializationException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -21,7 +21,6 @@ package com.raytheon.uf.edex.datadelivery.bandwidth.dao;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import com.raytheon.uf.common.serialization.SerializationException;
|
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.SubscriptionRetrievalAgent;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.SubscriptionRetrievalAgent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -65,12 +64,7 @@ public class SubscriptionRetrievalFixture extends
|
||||||
entity.setBandwidthSubscription(SubscriptionDaoFixture.INSTANCE
|
entity.setBandwidthSubscription(SubscriptionDaoFixture.INSTANCE
|
||||||
.get(seedValue));
|
.get(seedValue));
|
||||||
entity.setSubscriptionLatency(0);
|
entity.setSubscriptionLatency(0);
|
||||||
try {
|
|
||||||
entity.setSubscription(entity.getBandwidthSubscription()
|
|
||||||
.getSubscription());
|
|
||||||
} catch (SerializationException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,7 @@ import com.raytheon.uf.edex.core.EdexException;
|
||||||
import com.raytheon.uf.edex.database.DataAccessLayerException;
|
import com.raytheon.uf.edex.database.DataAccessLayerException;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.IBandwidthDao;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.IBandwidthDao;
|
||||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrieval;
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrieval;
|
||||||
|
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrievalAttributes;
|
||||||
import com.raytheon.uf.edex.datadelivery.retrieval.db.IRetrievalDao;
|
import com.raytheon.uf.edex.datadelivery.retrieval.db.IRetrievalDao;
|
||||||
import com.raytheon.uf.edex.datadelivery.retrieval.db.RetrievalRequestRecord;
|
import com.raytheon.uf.edex.datadelivery.retrieval.db.RetrievalRequestRecord;
|
||||||
import com.raytheon.uf.edex.datadelivery.retrieval.db.RetrievalRequestRecord.State;
|
import com.raytheon.uf.edex.datadelivery.retrieval.db.RetrievalRequestRecord.State;
|
||||||
|
@ -113,10 +114,17 @@ public class SubscriptionRetrievalAgentTest {
|
||||||
Subscription subscription = new SubscriptionBuilder().withRoute(route)
|
Subscription subscription = new SubscriptionBuilder().withRoute(route)
|
||||||
.build();
|
.build();
|
||||||
final SubscriptionRetrieval subscriptionRetrieval = new SubscriptionRetrieval();
|
final SubscriptionRetrieval subscriptionRetrieval = new SubscriptionRetrieval();
|
||||||
subscriptionRetrieval.setSubscription(subscription);
|
|
||||||
subscriptionRetrieval.setNetwork(subscription.getRoute());
|
subscriptionRetrieval.setNetwork(subscription.getRoute());
|
||||||
|
|
||||||
|
SubscriptionRetrievalAttributes attributes = new SubscriptionRetrievalAttributes();
|
||||||
|
attributes.setSubscriptionRetrieval(subscriptionRetrieval);
|
||||||
|
attributes.setSubscription(subscription);
|
||||||
|
|
||||||
IBandwidthDao bandwidthDao = mock(IBandwidthDao.class);
|
IBandwidthDao bandwidthDao = mock(IBandwidthDao.class);
|
||||||
|
when(
|
||||||
|
bandwidthDao
|
||||||
|
.getSubscriptionRetrievalAttributes(subscriptionRetrieval))
|
||||||
|
.thenReturn(attributes);
|
||||||
|
|
||||||
SubscriptionRetrievalAgent agent = new SubscriptionRetrievalAgent(
|
SubscriptionRetrievalAgent agent = new SubscriptionRetrievalAgent(
|
||||||
route, "someUri", new Object(), 1, null, bandwidthDao,
|
route, "someUri", new Object(), 1, null, bandwidthDao,
|
||||||
|
|
|
@ -24,9 +24,10 @@ import java.util.Random;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.GriddedCoverageFixture;
|
import com.raytheon.uf.common.datadelivery.registry.GriddedCoverageFixture;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.Provider;
|
import com.raytheon.uf.common.datadelivery.registry.Provider;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.ProviderFixture;
|
import com.raytheon.uf.common.datadelivery.registry.ProviderFixture;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
|
||||||
import com.raytheon.uf.common.datadelivery.registry.SubscriptionBundle;
|
|
||||||
import com.raytheon.uf.common.datadelivery.registry.SiteSubscriptionFixture;
|
import com.raytheon.uf.common.datadelivery.registry.SiteSubscriptionFixture;
|
||||||
|
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||||
|
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
|
||||||
|
import com.raytheon.uf.common.datadelivery.registry.SubscriptionBundle;
|
||||||
import com.raytheon.uf.common.datadelivery.retrieval.xml.Retrieval;
|
import com.raytheon.uf.common.datadelivery.retrieval.xml.Retrieval;
|
||||||
import com.raytheon.uf.common.datadelivery.retrieval.xml.Retrieval.SubscriptionType;
|
import com.raytheon.uf.common.datadelivery.retrieval.xml.Retrieval.SubscriptionType;
|
||||||
import com.raytheon.uf.common.datadelivery.retrieval.xml.RetrievalAttribute;
|
import com.raytheon.uf.common.datadelivery.retrieval.xml.RetrievalAttribute;
|
||||||
|
@ -49,6 +50,7 @@ import com.raytheon.uf.edex.datadelivery.retrieval.opendap.MockOpenDapServiceFac
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Jan 30, 2013 1543 djohnson Initial creation
|
* Jan 30, 2013 1543 djohnson Initial creation
|
||||||
* Feb 15, 2013 1543 djohnson Set coverage on retrieval attributes.
|
* Feb 15, 2013 1543 djohnson Set coverage on retrieval attributes.
|
||||||
|
* Jul 11, 2013 2106 djohnson Use SubscriptionPriority enum.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -77,7 +79,7 @@ public class RetrievalRequestRecordFixture extends
|
||||||
|
|
||||||
SubscriptionBundle bundle = new SubscriptionBundle();
|
SubscriptionBundle bundle = new SubscriptionBundle();
|
||||||
bundle.setBundleId(subscription.getSubscriptionId());
|
bundle.setBundleId(subscription.getSubscriptionId());
|
||||||
bundle.setPriority(1);
|
bundle.setPriority(SubscriptionPriority.HIGH);
|
||||||
bundle.setProvider(provider);
|
bundle.setProvider(provider);
|
||||||
bundle.setConnection(provider.getConnection());
|
bundle.setConnection(provider.getConnection());
|
||||||
bundle.setSubscription(subscription);
|
bundle.setSubscription(subscription);
|
||||||
|
|
Loading…
Add table
Reference in a new issue