felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r817967 - in /felix/trunk/webconsole: ./ src/main/java/org/apache/felix/webconsole/internal/ src/main/java/org/apache/felix/webconsole/internal/compendium/ src/main/java/org/apache/felix/webconsole/internal/misc/ src/main/java/org/apache/fe...
Date Wed, 23 Sep 2009 05:58:19 GMT
Author: fmeschbe
Date: Wed Sep 23 05:58:18 2009
New Revision: 817967

URL: http://svn.apache.org/viewvc?rev=817967&view=rev
Log:
FELIX-1630 Create AbstractConfigurationPrinter from which new PreferencesConfigurationPrinter
and ConfigurationAdminConfigurationPrinter extend. The latter two take the Preferences Service
and Configuration Admin printing functionality formerly included in the ConfigurationRender
itself. Also include the OSGi ServiceTracker in the bundle directly.

Added:
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/AbstractConfigurationPrinter.java
  (with props)
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigurationAdminConfigurationPrinter.java
  (with props)
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/PreferencesConfigurationPrinter.java
  (with props)
Modified:
    felix/trunk/webconsole/pom.xml
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ComponentConfigurationPrinter.java
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/BundleRepositoryRender.java
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java

Modified: felix/trunk/webconsole/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/pom.xml?rev=817967&r1=817966&r2=817967&view=diff
==============================================================================
--- felix/trunk/webconsole/pom.xml (original)
+++ felix/trunk/webconsole/pom.xml Wed Sep 23 05:58:18 2009
@@ -87,6 +87,10 @@
                                     org/apache/felix/bundlerepository/Util.class|
                                     org/apache/felix/bundlerepository/VersionRange.class,
                             
+                            <!-- ServiceTracker -->
+                            org.osgi.compendium;
+                                inline=org/osgi/util/tracker/*,
+                                
                             <!-- Required for JSON data transfer -->
                             json,
                             

Added: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/AbstractConfigurationPrinter.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/AbstractConfigurationPrinter.java?rev=817967&view=auto
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/AbstractConfigurationPrinter.java
(added)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/AbstractConfigurationPrinter.java
Wed Sep 23 05:58:18 2009
@@ -0,0 +1,52 @@
+/*
+ * 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.felix.webconsole.internal;
+
+
+import org.apache.felix.webconsole.ConfigurationPrinter;
+import org.apache.felix.webconsole.internal.OsgiManagerPlugin;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+
+public abstract class AbstractConfigurationPrinter implements ConfigurationPrinter, OsgiManagerPlugin
+{
+
+    private BundleContext bundleContext;
+
+    private ServiceRegistration registration;
+
+
+    public void activate( BundleContext bundleContext )
+    {
+        this.bundleContext = bundleContext;
+        this.registration = bundleContext.registerService( SERVICE, this, null );
+    }
+
+
+    public void deactivate()
+    {
+        this.registration.unregister();
+        this.bundleContext = null;
+    }
+
+
+    protected BundleContext getBundleContext()
+    {
+        return bundleContext;
+    }
+}

Propchange: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/AbstractConfigurationPrinter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/AbstractConfigurationPrinter.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ComponentConfigurationPrinter.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ComponentConfigurationPrinter.java?rev=817967&r1=817966&r2=817967&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ComponentConfigurationPrinter.java
(original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ComponentConfigurationPrinter.java
Wed Sep 23 05:58:18 2009
@@ -30,28 +30,15 @@
 import org.apache.felix.scr.Component;
 import org.apache.felix.scr.Reference;
 import org.apache.felix.scr.ScrService;
-import org.apache.felix.webconsole.ConfigurationPrinter;
-import org.osgi.framework.BundleContext;
+import org.apache.felix.webconsole.internal.AbstractConfigurationPrinter;
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.component.ComponentConstants;
 
 
-public class ComponentConfigurationPrinter extends AbstractScrPlugin implements ConfigurationPrinter
+public class ComponentConfigurationPrinter extends AbstractConfigurationPrinter
 {
 
-    private ServiceRegistration registration;
-
-
-    public void activate( BundleContext bundleContext )
-    {
-        super.activate( bundleContext );
-
-        registration = bundleContext.registerService( ConfigurationPrinter.SERVICE, this,
null );
-    }
-
-
     public String getTitle()
     {
         return "Declarative Services Components";
@@ -60,39 +47,48 @@
 
     public void printConfiguration( PrintWriter pw )
     {
-        ScrService scrService = getScrService();
-        if ( scrService != null )
+        ServiceReference sr = getBundleContext().getServiceReference( "org.apache.felix.scr.ScrService"
);
+        if ( sr == null )
         {
-            Component[] components = scrService.getComponents();
-
-            if ( components == null || components.length == 0 )
+            pw.println( "  Apache Felix Declarative Service not installed" );
+        }
+        else
+        {
+            ScrService scrService = ( ScrService ) getBundleContext().getService( sr );
+            try
             {
-
-                pw.println( "  No Components Registered" );
-
+                printComponents( pw, scrService.getComponents() );
             }
-            else
+            finally
             {
+                getBundleContext().ungetService( sr );
+            }
+        }
+    }
 
-                // order components by id
-                TreeMap componentMap = new TreeMap();
-                for ( int i = 0; i < components.length; i++ )
-                {
-                    Component component = components[i];
-                    componentMap.put( new Long( component.getId() ), component );
-                }
 
-                // render components
-                for ( Iterator ci = componentMap.values().iterator(); ci.hasNext(); )
-                {
-                    Component component = ( Component ) ci.next();
-                    component( pw, component );
-                }
-            }
+    public void printComponents( final PrintWriter pw, final Component[] components )
+    {
+        if ( components == null || components.length == 0 )
+        {
+            pw.println( "  No Components Registered" );
         }
         else
         {
-            pw.println( "  Apache Felix Declarative Service not installed" );
+            // order components by id
+            TreeMap componentMap = new TreeMap();
+            for ( int i = 0; i < components.length; i++ )
+            {
+                Component component = components[i];
+                componentMap.put( new Long( component.getId() ), component );
+            }
+
+            // render components
+            for ( Iterator ci = componentMap.values().iterator(); ci.hasNext(); )
+            {
+                Component component = ( Component ) ci.next();
+                component( pw, component );
+            }
         }
     }
 

Added: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigurationAdminConfigurationPrinter.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigurationAdminConfigurationPrinter.java?rev=817967&view=auto
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigurationAdminConfigurationPrinter.java
(added)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigurationAdminConfigurationPrinter.java
Wed Sep 23 05:58:18 2009
@@ -0,0 +1,123 @@
+/*
+ * 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.felix.webconsole.internal.compendium;
+
+
+import java.io.PrintWriter;
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.SortedMap;
+import java.util.SortedSet;
+import java.util.TreeMap;
+import java.util.TreeSet;
+
+import org.apache.felix.webconsole.internal.AbstractConfigurationPrinter;
+import org.apache.felix.webconsole.internal.misc.ConfigurationRender;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+
+
+public class ConfigurationAdminConfigurationPrinter extends AbstractConfigurationPrinter
+{
+
+    public static final String TITLE = "Configurations";
+
+
+    public String getTitle()
+    {
+        return TITLE;
+    }
+
+
+    public void printConfiguration( PrintWriter pw )
+    {
+        ServiceReference sr = getBundleContext().getServiceReference( ConfigurationAdmin.class.getName()
);
+        if ( sr == null )
+        {
+            pw.println( "  Configuration Admin Service not registered" );
+        }
+        else
+        {
+
+            ConfigurationAdmin ca = ( ConfigurationAdmin ) getBundleContext().getService(
sr );
+            try
+            {
+                Configuration[] configs = ca.listConfigurations( null );
+                if ( configs != null && configs.length > 0 )
+                {
+                    SortedMap sm = new TreeMap();
+                    for ( int i = 0; i < configs.length; i++ )
+                    {
+                        sm.put( configs[i].getPid(), configs[i] );
+                    }
+
+                    for ( Iterator mi = sm.values().iterator(); mi.hasNext(); )
+                    {
+                        this.printConfiguration( pw, ( Configuration ) mi.next() );
+                    }
+                }
+                else
+                {
+                    pw.println( "  No Configurations available" );
+                }
+            }
+            catch ( Exception e )
+            {
+                // todo or not :-)
+            }
+            finally
+            {
+                getBundleContext().ungetService( sr );
+            }
+        }
+    }
+
+
+    private void printConfiguration( PrintWriter pw, Configuration config )
+    {
+        ConfigurationRender.infoLine( pw, "", "PID", config.getPid() );
+
+        if ( config.getFactoryPid() != null )
+        {
+            ConfigurationRender.infoLine( pw, "  ", "Factory PID", config.getFactoryPid()
);
+        }
+
+        String loc = ( config.getBundleLocation() != null ) ? config.getBundleLocation()
: "Unbound";
+        ConfigurationRender.infoLine( pw, "  ", "BundleLocation", loc );
+
+        Dictionary props = config.getProperties();
+        if ( props != null )
+        {
+            SortedSet keys = new TreeSet();
+            for ( Enumeration ke = props.keys(); ke.hasMoreElements(); )
+            {
+                keys.add( ke.nextElement() );
+            }
+
+            for ( Iterator ki = keys.iterator(); ki.hasNext(); )
+            {
+                String key = ( String ) ki.next();
+                ConfigurationRender.infoLine( pw, "  ", key, props.get( key ) );
+            }
+        }
+
+        pw.println();
+    }
+
+}

Propchange: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigurationAdminConfigurationPrinter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigurationAdminConfigurationPrinter.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Added: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/PreferencesConfigurationPrinter.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/PreferencesConfigurationPrinter.java?rev=817967&view=auto
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/PreferencesConfigurationPrinter.java
(added)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/PreferencesConfigurationPrinter.java
Wed Sep 23 05:58:18 2009
@@ -0,0 +1,101 @@
+/*
+ * 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.felix.webconsole.internal.compendium;
+
+
+import java.io.PrintWriter;
+
+import org.apache.felix.webconsole.internal.AbstractConfigurationPrinter;
+import org.apache.felix.webconsole.internal.misc.ConfigurationRender;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.prefs.BackingStoreException;
+import org.osgi.service.prefs.Preferences;
+import org.osgi.service.prefs.PreferencesService;
+
+
+public class PreferencesConfigurationPrinter extends AbstractConfigurationPrinter
+{
+
+    public static final String TITLE = "Preferences";
+
+
+    public String getTitle()
+    {
+        return TITLE;
+    }
+
+
+    public void printConfiguration( PrintWriter printWriter )
+    {
+        ServiceReference sr = getBundleContext().getServiceReference( PreferencesService.class.getName()
);
+        if ( sr == null )
+        {
+            printWriter.println( "  Preferences Service not registered" );
+        }
+        else
+        {
+            PreferencesService ps = ( PreferencesService ) getBundleContext().getService(
sr );
+            try
+            {
+                this.printPreferences( printWriter, ps.getSystemPreferences() );
+
+                String[] users = ps.getUsers();
+                for ( int i = 0; users != null && i < users.length; i++ )
+                {
+                    printWriter.println( "*** User Preferences " + users[i] + ":" );
+                    this.printPreferences( printWriter, ps.getUserPreferences( users[i] )
);
+                }
+            }
+            catch ( BackingStoreException bse )
+            {
+                // todo or not :-)
+            }
+            finally
+            {
+                getBundleContext().ungetService( sr );
+            }
+        }
+    }
+
+
+    private void printPreferences( PrintWriter pw, Preferences prefs ) throws BackingStoreException
+    {
+
+        final String[] children = prefs.childrenNames();
+        final String[] keys = prefs.keys();
+
+        if ( children.length == 0 && keys.length == 0 )
+        {
+            pw.println( "No Preferences available" );
+        }
+        else
+        {
+            for ( int i = 0; i < children.length; i++ )
+            {
+                this.printPreferences( pw, prefs.node( children[i] ) );
+            }
+
+            for ( int i = 0; i < keys.length; i++ )
+            {
+                ConfigurationRender
+                    .infoLine( pw, null, prefs.absolutePath() + "/" + keys[i], prefs.get(
keys[i], null ) );
+            }
+        }
+
+        pw.println();
+    }
+}

Propchange: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/PreferencesConfigurationPrinter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/PreferencesConfigurationPrinter.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java?rev=817967&r1=817966&r2=817967&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java
(original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java
Wed Sep 23 05:58:18 2009
@@ -28,7 +28,6 @@
 import java.util.Collection;
 import java.util.Date;
 import java.util.Dictionary;
-import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.Locale;
 import java.util.Properties;
@@ -51,11 +50,6 @@
 import org.osgi.framework.Constants;
 import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.framework.ServiceReference;
-import org.osgi.service.cm.Configuration;
-import org.osgi.service.cm.ConfigurationAdmin;
-import org.osgi.service.prefs.BackingStoreException;
-import org.osgi.service.prefs.Preferences;
-import org.osgi.service.prefs.PreferencesService;
 import org.osgi.util.tracker.ServiceTracker;
 
 
@@ -188,8 +182,6 @@
     {
         this.printSystemProperties( pw );
         this.printServices( pw );
-        this.printPreferences( pw );
-        this.printConfigurations( pw );
         this.printThreads( pw );
 
         for ( Iterator cpi = getConfigurationPrinters().iterator(); cpi.hasNext(); )
@@ -238,7 +230,7 @@
         for ( Iterator ki = keys.iterator(); ki.hasNext(); )
         {
             Object key = ki.next();
-            this.infoLine( pw, null, ( String ) key, props.get( key ) );
+            infoLine( pw, null, ( String ) key, props.get( key ) );
         }
 
         pw.end();
@@ -266,7 +258,7 @@
     //            SortedSet keys = new TreeSet(props.keySet());
     //            for (Iterator ki = keys.iterator(); ki.hasNext();) {
     //                Object key = ki.next();
-    //                this.infoLine(pw, null, (String) key, props.get(key));
+    //                infoLine(pw, null, (String) key, props.get(key));
     //            }
     //
     //        } else {
@@ -301,16 +293,16 @@
         {
             ServiceReference sr = ( ServiceReference ) si.next();
 
-            this.infoLine( pw, null, String.valueOf( sr.getProperty( Constants.SERVICE_ID
) ), sr
+            infoLine( pw, null, String.valueOf( sr.getProperty( Constants.SERVICE_ID ) ),
sr
                 .getProperty( Constants.OBJECTCLASS ) );
-            this.infoLine( pw, "  ", "Bundle", this.getBundleString( sr.getBundle() ) );
+            infoLine( pw, "  ", "Bundle", this.getBundleString( sr.getBundle() ) );
 
             Bundle[] users = sr.getUsingBundles();
             if ( users != null && users.length > 0 )
             {
                 for ( int i = 0; i < users.length; i++ )
                 {
-                    this.infoLine( pw, "  ", "Using Bundle", this.getBundleString( users[i]
) );
+                    infoLine( pw, "  ", "Using Bundle", this.getBundleString( users[i] )
);
                 }
             }
 
@@ -320,7 +312,7 @@
             {
                 if ( !Constants.SERVICE_ID.equals( keys[i] ) && !Constants.OBJECTCLASS.equals(
keys[i] ) )
                 {
-                    this.infoLine( pw, "  ", keys[i], sr.getProperty( keys[i] ) );
+                    infoLine( pw, "  ", keys[i], sr.getProperty( keys[i] ) );
                 }
             }
 
@@ -331,118 +323,6 @@
     }
 
 
-    private void printPreferences( ConfigurationWriter pw )
-    {
-        pw.title( "Preferences" );
-
-        ServiceReference sr = getBundleContext().getServiceReference( PreferencesService.class.getName()
);
-        if ( sr == null )
-        {
-            pw.println( "  Preferences Service not registered" );
-        }
-        else
-        {
-            PreferencesService ps = ( PreferencesService ) getBundleContext().getService(
sr );
-            try
-            {
-                this.printPreferences( pw, ps.getSystemPreferences() );
-
-                String[] users = ps.getUsers();
-                for ( int i = 0; users != null && i < users.length; i++ )
-                {
-                    pw.println( "*** User Preferences " + users[i] + ":" );
-                    this.printPreferences( pw, ps.getUserPreferences( users[i] ) );
-                }
-            }
-            catch ( BackingStoreException bse )
-            {
-                // todo or not :-)
-            }
-            finally
-            {
-                getBundleContext().ungetService( sr );
-            }
-        }
-
-        pw.end();
-    }
-
-
-    private void printPreferences( PrintWriter pw, Preferences prefs ) throws BackingStoreException
-    {
-
-        final String[] children = prefs.childrenNames();
-        final String[] keys = prefs.keys();
-
-        if ( children.length == 0 && keys.length == 0 )
-        {
-            pw.println( "No Preferences available" );
-        }
-        else
-        {
-            for ( int i = 0; i < children.length; i++ )
-            {
-                this.printPreferences( pw, prefs.node( children[i] ) );
-            }
-
-            for ( int i = 0; i < keys.length; i++ )
-            {
-                this.infoLine( pw, null, prefs.absolutePath() + "/" + keys[i], prefs.get(
keys[i], null ) );
-            }
-        }
-
-        pw.println();
-    }
-
-
-    private void printConfigurations( ConfigurationWriter pw )
-    {
-        pw.title(  "Configurations" );
-
-        ServiceReference sr = getBundleContext().getServiceReference( ConfigurationAdmin.class.getName()
);
-        if ( sr == null )
-        {
-            pw.println( "  Configuration Admin Service not registered" );
-        }
-        else
-        {
-
-            ConfigurationAdmin ca = ( ConfigurationAdmin ) getBundleContext().getService(
sr );
-            try
-            {
-                Configuration[] configs = ca.listConfigurations( null );
-                if ( configs != null && configs.length > 0 )
-                {
-                    SortedMap sm = new TreeMap();
-                    for ( int i = 0; i < configs.length; i++ )
-                    {
-                        sm.put( configs[i].getPid(), configs[i] );
-                    }
-
-                    for ( Iterator mi = sm.values().iterator(); mi.hasNext(); )
-                    {
-                        this.printConfiguration( pw, ( Configuration ) mi.next() );
-                    }
-                }
-                else
-                {
-                    pw.println( "  No Configurations available" );
-                }
-            }
-            catch ( Exception e )
-            {
-                // todo or not :-)
-            }
-            finally
-            {
-                getBundleContext().ungetService( sr );
-            }
-        }
-
-        pw.end();
-    }
-
-
     private void printConfigurationPrinter( ConfigurationWriter pw, ConfigurationPrinter
cp )
     {
         pw.title(  cp.getTitle() );
@@ -451,39 +331,7 @@
     }
 
 
-    private void printConfiguration( PrintWriter pw, Configuration config )
-    {
-        this.infoLine( pw, "", "PID", config.getPid() );
-
-        if ( config.getFactoryPid() != null )
-        {
-            this.infoLine( pw, "  ", "Factory PID", config.getFactoryPid() );
-        }
-
-        String loc = ( config.getBundleLocation() != null ) ? config.getBundleLocation()
: "Unbound";
-        this.infoLine( pw, "  ", "BundleLocation", loc );
-
-        Dictionary props = config.getProperties();
-        if ( props != null )
-        {
-            SortedSet keys = new TreeSet();
-            for ( Enumeration ke = props.keys(); ke.hasMoreElements(); )
-            {
-                keys.add( ke.nextElement() );
-            }
-
-            for ( Iterator ki = keys.iterator(); ki.hasNext(); )
-            {
-                String key = ( String ) ki.next();
-                this.infoLine( pw, "  ", key, props.get( key ) );
-            }
-        }
-
-        pw.println();
-    }
-
-
-    private void infoLine( PrintWriter pw, String indent, String label, Object value )
+    public static void infoLine( PrintWriter pw, String indent, String label, Object value
)
     {
         if ( indent != null )
         {
@@ -496,13 +344,13 @@
             pw.print( '=' );
         }
 
-        this.printObject( pw, value );
+        printObject( pw, value );
 
         pw.println();
     }
 
 
-    private void printObject( PrintWriter pw, Object value )
+    private static void printObject( PrintWriter pw, Object value )
     {
         if ( value == null )
         {
@@ -510,7 +358,7 @@
         }
         else if ( value.getClass().isArray() )
         {
-            this.printArray( pw, ( Object[] ) value );
+            printArray( pw, ( Object[] ) value );
         }
         else
         {
@@ -519,7 +367,7 @@
     }
 
 
-    private void printArray( PrintWriter pw, Object[] values )
+    private static void printArray( PrintWriter pw, Object[] values )
     {
         pw.print( '[' );
         if ( values != null && values.length > 0 )
@@ -530,7 +378,7 @@
                 {
                     pw.print( ", " );
                 }
-                this.printObject( pw, values[i] );
+                printObject( pw, values[i] );
             }
         }
         pw.print( ']' );

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/BundleRepositoryRender.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/BundleRepositoryRender.java?rev=817967&r1=817966&r2=817967&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/BundleRepositoryRender.java
(original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/BundleRepositoryRender.java
Wed Sep 23 05:58:18 2009
@@ -417,7 +417,7 @@
 
     protected RepositoryAdmin getRepositoryAdmin()
     {
-        return ( RepositoryAdmin ) getService( RepositoryAdmin.class.getName() );
+        return ( RepositoryAdmin ) getService( "org.osgi.service.obr.RepositoryAdmin" );
     }
 
 }

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java?rev=817967&r1=817966&r2=817967&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java
(original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java
Wed Sep 23 05:58:18 2009
@@ -116,10 +116,13 @@
     static final String DEFAULT_MANAGER_ROOT = "/system/console";
 
     static final String[] PLUGIN_CLASSES =
-        { "org.apache.felix.webconsole.internal.compendium.ComponentConfigurationPrinter",
+        {
+            "org.apache.felix.webconsole.internal.compendium.ComponentConfigurationPrinter",
             "org.apache.felix.webconsole.internal.compendium.ComponentsServlet",
             "org.apache.felix.webconsole.internal.compendium.ConfigManager",
+            "org.apache.felix.webconsole.internal.compendium.ConfigurationAdminConfigurationPrinter",
             "org.apache.felix.webconsole.internal.compendium.LogServlet",
+            "org.apache.felix.webconsole.internal.compendium.PreferencesConfigurationPrinter",
             "org.apache.felix.webconsole.internal.core.BundlesServlet",
             "org.apache.felix.webconsole.internal.core.InstallAction",
             "org.apache.felix.webconsole.internal.core.SetStartLevelAction",
@@ -132,7 +135,8 @@
             "org.apache.felix.webconsole.internal.obr.InstallFromRepoAction",
             "org.apache.felix.webconsole.internal.obr.RefreshRepoAction",
             "org.apache.felix.webconsole.internal.system.GCAction",
-            "org.apache.felix.webconsole.internal.system.VMStatPlugin" };
+            "org.apache.felix.webconsole.internal.system.VMStatPlugin"
+        };
 
     private BundleContext bundleContext;
 



Mime
View raw message