You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2013/01/28 22:33:33 UTC

svn commit: r1439647 - in /felix/trunk: pom.xml webconsole/pom.xml webconsole/src/main/java/org/apache/felix/webconsole/internal/OsgiManagerActivator.java

Author: cziegeler
Date: Mon Jan 28 21:33:31 2013
New Revision: 1439647

URL: http://svn.apache.org/viewvc?rev=1439647&view=rev
Log:
FELIX-3874 :  Create new status printer module 

Modified:
    felix/trunk/pom.xml
    felix/trunk/webconsole/pom.xml
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/OsgiManagerActivator.java

Modified: felix/trunk/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/pom.xml?rev=1439647&r1=1439646&r2=1439647&view=diff
==============================================================================
--- felix/trunk/pom.xml (original)
+++ felix/trunk/pom.xml Mon Jan 28 21:33:31 2013
@@ -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>

Modified: felix/trunk/webconsole/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/pom.xml?rev=1439647&r1=1439646&r2=1439647&view=diff
==============================================================================
--- felix/trunk/webconsole/pom.xml (original)
+++ felix/trunk/webconsole/pom.xml Mon Jan 28 21:33:31 2013
@@ -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>

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/OsgiManagerActivator.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/OsgiManagerActivator.java?rev=1439647&r1=1439646&r2=1439647&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/OsgiManagerActivator.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/OsgiManagerActivator.java Mon Jan 28 21:33:31 2013
@@ -25,7 +25,7 @@ import org.osgi.framework.BundleContext;
 
 
 /**
- * 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 @@ public class OsgiManagerActivator implem
 
     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();