Merge "Issue #2038 Add support for point data type subscriptions to BandwidthManager" into development
Former-commit-id:05c82feceb
[formerly05c82feceb
[formerly a64228266a146ecb9a27381d9422c7b9bef56dac]] Former-commit-id:286d19c182
Former-commit-id:11ebd89a2c
This commit is contained in:
commit
7dc49f0a5d
50 changed files with 1742 additions and 508 deletions
|
@ -37,7 +37,7 @@ import com.raytheon.uf.common.datadelivery.registry.DataLevelType.LevelType;
|
|||
import com.raytheon.uf.common.datadelivery.registry.DataSet;
|
||||
import com.raytheon.uf.common.datadelivery.registry.GriddedDataSet;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Provider;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Provider.ProviderType;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ProviderType;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
|
@ -171,7 +171,7 @@ public class MetaDataManager {
|
|||
.getAll()) {
|
||||
|
||||
for (ProviderType type : provider.getProviderType()) {
|
||||
typeSet.add(type.toString());
|
||||
typeSet.add(type.getDataType().toString());
|
||||
}
|
||||
}
|
||||
} catch (RegistryHandlerException e) {
|
||||
|
|
|
@ -575,37 +575,39 @@ public class SubscriptionService implements ISubscriptionService {
|
|||
throws RegistryHandlerException {
|
||||
|
||||
for (Subscription subscription : subscriptions) {
|
||||
final ISubscriptionHandler subscriptionHandler = DataDeliveryHandlers
|
||||
.getSubscriptionHandler();
|
||||
final List<Subscription> potentialDuplicates = subscriptionHandler
|
||||
.getActiveByDataSetAndProvider(
|
||||
subscription.getDataSetName(),
|
||||
subscription.getProvider());
|
||||
List<String> overlappingSubscriptions = Lists.newArrayList();
|
||||
for (Subscription potentialDuplicate : potentialDuplicates) {
|
||||
final ISubscriptionOverlapResponse overlapResponse = subscriptionOverlapService
|
||||
.isOverlapping(potentialDuplicate, subscription);
|
||||
final String potentialDuplicateName = potentialDuplicate
|
||||
.getName();
|
||||
if (overlapResponse.isDuplicate()) {
|
||||
return new SubscriptionServiceResult(true,
|
||||
"This subscription would be an exact duplicate of "
|
||||
+ potentialDuplicateName);
|
||||
if (!(subscription instanceof AdhocSubscription)) {
|
||||
final ISubscriptionHandler subscriptionHandler = DataDeliveryHandlers
|
||||
.getSubscriptionHandler();
|
||||
final List<Subscription> potentialDuplicates = subscriptionHandler
|
||||
.getActiveByDataSetAndProvider(
|
||||
subscription.getDataSetName(),
|
||||
subscription.getProvider());
|
||||
List<String> overlappingSubscriptions = Lists.newArrayList();
|
||||
for (Subscription potentialDuplicate : potentialDuplicates) {
|
||||
final ISubscriptionOverlapResponse overlapResponse = subscriptionOverlapService
|
||||
.isOverlapping(potentialDuplicate, subscription);
|
||||
final String potentialDuplicateName = potentialDuplicate
|
||||
.getName();
|
||||
if (overlapResponse.isDuplicate()) {
|
||||
return new SubscriptionServiceResult(true,
|
||||
"This subscription would be an exact duplicate of "
|
||||
+ potentialDuplicateName);
|
||||
}
|
||||
if (overlapResponse.isOverlapping()) {
|
||||
overlappingSubscriptions.add(potentialDuplicateName);
|
||||
}
|
||||
}
|
||||
if (overlapResponse.isOverlapping()) {
|
||||
overlappingSubscriptions.add(potentialDuplicateName);
|
||||
if (!overlappingSubscriptions.isEmpty()) {
|
||||
Collections.sort(overlappingSubscriptions);
|
||||
forceApplyPrompt
|
||||
.displayMessage(
|
||||
displayTextStrategy,
|
||||
StringUtil
|
||||
.createMessage(
|
||||
ISubscriptionOverlapService.OVERLAPPING_SUBSCRIPTIONS,
|
||||
overlappingSubscriptions));
|
||||
}
|
||||
}
|
||||
if (!overlappingSubscriptions.isEmpty()) {
|
||||
Collections.sort(overlappingSubscriptions);
|
||||
forceApplyPrompt
|
||||
.displayMessage(
|
||||
displayTextStrategy,
|
||||
StringUtil
|
||||
.createMessage(
|
||||
ISubscriptionOverlapService.OVERLAPPING_SUBSCRIPTIONS,
|
||||
overlappingSubscriptions));
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
|
@ -19,6 +19,10 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.datadelivery.subscription.subset;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
|
@ -28,6 +32,7 @@ import org.eclipse.swt.widgets.Group;
|
|||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.PointTime;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.subset.presenter.IPointDataTimingSubsetView;
|
||||
|
||||
/**
|
||||
|
@ -40,6 +45,7 @@ import com.raytheon.uf.viz.datadelivery.subscription.subset.presenter.IPointData
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 29, 2013 223 mpduff Initial creation.
|
||||
* Jun 06, 2013 2038 djohnson Place refresh intervals into PointTime so BandwidthManager has access.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -51,7 +57,7 @@ public class PointTimeSubsetTab extends DataTimingSubsetTab implements
|
|||
IPointDataTimingSubsetView {
|
||||
|
||||
/** Data Retrieval Intervals */
|
||||
private final String[] INTERVALS = new String[] { "5", "10", "15", "30" };
|
||||
private final String[] INTERVALS;
|
||||
|
||||
/** Retrieval Interval Selection Combo */
|
||||
private Combo intervalCombo;
|
||||
|
@ -69,6 +75,15 @@ public class PointTimeSubsetTab extends DataTimingSubsetTab implements
|
|||
public PointTimeSubsetTab(Composite parentComp, IDataSize callback,
|
||||
Shell shell) {
|
||||
super(parentComp, callback, shell);
|
||||
|
||||
// Use the string version of the refresh intervals found in PointTime
|
||||
final List<String> allowedRefreshIntervals = new ArrayList<String>();
|
||||
for (Iterator<Integer> iter = PointTime.getAllowedRefreshIntervals()
|
||||
.iterator(); iter.hasNext();) {
|
||||
allowedRefreshIntervals.add(Integer.toString(iter.next()));
|
||||
}
|
||||
INTERVALS = allowedRefreshIntervals
|
||||
.toArray(new String[allowedRefreshIntervals.size()]);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
31
deltaScripts/13.5.1/updateProviderType.sh
Normal file
31
deltaScripts/13.5.1/updateProviderType.sh
Normal file
|
@ -0,0 +1,31 @@
|
|||
#!/bin/bash
|
||||
|
||||
XSLT_SCRIPT="updateProviderType.xsl"
|
||||
# ensure that the xslt script is present
|
||||
if [ ! -f ${XSLT_SCRIPT} ]; then
|
||||
echo "ERROR: the required xslt script - ${XSLT_SCRIPT} was not found."
|
||||
echo "FATAL: the update has failed!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "INFO: update started - updating ProviderType to be a class proper"
|
||||
|
||||
# Update subscription manager configuration files
|
||||
for FILE in `find /awips2/edex/data/utility/common_static -iname \*-harvester.xml`
|
||||
do
|
||||
cp $FILE $FILE.bak
|
||||
xsltproc ${XSLT_SCRIPT} ${FILE}.bak > ${FILE}
|
||||
|
||||
# Make sure each command succeeds
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "FATAL: the update has failed!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Delete the md5 file
|
||||
rm $FILE.md5
|
||||
done
|
||||
|
||||
echo "INFO: the update has completed successfully!"
|
||||
|
||||
exit 0
|
15
deltaScripts/13.5.1/updateProviderType.xsl
Normal file
15
deltaScripts/13.5.1/updateProviderType.xsl
Normal file
|
@ -0,0 +1,15 @@
|
|||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:output indent="yes"/>
|
||||
<xsl:strip-space elements="*"/>
|
||||
|
||||
<xsl:template match="node()|@*">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="node()|@*"/>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="providerType">
|
||||
<providerType dataType="GRID" plugin="grid" availabilityDelay="100" />
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
|
@ -33,7 +33,6 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
public class IBandwidthRequest extends AbstractPrivilegedRequest {
|
||||
|
||||
public static enum RequestType {
|
||||
METADATA_UPDATE,
|
||||
// Get the current retrieval plan for the
|
||||
// specified begin and end time.
|
||||
RETRIEVAL_PLAN, SHOW_ALLOCATION,
|
||||
|
|
|
@ -15,7 +15,6 @@ import javax.xml.bind.annotation.XmlEnumValue;
|
|||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.Projection.ProjectionType;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Provider.ProviderType;
|
||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
|
@ -96,7 +95,7 @@ public class Collection implements ISerializableObject {
|
|||
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private ProviderType dataType;
|
||||
private DataType dataType;
|
||||
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
|
@ -170,7 +169,7 @@ public class Collection implements ISerializableObject {
|
|||
return format;
|
||||
}
|
||||
|
||||
public ProviderType getDataType() {
|
||||
public DataType getDataType() {
|
||||
return dataType;
|
||||
}
|
||||
|
||||
|
@ -353,7 +352,7 @@ public class Collection implements ISerializableObject {
|
|||
return ignore;
|
||||
}
|
||||
|
||||
public void setDataType(ProviderType dataType) {
|
||||
public void setDataType(DataType dataType) {
|
||||
this.dataType = dataType;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,4 +58,7 @@ public final class DataDeliveryRegistryObjectTypes {
|
|||
|
||||
public static final String DATASET = RegistryUtil
|
||||
.getObjectType(DataSet.class);
|
||||
|
||||
public static final String PROVIDER = RegistryUtil
|
||||
.getObjectType(Provider.class);
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
* Jan 15, 2011 dhladky Initial creation
|
||||
* Jul 24, 2012 955 djohnson Use List instead of ArrayList.
|
||||
* Jun 04, 2013 223 mpduff Cleanup.
|
||||
* Jun 06, 2013 2038 djohnson Remove throws ParseException.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -512,8 +513,7 @@ public class GriddedTime extends Time implements ISerializableObject,
|
|||
* @throws ParseException
|
||||
*/
|
||||
@Override
|
||||
public void setRequestStartAsDate(Date requestStartDate)
|
||||
throws ParseException {
|
||||
public void setRequestStartAsDate(Date requestStartDate) {
|
||||
this.requestStartDate = requestStartDate;
|
||||
if (requestStartDate != null && getFormat() != null) {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat(getFormat());
|
||||
|
@ -548,7 +548,7 @@ public class GriddedTime extends Time implements ISerializableObject,
|
|||
* @throws ParseException
|
||||
*/
|
||||
@Override
|
||||
public void setRequestEndAsDate(Date requestEndDate) throws ParseException {
|
||||
public void setRequestEndAsDate(Date requestEndDate) {
|
||||
this.requestEndDate = requestEndDate;
|
||||
if (requestEndDate != null && getFormat() != null) {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat(getFormat());
|
||||
|
|
|
@ -21,8 +21,10 @@ package com.raytheon.uf.common.datadelivery.registry;
|
|||
**/
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.SortedSet;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
|
@ -30,6 +32,7 @@ import javax.xml.bind.annotation.XmlElement;
|
|||
import javax.xml.bind.annotation.XmlElements;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
|
@ -56,9 +59,6 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
public class PointTime extends Time implements ISerializableObject,
|
||||
Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 234624356321L;
|
||||
|
||||
@XmlElement
|
||||
|
@ -128,4 +128,14 @@ public class PointTime extends Time implements ISerializableObject,
|
|||
public void setInterval(int interval) {
|
||||
this.interval = interval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the allowed refresh intervals. This should be a configurable value at
|
||||
* some point.
|
||||
*
|
||||
* @return the allowed refresh intervals
|
||||
*/
|
||||
public static SortedSet<Integer> getAllowedRefreshIntervals() {
|
||||
return Sets.newTreeSet(Arrays.asList(5, 10, 15, 30));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,15 +3,12 @@ package com.raytheon.uf.common.datadelivery.registry;
|
|||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElements;
|
||||
import javax.xml.bind.annotation.XmlEnum;
|
||||
import javax.xml.bind.annotation.XmlEnumValue;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.raytheon.uf.common.registry.annotations.RegistryObject;
|
||||
|
@ -52,58 +49,6 @@ import com.raytheon.uf.common.time.domain.api.IDuration;
|
|||
@RegistryObject({ "name" })
|
||||
public class Provider implements ISerializableObject {
|
||||
|
||||
/**
|
||||
* Enumeration of provider types, we know so far
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 16, 2012 dhladky Initial creation
|
||||
* Nov 19, 2012 1166 djohnson Clean up JAXB representation of registry objects.
|
||||
* Jan 14, 2013 1286 djohnson Extracted {@link IDuration}.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author dhladky
|
||||
* @version 1.0
|
||||
*/
|
||||
@XmlEnum
|
||||
public enum ProviderType {
|
||||
@XmlEnumValue(ProviderType.GRID_STRING_VALUE)
|
||||
GRID(ProviderType.GRID_STRING_VALUE, "grid"), @XmlEnumValue(ProviderType.POINT_STRING_VALUE)
|
||||
POINT(ProviderType.POINT_STRING_VALUE, "point");
|
||||
|
||||
private static final String GRID_STRING_VALUE = "Grid";
|
||||
|
||||
private static final String POINT_STRING_VALUE = "Point";
|
||||
|
||||
private final String providerType;
|
||||
|
||||
private final String plugin;
|
||||
|
||||
private ProviderType(String name, String plugin) {
|
||||
providerType = name;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return providerType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name of the plugin responsible for the type of data.
|
||||
*
|
||||
* @return the plugin name
|
||||
*/
|
||||
public String getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Service Type
|
||||
*
|
||||
|
@ -146,9 +91,6 @@ public class Provider implements ISerializableObject {
|
|||
|
||||
private static final Integer BYTES_IN_FLOAT = Float.SIZE / Byte.SIZE;
|
||||
|
||||
private static final Pattern POSTED_FILE_DELAY_PATTERN = Pattern
|
||||
.compile("\\s*(\\d+)\\s+([^\\s]+)\\s*");
|
||||
|
||||
@XmlAttribute(name = "name", required = true)
|
||||
@DynamicSerializeElement
|
||||
@SlotAttribute
|
||||
|
@ -323,4 +265,17 @@ public class Provider implements ISerializableObject {
|
|||
this.timeBetweenCrawlRequests = timeBetweenCrawlRequests;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dataSetType
|
||||
* @return
|
||||
*/
|
||||
public ProviderType getProviderType(DataType dataSetType) {
|
||||
for (ProviderType providerType : getProviderType()) {
|
||||
if (providerType.getDataType().equals(dataSetType)) {
|
||||
return providerType;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,127 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.datadelivery.registry;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
|
||||
/**
|
||||
* Provider configuration for a supported data type.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 07, 2013 2038 djohnson Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@DynamicSerialize
|
||||
public class ProviderType {
|
||||
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private DataType dataType;
|
||||
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private String plugin;
|
||||
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private int availabilityDelay;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public ProviderType() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience constructor.
|
||||
*
|
||||
* @param dataType
|
||||
* @param plugin
|
||||
* @param availabilityDelay
|
||||
*/
|
||||
public ProviderType(DataType dataType, String plugin, int availabilityDelay) {
|
||||
this.dataType = dataType;
|
||||
this.plugin = plugin;
|
||||
this.availabilityDelay = availabilityDelay;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the dataType
|
||||
*/
|
||||
public DataType getDataType() {
|
||||
return dataType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dataType
|
||||
* the dataType to set
|
||||
*/
|
||||
public void setDataType(DataType dataType) {
|
||||
this.dataType = dataType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the plugin
|
||||
*/
|
||||
public String getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param plugin
|
||||
* the plugin to set
|
||||
*/
|
||||
public void setPlugin(String plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the availabilityDelay
|
||||
*/
|
||||
public int getAvailabilityDelay() {
|
||||
return availabilityDelay;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param availabilityDelay
|
||||
* the availabilityDelay to set
|
||||
*/
|
||||
public void setAvailabilityDelay(int availabilityDelay) {
|
||||
this.availabilityDelay = availabilityDelay;
|
||||
}
|
||||
|
||||
}
|
|
@ -2,7 +2,6 @@ package com.raytheon.uf.common.datadelivery.registry;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.Provider.ProviderType;
|
||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
|
@ -107,21 +106,19 @@ public class SubscriptionBundle implements ISerializableObject {
|
|||
*
|
||||
* @return the type
|
||||
*/
|
||||
public ProviderType getDataType() {
|
||||
ProviderType pt = null;
|
||||
public DataType getDataType() {
|
||||
if (subscription != null) {
|
||||
if (subscription.getCoverage() instanceof GriddedCoverage) {
|
||||
pt = ProviderType.GRID;
|
||||
return DataType.GRID;
|
||||
}
|
||||
// TODO: Add more data types, currently defaulting to POINT only if
|
||||
// not a GriddedCoverage, when there could be other data types than
|
||||
// just Grid/Point
|
||||
else {
|
||||
pt = ProviderType.POINT;
|
||||
return DataType.POINT;
|
||||
}
|
||||
}
|
||||
|
||||
return pt;
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
* Sep 28, 2012 1187 djohnson {@link #setEndDate(Date)} was incorrectly changing the start date.
|
||||
* Nov 19, 2012 1166 djohnson Clean up JAXB representation of registry objects.
|
||||
* Jun 04, 2013 223 mpduff Added interval field.
|
||||
* Jun 06, 2013 2038 djohnson Remove throws ParseException.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -599,8 +600,7 @@ public class Time implements ISerializableObject, Serializable {
|
|||
* @return
|
||||
* @throws ParseException
|
||||
*/
|
||||
public void setRequestStartAsDate(Date requestStartDate)
|
||||
throws ParseException {
|
||||
public void setRequestStartAsDate(Date requestStartDate) {
|
||||
this.requestStartDate = requestStartDate;
|
||||
if (requestStartDate != null && getFormat() != null) {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat(getFormat());
|
||||
|
@ -633,7 +633,7 @@ public class Time implements ISerializableObject, Serializable {
|
|||
* @return
|
||||
* @throws ParseException
|
||||
*/
|
||||
public void setRequestEndAsDate(Date requestEndDate) throws ParseException {
|
||||
public void setRequestEndAsDate(Date requestEndDate) {
|
||||
this.requestEndDate = requestEndDate;
|
||||
if (requestEndDate != null && getFormat() != null) {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat(getFormat());
|
||||
|
|
|
@ -33,8 +33,8 @@ import javax.xml.bind.annotation.XmlEnumValue;
|
|||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.Connection;
|
||||
import com.raytheon.uf.common.datadelivery.registry.DataType;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Network;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Provider.ProviderType;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Provider.ServiceType;
|
||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
|
@ -83,7 +83,7 @@ public class Retrieval implements ISerializableObject, Serializable {
|
|||
|
||||
@XmlElement
|
||||
@DynamicSerializeElement
|
||||
private ProviderType providerType;
|
||||
private DataType dataType;
|
||||
|
||||
@XmlElement
|
||||
@DynamicSerializeElement
|
||||
|
@ -171,12 +171,12 @@ public class Retrieval implements ISerializableObject, Serializable {
|
|||
this.subscriptionName = subscriptionName;
|
||||
}
|
||||
|
||||
public void setProviderType(ProviderType providerType) {
|
||||
this.providerType = providerType;
|
||||
public void setDataType(DataType providerType) {
|
||||
this.dataType = providerType;
|
||||
}
|
||||
|
||||
public ProviderType getProviderType() {
|
||||
return providerType;
|
||||
public DataType getDataType() {
|
||||
return dataType;
|
||||
}
|
||||
|
||||
public void setSubscriptionType(SubscriptionType subscriptionType) {
|
||||
|
|
|
@ -44,6 +44,11 @@
|
|||
<constructor-arg ref="hibernateBandwidthDbInit" />
|
||||
</bean>
|
||||
|
||||
<bean id="dataSetAvailabilityCalculator"
|
||||
class="com.raytheon.uf.edex.datadelivery.bandwidth.util.ProviderDataTypeAvailabilityCalculator">
|
||||
<constructor-arg ref="ProviderHandler" />
|
||||
</bean>
|
||||
|
||||
<camelContext id="BandwidthManager-context"
|
||||
xmlns="http://camel.apache.org/schema/spring" errorHandlerRef="errorHandler">
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
|
||||
|
||||
<bean id="propertyPlaceholderConfigurer"
|
||||
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
|
||||
|
@ -39,12 +39,6 @@
|
|||
<property name="initializer" ref="bandwidthManagerInitializer" />
|
||||
</bean>
|
||||
|
||||
<bean id="dataSetAvailabilityCalculator"
|
||||
class="com.raytheon.uf.edex.datadelivery.bandwidth.util.SimpleAvailablityCalculator">
|
||||
<property name="delay"
|
||||
value="${bandwidth.dataSetAvailabilityCalculator.delay}" />
|
||||
</bean>
|
||||
|
||||
<bean id="bandwidthUtil"
|
||||
class="com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil"
|
||||
factory-method="getInstance">
|
||||
|
|
|
@ -7,7 +7,6 @@ import java.util.Calendar;
|
|||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
|
@ -21,6 +20,7 @@ import java.util.regex.Pattern;
|
|||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.eventbus.AllowConcurrentEvents;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
|
@ -35,11 +35,14 @@ import com.raytheon.uf.common.datadelivery.bandwidth.data.BandwidthGraphData;
|
|||
import com.raytheon.uf.common.datadelivery.registry.AdhocSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.DataDeliveryRegistryObjectTypes;
|
||||
import com.raytheon.uf.common.datadelivery.registry.DataSetMetaData;
|
||||
import com.raytheon.uf.common.datadelivery.registry.DataType;
|
||||
import com.raytheon.uf.common.datadelivery.registry.GriddedDataSetMetaData;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Network;
|
||||
import com.raytheon.uf.common.datadelivery.registry.PointDataSetMetaData;
|
||||
import com.raytheon.uf.common.datadelivery.registry.PointTime;
|
||||
import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Time;
|
||||
import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
|
||||
import com.raytheon.uf.common.event.EventBus;
|
||||
import com.raytheon.uf.common.registry.event.InsertRegistryEvent;
|
||||
|
@ -52,6 +55,7 @@ import com.raytheon.uf.common.status.UFStatus;
|
|||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.time.util.ITimer;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.common.util.CollectionUtil;
|
||||
import com.raytheon.uf.common.util.FileUtil;
|
||||
import com.raytheon.uf.common.util.IFileModifiedWatcher;
|
||||
import com.raytheon.uf.common.util.LogUtil;
|
||||
|
@ -110,6 +114,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
|||
* Mar 28, 2013 1841 djohnson Subscription is now UserSubscription.
|
||||
* May 02, 2013 1910 djohnson Shutdown proposed bandwidth managers in a finally.
|
||||
* May 20, 2013 1650 djohnson Add in capability to find required dataset size.
|
||||
* Jun 03, 2013 2038 djohnson Add base functionality to handle point data type subscriptions.
|
||||
* </pre>
|
||||
*
|
||||
* @author dhladky
|
||||
|
@ -252,22 +257,102 @@ public abstract class BandwidthManager extends
|
|||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* Process a {@link GriddedDataSetMetaData} that was received from the event
|
||||
* bus.
|
||||
*
|
||||
* @param dataSetMetaData
|
||||
* the metadadata
|
||||
*/
|
||||
@Override
|
||||
@Subscribe
|
||||
public void updateDataSetMetaData(DataSetMetaData dataSetMetaData)
|
||||
public void updateGriddedDataSetMetaData(
|
||||
GriddedDataSetMetaData dataSetMetaData)
|
||||
throws ParseException {
|
||||
if (dataSetMetaData instanceof GriddedDataSetMetaData) {
|
||||
GriddedDataSetMetaData gdsmd = (GriddedDataSetMetaData) dataSetMetaData;
|
||||
// Daily/Hourly/Monthly datasets
|
||||
if (dataSetMetaData.getCycle() == GriddedDataSetMetaData.NO_CYCLE) {
|
||||
updateDataSetMetaDataWithoutCycle(dataSetMetaData);
|
||||
}
|
||||
// Regular cycle containing datasets
|
||||
else {
|
||||
updateDataSetMetaDataWithCycle(dataSetMetaData);
|
||||
}
|
||||
}
|
||||
|
||||
// Daily/Hourly/Monthly datasets
|
||||
if (gdsmd.getCycle() == GriddedDataSetMetaData.NO_CYCLE) {
|
||||
updateDataSetMetaDataWithoutCycle(gdsmd);
|
||||
}
|
||||
// Regular cycle containing datasets
|
||||
else {
|
||||
updateDataSetMetaDataWithCycle(gdsmd);
|
||||
/**
|
||||
* Process a {@link PointDataSetMetaData} that was received from the event
|
||||
* bus.
|
||||
*
|
||||
* @param dataSetMetaData
|
||||
* the metadadata
|
||||
*/
|
||||
@Subscribe
|
||||
public void updatePointDataSetMetaData(PointDataSetMetaData dataSetMetaData) {
|
||||
// TODO: Change PointDataSetMetaData to only be able to use PointTime
|
||||
// objects
|
||||
final PointTime time = (PointTime) dataSetMetaData.getTime();
|
||||
final String providerName = dataSetMetaData.getProviderName();
|
||||
final String dataSetName = dataSetMetaData.getDataSetName();
|
||||
final Date pointTimeStart = time.getStartDate();
|
||||
final Date pointTimeEnd = time.getEndDate();
|
||||
|
||||
final SortedSet<Integer> allowedRefreshIntervals = PointTime
|
||||
.getAllowedRefreshIntervals();
|
||||
final long maxAllowedRefreshIntervalInMillis = TimeUtil.MILLIS_PER_MINUTE
|
||||
* allowedRefreshIntervals.last();
|
||||
final long minAllowedRefreshIntervalInMillis = TimeUtil.MILLIS_PER_MINUTE
|
||||
* allowedRefreshIntervals.first();
|
||||
|
||||
// Find any retrievals ranging from those with the minimum refresh
|
||||
// interval to the maximum refresh interval
|
||||
final Date startDate = new Date(pointTimeStart.getTime()
|
||||
+ minAllowedRefreshIntervalInMillis);
|
||||
final Date endDate = new Date(pointTimeEnd.getTime()
|
||||
+ maxAllowedRefreshIntervalInMillis);
|
||||
|
||||
final SortedSet<SubscriptionRetrieval> subscriptionRetrievals = bandwidthDao
|
||||
.getSubscriptionRetrievals(providerName, dataSetName,
|
||||
RetrievalStatus.SCHEDULED, startDate, endDate);
|
||||
|
||||
if (!CollectionUtil.isNullOrEmpty(subscriptionRetrievals)) {
|
||||
for (SubscriptionRetrieval retrieval : subscriptionRetrievals) {
|
||||
// Now check and make sure that at least one of the times falls
|
||||
// in their retrieval range, their latency is the retrieval
|
||||
// interval
|
||||
final int retrievalInterval = retrieval
|
||||
.getSubscriptionLatency();
|
||||
|
||||
// This is the latest time on the data we care about, once the
|
||||
// retrieval is signaled to go it retrieves everything up to
|
||||
// its start time
|
||||
final Date latestRetrievalDataTime = retrieval.getStartTime()
|
||||
.getTime();
|
||||
// This is the earliest possible time this retrieval cares about
|
||||
final Date earliestRetrievalDataTime = new Date(
|
||||
latestRetrievalDataTime.getTime()
|
||||
- (TimeUtil.MILLIS_PER_MINUTE * retrievalInterval));
|
||||
|
||||
// If the end is before any times we care about or the start is
|
||||
// after the latest times we care about, skip it
|
||||
if (pointTimeEnd.before(earliestRetrievalDataTime)
|
||||
|| pointTimeStart.after(latestRetrievalDataTime)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
// Update the retrieval times on the subscription object
|
||||
// which goes through the retrieval process
|
||||
final Subscription subscription = retrieval
|
||||
.getSubscription();
|
||||
final Time subTime = subscription.getTime();
|
||||
subTime.setRequestStartAsDate(earliestRetrievalDataTime);
|
||||
subTime.setRequestEndAsDate(latestRetrievalDataTime);
|
||||
|
||||
// Now update the retrieval to be ready
|
||||
retrieval.setStatus(RetrievalStatus.READY);
|
||||
bandwidthDaoUtil.update(retrieval);
|
||||
} catch (SerializationException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -420,14 +505,50 @@ public abstract class BandwidthManager extends
|
|||
|
||||
private List<BandwidthAllocation> schedule(Subscription subscription,
|
||||
SortedSet<Integer> cycles) {
|
||||
List<BandwidthAllocation> unscheduled = new ArrayList<BandwidthAllocation>();
|
||||
SortedSet<Calendar> retrievalTimes = bandwidthDaoUtil
|
||||
.getRetrievalTimes(subscription, cycles);
|
||||
|
||||
return scheduleSubscriptionForRetrievalTimes(subscription,
|
||||
retrievalTimes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedules a subscription that specifies a retrieval interval, rather than
|
||||
* cycle times.
|
||||
*
|
||||
* @param subscription
|
||||
* the subscription
|
||||
* @param retrievalInterval
|
||||
* the retrieval interval
|
||||
* @return the list of unscheduled subscriptions
|
||||
*/
|
||||
private List<BandwidthAllocation> schedule(Subscription subscription,
|
||||
int retrievalInterval) {
|
||||
SortedSet<Calendar> retrievalTimes = bandwidthDaoUtil
|
||||
.getRetrievalTimes(subscription, retrievalInterval);
|
||||
|
||||
return scheduleSubscriptionForRetrievalTimes(subscription,
|
||||
retrievalTimes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedule the given subscription for the specified retrieval times.
|
||||
*
|
||||
* @param subscription
|
||||
* the subscription
|
||||
* @param retrievalTimes
|
||||
* the retrieval times
|
||||
* @return the unscheduled subscriptions
|
||||
*/
|
||||
private List<BandwidthAllocation> scheduleSubscriptionForRetrievalTimes(
|
||||
Subscription subscription, SortedSet<Calendar> retrievalTimes) {
|
||||
|
||||
if (retrievalTimes.isEmpty()) {
|
||||
return unscheduled;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
List<BandwidthAllocation> unscheduled = Lists.newArrayList();
|
||||
|
||||
for (Calendar retrievalTime : retrievalTimes) {
|
||||
|
||||
// Retrieve all the current subscriptions by provider, dataset name
|
||||
|
@ -604,9 +725,26 @@ public abstract class BandwidthManager extends
|
|||
*/
|
||||
@Override
|
||||
public List<BandwidthAllocation> schedule(Subscription subscription) {
|
||||
SortedSet<Integer> cycles = new TreeSet<Integer>(subscription.getTime()
|
||||
.getCycleTimes());
|
||||
List<BandwidthAllocation> unscheduled = schedule(subscription, cycles);
|
||||
// TODO: In 13.6.1 pull out all of the subscription stuff into a
|
||||
// separate plugin, BandwidthManager should not work with Subscription
|
||||
// objects directly, it should have extension plugins that can allocate
|
||||
// bandwidth in their own types (e.g. registry syncing should be able to
|
||||
// sync into the bandwidth management infrastructure if required)
|
||||
List<BandwidthAllocation> unscheduled;
|
||||
|
||||
final DataType dataSetType = subscription.getDataSetType();
|
||||
switch (dataSetType) {
|
||||
case GRID:
|
||||
unscheduled = handleGridded(subscription);
|
||||
break;
|
||||
case POINT:
|
||||
unscheduled = handlePoint(subscription);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException(
|
||||
"The BandwidthManager doesn't know how to treat subscriptions with data type ["
|
||||
+ dataSetType + "]!");
|
||||
}
|
||||
|
||||
unscheduleSubscriptionsForAllocations(unscheduled);
|
||||
|
||||
|
@ -737,137 +875,78 @@ public abstract class BandwidthManager extends
|
|||
// it's active, attempt to add it..
|
||||
if (bandwidthSubscriptions.isEmpty() && subscription.isActive()
|
||||
&& !subscription.isUnscheduled()) {
|
||||
final boolean subscribedToCycles = !subscription.getTime()
|
||||
.getCycleTimes().isEmpty();
|
||||
final boolean useMostRecentDataSetUpdate = !subscribedToCycles;
|
||||
|
||||
// The subscription has cycles, so we can allocate bandwidth at
|
||||
// expected times
|
||||
List<BandwidthAllocation> unscheduled = Collections.emptyList();
|
||||
if (subscribedToCycles) {
|
||||
unscheduled = schedule(subscription);
|
||||
}
|
||||
|
||||
// Create an adhoc subscription based on the new subscription,
|
||||
// and set it to retrieve the most recent cycle (or most recent
|
||||
// url if a daily product)
|
||||
if (subscription instanceof SiteSubscription) {
|
||||
AdhocSubscription adhoc = new AdhocSubscription(
|
||||
(SiteSubscription) subscription);
|
||||
adhoc = bandwidthDaoUtil.setAdhocMostRecentUrlAndTime(
|
||||
adhoc, useMostRecentDataSetUpdate);
|
||||
|
||||
if (adhoc == null) {
|
||||
statusHandler
|
||||
.info(String
|
||||
.format("There wasn't applicable most recent dataset metadata to use for new subscription [%s]. "
|
||||
+ "No adhoc requested.",
|
||||
subscription.getName()));
|
||||
} else {
|
||||
unscheduled = schedule(adhoc);
|
||||
}
|
||||
} else {
|
||||
statusHandler
|
||||
.warn("Unable to create adhoc queries for shared subscriptions at this point. This functionality should be added in the future...");
|
||||
}
|
||||
return unscheduled;
|
||||
return schedule(subscription);
|
||||
} else if (!subscription.isActive() || subscription.isUnscheduled()) {
|
||||
// See if the subscription was inactivated or unscheduled..
|
||||
// Need to remove BandwidthReservations for this
|
||||
// subscription.
|
||||
return remove(bandwidthSubscriptions);
|
||||
} else {
|
||||
|
||||
// Compare the 'updated' Subscription with the stored
|
||||
// SubscriptionDaos to determine
|
||||
// if the changes made to the Subscription would affect
|
||||
// BandwidthReservations
|
||||
// already in place for this subscription.
|
||||
|
||||
Subscription old = bandwidthSubscriptions.get(0)
|
||||
.getSubscription();
|
||||
|
||||
// Check to see if estimated size changed. If there was a change
|
||||
// to
|
||||
// which parameters or levels or coverage or forecast hours,
|
||||
// those
|
||||
// don't effect BandwidthReservations so there is no need to
|
||||
// change the
|
||||
// RetrievalPlan as long as the size stays the same
|
||||
|
||||
if (BandwidthUtil.subscriptionRequiresReschedule(subscription,
|
||||
old)) {
|
||||
|
||||
// OK, have to remove the old Subscriptions and add the new
|
||||
// ones..
|
||||
List<BandwidthAllocation> unscheduled = remove(bandwidthSubscriptions);
|
||||
// No need to check anything else since all the
|
||||
// BandwidthSubscription's have been replaced.
|
||||
unscheduled.addAll(schedule(subscription));
|
||||
return unscheduled;
|
||||
}
|
||||
|
||||
List<BandwidthAllocation> unscheduled = new ArrayList<BandwidthAllocation>();
|
||||
// Check that the cycles in both subscriptions are the same
|
||||
SortedSet<Integer> newCycles = new TreeSet<Integer>(
|
||||
subscription.getTime().getCycleTimes());
|
||||
SortedSet<Integer> oldCycles = new TreeSet<Integer>(old
|
||||
.getTime().getCycleTimes());
|
||||
|
||||
if (newCycles.size() != oldCycles.size()
|
||||
|| !newCycles.containsAll(oldCycles)
|
||||
|| !oldCycles.containsAll(newCycles)) {
|
||||
// Cycle times have changed, reschedule.
|
||||
|
||||
// Create a Set of the common elements..
|
||||
Set<Integer> commonCycles = Sets
|
||||
.union(oldCycles, newCycles);
|
||||
|
||||
// Remove the common elements from the old cycles, these
|
||||
// need to be removed from the RetrievalPlan..
|
||||
oldCycles.removeAll(commonCycles);
|
||||
|
||||
// Remove the common elements from the new cycles, these
|
||||
// need to be added to the RetrievalPlan..
|
||||
newCycles.removeAll(commonCycles);
|
||||
|
||||
// Remove the old cycles, add the new ones...
|
||||
if (!oldCycles.isEmpty()) {
|
||||
// Create a List of SubscriptionDaos that need to be
|
||||
// removed..
|
||||
List<BandwidthSubscription> bandwidthSubscriptionToRemove = new ArrayList<BandwidthSubscription>();
|
||||
BandwidthSubscription bandwidthSubscription = null;
|
||||
Iterator<BandwidthSubscription> itr = bandwidthSubscriptions
|
||||
.iterator();
|
||||
while (itr.hasNext()) {
|
||||
bandwidthSubscription = itr.next();
|
||||
if (oldCycles.contains(bandwidthSubscription
|
||||
.getCycle())) {
|
||||
bandwidthSubscriptionToRemove
|
||||
.add(bandwidthSubscription);
|
||||
itr.remove();
|
||||
}
|
||||
}
|
||||
unscheduled
|
||||
.addAll(remove(bandwidthSubscriptionToRemove));
|
||||
}
|
||||
|
||||
if (!newCycles.isEmpty()) {
|
||||
unscheduled.addAll(schedule(subscription, newCycles));
|
||||
}
|
||||
}
|
||||
|
||||
// Update the remaining dao's with the current subscription...
|
||||
for (BandwidthSubscription bandwidthSubscription : bandwidthSubscriptions) {
|
||||
bandwidthSubscription.setSubscription(subscription);
|
||||
bandwidthDao.update(bandwidthSubscription);
|
||||
}
|
||||
|
||||
// Normal update, unschedule old allocations and create new ones
|
||||
List<BandwidthAllocation> unscheduled = remove(bandwidthSubscriptions);
|
||||
unscheduled.addAll(schedule(subscription));
|
||||
return unscheduled;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle scheduling point data type subscriptions.
|
||||
*
|
||||
* @param subscription
|
||||
* the subscription
|
||||
* @return the list of unscheduled subscriptions
|
||||
*/
|
||||
private List<BandwidthAllocation> handlePoint(Subscription subscription) {
|
||||
return schedule(subscription,
|
||||
((PointTime) subscription.getTime()).getInterval());
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle scheduling grid data type subscriptions.
|
||||
*
|
||||
* @param subscription
|
||||
* the subscription
|
||||
* @return the list of unscheduled subscriptions
|
||||
*/
|
||||
private List<BandwidthAllocation> handleGridded(Subscription subscription) {
|
||||
final List<Integer> cycles = subscription.getTime().getCycleTimes();
|
||||
final boolean subscribedToCycles = !CollectionUtil
|
||||
.isNullOrEmpty(cycles);
|
||||
final boolean useMostRecentDataSetUpdate = !subscribedToCycles;
|
||||
|
||||
// The subscription has cycles, so we can allocate bandwidth at
|
||||
// expected times
|
||||
List<BandwidthAllocation> unscheduled = Collections.emptyList();
|
||||
if (subscribedToCycles) {
|
||||
unscheduled = schedule(subscription, Sets.newTreeSet(cycles));
|
||||
}
|
||||
|
||||
// Create an adhoc subscription based on the new subscription,
|
||||
// and set it to retrieve the most recent cycle (or most recent
|
||||
// url if a daily product)
|
||||
if (subscription instanceof SiteSubscription) {
|
||||
AdhocSubscription adhoc = new AdhocSubscription(
|
||||
(SiteSubscription) subscription);
|
||||
adhoc = bandwidthDaoUtil.setAdhocMostRecentUrlAndTime(adhoc,
|
||||
useMostRecentDataSetUpdate);
|
||||
|
||||
if (adhoc == null) {
|
||||
statusHandler
|
||||
.info(String
|
||||
.format("There wasn't applicable most recent dataset metadata to use for new subscription [%s]. "
|
||||
+ "No adhoc requested.",
|
||||
subscription.getName()));
|
||||
} else {
|
||||
unscheduled = schedule(adhoc);
|
||||
}
|
||||
} else {
|
||||
statusHandler
|
||||
.warn("Unable to create adhoc queries for shared subscriptions at this point. This functionality should be added in the future...");
|
||||
}
|
||||
return unscheduled;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
|
@ -1092,13 +1171,7 @@ public abstract class BandwidthManager extends
|
|||
boolean setBandwidth = setBandwidth(requestNetwork, bandwidth);
|
||||
response = setBandwidth;
|
||||
break;
|
||||
case METADATA_UPDATE:
|
||||
DataSetMetaData r = request.getDataSetMetaData();
|
||||
updateDataSetMetaData(r);
|
||||
break;
|
||||
|
||||
case SHOW_ALLOCATION:
|
||||
|
||||
break;
|
||||
|
||||
case SHOW_BUCKET:
|
||||
|
|
|
@ -19,13 +19,11 @@
|
|||
**/
|
||||
package com.raytheon.uf.edex.datadelivery.bandwidth;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.eventbus.AllowConcurrentEvents;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.raytheon.uf.common.datadelivery.registry.AdhocSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.DataSetMetaData;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.registry.event.InsertRegistryEvent;
|
||||
import com.raytheon.uf.common.registry.event.RemoveRegistryEvent;
|
||||
|
@ -64,17 +62,6 @@ public interface IBandwidthManager {
|
|||
@Subscribe
|
||||
void registryEventListener(InsertRegistryEvent re);
|
||||
|
||||
/**
|
||||
* Persist the DataSetMetaData update and store the necessary statistical
|
||||
* data's to generate the predictive update time for a dataset.
|
||||
*
|
||||
* @param dataSetMetaData
|
||||
* @throws ParseException
|
||||
*/
|
||||
@Subscribe
|
||||
void updateDataSetMetaData(DataSetMetaData dataSetMetaData)
|
||||
throws ParseException;
|
||||
|
||||
/**
|
||||
* When a Subscription is removed from the Registry, a RemoveRegistryEvent
|
||||
* is generated and forwarded to this method to remove the necessary
|
||||
|
|
|
@ -21,11 +21,16 @@ package com.raytheon.uf.edex.datadelivery.bandwidth;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.raytheon.uf.common.datadelivery.registry.DataSetMetaData;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Network;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
|
@ -55,6 +60,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 24, 2012 1286 djohnson Initial creation
|
||||
* Dec 12, 2012 1286 djohnson Use concurrent lists to avoid concurrent modification exceptions.
|
||||
* Jun 03, 2013 2038 djohnson Add method to get subscription retrievals by provider, dataset, and status.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -87,8 +93,8 @@ class InMemoryBandwidthDao implements IBandwidthDao {
|
|||
.hasNext();) {
|
||||
BandwidthAllocation current = iter.next();
|
||||
if ((current instanceof SubscriptionRetrieval)
|
||||
&& ((SubscriptionRetrieval) current).getBandwidthSubscription()
|
||||
.getId() == subscriptionId) {
|
||||
&& ((SubscriptionRetrieval) current)
|
||||
.getBandwidthSubscription().getId() == subscriptionId) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -158,8 +164,8 @@ class InMemoryBandwidthDao implements IBandwidthDao {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public List<BandwidthDataSetUpdate> getBandwidthDataSetUpdate(String providerName,
|
||||
String dataSetName) {
|
||||
public List<BandwidthDataSetUpdate> getBandwidthDataSetUpdate(
|
||||
String providerName, String dataSetName) {
|
||||
ArrayList<BandwidthDataSetUpdate> results = clone(bandwidthDataSetUpdates);
|
||||
|
||||
for (Iterator<BandwidthDataSetUpdate> iter = results.iterator(); iter
|
||||
|
@ -180,10 +186,10 @@ class InMemoryBandwidthDao implements IBandwidthDao {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public List<BandwidthDataSetUpdate> getBandwidthDataSetUpdate(String providerName,
|
||||
String dataSetName, Calendar baseReferenceTime) {
|
||||
List<BandwidthDataSetUpdate> results = getBandwidthDataSetUpdate(providerName,
|
||||
dataSetName);
|
||||
public List<BandwidthDataSetUpdate> getBandwidthDataSetUpdate(
|
||||
String providerName, String dataSetName, Calendar baseReferenceTime) {
|
||||
List<BandwidthDataSetUpdate> results = getBandwidthDataSetUpdate(
|
||||
providerName, dataSetName);
|
||||
|
||||
for (Iterator<BandwidthDataSetUpdate> iter = results.iterator(); iter
|
||||
.hasNext();) {
|
||||
|
@ -205,7 +211,8 @@ class InMemoryBandwidthDao implements IBandwidthDao {
|
|||
public List<BandwidthAllocation> getDeferred(Network network,
|
||||
Calendar endTime) {
|
||||
List<BandwidthAllocation> results = getBandwidthAllocations(network);
|
||||
for (Iterator<BandwidthAllocation> iter = results.iterator(); iter.hasNext();) {
|
||||
for (Iterator<BandwidthAllocation> iter = results.iterator(); iter
|
||||
.hasNext();) {
|
||||
BandwidthAllocation current = iter.next();
|
||||
if (RetrievalStatus.DEFERRED.equals(current.getStatus())
|
||||
&& !current.getEndTime().after(endTime)) {
|
||||
|
@ -252,7 +259,8 @@ class InMemoryBandwidthDao implements IBandwidthDao {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public List<BandwidthSubscription> getBandwidthSubscription(Subscription subscription) {
|
||||
public List<BandwidthSubscription> getBandwidthSubscription(
|
||||
Subscription subscription) {
|
||||
return getBandwidthSubscriptionByRegistryId(subscription.getId());
|
||||
}
|
||||
|
||||
|
@ -263,8 +271,8 @@ class InMemoryBandwidthDao implements IBandwidthDao {
|
|||
public List<BandwidthSubscription> getBandwidthSubscriptionByRegistryId(
|
||||
String registryId) {
|
||||
final ArrayList<BandwidthSubscription> results = clone(bandwidthSubscriptions);
|
||||
for (Iterator<BandwidthSubscription> iter = results
|
||||
.iterator(); iter.hasNext();) {
|
||||
for (Iterator<BandwidthSubscription> iter = results.iterator(); iter
|
||||
.hasNext();) {
|
||||
final BandwidthSubscription current = iter.next();
|
||||
if (registryId.equals(current.getRegistryId())) {
|
||||
continue;
|
||||
|
@ -299,8 +307,7 @@ class InMemoryBandwidthDao implements IBandwidthDao {
|
|||
List<SubscriptionRetrieval> results = new ArrayList<SubscriptionRetrieval>(
|
||||
getSubscriptionRetrievals(provider, dataSetName));
|
||||
List<BandwidthSubscription> subscriptionsMatching = getBandwidthSubscriptions(
|
||||
provider,
|
||||
dataSetName, baseReferenceTime);
|
||||
provider, dataSetName, baseReferenceTime);
|
||||
|
||||
OUTER: for (Iterator<SubscriptionRetrieval> iter = results.iterator(); iter
|
||||
.hasNext();) {
|
||||
|
@ -367,12 +374,12 @@ class InMemoryBandwidthDao implements IBandwidthDao {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public List<BandwidthSubscription> getBandwidthSubscriptions(String provider,
|
||||
String dataSetName, Calendar baseReferenceTime) {
|
||||
public List<BandwidthSubscription> getBandwidthSubscriptions(
|
||||
String provider, String dataSetName, Calendar baseReferenceTime) {
|
||||
List<BandwidthSubscription> bandwidthSubscriptions = getBandwidthSubscriptions();
|
||||
|
||||
for (Iterator<BandwidthSubscription> iter = bandwidthSubscriptions.iterator(); iter
|
||||
.hasNext();) {
|
||||
for (Iterator<BandwidthSubscription> iter = bandwidthSubscriptions
|
||||
.iterator(); iter.hasNext();) {
|
||||
BandwidthSubscription current = iter.next();
|
||||
if (provider.equals(current.getProvider())
|
||||
&& dataSetName.equals(current.getDataSetName())
|
||||
|
@ -405,10 +412,12 @@ class InMemoryBandwidthDao implements IBandwidthDao {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public BandwidthSubscription newBandwidthSubscription(Subscription subscription,
|
||||
Calendar baseReferenceTime) throws SerializationException {
|
||||
BandwidthSubscription entity = BandwidthUtil.getSubscriptionDaoForSubscription(
|
||||
subscription, baseReferenceTime);
|
||||
public BandwidthSubscription newBandwidthSubscription(
|
||||
Subscription subscription, Calendar baseReferenceTime)
|
||||
throws SerializationException {
|
||||
BandwidthSubscription entity = BandwidthUtil
|
||||
.getSubscriptionDaoForSubscription(subscription,
|
||||
baseReferenceTime);
|
||||
|
||||
update(entity);
|
||||
|
||||
|
@ -429,8 +438,8 @@ class InMemoryBandwidthDao implements IBandwidthDao {
|
|||
.hasNext();) {
|
||||
BandwidthAllocation current = iter.next();
|
||||
if (current instanceof SubscriptionRetrieval) {
|
||||
if (((SubscriptionRetrieval) current).getBandwidthSubscription()
|
||||
.getId() == subscriptionId) {
|
||||
if (((SubscriptionRetrieval) current)
|
||||
.getBandwidthSubscription().getId() == subscriptionId) {
|
||||
results.add((SubscriptionRetrieval) current);
|
||||
}
|
||||
}
|
||||
|
@ -541,4 +550,59 @@ class InMemoryBandwidthDao implements IBandwidthDao {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public SortedSet<SubscriptionRetrieval> getSubscriptionRetrievals(
|
||||
String provider, String dataSetName, RetrievalStatus status) {
|
||||
|
||||
final List<SubscriptionRetrieval> subscriptionRetrievals = getSubscriptionRetrievals(
|
||||
provider, dataSetName);
|
||||
|
||||
for (Iterator<SubscriptionRetrieval> iter = subscriptionRetrievals
|
||||
.iterator(); iter.hasNext();) {
|
||||
SubscriptionRetrieval subRetrieval = iter.next();
|
||||
if (!status.equals(subRetrieval.getStatus())) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
|
||||
final TreeSet<SubscriptionRetrieval> treeSet = Sets
|
||||
.newTreeSet(new Comparator<SubscriptionRetrieval>() {
|
||||
@Override
|
||||
public int compare(SubscriptionRetrieval o1,
|
||||
SubscriptionRetrieval o2) {
|
||||
return o1.getStartTime().compareTo(o2.getStartTime());
|
||||
}
|
||||
});
|
||||
|
||||
treeSet.addAll(subscriptionRetrievals);
|
||||
|
||||
return treeSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public SortedSet<SubscriptionRetrieval> getSubscriptionRetrievals(
|
||||
String provider, String dataSetName, RetrievalStatus status,
|
||||
Date earliestDate, Date latestDate) {
|
||||
|
||||
SortedSet<SubscriptionRetrieval> results = getSubscriptionRetrievals(
|
||||
provider, dataSetName, status);
|
||||
|
||||
for (Iterator<SubscriptionRetrieval> iter = results
|
||||
.iterator(); iter.hasNext();) {
|
||||
SubscriptionRetrieval subRetrieval = iter.next();
|
||||
if (earliestDate.after(subRetrieval.getStartTime().getTime())
|
||||
|| latestDate.before(subRetrieval.getStartTime().getTime())) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,18 +20,22 @@
|
|||
package com.raytheon.uf.edex.datadelivery.bandwidth.dao;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.SortedSet;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.DataSetMetaData;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Network;
|
||||
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.retrieval.RetrievalStatus;
|
||||
|
||||
/**
|
||||
* Extracted from {@link BandwidthContextFactory} so that {@link BandwidthManager}
|
||||
* can be run in memory (e.g. for testing proposed bandwidth size limitations
|
||||
* and informing the user which subscriptions would be unable to be scheduled).
|
||||
* Extracted from {@link BandwidthContextFactory} so that
|
||||
* {@link BandwidthManager} can be run in memory (e.g. for testing proposed
|
||||
* bandwidth size limitations and informing the user which subscriptions would
|
||||
* be unable to be scheduled).
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -40,6 +44,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalStatus;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 23, 2012 1286 djohnson Initial creation
|
||||
* Jun 03, 2013 2038 djohnson Add method to get subscription retrievals by provider, dataset, and status.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -192,6 +197,50 @@ public interface IBandwidthDao {
|
|||
List<SubscriptionRetrieval> getSubscriptionRetrievals(String provider,
|
||||
String dataSetName, Calendar baseReferenceTime);
|
||||
|
||||
/**
|
||||
* Get all the subscription retrievals for the specified dataset, with the
|
||||
* specified status, and ordered by date.
|
||||
*
|
||||
* @param provider
|
||||
* The provider name.
|
||||
*
|
||||
* @param dataSetName
|
||||
* The dataset name.
|
||||
*
|
||||
* @param status
|
||||
* The status
|
||||
*
|
||||
* @return the subscription retrievals
|
||||
*/
|
||||
SortedSet<SubscriptionRetrieval> getSubscriptionRetrievals(String provider,
|
||||
String dataSetName, RetrievalStatus status);
|
||||
|
||||
/**
|
||||
* Get all the subscription retrievals for the specified dataset, with the
|
||||
* specified status, ordered by date, with a start date between the two
|
||||
* specified dates (inclusive).
|
||||
*
|
||||
* @param provider
|
||||
* The provider name.
|
||||
*
|
||||
* @param dataSetName
|
||||
* The dataset name.
|
||||
*
|
||||
* @param status
|
||||
* The status
|
||||
*
|
||||
* @param earliestDate
|
||||
* the earliest date
|
||||
*
|
||||
* @param latestDate
|
||||
* the latest date
|
||||
*
|
||||
* @return the subscription retrievals
|
||||
*/
|
||||
SortedSet<SubscriptionRetrieval> getSubscriptionRetrievals(String provider,
|
||||
String dataSetName, RetrievalStatus status, Date earliestDate,
|
||||
Date latestDate);
|
||||
|
||||
/**
|
||||
* Get all the subscription retrievals for the specified dataset and base
|
||||
* reference time.
|
||||
|
|
|
@ -20,7 +20,9 @@
|
|||
package com.raytheon.uf.edex.datadelivery.bandwidth.hibernate;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.SortedSet;
|
||||
|
||||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.jdbc.Work;
|
||||
|
@ -52,6 +54,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
|||
* Feb 07, 2013 1543 djohnson Moved session management context to CoreDao.
|
||||
* Feb 11, 2013 1543 djohnson Use Spring transactions.
|
||||
* Feb 13, 2013 1543 djohnson Converted into a service, created new DAOs as required.
|
||||
* Jun 03, 2013 2038 djohnson Add method to get subscription retrievals by provider, dataset, and status.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -204,6 +207,28 @@ public class HibernateBandwidthDao implements IBandwidthDao {
|
|||
dataSetName);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public SortedSet<SubscriptionRetrieval> getSubscriptionRetrievals(
|
||||
String provider, String dataSetName, RetrievalStatus status) {
|
||||
return subscriptionRetrievalDao.getByProviderDataSetAndStatus(provider,
|
||||
dataSetName, status);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public SortedSet<SubscriptionRetrieval> getSubscriptionRetrievals(
|
||||
String provider, String dataSetName, RetrievalStatus status,
|
||||
Date earliestDate, Date latestDate) {
|
||||
return this.subscriptionRetrievalDao
|
||||
.getByProviderDataSetStatusAndDateRange(provider, dataSetName,
|
||||
status, earliestDate, latestDate);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -339,7 +364,7 @@ public class HibernateBandwidthDao implements IBandwidthDao {
|
|||
* The unit of work to do.
|
||||
*/
|
||||
public void doWork(Work work) {
|
||||
subscriptionRetrievalDao.doWork(work);
|
||||
subscriptionRetrievalDao.executeWork(work);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,12 +20,15 @@
|
|||
package com.raytheon.uf.edex.datadelivery.bandwidth.hibernate;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.SortedSet;
|
||||
|
||||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.jdbc.Work;
|
||||
|
||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrieval;
|
||||
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalStatus;
|
||||
|
||||
/**
|
||||
* DAO for {@link SubscriptionRetrieval} instances.
|
||||
|
@ -37,6 +40,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrieval;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 13, 2013 1543 djohnson Initial creation
|
||||
* Jun 03, 2013 2038 djohnson Add method to get subscription retrievals by provider, dataset, and status.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -67,21 +71,45 @@ interface ISubscriptionRetrievalDao extends
|
|||
List<SubscriptionRetrieval> getByProviderDataSet(String provider,
|
||||
String dataSetName);
|
||||
|
||||
/**
|
||||
* Get by provider, dataset, and retrieval status. The results will be
|
||||
* ordered by start date.
|
||||
*
|
||||
* @param provider
|
||||
* @param dataSetName
|
||||
* @param status
|
||||
* @return
|
||||
*/
|
||||
SortedSet<SubscriptionRetrieval> getByProviderDataSetAndStatus(
|
||||
String provider, String dataSetName, RetrievalStatus status);
|
||||
|
||||
/**
|
||||
* Get by provider, dataset, retrieval status, and a date range. The results
|
||||
* will be ordered by start date.
|
||||
*
|
||||
* @param provider
|
||||
* @param dataSetName
|
||||
* @param status
|
||||
* @param earliestDate
|
||||
* @param latestDate
|
||||
* @return
|
||||
*/
|
||||
SortedSet<SubscriptionRetrieval> getByProviderDataSetStatusAndDateRange(
|
||||
String provider, String dataSetName, RetrievalStatus status,
|
||||
Date earliestDate, Date latestDate);
|
||||
|
||||
/**
|
||||
* Do arbitrary work.
|
||||
*
|
||||
* @param work
|
||||
* work
|
||||
*/
|
||||
// TODO: It would be nice to remove this method, if possible
|
||||
void doWork(Work work);
|
||||
void executeWork(Work work);
|
||||
|
||||
/**
|
||||
* Get the hibernate dialect.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
// TODO: It would be nice to remove this method, if possible
|
||||
Dialect getDialect();
|
||||
|
||||
}
|
|
@ -20,11 +20,15 @@
|
|||
package com.raytheon.uf.edex.datadelivery.bandwidth.hibernate;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.hibernate.jdbc.Work;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrieval;
|
||||
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalStatus;
|
||||
|
||||
/**
|
||||
* * DAO that handles {@link SubscriptionRetrieval} instances.
|
||||
|
@ -37,7 +41,8 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrieval;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 13, 2013 1543 djohnson Initial creation
|
||||
* Feb 22, 2013 1543 djohnson Made public as YAJSW doesn't like Spring exceptions.
|
||||
* 4/9/2013 1802 bphillip Changed to use new query method signatures in SessionManagedDao
|
||||
* 4/9/2013 1802 bphillip Changed to use new query method signatures in SessionManagedDao
|
||||
* Jun 03, 2013 2038 djohnson Add method to get subscription retrievals by provider, dataset, and status.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -48,17 +53,21 @@ public class SubscriptionRetrievalDao extends
|
|||
BaseBandwidthAllocationDao<SubscriptionRetrieval> implements
|
||||
ISubscriptionRetrievalDao {
|
||||
|
||||
private static final String GET_SUBSCRIPTIONRETRIEVAL_BY_PROVIDER_AND_DATASET_BASE = "from SubscriptionRetrieval sr where "
|
||||
+ " sr.bandwidthSubscription.id in ("
|
||||
+ " select sub.id from BandwidthSubscription sub where "
|
||||
+ " sub.provider = :provider and "
|
||||
+ " sub.dataSetName = :dataSetName";
|
||||
private static final String GET_SUBSCRIPTIONRETRIEVAL_BY_PROVIDER_AND_DATASET = "from SubscriptionRetrieval sr where "
|
||||
+ "sr.bandwidthSubscription.provider = :provider and "
|
||||
+ "sr.bandwidthSubscription.dataSetName = :dataSetName";
|
||||
|
||||
private static final String GET_SUBSCRIPTIONRETRIEVAL_BY_PROVIDER_AND_DATASET = GET_SUBSCRIPTIONRETRIEVAL_BY_PROVIDER_AND_DATASET_BASE
|
||||
+ ")";
|
||||
private static final String GET_SUBSCRIPTIONRETRIEVAL_BY_PROVIDER_AND_DATASET_AND_BASEREFERENCETIME = GET_SUBSCRIPTIONRETRIEVAL_BY_PROVIDER_AND_DATASET
|
||||
+ " and sr.bandwidthSubscription.baseReferenceTime = :baseReferenceTime)";
|
||||
|
||||
private static final String GET_SUBSCRIPTIONRETRIEVAL_BY_PROVIDER_AND_DATASET_AND_BASEREFERENCETIME = GET_SUBSCRIPTIONRETRIEVAL_BY_PROVIDER_AND_DATASET_BASE
|
||||
+ " and sub.baseReferenceTime = :baseReferenceTime)";
|
||||
private static final String GET_SUBSCRIPTIONRETRIEVAL_BY_PROVIDER_AND_DATASET_AND_STATUS = GET_SUBSCRIPTIONRETRIEVAL_BY_PROVIDER_AND_DATASET
|
||||
+ " and sr.status = :status order by sr.startTime";
|
||||
|
||||
private static final String GET_SUBSCRIPTIONRETRIEVAL_BY_PROVIDER_DATASET_STATUS_AND_DATES = GET_SUBSCRIPTIONRETRIEVAL_BY_PROVIDER_AND_DATASET
|
||||
+ " and sr.status = :status"
|
||||
+ " and sr.startTime >= :startDate"
|
||||
+ " and sr.startTime <= :endDate"
|
||||
+ " order by sr.startTime ";
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
|
@ -87,15 +96,66 @@ public class SubscriptionRetrievalDao extends
|
|||
public List<SubscriptionRetrieval> getByProviderDataSet(String provider,
|
||||
String dataSetName) {
|
||||
return query(GET_SUBSCRIPTIONRETRIEVAL_BY_PROVIDER_AND_DATASET,
|
||||
"provider", provider, "dataSetName", dataSetName);
|
||||
"provider", provider, "dataSetName", dataSetName);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
// TODO: Remove the requirement of this method
|
||||
public void doWork(Work work) {
|
||||
template.getSessionFactory().getCurrentSession().doWork(work);
|
||||
public SortedSet<SubscriptionRetrieval> getByProviderDataSetAndStatus(
|
||||
String provider, String dataSetName, RetrievalStatus status) {
|
||||
|
||||
final List<SubscriptionRetrieval> results = query(
|
||||
GET_SUBSCRIPTIONRETRIEVAL_BY_PROVIDER_AND_DATASET_AND_STATUS,
|
||||
"provider", provider, "dataSetName", dataSetName, "status",
|
||||
status);
|
||||
|
||||
return orderByStart(results);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public SortedSet<SubscriptionRetrieval> getByProviderDataSetStatusAndDateRange(
|
||||
String provider, String dataSetName, RetrievalStatus status,
|
||||
Date earliestDate, Date latestDate) {
|
||||
|
||||
final Calendar startDate = Calendar.getInstance();
|
||||
startDate.setTime(earliestDate);
|
||||
|
||||
final Calendar endDate = Calendar.getInstance();
|
||||
endDate.setTime(latestDate);
|
||||
|
||||
final List<SubscriptionRetrieval> results = query(
|
||||
GET_SUBSCRIPTIONRETRIEVAL_BY_PROVIDER_DATASET_STATUS_AND_DATES,
|
||||
"provider", provider, "dataSetName", dataSetName, "status",
|
||||
status, "startDate", startDate, "endDate", endDate);
|
||||
|
||||
return orderByStart(results);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link SortedSet} that orders the subscription retrievals by
|
||||
* start date.
|
||||
*
|
||||
* @param results
|
||||
* the results
|
||||
* @return the set
|
||||
*/
|
||||
private SortedSet<SubscriptionRetrieval> orderByStart(
|
||||
List<SubscriptionRetrieval> results) {
|
||||
final TreeSet<SubscriptionRetrieval> treeSet = Sets
|
||||
.newTreeSet(new Comparator<SubscriptionRetrieval>() {
|
||||
@Override
|
||||
public int compare(SubscriptionRetrieval o1,
|
||||
SubscriptionRetrieval o2) {
|
||||
return o1.getStartTime().compareTo(o2.getStartTime());
|
||||
}
|
||||
});
|
||||
treeSet.addAll(results);
|
||||
return treeSet;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import java.util.List;
|
|||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Network;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Provider;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ProviderType;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.SubscriptionBundle;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
|
||||
|
@ -186,6 +187,9 @@ public class SubscriptionRetrievalAgent extends
|
|||
timer.start();
|
||||
|
||||
final int numberOfRetrievals = retrievals.size();
|
||||
final ProviderType providerType = bundle.getProvider()
|
||||
.getProviderType(bundle.getDataType());
|
||||
final String plugin = providerType.getPlugin();
|
||||
for (int i = 0; i < numberOfRetrievals; i++) {
|
||||
Retrieval retrieval = retrievals.get(i);
|
||||
RetrievalRequestRecord rec = new RetrievalRequestRecord(
|
||||
|
@ -196,7 +200,7 @@ public class SubscriptionRetrievalAgent extends
|
|||
rec.setInsertTime(insertTime);
|
||||
rec.setNetwork(retrieval.getNetwork());
|
||||
rec.setProvider(provider);
|
||||
rec.setPlugin(retrieval.getProviderType().getPlugin());
|
||||
rec.setPlugin(plugin);
|
||||
rec.setSubscriptionType(retrieval.getSubscriptionType());
|
||||
|
||||
try {
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
**/
|
||||
package com.raytheon.uf.edex.datadelivery.bandwidth.util;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
|
@ -26,7 +27,7 @@ import java.util.List;
|
|||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.raytheon.uf.common.datadelivery.registry.AdhocSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Time;
|
||||
|
@ -55,6 +56,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalStatus;
|
|||
* Oct 24, 2012 1286 djohnson Extract methods from {@link BandwidthUtil}.
|
||||
* Dec 11, 2012 1286 djohnson FULFILLED allocations are not in the retrieval plan either.
|
||||
* Feb 14, 2013 1595 djohnson Fix not using calendar copies, and backwards max/min operations.
|
||||
* Jun 03, 2013 2038 djohnson Add ability to schedule down to minute granularity.
|
||||
* Jun 04, 2013 223 mpduff Refactor changes.
|
||||
*
|
||||
* </pre>
|
||||
|
@ -96,24 +98,8 @@ public class BandwidthDaoUtil {
|
|||
*/
|
||||
public SortedSet<Calendar> getRetrievalTimes(Subscription subscription,
|
||||
SortedSet<Integer> cycles) {
|
||||
|
||||
// TODO: Will need to address this calculation where obs are considered,
|
||||
// not sure how the Time Object will be used to communicate all the
|
||||
// times that an observation subscription should be fulfilled. For now,
|
||||
// assume grid and move on.
|
||||
SortedSet<Calendar> subscriptionTimes = new TreeSet<Calendar>();
|
||||
|
||||
// TODO: Can't schedule subscriptions without cycles, yet...
|
||||
if (cycles.size() == 0) {
|
||||
return subscriptionTimes;
|
||||
}
|
||||
|
||||
RetrievalPlan plan = retrievalManager.getPlan(subscription.getRoute());
|
||||
if (plan == null) {
|
||||
return subscriptionTimes;
|
||||
}
|
||||
|
||||
return getRetrievalTimes(subscription, cycles, plan, subscriptionTimes);
|
||||
return getRetrievalTimes(subscription, cycles,
|
||||
Sets.newTreeSet(Arrays.asList(0)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -121,15 +107,47 @@ public class BandwidthDaoUtil {
|
|||
* the current retrieval plan for the specified subscription.
|
||||
*
|
||||
* @param subscription
|
||||
* @param cycles
|
||||
* @param plan
|
||||
* @param subscriptionTimes
|
||||
* @param retrievalInterval
|
||||
* the retrieval interval
|
||||
* @return the retrieval times
|
||||
*/
|
||||
public SortedSet<Calendar> getRetrievalTimes(Subscription subscription,
|
||||
int retrievalInterval) {
|
||||
// Add all hours of the days
|
||||
final SortedSet<Integer> hours = Sets.newTreeSet();
|
||||
for (int i = 0; i < TimeUtil.HOURS_PER_DAY; i++) {
|
||||
hours.add(i);
|
||||
}
|
||||
|
||||
// Add every minute of the hour that is a multiple of the retrieval
|
||||
// interval
|
||||
final SortedSet<Integer> minutes = Sets.newTreeSet();
|
||||
for (int i = 0; i < TimeUtil.MINUTES_PER_HOUR; i += retrievalInterval) {
|
||||
minutes.add(i);
|
||||
}
|
||||
|
||||
return getRetrievalTimes(subscription, hours, minutes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate all the retrieval times for a subscription that should be in
|
||||
* the current retrieval plan for the specified subscription.
|
||||
*
|
||||
* @param subscription
|
||||
* @param hours
|
||||
* @param minutes
|
||||
* @return
|
||||
*/
|
||||
@VisibleForTesting
|
||||
SortedSet<Calendar> getRetrievalTimes(Subscription subscription,
|
||||
SortedSet<Integer> cycles, RetrievalPlan plan,
|
||||
SortedSet<Calendar> subscriptionTimes) {
|
||||
private SortedSet<Calendar> getRetrievalTimes(Subscription subscription,
|
||||
SortedSet<Integer> hours, SortedSet<Integer> minutes) {
|
||||
|
||||
SortedSet<Calendar> subscriptionTimes = new TreeSet<Calendar>();
|
||||
|
||||
RetrievalPlan plan = retrievalManager.getPlan(subscription.getRoute());
|
||||
if (plan == null) {
|
||||
return subscriptionTimes;
|
||||
}
|
||||
|
||||
Calendar planEnd = plan.getPlanEnd();
|
||||
Calendar planStart = plan.getPlanStart();
|
||||
|
||||
|
@ -200,24 +218,24 @@ public class BandwidthDaoUtil {
|
|||
|
||||
outerloop: while (!subscriptionStartDate.after(subscriptionEndDate)) {
|
||||
|
||||
for (Integer cycle : cycles) {
|
||||
// TODO: VERY grid specific. Should be transitioned to minutes?
|
||||
// to support obs
|
||||
// or rapidly (less than an hour) updated datasets..
|
||||
for (Integer cycle : hours) {
|
||||
subscriptionStartDate.set(Calendar.HOUR_OF_DAY, cycle);
|
||||
if (subscriptionStartDate.after(subscriptionEndDate)) {
|
||||
break outerloop;
|
||||
} else {
|
||||
Calendar time = TimeUtil.newCalendar();
|
||||
time.setTimeInMillis(subscriptionStartDate
|
||||
.getTimeInMillis());
|
||||
subscriptionTimes.add(time);
|
||||
for (Integer minute : minutes) {
|
||||
subscriptionStartDate.set(Calendar.MINUTE, minute);
|
||||
if (subscriptionStartDate.after(subscriptionEndDate)) {
|
||||
break outerloop;
|
||||
} else {
|
||||
Calendar time = TimeUtil.newCalendar();
|
||||
time.setTimeInMillis(subscriptionStartDate
|
||||
.getTimeInMillis());
|
||||
subscriptionTimes.add(time);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Start the next day..
|
||||
subscriptionStartDate.add(Calendar.DAY_OF_YEAR, 1);
|
||||
subscriptionStartDate.set(Calendar.HOUR_OF_DAY, cycles.first());
|
||||
subscriptionStartDate.set(Calendar.HOUR_OF_DAY, hours.first());
|
||||
}
|
||||
|
||||
// Now walk the subscription times and throw away anything outside the
|
||||
|
@ -313,7 +331,7 @@ public class BandwidthDaoUtil {
|
|||
if (statusHandler.isPriorityEnabled(Priority.DEBUG)) {
|
||||
statusHandler
|
||||
.debug(String
|
||||
.format("There wasn't applicable most recent dataset metadata to use for the adhoc subscription [%].",
|
||||
.format("There wasn't applicable most recent dataset metadata to use for the adhoc subscription [%s].",
|
||||
adhoc.getName()));
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -0,0 +1,128 @@
|
|||
/**
|
||||
* 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.util;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.raytheon.uf.common.datadelivery.registry.DataDeliveryRegistryObjectTypes;
|
||||
import com.raytheon.uf.common.datadelivery.registry.DataType;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Provider;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ProviderType;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.IProviderHandler;
|
||||
import com.raytheon.uf.common.event.EventBus;
|
||||
import com.raytheon.uf.common.registry.event.RegistryEvent;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
||||
|
||||
/**
|
||||
* Uses provider configured values for the availability delay.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 05, 2013 2038 djohnson Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class ProviderDataTypeAvailabilityCalculator implements
|
||||
IDataSetAvailablityCalculator {
|
||||
|
||||
private static final Provider PROVIDER_NOT_FOUND = new Provider();
|
||||
|
||||
private final LoadingCache<String, Provider> providerCache;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public ProviderDataTypeAvailabilityCalculator(
|
||||
final IProviderHandler providerHandler) {
|
||||
|
||||
// TODO: This should probably be moved inside the registry handler
|
||||
// itself
|
||||
this.providerCache = CacheBuilder.newBuilder().build(
|
||||
new CacheLoader<String, Provider>() {
|
||||
@Override
|
||||
public Provider load(String key)
|
||||
throws RegistryHandlerException {
|
||||
Provider provider = providerHandler
|
||||
.getByName(key);
|
||||
if (provider == null) {
|
||||
provider = PROVIDER_NOT_FOUND;
|
||||
}
|
||||
return provider;
|
||||
}
|
||||
});
|
||||
|
||||
EventBus.register(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int getDataSetAvailablityDelay(Subscription subscription) {
|
||||
final String providerName = subscription.getProvider();
|
||||
final DataType dataType = subscription.getDataSetType();
|
||||
|
||||
try {
|
||||
Provider provider = this.providerCache.get(providerName);
|
||||
|
||||
if (provider == PROVIDER_NOT_FOUND) {
|
||||
throw new IllegalArgumentException(
|
||||
"No availability delay registered for provider "
|
||||
+ providerName + " for data type " + dataType);
|
||||
}
|
||||
|
||||
final ProviderType providerType = provider
|
||||
.getProviderType(dataType);
|
||||
|
||||
if (providerType == null) {
|
||||
throw new IllegalArgumentException(
|
||||
"No availability delay registered for provider "
|
||||
+ providerName + " for data type " + dataType);
|
||||
}
|
||||
return providerType.getAvailabilityDelay();
|
||||
} catch (ExecutionException e) {
|
||||
throw new IllegalStateException(
|
||||
"Exception querying for the provider!", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void registryEventListener(RegistryEvent re) {
|
||||
final String objectType = re.getObjectType();
|
||||
|
||||
// If a provider event happens then expire the entire cache
|
||||
if (DataDeliveryRegistryObjectTypes.PROVIDER.equals(objectType)) {
|
||||
providerCache.invalidateAll();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -230,7 +230,8 @@ class FileCommunicationStrategy implements CommunicationStrategy {
|
|||
coll.setFirstDate(pc.getFirstDateFormatted());
|
||||
// TODO: figure a default data type and projection
|
||||
// strategy other than just the first one.
|
||||
coll.setDataType(provider.getProviderType().get(0));
|
||||
coll.setDataType(provider.getProviderType().get(0)
|
||||
.getDataType());
|
||||
coll.setProjection(provider.getProjection().get(0).getType());
|
||||
coll.setPeriodicity(pc.getPeriodicity());
|
||||
coll.setUrlKey(pc.getUrlKey());
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
!!!!!PLACE YOUR URL HERE!!!!!!-->
|
||||
<url>http://your.url.here:8085</url>
|
||||
</connection>
|
||||
<providerType>Point</providerType>
|
||||
<providerType dataType="POINT" plugin="madis" availabilityDelay="0" />
|
||||
<projection type="LatLon">
|
||||
<name>MadisLatLon</name>
|
||||
<description>MADIS Test LatLon Coverage</description>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<harvester>
|
||||
<!-- Provider information -->
|
||||
<provider serviceType="OPENDAP" name="NOMADS">
|
||||
<providerType>Grid</providerType>
|
||||
<providerType dataType="GRID" plugin="grid" availabilityDelay="100" />
|
||||
<projection type="LatLon">
|
||||
<name>NomadsLatLon</name>
|
||||
<description>Test LatLonGrid Coverage for NOMADS</description>
|
||||
|
@ -56,7 +56,7 @@
|
|||
<maxSeedDepth>-1</maxSeedDepth>
|
||||
<maxMainDepth>2</maxMainDepth>
|
||||
<!-- Commented out so you can run your own seed scan -->
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="narre">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="narre">
|
||||
<seedUrl>narre</seedUrl>
|
||||
<urlKey>narre</urlKey>
|
||||
<periodicity>day</periodicity>
|
||||
|
@ -64,7 +64,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="wave_nah">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="wave_nah">
|
||||
<parameterLookup>wave_nahParameterLookup</parameterLookup>
|
||||
<seedUrl>wave/nah</seedUrl>
|
||||
<urlKey>nah</urlKey>
|
||||
|
@ -73,7 +73,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="wave_akw">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="wave_akw">
|
||||
<parameterLookup>wave_akwParameterLookup</parameterLookup>
|
||||
<seedUrl>wave/akw</seedUrl>
|
||||
<urlKey>akw</urlKey>
|
||||
|
@ -82,7 +82,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="gfs">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="gfs">
|
||||
<parameterLookup>gfsParameterLookup</parameterLookup>
|
||||
<levelLookup>gfsLevelLookup</levelLookup>
|
||||
<seedUrl>gfs</seedUrl>
|
||||
|
@ -92,7 +92,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="wave_wna">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="wave_wna">
|
||||
<parameterLookup>wave_wnaParameterLookup</parameterLookup>
|
||||
<seedUrl>wave/wna</seedUrl>
|
||||
<urlKey>wna</urlKey>
|
||||
|
@ -101,7 +101,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="wave_nfcens">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="wave_nfcens">
|
||||
<seedUrl>wave/nfcens</seedUrl>
|
||||
<urlKey></urlKey>
|
||||
<periodicity>day</periodicity>
|
||||
|
@ -109,7 +109,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="wave_mww3">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="wave_mww3">
|
||||
<parameterLookup>wave_mww3ParameterLookup</parameterLookup>
|
||||
<seedUrl>wave/mww3</seedUrl>
|
||||
<urlKey></urlKey>
|
||||
|
@ -118,7 +118,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="wave_nph">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="wave_nph">
|
||||
<parameterLookup>wave_nphParameterLookup</parameterLookup>
|
||||
<seedUrl>wave/nph</seedUrl>
|
||||
<urlKey>nph</urlKey>
|
||||
|
@ -127,7 +127,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="wave_nww3">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="wave_nww3">
|
||||
<parameterLookup>wave_nww3ParameterLookup</parameterLookup>
|
||||
<seedUrl>wave/nww3</seedUrl>
|
||||
<urlKey>nww3</urlKey>
|
||||
|
@ -136,7 +136,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="gfs_hd">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="gfs_hd">
|
||||
<parameterLookup>gfs_hdParameterLookup</parameterLookup>
|
||||
<levelLookup>gfs_hdLevelLookup</levelLookup>
|
||||
<seedUrl>gfs_hd</seedUrl>
|
||||
|
@ -146,7 +146,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="wave_glw">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="wave_glw">
|
||||
<seedUrl>wave/glw</seedUrl>
|
||||
<urlKey>glw</urlKey>
|
||||
<periodicity>day</periodicity>
|
||||
|
@ -154,7 +154,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="wave_enp">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="wave_enp">
|
||||
<parameterLookup>wave_enpParameterLookup</parameterLookup>
|
||||
<seedUrl>wave/enp</seedUrl>
|
||||
<urlKey>enp</urlKey>
|
||||
|
@ -163,7 +163,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="gfs_2p5">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="gfs_2p5">
|
||||
<parameterLookup>gfs_2p5ParameterLookup</parameterLookup>
|
||||
<levelLookup>gfs_2p5LevelLookup</levelLookup>
|
||||
<seedUrl>gfs_2p5</seedUrl>
|
||||
|
@ -173,7 +173,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="hiresw">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="hiresw">
|
||||
<parameterLookup>hireswParameterLookup</parameterLookup>
|
||||
<levelLookup>hireswLevelLookup</levelLookup>
|
||||
<seedUrl>hiresw</seedUrl>
|
||||
|
@ -183,7 +183,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="cmcens">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="cmcens">
|
||||
<parameterLookup>cmcensParameterLookup</parameterLookup>
|
||||
<levelLookup>cmcensLevelLookup</levelLookup>
|
||||
<seedUrl>cmcens</seedUrl>
|
||||
|
@ -193,7 +193,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="nam">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="nam">
|
||||
<parameterLookup>namParameterLookup</parameterLookup>
|
||||
<levelLookup>namLevelLookup</levelLookup>
|
||||
<seedUrl>nam</seedUrl>
|
||||
|
@ -203,7 +203,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="sref">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="sref">
|
||||
<parameterLookup>srefParameterLookup</parameterLookup>
|
||||
<levelLookup>srefLevelLookup</levelLookup>
|
||||
<seedUrl>sref</seedUrl>
|
||||
|
@ -213,7 +213,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="sref_bc">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="sref_bc">
|
||||
<parameterLookup>sref_bcParameterLookup</parameterLookup>
|
||||
<levelLookup>sref_bcLevelLookup</levelLookup>
|
||||
<seedUrl>sref_bc</seedUrl>
|
||||
|
@ -223,7 +223,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="ofs_hires">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="ofs_hires">
|
||||
<parameterLookup>ofs_hiresParameterLookup</parameterLookup>
|
||||
<levelLookup>ofs_hiresLevelLookup</levelLookup>
|
||||
<seedUrl>ofs/hires</seedUrl>
|
||||
|
@ -233,7 +233,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="ofs">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="ofs">
|
||||
<parameterLookup>ofsParameterLookup</parameterLookup>
|
||||
<levelLookup>ofsLevelLookup</levelLookup>
|
||||
<seedUrl>ofs</seedUrl>
|
||||
|
@ -243,7 +243,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="akrtma">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="akrtma">
|
||||
<seedUrl>akrtma</seedUrl>
|
||||
<urlKey>akrtma</urlKey>
|
||||
<periodicity>day</periodicity>
|
||||
|
@ -251,7 +251,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="fens">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="fens">
|
||||
<parameterLookup>fensParameterLookup</parameterLookup>
|
||||
<levelLookup>fensLevelLookup</levelLookup>
|
||||
<seedUrl>fens</seedUrl>
|
||||
|
@ -261,7 +261,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="rtofs">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="rtofs">
|
||||
<parameterLookup>rtofsParameterLookup</parameterLookup>
|
||||
<levelLookup>rtofsLevelLookup</levelLookup>
|
||||
<seedUrl>rtofs</seedUrl>
|
||||
|
@ -271,7 +271,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="ice">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="ice">
|
||||
<parameterLookup>iceParameterLookup</parameterLookup>
|
||||
<seedUrl>ice</seedUrl>
|
||||
<urlKey>ice</urlKey>
|
||||
|
@ -280,7 +280,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="rtma2p5">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="rtma2p5">
|
||||
<seedUrl>rtma2p5</seedUrl>
|
||||
<urlKey>rtma2p5</urlKey>
|
||||
<periodicity>day</periodicity>
|
||||
|
@ -288,7 +288,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="gurtma">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="gurtma">
|
||||
<parameterLookup>gurtmaParameterLookup</parameterLookup>
|
||||
<levelLookup>gurtmaLevelLookup</levelLookup>
|
||||
<seedUrl>gurtma</seedUrl>
|
||||
|
@ -298,7 +298,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="naefs_bc">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="naefs_bc">
|
||||
<parameterLookup>naefs_bcParameterLookup</parameterLookup>
|
||||
<levelLookup>naefs_bcLevelLookup</levelLookup>
|
||||
<seedUrl>naefs_bc</seedUrl>
|
||||
|
@ -308,7 +308,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="rap">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="rap">
|
||||
<parameterLookup>rapParameterLookup</parameterLookup>
|
||||
<levelLookup>rapLevelLookup</levelLookup>
|
||||
<seedUrl>rap</seedUrl>
|
||||
|
@ -318,7 +318,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="naefs_ndgd">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="naefs_ndgd">
|
||||
<parameterLookup>naefs_ndgdParameterLookup</parameterLookup>
|
||||
<levelLookup>naefs_ndgdLevelLookup</levelLookup>
|
||||
<seedUrl>naefs_ndgd</seedUrl>
|
||||
|
@ -328,7 +328,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="rtma">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="rtma">
|
||||
<parameterLookup>rtmaParameterLookup</parameterLookup>
|
||||
<levelLookup>rtmaLevelLookup</levelLookup>
|
||||
<seedUrl>rtma</seedUrl>
|
||||
|
@ -338,7 +338,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="aqm">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="aqm">
|
||||
<parameterLookup>aqmParameterLookup</parameterLookup>
|
||||
<levelLookup>aqmLevelLookup</levelLookup>
|
||||
<seedUrl>aqm</seedUrl>
|
||||
|
@ -348,7 +348,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="ncom">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="ncom">
|
||||
<seedUrl>ncom</seedUrl>
|
||||
<urlKey>ncom</urlKey>
|
||||
<periodicity>day</periodicity>
|
||||
|
@ -356,7 +356,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="estofs">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="estofs">
|
||||
<seedUrl>estofs</seedUrl>
|
||||
<urlKey></urlKey>
|
||||
<periodicity>day</periodicity>
|
||||
|
@ -364,7 +364,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="fnl">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="fnl">
|
||||
<parameterLookup>fnlParameterLookup</parameterLookup>
|
||||
<seedUrl>fnl</seedUrl>
|
||||
<urlKey>fnl</urlKey>
|
||||
|
@ -373,7 +373,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="hirtma">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="hirtma">
|
||||
<seedUrl>hirtma</seedUrl>
|
||||
<urlKey>hirtma</urlKey>
|
||||
<periodicity>day</periodicity>
|
||||
|
@ -381,7 +381,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="prrtma">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="prrtma">
|
||||
<parameterLookup>prrtmaParameterLookup</parameterLookup>
|
||||
<levelLookup>prrtmaLevelLookup</levelLookup>
|
||||
<seedUrl>prrtma</seedUrl>
|
||||
|
@ -391,7 +391,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="gens_bc">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="gens_bc">
|
||||
<parameterLookup>gens_bcParameterLookup</parameterLookup>
|
||||
<levelLookup>gens_bcLevelLookup</levelLookup>
|
||||
<seedUrl>gens_bc</seedUrl>
|
||||
|
@ -401,7 +401,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="gens">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="gens">
|
||||
<parameterLookup>gensParameterLookup</parameterLookup>
|
||||
<levelLookup>gensLevelLookup</levelLookup>
|
||||
<seedUrl>gens</seedUrl>
|
||||
|
@ -411,7 +411,7 @@
|
|||
<lastDate>20121108</lastDate>
|
||||
<dateFormat>yyyyMMdd</dateFormat>
|
||||
</collection>
|
||||
<collection projection="LatLon" dataType="Grid" ignore="false" name="gens_ndgd">
|
||||
<collection projection="LatLon" dataType="GRID" ignore="false" name="gens_ndgd">
|
||||
<parameterLookup>gens_ndgdParameterLookup</parameterLookup>
|
||||
<levelLookup>gens_ndgdLevelLookup</levelLookup>
|
||||
<seedUrl>gens_ndgd</seedUrl>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<!-- for OGC it's your FQDN -->
|
||||
<url>http://your.url.here:8085</url>
|
||||
</connection>
|
||||
<providerType>Point</providerType>
|
||||
<providerType dataType="POINT" plugin="madis" availabilityDelay="0" />
|
||||
<projection type="LatLon">
|
||||
<name>MetarLatLon</name>
|
||||
<description>METAR Test LatLon Coverage</description>
|
||||
|
|
|
@ -25,6 +25,7 @@ import java.util.Calendar;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.ProviderType;
|
||||
import com.raytheon.uf.common.datadelivery.registry.SubscriptionBundle;
|
||||
import com.raytheon.uf.common.datadelivery.retrieval.xml.Retrieval;
|
||||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
||||
|
@ -85,9 +86,6 @@ public class RetrievalGenerationHandler implements IGenerateRetrieval {
|
|||
List<Retrieval> retrievals = rg.buildRetrieval(bundle);
|
||||
|
||||
if (!CollectionUtil.isNullOrEmpty(retrievals)) {
|
||||
// need to track in case something fails early
|
||||
int numFinished = 0;
|
||||
|
||||
String owner = bundle.getSubscription().getOwner();
|
||||
String provider = bundle.getSubscription().getProvider();
|
||||
int priority = 3;
|
||||
|
@ -101,12 +99,15 @@ public class RetrievalGenerationHandler implements IGenerateRetrieval {
|
|||
retrievals.size());
|
||||
long cumultTime1 = 0;
|
||||
int index = 0;
|
||||
final ProviderType providerType = bundle.getProvider()
|
||||
.getProviderType(bundle.getDataType());
|
||||
final String plugin = providerType.getPlugin();
|
||||
for (Retrieval retrieval : retrievals) {
|
||||
|
||||
RetrievalRequestRecord rec = new RetrievalRequestRecord(
|
||||
subscriptionName, index++, -1L);
|
||||
rec.setOwner(owner);
|
||||
rec.setPlugin(retrieval.getProviderType().getPlugin());
|
||||
rec.setPlugin(plugin);
|
||||
rec.setProvider(provider);
|
||||
rec.setSubscriptionType(retrieval.getSubscriptionType());
|
||||
rec.setNetwork(retrieval.getNetwork());
|
||||
|
@ -125,7 +126,6 @@ public class RetrievalGenerationHandler implements IGenerateRetrieval {
|
|||
+ subscriptionName
|
||||
+ " Failed to serialize request ["
|
||||
+ retrieval + "]", e);
|
||||
numFinished++;
|
||||
rec.setRetrieval(new byte[0]);
|
||||
rec.setState(State.FAILED);
|
||||
}
|
||||
|
|
|
@ -36,8 +36,9 @@ import com.raytheon.uf.common.datadelivery.registry.GriddedDataSetMetaData;
|
|||
import com.raytheon.uf.common.datadelivery.registry.Levels;
|
||||
import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSet;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Parameter;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Provider.ProviderType;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Provider;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Provider.ServiceType;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ProviderType;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.SubscriptionBundle;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Time;
|
||||
|
@ -402,11 +403,7 @@ class OpenDAPRetrievalGenerator extends RetrievalGenerator {
|
|||
|
||||
// Coverage and type processing
|
||||
Coverage cov = sub.getCoverage();
|
||||
ProviderType pt = null;
|
||||
if (cov instanceof GriddedCoverage){
|
||||
pt = ProviderType.GRID;
|
||||
retrieval.setProviderType(pt);
|
||||
} else {
|
||||
if (!(cov instanceof GriddedCoverage)) {
|
||||
throw new UnsupportedOperationException(
|
||||
"OPENDAP retrieval does not yet support coverages other than Gridded. ");
|
||||
}
|
||||
|
@ -420,7 +417,18 @@ class OpenDAPRetrievalGenerator extends RetrievalGenerator {
|
|||
att.setParameter(lparam);
|
||||
att.setEnsemble(ensemble);
|
||||
att.setSubName(retrieval.getSubscriptionName());
|
||||
att.setPlugin(pt.getPlugin());
|
||||
Provider provider;
|
||||
try {
|
||||
provider = DataDeliveryHandlers.getProviderHandler().getByName(
|
||||
sub.getProvider());
|
||||
} catch (RegistryHandlerException e) {
|
||||
throw new IllegalArgumentException(
|
||||
"Error looking up the provider!", e);
|
||||
}
|
||||
// Look up the provider's configured plugin for this data type
|
||||
ProviderType providerType = provider.getProviderType(sub
|
||||
.getDataSetType());
|
||||
att.setPlugin(providerType.getPlugin());
|
||||
att.setProvider(sub.getProvider());
|
||||
retrieval.addAttribute(att);
|
||||
|
||||
|
|
|
@ -19,9 +19,11 @@
|
|||
**/
|
||||
package com.raytheon.uf.edex.datadelivery.bandwidth;
|
||||
|
||||
import static org.hamcrest.Matchers.contains;
|
||||
import static org.hamcrest.Matchers.empty;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
import static org.hamcrest.Matchers.hasSize;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.hamcrest.Matchers.sameInstance;
|
||||
|
@ -48,11 +50,15 @@ import java.util.concurrent.CountDownLatch;
|
|||
import org.junit.Test;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.DataDeliveryRegistryObjectTypes;
|
||||
import com.raytheon.uf.common.datadelivery.registry.DataType;
|
||||
import com.raytheon.uf.common.datadelivery.registry.GriddedDataSetMetaData;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Network;
|
||||
import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSetMetaData;
|
||||
import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSetMetaDataFixture;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ParameterFixture;
|
||||
import com.raytheon.uf.common.datadelivery.registry.PointDataSetMetaData;
|
||||
import com.raytheon.uf.common.datadelivery.registry.PointDataSetMetaDataFixture;
|
||||
import com.raytheon.uf.common.datadelivery.registry.PointTime;
|
||||
import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.SiteSubscriptionFixture;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
|
@ -98,6 +104,7 @@ import com.raytheon.uf.edex.datadelivery.retrieval.RetrievalManagerNotifyEvent;
|
|||
* Mar 11, 2013 1645 djohnson Test configuration file modifications.
|
||||
* Mar 28, 2013 1841 djohnson Subscription is now UserSubscription.
|
||||
* Apr 29, 2013 1910 djohnson Always shutdown bandwidth managers in tests.
|
||||
* Jun 03, 2013 2038 djohnson Add support for point data based subscriptions.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -120,6 +127,29 @@ public class BandwidthManagerIntTest extends AbstractWfoBandwidthManagerIntTest
|
|||
1, 2, 3));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddingPointSubscriptionAllocatesAccordingToInterval()
|
||||
throws SerializationException {
|
||||
final int retrievalInterval = 10;
|
||||
Subscription subscription = getPointDataSubscription(retrievalInterval);
|
||||
|
||||
bandwidthManager.subscriptionUpdated(subscription);
|
||||
|
||||
// 6 per hour, one every 10 minutes
|
||||
final int expectedRetrievalsPerDay = TimeUtil.HOURS_PER_DAY
|
||||
* (TimeUtil.MINUTES_PER_HOUR / retrievalInterval);
|
||||
final int planDays = retrievalManager.getPlan(subscription.getRoute())
|
||||
.getPlanDays();
|
||||
// The number of retrievals per hour, per day, plus 1 because the last
|
||||
// retrieval starts at the very last time in the retrieval plan
|
||||
final int expectedNumberOfRetrievals = (planDays * expectedRetrievalsPerDay) + 1;
|
||||
|
||||
assertEquals("Incorrect number of bandwidth allocations made!",
|
||||
expectedNumberOfRetrievals, bandwidthDao
|
||||
.getBandwidthAllocations(subscription.getRoute())
|
||||
.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDataSetMetaDataUpdateSetsSubscriptionRetrievalsToReady()
|
||||
throws SerializationException, ParseException {
|
||||
|
@ -128,7 +158,7 @@ public class BandwidthManagerIntTest extends AbstractWfoBandwidthManagerIntTest
|
|||
|
||||
OpenDapGriddedDataSetMetaData metadata = OpenDapGriddedDataSetMetaDataFixture.INSTANCE
|
||||
.get();
|
||||
bandwidthManager.updateDataSetMetaData(metadata);
|
||||
bandwidthManager.updateGriddedDataSetMetaData(metadata);
|
||||
|
||||
Calendar cal = TimeUtil.newCalendar();
|
||||
cal.setTime(metadata.getDate());
|
||||
|
@ -142,6 +172,65 @@ public class BandwidthManagerIntTest extends AbstractWfoBandwidthManagerIntTest
|
|||
.next().getStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPointDataSetMetaDataUpdateSetsSubscriptionRetrievalsToReady()
|
||||
throws SerializationException, ParseException {
|
||||
|
||||
final int retrievalInterval = 10;
|
||||
final Subscription subscription = getPointDataSubscription(retrievalInterval);
|
||||
final String providerName = subscription.getProvider();
|
||||
final String dataSetName = subscription.getDataSetName();
|
||||
|
||||
bandwidthManager.subscriptionUpdated(subscription);
|
||||
|
||||
final List<SubscriptionRetrieval> subscriptionRetrievals = bandwidthDao
|
||||
.getSubscriptionRetrievals(providerName,
|
||||
dataSetName);
|
||||
|
||||
// We're going to send in a point data update with a time span that
|
||||
// bridges these two retrievals
|
||||
final SubscriptionRetrieval thirdRetrieval = subscriptionRetrievals
|
||||
.get(2);
|
||||
final SubscriptionRetrieval fourthRetrieval = subscriptionRetrievals
|
||||
.get(3);
|
||||
|
||||
// The start time for this point time is in between the third
|
||||
// retrieval's start and end times, minus the retrievalInterval which
|
||||
// becomes the latency
|
||||
final long startTimeForPointTimeInMillis = ((thirdRetrieval
|
||||
.getStartTime().getTimeInMillis() + thirdRetrieval.getEndTime()
|
||||
.getTimeInMillis()) / 2)
|
||||
- (retrievalInterval * TimeUtil.MILLIS_PER_MINUTE);
|
||||
|
||||
// The end time for this point time is in between the fourth retrieval's
|
||||
// start and end times, minus the retrievalInterval which becomes the
|
||||
// latency
|
||||
final long endTimeForPointTimeInMillis = ((fourthRetrieval
|
||||
.getStartTime().getTimeInMillis() + fourthRetrieval
|
||||
.getEndTime().getTimeInMillis()) / 2)
|
||||
- (retrievalInterval * TimeUtil.MILLIS_PER_MINUTE);
|
||||
|
||||
PointTime time = new PointTime();
|
||||
time.setTimes(Arrays.<Date> asList(new Date(
|
||||
startTimeForPointTimeInMillis), new Date(
|
||||
endTimeForPointTimeInMillis)));
|
||||
|
||||
PointDataSetMetaData metadata = PointDataSetMetaDataFixture.INSTANCE
|
||||
.get();
|
||||
metadata.setDataSetName(dataSetName);
|
||||
metadata.setProviderName(providerName);
|
||||
metadata.setTime(time);
|
||||
|
||||
// Send in the new times to the bandwidth manager
|
||||
bandwidthManager.updatePointDataSetMetaData(metadata);
|
||||
|
||||
final SortedSet<SubscriptionRetrieval> readyRetrievals = bandwidthDao
|
||||
.getSubscriptionRetrievals(providerName,
|
||||
dataSetName, RetrievalStatus.READY);
|
||||
assertThat(readyRetrievals, hasSize(2));
|
||||
assertThat(readyRetrievals, contains(thirdRetrieval, fourthRetrieval));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDataSetMetaDataUpdateSetsCorrectTimeOnSubscription()
|
||||
throws SerializationException, ParseException {
|
||||
|
@ -158,7 +247,7 @@ public class BandwidthManagerIntTest extends AbstractWfoBandwidthManagerIntTest
|
|||
metadata.setDate(oneDayLater);
|
||||
|
||||
// Send in the update
|
||||
bandwidthManager.updateDataSetMetaData(metadata);
|
||||
bandwidthManager.updateGriddedDataSetMetaData(metadata);
|
||||
|
||||
Calendar cal = TimeUtil.newCalendar();
|
||||
cal.setTime(metadata.getDate());
|
||||
|
@ -193,7 +282,7 @@ public class BandwidthManagerIntTest extends AbstractWfoBandwidthManagerIntTest
|
|||
dsmdTime.setStartDate(new Date(dsmdTime.getStartDate().getTime()
|
||||
+ TimeUtil.MILLIS_PER_DAY));
|
||||
|
||||
bandwidthManager.updateDataSetMetaData(update);
|
||||
bandwidthManager.updateGriddedDataSetMetaData(update);
|
||||
|
||||
List<SubscriptionRetrieval> retrievals = bandwidthDao
|
||||
.getSubscriptionRetrievals(subscription.getProvider(),
|
||||
|
@ -233,7 +322,7 @@ public class BandwidthManagerIntTest extends AbstractWfoBandwidthManagerIntTest
|
|||
RetrievalPlanTest.resizePlan(plan, TimeUtil.currentTimeMillis(), plan
|
||||
.getPlanEnd().getTimeInMillis());
|
||||
|
||||
bandwidthManager.updateDataSetMetaData(update);
|
||||
bandwidthManager.updateGriddedDataSetMetaData(update);
|
||||
|
||||
List<SubscriptionRetrieval> retrievals = bandwidthDao
|
||||
.getSubscriptionRetrievals(subscription.getProvider(),
|
||||
|
@ -267,7 +356,7 @@ public class BandwidthManagerIntTest extends AbstractWfoBandwidthManagerIntTest
|
|||
RetrievalPlanTest.resizePlan(plan, TimeUtil.currentTimeMillis(), plan
|
||||
.getPlanEnd().getTimeInMillis());
|
||||
|
||||
bandwidthManager.updateDataSetMetaData(update);
|
||||
bandwidthManager.updateGriddedDataSetMetaData(update);
|
||||
|
||||
List<SubscriptionRetrieval> retrievals = bandwidthDao
|
||||
.getSubscriptionRetrievals(subscription.getProvider(),
|
||||
|
@ -668,7 +757,7 @@ public class BandwidthManagerIntTest extends AbstractWfoBandwidthManagerIntTest
|
|||
// working at once
|
||||
waitForAllThreadsReadyLatch.countDown();
|
||||
waitForAllThreadsReadyLatch.await();
|
||||
proposed.updateDataSetMetaData(OpenDapGriddedDataSetMetaDataFixture.INSTANCE
|
||||
proposed.updateGriddedDataSetMetaData(OpenDapGriddedDataSetMetaDataFixture.INSTANCE
|
||||
.get(current));
|
||||
} catch (Exception e) {
|
||||
queue.offer(e);
|
||||
|
@ -983,11 +1072,7 @@ public class BandwidthManagerIntTest extends AbstractWfoBandwidthManagerIntTest
|
|||
List<Integer> cycles) throws SerializationException {
|
||||
Subscription subscription = SiteSubscriptionFixture.INSTANCE.get();
|
||||
subscription.getTime().setCycleTimes(cycles);
|
||||
try {
|
||||
bandwidthManager.subscriptionUpdated(subscription);
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
bandwidthManager.subscriptionUpdated(subscription);
|
||||
|
||||
assertEquals("Incorrect number of bandwidth allocations made!",
|
||||
retrievalManager.getPlan(subscription.getRoute()).getPlanDays()
|
||||
|
@ -1026,4 +1111,22 @@ public class BandwidthManagerIntTest extends AbstractWfoBandwidthManagerIntTest
|
|||
return Network.OPSNET;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a point data subscription with the given retrieval interval.
|
||||
*
|
||||
* @param retrievalInterval
|
||||
* the retrieval interval
|
||||
* @return
|
||||
*/
|
||||
protected Subscription getPointDataSubscription(int retrievalInterval) {
|
||||
final PointTime pointTime = new PointTime();
|
||||
pointTime.setInterval(retrievalInterval);
|
||||
|
||||
Subscription subscription = SiteSubscriptionFixture.INSTANCE.get();
|
||||
subscription.setTime(pointTime);
|
||||
subscription.setDataSetType(DataType.POINT);
|
||||
subscription.setLatencyInMinutes(retrievalInterval);
|
||||
return subscription;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -60,6 +60,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import com.google.common.collect.Lists;
|
||||
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
||||
import com.raytheon.uf.common.util.SpringFiles;
|
||||
import com.raytheon.uf.common.util.TestUtil;
|
||||
import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants;
|
||||
import com.raytheon.uf.edex.registry.ebxml.services.query.QueryManagerImpl.RETURN_TYPE;
|
||||
import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
||||
|
@ -76,6 +77,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
|||
* Apr 15, 2013 1914 djohnson Initial creation
|
||||
* Apr 18, 2013 1693 djohnson Consolidate reusable methods.
|
||||
* Apr 23, 2013 1910 djohnson Allow sub-classes to pass callables and monitor for fault exceptions.
|
||||
* Jun 05, 2013 2038 djohnson Use TestUtil constant for transactionManager.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -94,7 +96,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
|||
SpringFiles.UNIT_TEST_DB_BEANS_XML,
|
||||
SpringFiles.UNIT_TEST_EBXML_BEANS_XML,
|
||||
SpringFiles.UNIT_TEST_LOCALIZATION_BEANS_XML })
|
||||
@TransactionConfiguration(transactionManager = "metadataTxManager", defaultRollback = true)
|
||||
@TransactionConfiguration(transactionManager = TestUtil.METADATA_TX_MANAGER, defaultRollback = true)
|
||||
@Transactional
|
||||
@Ignore
|
||||
public class AbstractRegistryTest {
|
||||
|
|
|
@ -31,4 +31,11 @@
|
|||
factory-method="emptyMap">
|
||||
<!-- No retrievals for integration test -->
|
||||
</bean>
|
||||
|
||||
<bean id="dataSetAvailabilityCalculator"
|
||||
class="com.raytheon.uf.edex.datadelivery.bandwidth.util.SimpleAvailablityCalculator">
|
||||
<property name="delay"
|
||||
value="${bandwidth.dataSetAvailabilityCalculator.delay}" />
|
||||
</bean>
|
||||
|
||||
</beans>
|
|
@ -68,8 +68,7 @@ public abstract class BaseSubscriptionFixture<T extends Subscription> extends
|
|||
.setDataSetName(OpenDapGriddedDataSetMetaDataFixture.INSTANCE
|
||||
.get(seedValue).getDataSetName());
|
||||
subscription.setDataSetSize(seedValue);
|
||||
subscription.setDataSetType(AbstractFixture.randomEnum(DataType.class,
|
||||
random));
|
||||
subscription.setDataSetType(DataType.GRID);
|
||||
subscription.setDeleted(random.nextBoolean());
|
||||
subscription.setDescription("description" + random.nextInt());
|
||||
subscription.setFullDataSet(random.nextBoolean());
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.datadelivery.registry;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.Random;
|
||||
|
||||
import com.raytheon.uf.common.time.util.ImmutableDate;
|
||||
import com.raytheon.uf.common.util.AbstractFixture;
|
||||
|
||||
/**
|
||||
* {@link AbstractFixture} implementation for {@link PointDataSetMetaData}
|
||||
* objects.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 05, 2013 2038 djohnson Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class PointDataSetMetaDataFixture extends
|
||||
AbstractFixture<PointDataSetMetaData> {
|
||||
|
||||
public static final PointDataSetMetaDataFixture INSTANCE = new PointDataSetMetaDataFixture();
|
||||
|
||||
/**
|
||||
* Disabled constructor.
|
||||
*/
|
||||
private PointDataSetMetaDataFixture() {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public PointDataSetMetaData getInstance(long seedValue, Random random) {
|
||||
final PointTime time = PointTimeFixture.INSTANCE.get(seedValue);
|
||||
final PointDataSet dataSet = WFSPointDataSetFixture.INSTANCE
|
||||
.get(seedValue);
|
||||
|
||||
PointDataSetMetaData obj = new PointDataSetMetaData();
|
||||
obj.setDataSetDescription("description" + seedValue);
|
||||
obj.setDataSetName(dataSet.getDataSetName());
|
||||
try {
|
||||
obj.setDate(new ImmutableDate(TimeFixture.INSTANCE.get(seedValue)
|
||||
.getStartDate()));
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
obj.setProviderName(dataSet.getProviderName());
|
||||
obj.setTime(time);
|
||||
obj.setUrl("http://" + seedValue);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.datadelivery.registry;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.raytheon.uf.common.util.AbstractFixture;
|
||||
|
||||
/**
|
||||
* Fixture for {@link PointTime} objects.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 05, 2013 2038 djohnson Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class PointTimeFixture extends AbstractFixture<PointTime> {
|
||||
|
||||
public static final PointTimeFixture INSTANCE = new PointTimeFixture();
|
||||
|
||||
/**
|
||||
* Disabled.
|
||||
*/
|
||||
private PointTimeFixture() {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public PointTime getInstance(long seedValue, Random random) {
|
||||
PointTime time = new PointTime();
|
||||
time.setInterval((int) seedValue + 1);
|
||||
|
||||
return time;
|
||||
}
|
||||
}
|
|
@ -19,11 +19,9 @@
|
|||
**/
|
||||
package com.raytheon.uf.common.datadelivery.registry;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Random;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.Provider.ProviderType;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Provider.ServiceType;
|
||||
import com.raytheon.uf.common.util.AbstractFixture;
|
||||
|
||||
|
@ -68,8 +66,8 @@ public class ProviderFixture extends AbstractFixture<Provider> {
|
|||
// TODO: ProjectionFixture
|
||||
// provider.setProjection(ProjectionFixture.INSTANCE.get(seedValue));
|
||||
provider.setServiceType(ServiceType.OPENDAP);
|
||||
provider.setProviderType(new ArrayList<ProviderType>(Arrays
|
||||
.asList(AbstractFixture.randomEnum(ProviderType.class, random))));
|
||||
provider.setProviderType(Arrays.<ProviderType> asList(new ProviderType(
|
||||
DataType.GRID, "grid", 100)));
|
||||
|
||||
return provider;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.datadelivery.registry;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Random;
|
||||
|
||||
import com.raytheon.uf.common.util.AbstractFixture;
|
||||
|
||||
/**
|
||||
* {@link AbstractFixture} implementation for {@link WFSPointDataSet} objects.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 05, 2013 2038 djohnson Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class WFSPointDataSetFixture extends AbstractFixture<WFSPointDataSet> {
|
||||
|
||||
public static final WFSPointDataSetFixture INSTANCE = new WFSPointDataSetFixture();
|
||||
|
||||
/**
|
||||
* Disabled constructor.
|
||||
*/
|
||||
private WFSPointDataSetFixture() {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public WFSPointDataSet getInstance(long seedValue, Random random) {
|
||||
WFSPointDataSet obj = new WFSPointDataSet();
|
||||
obj.setCollectionName("collectionName-" + seedValue);
|
||||
obj.setDataSetName("dataSetName" + seedValue);
|
||||
obj.setDataSetType(DataType.POINT);
|
||||
obj.setTime(PointTimeFixture.INSTANCE.get(seedValue));
|
||||
obj.setParameters(Collections.<String, Parameter> emptyMap());
|
||||
obj.setProviderName(ProviderFixture.INSTANCE.get(seedValue).getName());
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
}
|
|
@ -59,6 +59,7 @@ import com.raytheon.uf.common.time.util.TimeUtil;
|
|||
* Jul 24, 2012 955 djohnson Initial creation
|
||||
* Sep 07, 2012 1102 djohnson Add test for more specification defined properties of hashCode/equals.
|
||||
* Oct 23, 2012 1286 djohnson setupTestClassDir() takes any class.
|
||||
* Jun 05, 2013 2038 djohnson Add constant for metadata tx manager.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -67,6 +68,9 @@ import com.raytheon.uf.common.time.util.TimeUtil;
|
|||
*/
|
||||
@Ignore
|
||||
public final class TestUtil {
|
||||
|
||||
public static final String METADATA_TX_MANAGER = "metadataTxManager";
|
||||
|
||||
public static final Pattern COMMA_PATTERN = Pattern.compile(",");
|
||||
|
||||
private static final Pattern NEW_LINE_PATTERN = Pattern.compile("\n");
|
||||
|
|
|
@ -19,24 +19,32 @@
|
|||
**/
|
||||
package com.raytheon.uf.edex.datadelivery.bandwidth;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.hasSize;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotSame;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.SortedSet;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Network;
|
||||
import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSetMetaData;
|
||||
import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSetMetaDataFixture;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.SiteSubscriptionFixture;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
import com.raytheon.uf.common.time.util.ImmutableDate;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
|
@ -44,8 +52,8 @@ import com.raytheon.uf.common.util.TestUtil;
|
|||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthAllocation;
|
||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthAllocationFixture;
|
||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthDataSetUpdate;
|
||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.IBandwidthDao;
|
||||
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.SubscriptionRetrieval;
|
||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrievalFixture;
|
||||
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalStatus;
|
||||
|
@ -61,6 +69,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 12, 2012 1286 djohnson Initial creation
|
||||
* Jun 03, 2013 2038 djohnson Add test getting retrievals by dataset, provider, and status.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -172,11 +181,13 @@ public abstract class AbstractBandwidthDaoTest<T extends IBandwidthDao> {
|
|||
.get(1);
|
||||
OpenDapGriddedDataSetMetaData metaData2 = OpenDapGriddedDataSetMetaDataFixture.INSTANCE
|
||||
.get(2);
|
||||
BandwidthDataSetUpdate metaDataDao = dao.newBandwidthDataSetUpdate(metaData);
|
||||
BandwidthDataSetUpdate metaDataDao = dao
|
||||
.newBandwidthDataSetUpdate(metaData);
|
||||
dao.newBandwidthDataSetUpdate(metaData2);
|
||||
|
||||
final List<BandwidthDataSetUpdate> results = dao.getBandwidthDataSetUpdate(
|
||||
metaData.getProviderName(), metaData.getDataSetName());
|
||||
final List<BandwidthDataSetUpdate> results = dao
|
||||
.getBandwidthDataSetUpdate(metaData.getProviderName(),
|
||||
metaData.getDataSetName());
|
||||
assertEquals(1, results.size());
|
||||
final BandwidthDataSetUpdate result = results.iterator().next();
|
||||
assertEquals(metaData.getDataSetName(), result.getDataSetName());
|
||||
|
@ -191,15 +202,17 @@ public abstract class AbstractBandwidthDaoTest<T extends IBandwidthDao> {
|
|||
.get(1);
|
||||
metaData2.setDate(new ImmutableDate(metaData.getDate().getTime()
|
||||
+ TimeUtil.MILLIS_PER_YEAR));
|
||||
BandwidthDataSetUpdate metaDataDao = dao.newBandwidthDataSetUpdate(metaData);
|
||||
BandwidthDataSetUpdate metaDataDao = dao
|
||||
.newBandwidthDataSetUpdate(metaData);
|
||||
dao.newBandwidthDataSetUpdate(metaData2);
|
||||
|
||||
final ImmutableDate date1 = metaData.getDate();
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(date1);
|
||||
|
||||
final List<BandwidthDataSetUpdate> results = dao.getBandwidthDataSetUpdate(
|
||||
metaData.getProviderName(), metaData.getDataSetName(), cal);
|
||||
final List<BandwidthDataSetUpdate> results = dao
|
||||
.getBandwidthDataSetUpdate(metaData.getProviderName(),
|
||||
metaData.getDataSetName(), cal);
|
||||
assertEquals(1, results.size());
|
||||
final BandwidthDataSetUpdate result = results.iterator().next();
|
||||
assertEquals(metaData.getDataSetName(), result.getDataSetName());
|
||||
|
@ -312,7 +325,8 @@ public abstract class AbstractBandwidthDaoTest<T extends IBandwidthDao> {
|
|||
assertFalse("The two objects should not have the same id!",
|
||||
entity1.getId() == entity2.getId());
|
||||
|
||||
final BandwidthSubscription result = dao.getBandwidthSubscription(entity2.getId());
|
||||
final BandwidthSubscription result = dao
|
||||
.getBandwidthSubscription(entity2.getId());
|
||||
assertEquals("Should have returned the entity with the correct id!",
|
||||
entity2.getId(), result.getId());
|
||||
assertNotSame(entity2, result);
|
||||
|
@ -323,7 +337,8 @@ public abstract class AbstractBandwidthDaoTest<T extends IBandwidthDao> {
|
|||
throws SerializationException {
|
||||
final Calendar now = BandwidthUtil.now();
|
||||
// Identical except for their base reference times and ids
|
||||
dao.newBandwidthSubscription(SiteSubscriptionFixture.INSTANCE.get(), now);
|
||||
dao.newBandwidthSubscription(SiteSubscriptionFixture.INSTANCE.get(),
|
||||
now);
|
||||
|
||||
final Calendar later = BandwidthUtil.now();
|
||||
later.add(Calendar.HOUR, 1);
|
||||
|
@ -407,9 +422,12 @@ public abstract class AbstractBandwidthDaoTest<T extends IBandwidthDao> {
|
|||
.get(2);
|
||||
|
||||
// Still have to persist the actual subscription daos
|
||||
final BandwidthSubscription subDao1 = entity1.getBandwidthSubscription();
|
||||
final BandwidthSubscription subDao2 = entity2.getBandwidthSubscription();
|
||||
final BandwidthSubscription subDao3 = entity3.getBandwidthSubscription();
|
||||
final BandwidthSubscription subDao1 = entity1
|
||||
.getBandwidthSubscription();
|
||||
final BandwidthSubscription subDao2 = entity2
|
||||
.getBandwidthSubscription();
|
||||
final BandwidthSubscription subDao3 = entity3
|
||||
.getBandwidthSubscription();
|
||||
|
||||
// Give each a unique time
|
||||
final Calendar one = BandwidthUtil.now();
|
||||
|
@ -475,12 +493,15 @@ public abstract class AbstractBandwidthDaoTest<T extends IBandwidthDao> {
|
|||
three.add(Calendar.HOUR, 1);
|
||||
|
||||
// Three entities all the same except for base reference time
|
||||
dao.newBandwidthSubscription(SiteSubscriptionFixture.INSTANCE.get(), one);
|
||||
dao.newBandwidthSubscription(SiteSubscriptionFixture.INSTANCE.get(), two);
|
||||
dao.newBandwidthSubscription(SiteSubscriptionFixture.INSTANCE.get(),
|
||||
one);
|
||||
dao.newBandwidthSubscription(SiteSubscriptionFixture.INSTANCE.get(),
|
||||
two);
|
||||
BandwidthSubscription entity3 = dao.newBandwidthSubscription(
|
||||
SiteSubscriptionFixture.INSTANCE.get(), three);
|
||||
// One with same base reference time but different provider/dataset
|
||||
dao.newBandwidthSubscription(SiteSubscriptionFixture.INSTANCE.get(2), three);
|
||||
dao.newBandwidthSubscription(SiteSubscriptionFixture.INSTANCE.get(2),
|
||||
three);
|
||||
|
||||
List<BandwidthSubscription> results = dao.getBandwidthSubscriptions(
|
||||
entity3.getProvider(), entity3.getDataSetName(), three);
|
||||
|
@ -508,9 +529,12 @@ public abstract class AbstractBandwidthDaoTest<T extends IBandwidthDao> {
|
|||
.get(2);
|
||||
|
||||
// Still have to persist the actual subscription daos
|
||||
final BandwidthSubscription subDao1 = entity1.getBandwidthSubscription();
|
||||
final BandwidthSubscription subDao2 = entity2.getBandwidthSubscription();
|
||||
final BandwidthSubscription subDao3 = entity3.getBandwidthSubscription();
|
||||
final BandwidthSubscription subDao1 = entity1
|
||||
.getBandwidthSubscription();
|
||||
final BandwidthSubscription subDao2 = entity2
|
||||
.getBandwidthSubscription();
|
||||
final BandwidthSubscription subDao3 = entity3
|
||||
.getBandwidthSubscription();
|
||||
|
||||
// This persists the subscription dao objects and sets them on the
|
||||
// retrievals
|
||||
|
@ -547,9 +571,12 @@ public abstract class AbstractBandwidthDaoTest<T extends IBandwidthDao> {
|
|||
.get(2);
|
||||
|
||||
// Still have to persist the actual subscription daos
|
||||
final BandwidthSubscription subDao1 = entity1.getBandwidthSubscription();
|
||||
final BandwidthSubscription subDao2 = entity2.getBandwidthSubscription();
|
||||
final BandwidthSubscription subDao3 = entity3.getBandwidthSubscription();
|
||||
final BandwidthSubscription subDao1 = entity1
|
||||
.getBandwidthSubscription();
|
||||
final BandwidthSubscription subDao2 = entity2
|
||||
.getBandwidthSubscription();
|
||||
final BandwidthSubscription subDao3 = entity3
|
||||
.getBandwidthSubscription();
|
||||
|
||||
// This persists the subscription dao objects and sets them on the
|
||||
// retrievals
|
||||
|
@ -575,17 +602,20 @@ public abstract class AbstractBandwidthDaoTest<T extends IBandwidthDao> {
|
|||
@Test
|
||||
public void testRemoveSubscriptionDao() throws SerializationException {
|
||||
final Calendar now = BandwidthUtil.now();
|
||||
dao.newBandwidthSubscription(SiteSubscriptionFixture.INSTANCE.get(1), now);
|
||||
dao.newBandwidthSubscription(SiteSubscriptionFixture.INSTANCE.get(1),
|
||||
now);
|
||||
final BandwidthSubscription entity2 = dao.newBandwidthSubscription(
|
||||
SiteSubscriptionFixture.INSTANCE.get(2), now);
|
||||
dao.newBandwidthSubscription(SiteSubscriptionFixture.INSTANCE.get(3), now);
|
||||
dao.newBandwidthSubscription(SiteSubscriptionFixture.INSTANCE.get(3),
|
||||
now);
|
||||
|
||||
assertEquals("Incorrect number of entities found!", 3, dao
|
||||
.getBandwidthSubscriptions().size());
|
||||
|
||||
dao.remove(entity2);
|
||||
|
||||
final List<BandwidthSubscription> subscriptions = dao.getBandwidthSubscriptions();
|
||||
final List<BandwidthSubscription> subscriptions = dao
|
||||
.getBandwidthSubscriptions();
|
||||
assertEquals("Incorrect number of entities found!", 2,
|
||||
subscriptions.size());
|
||||
for (BandwidthSubscription subscription : subscriptions) {
|
||||
|
@ -624,8 +654,7 @@ public abstract class AbstractBandwidthDaoTest<T extends IBandwidthDao> {
|
|||
public void testUpdateBandwidthAllocation() {
|
||||
final long estimatedSize = 25L;
|
||||
|
||||
BandwidthAllocation entity = BandwidthAllocationFixture.INSTANCE
|
||||
.get();
|
||||
BandwidthAllocation entity = BandwidthAllocationFixture.INSTANCE.get();
|
||||
entity.setAgentType("someAgentType");
|
||||
dao.store(entity);
|
||||
entity.setEstimatedSize(estimatedSize);
|
||||
|
@ -647,7 +676,8 @@ public abstract class AbstractBandwidthDaoTest<T extends IBandwidthDao> {
|
|||
dao.update(entity);
|
||||
|
||||
assertEquals("Expected the entity to have been updated!", 25L, dao
|
||||
.getBandwidthSubscriptions().iterator().next().getEstimatedSize());
|
||||
.getBandwidthSubscriptions().iterator().next()
|
||||
.getEstimatedSize());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -664,4 +694,124 @@ public abstract class AbstractBandwidthDaoTest<T extends IBandwidthDao> {
|
|||
assertEquals("Expected the entity to have been updated!", 25L, dao
|
||||
.getSubscriptionRetrieval(entity.getId()).getEstimatedSize());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetSubscriptionRetrievalsByProviderDataSetAndStatus() {
|
||||
|
||||
final int numberOfScheduledEntities = 2;
|
||||
final int numberOfReadyEntities = 3;
|
||||
List<SubscriptionRetrieval> entities = Lists
|
||||
.newArrayListWithCapacity(numberOfScheduledEntities
|
||||
+ numberOfReadyEntities);
|
||||
|
||||
// Create some scheduled entities
|
||||
entities.addAll(getEntitiesInState(numberOfScheduledEntities,
|
||||
RetrievalStatus.SCHEDULED));
|
||||
|
||||
// Create some ready entities
|
||||
entities.addAll(getEntitiesInState(numberOfReadyEntities,
|
||||
RetrievalStatus.READY));
|
||||
|
||||
for (int i = 0; i < entities.size(); i++) {
|
||||
final SubscriptionRetrieval entity = entities.get(i);
|
||||
// Give each one a unique start time
|
||||
entity.getStartTime().add(Calendar.MINUTE, i);
|
||||
dao.store(entity.getBandwidthSubscription());
|
||||
}
|
||||
dao.store(entities);
|
||||
|
||||
BandwidthSubscription bandwidthSubscription = entities.iterator()
|
||||
.next().getBandwidthSubscription();
|
||||
final int actualNumberOfScheduledStatus = dao
|
||||
.getSubscriptionRetrievals(bandwidthSubscription.getProvider(),
|
||||
bandwidthSubscription.getDataSetName(),
|
||||
RetrievalStatus.SCHEDULED).size();
|
||||
assertThat(actualNumberOfScheduledStatus,
|
||||
is(equalTo(numberOfScheduledEntities)));
|
||||
|
||||
final int actualNumberOfReadyStatus = dao.getSubscriptionRetrievals(
|
||||
bandwidthSubscription.getProvider(),
|
||||
bandwidthSubscription.getDataSetName(), RetrievalStatus.READY)
|
||||
.size();
|
||||
assertThat(actualNumberOfReadyStatus,
|
||||
is(equalTo(numberOfReadyEntities)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetSubscriptionRetrievalsByProviderDataSetStatusAndDates() {
|
||||
|
||||
final int numberOfScheduledEntities = 2;
|
||||
final int numberOfReadyEntities = 10;
|
||||
List<SubscriptionRetrieval> entities = Lists
|
||||
.newArrayListWithCapacity(numberOfScheduledEntities
|
||||
+ numberOfReadyEntities);
|
||||
|
||||
// Create some scheduled entities
|
||||
entities.addAll(getEntitiesInState(numberOfScheduledEntities,
|
||||
RetrievalStatus.SCHEDULED));
|
||||
|
||||
// Create some ready entities
|
||||
List<SubscriptionRetrieval> readyEntities = getEntitiesInState(
|
||||
numberOfReadyEntities, RetrievalStatus.READY);
|
||||
entities.addAll(readyEntities);
|
||||
|
||||
// Persist the bandwidth subscriptions and create some unique times
|
||||
for (int i = 0; i < entities.size(); i++) {
|
||||
final SubscriptionRetrieval entity = entities.get(i);
|
||||
|
||||
// Give each one a unique start time
|
||||
final Calendar startTime = entity.getStartTime();
|
||||
startTime.add(Calendar.HOUR, i);
|
||||
|
||||
// ... and end time
|
||||
Calendar endTime = BandwidthUtil.copy(startTime);
|
||||
endTime.add(Calendar.MINUTE, 5);
|
||||
entity.setEndTime(endTime);
|
||||
|
||||
dao.store(entity.getBandwidthSubscription());
|
||||
}
|
||||
dao.store(entities);
|
||||
|
||||
BandwidthSubscription bandwidthSubscription = entities.iterator()
|
||||
.next().getBandwidthSubscription();
|
||||
// These are the entities we expect to get (two items)
|
||||
List<SubscriptionRetrieval> expectToGet = readyEntities.subList(3, 5);
|
||||
final Iterator<SubscriptionRetrieval> iter = expectToGet.iterator();
|
||||
|
||||
// Use the start time of the first retrieval and the end time of the
|
||||
// second retrieval
|
||||
final Date startTime = iter.next().getStartTime().getTime();
|
||||
final Date endTime = iter.next().getEndTime().getTime();
|
||||
|
||||
final SortedSet<SubscriptionRetrieval> actualReceived = dao.getSubscriptionRetrievals(bandwidthSubscription.getProvider(),
|
||||
bandwidthSubscription.getDataSetName(), RetrievalStatus.READY,
|
||||
startTime, endTime);
|
||||
|
||||
// Verify the correct number of retrievals were returned
|
||||
assertThat(actualReceived, hasSize(expectToGet.size()));
|
||||
|
||||
// Verify the two SubscriptionRetrievals are correct
|
||||
Iterator<SubscriptionRetrieval> actualIter = actualReceived.iterator();
|
||||
assertThat(actualIter.next(), is(equalTo(expectToGet.get(0))));
|
||||
assertThat(actualIter.next(), is(equalTo(expectToGet.get(1))));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the specified number of entities in the specified state.
|
||||
*
|
||||
* @param numberOfEntities
|
||||
* @param state
|
||||
* @return the entities
|
||||
*/
|
||||
protected static List<SubscriptionRetrieval> getEntitiesInState(
|
||||
int numberOfEntities, RetrievalStatus state) {
|
||||
List<SubscriptionRetrieval> entities = Lists.newArrayList();
|
||||
for (int i = 0; i < numberOfEntities; i++) {
|
||||
SubscriptionRetrieval entity = SubscriptionRetrievalFixture.INSTANCE
|
||||
.get();
|
||||
entity.setStatus(state);
|
||||
entities.add(entity);
|
||||
}
|
||||
return entities;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,8 +25,11 @@ import org.springframework.test.annotation.DirtiesContext;
|
|||
import org.springframework.test.annotation.DirtiesContext.ClassMode;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.test.context.transaction.TransactionConfiguration;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.raytheon.uf.common.util.SpringFiles;
|
||||
import com.raytheon.uf.common.util.TestUtil;
|
||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.IBandwidthDao;
|
||||
import com.raytheon.uf.edex.datadelivery.bandwidth.hibernate.HibernateBandwidthDao;
|
||||
|
||||
|
@ -41,6 +44,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.hibernate.HibernateBandwidthD
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 13, 2012 1286 djohnson Initial creation
|
||||
* Jun 03, 2013 2038 djohnson Use transactional semantics.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -51,6 +55,8 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.hibernate.HibernateBandwidthD
|
|||
@ContextConfiguration(locations = { SpringFiles.UNIT_TEST_DB_BEANS_XML,
|
||||
SpringFiles.BANDWIDTH_DATADELIVERY_DAOS_XML,
|
||||
SpringFiles.RETRIEVAL_DATADELIVERY_DAOS_XML })
|
||||
@TransactionConfiguration(transactionManager = TestUtil.METADATA_TX_MANAGER, defaultRollback = true)
|
||||
@Transactional
|
||||
@DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
|
||||
public class HibernateBandwidthDaoTest extends
|
||||
AbstractBandwidthDaoTest<IBandwidthDao> {
|
||||
|
|
|
@ -19,7 +19,11 @@
|
|||
**/
|
||||
package com.raytheon.uf.edex.datadelivery.bandwidth.util;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.hasSize;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
|
@ -31,6 +35,7 @@ import java.util.Calendar;
|
|||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
|
@ -38,6 +43,7 @@ import org.junit.After;
|
|||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Network;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.SubscriptionBuilder;
|
||||
|
@ -70,6 +76,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalStatus;
|
|||
* Oct 24, 2012 1286 djohnson Initial creation
|
||||
* Feb 07, 2013 1543 djohnson Remove unnecessary test setup methods.
|
||||
* Feb 14, 2013 1595 djohnson Fix retrieval plan/subscription time intersections.
|
||||
* Jun 05, 2013 2038 djohnson Use public API for getting retrieval times.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -110,6 +117,11 @@ public class BandwidthDaoUtilTest {
|
|||
|
||||
map = BandwidthMap.load(lf.getFile());
|
||||
plan = new RetrievalPlan(Network.OPSNET, map, mockDao);
|
||||
|
||||
Map<Network, RetrievalPlan> retrievalPlans = Maps
|
||||
.newEnumMap(Network.class);
|
||||
retrievalPlans.put(Network.OPSNET, plan);
|
||||
when(retrievalManager.getRetrievalPlans()).thenReturn(retrievalPlans);
|
||||
}
|
||||
|
||||
@After
|
||||
|
@ -130,10 +142,8 @@ public class BandwidthDaoUtilTest {
|
|||
TreeSet<Integer> cycles = new TreeSet<Integer>(subscription.getTime()
|
||||
.getCycleTimes());
|
||||
|
||||
SortedSet<Calendar> subscriptionTimes = new TreeSet<Calendar>();
|
||||
|
||||
subscriptionTimes = bandwidthDaoUtil.getRetrievalTimes(subscription,
|
||||
cycles, plan, subscriptionTimes);
|
||||
SortedSet<Calendar> subscriptionTimes = bandwidthDaoUtil
|
||||
.getRetrievalTimes(subscription, cycles);
|
||||
|
||||
final List<Integer> daysOfTheYear = Arrays.asList(3, 4);
|
||||
verifySubscriptionTimesContainsCyclesForSpecifiedDays(daysOfTheYear,
|
||||
|
@ -154,10 +164,8 @@ public class BandwidthDaoUtilTest {
|
|||
TreeSet<Integer> cycles = new TreeSet<Integer>(subscription.getTime()
|
||||
.getCycleTimes());
|
||||
|
||||
SortedSet<Calendar> subscriptionTimes = new TreeSet<Calendar>();
|
||||
|
||||
subscriptionTimes = bandwidthDaoUtil.getRetrievalTimes(subscription,
|
||||
cycles, plan, subscriptionTimes);
|
||||
SortedSet<Calendar> subscriptionTimes = bandwidthDaoUtil
|
||||
.getRetrievalTimes(subscription, cycles);
|
||||
|
||||
final List<Integer> daysOfTheYear = Arrays.asList(4);
|
||||
verifySubscriptionTimesContainsCyclesForSpecifiedDays(daysOfTheYear,
|
||||
|
@ -181,10 +189,8 @@ public class BandwidthDaoUtilTest {
|
|||
TreeSet<Integer> cycles = new TreeSet<Integer>(subscription.getTime()
|
||||
.getCycleTimes());
|
||||
|
||||
SortedSet<Calendar> subscriptionTimes = new TreeSet<Calendar>();
|
||||
|
||||
subscriptionTimes = bandwidthDaoUtil.getRetrievalTimes(subscription,
|
||||
cycles, plan, subscriptionTimes);
|
||||
SortedSet<Calendar> subscriptionTimes = bandwidthDaoUtil
|
||||
.getRetrievalTimes(subscription, cycles);
|
||||
|
||||
final List<Integer> daysOfTheYear = Arrays.asList(3);
|
||||
verifySubscriptionTimesContainsCyclesForSpecifiedDays(daysOfTheYear,
|
||||
|
@ -217,6 +223,47 @@ public class BandwidthDaoUtilTest {
|
|||
verify(retrievalManager, never()).remove(alloc2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetRetrievalTimesReturnsEachIntervalMinuteOfEachHourInPlanWindow() {
|
||||
Subscription subscription = new SubscriptionBuilder()
|
||||
.withActivePeriodStart(plan.getPlanStart().getTime())
|
||||
.withActivePeriodEnd(plan.getPlanEnd().getTime())
|
||||
.withSubscriptionStart(TimeUtil.newImmutableDate()).build();
|
||||
|
||||
// A 30 minute interval should provide 0 and 30 minutes of every hour
|
||||
// Make sure the subscription is "active" within the plan period
|
||||
final int interval = 30;
|
||||
SortedSet<Calendar> subscriptionTimes = bandwidthDaoUtil
|
||||
.getRetrievalTimes(subscription, interval);
|
||||
|
||||
// Expected size is two per hour (0 and 30 minutes), for every hour,
|
||||
// over the retrieval plan days (2), plus 1 because the retrieval plan
|
||||
// ends on a 0 minute time
|
||||
final int expectedSize = TimeUtil.HOURS_PER_DAY * plan.getPlanDays()
|
||||
* 2 + 1;
|
||||
assertThat(subscriptionTimes, hasSize(expectedSize));
|
||||
|
||||
// Make sure we have the expected number of 0 and 30 minute scheduled
|
||||
// times
|
||||
int numberOfZeroMinuteTimes = 0;
|
||||
int numberOfThirtyMinuteTimes = 0;
|
||||
for (Calendar subscriptionTime : subscriptionTimes) {
|
||||
final int minuteField = subscriptionTime.get(Calendar.MINUTE);
|
||||
if (minuteField == 0) {
|
||||
numberOfZeroMinuteTimes++;
|
||||
} else if (minuteField == 30) {
|
||||
numberOfThirtyMinuteTimes++;
|
||||
}
|
||||
}
|
||||
|
||||
final int halfTheTimes = subscriptionTimes.size() / 2;
|
||||
assertThat(numberOfZeroMinuteTimes, is(equalTo(halfTheTimes + 1)));
|
||||
assertThat(numberOfThirtyMinuteTimes, is(equalTo(halfTheTimes)));
|
||||
|
||||
// Would be nice to verify the days and hours, but the cycle based tests already
|
||||
// do that and the code was reused, maybe add it later
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies the subscription times contains the cycles for the specified
|
||||
* days.
|
||||
|
|
|
@ -0,0 +1,111 @@
|
|||
/**
|
||||
* 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.util;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.DataType;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Provider;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ProviderType;
|
||||
import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.IProviderHandler;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
||||
import com.raytheon.uf.common.util.registry.RegistryException;
|
||||
|
||||
/**
|
||||
* Test {@link ProviderDataTypeAvailabilityCalculator}.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 05, 2013 2038 djohnson Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class ProviderDataTypeAvailabilityCalculatorTest {
|
||||
|
||||
private static final int ONE_HUNDRED = 100;
|
||||
|
||||
private static final String PROVIDER_NAME = "someProviderName";
|
||||
|
||||
private static final Provider provider = new Provider();
|
||||
static {
|
||||
provider.setName(PROVIDER_NAME);
|
||||
provider.setProviderType(Arrays.<ProviderType> asList(new ProviderType(
|
||||
DataType.GRID, "grid", ONE_HUNDRED)));
|
||||
}
|
||||
|
||||
private final IProviderHandler providerHandler = mock(IProviderHandler.class);
|
||||
|
||||
private final ProviderDataTypeAvailabilityCalculator availabilityCalculator = new ProviderDataTypeAvailabilityCalculator(
|
||||
providerHandler);
|
||||
|
||||
@Before
|
||||
public void setUp() throws RegistryException, RegistryHandlerException {
|
||||
when(providerHandler.getByName(PROVIDER_NAME)).thenReturn(provider);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void returnsConfiguredAvailabilityWhenRegistered() {
|
||||
Subscription subscription = new SiteSubscription();
|
||||
subscription.setProvider(PROVIDER_NAME);
|
||||
subscription.setDataSetType(DataType.GRID);
|
||||
|
||||
assertThat(
|
||||
availabilityCalculator.getDataSetAvailablityDelay(subscription),
|
||||
is(equalTo(ONE_HUNDRED)));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void throwsIllegalArgumentExceptionWhenProviderNotRegistered() {
|
||||
Subscription subscription = new SiteSubscription();
|
||||
subscription.setProvider("someOtherProviderName");
|
||||
subscription.setDataSetType(DataType.GRID);
|
||||
|
||||
availabilityCalculator.getDataSetAvailablityDelay(subscription);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void throwsIllegalArgumentExceptionWhenDataTypeNotRegistered() {
|
||||
Subscription subscription = new SiteSubscription();
|
||||
subscription.setProvider(PROVIDER_NAME);
|
||||
subscription.setDataSetType(DataType.POINT);
|
||||
|
||||
availabilityCalculator.getDataSetAvailablityDelay(subscription);
|
||||
}
|
||||
|
||||
}
|
|
@ -71,8 +71,8 @@ public class MockOpenDapRetrievalGenerator extends OpenDAPRetrievalGenerator {
|
|||
retrieval.setConnection(bundle.getConnection());
|
||||
retrieval.setNetwork(subscription.getRoute());
|
||||
retrieval.setOwner(subscription.getOwner());
|
||||
retrieval.setProviderType(bundle.getProvider().getProviderType()
|
||||
.iterator().next());
|
||||
retrieval.setDataType(bundle.getProvider().getProviderType()
|
||||
.iterator().next().getDataType());
|
||||
retrieval.setServiceType(this.getServiceType());
|
||||
retrieval.setSubscriptionName(subscription.getName());
|
||||
retrieval.setSubscriptionType(getSubscriptionType(subscription));
|
||||
|
|
|
@ -47,8 +47,8 @@ import com.raytheon.uf.common.datadelivery.bandwidth.IBandwidthService;
|
|||
import com.raytheon.uf.common.datadelivery.bandwidth.IProposeScheduleResponse;
|
||||
import com.raytheon.uf.common.datadelivery.registry.AdhocSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.AdhocSubscriptionFixture;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.SiteSubscriptionFixture;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler;
|
||||
import com.raytheon.uf.common.datadelivery.service.ISubscriptionNotificationService;
|
||||
|
@ -57,7 +57,6 @@ import com.raytheon.uf.common.datadelivery.service.subscription.ISubscriptionOve
|
|||
import com.raytheon.uf.common.localization.PathManagerFactoryTest;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryObjectHandlersUtil;
|
||||
import com.raytheon.uf.common.util.FileUtil;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService.ISubscriptionServiceResult;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionService.ForceApplyPromptResponse;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionService.IDisplayForceApplyPrompt;
|
||||
|
@ -350,26 +349,8 @@ public abstract class AbstractSubscriptionServiceTest {
|
|||
@Test
|
||||
public void testOverlappingSubscriptionsNotifiesUser()
|
||||
throws RegistryHandlerException {
|
||||
final ISubscriptionHandler subscriptionHandler = DataDeliveryHandlers
|
||||
.getSubscriptionHandler();
|
||||
|
||||
// Store a duplicate subscription
|
||||
Subscription duplicateSub = sub1.copy("duplicateSub");
|
||||
subscriptionHandler.store(duplicateSub);
|
||||
|
||||
final ISubscriptionOverlapResponse response = mock(ISubscriptionOverlapResponse.class);
|
||||
when(subscriptionOverlapService.isOverlapping(duplicateSub, sub1))
|
||||
.thenReturn(response);
|
||||
when(response.isOverlapping()).thenReturn(true);
|
||||
|
||||
performServiceInteraction();
|
||||
|
||||
verify(mockDisplay).displayMessage(
|
||||
mockPromptDisplayText,
|
||||
ISubscriptionOverlapService.OVERLAPPING_SUBSCRIPTIONS
|
||||
+ FileUtil.EOL + duplicateSub.getName());
|
||||
// Not valid for adhocs
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies that the only interactions with the subscription handler are to
|
||||
* check for duplicate/overlapping subscriptions.
|
||||
|
|
|
@ -21,12 +21,15 @@ package com.raytheon.uf.viz.datadelivery.subscription;
|
|||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
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.util.CollectionUtil;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService.ISubscriptionServiceResult;
|
||||
|
@ -147,6 +150,15 @@ public class SubscriptionServiceStoreAdhocTest extends
|
|||
// Adhoc subscriptions no longer interact with the registry
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void verifyOnlyCheckingForDuplicateSubscriptions()
|
||||
throws RegistryHandlerException {
|
||||
// Adhocs don't check for duplicates
|
||||
final ISubscriptionHandler subscriptionHandler = DataDeliveryHandlers
|
||||
.getSubscriptionHandler();
|
||||
verifyNoMoreInteractions(subscriptionHandler);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
|
|
@ -40,12 +40,13 @@ import org.junit.Before;
|
|||
import org.junit.Test;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.raytheon.uf.common.datadelivery.registry.DataType;
|
||||
import com.raytheon.uf.common.datadelivery.registry.GriddedDataSet;
|
||||
import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSet;
|
||||
import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.SiteSubscriptionFixture;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.SubscriptionBuilder;
|
||||
import com.raytheon.uf.common.datadelivery.registry.SiteSubscriptionFixture;
|
||||
import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
||||
import com.raytheon.uf.common.time.CalendarBuilder;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
|
@ -91,6 +92,7 @@ public class CreateSubscriptionPresenterTest {
|
|||
dataSet.setDataSetName("name");
|
||||
dataSet.setProviderName("provider");
|
||||
dataSet.setForecastHours(Sets.newHashSet(0, 3, 6));
|
||||
dataSet.setDataSetType(DataType.GRID);
|
||||
dataSet.setCycles(Sets.newHashSet(0, 6, 12));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue