From d357b534c4b66f54d3e16921b68d442c1131f082 Mon Sep 17 00:00:00 2001 From: Richard Peter Date: Thu, 12 Dec 2013 13:47:37 -0600 Subject: [PATCH] Issue #2170: Add registration of Router to Notification Framework Change-Id: Ib2bc29d82395a021cee3a8f98b894010303f06ad Former-commit-id: db0e9d40ecc229b5730f7d578413947fbbf6622b [formerly 312fcc2b2f244e15c7ed6a1dc913d59a3edc4a12] [formerly db0e9d40ecc229b5730f7d578413947fbbf6622b [formerly 312fcc2b2f244e15c7ed6a1dc913d59a3edc4a12] [formerly ded9c782fcc8e078bd178a9a58d86f98b011a1c1 [formerly 6ea46281b904c99c9b6c9f364293bec96be16f7d]]] Former-commit-id: ded9c782fcc8e078bd178a9a58d86f98b011a1c1 Former-commit-id: 3b4507cbe512cea0341df0f413608763b1f49b24 [formerly b4fc76c03a82b88be9b7c2ebf3cf8153b764e612] Former-commit-id: 35436255069435624a74e46677908fc80de391a2 --- .../ingest/notification/PluginNotifier.java | 59 +++++++++++++++---- 1 file changed, 47 insertions(+), 12 deletions(-) diff --git a/edexOsgi/com.raytheon.uf.edex.ingest/src/com/raytheon/uf/edex/ingest/notification/PluginNotifier.java b/edexOsgi/com.raytheon.uf.edex.ingest/src/com/raytheon/uf/edex/ingest/notification/PluginNotifier.java index be3b6b381d..d3424435c7 100644 --- a/edexOsgi/com.raytheon.uf.edex.ingest/src/com/raytheon/uf/edex/ingest/notification/PluginNotifier.java +++ b/edexOsgi/com.raytheon.uf.edex.ingest/src/com/raytheon/uf/edex/ingest/notification/PluginNotifier.java @@ -181,20 +181,55 @@ public class PluginNotifier { */ public synchronized void register(PluginNotifierConfig config, boolean rebuildTree) throws InvalidNotificationConfigException { + register(config, null, rebuildTree); + } + + /** + * Register the given PluginNotifierConfig. + * + * @param config + * @param router + * The INotificationRouter to use for this config. If null, will + * use the default based on the config format. + * @return + */ + public synchronized void register(PluginNotifierConfig config, + INotificationRouter router) + throws InvalidNotificationConfigException { + register(config, router, true); + } + + /** + * Register the given PluginNotifierConfig. + * + * @param config + * @param router + * The INotificationRouter to use for this config. If null, will + * use the default based on the config format. + * @param rebuildTree + * Whether or not to rebuild the internal tree. If many things + * are being registered can improve performance to only build + * tree once at the end. + * @return + */ + public synchronized void register(PluginNotifierConfig config, + INotificationRouter router, boolean rebuildTree) + throws InvalidNotificationConfigException { validate(config); - INotificationRouter router = null; - switch (config.getFormat()) { - case DATAURI: - router = new DataUriRouter(config); - break; - case PDO: - router = new PdoRouter(config); - break; - default: - throw new InvalidNotificationConfigException( - "No INotificationRouter registered for format: " - + config.getFormat()); + if (router == null) { + switch (config.getFormat()) { + case DATAURI: + router = new DataUriRouter(config); + break; + case PDO: + router = new PdoRouter(config); + break; + default: + throw new InvalidNotificationConfigException( + "No INotificationRouter registered for format: " + + config.getFormat()); + } } Map[] metadataMaps = config.getMetadataMap();