felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r657742 [4/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/obr/RefreshRepoAction.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/RefreshRepoAction.java?rev=657742&r1=657741&r2=657742&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/RefreshRepoAction.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/RefreshRepoAction.java Mon May 19 00:36:38 2008
@@ -16,72 +16,79 @@
  */
 package org.apache.felix.webconsole.internal.obr;
 
+
 import org.apache.felix.webconsole.Action;
 
-public abstract class RefreshRepoAction extends AbstractObrPlugin implements Action {
+
+public abstract class RefreshRepoAction extends AbstractObrPlugin implements Action
+{
 
     public static final String NAME = "refreshOBR";
 
     public static final String PARAM_REPO = "repository";
 
-    public String getName() {
+
+    public String getName()
+    {
         return NAME;
     }
 
-    public String getLabel() {
+
+    public String getLabel()
+    {
         return NAME;
     }
-/*
-    public boolean performAction(HttpServletRequest request,
-            HttpServletResponse response) {
-
-        BundleRepositoryAdmin repoAdmin = getBundleRepositoryAdmin();
-        if (repoAdmin != null) {
-            String repositoryURL = request.getParameter("repository");
-            Iterator<Repository> repos = repoAdmin.getRepositories();
-            Repository repo = this.getRepository(repos, repositoryURL);
-
-            URL repoURL = null;
-            if (repo != null) {
-                repoURL = repo.getURL();
-            } else {
-                try {
-                    repoURL = new URL(repositoryURL);
-                } catch (Throwable t) {
-                    // don't care, just ignore
+    /*
+        public boolean performAction(HttpServletRequest request,
+                HttpServletResponse response) {
+
+            BundleRepositoryAdmin repoAdmin = getBundleRepositoryAdmin();
+            if (repoAdmin != null) {
+                String repositoryURL = request.getParameter("repository");
+                Iterator<Repository> repos = repoAdmin.getRepositories();
+                Repository repo = this.getRepository(repos, repositoryURL);
+
+                URL repoURL = null;
+                if (repo != null) {
+                    repoURL = repo.getURL();
+                } else {
+                    try {
+                        repoURL = new URL(repositoryURL);
+                    } catch (Throwable t) {
+                        // don't care, just ignore
+                    }
                 }
-            }
 
-            // log.log(LogService.LOG_DEBUG, "Refreshing " + repo.getURL());
-            if (repoURL != null) {
-                try {
-                    repoAdmin.addRepository(repoURL);
-                } catch (Exception e) {
-                    // TODO: log.log(LogService.LOG_ERROR, "Cannot refresh
-                    // Repository " + repo.getURL());
+                // log.log(LogService.LOG_DEBUG, "Refreshing " + repo.getURL());
+                if (repoURL != null) {
+                    try {
+                        repoAdmin.addRepository(repoURL);
+                    } catch (Exception e) {
+                        // TODO: log.log(LogService.LOG_ERROR, "Cannot refresh
+                        // Repository " + repo.getURL());
+                    }
                 }
             }
-        }
 
-        return true;
-    }
+            return true;
+        }
 
-    // ---------- internal -----------------------------------------------------
+        // ---------- internal -----------------------------------------------------
 
-    private Repository getRepository(Iterator<Repository> repos,
-            String repositoryUrl) {
-        if (repositoryUrl == null || repositoryUrl.length() == 0) {
-            return null;
-        }
+        private Repository getRepository(Iterator<Repository> repos,
+                String repositoryUrl) {
+            if (repositoryUrl == null || repositoryUrl.length() == 0) {
+                return null;
+            }
 
-        while (repos.hasNext()) {
-            Repository repo = repos.next();
-            if (repositoryUrl.equals(repo.getURL().toString())) {
-                return repo;
+            while (repos.hasNext()) {
+                Repository repo = repos.next();
+                if (repositoryUrl.equals(repo.getURL().toString())) {
+                    return repo;
+                }
             }
-        }
 
-        return null;
-    }
-*/
+            return null;
+        }
+    */
 }

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationListener.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationListener.java?rev=657742&r1=657741&r2=657742&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationListener.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationListener.java Mon May 19 00:36:38 2008
@@ -18,6 +18,7 @@
  */
 package org.apache.felix.webconsole.internal.servlet;
 
+
 import java.util.Dictionary;
 import java.util.Hashtable;
 
@@ -25,28 +26,34 @@
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.cm.ManagedService;
 
-class ConfigurationListener implements ManagedService {
+
+class ConfigurationListener implements ManagedService
+{
 
     private final OsgiManager osgiManager;
 
-    static ServiceRegistration create(OsgiManager osgiManager) {
-        ConfigurationListener cl = new ConfigurationListener(osgiManager);
+
+    static ServiceRegistration create( OsgiManager osgiManager )
+    {
+        ConfigurationListener cl = new ConfigurationListener( osgiManager );
 
         Dictionary props = new Hashtable();
-        props.put(Constants.SERVICE_VENDOR, "The Apache Software Foundation");
-        props.put(Constants.SERVICE_DESCRIPTION,
-            "OSGi Management Console Configuration Receiver");
-        props.put(Constants.SERVICE_PID, osgiManager.getClass().getName());
+        props.put( Constants.SERVICE_VENDOR, "The Apache Software Foundation" );
+        props.put( Constants.SERVICE_DESCRIPTION, "OSGi Management Console Configuration Receiver" );
+        props.put( Constants.SERVICE_PID, osgiManager.getClass().getName() );
 
-        return osgiManager.getBundleContext().registerService(
-            ManagedService.class.getName(), cl, props);
+        return osgiManager.getBundleContext().registerService( ManagedService.class.getName(), cl, props );
     }
 
-    private ConfigurationListener(OsgiManager osgiManager) {
+
+    private ConfigurationListener( OsgiManager osgiManager )
+    {
         this.osgiManager = osgiManager;
     }
 
-    public void updated(Dictionary config) {
-        osgiManager.updateConfiguration(config);
+
+    public void updated( Dictionary config )
+    {
+        osgiManager.updateConfiguration( config );
     }
 }
\ No newline at end of file

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/Logger.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/Logger.java?rev=657742&r1=657741&r2=657742&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/Logger.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/Logger.java Mon May 19 00:36:38 2008
@@ -18,37 +18,52 @@
  */
 package org.apache.felix.webconsole.internal.servlet;
 
+
 import org.osgi.framework.BundleContext;
 import org.osgi.service.log.LogService;
 import org.osgi.util.tracker.ServiceTracker;
 
-public class Logger {
+
+public class Logger
+{
 
     private ServiceTracker logTracker;
 
-    Logger(BundleContext bundleContext) {
-        logTracker = new ServiceTracker(bundleContext,
-            LogService.class.getName(), null);
+
+    Logger( BundleContext bundleContext )
+    {
+        logTracker = new ServiceTracker( bundleContext, LogService.class.getName(), null );
         logTracker.open();
     }
 
-    void dispose() {
-        if (logTracker != null) {
+
+    void dispose()
+    {
+        if ( logTracker != null )
+        {
             logTracker.close();
         }
     }
 
-    public void log(int logLevel, String message) {
-        log(logLevel, message, null);
+
+    public void log( int logLevel, String message )
+    {
+        log( logLevel, message, null );
     }
 
-    public void log(int logLevel, String message, Throwable t) {
+
+    public void log( int logLevel, String message, Throwable t )
+    {
         Object log = logTracker.getService();
-        if (log != null) {
-            ((LogService) log).log(logLevel, message, t);
-        } else {
+        if ( log != null )
+        {
+            ( ( LogService ) log ).log( logLevel, message, t );
+        }
+        else
+        {
             String level;
-            switch (logLevel) {
+            switch ( logLevel )
+            {
                 case LogService.LOG_DEBUG:
                     level = "*DEBUG*";
                     break;
@@ -66,13 +81,15 @@
                     break;
             }
 
-            if (message == null && t != null) {
+            if ( message == null && t != null )
+            {
                 message = t.getMessage();
             }
 
-            System.out.println(level + " " + message);
-            if (t != null) {
-                t.printStackTrace(System.out);
+            System.out.println( level + " " + message );
+            if ( t != null )
+            {
+                t.printStackTrace( System.out );
             }
         }
     }

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=657742&r1=657741&r2=657742&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 Mon May 19 00:36:38 2008
@@ -16,6 +16,7 @@
  */
 package org.apache.felix.webconsole.internal.servlet;
 
+
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.util.Dictionary;
@@ -70,13 +71,15 @@
 import org.osgi.service.log.LogService;
 import org.osgi.util.tracker.ServiceTracker;
 
+
 /**
  * The <code>OSGi Manager</code> TODO
  *
  * @scr.component ds="no" label="%manager.name"
  *                description="%manager.description"
  */
-public class OsgiManager extends GenericServlet {
+public class OsgiManager extends GenericServlet
+{
 
     /** Pseudo class version ID to keep the IDE quite. */
     private static final long serialVersionUID = 1L;
@@ -119,15 +122,12 @@
      */
     private static final String DEFAULT_MANAGER_ROOT = "/system/console";
 
-    private static final Class[] PLUGIN_CLASSES = {
-        AjaxConfigManagerAction.class, ComponentConfigurationPrinter.class,
-        ComponentRenderAction.class, ConfigManager.class,
-        AjaxBundleDetailsAction.class, BundleListRender.class,
-        InstallAction.class, RefreshPackagesAction.class,
-        SetStartLevelAction.class, StartAction.class, StopAction.class,
-        UninstallAction.class, UpdateAction.class,
-        ConfigurationRender.class, GCAction.class,
-        ShutdownAction.class, ShutdownRender.class, VMStatRender.class };
+    private static final Class[] PLUGIN_CLASSES =
+        { AjaxConfigManagerAction.class, ComponentConfigurationPrinter.class, ComponentRenderAction.class,
+            ConfigManager.class, AjaxBundleDetailsAction.class, BundleListRender.class, InstallAction.class,
+            RefreshPackagesAction.class, SetStartLevelAction.class, StartAction.class, StopAction.class,
+            UninstallAction.class, UpdateAction.class, ConfigurationRender.class, GCAction.class, ShutdownAction.class,
+            ShutdownRender.class, VMStatRender.class };
 
     private BundleContext bundleContext;
 
@@ -155,65 +155,83 @@
 
     private Dictionary configuration;
 
-    public OsgiManager(BundleContext bundleContext) {
+
+    public OsgiManager( BundleContext bundleContext )
+    {
 
         this.bundleContext = bundleContext;
-        this.log = new Logger(bundleContext);
+        this.log = new Logger( bundleContext );
 
-        updateConfiguration(null);
+        updateConfiguration( null );
 
-        try {
-            this.configurationListener = ConfigurationListener.create(this);
-        } catch (Throwable t) {
+        try
+        {
+            this.configurationListener = ConfigurationListener.create( this );
+        }
+        catch ( Throwable t )
+        {
             // might be caused by CM not available
         }
 
         // track renders and operations
-        operationsTracker = new OperationServiceTracker(this);
+        operationsTracker = new OperationServiceTracker( this );
         operationsTracker.open();
-        rendersTracker = new RenderServiceTracker(this);
+        rendersTracker = new RenderServiceTracker( this );
         rendersTracker.open();
-        httpServiceTracker = new HttpServiceTracker(this);
+        httpServiceTracker = new HttpServiceTracker( this );
         httpServiceTracker.open();
 
-        for (int i=0; i < PLUGIN_CLASSES.length; i++) {
+        for ( int i = 0; i < PLUGIN_CLASSES.length; i++ )
+        {
             Class pluginClass = PLUGIN_CLASSES[i];
-            try {
+            try
+            {
                 Object plugin = pluginClass.newInstance();
-                if (plugin instanceof BaseManagementPlugin) {
-                    ((BaseManagementPlugin) plugin).setBundleContext(bundleContext);
-                    ((BaseManagementPlugin) plugin).setLogger(log);
+                if ( plugin instanceof BaseManagementPlugin )
+                {
+                    ( ( BaseManagementPlugin ) plugin ).setBundleContext( bundleContext );
+                    ( ( BaseManagementPlugin ) plugin ).setLogger( log );
                 }
-                if (plugin instanceof Action) {
-                    bindOperation((Action) plugin);
+                if ( plugin instanceof Action )
+                {
+                    bindOperation( ( Action ) plugin );
                 }
-                if (plugin instanceof Render) {
-                    bindRender((Render) plugin);
+                if ( plugin instanceof Render )
+                {
+                    bindRender( ( Render ) plugin );
                 }
-            } catch (Throwable t) {
+            }
+            catch ( Throwable t )
+            {
                 // todo: log
             }
         }
     }
 
-    public void dispose() {
 
-        if (configurationListener != null) {
+    public void dispose()
+    {
+
+        if ( configurationListener != null )
+        {
             configurationListener.unregister();
             configurationListener = null;
         }
 
-        if (operationsTracker != null) {
+        if ( operationsTracker != null )
+        {
             operationsTracker.close();
             operationsTracker = null;
         }
 
-        if (rendersTracker != null) {
+        if ( rendersTracker != null )
+        {
             rendersTracker.close();
             rendersTracker = null;
         }
 
-        if (httpServiceTracker != null) {
+        if ( httpServiceTracker != null )
+        {
             httpServiceTracker.close();
             httpServiceTracker = null;
         }
@@ -223,35 +241,39 @@
         this.operations.clear();
         this.renders.clear();
 
-        if (log != null) {
+        if ( log != null )
+        {
             log.dispose();
         }
 
         this.bundleContext = null;
     }
 
-    public void service(ServletRequest req, ServletResponse res)
-            throws ServletException, IOException {
 
-        HttpServletRequest request = (HttpServletRequest) req;
-        HttpServletResponse response = (HttpServletResponse) res;
+    public void service( ServletRequest req, ServletResponse res ) throws ServletException, IOException
+    {
+
+        HttpServletRequest request = ( HttpServletRequest ) req;
+        HttpServletResponse response = ( HttpServletResponse ) res;
 
         // handle the request action, terminate if done
-        if (this.handleAction(request, response)) {
+        if ( this.handleAction( request, response ) )
+        {
             return;
         }
 
         // check whether we are not at .../{webManagerRoot}
-        if (request.getRequestURI().endsWith(this.webManagerRoot)) {
-            response.sendRedirect(request.getRequestURI() + "/"
-                + this.defaultRender.getName());
+        if ( request.getRequestURI().endsWith( this.webManagerRoot ) )
+        {
+            response.sendRedirect( request.getRequestURI() + "/" + this.defaultRender.getName() );
             return;
         }
 
         // otherwise we render the response
-        Render render = this.getRender(request);
-        if (render == null) {
-            response.sendError(HttpServletResponse.SC_NOT_FOUND);
+        Render render = this.getRender( request );
+        if ( render == null )
+        {
+            response.sendError( HttpServletResponse.SC_NOT_FOUND );
             return;
         }
 
@@ -260,47 +282,56 @@
         // account:
         // Boolean.valueOf(request.getParameter("disabled")).booleanValue();
 
-        PrintWriter pw = Util.startHtml(response, render.getLabel());
-        Util.navigation(pw, this.renders.values(), current, disabled);
+        PrintWriter pw = Util.startHtml( response, render.getLabel() );
+        Util.navigation( pw, this.renders.values(), current, disabled );
 
-        render.render(request, response);
+        render.render( request, response );
 
-        Util.endHhtml(pw);
+        Util.endHhtml( pw );
     }
 
-    protected boolean handleAction(HttpServletRequest req,
-            HttpServletResponse resp) throws IOException {
+
+    protected boolean handleAction( HttpServletRequest req, HttpServletResponse resp ) throws IOException
+    {
         // check action
-        String actionName = this.getParameter(req, Util.PARAM_ACTION);
-        if (actionName != null) {
-            Action action = (Action) this.operations.get(actionName);
-            if (action != null) {
+        String actionName = this.getParameter( req, Util.PARAM_ACTION );
+        if ( actionName != null )
+        {
+            Action action = ( Action ) this.operations.get( actionName );
+            if ( action != null )
+            {
                 boolean redirect = true;
-                try {
-                    redirect = action.performAction(req, resp);
-                } catch (IOException ioe) {
-                    this.log(ioe.getMessage(), ioe);
-                } catch (ServletException se) {
-                    this.log(se.getMessage(), se.getRootCause());
+                try
+                {
+                    redirect = action.performAction( req, resp );
+                }
+                catch ( IOException ioe )
+                {
+                    this.log( ioe.getMessage(), ioe );
+                }
+                catch ( ServletException se )
+                {
+                    this.log( se.getMessage(), se.getRootCause() );
                 }
 
                 // maybe overwrite redirect
-                if (PARAM_NO_REDIRECT_AFTER_ACTION.equals(getParameter(req,
-                    PARAM_NO_REDIRECT_AFTER_ACTION))) {
-                    resp.setStatus(HttpServletResponse.SC_OK);
-                    resp.setContentType("text/html");
-                    resp.getWriter().println("Ok");
+                if ( PARAM_NO_REDIRECT_AFTER_ACTION.equals( getParameter( req, PARAM_NO_REDIRECT_AFTER_ACTION ) ) )
+                {
+                    resp.setStatus( HttpServletResponse.SC_OK );
+                    resp.setContentType( "text/html" );
+                    resp.getWriter().println( "Ok" );
                     return true;
                 }
 
-                if (redirect) {
+                if ( redirect )
+                {
                     String uri = req.getRequestURI();
                     // Object pars =
                     // req.getAttribute(Action.ATTR_REDIRECT_PARAMETERS);
                     // if (pars instanceof String) {
                     // uri += "?" + pars;
                     // }
-                    resp.sendRedirect(uri);
+                    resp.sendRedirect( uri );
                 }
                 return true;
             }
@@ -309,72 +340,89 @@
         return false;
     }
 
-    protected Render getRender(HttpServletRequest request) {
+
+    protected Render getRender( HttpServletRequest request )
+    {
 
         String page = request.getRequestURI();
 
         // remove trailing slashes
-        while (page.endsWith("/")) {
-            page = page.substring(0, page.length() - 1);
+        while ( page.endsWith( "/" ) )
+        {
+            page = page.substring( 0, page.length() - 1 );
         }
 
         // take last part of the name
-        int lastSlash = page.lastIndexOf('/');
-        if (lastSlash >= 0) {
-            page = page.substring(lastSlash + 1);
+        int lastSlash = page.lastIndexOf( '/' );
+        if ( lastSlash >= 0 )
+        {
+            page = page.substring( lastSlash + 1 );
         }
 
-        Render render = (Render) this.renders.get(page);
-        return (render == null) ? this.defaultRender : render;
+        Render render = ( Render ) this.renders.get( page );
+        return ( render == null ) ? this.defaultRender : render;
     }
 
-    private String getParameter(HttpServletRequest request, String name) {
+
+    private String getParameter( HttpServletRequest request, String name )
+    {
         // just get the parameter if not a multipart/form-data POST
-        if (!ServletFileUpload.isMultipartContent(new ServletRequestContext(
-            request))) {
-            return request.getParameter(name);
+        if ( !ServletFileUpload.isMultipartContent( new ServletRequestContext( request ) ) )
+        {
+            return request.getParameter( name );
         }
 
         // check, whether we alread have the parameters
-        Map params = (Map) request.getAttribute(Util.ATTR_FILEUPLOAD);
-        if (params == null) {
+        Map params = ( Map ) request.getAttribute( Util.ATTR_FILEUPLOAD );
+        if ( params == null )
+        {
             // parameters not read yet, read now
             // Create a factory for disk-based file items
             DiskFileItemFactory factory = new DiskFileItemFactory();
-            factory.setSizeThreshold(256000);
+            factory.setSizeThreshold( 256000 );
 
             // Create a new file upload handler
-            ServletFileUpload upload = new ServletFileUpload(factory);
-            upload.setSizeMax(-1);
+            ServletFileUpload upload = new ServletFileUpload( factory );
+            upload.setSizeMax( -1 );
 
             // Parse the request
             params = new HashMap();
-            try {
-                List items = upload.parseRequest(request);
-                for (Iterator fiter=items.iterator(); fiter.hasNext(); ) {
-                    FileItem fi = (FileItem) fiter.next();
-                    FileItem[] current = (FileItem[]) params.get(fi.getFieldName());
-                    if (current == null) {
-                        current = new FileItem[] { fi };
-                    } else {
+            try
+            {
+                List items = upload.parseRequest( request );
+                for ( Iterator fiter = items.iterator(); fiter.hasNext(); )
+                {
+                    FileItem fi = ( FileItem ) fiter.next();
+                    FileItem[] current = ( FileItem[] ) params.get( fi.getFieldName() );
+                    if ( current == null )
+                    {
+                        current = new FileItem[]
+                            { fi };
+                    }
+                    else
+                    {
                         FileItem[] newCurrent = new FileItem[current.length + 1];
-                        System.arraycopy(current, 0, newCurrent, 0,
-                            current.length);
+                        System.arraycopy( current, 0, newCurrent, 0, current.length );
                         newCurrent[current.length] = fi;
                         current = newCurrent;
                     }
-                    params.put(fi.getFieldName(), current);
+                    params.put( fi.getFieldName(), current );
                 }
-            } catch (FileUploadException fue) {
+            }
+            catch ( FileUploadException fue )
+            {
                 // TODO: log
             }
-            request.setAttribute(Util.ATTR_FILEUPLOAD, params);
+            request.setAttribute( Util.ATTR_FILEUPLOAD, params );
         }
 
-        FileItem[] param = (FileItem[]) params.get(name);
-        if (param != null) {
-            for (int i = 0; i < param.length; i++) {
-                if (param[i].isFormField()) {
+        FileItem[] param = ( FileItem[] ) params.get( name );
+        if ( param != null )
+        {
+            for ( int i = 0; i < param.length; i++ )
+            {
+                if ( param[i].isFormField() )
+                {
                     return param[i].getString();
                 }
             }
@@ -384,188 +432,245 @@
         return null;
     }
 
-    BundleContext getBundleContext() {
+
+    BundleContext getBundleContext()
+    {
         return bundleContext;
     }
 
-    private static class HttpServiceTracker extends ServiceTracker {
+    private static class HttpServiceTracker extends ServiceTracker
+    {
 
         private final OsgiManager osgiManager;
 
-        HttpServiceTracker(OsgiManager osgiManager) {
-            super(osgiManager.getBundleContext(), HttpService.class.getName(),
-                null);
+
+        HttpServiceTracker( OsgiManager osgiManager )
+        {
+            super( osgiManager.getBundleContext(), HttpService.class.getName(), null );
             this.osgiManager = osgiManager;
         }
 
-        public Object addingService(ServiceReference reference) {
-            Object operation = super.addingService(reference);
-            if (operation instanceof HttpService) {
-                osgiManager.bindHttpService((HttpService) operation);
+
+        public Object addingService( ServiceReference reference )
+        {
+            Object operation = super.addingService( reference );
+            if ( operation instanceof HttpService )
+            {
+                osgiManager.bindHttpService( ( HttpService ) operation );
             }
             return operation;
         }
 
-        public void removedService(ServiceReference reference, Object service) {
-            if (service instanceof HttpService) {
-                osgiManager.unbindHttpService((HttpService) service);
+
+        public void removedService( ServiceReference reference, Object service )
+        {
+            if ( service instanceof HttpService )
+            {
+                osgiManager.unbindHttpService( ( HttpService ) service );
             }
 
-            super.removedService(reference, service);
+            super.removedService( reference, service );
         }
     }
 
-    private static class OperationServiceTracker extends ServiceTracker {
+    private static class OperationServiceTracker extends ServiceTracker
+    {
 
         private final OsgiManager osgiManager;
 
-        OperationServiceTracker(OsgiManager osgiManager) {
-            super(osgiManager.getBundleContext(), Action.SERVICE, null);
+
+        OperationServiceTracker( OsgiManager osgiManager )
+        {
+            super( osgiManager.getBundleContext(), Action.SERVICE, null );
             this.osgiManager = osgiManager;
         }
 
-        public Object addingService(ServiceReference reference) {
-            Object operation = super.addingService(reference);
-            if (operation instanceof Action) {
-                osgiManager.bindOperation((Action) operation);
+
+        public Object addingService( ServiceReference reference )
+        {
+            Object operation = super.addingService( reference );
+            if ( operation instanceof Action )
+            {
+                osgiManager.bindOperation( ( Action ) operation );
             }
             return operation;
         }
 
-        public void removedService(ServiceReference reference, Object service) {
-            if (service instanceof Action) {
-                osgiManager.bindOperation((Action) service);
+
+        public void removedService( ServiceReference reference, Object service )
+        {
+            if ( service instanceof Action )
+            {
+                osgiManager.bindOperation( ( Action ) service );
             }
 
-            super.removedService(reference, service);
+            super.removedService( reference, service );
         }
     }
 
-    private static class RenderServiceTracker extends ServiceTracker {
+    private static class RenderServiceTracker extends ServiceTracker
+    {
 
         private final OsgiManager osgiManager;
 
-        RenderServiceTracker(OsgiManager osgiManager) {
-            super(osgiManager.getBundleContext(), Render.SERVICE, null);
+
+        RenderServiceTracker( OsgiManager osgiManager )
+        {
+            super( osgiManager.getBundleContext(), Render.SERVICE, null );
             this.osgiManager = osgiManager;
         }
 
-        public Object addingService(ServiceReference reference) {
-            Object operation = super.addingService(reference);
-            if (operation instanceof Render) {
-                osgiManager.bindRender((Render) operation);
+
+        public Object addingService( ServiceReference reference )
+        {
+            Object operation = super.addingService( reference );
+            if ( operation instanceof Render )
+            {
+                osgiManager.bindRender( ( Render ) operation );
             }
             return operation;
         }
 
-        public void removedService(ServiceReference reference, Object service) {
-            if (service instanceof Render) {
-                osgiManager.bindRender((Render) service);
+
+        public void removedService( ServiceReference reference, Object service )
+        {
+            if ( service instanceof Render )
+            {
+                osgiManager.bindRender( ( Render ) service );
             }
 
-            super.removedService(reference, service);
+            super.removedService( reference, service );
         }
     }
 
-    protected synchronized void bindHttpService(HttpService httpService) {
+
+    protected synchronized void bindHttpService( HttpService httpService )
+    {
         Dictionary config = getConfiguration();
 
         // get authentication details
-        String realm = this.getProperty(config, PROP_REALM,
-            "OSGi Management Console");
-        String userId = this.getProperty(config, PROP_USER_NAME, null);
-        String password = this.getProperty(config, PROP_PASSWORD, null);
+        String realm = this.getProperty( config, PROP_REALM, "OSGi Management Console" );
+        String userId = this.getProperty( config, PROP_USER_NAME, null );
+        String password = this.getProperty( config, PROP_PASSWORD, null );
 
         // register the servlet and resources
-        try {
-            HttpContext httpContext = new OsgiManagerHttpContext(httpService, realm,
-                userId, password);
-
-            Dictionary servletConfig = toStringConfig(config);
-
-            httpService.registerServlet(this.webManagerRoot, this,
-                servletConfig, httpContext);
-            httpService.registerResources(this.webManagerRoot + "/res", "/res",
-                httpContext);
+        try
+        {
+            HttpContext httpContext = new OsgiManagerHttpContext( httpService, realm, userId, password );
+
+            Dictionary servletConfig = toStringConfig( config );
+
+            httpService.registerServlet( this.webManagerRoot, this, servletConfig, httpContext );
+            httpService.registerResources( this.webManagerRoot + "/res", "/res", httpContext );
 
-        } catch (Exception e) {
-            log.log(LogService.LOG_ERROR, "Problem setting up", e);
+        }
+        catch ( Exception e )
+        {
+            log.log( LogService.LOG_ERROR, "Problem setting up", e );
         }
 
         this.httpService = httpService;
     }
 
-    protected synchronized void unbindHttpService(HttpService httpService) {
-        httpService.unregister(this.webManagerRoot + "/res");
-        httpService.unregister(this.webManagerRoot);
 
-        if (this.httpService == httpService) {
+    protected synchronized void unbindHttpService( HttpService httpService )
+    {
+        httpService.unregister( this.webManagerRoot + "/res" );
+        httpService.unregister( this.webManagerRoot );
+
+        if ( this.httpService == httpService )
+        {
             this.httpService = null;
         }
     }
 
-    protected void bindOperation(Action operation) {
-        this.operations.put(operation.getName(), operation);
+
+    protected void bindOperation( Action operation )
+    {
+        this.operations.put( operation.getName(), operation );
     }
 
-    protected void unbindOperation(Action operation) {
-        this.operations.remove(operation.getName());
+
+    protected void unbindOperation( Action operation )
+    {
+        this.operations.remove( operation.getName() );
     }
 
-    protected void bindRender(Render render) {
-        this.renders.put(render.getName(), render);
 
-        if (this.defaultRender == null) {
+    protected void bindRender( Render render )
+    {
+        this.renders.put( render.getName(), render );
+
+        if ( this.defaultRender == null )
+        {
             this.defaultRender = render;
-        } else if (render.getName().equals(this.defaultRenderName)) {
+        }
+        else if ( render.getName().equals( this.defaultRenderName ) )
+        {
             this.defaultRender = render;
         }
     }
 
-    protected void unbindRender(Render render) {
-        this.renders.remove(render.getName());
 
-        if (this.defaultRender == render) {
-            if (this.renders.isEmpty()) {
+    protected void unbindRender( Render render )
+    {
+        this.renders.remove( render.getName() );
+
+        if ( this.defaultRender == render )
+        {
+            if ( this.renders.isEmpty() )
+            {
                 this.defaultRender = null;
-            } else {
-                this.defaultRender = (Render) renders.values().iterator().next();
+            }
+            else
+            {
+                this.defaultRender = ( Render ) renders.values().iterator().next();
             }
         }
     }
 
-    private Dictionary getConfiguration() {
+
+    private Dictionary getConfiguration()
+    {
         return configuration;
     }
 
-    void updateConfiguration(Dictionary config) {
-        if (config == null) {
+
+    void updateConfiguration( Dictionary config )
+    {
+        if ( config == null )
+        {
             config = new Hashtable();
         }
 
         configuration = config;
 
-        defaultRenderName = (String) config.get(PROP_DEFAULT_RENDER);
-        if (defaultRenderName != null && renders.get(defaultRenderName) != null) {
-            defaultRender = (Render) renders.get(defaultRenderName);
+        defaultRenderName = ( String ) config.get( PROP_DEFAULT_RENDER );
+        if ( defaultRenderName != null && renders.get( defaultRenderName ) != null )
+        {
+            defaultRender = ( Render ) renders.get( defaultRenderName );
         }
 
         // get the web manager root path
-        webManagerRoot = this.getProperty(config, PROP_MANAGER_ROOT, DEFAULT_MANAGER_ROOT);
-        if (!webManagerRoot.startsWith("/")) {
+        webManagerRoot = this.getProperty( config, PROP_MANAGER_ROOT, DEFAULT_MANAGER_ROOT );
+        if ( !webManagerRoot.startsWith( "/" ) )
+        {
             webManagerRoot = "/" + webManagerRoot;
         }
 
         // might update http service registration
         HttpService httpService = this.httpService;
-        if (httpService != null) {
-            synchronized (this) {
-                unbindHttpService(httpService);
-                bindHttpService(httpService);
+        if ( httpService != null )
+        {
+            synchronized ( this )
+            {
+                unbindHttpService( httpService );
+                bindHttpService( httpService );
             }
         }
     }
 
+
     /**
      * Returns the named property from the configuration. If the property does
      * not exist, the default value <code>def</code> is returned.
@@ -576,25 +681,30 @@
      * @return The value of the named property as a string or <code>def</code>
      *         if the property does not exist
      */
-    private String getProperty(Dictionary config, String name,
-            String def) {
-        Object value = config.get(name);
-        if (value instanceof String) {
-            return (String) value;
+    private String getProperty( Dictionary config, String name, String def )
+    {
+        Object value = config.get( name );
+        if ( value instanceof String )
+        {
+            return ( String ) value;
         }
 
-        if (value == null) {
+        if ( value == null )
+        {
             return def;
         }
 
-        return String.valueOf(value);
+        return String.valueOf( value );
     }
 
-    private Dictionary toStringConfig(Dictionary config) {
+
+    private Dictionary toStringConfig( Dictionary config )
+    {
         Dictionary stringConfig = new Hashtable();
-        for (Enumeration ke = config.keys(); ke.hasMoreElements();) {
+        for ( Enumeration ke = config.keys(); ke.hasMoreElements(); )
+        {
             Object key = ke.nextElement();
-            stringConfig.put(key.toString(), String.valueOf(config.get(key)));
+            stringConfig.put( key.toString(), String.valueOf( config.get( key ) ) );
         }
         return stringConfig;
     }

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManagerHttpContext.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManagerHttpContext.java?rev=657742&r1=657741&r2=657742&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManagerHttpContext.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManagerHttpContext.java Mon May 19 00:36:38 2008
@@ -16,6 +16,7 @@
  */
 package org.apache.felix.webconsole.internal.servlet;
 
+
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.net.URL;
@@ -26,7 +27,9 @@
 import org.osgi.service.http.HttpContext;
 import org.osgi.service.http.HttpService;
 
-final class OsgiManagerHttpContext implements HttpContext {
+
+final class OsgiManagerHttpContext implements HttpContext
+{
 
     private static final String HEADER_WWW_AUTHENTICATE = "WWW-Authenticate";
 
@@ -52,25 +55,33 @@
 
     private final HttpContext base;
 
-    OsgiManagerHttpContext(HttpService httpService, String realm, String userId, String password) {
+
+    OsgiManagerHttpContext( HttpService httpService, String realm, String userId, String password )
+    {
         this.base = httpService.createDefaultHttpContext();
         this.realm = realm;
         this.userId = userId;
-        this.user = encode(userId, password);
+        this.user = encode( userId, password );
     }
 
-    public String getMimeType(String name) {
-        return this.base.getMimeType(name);
+
+    public String getMimeType( String name )
+    {
+        return this.base.getMimeType( name );
     }
 
-    public URL getResource(String name) {
-        URL url = this.base.getResource(name);
-        if (url == null && name.endsWith("/")) {
-            return this.base.getResource(name.substring(0, name.length() - 1));
+
+    public URL getResource( String name )
+    {
+        URL url = this.base.getResource( name );
+        if ( url == null && name.endsWith( "/" ) )
+        {
+            return this.base.getResource( name.substring( 0, name.length() - 1 ) );
         }
         return url;
     }
 
+
     /**
      * Checks the <code>Authorization</code> header of the request for Basic
      * authentication user name and password. If contained, the credentials are
@@ -86,34 +97,37 @@
      * @return <code>true</code> if authentication is required and not
      *         satisfied by the request.
      */
-    public boolean handleSecurity(HttpServletRequest request,
-            HttpServletResponse response) {
+    public boolean handleSecurity( HttpServletRequest request, HttpServletResponse response )
+    {
 
         // don't care for authentication if no user name is configured
-        if (this.user == null) {
+        if ( this.user == null )
+        {
             return true;
         }
 
         // Return immediately if the header is missing
-        String authHeader = request.getHeader(HEADER_AUTHORIZATION);
-        if (authHeader != null && authHeader.length() > 0) {
+        String authHeader = request.getHeader( HEADER_AUTHORIZATION );
+        if ( authHeader != null && authHeader.length() > 0 )
+        {
 
             // Get the authType (Basic, Digest) and authInfo (user/password)
             // from
             // the header
             authHeader = authHeader.trim();
-            int blank = authHeader.indexOf(' ');
-            if (blank > 0) {
-                String authType = authHeader.substring(0, blank);
-                String authInfo = authHeader.substring(blank).trim();
+            int blank = authHeader.indexOf( ' ' );
+            if ( blank > 0 )
+            {
+                String authType = authHeader.substring( 0, blank );
+                String authInfo = authHeader.substring( blank ).trim();
 
                 // Check whether authorization type matches
-                if (authType.equalsIgnoreCase(AUTHENTICATION_SCHEME_BASIC)
-                    && this.user.equals(authInfo)) {
+                if ( authType.equalsIgnoreCase( AUTHENTICATION_SCHEME_BASIC ) && this.user.equals( authInfo ) )
+                {
 
                     // as per the spec, set attributes
-                    request.setAttribute(HttpContext.AUTHENTICATION_TYPE, "");
-                    request.setAttribute(HttpContext.REMOTE_USER, this.userId);
+                    request.setAttribute( HttpContext.AUTHENTICATION_TYPE, "" );
+                    request.setAttribute( HttpContext.REMOTE_USER, this.userId );
 
                     // succeed
                     return true;
@@ -122,13 +136,15 @@
         }
 
         // request authentication
-        response.setHeader(HEADER_WWW_AUTHENTICATE, AUTHENTICATION_SCHEME_BASIC
-            + " realm=\"" + this.realm + "\"");
-        try {
-            response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
-        } catch (IOException ioe) {
+        response.setHeader( HEADER_WWW_AUTHENTICATE, AUTHENTICATION_SCHEME_BASIC + " realm=\"" + this.realm + "\"" );
+        try
+        {
+            response.sendError( HttpServletResponse.SC_UNAUTHORIZED );
+        }
+        catch ( IOException ioe )
+        {
             // failed sending the error, fall back to setting the status
-            response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
+            response.setStatus( HttpServletResponse.SC_UNAUTHORIZED );
         }
 
         // inform HttpService that authentication failed
@@ -145,21 +161,27 @@
      * @return The Base64 encoded username/password pair or <code>null</code>
      *         if <code>user</code> is <code>null</code> or empty.
      */
-    public static String encode(String user, String password) {
+    public static String encode( String user, String password )
+    {
 
         /* check arguments */
-        if (user == null || user.length() == 0) return null;
+        if ( user == null || user.length() == 0 )
+            return null;
 
         String srcString = user + ":";
-        if (password != null && password.length() > 0) {
+        if ( password != null && password.length() > 0 )
+        {
             srcString += password;
         }
 
         // need bytes
         byte[] src;
-        try {
-            src = srcString.getBytes("ISO-8859-1");
-        } catch (UnsupportedEncodingException uee) {
+        try
+        {
+            src = srcString.getBytes( "ISO-8859-1" );
+        }
+        catch ( UnsupportedEncodingException uee )
+        {
             // we do not expect this, the API presribes ISO-8859-1 to be present
             // anyway, fallback to platform default
             src = srcString.getBytes();
@@ -168,7 +190,7 @@
         int srcsize = src.length;
         int tbllen = base64Table.length();
 
-        StringBuffer result = new StringBuffer(srcsize);
+        StringBuffer result = new StringBuffer( srcsize );
 
         /* encode */
         int tblpos = 0;
@@ -177,12 +199,17 @@
         int inpos = 0;
         int pos = 0;
 
-        while (inpos <= srcsize) {
+        while ( inpos <= srcsize )
+        {
 
-            if (bitsread < 0) {
-                if (inpos < srcsize) {
+            if ( bitsread < 0 )
+            {
+                if ( inpos < srcsize )
+                {
                     pos = src[inpos++];
-                } else {
+                }
+                else
+                {
                     // inpos++;
                     // pos = 0;
                     break;
@@ -192,34 +219,40 @@
 
             tblpos = 0;
             bitpos = tbllen / 2;
-            while (bitpos > 0) {
-                if (bitsread < 0) {
-                    pos = (inpos < srcsize) ? src[inpos] : '\0';
+            while ( bitpos > 0 )
+            {
+                if ( bitsread < 0 )
+                {
+                    pos = ( inpos < srcsize ) ? src[inpos] : '\0';
                     inpos++;
                     bitsread = 7;
                 }
 
                 /* test if bit at pos <bitpos> in <pos> is set.. */
-                if (((1 << bitsread) & pos) != 0) tblpos += bitpos;
+                if ( ( ( 1 << bitsread ) & pos ) != 0 )
+                    tblpos += bitpos;
 
                 bitpos /= 2;
                 bitsread--;
             }
 
             // got one
-            result.append(base64Table.charAt(tblpos));
+            result.append( base64Table.charAt( tblpos ) );
         }
 
         /* add the padding bytes */
-        while (bitsread != -1) {
+        while ( bitsread != -1 )
+        {
             bitpos = tbllen / 2;
-            while (bitpos > 0) {
-                if (bitsread < 0) bitsread = 7;
+            while ( bitpos > 0 )
+            {
+                if ( bitsread < 0 )
+                    bitsread = 7;
                 bitpos /= 2;
                 bitsread--;
             }
 
-            result.append(base64Pad);
+            result.append( base64Pad );
         }
 
         return result.toString();

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/system/GCAction.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/system/GCAction.java?rev=657742&r1=657741&r2=657742&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/system/GCAction.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/system/GCAction.java Mon May 19 00:36:38 2008
@@ -16,25 +16,34 @@
  */
 package org.apache.felix.webconsole.internal.system;
 
+
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.felix.webconsole.Action;
 
-public class GCAction implements Action {
+
+public class GCAction implements Action
+{
 
     public static final String NAME = "gc";
     public static final String LABEL = "Collect Garbage";
 
-    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 )
+    {
         System.gc();
         return false;
     }

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/system/ShutdownAction.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/system/ShutdownAction.java?rev=657742&r1=657741&r2=657742&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/system/ShutdownAction.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/system/ShutdownAction.java Mon May 19 00:36:38 2008
@@ -16,6 +16,7 @@
  */
 package org.apache.felix.webconsole.internal.system;
 
+
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
@@ -24,37 +25,51 @@
 import org.osgi.framework.BundleException;
 import org.osgi.service.log.LogService;
 
-public class ShutdownAction extends BaseManagementPlugin implements Action {
+
+public class ShutdownAction extends BaseManagementPlugin implements Action
+{
 
     public static final String NAME = "shutdown";
 
-    public String getName() {
+
+    public String getName()
+    {
         return NAME;
     }
 
-    public String getLabel() {
+
+    public String getLabel()
+    {
         return NAME;
     }
 
-    public boolean performAction(HttpServletRequest request,
-            HttpServletResponse response) {
+
+    public boolean performAction( HttpServletRequest request, HttpServletResponse response )
+    {
         // simply terminate VM in case of shutdown :-)
-        Thread t = new Thread("Stopper") {
-            public void run() {
-                try {
-                    Thread.sleep(2000L);
-                } catch (InterruptedException ie) {
+        Thread t = new Thread( "Stopper" )
+        {
+            public void run()
+            {
+                try
+                {
+                    Thread.sleep( 2000L );
+                }
+                catch ( InterruptedException ie )
+                {
                     // ignore
                 }
 
-                getLog().log(LogService.LOG_INFO, "Shutting down server now!");
+                getLog().log( LogService.LOG_INFO, "Shutting down server now!" );
 
                 // stopping bundle 0 (system bundle) stops the framework
-                try {
-                    getBundleContext().getBundle(0).stop();
-                } catch (BundleException be) {
-                    getLog().log(LogService.LOG_ERROR,
-                        "Problem stopping Framework", be);
+                try
+                {
+                    getBundleContext().getBundle( 0 ).stop();
+                }
+                catch ( BundleException be )
+                {
+                    getLog().log( LogService.LOG_ERROR, "Problem stopping Framework", be );
                 }
             }
         };

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/system/ShutdownRender.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/system/ShutdownRender.java?rev=657742&r1=657741&r2=657742&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/system/ShutdownRender.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/system/ShutdownRender.java Mon May 19 00:36:38 2008
@@ -16,6 +16,7 @@
  */
 package org.apache.felix.webconsole.internal.system;
 
+
 import java.io.IOException;
 import java.io.PrintWriter;
 
@@ -24,33 +25,40 @@
 
 import org.apache.felix.webconsole.Render;
 
-public class ShutdownRender implements Render {
+
+public class ShutdownRender implements Render
+{
 
     public static final String NAME = "shutdown";
     public static final String LABEL = null; // hide from navigation
 
-    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("<tr>");
-        pw.println("<td colspan='2' class='techcontentcell'>");
-        pw.println("<table class='content' cellpadding='0' cellspacing='0' width='100%'>");
-        pw.println("<tr class='content'>");
-        pw.println("<th class='content important'>Server terminated</th>");
-        pw.println("</tr>");
-        pw.println("</table>");
-        pw.println("</td>");
-        pw.println("</tr>");
+        pw.println( "<tr>" );
+        pw.println( "<td colspan='2' class='techcontentcell'>" );
+        pw.println( "<table class='content' cellpadding='0' cellspacing='0' width='100%'>" );
+        pw.println( "<tr class='content'>" );
+        pw.println( "<th class='content important'>Server terminated</th>" );
+        pw.println( "</tr>" );
+        pw.println( "</table>" );
+        pw.println( "</td>" );
+        pw.println( "</tr>" );
     }
 
 }

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/system/VMStatRender.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/system/VMStatRender.java?rev=657742&r1=657741&r2=657742&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/system/VMStatRender.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/system/VMStatRender.java Mon May 19 00:36:38 2008
@@ -16,6 +16,7 @@
  */
 package org.apache.felix.webconsole.internal.system;
 
+
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.util.Date;
@@ -28,145 +29,152 @@
 import org.apache.felix.webconsole.internal.Util;
 import org.apache.felix.webconsole.internal.core.SetStartLevelAction;
 
-public class VMStatRender extends BaseManagementPlugin implements Render {
+
+public class VMStatRender extends BaseManagementPlugin implements Render
+{
 
     public static final String NAME = "vmstat";
 
     public static final String LABEL = "System Information";
 
-    private static final long startDate = (new Date()).getTime();
+    private static final long startDate = ( new Date() ).getTime();
 
-    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("");
+        pw.println( "" );
         boolean shutdown = false;
 
         String target = request.getRequestURI();
-        if (request.getParameter(Util.PARAM_SHUTDOWN) != null) {
+        if ( request.getParameter( Util.PARAM_SHUTDOWN ) != null )
+        {
             target = ShutdownRender.NAME;
             shutdown = true;
         }
 
-        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 colspan='2' class='content container'>Start Level Information:</th>");
-        pw.println("</tr>");
-
-        pw.println("<tr class='content'>");
-        pw.println("<td class='content'>System Start Level</td>");
-        pw.println("<td class='content'>");
-        pw.println("<form method='post'>");
-        pw.println("<input type='hidden' name='" + Util.PARAM_ACTION
-            + "' value='" + SetStartLevelAction.NAME + "'>");
-        pw.println("<input class='input' type='text' size='3' name='systemStartLevel' value='"
-            + getStartLevel().getStartLevel() + "'/>");
-        pw.println("&nbsp;&nbsp;<input class='submit' type='submit' name='"
-            + SetStartLevelAction.LABEL + "' value='Change'>");
-        pw.println("</form>");
-        pw.println("</td>");
-        pw.println("</tr>");
-        pw.println("<tr class='content'>");
-        pw.println("<td class='content'>Default Bundle Start Level</td>");
-        pw.println("<td class='content'>");
-        pw.println("<form method='post'>");
-        pw.println("<input type='hidden' name='" + Util.PARAM_ACTION
-            + "' value='" + SetStartLevelAction.NAME + "'>");
-        pw.println("<input class='input' type='text' size='3' name='bundleStartLevel' value='"
-            + getStartLevel().getInitialBundleStartLevel() + "'/>");
-        pw.println("&nbsp;&nbsp;<input class='submit' type='submit' name='"
-            + SetStartLevelAction.LABEL + "' value='Change'>");
-        pw.println("</form>");
-        pw.println("</td>");
-        pw.println("</tr>");
-
-        pw.println("<tr class='content'>");
-        pw.println("<td colspan='2' class='content'>&nbsp;</th>");
-        pw.println("</tr>");
-
-        pw.println("<tr class='content'>");
-        pw.println("<th colspan='2' class='content container'>Server Information:</th>");
-        pw.println("</tr>");
-
-        pw.println("<tr class='content'>");
-        pw.println("<td class='content'>Last Started</td>");
-        pw.println("<td class='content'>");
-        pw.println("<script language='JavaScript'>");
-        pw.println("localDate(" + startDate /* <%= Server.getStartTime() %> */
-            + ")");
-        pw.println("</script>");
-        pw.println("</td>");
-        pw.println("</tr>");
-
-        pw.println("<tr class='content'>");
-        pw.println("<form name='shutdownform' method='post' action='" + target
-            + "'>");
-        pw.println("<td class='content'>Server</td>");
-        pw.println("<td class='content'>");
-
-        if (!shutdown) {
-            pw.println("<input type='hidden' name='" + Util.PARAM_SHUTDOWN
-                + "' value='" + Util.VALUE_SHUTDOWN + "'>");
-            pw.println("<input class='submit important' type='submit' value='Stop' onclick=\"return confirm('This will terminate all running applications. Do you want to stop the server?')\">");
-        } else {
-            pw.println("<input class='submit important' type='button' value='Abort' onclick=\"abort('"
-                + request.getRequestURI() + "')\">&nbsp;");
-            pw.println("<input type='hidden' name='" + Util.PARAM_ACTION
-                + "' value='" + ShutdownAction.NAME + "'>");
-            pw.println("Shutdown in <span id='countdowncell'>&nbsp;</span>");
-            pw.println("<script language='JavaScript'>");
-            pw.println("shutdown(3, 'shutdownform', 'countdowncell');");
-            pw.println("</script>");
+        pw.println( "<tr class='content'>" );
+        pw.println( "<th colspan='2' class='content container'>Start Level Information:</th>" );
+        pw.println( "</tr>" );
+
+        pw.println( "<tr class='content'>" );
+        pw.println( "<td class='content'>System Start Level</td>" );
+        pw.println( "<td class='content'>" );
+        pw.println( "<form method='post'>" );
+        pw.println( "<input type='hidden' name='" + Util.PARAM_ACTION + "' value='" + SetStartLevelAction.NAME + "'>" );
+        pw.println( "<input class='input' type='text' size='3' name='systemStartLevel' value='"
+            + getStartLevel().getStartLevel() + "'/>" );
+        pw.println( "&nbsp;&nbsp;<input class='submit' type='submit' name='" + SetStartLevelAction.LABEL
+            + "' value='Change'>" );
+        pw.println( "</form>" );
+        pw.println( "</td>" );
+        pw.println( "</tr>" );
+        pw.println( "<tr class='content'>" );
+        pw.println( "<td class='content'>Default Bundle Start Level</td>" );
+        pw.println( "<td class='content'>" );
+        pw.println( "<form method='post'>" );
+        pw.println( "<input type='hidden' name='" + Util.PARAM_ACTION + "' value='" + SetStartLevelAction.NAME + "'>" );
+        pw.println( "<input class='input' type='text' size='3' name='bundleStartLevel' value='"
+            + getStartLevel().getInitialBundleStartLevel() + "'/>" );
+        pw.println( "&nbsp;&nbsp;<input class='submit' type='submit' name='" + SetStartLevelAction.LABEL
+            + "' value='Change'>" );
+        pw.println( "</form>" );
+        pw.println( "</td>" );
+        pw.println( "</tr>" );
+
+        pw.println( "<tr class='content'>" );
+        pw.println( "<td colspan='2' class='content'>&nbsp;</th>" );
+        pw.println( "</tr>" );
+
+        pw.println( "<tr class='content'>" );
+        pw.println( "<th colspan='2' class='content container'>Server Information:</th>" );
+        pw.println( "</tr>" );
+
+        pw.println( "<tr class='content'>" );
+        pw.println( "<td class='content'>Last Started</td>" );
+        pw.println( "<td class='content'>" );
+        pw.println( "<script language='JavaScript'>" );
+        pw.println( "localDate(" + startDate /* <%= Server.getStartTime() %> */
+            + ")" );
+        pw.println( "</script>" );
+        pw.println( "</td>" );
+        pw.println( "</tr>" );
+
+        pw.println( "<tr class='content'>" );
+        pw.println( "<form name='shutdownform' method='post' action='" + target + "'>" );
+        pw.println( "<td class='content'>Server</td>" );
+        pw.println( "<td class='content'>" );
+
+        if ( !shutdown )
+        {
+            pw.println( "<input type='hidden' name='" + Util.PARAM_SHUTDOWN + "' value='" + Util.VALUE_SHUTDOWN + "'>" );
+            pw
+                .println( "<input class='submit important' type='submit' value='Stop' onclick=\"return confirm('This will terminate all running applications. Do you want to stop the server?')\">" );
+        }
+        else
+        {
+            pw.println( "<input class='submit important' type='button' value='Abort' onclick=\"abort('"
+                + request.getRequestURI() + "')\">&nbsp;" );
+            pw.println( "<input type='hidden' name='" + Util.PARAM_ACTION + "' value='" + ShutdownAction.NAME + "'>" );
+            pw.println( "Shutdown in <span id='countdowncell'>&nbsp;</span>" );
+            pw.println( "<script language='JavaScript'>" );
+            pw.println( "shutdown(3, 'shutdownform', 'countdowncell');" );
+            pw.println( "</script>" );
         }
 
-        pw.println("</td>");
-        pw.println("</form>");
-        pw.println("</tr>");
-
-        pw.println("<tr class='content'>");
-        pw.println("<td colspan='2' class='content'>&nbsp;</th>");
-        pw.println("</tr>");
-
-        pw.println("<tr class='content'>");
-        pw.println("<th colspan='2' class='content container'>Java Information:</th>");
-        pw.println("</tr>");
-
-        this.infoLine(pw, "Java Runtime", "ABOUT_JRT");
-        this.infoLine(pw, "Java Virtual Machine", "ABOUT_JVM");
-        this.infoLine(pw, "Total Memory", "ABOUT_MEM");
-        this.infoLine(pw, "Used Memory", "ABOUT_USED");
-        this.infoLine(pw, "Free Memory", "ABOUT_FREE");
-
-        pw.println("<tr class='content'>");
-        pw.println("<form method='post'>");
-        pw.println("<td class='content'>Garbage Collection</td>");
-        pw.println("<td class='content'>");
-        pw.println("<input type='hidden' name='" + Util.PARAM_ACTION
-            + "' value='" + GCAction.NAME + "'>");
-        pw.println("<input class='submit' type='submit' name='"
-            + GCAction.LABEL + "' value='Run'>");
-        pw.println("</form></td></tr>");
+        pw.println( "</td>" );
+        pw.println( "</form>" );
+        pw.println( "</tr>" );
+
+        pw.println( "<tr class='content'>" );
+        pw.println( "<td colspan='2' class='content'>&nbsp;</th>" );
+        pw.println( "</tr>" );
+
+        pw.println( "<tr class='content'>" );
+        pw.println( "<th colspan='2' class='content container'>Java Information:</th>" );
+        pw.println( "</tr>" );
+
+        this.infoLine( pw, "Java Runtime", "ABOUT_JRT" );
+        this.infoLine( pw, "Java Virtual Machine", "ABOUT_JVM" );
+        this.infoLine( pw, "Total Memory", "ABOUT_MEM" );
+        this.infoLine( pw, "Used Memory", "ABOUT_USED" );
+        this.infoLine( pw, "Free Memory", "ABOUT_FREE" );
+
+        pw.println( "<tr class='content'>" );
+        pw.println( "<form method='post'>" );
+        pw.println( "<td class='content'>Garbage Collection</td>" );
+        pw.println( "<td class='content'>" );
+        pw.println( "<input type='hidden' name='" + Util.PARAM_ACTION + "' value='" + GCAction.NAME + "'>" );
+        pw.println( "<input class='submit' type='submit' name='" + GCAction.LABEL + "' value='Run'>" );
+        pw.println( "</form></td></tr>" );
 
-        pw.println("</table>");
+        pw.println( "</table>" );
     }
 
-    private void infoLine(PrintWriter pw, String label, String jsName) {
-        pw.println("<tr class='content'>");
-        pw.println("<td class='content'>" + label + "</td>");
-        pw.println("<td class='content'>");
-        pw.println("<script> document.write(" + jsName + "); </script>");
-        pw.println("</td></tr>");
+
+    private void infoLine( PrintWriter pw, String label, String jsName )
+    {
+        pw.println( "<tr class='content'>" );
+        pw.println( "<td class='content'>" + label + "</td>" );
+        pw.println( "<td class='content'>" );
+        pw.println( "<script> document.write(" + jsName + "); </script>" );
+        pw.println( "</td></tr>" );
     }
 
 }



Mime
View raw message