From c307836d7ed86f2516089c1f60ef01fabfb04c6b Mon Sep 17 00:00:00 2001 From: Guus der Kinderen Date: Fri, 21 Oct 2016 11:23:02 +0200 Subject: [PATCH] Openfire plugin should expose its Component This is a fix for https://github.com/jitsi/jitsi-videobridge/issues/338 which is an issue similar to https://github.com/jitsi/jitsi-videobridge/issues/335. When the Openfire plugin exposes its ComponentImpl instance, it's data can, for instance, be used to populate admin console pages (listings of active conferences, etc). --- .../videobridge/openfire/PluginImpl.java | 35 +++++++++++++------ 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/openfire/src/java/org/jitsi/videobridge/openfire/PluginImpl.java b/openfire/src/java/org/jitsi/videobridge/openfire/PluginImpl.java index 8393cc7a09..4950216a13 100644 --- a/openfire/src/java/org/jitsi/videobridge/openfire/PluginImpl.java +++ b/openfire/src/java/org/jitsi/videobridge/openfire/PluginImpl.java @@ -80,6 +80,12 @@ public class PluginImpl */ private ComponentManager componentManager; + /** + * The Component that has been registered by this plugin. This + * wraps the Videobridge service. + */ + private ComponentImpl component; + /** * The subdomain of the address of component with which it has been * added to {@link #componentManager}. @@ -108,6 +114,7 @@ public void destroyPlugin() // TODO Auto-generated method stub } componentManager = null; + component = null; subdomain = null; } } @@ -174,30 +181,36 @@ public void initializePlugin(PluginManager manager, File pluginDirectory) ComponentImpl component = new ComponentImpl( hostname, port, domain, subdomain, secret ); - boolean added = false; - try { componentManager.addComponent(subdomain, component); - added = true; + this.componentManager = componentManager; + this.component = component; + this.subdomain = subdomain; } catch (ComponentException ce) { Log.error( "An exception occurred when loading the plugin: " + "the component could not be added.", ce ); - } - if (added) - { - this.componentManager = componentManager; - this.subdomain = subdomain; - } - else - { this.componentManager = null; + this.component = null; this.subdomain = null; } } + /** + * Returns the Component that has been registered by this plugin. + * This wraps the Videobridge service. + * + * When the plugin is not running, null will be returned. + * + * @return The Videobridge component, or null when not running. + */ + public ComponentImpl getComponent() + { + return component; + } + /** * Checks whether we have folder with extracted natives, if missing * find the appropriate jar file and extract them. Normally this is