From 3aa399c82e32d824c66e3dd829ea874309c1c181 Mon Sep 17 00:00:00 2001 From: Brad Gonzales Date: Tue, 19 Nov 2013 19:16:22 -0600 Subject: [PATCH] Issue #2545 Renamed datadelivery edex impl files to facilitate modes exclusion. Added monilithic impl config file for a registry that runs as an ncf and wfo for devRegistry mode. Added empty site and shared and local subscription handlers to enable the FindSubscriptionHandler bean to be configured through spring. Fix for re-routing Insert and Update registry events as data set metadata events which was lost when the registry was configured to distinguish between insert and update events. Moved subscriptionRoutesToSchedule bean (and other beans specific to an implementation) to the ncf, wfo, and monolithic edex impl spring files. Removed the wfo and ncf specific code from HibernateBandwidthInitializer.executeAfterRegistryInit() since the customized subscription handlers will be injected through spring. Removed the SBN route from wfo mode. Amend: Comment updates from peer review. Change-Id: Ic4c0dca8ebf1e86537e46a6231af58bb65c83cf8 Former-commit-id: 2f37534433602960a90f639388687a2e090bcf86 [formerly 5576ac613495e129bdf037df070fc1aa3a3743a7] [formerly 053f20c70be96a0e6c05bb840e76dd47ef1feee3] [formerly 95a1914c71fcf58339136eae732fd75aefba7f31 [formerly 053f20c70be96a0e6c05bb840e76dd47ef1feee3 [formerly c245f741b9e78d8e4503698336d9929536e72e0d]]] Former-commit-id: 95a1914c71fcf58339136eae732fd75aefba7f31 Former-commit-id: 19437f081eb72b80741e738e53af17b271610621 [formerly 04829d37e2f876ff17d290bebc6dc73f68731583] Former-commit-id: 3c86e33ea44897fe69ac95ee9e5614f60a5b674d --- edexOsgi/build.edex/esb/conf/modes.xml | 13 +- .../bandwidth/data/BandwidthGraphData.java | 12 + .../EmptySharedSubscriptionHandler.java | 240 ++++++++++++++++++ .../EmptySiteSubscriptionHandler.java | 238 +++++++++++++++++ .../META-INF/MANIFEST.MF | 3 +- ...dth-datadelivery-edex-impl-monolithic.xml} | 18 +- ... bandwidth-datadelivery-edex-impl-ncf.xml} | 30 +++ .../res/spring/bandwidth-datadelivery-ncf.xml | 4 - .../MonolithicBandwidthManagerCreator.java | 118 +++++++++ .../ncf/NcfBandwidthManagerCreator.java | 26 ++ .../bandwidth-datadelivery-edex-impl-wfo.xml | 78 ++++++ .../bandwidth-datadelivery-edex-impl.xml | 11 - .../res/spring/bandwidth-datadelivery-wfo.xml | 5 - .../bandwidth/BandwidthManager.java | 4 +- .../bandwidth/EdexBandwidthManager.java | 92 +++---- .../bandwidth/WfoBandwidthManagerCreator.java | 42 +++ .../handler/LocalSiteSubscriptionHandler.java | 78 ++++++ .../HibernateBandwidthInitializer.java | 18 +- 18 files changed, 942 insertions(+), 88 deletions(-) create mode 100644 edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/EmptySharedSubscriptionHandler.java create mode 100644 edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/EmptySiteSubscriptionHandler.java rename edexOsgi/{com.raytheon.uf.edex.datadelivery.bandwidth/res/spring/bandwidth-datadelivery-wfo-edex-impl.xml => com.raytheon.uf.edex.datadelivery.bandwidth.ncf/res/spring/bandwidth-datadelivery-edex-impl-monolithic.xml} (78%) rename edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth.ncf/res/spring/{bandwidth-datadelivery-ncf-edex-impl.xml => bandwidth-datadelivery-edex-impl-ncf.xml} (58%) create mode 100644 edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth.ncf/src/com/raytheon/uf/edex/datadelivery/bandwidth/ncf/MonolithicBandwidthManagerCreator.java create mode 100644 edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/res/spring/bandwidth-datadelivery-edex-impl-wfo.xml create mode 100644 edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/handler/LocalSiteSubscriptionHandler.java diff --git a/edexOsgi/build.edex/esb/conf/modes.xml b/edexOsgi/build.edex/esb/conf/modes.xml index fb119fb0d6..0b403a5084 100644 --- a/edexOsgi/build.edex/esb/conf/modes.xml +++ b/edexOsgi/build.edex/esb/conf/modes.xml @@ -236,7 +236,9 @@ ebxml.*\.xml dataDeliveryTemplate datadelivery-wfo-cron.xml - .*datadelivery-ncf.* + bandwidth-datadelivery-edex-impl-wfo.xml + .*datadelivery.*-ncf.* + .*datadelivery.*-monolithic.* harvester-* crawler-* @@ -244,7 +246,9 @@ ebxml.*\.xml dataDeliveryTemplate - .*datadelivery-wfo.* + bandwidth-datadelivery-edex-impl-ncf.xml + .*datadelivery.*-wfo.* + .*datadelivery.*-monolithic.* @@ -299,9 +303,10 @@ are for DEVELOPMENT purposes only --> ebxml.*\.xml - adhoc-datadelivery-wfo.xml + datadelivery-wfo-cron.xml dataDeliveryTemplate - .*datadelivery-ncf.* + bandwidth-datadelivery-edex-impl-monolithic.xml + .*datadelivery.*-ncf.* .*sbn-simulator-wfo.* diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.bandwidth/src/com/raytheon/uf/common/datadelivery/bandwidth/data/BandwidthGraphData.java b/edexOsgi/com.raytheon.uf.common.datadelivery.bandwidth/src/com/raytheon/uf/common/datadelivery/bandwidth/data/BandwidthGraphData.java index f4cb0add4c..84a45b53d3 100644 --- a/edexOsgi/com.raytheon.uf.common.datadelivery.bandwidth/src/com/raytheon/uf/common/datadelivery/bandwidth/data/BandwidthGraphData.java +++ b/edexOsgi/com.raytheon.uf.common.datadelivery.bandwidth/src/com/raytheon/uf/common/datadelivery/bandwidth/data/BandwidthGraphData.java @@ -48,6 +48,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; * Dec 06, 2012 1397 djohnson Add dynamic serialize class annotation. * Jan 25, 2013 1528 djohnson Subscription priority is now an enum. * Sep 20, 2013 2397 bgonzale Added Map of Bucket Descriptions. + * Nov 19, 2013 2545 bgonzale Added 'add' method stub. Still work to do. * * * @@ -95,6 +96,17 @@ public class BandwidthGraphData { priorityMap = new HashMap(); } + /** + * Add the other BandwidthGraphData data to this object. + * + * @param other + */ + public void add(BandwidthGraphData other) { + /* + * TODO merge SBN and OPSNET data into on Bandwidth Graph Data + */ + } + /** * @return the dataMap */ diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/EmptySharedSubscriptionHandler.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/EmptySharedSubscriptionHandler.java new file mode 100644 index 0000000000..28fab17f77 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/EmptySharedSubscriptionHandler.java @@ -0,0 +1,240 @@ +/** + * 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.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Set; + +import com.raytheon.uf.common.datadelivery.registry.Network; +import com.raytheon.uf.common.datadelivery.registry.PendingSubscription; +import com.raytheon.uf.common.datadelivery.registry.SharedSubscription; +import com.raytheon.uf.common.registry.handler.RegistryHandlerException; + +/** + * SharedSubscriptionHandler that performs no operations. Injected when shared + * subscriptions should be ignored. Used by the wfo registry since wfos do not + * process shared subscriptions. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Nov 4, 2013  2545       bgonzale    Initial creation
+ * 
+ * 
+ * + * @author bgonzale + * @version 1.0 + */ + +public class EmptySharedSubscriptionHandler implements + ISharedSubscriptionHandler { + + /* (non-Javadoc) + * @see com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionTypeHandler#getByPendingSubscription(com.raytheon.uf.common.datadelivery.registry.PendingSubscription) + */ + @Override + public SharedSubscription getByPendingSubscription( + PendingSubscription pending) throws RegistryHandlerException { + return null; + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionTypeHandler#getByPendingSubscriptionId(java.lang.String) + */ + @Override + public SharedSubscription getByPendingSubscriptionId(String id) + throws RegistryHandlerException { + return null; + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionTypeHandler#getActiveByDataSetAndProvider(java.lang.String, java.lang.String) + */ + @Override + public List getActiveByDataSetAndProvider( + String dataSetName, String providerName) + throws RegistryHandlerException { + return Collections.EMPTY_LIST; + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getByName(java.lang.String) + */ + @Override + public SharedSubscription getByName(String name) + throws RegistryHandlerException { + return null; + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getByNames(java.util.Collection) + */ + @Override + public List getByNames(Collection names) + throws RegistryHandlerException { + return Collections.EMPTY_LIST; + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getByOwner(java.lang.String) + */ + @Override + public List getByOwner(String owner) + throws RegistryHandlerException { + return Collections.EMPTY_LIST; + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getByGroupName(java.lang.String) + */ + @Override + public List getByGroupName(String group) + throws RegistryHandlerException { + return Collections.EMPTY_LIST; + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getByFilters(java.lang.String, java.lang.String) + */ + @Override + public List getByFilters(String group, String officeId) + throws RegistryHandlerException { + return Collections.EMPTY_LIST; + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getSubscribedToDataSetNames(java.lang.String) + */ + @Override + public Set getSubscribedToDataSetNames(String siteId) + throws RegistryHandlerException { + return Collections.EMPTY_SET; + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getActive() + */ + @Override + public List getActive() throws RegistryHandlerException { + return Collections.EMPTY_LIST; + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getActiveForRoute(com.raytheon.uf.common.datadelivery.registry.Network) + */ + @Override + public List getActiveForRoute(Network route) + throws RegistryHandlerException { + return Collections.EMPTY_LIST; + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getActiveForRoutes(com.raytheon.uf.common.datadelivery.registry.Network[]) + */ + @Override + public List getActiveForRoutes(Network... routes) + throws RegistryHandlerException { + return Collections.EMPTY_LIST; + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#getById(java.lang.String) + */ + @Override + public SharedSubscription getById(String id) + throws RegistryHandlerException { + return null; + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#getAll() + */ + @Override + public List getAll() throws RegistryHandlerException { + return Collections.EMPTY_LIST; + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#store(java.lang.Object) + */ + @Override + public void store(SharedSubscription obj) throws RegistryHandlerException { + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#update(java.lang.Object) + */ + @Override + public void update(SharedSubscription obj) throws RegistryHandlerException { + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#delete(java.lang.Object) + */ + @Override + public void delete(SharedSubscription obj) throws RegistryHandlerException { + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#deleteById(java.lang.String, java.lang.String) + */ + @Override + public void deleteById(String username, String registryId) + throws RegistryHandlerException { + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#deleteByIds(java.lang.String, java.util.List) + */ + @Override + public void deleteByIds(String username, List registryIds) + throws RegistryHandlerException { + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#delete(java.lang.String, java.lang.Object) + */ + @Override + public void delete(String username, SharedSubscription obj) + throws RegistryHandlerException { + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#delete(java.util.Collection) + */ + @Override + public void delete(Collection objects) + throws RegistryHandlerException { + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#delete(java.lang.String, java.util.Collection) + */ + @Override + public void delete(String username, Collection objects) + throws RegistryHandlerException { + } + +} diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/EmptySiteSubscriptionHandler.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/EmptySiteSubscriptionHandler.java new file mode 100644 index 0000000000..12f534c042 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/EmptySiteSubscriptionHandler.java @@ -0,0 +1,238 @@ +/** + * 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.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Set; + +import com.raytheon.uf.common.datadelivery.registry.Network; +import com.raytheon.uf.common.datadelivery.registry.PendingSubscription; +import com.raytheon.uf.common.datadelivery.registry.SiteSubscription; +import com.raytheon.uf.common.registry.handler.RegistryHandlerException; + +/** + * SiteSubscriptionHandler that performs no operations. Injected when site + * subscriptions should be ignored. Used by the ncf registry since it does not + * process site subscriptions. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Nov 4, 2013  2545       bgonzale    Initial creation
+ * 
+ * 
+ * + * @author bgonzale + * @version 1.0 + */ + +public class EmptySiteSubscriptionHandler implements ISiteSubscriptionHandler { + + /* (non-Javadoc) + * @see com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionTypeHandler#getByPendingSubscription(com.raytheon.uf.common.datadelivery.registry.PendingSubscription) + */ + @Override + public SiteSubscription getByPendingSubscription(PendingSubscription pending) + throws RegistryHandlerException { + return null; + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionTypeHandler#getByPendingSubscriptionId(java.lang.String) + */ + @Override + public SiteSubscription getByPendingSubscriptionId(String id) + throws RegistryHandlerException { + return null; + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionTypeHandler#getActiveByDataSetAndProvider(java.lang.String, java.lang.String) + */ + @Override + public List getActiveByDataSetAndProvider( + String dataSetName, String providerName) + throws RegistryHandlerException { + return Collections.EMPTY_LIST; + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getByName(java.lang.String) + */ + @Override + public SiteSubscription getByName(String name) + throws RegistryHandlerException { + return null; + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getByNames(java.util.Collection) + */ + @Override + public List getByNames(Collection names) + throws RegistryHandlerException { + return Collections.EMPTY_LIST; + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getByOwner(java.lang.String) + */ + @Override + public List getByOwner(String owner) + throws RegistryHandlerException { + return Collections.EMPTY_LIST; + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getByGroupName(java.lang.String) + */ + @Override + public List getByGroupName(String group) + throws RegistryHandlerException { + return Collections.EMPTY_LIST; + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getByFilters(java.lang.String, java.lang.String) + */ + @Override + public List getByFilters(String group, String officeId) + throws RegistryHandlerException { + return Collections.EMPTY_LIST; + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getSubscribedToDataSetNames(java.lang.String) + */ + @Override + public Set getSubscribedToDataSetNames(String siteId) + throws RegistryHandlerException { + return Collections.EMPTY_SET; + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getActive() + */ + @Override + public List getActive() throws RegistryHandlerException { + return Collections.EMPTY_LIST; + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getActiveForRoute(com.raytheon.uf.common.datadelivery.registry.Network) + */ + @Override + public List getActiveForRoute(Network route) + throws RegistryHandlerException { + return Collections.EMPTY_LIST; + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.datadelivery.registry.handlers.IBaseSubscriptionHandler#getActiveForRoutes(com.raytheon.uf.common.datadelivery.registry.Network[]) + */ + @Override + public List getActiveForRoutes(Network... routes) + throws RegistryHandlerException { + return Collections.EMPTY_LIST; + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#getById(java.lang.String) + */ + @Override + public SiteSubscription getById(String id) throws RegistryHandlerException { + return null; + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#getAll() + */ + @Override + public List getAll() throws RegistryHandlerException { + return Collections.EMPTY_LIST; + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#store(java.lang.Object) + */ + @Override + public void store(SiteSubscription obj) throws RegistryHandlerException { + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#update(java.lang.Object) + */ + @Override + public void update(SiteSubscription obj) throws RegistryHandlerException { + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#delete(java.lang.Object) + */ + @Override + public void delete(SiteSubscription obj) throws RegistryHandlerException { + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#deleteById(java.lang.String, java.lang.String) + */ + @Override + public void deleteById(String username, String registryId) + throws RegistryHandlerException { + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#deleteByIds(java.lang.String, java.util.List) + */ + @Override + public void deleteByIds(String username, List registryIds) + throws RegistryHandlerException { + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#delete(java.lang.String, java.lang.Object) + */ + @Override + public void delete(String username, SiteSubscription obj) + throws RegistryHandlerException { + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#delete(java.util.Collection) + */ + @Override + public void delete(Collection objects) + throws RegistryHandlerException { + } + + /* (non-Javadoc) + * @see com.raytheon.uf.common.registry.handler.IRegistryObjectHandler#delete(java.lang.String, java.util.Collection) + */ + @Override + public void delete(String username, Collection objects) + throws RegistryHandlerException { + } + +} diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth.ncf/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth.ncf/META-INF/MANIFEST.MF index b7c2f5cb8f..f1e04cccf9 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth.ncf/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth.ncf/META-INF/MANIFEST.MF @@ -18,4 +18,5 @@ Require-Bundle: com.raytheon.uf.common.datadelivery.bandwidth;bundle-version="1. com.raytheon.uf.edex.core;bundle-version="1.12.1174", com.raytheon.uf.common.registry.ebxml;bundle-version="1.0.0", com.raytheon.uf.common.datadelivery.service;bundle-version="1.0.0" -Import-Package: com.raytheon.edex.site +Import-Package: com.raytheon.edex.site, + com.raytheon.uf.common.event diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/res/spring/bandwidth-datadelivery-wfo-edex-impl.xml b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth.ncf/res/spring/bandwidth-datadelivery-edex-impl-monolithic.xml similarity index 78% rename from edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/res/spring/bandwidth-datadelivery-wfo-edex-impl.xml rename to edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth.ncf/res/spring/bandwidth-datadelivery-edex-impl-monolithic.xml index 60851496c3..539ee0f834 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/res/spring/bandwidth-datadelivery-wfo-edex-impl.xml +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth.ncf/res/spring/bandwidth-datadelivery-edex-impl-monolithic.xml @@ -4,7 +4,23 @@ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd"> + class="com.raytheon.uf.edex.datadelivery.bandwidth.ncf.MonolithicBandwidthManagerCreator" /> + + + OPSNET + SBN + + + + + + + + + + + + + + + + + + + + + + + + SBN + + + + + + + + + + + diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth.ncf/res/spring/bandwidth-datadelivery-ncf.xml b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth.ncf/res/spring/bandwidth-datadelivery-ncf.xml index 4a4a10e862..62e606b102 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth.ncf/res/spring/bandwidth-datadelivery-ncf.xml +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth.ncf/res/spring/bandwidth-datadelivery-ncf.xml @@ -3,10 +3,6 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd"> - - SBN - - diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth.ncf/src/com/raytheon/uf/edex/datadelivery/bandwidth/ncf/MonolithicBandwidthManagerCreator.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth.ncf/src/com/raytheon/uf/edex/datadelivery/bandwidth/ncf/MonolithicBandwidthManagerCreator.java new file mode 100644 index 0000000000..9f502bd81e --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth.ncf/src/com/raytheon/uf/edex/datadelivery/bandwidth/ncf/MonolithicBandwidthManagerCreator.java @@ -0,0 +1,118 @@ +/** + * 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.ncf; + +import com.raytheon.uf.common.datadelivery.registry.Coverage; +import com.raytheon.uf.common.datadelivery.registry.Time; +import com.raytheon.uf.common.datadelivery.registry.handlers.IDataSetMetaDataHandler; +import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler; +import com.raytheon.uf.common.datadelivery.service.ISubscriptionNotificationService; +import com.raytheon.uf.common.util.JarUtil; +import com.raytheon.uf.edex.datadelivery.bandwidth.BandwidthManager; +import com.raytheon.uf.edex.datadelivery.bandwidth.EdexBandwidthContextFactory.IEdexBandwidthManagerCreator; +import com.raytheon.uf.edex.datadelivery.bandwidth.IBandwidthManager; +import com.raytheon.uf.edex.datadelivery.bandwidth.dao.IBandwidthDao; +import com.raytheon.uf.edex.datadelivery.bandwidth.dao.IBandwidthDbInit; +import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalManager; +import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthDaoUtil; + +/** + * {@link IEdexBandwidthManagerCreator} A bandwidth manager creator for + * bandwidth managers that act standalone. They do not have parent or client + * registries, but handle the scheduling themselves. This creator will configure + * the manager with the spring files to configure SBN and OPSNET retrievals. + * + * This is primarily for a development EDEX mode for registry so that testing + * can be on a standalone box. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Nov 13, 2013 2545       bgonzale    Initial creation
+ * 
+ * 
+ * + * @author bgonzale + * @version 1.0 + */ +public class MonolithicBandwidthManagerCreator + extends NcfBandwidthManagerCreator { + + /** + * NCF {@link BandwidthManager} implementation. + */ + static class MonolithicBandwidthManager + extends NcfBandwidthManager { + + private static final String[] BANDWIDTH_MANAGER_FILES = new String[] { + JarUtil.getResResourcePath("/spring/bandwidth-datadelivery-monolithic-edex-impl.xml"), + JarUtil.getResResourcePath("/spring/bandwidth-datadelivery-edex-impl.xml"), + JarUtil.getResResourcePath("/spring/bandwidth-datadelivery.xml"), + JarUtil.getResResourcePath("/spring/bandwidth-datadelivery-daos.xml"), + JarUtil.getResResourcePath("/spring/bandwidth-datadelivery-eventbus.xml"), + JarUtil.getResResourcePath("/spring/thrift-bandwidth.xml"), + JarUtil.getResResourcePath("/spring/bandwidth-datadelivery-wfo.xml") }; + + /** + * Constructor. + * + * @param dbInit + * @param bandwidthDao + * @param retrievalManager + * @param bandwidthDaoUtil + */ + public MonolithicBandwidthManager(IBandwidthDbInit dbInit, + IBandwidthDao bandwidthDao, RetrievalManager retrievalManager, + BandwidthDaoUtil bandwidthDaoUtil, + IDataSetMetaDataHandler dataSetMetaDataHandler, + ISubscriptionHandler subscriptionHandler, + ISubscriptionNotificationService subscriptionNotificationService) { + super(dbInit, bandwidthDao, retrievalManager, bandwidthDaoUtil, + dataSetMetaDataHandler, subscriptionHandler, + subscriptionNotificationService); + } + + @Override + protected String[] getSpringFilesForNewInstance() { + return BANDWIDTH_MANAGER_FILES; + } + + } + + /** + * {@inheritDoc} + */ + @Override + public IBandwidthManager getBandwidthManager(IBandwidthDbInit dbInit, + IBandwidthDao bandwidthDao, RetrievalManager retrievalManager, + BandwidthDaoUtil bandwidthDaoUtil, + IDataSetMetaDataHandler dataSetMetaDataHandler, + ISubscriptionHandler subscriptionHandler, + ISubscriptionNotificationService subscriptionNotificationService) { + return new MonolithicBandwidthManager(dbInit, bandwidthDao, + retrievalManager, + bandwidthDaoUtil, dataSetMetaDataHandler, subscriptionHandler, + subscriptionNotificationService); + } + +} diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth.ncf/src/com/raytheon/uf/edex/datadelivery/bandwidth/ncf/NcfBandwidthManagerCreator.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth.ncf/src/com/raytheon/uf/edex/datadelivery/bandwidth/ncf/NcfBandwidthManagerCreator.java index ffb8eb70ce..1c02d58de4 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth.ncf/src/com/raytheon/uf/edex/datadelivery/bandwidth/ncf/NcfBandwidthManagerCreator.java +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth.ncf/src/com/raytheon/uf/edex/datadelivery/bandwidth/ncf/NcfBandwidthManagerCreator.java @@ -22,13 +22,17 @@ package com.raytheon.uf.edex.datadelivery.bandwidth.ncf; import java.util.List; import java.util.Set; +import com.google.common.eventbus.AllowConcurrentEvents; +import com.google.common.eventbus.Subscribe; import com.raytheon.uf.common.datadelivery.bandwidth.ProposeScheduleResponse; import com.raytheon.uf.common.datadelivery.registry.Coverage; +import com.raytheon.uf.common.datadelivery.registry.DataDeliveryRegistryObjectTypes; import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.datadelivery.registry.Time; import com.raytheon.uf.common.datadelivery.registry.handlers.IDataSetMetaDataHandler; import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler; import com.raytheon.uf.common.datadelivery.service.ISubscriptionNotificationService; +import com.raytheon.uf.common.registry.event.UpdateRegistryEvent; import com.raytheon.uf.common.serialization.SerializationException; import com.raytheon.uf.common.util.JarUtil; import com.raytheon.uf.edex.datadelivery.bandwidth.BandwidthManager; @@ -56,6 +60,8 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthDaoUtil; * Jul 10, 2013 2106 djohnson Dependency inject registry handlers. * Oct 3 2013 1797 dhladky Generics added * Nov 08, 2013 2506 bgonzale Added subscription notification service to bandwidth manager. + * Nov 19, 2013 2545 bgonzale Added registryEventListener method for update events. + * Reschedule updated shared subscriptions. * * * @@ -97,6 +103,26 @@ public class NcfBandwidthManagerCreator impl subscriptionNotificationService); } + /** + * Listen for Registry update events. Filter for subscription specific + * events. Sends corresponding subscription notification events. + * + * @param event + */ + @Override + @Subscribe + @AllowConcurrentEvents + public void registryEventListener(UpdateRegistryEvent event) { + super.registryEventListener(event); + if (DataDeliveryRegistryObjectTypes.SHARED_SUBSCRIPTION + .equals(event.getObjectType())) { + Subscription subscription = getRegistryObjectById( + getSubscriptionHandler(), event.getId()); + subscriptionUpdated(subscription); + sendSubscriptionNotificationEvent(event, subscription); + } + } + @Override protected String[] getSpringFilesForNewInstance() { return NCF_BANDWIDTH_MANAGER_FILES; diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/res/spring/bandwidth-datadelivery-edex-impl-wfo.xml b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/res/spring/bandwidth-datadelivery-edex-impl-wfo.xml new file mode 100644 index 0000000000..74ca849916 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/res/spring/bandwidth-datadelivery-edex-impl-wfo.xml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + OPSNET + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/res/spring/bandwidth-datadelivery-edex-impl.xml b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/res/spring/bandwidth-datadelivery-edex-impl.xml index 928e345d2f..7881c85f3a 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/res/spring/bandwidth-datadelivery-edex-impl.xml +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/res/spring/bandwidth-datadelivery-edex-impl.xml @@ -28,17 +28,6 @@
- - - - - - - - - diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/res/spring/bandwidth-datadelivery-wfo.xml b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/res/spring/bandwidth-datadelivery-wfo.xml index a357acdbe4..5b52dde11c 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/res/spring/bandwidth-datadelivery-wfo.xml +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/res/spring/bandwidth-datadelivery-wfo.xml @@ -3,11 +3,6 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd"> - - OPSNET - SBN - - diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthManager.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthManager.java index f298d2cfda..8e1f1e6a9d 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthManager.java +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthManager.java @@ -125,6 +125,8 @@ import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException; * Oct 23, 2013 2385 bphillip Change schedule method to scheduleAdhoc * Oct 30, 2013 2448 dhladky Moved methods to TimeUtil. * Nov 04, 2013 2506 bgonzale Added removeBandwidthSubscriptions method. + * Nov 19, 2013 2545 bgonzale changed getBandwidthGraphData to protected. + * * * * @author dhladky @@ -879,7 +881,7 @@ public abstract class BandwidthManager * * @return the graph data */ - private BandwidthGraphData getBandwidthGraphData() { + protected BandwidthGraphData getBandwidthGraphData() { return new BandwidthGraphDataAdapter(retrievalManager).get(); } diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/EdexBandwidthManager.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/EdexBandwidthManager.java index e8d28cb27a..0ef41d3a09 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/EdexBandwidthManager.java +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/EdexBandwidthManager.java @@ -108,7 +108,8 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil; * Added subscriptionNotificationService field. * Send notifications. * Nov 15, 2013 2545 bgonzale Added check for subscription events before sending - * notifications. + * notifications. Republish dataset metadata registry + * insert and update events as dataset metadata events. * * * @@ -335,7 +336,8 @@ public abstract class EdexBandwidthManager try { Subscription sub = (Subscription) RegistryEncoders .ofType(JAXB).decodeObject( - ((RemoveRegistryEvent) event).getRemovedObject()); + ((RemoveRegistryEvent) event) + .getRemovedObject()); sendSubscriptionNotificationEvent(event, sub); } catch (SerializationException e) { statusHandler @@ -348,8 +350,8 @@ public abstract class EdexBandwidthManager } /** - * Create a hook into the EDEX Notification sub-system to receive the the - * necessary InsertRegistryEvents to drive Bandwidth Management. + * Listen for registry insert events necessary to drive Bandwidth + * Management. * * @param re * The InsertRegistryEvent Object to evaluate. @@ -358,33 +360,9 @@ public abstract class EdexBandwidthManager @AllowConcurrentEvents public void registryEventListener(InsertRegistryEvent re) { final String objectType = re.getObjectType(); - final String id = re.getId(); if (DataDeliveryRegistryObjectTypes.DATASETMETADATA.equals(objectType)) { - - DataSetMetaData dsmd = getDataSetMetaData(id); - - if (dsmd != null) { - // Repost the Object to the BandwidthEventBus to free - // the notification thread. - - // TODO: A hack to prevent rap_f and rap datasets being - // Identified as the - // same dataset... - Matcher matcher = RAP_PATTERN.matcher(dsmd.getUrl()); - if (matcher.matches()) { - statusHandler - .info("Found rap_f dataset - updating dataset name from [" - + dsmd.getDataSetName() + "] to [rap_f]"); - dsmd.setDataSetName("rap_f"); - } - // TODO: End of hack.. - - BandwidthEventBus.publish(dsmd); - } else { - statusHandler.error("No DataSetMetaData found for id [" + id - + "]"); - } + publishDataSetMetaDataEvent(re); } if (DataDeliveryRegistryObjectTypes.isRecurringSubscription(re .getObjectType())) { @@ -394,24 +372,15 @@ public abstract class EdexBandwidthManager } } - /** - * Create a hook into the EDEX Notification sub-system to receive - * UpdateRegistryEvents. Filter for subscription specific events. - * - * @param event - */ - @Subscribe - @AllowConcurrentEvents - public void registryEventListener(UpdateRegistryEvent event) { - if (DataDeliveryRegistryObjectTypes.isRecurringSubscription(event - .getObjectType())) { - Subscription sub = getRegistryObjectById(subscriptionHandler, - event.getId()); - sendSubscriptionNotificationEvent(event, sub); + protected void registryEventListener(UpdateRegistryEvent event) { + final String objectType = event.getObjectType(); + + if (DataDeliveryRegistryObjectTypes.DATASETMETADATA.equals(objectType)) { + publishDataSetMetaDataEvent(event); } } - private void sendSubscriptionNotificationEvent(RegistryEvent event, + protected void sendSubscriptionNotificationEvent(RegistryEvent event, Subscription sub) { final String objectType = event.getObjectType(); @@ -447,11 +416,37 @@ public abstract class EdexBandwidthManager } } + private void publishDataSetMetaDataEvent(RegistryEvent re) { + final String id = re.getId(); + DataSetMetaData dsmd = getDataSetMetaData(id); + + if (dsmd != null) { + // Repost the Object to the BandwidthEventBus to free + // the notification thread. + + // TODO: A hack to prevent rap_f and rap datasets being + // Identified as the + // same dataset... + Matcher matcher = RAP_PATTERN.matcher(dsmd.getUrl()); + if (matcher.matches()) { + statusHandler + .info("Found rap_f dataset - updating dataset name from [" + + dsmd.getDataSetName() + "] to [rap_f]"); + dsmd.setDataSetName("rap_f"); + } + // TODO: End of hack.. + + BandwidthEventBus.publish(dsmd); + } else { + statusHandler.error("No DataSetMetaData found for id [" + id + "]"); + } + } + private DataSetMetaData getDataSetMetaData(String id) { return getRegistryObjectById(dataSetMetaDataHandler, id); } - private static M getRegistryObjectById( + protected static M getRegistryObjectById( IRegistryObjectHandler handler, String id) { try { return handler.getById(id); @@ -462,6 +457,13 @@ public abstract class EdexBandwidthManager } } + /** + * @return the subscriptionHandler + */ + public ISubscriptionHandler getSubscriptionHandler() { + return subscriptionHandler; + } + /** * Process a {@link GriddedDataSetMetaData} that was received from the event * bus. diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/WfoBandwidthManagerCreator.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/WfoBandwidthManagerCreator.java index 7b23f5a6d9..9f190144c5 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/WfoBandwidthManagerCreator.java +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/WfoBandwidthManagerCreator.java @@ -22,14 +22,20 @@ package com.raytheon.uf.edex.datadelivery.bandwidth; import java.util.List; import java.util.Set; +import com.google.common.eventbus.AllowConcurrentEvents; +import com.google.common.eventbus.Subscribe; +import com.raytheon.edex.site.SiteUtil; import com.raytheon.uf.common.datadelivery.bandwidth.IBandwidthService; import com.raytheon.uf.common.datadelivery.bandwidth.IProposeScheduleResponse; +import com.raytheon.uf.common.datadelivery.bandwidth.data.BandwidthGraphData; import com.raytheon.uf.common.datadelivery.registry.Coverage; +import com.raytheon.uf.common.datadelivery.registry.DataDeliveryRegistryObjectTypes; import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.datadelivery.registry.Time; import com.raytheon.uf.common.datadelivery.registry.handlers.IDataSetMetaDataHandler; import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler; import com.raytheon.uf.common.datadelivery.service.ISubscriptionNotificationService; +import com.raytheon.uf.common.registry.event.UpdateRegistryEvent; import com.raytheon.uf.common.serialization.SerializationException; import com.raytheon.uf.common.util.JarUtil; import com.raytheon.uf.edex.datadelivery.bandwidth.EdexBandwidthContextFactory.IEdexBandwidthManagerCreator; @@ -55,6 +61,9 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthDaoUtil; * Oct 2, 2013 1797 dhladky Generics * Oct 28, 2013 2506 bgonzale SBN (Shared) Scheduled at the central registry. * Added subscription notification service to bandwidth manager. + * Nov 19, 2013 2545 bgonzale Added registryEventListener method for update events. + * Added getBandwidthGraphData. + * Reschedule updated local subscriptions. * * * @@ -100,6 +109,32 @@ public class WfoBandwidthManagerCreator impl subscriptionNotificationService); } + /** + * Listen for Registry update events. Filter for subscription specific + * events. Sends corresponding subscription notification events. + * + * @param event + */ + @Override + @Subscribe + @AllowConcurrentEvents + public void registryEventListener(UpdateRegistryEvent event) { + super.registryEventListener(event); + if (DataDeliveryRegistryObjectTypes.SITE_SUBSCRIPTION.equals(event + .getObjectType())) { + Subscription subscription = getRegistryObjectById( + getSubscriptionHandler(), event.getId()); + boolean isLocalOrigination = subscription.getOriginatingSite() + .equals( + SiteUtil.getSite()); + + if (isLocalOrigination) { + subscriptionUpdated(subscription); + } + sendSubscriptionNotificationEvent(event, subscription); + } + } + @Override protected String[] getSpringFilesForNewInstance() { return WFO_BANDWIDTH_MANAGER_FILES; @@ -134,6 +169,13 @@ public class WfoBandwidthManagerCreator impl return ncfBandwidthService.schedule(subscriptions); } + @Override + protected BandwidthGraphData getBandwidthGraphData() { + BandwidthGraphData data = super.getBandwidthGraphData(); + data.add(ncfBandwidthService.getBandwidthGraphData()); + return data; + } + } /** diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/handler/LocalSiteSubscriptionHandler.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/handler/LocalSiteSubscriptionHandler.java new file mode 100644 index 0000000000..dc79a768ad --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/handler/LocalSiteSubscriptionHandler.java @@ -0,0 +1,78 @@ +/** + * This software was developed and / or modified by Raytheon Company, + * pursuant to Contract DG133W-05-CQ-1067 with the US Government. + * + * U.S. EXPORT CONTROLLED TECHNICAL DATA + * This software product contains export-restricted data whose + * export/transfer/disclosure is restricted by U.S. law. Dissemination + * to non-U.S. persons whether in the United States or abroad requires + * an export license or other authorization. + * + * Contractor Name: Raytheon Company + * Contractor Address: 6825 Pine Street, Suite 340 + * Mail Stop B8 + * Omaha, NE 68106 + * 402.291.0100 + * + * See the AWIPS II Master Rights File ("Master Rights File.pdf") for + * further licensing information. + **/ +package com.raytheon.uf.edex.datadelivery.bandwidth.handler; + +import com.raytheon.edex.site.SiteUtil; +import com.raytheon.uf.common.datadelivery.registry.SiteSubscription; +import com.raytheon.uf.common.datadelivery.registry.ebxml.SiteSubscriptionQuery; +import com.raytheon.uf.common.datadelivery.registry.handlers.SiteSubscriptionHandler; +import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler; + +/** + * {@link IRegistryObjectHandler} implementation for {@link SiteSubscription}. + * Retrieves only subscritions for the given site id. If the site id is not set + * then it retrieves all. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Nov 14, 2013 2545       bgonzale    Initial creation.
+ * 
+ * 
+ * + * @author bgonzale + * @version 1.0 + */ +public class LocalSiteSubscriptionHandler extends SiteSubscriptionHandler { + + private String officeId; + + /** + * Default Constructor. + */ + public LocalSiteSubscriptionHandler() { + this(SiteUtil.getSite()); + } + + /** + * Initialization Constructor. + * + * @param officeId + */ + public LocalSiteSubscriptionHandler(String officeId) { + this.officeId = officeId; + } + + /** + * {@inheritDoc} + */ + @Override + protected SiteSubscriptionQuery getQuery() { + SiteSubscriptionQuery query = new SiteSubscriptionQuery(); + if (officeId != null) { + query.setOfficeId(officeId); + } + return query; + } + +} diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/hibernate/HibernateBandwidthInitializer.java b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/hibernate/HibernateBandwidthInitializer.java index e1a5a03b53..d4debdfa11 100644 --- a/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/hibernate/HibernateBandwidthInitializer.java +++ b/edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/hibernate/HibernateBandwidthInitializer.java @@ -6,7 +6,6 @@ import java.util.List; import java.util.Set; import com.raytheon.edex.site.SiteUtil; -import com.raytheon.uf.common.datadelivery.registry.SharedSubscription; import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.registry.ebxml.RegistryUtil; import com.raytheon.uf.common.status.IUFStatusHandler; @@ -36,6 +35,8 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalManager; * Sep 06, 2013 2344 bgonzale Removed attempt to add to immutable empty set. * Oct 16, 2013 2267 bgonzale executeAfterRegistryInit subscribes to all local. Removed is shared checks. * Nov 04, 2013 2506 bgonzale added site field. facilitates testing. + * Nov 19, 2013 2545 bgonzale Removed programmatic customization for central, client, and dev(monolithic) + * registries since the injected FindSubscription handler will be configured now. * * * @@ -101,26 +102,11 @@ public class HibernateBandwidthInitializer implements BandwidthInitializer { public void executeAfterRegistryInit() { Set activeSubscriptions = new HashSet(); try { - final String localOffice = SiteUtil.getSite(); - final boolean isRegistry = System.getProperty("edex.run.mode") - .equals("registry"); - final boolean isCentralRegistry = System.getProperty( - "edex.run.mode").equals("centralRegistry"); - // Load active subscriptions for (Subscription sub : findSubscriptionsStrategy .findSubscriptionsToSchedule()) { - boolean isShared = (sub instanceof SharedSubscription); - boolean isLocalOffice = sub.getOfficeIDs() - .contains(localOffice); - - if ((isCentralRegistry && isShared) - || (isRegistry && isLocalOffice && !isShared)) { activeSubscriptions.add(sub); statusHandler.info("Scheduling Subscription: " + sub); - } else { - statusHandler.info("Not Scheduling Subscription: " + sub); - } } } catch (Exception e) { statusHandler.error(