You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by gn...@apache.org on 2015/07/09 11:21:27 UTC

[1/3] karaf git commit: [KARAF-3842] Avoid possible leaks with servlet events

Repository: karaf
Updated Branches:
  refs/heads/master ea9e4c8cc -> a4d2ae7d9


[KARAF-3842] Avoid possible leaks with servlet events

Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/989386d8
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/989386d8
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/989386d8

Branch: refs/heads/master
Commit: 989386d8fc71cbdd3682cf054ea27de93e37dfb1
Parents: ea9e4c8
Author: Guillaume Nodet <gn...@apache.org>
Authored: Thu Jul 9 10:56:49 2015 +0200
Committer: Guillaume Nodet <gn...@apache.org>
Committed: Thu Jul 9 10:56:49 2015 +0200

----------------------------------------------------------------------
 .../karaf/webconsole/http/WebEventHandler.java  | 38 +++++++++++++++++---
 .../OSGI-INF/blueprint/webconsole-http.xml      |  5 ++-
 2 files changed, 38 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/989386d8/webconsole/http/src/main/java/org/apache/karaf/webconsole/http/WebEventHandler.java
----------------------------------------------------------------------
diff --git a/webconsole/http/src/main/java/org/apache/karaf/webconsole/http/WebEventHandler.java b/webconsole/http/src/main/java/org/apache/karaf/webconsole/http/WebEventHandler.java
index 0579b8c..fa81e4c 100644
--- a/webconsole/http/src/main/java/org/apache/karaf/webconsole/http/WebEventHandler.java
+++ b/webconsole/http/src/main/java/org/apache/karaf/webconsole/http/WebEventHandler.java
@@ -21,18 +21,48 @@ import java.util.Map;
 
 import org.ops4j.pax.web.service.spi.WebEvent;
 import org.ops4j.pax.web.service.spi.WebListener;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.BundleListener;
 
-public class WebEventHandler implements WebListener {
+public class WebEventHandler implements WebListener, BundleListener {
 
+    BundleContext bundleContext;
     private final Map<Long, WebEvent> bundleEvents = new HashMap<Long, WebEvent>();
 
+    public void setBundleContext(BundleContext bundleContext) {
+        this.bundleContext = bundleContext;
+    }
+
+    public void init() {
+        bundleContext.addBundleListener(this);
+    }
+
+    public void destroy() {
+        bundleContext.removeBundleListener(this);
+    }
+
     @Override
-    public void webEvent(WebEvent event) {
+    public void bundleChanged(BundleEvent event) {
+        if (event.getType() == BundleEvent.UNINSTALLED
+                || event.getType() == BundleEvent.UNRESOLVED
+                || event.getType() == BundleEvent.STOPPED) {
+            removeEventsForBundle(event.getBundle());
+        }
+    }
+
+    @Override
+    public synchronized void webEvent(WebEvent event) {
         bundleEvents.put(event.getBundle().getBundleId(), event);
     }
 
-    public Map<Long, WebEvent> getBundleEvents() {
-        return bundleEvents;
+    public synchronized Map<Long, WebEvent> getBundleEvents() {
+        return new HashMap<>(bundleEvents);
+    }
+
+    public synchronized void removeEventsForBundle(Bundle bundle) {
+        bundleEvents.remove(bundle.getBundleId());
     }
 
 }

http://git-wip-us.apache.org/repos/asf/karaf/blob/989386d8/webconsole/http/src/main/resources/OSGI-INF/blueprint/webconsole-http.xml
----------------------------------------------------------------------
diff --git a/webconsole/http/src/main/resources/OSGI-INF/blueprint/webconsole-http.xml b/webconsole/http/src/main/resources/OSGI-INF/blueprint/webconsole-http.xml
index 2975f28..626f511 100644
--- a/webconsole/http/src/main/resources/OSGI-INF/blueprint/webconsole-http.xml
+++ b/webconsole/http/src/main/resources/OSGI-INF/blueprint/webconsole-http.xml
@@ -27,7 +27,10 @@
              interface="org.ops4j.pax.web.service.spi.ServletListener"
              ref="eaHandler" />
 
-	<bean id="webEaHandler" class="org.apache.karaf.webconsole.http.WebEventHandler"/>
+	<bean id="webEaHandler" class="org.apache.karaf.webconsole.http.WebEventHandler"
+          init-method="init" destroy-method="destroy">
+        <property name="bundleContext" ref="blueprintBundleContext" />
+    </bean>
 	<service id="webListener" interface="org.ops4j.pax.web.service.spi.WebListener" ref="webEaHandler"/>
 
     <bean id="httpPlugin" class="org.apache.karaf.webconsole.http.HttpPlugin" init-method="start" destroy-method="stop">


[3/3] karaf git commit: Remove unused import

Posted by gn...@apache.org.
Remove unused import

Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/a4d2ae7d
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/a4d2ae7d
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/a4d2ae7d

Branch: refs/heads/master
Commit: a4d2ae7d9a082ad4f1b91d189102e6497d24c17a
Parents: f032ce9
Author: Guillaume Nodet <gn...@apache.org>
Authored: Thu Jul 9 11:21:16 2015 +0200
Committer: Guillaume Nodet <gn...@apache.org>
Committed: Thu Jul 9 11:21:16 2015 +0200

----------------------------------------------------------------------
 .../java/org/apache/karaf/features/internal/service/Deployer.java   | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/a4d2ae7d/features/core/src/main/java/org/apache/karaf/features/internal/service/Deployer.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/service/Deployer.java b/features/core/src/main/java/org/apache/karaf/features/internal/service/Deployer.java
index 525d354..8bba486 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/service/Deployer.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/service/Deployer.java
@@ -53,7 +53,6 @@ import org.apache.karaf.features.internal.util.ChecksumUtils;
 import org.apache.karaf.features.internal.util.Macro;
 import org.apache.karaf.features.internal.util.MapUtils;
 import org.apache.karaf.features.internal.util.MultiException;
-import org.apache.karaf.util.collections.CopyOnWriteArrayIdentityList;
 import org.eclipse.equinox.region.Region;
 import org.eclipse.equinox.region.RegionDigraph;
 import org.osgi.framework.Bundle;


[2/3] karaf git commit: [KARAF-3843] Get rid of blueprint dependency in the web console

Posted by gn...@apache.org.
[KARAF-3843] Get rid of blueprint dependency in the web console

Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/f032ce95
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/f032ce95
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/f032ce95

Branch: refs/heads/master
Commit: f032ce95d41c50e01eb785ecd921eedef9b40d9e
Parents: 989386d
Author: Guillaume Nodet <gn...@apache.org>
Authored: Thu Jul 9 11:21:04 2015 +0200
Committer: Guillaume Nodet <gn...@apache.org>
Committed: Thu Jul 9 11:21:04 2015 +0200

----------------------------------------------------------------------
 .../standard/src/main/feature/feature.xml       |  9 ---
 webconsole/features/pom.xml                     | 19 ++---
 .../karaf/webconsole/features/Activator.java    | 58 +++++++++++++++
 .../OSGI-INF/blueprint/webconsole-features.xml  | 36 ----------
 webconsole/gogo/pom.xml                         | 13 ++--
 .../apache/karaf/webconsole/gogo/Activator.java | 57 +++++++++++++++
 .../OSGI-INF/blueprint/webconsole-gogo.xml      | 35 ---------
 webconsole/http/pom.xml                         | 13 ++--
 .../apache/karaf/webconsole/http/Activator.java | 75 ++++++++++++++++++++
 .../OSGI-INF/blueprint/webconsole-http.xml      | 47 ------------
 webconsole/instance/pom.xml                     | 13 ++--
 .../karaf/webconsole/instance/Activator.java    | 57 +++++++++++++++
 .../OSGI-INF/blueprint/webconsole-instance.xml  | 35 ---------
 13 files changed, 285 insertions(+), 182 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/f032ce95/assemblies/features/standard/src/main/feature/feature.xml
----------------------------------------------------------------------
diff --git a/assemblies/features/standard/src/main/feature/feature.xml b/assemblies/features/standard/src/main/feature/feature.xml
index 8628795..f816224 100644
--- a/assemblies/features/standard/src/main/feature/feature.xml
+++ b/assemblies/features/standard/src/main/feature/feature.xml
@@ -383,19 +383,10 @@
             realm=karaf
         </config>
         <feature>http</feature>
-        <feature>aries-blueprint</feature>
         <bundle start-level="30">mvn:org.apache.felix/org.apache.felix.metatype/${felix.metatype.version}</bundle>
         <bundle start-level="30">mvn:org.apache.karaf.webconsole/org.apache.karaf.webconsole.console/${project.version}</bundle>
         <bundle start-level="30">mvn:org.apache.karaf.webconsole/org.apache.karaf.webconsole.http/${project.version}</bundle>
         <conditional>
-            <condition>eventadmin</condition>
-            <bundle start-level="30">mvn:org.apache.felix/org.apache.felix.webconsole.plugins.event/${felix.eventadmin.webconsole.plugin.version}</bundle>
-        </conditional>
-        <conditional>
-            <condition>scr</condition>
-            <bundle start-level="30">mvn:org.apache.felix/org.apache.felix.webconsole.plugins.ds/${felix.scr.webconsole.plugin.version}</bundle>
-        </conditional>
-        <conditional>
             <condition>instance</condition>
             <bundle start-level="30">mvn:org.apache.karaf.webconsole/org.apache.karaf.webconsole.instance/${project.version}</bundle>
         </conditional>

http://git-wip-us.apache.org/repos/asf/karaf/blob/f032ce95/webconsole/features/pom.xml
----------------------------------------------------------------------
diff --git a/webconsole/features/pom.xml b/webconsole/features/pom.xml
index a0817cc..f3f1281 100644
--- a/webconsole/features/pom.xml
+++ b/webconsole/features/pom.xml
@@ -59,9 +59,14 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
+            <groupId>org.apache.karaf</groupId>
+            <artifactId>org.apache.karaf.util</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
             <groupId>${servlet.spec.groupId}</groupId>
-	    <artifactId>${servlet.spec.artifactId}</artifactId>
-	    <scope>provided</scope>
+            <artifactId>${servlet.spec.artifactId}</artifactId>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.karaf.features</groupId>
@@ -70,8 +75,6 @@
         <dependency>
             <groupId>org.json</groupId>
             <artifactId>json</artifactId>
-            <scope>provided</scope>
-            <optional>true</optional>
         </dependency>
     </dependencies>
 
@@ -93,16 +96,16 @@
         </resources>
         <plugins>
             <plugin>
+                <groupId>org.apache.karaf.tooling</groupId>
+                <artifactId>karaf-services-maven-plugin</artifactId>
+            </plugin>
+            <plugin>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
                 <configuration>
                     <instructions>
                         <Import-Package>
-                            org.apache.aries.blueprint,
 			                org.apache.felix.webconsole*;version="[3,5)",
-                            org.json,
-                            org.osgi.service.blueprint.container,
-                            org.osgi.service.blueprint.reflect,
                             *
                         </Import-Package>
                     </instructions>

http://git-wip-us.apache.org/repos/asf/karaf/blob/f032ce95/webconsole/features/src/main/java/org/apache/karaf/webconsole/features/Activator.java
----------------------------------------------------------------------
diff --git a/webconsole/features/src/main/java/org/apache/karaf/webconsole/features/Activator.java b/webconsole/features/src/main/java/org/apache/karaf/webconsole/features/Activator.java
new file mode 100644
index 0000000..343d27f
--- /dev/null
+++ b/webconsole/features/src/main/java/org/apache/karaf/webconsole/features/Activator.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.webconsole.features;
+
+import javax.servlet.Servlet;
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.apache.karaf.features.FeaturesService;
+import org.apache.karaf.util.tracker.BaseActivator;
+import org.apache.karaf.util.tracker.annotation.RequireService;
+import org.apache.karaf.util.tracker.annotation.Services;
+import org.apache.karaf.webconsole.features.FeaturesPlugin;
+
+@Services(
+        requires = @RequireService(FeaturesService.class)
+)
+public class Activator extends BaseActivator {
+
+    private FeaturesPlugin featuresPlugin;
+
+    @Override
+    protected void doStart() throws Exception {
+        featuresPlugin = new FeaturesPlugin();
+        featuresPlugin.setBundleContext(bundleContext);
+        featuresPlugin.setFeaturesService(getTrackedService(FeaturesService.class));
+        featuresPlugin.start();
+
+        Dictionary<String, String> props = new Hashtable<>();
+        props.put("felix.webconsole.label", "features");
+        props.put("alias", "/features");
+        register(Servlet.class, featuresPlugin, props);
+    }
+
+    @Override
+    protected void doStop() {
+        super.doStop();
+        if (featuresPlugin != null) {
+            featuresPlugin.stop();
+            featuresPlugin = null;
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/karaf/blob/f032ce95/webconsole/features/src/main/resources/OSGI-INF/blueprint/webconsole-features.xml
----------------------------------------------------------------------
diff --git a/webconsole/features/src/main/resources/OSGI-INF/blueprint/webconsole-features.xml b/webconsole/features/src/main/resources/OSGI-INF/blueprint/webconsole-features.xml
deleted file mode 100644
index 5b86207..0000000
--- a/webconsole/features/src/main/resources/OSGI-INF/blueprint/webconsole-features.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    Licensed to the Apache Software Foundation (ASF) under one or more
-    contributor license agreements.  See the NOTICE file distributed with
-    this work for additional information regarding copyright ownership.
-    The ASF licenses this file to You under the Apache License, Version 2.0
-    (the "License"); you may not use this file except in compliance with
-    the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="lazy">
-
-    <reference id="featuresService" interface="org.apache.karaf.features.FeaturesService" />
-
-    <bean id="featuresPlugin" class="org.apache.karaf.webconsole.features.FeaturesPlugin" init-method="start" destroy-method="stop">
-        <property name="featuresService" ref="featuresService" />
-        <property name="bundleContext" ref="blueprintBundleContext" />
-    </bean>
-
-    <service ref="featuresPlugin" interface="javax.servlet.Servlet" >
-        <service-properties>
-            <entry key="felix.webconsole.label" value="features"/>
-            <entry key="alias" value="/features"/>
-        </service-properties>
-    </service>
-
-</blueprint>

http://git-wip-us.apache.org/repos/asf/karaf/blob/f032ce95/webconsole/gogo/pom.xml
----------------------------------------------------------------------
diff --git a/webconsole/gogo/pom.xml b/webconsole/gogo/pom.xml
index 9aec62c..4528cf5 100644
--- a/webconsole/gogo/pom.xml
+++ b/webconsole/gogo/pom.xml
@@ -83,6 +83,11 @@
             <artifactId>org.apache.karaf.shell.console</artifactId>
         </dependency>
         <dependency>
+            <groupId>org.apache.karaf</groupId>
+            <artifactId>org.apache.karaf.util</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
             <groupId>org.json</groupId>
             <artifactId>json</artifactId>
             <scope>provided</scope>
@@ -108,17 +113,17 @@
         </resources>
         <plugins>
             <plugin>
+                <groupId>org.apache.karaf.tooling</groupId>
+                <artifactId>karaf-services-maven-plugin</artifactId>
+            </plugin>
+            <plugin>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
                 <configuration>
                     <instructions>
                         <Import-Package>
                             jline;version="[${jline.version}, ${jline.version}]",
-                            org.apache.aries.blueprint,
 			                org.apache.felix.webconsole*;version="[3,5)",
-                            org.json,
-                            org.osgi.service.blueprint.container,
-                            org.osgi.service.blueprint.reflect,
                             *
                         </Import-Package>
                     </instructions>

http://git-wip-us.apache.org/repos/asf/karaf/blob/f032ce95/webconsole/gogo/src/main/java/org/apache/karaf/webconsole/gogo/Activator.java
----------------------------------------------------------------------
diff --git a/webconsole/gogo/src/main/java/org/apache/karaf/webconsole/gogo/Activator.java b/webconsole/gogo/src/main/java/org/apache/karaf/webconsole/gogo/Activator.java
new file mode 100644
index 0000000..4825600
--- /dev/null
+++ b/webconsole/gogo/src/main/java/org/apache/karaf/webconsole/gogo/Activator.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.webconsole.gogo;
+
+import javax.servlet.Servlet;
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.apache.karaf.shell.api.console.SessionFactory;
+import org.apache.karaf.util.tracker.BaseActivator;
+import org.apache.karaf.util.tracker.annotation.RequireService;
+import org.apache.karaf.util.tracker.annotation.Services;
+
+@Services(
+        requires = @RequireService(SessionFactory.class)
+)
+public class Activator extends BaseActivator {
+
+    private GogoPlugin gogoPlugin;
+
+    @Override
+    protected void doStart() throws Exception {
+        gogoPlugin = new GogoPlugin();
+        gogoPlugin.setBundleContext(bundleContext);
+        gogoPlugin.setSessionFactory(getTrackedService(SessionFactory.class));
+        gogoPlugin.start();
+
+        Dictionary<String, String> props = new Hashtable<>();
+        props.put("felix.webconsole.label", "gogo");
+        props.put("alias", "/gogo");
+        register(Servlet.class, gogoPlugin, props);
+    }
+
+    @Override
+    protected void doStop() {
+        super.doStop();
+        if (gogoPlugin != null) {
+            gogoPlugin.stop();
+            gogoPlugin = null;
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/karaf/blob/f032ce95/webconsole/gogo/src/main/resources/OSGI-INF/blueprint/webconsole-gogo.xml
----------------------------------------------------------------------
diff --git a/webconsole/gogo/src/main/resources/OSGI-INF/blueprint/webconsole-gogo.xml b/webconsole/gogo/src/main/resources/OSGI-INF/blueprint/webconsole-gogo.xml
deleted file mode 100644
index 00c1c2d..0000000
--- a/webconsole/gogo/src/main/resources/OSGI-INF/blueprint/webconsole-gogo.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    Licensed to the Apache Software Foundation (ASF) under one or more
-    contributor license agreements.  See the NOTICE file distributed with
-    this work for additional information regarding copyright ownership.
-    The ASF licenses this file to You under the Apache License, Version 2.0
-    (the "License"); you may not use this file except in compliance with
-    the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="lazy">
-
-	<reference id="sessionFactory" interface="org.apache.karaf.shell.api.console.SessionFactory"/>
-
-    <bean id="gogoPlugin" class="org.apache.karaf.webconsole.gogo.GogoPlugin" init-method="start" destroy-method="stop">
-        <property name="bundleContext" ref="blueprintBundleContext" />
-        <property name="sessionFactory" ref="sessionFactory"/>
-    </bean>
-    <service ref="gogoPlugin" interface="javax.servlet.Servlet" >
-        <service-properties>
-            <entry key="felix.webconsole.label" value="gogo"/>
-            <entry key="alias" value="/gogo"/>
-        </service-properties>
-    </service>
-
-</blueprint>

http://git-wip-us.apache.org/repos/asf/karaf/blob/f032ce95/webconsole/http/pom.xml
----------------------------------------------------------------------
diff --git a/webconsole/http/pom.xml b/webconsole/http/pom.xml
index d64fc8d..6599f8f 100644
--- a/webconsole/http/pom.xml
+++ b/webconsole/http/pom.xml
@@ -73,6 +73,11 @@
             <artifactId>org.apache.karaf.features.core</artifactId>
         </dependency>
         <dependency>
+            <groupId>org.apache.karaf</groupId>
+            <artifactId>org.apache.karaf.util</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
             <groupId>org.json</groupId>
             <artifactId>json</artifactId>
             <scope>provided</scope>
@@ -98,16 +103,16 @@
         </resources>
         <plugins>
             <plugin>
+                <groupId>org.apache.karaf.tooling</groupId>
+                <artifactId>karaf-services-maven-plugin</artifactId>
+            </plugin>
+            <plugin>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
                 <configuration>
                     <instructions>
                         <Import-Package>
-                            org.apache.aries.blueprint,
 			                org.apache.felix.webconsole*;version="[3,5)",
-                            org.json,
-                            org.osgi.service.blueprint.container,
-                            org.osgi.service.blueprint.reflect,
                             *
                         </Import-Package>
                     </instructions>

http://git-wip-us.apache.org/repos/asf/karaf/blob/f032ce95/webconsole/http/src/main/java/org/apache/karaf/webconsole/http/Activator.java
----------------------------------------------------------------------
diff --git a/webconsole/http/src/main/java/org/apache/karaf/webconsole/http/Activator.java b/webconsole/http/src/main/java/org/apache/karaf/webconsole/http/Activator.java
new file mode 100644
index 0000000..74744d0
--- /dev/null
+++ b/webconsole/http/src/main/java/org/apache/karaf/webconsole/http/Activator.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.webconsole.http;
+
+import javax.servlet.Servlet;
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.apache.karaf.util.tracker.BaseActivator;
+import org.apache.karaf.util.tracker.annotation.Services;
+import org.ops4j.pax.web.service.spi.ServletListener;
+import org.ops4j.pax.web.service.spi.WebListener;
+
+@Services
+public class Activator extends BaseActivator {
+
+    private HttpPlugin httpPlugin;
+    private ServletEventHandler eaHandler;
+    private WebEventHandler webEaHandler;
+
+    @Override
+    protected void doStart() throws Exception {
+        eaHandler = new ServletEventHandler();
+        eaHandler.setBundleContext(bundleContext);
+        eaHandler.init();
+        register(ServletListener.class, eaHandler);
+
+        webEaHandler = new WebEventHandler();
+        webEaHandler.setBundleContext(bundleContext);
+        webEaHandler.init();
+        register(WebListener.class, webEaHandler);
+
+        httpPlugin = new HttpPlugin();
+        httpPlugin.setBundleContext(bundleContext);
+        httpPlugin.setServletEventHandler(eaHandler);
+        httpPlugin.setWebEventHandler(webEaHandler);
+        httpPlugin.start();
+
+        Dictionary<String, String> props = new Hashtable<>();
+        props.put("felix.webconsole.label", "http");
+        register(Servlet.class, httpPlugin, props);
+    }
+
+    @Override
+    protected void doStop() {
+        super.doStop();
+        if (httpPlugin != null) {
+            httpPlugin.stop();
+            httpPlugin = null;
+        }
+        if (eaHandler != null) {
+            eaHandler.destroy();
+            eaHandler = null;
+        }
+        if (webEaHandler != null) {
+            webEaHandler.destroy();
+            webEaHandler = null;
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/karaf/blob/f032ce95/webconsole/http/src/main/resources/OSGI-INF/blueprint/webconsole-http.xml
----------------------------------------------------------------------
diff --git a/webconsole/http/src/main/resources/OSGI-INF/blueprint/webconsole-http.xml b/webconsole/http/src/main/resources/OSGI-INF/blueprint/webconsole-http.xml
deleted file mode 100644
index 626f511..0000000
--- a/webconsole/http/src/main/resources/OSGI-INF/blueprint/webconsole-http.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    Licensed to the Apache Software Foundation (ASF) under one or more
-    contributor license agreements.  See the NOTICE file distributed with
-    this work for additional information regarding copyright ownership.
-    The ASF licenses this file to You under the Apache License, Version 2.0
-    (the "License"); you may not use this file except in compliance with
-    the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="lazy">
-
-	<bean id="eaHandler" class="org.apache.karaf.webconsole.http.ServletEventHandler"
-            init-method="init" destroy-method="destroy">
-        <property name="bundleContext" ref="blueprintBundleContext" />
-    </bean>
-    <service id="servletListener"
-             interface="org.ops4j.pax.web.service.spi.ServletListener"
-             ref="eaHandler" />
-
-	<bean id="webEaHandler" class="org.apache.karaf.webconsole.http.WebEventHandler"
-          init-method="init" destroy-method="destroy">
-        <property name="bundleContext" ref="blueprintBundleContext" />
-    </bean>
-	<service id="webListener" interface="org.ops4j.pax.web.service.spi.WebListener" ref="webEaHandler"/>
-
-    <bean id="httpPlugin" class="org.apache.karaf.webconsole.http.HttpPlugin" init-method="start" destroy-method="stop">
-        <property name="servletEventHandler" ref="eaHandler" />
-        <property name="webEventHandler" ref="webEaHandler" />
-        <property name="bundleContext" ref="blueprintBundleContext" />
-    </bean>
-    <service ref="httpPlugin" interface="javax.servlet.Servlet" >
-        <service-properties>
-            <entry key="felix.webconsole.label" value="http"/>
-        </service-properties>
-    </service>    
-
-</blueprint>

http://git-wip-us.apache.org/repos/asf/karaf/blob/f032ce95/webconsole/instance/pom.xml
----------------------------------------------------------------------
diff --git a/webconsole/instance/pom.xml b/webconsole/instance/pom.xml
index 4be550c..2a1dff0 100644
--- a/webconsole/instance/pom.xml
+++ b/webconsole/instance/pom.xml
@@ -69,6 +69,11 @@
 			<scope>provided</scope>
 		</dependency>
 		<dependency>
+			<groupId>org.apache.karaf</groupId>
+			<artifactId>org.apache.karaf.util</artifactId>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
 			<groupId>org.json</groupId>
 			<artifactId>json</artifactId>
 			<scope>provided</scope>
@@ -102,16 +107,16 @@
 		</resources>
 		<plugins>
 			<plugin>
+				<groupId>org.apache.karaf.tooling</groupId>
+				<artifactId>karaf-services-maven-plugin</artifactId>
+			</plugin>
+			<plugin>
 				<groupId>org.apache.felix</groupId>
 				<artifactId>maven-bundle-plugin</artifactId>
 				<configuration>
 					<instructions>
 						<Import-Package>
-							org.apache.aries.blueprint,
 							org.apache.felix.webconsole*;version="[3,5)",
-                            org.json,
-							org.osgi.service.blueprint.container,
-							org.osgi.service.blueprint.reflect,
 							*
 						</Import-Package>
 					</instructions>

http://git-wip-us.apache.org/repos/asf/karaf/blob/f032ce95/webconsole/instance/src/main/java/org/apache/karaf/webconsole/instance/Activator.java
----------------------------------------------------------------------
diff --git a/webconsole/instance/src/main/java/org/apache/karaf/webconsole/instance/Activator.java b/webconsole/instance/src/main/java/org/apache/karaf/webconsole/instance/Activator.java
new file mode 100644
index 0000000..6d090ad
--- /dev/null
+++ b/webconsole/instance/src/main/java/org/apache/karaf/webconsole/instance/Activator.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.webconsole.instance;
+
+import javax.servlet.Servlet;
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.apache.karaf.instance.core.InstanceService;
+import org.apache.karaf.util.tracker.BaseActivator;
+import org.apache.karaf.util.tracker.annotation.RequireService;
+import org.apache.karaf.util.tracker.annotation.Services;
+
+@Services(
+        requires = @RequireService(InstanceService.class)
+)
+public class Activator extends BaseActivator {
+
+    private InstancePlugin instancePlugin;
+
+    @Override
+    protected void doStart() throws Exception {
+        instancePlugin = new InstancePlugin();
+        instancePlugin.setBundleContext(bundleContext);
+        instancePlugin.setInstanceService(getTrackedService(InstanceService.class));
+        instancePlugin.start();
+
+        Dictionary<String, String> props = new Hashtable<>();
+        props.put("felix.webconsole.label", "instance");
+        props.put("alias", "/instance");
+        register(Servlet.class, instancePlugin, props);
+    }
+
+    @Override
+    protected void doStop() {
+        super.doStop();
+        if (instancePlugin != null) {
+            instancePlugin.stop();
+            instancePlugin = null;
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/karaf/blob/f032ce95/webconsole/instance/src/main/resources/OSGI-INF/blueprint/webconsole-instance.xml
----------------------------------------------------------------------
diff --git a/webconsole/instance/src/main/resources/OSGI-INF/blueprint/webconsole-instance.xml b/webconsole/instance/src/main/resources/OSGI-INF/blueprint/webconsole-instance.xml
deleted file mode 100644
index 80ba1e3..0000000
--- a/webconsole/instance/src/main/resources/OSGI-INF/blueprint/webconsole-instance.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    Licensed to the Apache Software Foundation (ASF) under one or more
-    contributor license agreements.  See the NOTICE file distributed with
-    this work for additional information regarding copyright ownership.
-    The ASF licenses this file to You under the Apache License, Version 2.0
-    (the "License"); you may not use this file except in compliance with
-    the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="lazy">
-
-    <reference id="instanceService" interface="org.apache.karaf.instance.core.InstanceService" />
-
-    <bean id="instancePlugin" class="org.apache.karaf.webconsole.instance.InstancePlugin" init-method="start" destroy-method="stop">
-        <property name="instanceService" ref="instanceService" />
-        <property name="bundleContext" ref="blueprintBundleContext" />
-    </bean>
-    <service ref="instancePlugin" interface="javax.servlet.Servlet" >
-        <service-properties>
-            <entry key="felix.webconsole.label" value="instance"/>
-            <entry key="alias" value="/instance"/>
-        </service-properties>
-    </service>
-
-</blueprint>