felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r657742 [3/4] - in /felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole: ./ internal/ internal/compendium/ internal/core/ internal/misc/ internal/obr/ internal/servlet/ internal/system/
Date Mon, 19 May 2008 07:36:39 GMT
Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/InstallAction.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/InstallAction.java?rev=657742&r1=657741&r2=657742&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/InstallAction.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/InstallAction.java Mon May 19 00:36:38 2008
@@ -16,6 +16,7 @@
  */
 package org.apache.felix.webconsole.internal.core;
 
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
@@ -36,10 +37,12 @@
 import org.osgi.service.packageadmin.PackageAdmin;
 import org.osgi.service.startlevel.StartLevel;
 
+
 /**
  * The <code>InstallAction</code> TODO
  */
-public class InstallAction extends BundleAction {
+public class InstallAction extends BundleAction
+{
 
     public static final String NAME = "install";
 
@@ -54,31 +57,37 @@
     // set to ask for PackageAdmin.refreshPackages() after install/update
     public static final String FIELD_REFRESH_PACKAGES = "refreshPackages";
 
-    public String getName() {
+
+    public String getName()
+    {
         return NAME;
     }
 
-    public String getLabel() {
+
+    public String getLabel()
+    {
         return LABEL;
     }
 
-    public boolean performAction(HttpServletRequest request,
-            HttpServletResponse response) {
+
+    public boolean performAction( HttpServletRequest request, HttpServletResponse response )
+    {
 
         // get the uploaded data
-        Map params = (Map) request.getAttribute(Util.ATTR_FILEUPLOAD);
-        if (params == null) {
+        Map params = ( Map ) request.getAttribute( Util.ATTR_FILEUPLOAD );
+        if ( params == null )
+        {
             return true;
         }
 
-        FileItem startItem = getFileItem(params, FIELD_START, true);
-        FileItem startLevelItem = getFileItem(params, FIELD_STARTLEVEL, true);
-        FileItem bundleItem = getFileItem(params, FIELD_BUNDLEFILE, false);
-        FileItem refreshPackagesItem = getFileItem(params,
-            FIELD_REFRESH_PACKAGES, true);
+        FileItem startItem = getFileItem( params, FIELD_START, true );
+        FileItem startLevelItem = getFileItem( params, FIELD_STARTLEVEL, true );
+        FileItem bundleItem = getFileItem( params, FIELD_BUNDLEFILE, false );
+        FileItem refreshPackagesItem = getFileItem( params, FIELD_REFRESH_PACKAGES, true );
 
         // don't care any more if not bundle item
-        if (bundleItem == null || bundleItem.getSize() <= 0) {
+        if ( bundleItem == null || bundleItem.getSize() <= 0 )
+        {
             return true;
         }
 
@@ -88,52 +97,63 @@
         String bundleLocation = "inputstream:";
 
         // convert the start level value
-        if (startLevelItem != null) {
-            try {
-                startLevel = Integer.parseInt(startLevelItem.getString());
-            } catch (NumberFormatException nfe) {
-                getLog().log(
-                    LogService.LOG_INFO,
-                    "Cannot parse start level parameter " + startLevelItem
-                        + " to a number, not setting start level");
+        if ( startLevelItem != null )
+        {
+            try
+            {
+                startLevel = Integer.parseInt( startLevelItem.getString() );
+            }
+            catch ( NumberFormatException nfe )
+            {
+                getLog().log( LogService.LOG_INFO,
+                    "Cannot parse start level parameter " + startLevelItem + " to a number, not setting start level" );
             }
         }
 
         // write the bundle data to a temporary file to ease processing
         File tmpFile = null;
-        try {
+        try
+        {
             // copy the data to a file for better processing
-            tmpFile = File.createTempFile("install", ".tmp");
-            bundleItem.write(tmpFile);
-        } catch (Exception e) {
-            getLog().log(LogService.LOG_ERROR,
-                "Problem accessing uploaded bundle file", e);
+            tmpFile = File.createTempFile( "install", ".tmp" );
+            bundleItem.write( tmpFile );
+        }
+        catch ( Exception e )
+        {
+            getLog().log( LogService.LOG_ERROR, "Problem accessing uploaded bundle file", e );
 
             // remove the tmporary file
-            if (tmpFile != null) {
+            if ( tmpFile != null )
+            {
                 tmpFile.delete();
                 tmpFile = null;
             }
         }
 
         // install or update the bundle now
-        if (tmpFile != null) {
+        if ( tmpFile != null )
+        {
             // start, refreshPackages just needs to exist, don't care for value
             boolean start = startItem != null;
             boolean refreshPackages = refreshPackagesItem != null;
 
             bundleLocation = "inputstream:" + bundleItem.getName();
-            installBundle(bundleLocation, tmpFile, startLevel, start, refreshPackages);
+            installBundle( bundleLocation, tmpFile, startLevel, start, refreshPackages );
         }
 
         return true;
     }
 
-    private FileItem getFileItem(Map params, String name, boolean isFormField) {
-        FileItem[] items = (FileItem[]) params.get(name);
-        if (items != null) {
-            for (int i = 0; i < items.length; i++) {
-                if (items[i].isFormField() == isFormField) {
+
+    private FileItem getFileItem( Map params, String name, boolean isFormField )
+    {
+        FileItem[] items = ( FileItem[] ) params.get( name );
+        if ( items != null )
+        {
+            for ( int i = 0; i < items.length; i++ )
+            {
+                if ( items[i].isFormField() == isFormField )
+                {
                     return items[i];
                 }
             }
@@ -143,13 +163,16 @@
         return null;
     }
 
-    private void installBundle(String location, File bundleFile,
-            int startLevel, boolean start, boolean refreshPackages) {
-        if (bundleFile != null) {
+
+    private void installBundle( String location, File bundleFile, int startLevel, boolean start, boolean refreshPackages )
+    {
+        if ( bundleFile != null )
+        {
 
             // try to get the bundle name, fail if none
-            String symbolicName = getSymbolicName(bundleFile);
-            if (symbolicName == null) {
+            String symbolicName = getSymbolicName( bundleFile );
+            if ( symbolicName == null )
+            {
                 bundleFile.delete();
                 return;
             }
@@ -157,47 +180,58 @@
             // check for existing bundle first
             Bundle updateBundle = null;
             Bundle[] bundles = getBundleContext().getBundles();
-            for (int i = 0; i < bundles.length; i++) {
-                if ((bundles[i].getLocation() != null && bundles[i].getLocation().equals(
-                    location))
-                    || (bundles[i].getSymbolicName() != null && bundles[i].getSymbolicName().equals(
-                        symbolicName))) {
+            for ( int i = 0; i < bundles.length; i++ )
+            {
+                if ( ( bundles[i].getLocation() != null && bundles[i].getLocation().equals( location ) )
+                    || ( bundles[i].getSymbolicName() != null && bundles[i].getSymbolicName().equals( symbolicName ) ) )
+                {
                     updateBundle = bundles[i];
                     break;
                 }
             }
 
-            if (updateBundle != null) {
+            if ( updateBundle != null )
+            {
 
-                updateBackground(updateBundle, bundleFile, refreshPackages);
+                updateBackground( updateBundle, bundleFile, refreshPackages );
 
-            } else {
+            }
+            else
+            {
 
-                installBackground(bundleFile, location, startLevel, start,
-                    refreshPackages);
+                installBackground( bundleFile, location, startLevel, start, refreshPackages );
 
             }
         }
     }
 
-    private String getSymbolicName(File bundleFile) {
+
+    private String getSymbolicName( File bundleFile )
+    {
         JarFile jar = null;
-        try {
-            jar = new JarFile(bundleFile);
+        try
+        {
+            jar = new JarFile( bundleFile );
             Manifest m = jar.getManifest();
-            if (m != null) {
-                return m.getMainAttributes().getValue(
-                    Constants.BUNDLE_SYMBOLICNAME);
-            }
-        } catch (IOException ioe) {
-            getLog().log(LogService.LOG_WARNING,
-                "Cannot extract symbolic name of bundle file " + bundleFile,
-                ioe);
-        } finally {
-            if (jar != null) {
-                try {
+            if ( m != null )
+            {
+                return m.getMainAttributes().getValue( Constants.BUNDLE_SYMBOLICNAME );
+            }
+        }
+        catch ( IOException ioe )
+        {
+            getLog().log( LogService.LOG_WARNING, "Cannot extract symbolic name of bundle file " + bundleFile, ioe );
+        }
+        finally
+        {
+            if ( jar != null )
+            {
+                try
+                {
                     jar.close();
-                } catch (IOException ioe) {
+                }
+                catch ( IOException ioe )
+                {
                     // ignore
                 }
             }
@@ -207,24 +241,26 @@
         return null;
     }
 
-    private void installBackground(final File bundleFile,
-            final String location, final int startlevel, final boolean doStart,
-            final boolean refreshPackages) {
-
-        Thread t = new InstallHelper(this, "Background Install " + bundleFile,
-            bundleFile, refreshPackages) {
-
-            protected void doRun(InputStream bundleStream)
-                    throws BundleException {
-                Bundle bundle = getBundleContext().installBundle(location,
-                    bundleStream);
+
+    private void installBackground( final File bundleFile, final String location, final int startlevel,
+        final boolean doStart, final boolean refreshPackages )
+    {
+
+        Thread t = new InstallHelper( this, "Background Install " + bundleFile, bundleFile, refreshPackages )
+        {
+
+            protected void doRun( InputStream bundleStream ) throws BundleException
+            {
+                Bundle bundle = getBundleContext().installBundle( location, bundleStream );
 
                 StartLevel sl = getStartLevel();
-                if (sl != null) {
-                    sl.setBundleStartLevel(bundle, startlevel);
+                if ( sl != null )
+                {
+                    sl.setBundleStartLevel( bundle, startlevel );
                 }
 
-                if (doStart) {
+                if ( doStart )
+                {
                     bundle.start();
                 }
             }
@@ -233,22 +269,24 @@
         t.start();
     }
 
-    private void updateBackground(final Bundle bundle, final File bundleFile,
-            final boolean refreshPackages) {
-        Thread t = new InstallHelper(this, "Background Update"
-            + bundle.getSymbolicName() + " (" + bundle.getBundleId() + ")",
-            bundleFile, refreshPackages) {
-
-            protected void doRun(InputStream bundleStream)
-                    throws BundleException {
-                bundle.update(bundleStream);
+
+    private void updateBackground( final Bundle bundle, final File bundleFile, final boolean refreshPackages )
+    {
+        Thread t = new InstallHelper( this, "Background Update" + bundle.getSymbolicName() + " ("
+            + bundle.getBundleId() + ")", bundleFile, refreshPackages )
+        {
+
+            protected void doRun( InputStream bundleStream ) throws BundleException
+            {
+                bundle.update( bundleStream );
             }
         };
 
         t.start();
     }
 
-    private static abstract class InstallHelper extends Thread {
+    private static abstract class InstallHelper extends Thread
+    {
 
         private final InstallAction installAction;
 
@@ -256,56 +294,78 @@
 
         private final boolean refreshPackages;
 
-        InstallHelper(InstallAction installAction, String name,
-                File bundleFile, boolean refreshPackages) {
-            super(name);
-            setDaemon(true);
+
+        InstallHelper( InstallAction installAction, String name, File bundleFile, boolean refreshPackages )
+        {
+            super( name );
+            setDaemon( true );
 
             this.installAction = installAction;
             this.bundleFile = bundleFile;
             this.refreshPackages = refreshPackages;
         }
 
-        protected abstract void doRun(InputStream bundleStream)
-                throws BundleException;
 
-        public void run() {
+        protected abstract void doRun( InputStream bundleStream ) throws BundleException;
+
+
+        public void run()
+        {
             // wait some time for the request to settle
-            try {
-                sleep(500L);
-            } catch (InterruptedException ie) {
+            try
+            {
+                sleep( 500L );
+            }
+            catch ( InterruptedException ie )
+            {
                 // don't care
             }
 
             // now deploy the resolved bundles
             InputStream bundleStream = null;
-            try {
-                bundleStream = new FileInputStream(bundleFile);
-                doRun(bundleStream);
-
-                if (refreshPackages) {
-                    try {
+            try
+            {
+                bundleStream = new FileInputStream( bundleFile );
+                doRun( bundleStream );
+
+                if ( refreshPackages )
+                {
+                    try
+                    {
                         PackageAdmin pa = installAction.getPackageAdmin();
-                        if (pa != null) {
-                            pa.refreshPackages(null);
+                        if ( pa != null )
+                        {
+                            pa.refreshPackages( null );
                         }
-                    } catch (IllegalStateException ise) {
+                    }
+                    catch ( IllegalStateException ise )
+                    {
                         // This exception is expected if the webconsole bundle
                         // itself has just been updated. For now, we just
                         // ignore this exception
                     }
                 }
-            } catch (IOException ioe) {
-                installAction.getLog().log(LogService.LOG_ERROR,
-                    "Cannot install or update bundle from " + bundleFile, ioe);
-            } catch (BundleException be) {
-                installAction.getLog().log(LogService.LOG_ERROR,
-                    "Cannot install or update bundle from " + bundleFile, be);
-            } finally {
-                if (bundleStream != null) {
-                    try {
+            }
+            catch ( IOException ioe )
+            {
+                installAction.getLog().log( LogService.LOG_ERROR, "Cannot install or update bundle from " + bundleFile,
+                    ioe );
+            }
+            catch ( BundleException be )
+            {
+                installAction.getLog().log( LogService.LOG_ERROR, "Cannot install or update bundle from " + bundleFile,
+                    be );
+            }
+            finally
+            {
+                if ( bundleStream != null )
+                {
+                    try
+                    {
                         bundleStream.close();
-                    } catch (IOException ignore) {
+                    }
+                    catch ( IOException ignore )
+                    {
                     }
                 }
                 bundleFile.delete();

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/RefreshPackagesAction.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/RefreshPackagesAction.java?rev=657742&r1=657741&r2=657742&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/RefreshPackagesAction.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/RefreshPackagesAction.java Mon May 19 00:36:38 2008
@@ -16,30 +16,38 @@
  */
 package org.apache.felix.webconsole.internal.core;
 
+
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+
 /**
  * The <code>RefreshPackagesAction</code> TODO
  */
-public class RefreshPackagesAction extends BundleAction {
+public class RefreshPackagesAction extends BundleAction
+{
 
     public static final String NAME = "refreshPackages";
 
     public static final String LABEL = "Refresh Packages";
 
-    public String getName() {
+
+    public String getName()
+    {
         return NAME;
     }
 
-    public String getLabel() {
+
+    public String getLabel()
+    {
         return LABEL;
     }
 
-    public boolean performAction(HttpServletRequest request,
-            HttpServletResponse response) {
 
-        getPackageAdmin().refreshPackages(null);
+    public boolean performAction( HttpServletRequest request, HttpServletResponse response )
+    {
+
+        getPackageAdmin().refreshPackages( null );
 
         return true;
     }

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/SetStartLevelAction.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/SetStartLevelAction.java?rev=657742&r1=657741&r2=657742&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/SetStartLevelAction.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/SetStartLevelAction.java Mon May 19 00:36:38 2008
@@ -16,6 +16,7 @@
  */
 package org.apache.felix.webconsole.internal.core;
 
+
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
@@ -23,46 +24,61 @@
 import org.apache.felix.webconsole.internal.BaseManagementPlugin;
 import org.osgi.service.startlevel.StartLevel;
 
+
 /**
  * The <code>SetStartLevelAction</code> TODO
  */
-public class SetStartLevelAction extends BaseManagementPlugin implements Action {
+public class SetStartLevelAction extends BaseManagementPlugin implements Action
+{
 
     public static final String NAME = "setStartLevel";
 
     public static final String LABEL = "Set Start Level";
 
-    public String getName() {
+
+    public String getName()
+    {
         return NAME;
     }
 
-    public String getLabel() {
+
+    public String getLabel()
+    {
         return LABEL;
     }
 
-    public boolean performAction(HttpServletRequest request,
-            HttpServletResponse response) {
+
+    public boolean performAction( HttpServletRequest request, HttpServletResponse response )
+    {
 
         StartLevel sl = getStartLevel();
-        if (sl != null) {
-            int bundleSL = this.getParameterInt(request, "bundleStartLevel");
-            if (bundleSL > 0 && bundleSL != sl.getInitialBundleStartLevel()) {
-                sl.setInitialBundleStartLevel(bundleSL);
+        if ( sl != null )
+        {
+            int bundleSL = this.getParameterInt( request, "bundleStartLevel" );
+            if ( bundleSL > 0 && bundleSL != sl.getInitialBundleStartLevel() )
+            {
+                sl.setInitialBundleStartLevel( bundleSL );
             }
 
-            int systemSL = this.getParameterInt(request, "systemStartLevel");
-            if (systemSL > 0 && systemSL != sl.getStartLevel()) {
-                sl.setStartLevel(systemSL);
+            int systemSL = this.getParameterInt( request, "systemStartLevel" );
+            if ( systemSL > 0 && systemSL != sl.getStartLevel() )
+            {
+                sl.setStartLevel( systemSL );
             }
         }
 
         return true;
     }
 
-    private int getParameterInt(HttpServletRequest request, String name) {
-        try {
-            return Integer.parseInt(request.getParameter(name));
-        } catch (NumberFormatException nfe) {
+
+    private int getParameterInt( HttpServletRequest request, String name )
+    {
+        try
+        {
+            return Integer.parseInt( request.getParameter( name ) );
+        }
+        catch ( NumberFormatException nfe )
+        {
             // don't care
         }
 

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/StartAction.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/StartAction.java?rev=657742&r1=657741&r2=657742&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/StartAction.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/StartAction.java Mon May 19 00:36:38 2008
@@ -16,6 +16,7 @@
  */
 package org.apache.felix.webconsole.internal.core;
 
+
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
@@ -23,29 +24,42 @@
 import org.osgi.framework.BundleException;
 import org.osgi.service.log.LogService;
 
-public class StartAction extends BundleAction {
+
+public class StartAction extends BundleAction
+{
 
     public static final String NAME = "start";
     public static final String LABEL = "Start";
 
-    public String getName() {
+
+    public String getName()
+    {
         return NAME;
     }
 
-    public String getLabel() {
+
+    public String getLabel()
+    {
         return LABEL;
     }
 
-    public boolean performAction(HttpServletRequest request, HttpServletResponse response) {
 
-        long bundleId = this.getBundleId(request);
-        if (bundleId > 0) { // cannot start system bundle !!
-            Bundle bundle = this.getBundleContext().getBundle(bundleId);
-            if (bundle != null) {
-                try {
+    public boolean performAction( HttpServletRequest request, HttpServletResponse response )
+    {
+
+        long bundleId = this.getBundleId( request );
+        if ( bundleId > 0 )
+        { // cannot start system bundle !!
+            Bundle bundle = this.getBundleContext().getBundle( bundleId );
+            if ( bundle != null )
+            {
+                try
+                {
                     bundle.start();
-                } catch (BundleException be) {
-                    getLog().log(LogService.LOG_ERROR, "Cannot start", be);
+                }
+                catch ( BundleException be )
+                {
+                    getLog().log( LogService.LOG_ERROR, "Cannot start", be );
                 }
 
             }
@@ -53,4 +67,3 @@
         return true;
     }
 }
-

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/StopAction.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/StopAction.java?rev=657742&r1=657741&r2=657742&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/StopAction.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/StopAction.java Mon May 19 00:36:38 2008
@@ -16,6 +16,7 @@
  */
 package org.apache.felix.webconsole.internal.core;
 
+
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
@@ -23,32 +24,45 @@
 import org.osgi.framework.BundleException;
 import org.osgi.service.log.LogService;
 
+
 /**
  * The <code>StopAction</code> TODO
  */
-public class StopAction extends BundleAction {
+public class StopAction extends BundleAction
+{
 
     public static final String NAME = "stop";
     public static final String LABEL = "Stop";
 
-    public String getName() {
+
+    public String getName()
+    {
         return NAME;
     }
 
-    public String getLabel() {
+
+    public String getLabel()
+    {
         return LABEL;
     }
 
-    public boolean performAction(HttpServletRequest request, HttpServletResponse response) {
 
-        long bundleId = this.getBundleId(request);
-        if (bundleId > 0) { // cannot stop system bundle !!
-            Bundle bundle = this.getBundleContext().getBundle(bundleId);
-            if (bundle != null) {
-                try {
+    public boolean performAction( HttpServletRequest request, HttpServletResponse response )
+    {
+
+        long bundleId = this.getBundleId( request );
+        if ( bundleId > 0 )
+        { // cannot stop system bundle !!
+            Bundle bundle = this.getBundleContext().getBundle( bundleId );
+            if ( bundle != null )
+            {
+                try
+                {
                     bundle.stop();
-                } catch (BundleException be) {
-                    getLog().log(LogService.LOG_ERROR, "Cannot stop", be);
+                }
+                catch ( BundleException be )
+                {
+                    getLog().log( LogService.LOG_ERROR, "Cannot stop", be );
                 }
 
             }
@@ -57,4 +71,3 @@
         return true;
     }
 }
-

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/UninstallAction.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/UninstallAction.java?rev=657742&r1=657741&r2=657742&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/UninstallAction.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/UninstallAction.java Mon May 19 00:36:38 2008
@@ -16,6 +16,7 @@
  */
 package org.apache.felix.webconsole.internal.core;
 
+
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
@@ -23,29 +24,42 @@
 import org.osgi.framework.BundleException;
 import org.osgi.service.log.LogService;
 
-public class UninstallAction extends BundleAction {
+
+public class UninstallAction extends BundleAction
+{
 
     public static final String NAME = "uninstall";
     public static final String LABEL = "Uninstall";
 
-    public String getName() {
+
+    public String getName()
+    {
         return NAME;
     }
 
-    public String getLabel() {
+
+    public String getLabel()
+    {
         return LABEL;
     }
 
-    public boolean performAction(HttpServletRequest request, HttpServletResponse response) {
 
-        long bundleId = this.getBundleId(request);
-        if (bundleId > 0) { // cannot stop system bundle !!
-            Bundle bundle = this.getBundleContext().getBundle(bundleId);
-            if (bundle != null) {
-                try {
+    public boolean performAction( HttpServletRequest request, HttpServletResponse response )
+    {
+
+        long bundleId = this.getBundleId( request );
+        if ( bundleId > 0 )
+        { // cannot stop system bundle !!
+            Bundle bundle = this.getBundleContext().getBundle( bundleId );
+            if ( bundle != null )
+            {
+                try
+                {
                     bundle.uninstall();
-                } catch (BundleException be) {
-                    getLog().log(LogService.LOG_ERROR, "Cannot uninstall", be);
+                }
+                catch ( BundleException be )
+                {
+                    getLog().log( LogService.LOG_ERROR, "Cannot uninstall", be );
                 }
 
             }
@@ -54,4 +68,3 @@
         return true;
     }
 }
-

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/UpdateAction.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/UpdateAction.java?rev=657742&r1=657741&r2=657742&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/UpdateAction.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/UpdateAction.java Mon May 19 00:36:38 2008
@@ -16,6 +16,7 @@
  */
 package org.apache.felix.webconsole.internal.core;
 
+
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
@@ -24,10 +25,12 @@
 import org.osgi.service.log.LogService;
 import org.osgi.util.tracker.ServiceTracker;
 
+
 /**
  * The <code>UpdateAction</code> TODO
  */
-public class UpdateAction extends BundleAction {
+public class UpdateAction extends BundleAction
+{
 
     public static final String NAME = "update";
 
@@ -38,33 +41,44 @@
     // track the optional installer service manually
     private ServiceTracker installerService;
 
-    public void setBundleContext(BundleContext bundleContext) {
-        super.setBundleContext(bundleContext);
 
-        installerService = new ServiceTracker(bundleContext,
-            INSTALLER_SERVICE_NAME, null);
+    public void setBundleContext( BundleContext bundleContext )
+    {
+        super.setBundleContext( bundleContext );
+
+        installerService = new ServiceTracker( bundleContext, INSTALLER_SERVICE_NAME, null );
         installerService.open();
     }
 
-    public String getName() {
+
+    public String getName()
+    {
         return NAME;
     }
 
-    public String getLabel() {
+
+    public String getLabel()
+    {
         return LABEL;
     }
 
-    public boolean performAction(HttpServletRequest request,
-            HttpServletResponse response) {
 
-        long bundleId = this.getBundleId(request);
-        if (bundleId > 0) { // cannot stop system bundle !!
-            Bundle bundle = this.getBundleContext().getBundle(bundleId);
-            if (bundle != null) {
-                try {
-                    this.updateFromRepo(bundle);
-                } catch (Throwable t) {
-                    getLog().log(LogService.LOG_ERROR, "Uncaught Problem", t);
+    public boolean performAction( HttpServletRequest request, HttpServletResponse response )
+    {
+
+        long bundleId = this.getBundleId( request );
+        if ( bundleId > 0 )
+        { // cannot stop system bundle !!
+            Bundle bundle = this.getBundleContext().getBundle( bundleId );
+            if ( bundle != null )
+            {
+                try
+                {
+                    this.updateFromRepo( bundle );
+                }
+                catch ( Throwable t )
+                {
+                    getLog().log( LogService.LOG_ERROR, "Uncaught Problem", t );
                 }
 
             }
@@ -73,51 +87,53 @@
         return true;
     }
 
-    private void updateFromRepo(final Bundle bundle) {
-/*
-        final InstallerService is = (InstallerService) installerService.getService();
-        if (is == null) {
-            return;
-        }
-
-        final String name = bundle.getSymbolicName();
-        final String version = (String) bundle.getHeaders().get(
-            Constants.BUNDLE_VERSION);
-
-        // the name is required, otherwise we can do nothing
-        if (name == null) {
-            return;
-        }
 
-        // TODO: Should be restrict to same major.micro ??
-
-        Thread t = new Thread("Background Update") {
-            public void run() {
-                // wait some time for the request to settle
-                try {
-                    sleep(500L);
-                } catch (InterruptedException ie) {
-                    // don't care
+    private void updateFromRepo( final Bundle bundle )
+    {
+        /*
+                final InstallerService is = (InstallerService) installerService.getService();
+                if (is == null) {
+                    return;
                 }
 
-                Installer installer = is.getInstaller();
-                installer.addBundle(name, new VersionRange(version), -1);
-                try {
-                    installer.install(false);
-                } catch (InstallerException ie) {
-                    Throwable cause = (ie.getCause() != null)
-                            ? ie.getCause()
-                            : ie;
-                    getLog().log(LogService.LOG_ERROR, "Cannot update", cause);
-                } finally {
-                    installer.dispose();
+                final String name = bundle.getSymbolicName();
+                final String version = (String) bundle.getHeaders().get(
+                    Constants.BUNDLE_VERSION);
+
+                // the name is required, otherwise we can do nothing
+                if (name == null) {
+                    return;
                 }
-            }
-        };
 
-        t.setDaemon(true); // make a daemon thread (detach from current thread)
-        t.start();
-        */
+                // TODO: Should be restrict to same major.micro ??
+
+                Thread t = new Thread("Background Update") {
+                    public void run() {
+                        // wait some time for the request to settle
+                        try {
+                            sleep(500L);
+                        } catch (InterruptedException ie) {
+                            // don't care
+                        }
+
+                        Installer installer = is.getInstaller();
+                        installer.addBundle(name, new VersionRange(version), -1);
+                        try {
+                            installer.install(false);
+                        } catch (InstallerException ie) {
+                            Throwable cause = (ie.getCause() != null)
+                                    ? ie.getCause()
+                                    : ie;
+                            getLog().log(LogService.LOG_ERROR, "Cannot update", cause);
+                        } finally {
+                            installer.dispose();
+                        }
+                    }
+                };
+
+                t.setDaemon(true); // make a daemon thread (detach from current thread)
+                t.start();
+                */
     }
 
 }

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/AssemblyListRender.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/AssemblyListRender.java?rev=657742&r1=657741&r2=657742&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/AssemblyListRender.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/AssemblyListRender.java Mon May 19 00:36:38 2008
@@ -16,33 +16,44 @@
  */
 package org.apache.felix.webconsole.internal.misc;
 
+
 import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.felix.webconsole.internal.core.BundleListRender;
 import org.osgi.framework.Bundle;
 
-public class AssemblyListRender extends BundleListRender {
+
+public class AssemblyListRender extends BundleListRender
+{
 
     public static final String NAME = "assemblyList";
     public static final String LABEL = "Assemblies";
 
-    public String getName() {
+
+    public String getName()
+    {
         return NAME;
     }
 
-    public String getLabel() {
+
+    public String getLabel()
+    {
         return LABEL;
     }
 
-    protected Bundle[] getBundles() {
+
+    protected Bundle[] getBundles()
+    {
         Bundle[] bundles = this.getBundleContext().getBundles();
         List assList = new ArrayList();
-        for (int i=0; i < bundles.length; i++) {
-            if (bundles[i].getHeaders().get("Assembly-Bundles") != null) {
-                assList.add(bundles[i]);
+        for ( int i = 0; i < bundles.length; i++ )
+        {
+            if ( bundles[i].getHeaders().get( "Assembly-Bundles" ) != null )
+            {
+                assList.add( bundles[i] );
             }
         }
-        return (Bundle[]) assList.toArray(new Bundle[assList.size()]);
+        return ( Bundle[] ) assList.toArray( new Bundle[assList.size()] );
     }
 }

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=657742&r1=657741&r2=657742&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 Mon May 19 00:36:38 2008
@@ -16,10 +16,8 @@
  */
 package org.apache.felix.webconsole.internal.misc;
 
-import java.io.File;
-import java.io.FileInputStream;
+
 import java.io.IOException;
-import java.io.InputStream;
 import java.io.PrintWriter;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
@@ -40,7 +38,6 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.commons.io.IOUtils;
 import org.apache.felix.webconsole.ConfigurationPrinter;
 import org.apache.felix.webconsole.Render;
 import org.apache.felix.webconsole.internal.BaseManagementPlugin;
@@ -55,7 +52,9 @@
 import org.osgi.service.prefs.PreferencesService;
 import org.osgi.util.tracker.ServiceTracker;
 
-public class ConfigurationRender extends BaseManagementPlugin implements Render {
+
+public class ConfigurationRender extends BaseManagementPlugin implements Render
+{
 
     public static final String NAME = "config";
 
@@ -67,66 +66,77 @@
 
     private SortedMap configurationPrinters = new TreeMap();
 
-    public String getName() {
+
+    public String getName()
+    {
         return NAME;
     }
 
-    public String getLabel() {
+
+    public String getLabel()
+    {
         return LABEL;
     }
 
-    public void render(HttpServletRequest request, HttpServletResponse response)
-            throws IOException {
+
+    public void render( HttpServletRequest request, HttpServletResponse response ) throws IOException
+    {
 
         PrintWriter pw = response.getWriter();
 
-        pw.println("<table class='content' cellpadding='0' cellspacing='0' width='100%'>");
+        pw.println( "<table class='content' cellpadding='0' cellspacing='0' width='100%'>" );
 
-        pw.println("<tr class='content'>");
-        pw.println("<th class='content container'>Configuration Details</th>");
-        pw.println("</tr>");
-
-        pw.println("<tr class='content'>");
-        pw.println("<td class='content'>");
-        pw.println("<pre>");
-
-        pw.println("*** Date: "
-            + SimpleDateFormat.getDateTimeInstance(SimpleDateFormat.LONG,
-                SimpleDateFormat.LONG, Locale.US).format(new Date()));
+        pw.println( "<tr class='content'>" );
+        pw.println( "<th class='content container'>Configuration Details</th>" );
+        pw.println( "</tr>" );
+
+        pw.println( "<tr class='content'>" );
+        pw.println( "<td class='content'>" );
+        pw.println( "<pre>" );
+
+        pw.println( "*** Date: "
+            + SimpleDateFormat.getDateTimeInstance( SimpleDateFormat.LONG, SimpleDateFormat.LONG, Locale.US ).format(
+                new Date() ) );
         pw.println();
 
-        this.printSystemProperties(pw);
-        this.printBundles(pw);
-        this.printServices(pw);
-        this.printPreferences(pw);
-        this.printConfigurations(pw);
-
-        for (Iterator cpi = getConfigurationPrinters().iterator(); cpi.hasNext();) {
-            printConfigurationPrinter(pw, (ConfigurationPrinter) cpi.next());
-        }
-
-        pw.println("</pre>");
-        pw.println("</td>");
-        pw.println("</tr>");
-        pw.println("</table>");
-    }
-
-    private Collection getConfigurationPrinters() {
-        if (cfgPrinterTracker == null) {
-            cfgPrinterTracker = new ServiceTracker(getBundleContext(),
-                ConfigurationPrinter.SERVICE, null);
+        this.printSystemProperties( pw );
+        this.printBundles( pw );
+        this.printServices( pw );
+        this.printPreferences( pw );
+        this.printConfigurations( pw );
+
+        for ( Iterator cpi = getConfigurationPrinters().iterator(); cpi.hasNext(); )
+        {
+            printConfigurationPrinter( pw, ( ConfigurationPrinter ) cpi.next() );
+        }
+
+        pw.println( "</pre>" );
+        pw.println( "</td>" );
+        pw.println( "</tr>" );
+        pw.println( "</table>" );
+    }
+
+
+    private Collection getConfigurationPrinters()
+    {
+        if ( cfgPrinterTracker == null )
+        {
+            cfgPrinterTracker = new ServiceTracker( getBundleContext(), ConfigurationPrinter.SERVICE, null );
             cfgPrinterTracker.open();
             cfgPrinterTrackerCount = -1;
         }
 
-        if (cfgPrinterTrackerCount != cfgPrinterTracker.getTrackingCount()) {
+        if ( cfgPrinterTrackerCount != cfgPrinterTracker.getTrackingCount() )
+        {
             SortedMap cp = new TreeMap();
             Object[] services = cfgPrinterTracker.getServices();
-            if (services != null) {
-                for (int i = 0; i < services.length; i++) {
+            if ( services != null )
+            {
+                for ( int i = 0; i < services.length; i++ )
+                {
                     Object srv = services[i];
-                    ConfigurationPrinter cfgPrinter = (ConfigurationPrinter) srv;
-                    cp.put(cfgPrinter.getTitle(), cfgPrinter);
+                    ConfigurationPrinter cfgPrinter = ( ConfigurationPrinter ) srv;
+                    cp.put( cfgPrinter.getTitle(), cfgPrinter );
                 }
             }
             configurationPrinters = cp;
@@ -136,108 +146,122 @@
         return configurationPrinters.values();
     }
 
-    private void printSystemProperties(PrintWriter pw) {
-        pw.println("*** System properties:");
+
+    private void printSystemProperties( PrintWriter pw )
+    {
+        pw.println( "*** System properties:" );
 
         Properties props = System.getProperties();
-        SortedSet keys = new TreeSet(props.keySet());
-        for (Iterator ki = keys.iterator(); ki.hasNext();) {
+        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));
+            this.infoLine( pw, null, ( String ) key, props.get( key ) );
         }
 
         pw.println();
     }
 
-    // This is Sling stuff, we comment it out for now
-//    private void printRawFrameworkProperties(PrintWriter pw) {
-//        pw.println("*** Raw Framework properties:");
-//
-//        File file = new File(getBundleContext().getProperty("sling.home"),
-//            "sling.properties");
-//        if (file.exists()) {
-//            Properties props = new Properties();
-//            InputStream ins = null;
-//            try {
-//                ins = new FileInputStream(file);
-//                props.load(ins);
-//            } catch (IOException ioe) {
-//                // handle or ignore
-//            } finally {
-//                IOUtils.closeQuietly(ins);
-//            }
-//
-//            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));
-//            }
-//
-//        } else {
-//            pw.println("  No Framework properties in " + file);
-//        }
-//
-//        pw.println();
-//    }
 
-    private void printBundles(PrintWriter pw) {
-        pw.println("*** Bundles:");
+    // This is Sling stuff, we comment it out for now
+    //    private void printRawFrameworkProperties(PrintWriter pw) {
+    //        pw.println("*** Raw Framework properties:");
+    //
+    //        File file = new File(getBundleContext().getProperty("sling.home"),
+    //            "sling.properties");
+    //        if (file.exists()) {
+    //            Properties props = new Properties();
+    //            InputStream ins = null;
+    //            try {
+    //                ins = new FileInputStream(file);
+    //                props.load(ins);
+    //            } catch (IOException ioe) {
+    //                // handle or ignore
+    //            } finally {
+    //                IOUtils.closeQuietly(ins);
+    //            }
+    //
+    //            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));
+    //            }
+    //
+    //        } else {
+    //            pw.println("  No Framework properties in " + file);
+    //        }
+    //
+    //        pw.println();
+    //    }
+
+    private void printBundles( PrintWriter pw )
+    {
+        pw.println( "*** Bundles:" );
         // biz.junginger.freemem.FreeMem (1.3.0) "FreeMem Eclipse Memory
         // Monitor" [Resolved]
 
         Bundle[] bundles = getBundleContext().getBundles();
         SortedSet keys = new TreeSet();
-        for (int i = 0; i < bundles.length; i++) {
-            keys.add(this.getBundleString(bundles[i], true));
+        for ( int i = 0; i < bundles.length; i++ )
+        {
+            keys.add( this.getBundleString( bundles[i], true ) );
         }
 
-        for (Iterator ki = keys.iterator(); ki.hasNext();) {
-            this.infoLine(pw, null, null, ki.next());
+        for ( Iterator ki = keys.iterator(); ki.hasNext(); )
+        {
+            this.infoLine( pw, null, null, ki.next() );
         }
 
         pw.println();
     }
 
-    private void printServices(PrintWriter pw) {
-        pw.println("*** Services:");
+
+    private void printServices( PrintWriter pw )
+    {
+        pw.println( "*** Services:" );
 
         // get the list of services sorted by service ID (ascending)
         SortedMap srMap = new TreeMap();
-        try {
-            ServiceReference[] srs = getBundleContext().getAllServiceReferences(
-                null, null);
-            for (int i = 0; i < srs.length; i++) {
-                srMap.put(srs[i].getProperty(Constants.SERVICE_ID), srs[i]);
+        try
+        {
+            ServiceReference[] srs = getBundleContext().getAllServiceReferences( null, null );
+            for ( int i = 0; i < srs.length; i++ )
+            {
+                srMap.put( srs[i].getProperty( Constants.SERVICE_ID ), srs[i] );
             }
-        } catch (InvalidSyntaxException ise) {
+        }
+        catch ( InvalidSyntaxException ise )
+        {
             // should handle, for now just print nothing, actually this is not
             // expected
         }
 
-        for (Iterator si = srMap.values().iterator(); si.hasNext();) {
-            ServiceReference sr = (ServiceReference) si.next();
-
-            this.infoLine(pw, null,
-                String.valueOf(sr.getProperty(Constants.SERVICE_ID)),
-                sr.getProperty(Constants.OBJECTCLASS));
-            this.infoLine(pw, "  ", "Bundle", this.getBundleString(
-                sr.getBundle(), false));
+        for ( Iterator si = srMap.values().iterator(); si.hasNext(); )
+        {
+            ServiceReference sr = ( ServiceReference ) si.next();
+
+            this.infoLine( pw, null, String.valueOf( sr.getProperty( Constants.SERVICE_ID ) ), sr
+                .getProperty( Constants.OBJECTCLASS ) );
+            this.infoLine( pw, "  ", "Bundle", this.getBundleString( sr.getBundle(), false ) );
 
             Bundle[] users = sr.getUsingBundles();
-            if (users != null && users.length > 0) {
+            if ( users != null && users.length > 0 )
+            {
                 List userString = new ArrayList();
-                for (int i = 0; i < users.length; i++) {
-                    userString.add(this.getBundleString(users[i], false));
+                for ( int i = 0; i < users.length; i++ )
+                {
+                    userString.add( this.getBundleString( users[i], false ) );
                 }
-                this.infoLine(pw, "  ", "Using Bundles", userString);
+                this.infoLine( pw, "  ", "Using Bundles", userString );
             }
 
             String[] keys = sr.getPropertyKeys();
-            Arrays.sort(keys);
-            for (int i = 0; i < keys.length; i++) {
-                if (!Constants.SERVICE_ID.equals(keys[i])
-                    && !Constants.OBJECTCLASS.equals(keys[i])) {
-                    this.infoLine(pw, "  ", keys[i], sr.getProperty(keys[i]));
+            Arrays.sort( keys );
+            for ( int i = 0; i < keys.length; i++ )
+            {
+                if ( !Constants.SERVICE_ID.equals( keys[i] ) && !Constants.OBJECTCLASS.equals( keys[i] ) )
+                {
+                    this.infoLine( pw, "  ", keys[i], sr.getProperty( keys[i] ) );
                 }
             }
 
@@ -245,205 +269,256 @@
         }
     }
 
-    private void printPreferences(PrintWriter pw) {
-        pw.println("*** System Preferences:");
 
-        ServiceReference sr = getBundleContext().getServiceReference(
-            PreferencesService.class.getName());
-        if (sr == null) {
-            pw.println("  Preferences Service not registered");
+    private void printPreferences( PrintWriter pw )
+    {
+        pw.println( "*** System Preferences:" );
+
+        ServiceReference sr = getBundleContext().getServiceReference( PreferencesService.class.getName() );
+        if ( sr == null )
+        {
+            pw.println( "  Preferences Service not registered" );
             pw.println();
             return;
         }
 
-        PreferencesService ps = (PreferencesService) getBundleContext().getService(
-            sr);
-        try {
-            this.printPreferences(pw, ps.getSystemPreferences());
+        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]));
+            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) {
+        }
+        catch ( BackingStoreException bse )
+        {
             // todo or not :-)
-        } finally {
-            getBundleContext().ungetService(sr);
+        }
+        finally
+        {
+            getBundleContext().ungetService( sr );
         }
     }
 
-    private void printPreferences(PrintWriter pw, Preferences prefs)
-            throws BackingStoreException {
+
+    private void printPreferences( PrintWriter pw, Preferences prefs ) throws BackingStoreException
+    {
 
         String[] children = prefs.childrenNames();
-        for (int i = 0; i < children.length; i++) {
-            this.printPreferences(pw, prefs.node(children[i]));
+        for ( int i = 0; i < children.length; i++ )
+        {
+            this.printPreferences( pw, prefs.node( children[i] ) );
         }
 
         String[] keys = prefs.keys();
-        for (int i = 0; i < keys.length; i++) {
-            this.infoLine(pw, null, prefs.absolutePath() + "/" + keys[i],
-                prefs.get(keys[i], null));
+        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(PrintWriter pw) {
-        pw.println("*** 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) {
+    private void printConfigurations( PrintWriter pw )
+    {
+        pw.println( "*** 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 ( 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());
+                    for ( Iterator mi = sm.values().iterator(); mi.hasNext(); )
+                    {
+                        this.printConfiguration( pw, ( Configuration ) mi.next() );
                     }
-                } else {
-                    pw.println("  No Configurations available");
                 }
-            } catch (Exception e) {
+                else
+                {
+                    pw.println( "  No Configurations available" );
+                }
+            }
+            catch ( Exception e )
+            {
                 // todo or not :-)
-            } finally {
-                getBundleContext().ungetService(sr);
+            }
+            finally
+            {
+                getBundleContext().ungetService( sr );
             }
         }
 
         pw.println();
     }
 
-    private void printConfigurationPrinter(PrintWriter pw,
-            ConfigurationPrinter cp) {
-        pw.println("*** " + cp.getTitle() + ":");
-        cp.printConfiguration(pw);
+
+    private void printConfigurationPrinter( PrintWriter pw, ConfigurationPrinter cp )
+    {
+        pw.println( "*** " + cp.getTitle() + ":" );
+        cp.printConfiguration( pw );
         pw.println();
     }
 
-    private void printConfiguration(PrintWriter pw, Configuration config) {
-        this.infoLine(pw, "", "PID", config.getPid());
 
-        if (config.getFactoryPid() != null) {
-            this.infoLine(pw, "  ", "Factory PID", config.getFactoryPid());
+    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);
+        String loc = ( config.getBundleLocation() != null ) ? config.getBundleLocation() : "Unbound";
+        this.infoLine( pw, "  ", "BundleLocation", loc );
 
         Dictionary props = config.getProperties();
-        if (props != null) {
+        if ( props != null )
+        {
             SortedSet keys = new TreeSet();
-            for (Enumeration ke = props.keys(); ke.hasMoreElements();) {
-                keys.add(ke.nextElement());
+            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));
+            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) {
-        if (indent != null) {
-            pw.print(indent);
+
+    private void infoLine( PrintWriter pw, String indent, String label, Object value )
+    {
+        if ( indent != null )
+        {
+            pw.print( indent );
         }
 
-        if (label != null) {
-            pw.print(label);
-            pw.print('=');
+        if ( label != null )
+        {
+            pw.print( label );
+            pw.print( '=' );
         }
 
-        this.printObject(pw, value);
+        this.printObject( pw, value );
 
         pw.println();
     }
 
-    private void printObject(PrintWriter pw, Object value) {
-        if (value == null) {
-            pw.print("null");
-        } else if (value.getClass().isArray()) {
-            this.printArray(pw, (Object[]) value);
-        } else {
-            pw.print(value);
+
+    private void printObject( PrintWriter pw, Object value )
+    {
+        if ( value == null )
+        {
+            pw.print( "null" );
+        }
+        else if ( value.getClass().isArray() )
+        {
+            this.printArray( pw, ( Object[] ) value );
+        }
+        else
+        {
+            pw.print( value );
         }
     }
 
-    private void printArray(PrintWriter pw, Object[] values) {
-        pw.print('[');
-        if (values != null && values.length > 0) {
-            for (int i = 0; i < values.length; i++) {
-                if (i > 0) {
-                    pw.print(", ");
+
+    private void printArray( PrintWriter pw, Object[] values )
+    {
+        pw.print( '[' );
+        if ( values != null && values.length > 0 )
+        {
+            for ( int i = 0; i < values.length; i++ )
+            {
+                if ( i > 0 )
+                {
+                    pw.print( ", " );
                 }
-                this.printObject(pw, values[i]);
+                this.printObject( pw, values[i] );
             }
         }
-        pw.print(']');
+        pw.print( ']' );
     }
 
-    private String getBundleString(Bundle bundle, boolean withState) {
+
+    private String getBundleString( Bundle bundle, boolean withState )
+    {
         StringBuffer buf = new StringBuffer();
 
-        if (bundle.getSymbolicName() != null) {
-            buf.append(bundle.getSymbolicName());
-        } else if (bundle.getLocation() != null) {
-            buf.append(bundle.getLocation());
-        } else {
-            buf.append(bundle.getBundleId());
+        if ( bundle.getSymbolicName() != null )
+        {
+            buf.append( bundle.getSymbolicName() );
+        }
+        else if ( bundle.getLocation() != null )
+        {
+            buf.append( bundle.getLocation() );
+        }
+        else
+        {
+            buf.append( bundle.getBundleId() );
         }
 
         Dictionary headers = bundle.getHeaders();
-        if (headers.get(Constants.BUNDLE_VERSION) != null) {
-            buf.append(" (").append(headers.get(Constants.BUNDLE_VERSION)).append(
-                ')');
+        if ( headers.get( Constants.BUNDLE_VERSION ) != null )
+        {
+            buf.append( " (" ).append( headers.get( Constants.BUNDLE_VERSION ) ).append( ')' );
         }
 
-        if (headers.get(Constants.BUNDLE_NAME) != null) {
-            buf.append(" \"").append(headers.get(Constants.BUNDLE_NAME)).append(
-                '"');
+        if ( headers.get( Constants.BUNDLE_NAME ) != null )
+        {
+            buf.append( " \"" ).append( headers.get( Constants.BUNDLE_NAME ) ).append( '"' );
         }
 
-        if (withState) {
-            buf.append(" [");
-            switch (bundle.getState()) {
+        if ( withState )
+        {
+            buf.append( " [" );
+            switch ( bundle.getState() )
+            {
                 case Bundle.INSTALLED:
-                    buf.append("Installed");
+                    buf.append( "Installed" );
                     break;
                 case Bundle.RESOLVED:
-                    buf.append("Resolved");
+                    buf.append( "Resolved" );
                     break;
                 case Bundle.STARTING:
-                    buf.append("Starting");
+                    buf.append( "Starting" );
                     break;
                 case Bundle.ACTIVE:
-                    buf.append("Active");
+                    buf.append( "Active" );
                     break;
                 case Bundle.STOPPING:
-                    buf.append("Stopping");
+                    buf.append( "Stopping" );
                     break;
                 case Bundle.UNINSTALLED:
-                    buf.append("Uninstalled");
+                    buf.append( "Uninstalled" );
                     break;
             }
-            buf.append(']');
+            buf.append( ']' );
         }
 
         return buf.toString();

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/AbstractObrPlugin.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/AbstractObrPlugin.java?rev=657742&r1=657741&r2=657742&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/AbstractObrPlugin.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/AbstractObrPlugin.java Mon May 19 00:36:38 2008
@@ -18,38 +18,43 @@
  */
 package org.apache.felix.webconsole.internal.obr;
 
+
 import org.apache.felix.webconsole.internal.BaseManagementPlugin;
 import org.osgi.framework.BundleContext;
 import org.osgi.util.tracker.ServiceTracker;
 
-public class AbstractObrPlugin extends BaseManagementPlugin {
+
+public class AbstractObrPlugin extends BaseManagementPlugin
+{
 
     // track the optional installer service manually
     private ServiceTracker installerService;
 
-    public void setBundleContext(BundleContext bundleContext) {
-        super.setBundleContext(bundleContext);
+
+    public void setBundleContext( BundleContext bundleContext )
+    {
+        super.setBundleContext( bundleContext );
 
     }
-/*
-    protected InstallerService getInstallerService() {
-        if (installerService == null) {
-            try {
-                installerService = new ServiceTracker(getBundleContext(),
-                    InstallerService.class.getName(), null);
-                installerService.open();
-            } catch (Throwable t) {
-                // missing InstallerService class ??
-                return null;
+    /*
+        protected InstallerService getInstallerService() {
+            if (installerService == null) {
+                try {
+                    installerService = new ServiceTracker(getBundleContext(),
+                        InstallerService.class.getName(), null);
+                    installerService.open();
+                } catch (Throwable t) {
+                    // missing InstallerService class ??
+                    return null;
+                }
+
             }
 
+            return (InstallerService) installerService.getService();
         }
 
-        return (InstallerService) installerService.getService();
-    }
-
-    protected BundleRepositoryAdmin getBundleRepositoryAdmin() {
-        InstallerService is = getInstallerService();
-        return (is != null) ? is.getBundleRepositoryAdmin() : null;
-    }*/
+        protected BundleRepositoryAdmin getBundleRepositoryAdmin() {
+            InstallerService is = getInstallerService();
+            return (is != null) ? is.getBundleRepositoryAdmin() : null;
+        }*/
 }

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=657742&r1=657741&r2=657742&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 Mon May 19 00:36:38 2008
@@ -16,6 +16,7 @@
  */
 package org.apache.felix.webconsole.internal.obr;
 
+
 import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -30,7 +31,9 @@
 import org.osgi.framework.Constants;
 import org.osgi.framework.Version;
 
-public abstract class BundleRepositoryRender extends AbstractObrPlugin implements Render {
+
+public abstract class BundleRepositoryRender extends AbstractObrPlugin implements Render
+{
 
     public static final String NAME = "bundlerepo";
 
@@ -44,231 +47,257 @@
 
     private String[] repoURLs;
 
-    public void setBundleContext(BundleContext bundleContext) {
-        super.setBundleContext(bundleContext);
 
-        String urlStr = bundleContext.getProperty(REPOSITORY_PROPERTY);
+    public void setBundleContext( BundleContext bundleContext )
+    {
+        super.setBundleContext( bundleContext );
+
+        String urlStr = bundleContext.getProperty( REPOSITORY_PROPERTY );
         List urlList = new ArrayList();
 
-        if (urlStr != null) {
-            StringTokenizer st = new StringTokenizer(urlStr);
-            while (st.hasMoreTokens()) {
-                urlList.add(st.nextToken());
+        if ( urlStr != null )
+        {
+            StringTokenizer st = new StringTokenizer( urlStr );
+            while ( st.hasMoreTokens() )
+            {
+                urlList.add( st.nextToken() );
             }
         }
 
-        this.repoURLs = (String[]) urlList.toArray(new String[urlList.size()]);
+        this.repoURLs = ( String[] ) urlList.toArray( new String[urlList.size()] );
     }
 
-    public String getName() {
+
+    public String getName()
+    {
         return NAME;
     }
 
-    public String getLabel() {
+
+    public String getLabel()
+    {
         return LABEL;
     }
-/*
-    public void render(HttpServletRequest request, HttpServletResponse response)
-            throws IOException {
-
-        PrintWriter pw = response.getWriter();
-        this.header(pw);
-
-        Iterator<?> repos;
-        BundleRepositoryAdmin repoAdmin = getBundleRepositoryAdmin();
-        if (repoAdmin != null) {
-            repos = repoAdmin.getRepositories();
-        } else {
-            repos = Collections.emptyList().iterator();
-        }
 
-        Set<String> activeURLs = new HashSet<String>();
-        if (!repos.hasNext()) {
-            pw.println("<tr class='content'>");
-            pw.println("<td class='content' colspan='4'>No Active Repositories</td>");
-            pw.println("</tr>");
-        } else {
-            while (repos.hasNext()) {
-                Repository repo = (Repository) repos.next();
 
-                activeURLs.add(repo.getURL().toString());
+    /*
+        public void render(HttpServletRequest request, HttpServletResponse response)
+                throws IOException {
+
+            PrintWriter pw = response.getWriter();
+            this.header(pw);
+
+            Iterator<?> repos;
+            BundleRepositoryAdmin repoAdmin = getBundleRepositoryAdmin();
+            if (repoAdmin != null) {
+                repos = repoAdmin.getRepositories();
+            } else {
+                repos = Collections.emptyList().iterator();
+            }
 
+            Set<String> activeURLs = new HashSet<String>();
+            if (!repos.hasNext()) {
                 pw.println("<tr class='content'>");
-                pw.println("<td class='content'>" + repo.getName() + "</td>");
-                pw.println("<td class='content'>" + repo.getURL() + "</td>");
-                pw.println("<td class='content'>"
-                    + new Date(repo.getLastModified()) + "</td>");
-                pw.println("<td class='content'>");
-                pw.println("<form>");
-                pw.println("<input type='hidden' name='" + Util.PARAM_ACTION
-                    + "' value='" + RefreshRepoAction.NAME + "'>");
-                pw.println("<input type='hidden' name='"
-                    + RefreshRepoAction.PARAM_REPO + "' value='"
-                    + repo.getURL() + "'>");
-                pw.println("<input class='submit' type='submit' value='Refresh'>");
-                pw.println("</form>");
-                pw.println("</td>");
+                pw.println("<td class='content' colspan='4'>No Active Repositories</td>");
                 pw.println("</tr>");
+            } else {
+                while (repos.hasNext()) {
+                    Repository repo = (Repository) repos.next();
+
+                    activeURLs.add(repo.getURL().toString());
+
+                    pw.println("<tr class='content'>");
+                    pw.println("<td class='content'>" + repo.getName() + "</td>");
+                    pw.println("<td class='content'>" + repo.getURL() + "</td>");
+                    pw.println("<td class='content'>"
+                        + new Date(repo.getLastModified()) + "</td>");
+                    pw.println("<td class='content'>");
+                    pw.println("<form>");
+                    pw.println("<input type='hidden' name='" + Util.PARAM_ACTION
+                        + "' value='" + RefreshRepoAction.NAME + "'>");
+                    pw.println("<input type='hidden' name='"
+                        + RefreshRepoAction.PARAM_REPO + "' value='"
+                        + repo.getURL() + "'>");
+                    pw.println("<input class='submit' type='submit' value='Refresh'>");
+                    pw.println("</form>");
+                    pw.println("</td>");
+                    pw.println("</tr>");
+                }
             }
-        }
 
-        // list any repositories configured but not active
-        for (int i = 0; i < this.repoURLs.length; i++) {
-            if (!activeURLs.contains(this.repoURLs[i])) {
-                pw.println("<tr class='content'>");
-                pw.println("<td class='content'>-</td>");
-                pw.println("<td class='content'>" + this.repoURLs[i] + "</td>");
-                pw.println("<td class='content'>[inactive, click Refresh to activate]</td>");
-                pw.println("<td class='content'>");
-                pw.println("<form>");
-                pw.println("<input type='hidden' name='" + Util.PARAM_ACTION
-                    + "' value='" + RefreshRepoAction.NAME + "'>");
-                pw.println("<input type='hidden' name='"
-                    + RefreshRepoAction.PARAM_REPO + "' value='"
-                    + this.repoURLs[i] + "'>");
-                pw.println("<input class='submit' type='submit' value='Refresh'>");
-                pw.println("</form>");
-                pw.println("</td>");
-                pw.println("</tr>");
+            // list any repositories configured but not active
+            for (int i = 0; i < this.repoURLs.length; i++) {
+                if (!activeURLs.contains(this.repoURLs[i])) {
+                    pw.println("<tr class='content'>");
+                    pw.println("<td class='content'>-</td>");
+                    pw.println("<td class='content'>" + this.repoURLs[i] + "</td>");
+                    pw.println("<td class='content'>[inactive, click Refresh to activate]</td>");
+                    pw.println("<td class='content'>");
+                    pw.println("<form>");
+                    pw.println("<input type='hidden' name='" + Util.PARAM_ACTION
+                        + "' value='" + RefreshRepoAction.NAME + "'>");
+                    pw.println("<input type='hidden' name='"
+                        + RefreshRepoAction.PARAM_REPO + "' value='"
+                        + this.repoURLs[i] + "'>");
+                    pw.println("<input class='submit' type='submit' value='Refresh'>");
+                    pw.println("</form>");
+                    pw.println("</td>");
+                    pw.println("</tr>");
+                }
             }
-        }
 
-        this.footer(pw);
+            this.footer(pw);
 
-        this.listResources(pw);
-    }
-*/
-    private void header(PrintWriter pw) {
-        pw.println("<table class='content' cellpadding='0' cellspacing='0' width='100%'>");
-        pw.println("<tr class='content'>");
-        pw.println("<th class='content container' colspan='4'>Bundle Repositories</th>");
-        pw.println("</tr>");
-        pw.println("<tr class='content'>");
-        pw.println("<th class='content'>Name</th>");
-        pw.println("<th class='content'>URL</th>");
-        pw.println("<th class='content'>Last Modification Time</th>");
-        pw.println("<th class='content'>&nbsp;</th>");
-        pw.println("</tr>");
+            this.listResources(pw);
+        }
+    */
+    private void header( PrintWriter pw )
+    {
+        pw.println( "<table class='content' cellpadding='0' cellspacing='0' width='100%'>" );
+        pw.println( "<tr class='content'>" );
+        pw.println( "<th class='content container' colspan='4'>Bundle Repositories</th>" );
+        pw.println( "</tr>" );
+        pw.println( "<tr class='content'>" );
+        pw.println( "<th class='content'>Name</th>" );
+        pw.println( "<th class='content'>URL</th>" );
+        pw.println( "<th class='content'>Last Modification Time</th>" );
+        pw.println( "<th class='content'>&nbsp;</th>" );
+        pw.println( "</tr>" );
     }
 
-    private void footer(PrintWriter pw) {
-        pw.println("</table>");
+
+    private void footer( PrintWriter pw )
+    {
+        pw.println( "</table>" );
     }
 
-    private void resourcesHeader(PrintWriter pw, boolean doForm) {
 
-        if (doForm) {
-            pw.println("<form method='post'>");
-            pw.println("<input type='hidden' name='" + Util.PARAM_ACTION
-                + "' value='" + InstallFromRepoAction.NAME + "'>");
+    private void resourcesHeader( PrintWriter pw, boolean doForm )
+    {
+
+        if ( doForm )
+        {
+            pw.println( "<form method='post'>" );
+            pw.println( "<input type='hidden' name='" + Util.PARAM_ACTION + "' value='" + InstallFromRepoAction.NAME
+                + "'>" );
         }
 
-        pw.println("<table class='content' cellpadding='0' cellspacing='0' width='100%'>");
-        pw.println("<tr class='content'>");
-        pw.println("<th class='content container' colspan='3'>Available Resources</th>");
-        pw.println("</tr>");
-        pw.println("<tr class='content'>");
-        pw.println("<th class='content'>Deploy</th>");
-        pw.println("<th class='content'>Name</th>");
-        pw.println("<th class='content'>Version</th>");
-        pw.println("</tr>");
+        pw.println( "<table class='content' cellpadding='0' cellspacing='0' width='100%'>" );
+        pw.println( "<tr class='content'>" );
+        pw.println( "<th class='content container' colspan='3'>Available Resources</th>" );
+        pw.println( "</tr>" );
+        pw.println( "<tr class='content'>" );
+        pw.println( "<th class='content'>Deploy</th>" );
+        pw.println( "<th class='content'>Name</th>" );
+        pw.println( "<th class='content'>Version</th>" );
+        pw.println( "</tr>" );
     }
-/*
-    private void listResources(PrintWriter pw) {
-        InstallerService is = getInstallerService();
-        if (is == null) {
-            return;
-        }
 
-        Map<String, Version> bundles = this.getBundles();
 
-        Iterator<?> resources = is.getBundleRepositoryAdmin().getResources();
-        SortedSet<Resource> resSet = new TreeSet<Resource>(
-            new Comparator<Resource>() {
-                public int compare(Resource o1, Resource o2) {
-                    if (o1 == o2 || o1.equals(o2)) {
-                        return 0;
-                    }
+    /*
+        private void listResources(PrintWriter pw) {
+            InstallerService is = getInstallerService();
+            if (is == null) {
+                return;
+            }
+
+            Map<String, Version> bundles = this.getBundles();
+
+            Iterator<?> resources = is.getBundleRepositoryAdmin().getResources();
+            SortedSet<Resource> resSet = new TreeSet<Resource>(
+                new Comparator<Resource>() {
+                    public int compare(Resource o1, Resource o2) {
+                        if (o1 == o2 || o1.equals(o2)) {
+                            return 0;
+                        }
+
+                        if (o1.getPresentationName().equals(
+                            o2.getPresentationName())) {
+                            return o1.getVersion().compareTo(o2.getVersion());
+                        }
 
-                    if (o1.getPresentationName().equals(
-                        o2.getPresentationName())) {
-                        return o1.getVersion().compareTo(o2.getVersion());
+                        return o1.getPresentationName().compareTo(
+                            o2.getPresentationName());
                     }
+                });
 
-                    return o1.getPresentationName().compareTo(
-                        o2.getPresentationName());
+            while (resources.hasNext()) {
+                Resource res = (Resource) resources.next();
+                Version ver = bundles.get(res.getSymbolicName());
+                if (ver == null || ver.compareTo(res.getVersion()) < 0) {
+                    resSet.add(res);
                 }
-            });
-
-        while (resources.hasNext()) {
-            Resource res = (Resource) resources.next();
-            Version ver = bundles.get(res.getSymbolicName());
-            if (ver == null || ver.compareTo(res.getVersion()) < 0) {
-                resSet.add(res);
             }
-        }
 
-        this.resourcesHeader(pw, !resSet.isEmpty());
+            this.resourcesHeader(pw, !resSet.isEmpty());
+
+            for (Resource resource : resSet) {
+                this.printResource(pw, resource);
+            }
 
-        for (Resource resource : resSet) {
-            this.printResource(pw, resource);
+            this.resourcesFooter(pw, !resSet.isEmpty());
         }
 
-        this.resourcesFooter(pw, !resSet.isEmpty());
-    }
+        private void printResource(PrintWriter pw, Resource res) {
+            pw.println("<tr class='content'>");
+            pw.println("<td class='content' valign='top' align='center'><input class='checkradio' type='checkbox' name='bundle' value='"
+                + res.getSymbolicName() + "," + res.getVersion() + "'></td>");
 
-    private void printResource(PrintWriter pw, Resource res) {
-        pw.println("<tr class='content'>");
-        pw.println("<td class='content' valign='top' align='center'><input class='checkradio' type='checkbox' name='bundle' value='"
-            + res.getSymbolicName() + "," + res.getVersion() + "'></td>");
-
-        // check whether the resource is an assembly (category name)
-        String style = "";
-        String[] cat = res.getCategories();
-        for (int i = 0; cat != null && i < cat.length; i++) {
-            if ("assembly".equals(cat[i])) {
-                style = "style='font-weight:bold'";
+            // check whether the resource is an assembly (category name)
+            String style = "";
+            String[] cat = res.getCategories();
+            for (int i = 0; cat != null && i < cat.length; i++) {
+                if ("assembly".equals(cat[i])) {
+                    style = "style='font-weight:bold'";
+                }
             }
-        }
-        pw.println("<td class='content' " + style + ">"
-            + res.getPresentationName() + " (" + res.getSymbolicName()
-            + ")</td>");
-        pw.println("<td class='content' " + style + " valign='top'>"
-            + res.getVersion() + "</td>");
+            pw.println("<td class='content' " + style + ">"
+                + res.getPresentationName() + " (" + res.getSymbolicName()
+                + ")</td>");
+            pw.println("<td class='content' " + style + " valign='top'>"
+                + res.getVersion() + "</td>");
 
-        pw.println("</tr>");
-    }
-*/
-    private void resourcesButtons(PrintWriter pw) {
-        pw.println("<tr class='content'>");
-        pw.println("<td class='content'>&nbsp;</td>");
-        pw.println("<td class='content' colspan='2'>");
-        pw.println("<input class='submit' style='width:auto' type='submit' name='deploy' value='Deploy Selected'>");
-        pw.println("&nbsp;&nbsp;&nbsp;");
-        pw.println("<input class='submit' style='width:auto' type='submit' name='deploystart' value='Deploy and Start Selected'>");
-        pw.println("</td></tr>");
+            pw.println("</tr>");
+        }
+    */
+    private void resourcesButtons( PrintWriter pw )
+    {
+        pw.println( "<tr class='content'>" );
+        pw.println( "<td class='content'>&nbsp;</td>" );
+        pw.println( "<td class='content' colspan='2'>" );
+        pw.println( "<input class='submit' style='width:auto' type='submit' name='deploy' value='Deploy Selected'>" );
+        pw.println( "&nbsp;&nbsp;&nbsp;" );
+        pw
+            .println( "<input class='submit' style='width:auto' type='submit' name='deploystart' value='Deploy and Start Selected'>" );
+        pw.println( "</td></tr>" );
     }
 
-    private void resourcesFooter(PrintWriter pw, boolean doForm) {
-        if (doForm) {
-            this.resourcesButtons(pw);
+
+    private void resourcesFooter( PrintWriter pw, boolean doForm )
+    {
+        if ( doForm )
+        {
+            this.resourcesButtons( pw );
         }
-        pw.println("</table></form>");
+        pw.println( "</table></form>" );
     }
 
-    private Map getBundles() {
+
+    private Map getBundles()
+    {
         Map bundles = new HashMap();
 
         Bundle[] installed = getBundleContext().getBundles();
-        for (int i = 0; i < installed.length; i++) {
-            String ver = (String) installed[i].getHeaders().get(
-                Constants.BUNDLE_VERSION);
-            Version bundleVersion = Version.parseVersion(ver);
+        for ( int i = 0; i < installed.length; i++ )
+        {
+            String ver = ( String ) installed[i].getHeaders().get( Constants.BUNDLE_VERSION );
+            Version bundleVersion = Version.parseVersion( ver );
 
             // assume one bundle instance per symbolic name !!
             // only add if there is a symbolic name !
-            if (installed[i].getSymbolicName() != null) {
-                bundles.put(installed[i].getSymbolicName(), bundleVersion);
+            if ( installed[i].getSymbolicName() != null )
+            {
+                bundles.put( installed[i].getSymbolicName(), bundleVersion );
             }
         }
 

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/InstallFromRepoAction.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/InstallFromRepoAction.java?rev=657742&r1=657741&r2=657742&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/InstallFromRepoAction.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/InstallFromRepoAction.java Mon May 19 00:36:38 2008
@@ -16,17 +16,24 @@
  */
 package org.apache.felix.webconsole.internal.obr;
 
+
 import org.apache.felix.webconsole.Action;
 
-public abstract class InstallFromRepoAction extends AbstractObrPlugin implements Action {
+
+public abstract class InstallFromRepoAction extends AbstractObrPlugin implements Action
+{
 
     public static final String NAME = "installFromOBR";
 
-    public String getName() {
+
+    public String getName()
+    {
         return NAME;
     }
 
-    public String getLabel() {
+
+    public String getLabel()
+    {
         return NAME;
     }
 



Mime
View raw message