[KARAF-2277] Fix Cellar WebConsole plugin with Equinox git-svn-id: https://svn.apache.org/repos/asf/karaf/cellar/branches/cellar-2.3.x@1478657 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/karaf-cellar/repo Commit: http://git-wip-us.apache.org/repos/asf/karaf-cellar/commit/056c4128 Tree: http://git-wip-us.apache.org/repos/asf/karaf-cellar/tree/056c4128 Diff: http://git-wip-us.apache.org/repos/asf/karaf-cellar/diff/056c4128 Branch: refs/heads/cellar-2.3.x Commit: 056c4128131be80e99a1987639010b48bf1f6bd5 Parents: 5d81588 Author: jbonofre <jbonofre@13f79535-47bb-0310-9956-ffa450edef68> Authored: Fri May 3 06:54:51 2013 +0000 Committer: jbonofre <jbonofre@13f79535-47bb-0310-9956-ffa450edef68> Committed: Fri May 3 06:54:51 2013 +0000 ---------------------------------------------------------------------- .../cellar/webconsole/ClusterGroupsPlugin.java | 16 ++++++++-------- .../OSGI-INF/blueprint/webconsole-cellar.xml | 3 +-- 2 files changed, 9 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/056c4128/webconsole/src/main/java/org/apache/karaf/cellar/webconsole/ClusterGroupsPlugin.java ---------------------------------------------------------------------- diff --git a/webconsole/src/main/java/org/apache/karaf/cellar/webconsole/ClusterGroupsPlugin.java b/webconsole/src/main/java/org/apache/karaf/cellar/webconsole/ClusterGroupsPlugin.java index 0bd1b42..c847576 100644 --- a/webconsole/src/main/java/org/apache/karaf/cellar/webconsole/ClusterGroupsPlugin.java +++ b/webconsole/src/main/java/org/apache/karaf/cellar/webconsole/ClusterGroupsPlugin.java @@ -38,29 +38,26 @@ import java.util.ArrayList; import java.util.List; import java.util.Set; +/** + * WebConsole plugin for Cellar cluster groups. + */ public class ClusterGroupsPlugin extends AbstractWebConsolePlugin { private static final transient Logger LOGGER = LoggerFactory.getLogger(ClusterGroupsPlugin.class); public static final String NAME = "cluster.groups"; - public static final String LABEL = "Cluster Groups"; - private ClassLoader classLoader; - private String clusterGroupsJs = "/cluster.groups/res/ui/cluster-groups.js"; private ClusterManager clusterManager; private ExecutionContext executionContext; private GroupManager groupManager; - private BundleContext bundleContext; public void start() { super.activate(bundleContext); - this.classLoader = this.getClass().getClassLoader(); - this.LOGGER.info("{} plugin activated", LABEL); } @@ -129,7 +126,7 @@ public class ClusterGroupsPlugin extends AbstractWebConsolePlugin { try { Thread.sleep(800); } catch (InterruptedException e) { - // we ignore this + // ignore } this.renderJSON(resp, null); } else { @@ -166,13 +163,16 @@ public class ClusterGroupsPlugin extends AbstractWebConsolePlugin { protected URL getResource(String path) { path = path.substring(NAME.length() + 1); + if (path == null || path.isEmpty()) { + return null; + } URL url = this.classLoader.getResource(path); if (url != null) { InputStream ins = null; try { ins = url.openStream(); if (ins == null) { - this.LOGGER.error("Failed to open {}", url); + this.LOGGER.error("failed to open {}", url); url = null; } } catch (IOException e) { http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/056c4128/webconsole/src/main/resources/OSGI-INF/blueprint/webconsole-cellar.xml ---------------------------------------------------------------------- diff --git a/webconsole/src/main/resources/OSGI-INF/blueprint/webconsole-cellar.xml b/webconsole/src/main/resources/OSGI-INF/blueprint/webconsole-cellar.xml index 37637fe..9a41fed 100644 --- a/webconsole/src/main/resources/OSGI-INF/blueprint/webconsole-cellar.xml +++ b/webconsole/src/main/resources/OSGI-INF/blueprint/webconsole-cellar.xml @@ -17,8 +17,7 @@ limitations under the License. --> -<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" - xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"> +<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="lazy"> <reference id="groupManager" interface="org.apache.karaf.cellar.core.GroupManager"/> <reference id="clusterManager" interface="org.apache.karaf.cellar.core.ClusterManager"/>
