FELIX-3874 :  Create new status printer module 

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1439647 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/pom.xml b/pom.xml
index 0b6f6e1..4abda48 100644
--- a/pom.xml
+++ b/pom.xml
@@ -118,6 +118,7 @@
         <module>servicebinder</module>
         <module>wireadmin</module>
         <module>prefs</module>
+        <module>status-printer</module>
         <module>webconsole</module>
         <module>webconsole-plugins/event</module>
         <module>fileinstall</module>
diff --git a/webconsole/pom.xml b/webconsole/pom.xml
index 6fd7de4..d1ba5b3 100644
--- a/webconsole/pom.xml
+++ b/webconsole/pom.xml
@@ -226,7 +226,7 @@
                                        <Bundle-Version>
                                            ${project.version}-all
                                        </Bundle-Version>
-                                       <Export-Package>
+                                       <Export-Package>                                         
                                             org.apache.commons.fileupload,
                                             org.apache.commons.fileupload.disk,
                                             org.apache.commons.fileupload.servlet,
@@ -234,7 +234,8 @@
                                             org.apache.commons.io,
                                             org.apache.commons.io.filefilter,
                                             org.apache.commons.io.output,
-                                            org.json;version=${org.json.version.osgi}
+                                            org.json;version=${org.json.version.osgi},
+                                            org.apache.felix.status;version=1.0.0
                                        </Export-Package>
                                        <Embed-Dependency>
                                            <!-- Import/Export-Package parsing -->
@@ -244,6 +245,7 @@
                                            <!-- ServiceTracker -->
                                            org.osgi.compendium;
                                               inline=org/osgi/util/tracker/*,
+                                           org.apache.felix.status
                                        </Embed-Dependency>
                                        
                                        <_removeheaders>
@@ -421,5 +423,11 @@
             <optional>true</optional>
         </dependency>
         
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.status</artifactId>
+            <version>0.0.1-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
     </dependencies>
 </project>
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/OsgiManagerActivator.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/OsgiManagerActivator.java
index d21c98e..3f764b4 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/OsgiManagerActivator.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/OsgiManagerActivator.java
@@ -25,7 +25,7 @@
 
 
 /**
- * This is the main, starting class of the Bundle. It initializes and disposes 
+ * This is the main, starting class of the Bundle. It initializes and disposes
  * the Apache Web Console upon bundle lifecycle requests.
  */
 public class OsgiManagerActivator implements BundleActivator
@@ -33,21 +33,45 @@
 
     private OsgiManager osgiManager;
 
+    private BundleActivator statusActivator;
+
+    private static final String STATUS_ACTIVATOR = "org.apache.felix.status.impl.Activator";
 
     /**
      * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
      */
-    public void start( BundleContext bundleContext )
+    public void start( final BundleContext bundleContext ) throws Exception
     {
         osgiManager = new OsgiManager( bundleContext );
+        try
+        {
+            final Class activatorClass = bundleContext.getBundle().loadClass(STATUS_ACTIVATOR);
+            this.statusActivator = (BundleActivator) activatorClass.newInstance();
+
+        }
+        catch (Throwable t)
+        {
+            // we ignore this as the status activator is only available if the web console
+            // bundle contains the status bundle.
+        }
+        if ( this.statusActivator != null)
+        {
+            this.statusActivator.start(bundleContext);
+        }
     }
 
 
     /**
      * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
      */
-    public void stop( BundleContext arg0 )
+    public void stop( final BundleContext bundleContext ) throws Exception
     {
+        if ( this.statusActivator != null)
+        {
+            this.statusActivator.stop(bundleContext);
+            this.statusActivator = null;
+        }
+
         if ( osgiManager != null )
         {
             osgiManager.dispose();