Issue #2460 Product browser display of adhoc subscriptions
Change-Id: I9c045b781adb41468d395b67a837c9a862744447 Former-commit-id: c504c44750f5f441be41c20fdb78a363c620fb3d
This commit is contained in:
parent
e1a0403c01
commit
477fbd3d59
15 changed files with 404 additions and 5 deletions
|
@ -75,6 +75,11 @@
|
|||
class="com.raytheon.uf.common.datadelivery.registry.handlers.DataSetHandler">
|
||||
<property name="registryHandler" ref="registryHandler" />
|
||||
</bean>
|
||||
|
||||
<bean name="AdhocSubscriptionHandler"
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.AdhocSubscriptionHandler">
|
||||
<property name="registryHandler" ref="registryHandler" />
|
||||
</bean>
|
||||
|
||||
<!-- The actual registering of the handlers -->
|
||||
|
||||
|
@ -151,6 +156,11 @@
|
|||
value="com.raytheon.uf.common.datadelivery.registry.handlers.IDataSetHandler" />
|
||||
<constructor-arg ref="DataSetHandler" />
|
||||
</bean>
|
||||
|
||||
<bean id="registerAdhocSubscriptionHandler" factory-bean="registryObjectHandlerRegistry" factory-method="registerHandler">
|
||||
<constructor-arg value="com.raytheon.uf.common.datadelivery.registry.handlers.IAdhocSubscriptionHandler" />
|
||||
<constructor-arg ref="AdhocSubscriptionHandler" />
|
||||
</bean>
|
||||
|
||||
<!-- Used to consolidate the dependency clauses of beans that rely upon
|
||||
data delivery registry handlers -->
|
||||
|
@ -159,6 +169,6 @@
|
|||
registerGroupDefinitionHandler,
|
||||
registerProviderHandler,registerDataSetNameHandler,registerParameterHandler,
|
||||
registerParameterLevelHandler,registerDataSetMetaDataHandler,
|
||||
registerGriddedDataSetMetaDataHandler,registerDataSetHandler" />
|
||||
registerGriddedDataSetMetaDataHandler,registerDataSetHandler,registerAdhocSubscriptionHandler" />
|
||||
|
||||
</beans>
|
|
@ -28,9 +28,11 @@ import java.util.Map;
|
|||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import com.raytheon.uf.common.comm.CommunicationException;
|
||||
import com.raytheon.uf.common.datadelivery.registry.AdhocSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Coverage;
|
||||
import com.raytheon.uf.common.datadelivery.registry.DataType;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.IAdhocSubscriptionHandler;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
|
||||
|
@ -66,6 +68,7 @@ import com.raytheon.viz.pointdata.util.PointDataInventory;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 17, 2013 2391 mpduff Initial creation
|
||||
* Sept 22, 2013 2246 dhladky Setup binoffset for time into +-5 min intervals
|
||||
* Oct 13, 2013 2460 dhladky Added display of Adhoc subscriptions
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -432,6 +435,20 @@ public class DataDeliveryProductBrowserDataDefinition
|
|||
} catch (RegistryHandlerException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
}
|
||||
|
||||
final IAdhocSubscriptionHandler adhochandler = RegistryObjectHandlers
|
||||
.get(IAdhocSubscriptionHandler.class);
|
||||
List<AdhocSubscription> adhocSubs = null;
|
||||
|
||||
try {
|
||||
adhocSubs = adhochandler.getAll();
|
||||
} catch (RegistryHandlerException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
}
|
||||
|
||||
if (adhocSubs != null) {
|
||||
subList.addAll(adhocSubs);
|
||||
}
|
||||
|
||||
return subList;
|
||||
}
|
||||
|
|
|
@ -92,6 +92,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
|
|||
* Jul 18, 2013 1653 mpduff Add SubscriptionStatusSummary.
|
||||
* Jul 26, 2013 2232 mpduff Refactored Data Delivery permissions.
|
||||
* Sept 25, 2013 1797 dhladky separated time from gridded time
|
||||
* Oct 12, 2013 2460 dhladky restored adhoc subscriptions to registry storage.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -566,9 +567,9 @@ public class SubscriptionService implements ISubscriptionService {
|
|||
final String successMessage = "The query was successfully stored.";
|
||||
final ServiceInteraction action = new ServiceInteraction() {
|
||||
@Override
|
||||
public String call() {
|
||||
// Adhoc subscriptions don't interact with the registry any
|
||||
// longer, so it gets a blank implementation
|
||||
public String call() throws RegistryHandlerException {
|
||||
DataDeliveryHandlers.getSubscriptionHandler().store(
|
||||
sub);
|
||||
return successMessage;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -235,6 +235,7 @@
|
|||
<!-- Registry production mode -->
|
||||
<include>ebxml.*\.xml</include>
|
||||
<includeMode>dataDeliveryTemplate</includeMode>
|
||||
<include>adhoc-datadelivery-wfo.xml</include>
|
||||
<exclude>.*datadelivery-ncf.*</exclude>
|
||||
<exclude>harvester-*</exclude>
|
||||
<exclude>crawler-*</exclude>
|
||||
|
@ -299,6 +300,7 @@
|
|||
are for DEVELOPMENT purposes only -->
|
||||
<mode name="devRegistry">
|
||||
<include>ebxml.*\.xml</include>
|
||||
<include>adhoc-datadelivery-wfo.xml</include>
|
||||
<includeMode>dataDeliveryTemplate</includeMode>
|
||||
<exclude>.*datadelivery-ncf.*</exclude>
|
||||
</mode>
|
||||
|
|
|
@ -23,6 +23,7 @@ import javax.xml.bind.annotation.XmlAccessType;
|
|||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.raytheon.uf.common.registry.annotations.RegistryObject;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
|
||||
/**
|
||||
|
@ -44,6 +45,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
|||
* Mar 29, 2013 1841 djohnson Subscription is now UserSubscription.
|
||||
* May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription.
|
||||
* Oct 2, 2013 1797 dhladky Generics start
|
||||
* Oct 11, 2013 2460 dhladky Restored Adhoc's to registryObject store, WFO only
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -54,6 +56,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
|||
@XmlRootElement(name = "AdhocSubscription")
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@DynamicSerialize
|
||||
@RegistryObject({ Subscription.PROVIDER_NAME_SLOT, Subscription.NAME_SLOT,
|
||||
Subscription.DATA_SET_SLOT, Subscription.OWNER_SLOT })
|
||||
public class AdhocSubscription<T extends Time, C extends Coverage> extends SiteSubscription<T, C> {
|
||||
|
||||
private static final long serialVersionUID = -2200080380095632486L;
|
||||
|
|
|
@ -33,6 +33,7 @@ import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
|||
* Oct 5, 2012 0726 djohnson Initial creation
|
||||
* Dec 11, 2012 1403 djohnson Adhoc subscriptions no longer go to the registry.
|
||||
* May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription.
|
||||
* Oct 11, 2013 2460 dhladky Restored Adhoc to registry store, WFO only.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -55,6 +56,9 @@ public final class DataDeliveryRegistryObjectTypes {
|
|||
|
||||
public static final String SHARED_SUBSCRIPTION = RegistryUtil
|
||||
.getObjectType(SharedSubscription.class);
|
||||
|
||||
public static final String ADHOC_SUBSCRIPTION = RegistryUtil
|
||||
.getObjectType(AdhocSubscription.class);
|
||||
|
||||
public static final String DATASET = RegistryUtil
|
||||
.getObjectType(DataSet.class);
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
/**
|
||||
* 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.handlers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.raytheon.uf.common.datadelivery.registry.AdhocSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.ebxml.AdhocSubscriptionQuery;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ebxml.SubscriptionFilterableQuery;
|
||||
|
||||
import com.raytheon.uf.common.registry.RegistryQueryResponse;
|
||||
import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
||||
|
||||
/**
|
||||
* {@link IRegistryObjectHandler} implementation for {@link AdhocSubscription}.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 05, 2012 1241 djohnson Initial creation.
|
||||
* Oct 12, 2013 2460 dhladky restored.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
public class AdhocSubscriptionHandler extends
|
||||
BaseSubscriptionHandler<AdhocSubscription, AdhocSubscriptionQuery>
|
||||
implements IAdhocSubscriptionHandler {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
||||
@Override
|
||||
|
||||
protected AdhocSubscriptionQuery getQuery() {
|
||||
return new AdhocSubscriptionQuery();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
* {@inheritDoc}
|
||||
|
||||
*/
|
||||
|
||||
@Override
|
||||
|
||||
protected Class<AdhocSubscription> getRegistryObjectClass() {
|
||||
return AdhocSubscription.class;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -34,6 +34,7 @@ import com.raytheon.uf.common.registry.handler.RegistryObjectHandlers;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 3, 2012 1241 djohnson Initial creation
|
||||
* Dec 11, 2012 1403 djohnson Adhoc subscriptions no longer go to the registry.
|
||||
* Oct 12, 2013 2046 dhladky Restored Adhoc's at WFO level
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -137,4 +138,15 @@ public final class DataDeliveryHandlers {
|
|||
public static IDataSetHandler getDataSetHandler() {
|
||||
return RegistryObjectHandlers.get(IDataSetHandler.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the {@link IAdhocSubscriptionHandler}.
|
||||
*
|
||||
* @return the handler
|
||||
*/
|
||||
|
||||
public static IAdhocSubscriptionHandler getAdhocSubscriptionHandler() {
|
||||
return RegistryObjectHandlers.get(IAdhocSubscriptionHandler.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
/**
|
||||
* 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.handlers;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.AdhocSubscription;
|
||||
import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
|
||||
|
||||
/**
|
||||
* The {@link IRegistryObjectHandler} interface for {@link AdhocSubscription}s.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 05, 2012 1241 djohnson Initial creation
|
||||
* Oct 12, 2013 2460 dhladky restored.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public interface IAdhocSubscriptionHandler extends
|
||||
IBaseSubscriptionHandler<AdhocSubscription> {
|
||||
}
|
|
@ -44,6 +44,7 @@ Export-Package: com.raytheon.uf.edex.datadelivery.retrieval;
|
|||
com.raytheon.uf.common.serialization,
|
||||
com.raytheon.uf.common.datadelivery.registry",
|
||||
com.raytheon.uf.edex.datadelivery.retrieval.adapters;uses:="com.raytheon.uf.edex.datadelivery.retrieval.interfaces,com.raytheon.uf.common.datadelivery.retrieval.xml,com.raytheon.uf.edex.datadelivery.retrieval.response",
|
||||
com.raytheon.uf.edex.datadelivery.retrieval.adhoc,
|
||||
com.raytheon.uf.edex.datadelivery.retrieval.db;uses:="com.raytheon.uf.common.dataplugin.persist,com.raytheon.uf.edex.database.dao,com.raytheon.uf.common.serialization",
|
||||
com.raytheon.uf.edex.datadelivery.retrieval.handlers;uses:="com.raytheon.uf.edex.datadelivery.retrieval.interfaces,com.raytheon.uf.common.datadelivery.retrieval.xml,com.raytheon.uf.edex.datadelivery.retrieval.db",
|
||||
com.raytheon.uf.edex.datadelivery.retrieval.interfaces;
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
<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
|
||||
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
|
||||
|
||||
<!-- Cleans up old Adhoc subscriptions in the registry when the data for
|
||||
them expires This only runs within the WFO registry mode (Adhoc subscriptions
|
||||
are only allowed there) -->
|
||||
|
||||
<bean id="AdhocSubscriptionCleaner"
|
||||
class="com.raytheon.uf.edex.datadelivery.retrieval.adhoc.AdhocSubscriptionCleaner" />
|
||||
|
||||
<camelContext id="adhocsubscription-cleanup" xmlns="http://camel.apache.org/schema/spring"
|
||||
errorHandlerRef="errorHandler">
|
||||
<endpoint id="processAdhocSubscriptions"
|
||||
uri="clusteredquartz://registry/processAdhocSubscriptions/?cron=${adhocsubscription-process.cron}" />
|
||||
<route id="processSubscriptionsFromQuartz">
|
||||
<from uri="processAdhocSubscriptions" />
|
||||
<bean ref="AdhocSubscriptionCleaner" method="processSubscriptions" />
|
||||
</route>
|
||||
</camelContext>
|
||||
</beans>
|
|
@ -0,0 +1,188 @@
|
|||
package com.raytheon.uf.edex.datadelivery.retrieval.adhoc;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
**/
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.AdhocSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Provider;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ProviderType;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.IAdhocSubscriptionHandler;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.IProviderHandler;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.edex.database.plugin.PluginDao;
|
||||
import com.raytheon.uf.edex.database.purge.PurgeRule;
|
||||
import com.raytheon.uf.edex.database.purge.PurgeRuleSet;
|
||||
|
||||
/**
|
||||
* Dumps expired Adhoc Subscriptions based on diff between end and expiration
|
||||
* time in purge rules.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 11, 2013 2460 dhladky Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author dhladky
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class AdhocSubscriptionCleaner {
|
||||
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(AdhocSubscriptionCleaner.class);
|
||||
|
||||
public AdhocSubscriptionCleaner() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans old adhoc subscriptions from the WFO registry.
|
||||
* Compares the end() time on the sub to the expiration period in
|
||||
* associated purge rules derived from the plugin each subs data
|
||||
* is stored too. Runs on every 20 minutes.
|
||||
*/
|
||||
public void processSubscriptions() {
|
||||
|
||||
statusHandler.handle(Priority.INFO, "Processing Adhoc Subscriptions for expiration...");
|
||||
List<AdhocSubscription> adhocs = null;
|
||||
final IAdhocSubscriptionHandler adhocSubHandler = DataDeliveryHandlers.getAdhocSubscriptionHandler();
|
||||
|
||||
try {
|
||||
adhocs = adhocSubHandler.getAll();
|
||||
|
||||
} catch (RegistryHandlerException e) {
|
||||
statusHandler.handle(Priority.ERROR, "Can't load list of adhoc subscriptions from registry!", e);
|
||||
}
|
||||
|
||||
if (adhocs != null && !adhocs.isEmpty()) {
|
||||
|
||||
Map<String, Provider> providers = new HashMap<String, Provider>();
|
||||
Map<String, PurgeRuleSet> purgeRules = new HashMap<String, PurgeRuleSet>();
|
||||
List<AdhocSubscription> subsToDelete = new ArrayList<AdhocSubscription>();
|
||||
|
||||
// loop over the adhoc subscriptions we have
|
||||
for (AdhocSubscription adhoc: adhocs) {
|
||||
|
||||
String providerName = adhoc.getProvider();
|
||||
Provider provider = null;
|
||||
|
||||
// speed, only has to lookup each provider once
|
||||
if (!providers.containsKey(providerName)) {
|
||||
|
||||
final IProviderHandler providerHandler = DataDeliveryHandlers.getProviderHandler();
|
||||
|
||||
try {
|
||||
provider = providerHandler.getByName(providerName);
|
||||
providers.put(providerName, provider);
|
||||
|
||||
} catch (RegistryHandlerException e) {
|
||||
statusHandler.handle(Priority.ERROR, "Can't load provider from registry! "+providerName, e);
|
||||
}
|
||||
} else {
|
||||
// pull a cached provider
|
||||
if (providerName != null) {
|
||||
provider = providers.get(providerName);
|
||||
}
|
||||
}
|
||||
|
||||
List<String> plugins = new ArrayList<String>();
|
||||
|
||||
if (provider != null) {
|
||||
// find the actual plugin
|
||||
for (ProviderType type : provider.getProviderType()) {
|
||||
plugins.add(type.getPlugin());
|
||||
}
|
||||
}
|
||||
|
||||
// extract the purge rules from localization, place in map for speed
|
||||
PurgeRuleSet purgeRuleSet = null;
|
||||
|
||||
if (plugins != null && !plugins.isEmpty()) {
|
||||
// multiple plugins for providers on occasion
|
||||
for (String plugin : plugins) {
|
||||
|
||||
if (!purgeRules.containsKey(plugin)) {
|
||||
|
||||
purgeRuleSet = PluginDao
|
||||
.getPurgeRulesForPlugin(plugin);
|
||||
purgeRules.put(plugin, purgeRuleSet);
|
||||
|
||||
} else {
|
||||
// pull a cached purgeRuleSet
|
||||
if (plugin != null) {
|
||||
purgeRuleSet = purgeRules.get(plugin);
|
||||
}
|
||||
}
|
||||
|
||||
if (purgeRuleSet != null) {
|
||||
|
||||
List<PurgeRule> rules = purgeRuleSet.getRules();
|
||||
|
||||
// Go over all of the purge rules for each sub
|
||||
for (PurgeRule rule: rules) {
|
||||
// use current system date/time
|
||||
long timeCheck = TimeUtil.newDate().getTime();
|
||||
Date expireDate = new Date(timeCheck + rule.getPeriodInMillis());
|
||||
|
||||
// check rule against creation time of this sub
|
||||
if (adhoc.getTime().getEnd().before(expireDate)) {
|
||||
if (!subsToDelete.contains(adhoc)) {
|
||||
subsToDelete.add(adhoc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// get rid of old subscriptions
|
||||
if (subsToDelete != null && !subsToDelete.isEmpty()) {
|
||||
|
||||
try {
|
||||
adhocSubHandler.delete(subsToDelete);
|
||||
statusHandler.handle(Priority.INFO, "Deleted "
|
||||
+ subsToDelete.size()
|
||||
+ " expired adhocSubscriptions.");
|
||||
} catch (RegistryHandlerException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Failed to delete expired adhoc subscriptions.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -82,5 +82,9 @@
|
|||
<property name="registryHandler" ref="registryHandler" />
|
||||
</bean>
|
||||
|
||||
<bean name="AdhocSubscriptionHandler"
|
||||
class="com.raytheon.uf.common.datadelivery.registry.handlers.AdhocSubscriptionHandler">
|
||||
<property name="registryHandler" ref="registryHandler" />
|
||||
</bean>
|
||||
|
||||
</beans>
|
|
@ -57,12 +57,17 @@
|
|||
<constructor-arg ref="DataSetHandler" />
|
||||
</bean>
|
||||
|
||||
<bean id="registerAdhocSubscriptionHandler" factory-bean="registryObjectHandlerRegistry" factory-method="registerHandler">
|
||||
<constructor-arg value="com.raytheon.uf.common.datadelivery.registry.handlers.IAdhocSubscriptionHandler" />
|
||||
<constructor-arg ref="AdhocSubscriptionHandler" />
|
||||
</bean>
|
||||
|
||||
<!-- Used to consolidate the dependency clauses of beans that rely upon data delivery registry handlers -->
|
||||
<bean id="registerDataDeliveryHandlers" class="java.lang.String"
|
||||
depends-on="registerSubscriptionHandler,registerPendingSubscriptionHandler,
|
||||
registerGroupDefinitionHandler,
|
||||
registerProviderHandler,registerDataSetNameHandler,registerParameterHandler,
|
||||
registerParameterLevelHandler,registerDataSetMetaDataHandler,
|
||||
registerGriddedDataSetMetaDataHandler,registerDataSetHandler" />
|
||||
registerGriddedDataSetMetaDataHandler,registerDataSetHandler, registerAdhocSubscriptionHandler" />
|
||||
|
||||
</beans>
|
|
@ -2,6 +2,8 @@
|
|||
ebxml-subscription-process.cron=0+0/1+*+*+*+?
|
||||
# The period which the registry runs the garbage collection
|
||||
ebxml-garbage-collect-process.cron=0/10+*+*+*+*+?
|
||||
# The period which adhoc subscriptions are cleaned, every 20 mins
|
||||
adhocsubscription-process.cron=0+0/20+*+*+*+?
|
||||
# When a federation synchonization is necessary, this is the number of threads
|
||||
# that will be used for synchronization
|
||||
ebxml-federation-sync-threads=3
|
||||
|
|
Loading…
Add table
Reference in a new issue