Permalink
Browse files

Organize imports and format according to Apache Felix code conventions

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@657742 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent d388623 commit edfad55cdc1844c3ba2402c950582dede999ba6e Felix Meschberger committed May 19, 2008
Showing with 3,181 additions and 2,233 deletions.
  1. +11 −5 webconsole/src/main/java/org/apache/felix/webconsole/Action.java
  2. +7 −2 webconsole/src/main/java/org/apache/felix/webconsole/ConfigurationPrinter.java
  3. +8 −2 webconsole/src/main/java/org/apache/felix/webconsole/Render.java
  4. +36 −20 webconsole/src/main/java/org/apache/felix/webconsole/internal/BaseManagementPlugin.java
  5. +14 −6 webconsole/src/main/java/org/apache/felix/webconsole/internal/OsgiManagerActivator.java
  6. +70 −44 webconsole/src/main/java/org/apache/felix/webconsole/internal/Util.java
  7. +16 −8 webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/AbstractScrPlugin.java
  8. +260 −174 ...onsole/src/main/java/org/apache/felix/webconsole/internal/compendium/AjaxConfigManagerAction.java
  9. +117 −85 .../src/main/java/org/apache/felix/webconsole/internal/compendium/ComponentConfigurationPrinter.java
  10. +271 −218 webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ComponentRenderAction.java
  11. +108 −76 webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManager.java
  12. +119 −73 webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManagerBase.java
  13. +321 −221 webconsole/src/main/java/org/apache/felix/webconsole/internal/core/AjaxBundleDetailsAction.java
  14. +15 −7 webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundleAction.java
  15. +221 −185 webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundleListRender.java
  16. +174 −114 webconsole/src/main/java/org/apache/felix/webconsole/internal/core/InstallAction.java
  17. +14 −6 webconsole/src/main/java/org/apache/felix/webconsole/internal/core/RefreshPackagesAction.java
  18. +32 −16 webconsole/src/main/java/org/apache/felix/webconsole/internal/core/SetStartLevelAction.java
  19. +25 −12 webconsole/src/main/java/org/apache/felix/webconsole/internal/core/StartAction.java
  20. +25 −12 webconsole/src/main/java/org/apache/felix/webconsole/internal/core/StopAction.java
  21. +25 −12 webconsole/src/main/java/org/apache/felix/webconsole/internal/core/UninstallAction.java
  22. +74 −58 webconsole/src/main/java/org/apache/felix/webconsole/internal/core/UpdateAction.java
  23. +19 −8 webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/AssemblyListRender.java
  24. +287 −212 webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java
  25. +25 −20 webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/AbstractObrPlugin.java
  26. +200 −171 webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/BundleRepositoryRender.java
  27. +10 −3 webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/InstallFromRepoAction.java
  28. +53 −46 webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/RefreshRepoAction.java
  29. +19 −12 webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationListener.java
  30. +34 −17 webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/Logger.java
  31. +303 −193 webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java
  32. +81 −48 webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManagerHttpContext.java
  33. +13 −4 webconsole/src/main/java/org/apache/felix/webconsole/internal/system/GCAction.java
  34. +31 −16 webconsole/src/main/java/org/apache/felix/webconsole/internal/system/ShutdownAction.java
  35. +22 −14 webconsole/src/main/java/org/apache/felix/webconsole/internal/system/ShutdownRender.java
  36. +121 −113 webconsole/src/main/java/org/apache/felix/webconsole/internal/system/VMStatRender.java
@@ -16,26 +16,32 @@
*/
package org.apache.felix.webconsole;
+
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-public interface Action {
+
+public interface Action
+{
static final String SERVICE = Action.class.getName();
-
+
/**
* The name of a request attribute, which may be set by performAction if
* redirecting.
*/
- static final String ATTR_REDIRECT_PARAMETERS= "redirectParameters";
+ static final String ATTR_REDIRECT_PARAMETERS = "redirectParameters";
+
String getName();
+
String getLabel();
+
/**
* Performs the action the request data optionally sending a response to
* the HTTP Servlet Response.
@@ -53,7 +59,7 @@
* processing the action. The <code>rootCause</code> of the exception
* should contain the cause of the error.
*/
- boolean performAction(HttpServletRequest request,
- HttpServletResponse response) throws IOException, ServletException;
+ boolean performAction( HttpServletRequest request, HttpServletResponse response ) throws IOException,
+ ServletException;
}
@@ -18,14 +18,19 @@
*/
package org.apache.felix.webconsole;
+
import java.io.PrintWriter;
-public interface ConfigurationPrinter {
+
+public interface ConfigurationPrinter
+{
static final String SERVICE = ConfigurationPrinter.class.getName();
+
String getTitle();
- void printConfiguration(PrintWriter printWriter);
+
+ void printConfiguration( PrintWriter printWriter );
}
@@ -16,23 +16,29 @@
*/
package org.apache.felix.webconsole;
+
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+
/**
* The <code>Render</code> TODO
*/
-public interface Render {
+public interface Render
+{
static final String SERVICE = Render.class.getName();
+
String getName();
+
String getLabel();
- void render(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException;
+
+ void render( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException;
}
@@ -18,13 +18,16 @@
*/
package org.apache.felix.webconsole.internal;
+
import org.apache.felix.webconsole.internal.servlet.Logger;
import org.osgi.framework.BundleContext;
import org.osgi.service.packageadmin.PackageAdmin;
import org.osgi.service.startlevel.StartLevel;
import org.osgi.util.tracker.ServiceTracker;
-public class BaseManagementPlugin {
+
+public class BaseManagementPlugin
+{
private BundleContext bundleContext;
private Logger log;
@@ -33,42 +36,55 @@
private ServiceTracker packageAdmin;
- protected BaseManagementPlugin() {
+
+ protected BaseManagementPlugin()
+ {
}
- public void setBundleContext(BundleContext bundleContext) {
+
+ public void setBundleContext( BundleContext bundleContext )
+ {
this.bundleContext = bundleContext;
}
-
- public void setLogger(Logger log) {
+
+
+ public void setLogger( Logger log )
+ {
this.log = log;
}
- protected BundleContext getBundleContext() {
+
+ protected BundleContext getBundleContext()
+ {
return bundleContext;
}
-
- protected Logger getLog() {
+
+
+ protected Logger getLog()
+ {
return log;
}
-
- protected StartLevel getStartLevel() {
- if (startLevelService == null) {
- startLevelService = new ServiceTracker(getBundleContext(),
- StartLevel.class.getName(), null);
+
+
+ protected StartLevel getStartLevel()
+ {
+ if ( startLevelService == null )
+ {
+ startLevelService = new ServiceTracker( getBundleContext(), StartLevel.class.getName(), null );
startLevelService.open();
}
- return (StartLevel) startLevelService.getService();
+ return ( StartLevel ) startLevelService.getService();
}
- protected PackageAdmin getPackageAdmin() {
- if (packageAdmin == null) {
- packageAdmin = new ServiceTracker(getBundleContext(),
- PackageAdmin.class.getName(), null);
+
+ protected PackageAdmin getPackageAdmin()
+ {
+ if ( packageAdmin == null )
+ {
+ packageAdmin = new ServiceTracker( getBundleContext(), PackageAdmin.class.getName(), null );
packageAdmin.open();
}
- return (PackageAdmin) packageAdmin.getService();
+ return ( PackageAdmin ) packageAdmin.getService();
}
-
}
@@ -18,20 +18,28 @@
*/
package org.apache.felix.webconsole.internal;
+
import org.apache.felix.webconsole.internal.servlet.OsgiManager;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
-public class OsgiManagerActivator implements BundleActivator {
+
+public class OsgiManagerActivator implements BundleActivator
+{
private OsgiManager osgiManager;
-
- public void start(BundleContext bundleContext) {
- osgiManager = new OsgiManager(bundleContext);
+
+
+ public void start( BundleContext bundleContext )
+ {
+ osgiManager = new OsgiManager( bundleContext );
}
- public void stop(BundleContext arg0) {
- if (osgiManager != null) {
+
+ public void stop( BundleContext arg0 )
+ {
+ if ( osgiManager != null )
+ {
osgiManager.dispose();
}
}
@@ -16,6 +16,7 @@
*/
package org.apache.felix.webconsole.internal;
+
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
@@ -30,10 +31,12 @@
import org.apache.commons.io.IOUtils;
import org.apache.felix.webconsole.Render;
+
/**
* The <code>Util</code> TODO
*/
-public class Util {
+public class Util
+{
/** web apps subpage */
public static final String PAGE_WEBAPPS = "/webapps";
@@ -87,8 +90,10 @@
/** The name of the request attribute containig the map of FileItems from the POST request */
public static final String ATTR_FILEUPLOAD = "org.apache.felix.webconsole.fileupload";
- public static PrintWriter startHtml(HttpServletResponse resp, String pageTitle) throws IOException {
- resp.setContentType("text/html; utf-8");
+
+ public static PrintWriter startHtml( HttpServletResponse resp, String pageTitle ) throws IOException
+ {
+ resp.setContentType( "text/html; utf-8" );
PrintWriter pw = resp.getWriter();
@@ -102,69 +107,90 @@ public static PrintWriter startHtml(HttpServletResponse resp, String pageTitle)
long totalMem = Runtime.getRuntime().totalMemory() / 1024;
long usedMem = totalMem - freeMem;
- String header = MessageFormat.format(HEADER, new Object[] {
- adminTitle,
- "1.0.0-SNAPSHOT", // ServletEngine.VERSION.getFullVersion(),
- System.getProperty("java.runtime.version"),
- System.getProperty("java.runtime.name"),
- System.getProperty("java.vm.name"),
- System.getProperty("java.vm.version"),
- System.getProperty("java.vm.info"), new Long(totalMem),
- new Long(usedMem), new Long(freeMem), vendorWeb, productName,
- pageTitle, productWeb, vendorName});
- pw.println(header);
+ String header = MessageFormat.format( HEADER, new Object[]
+ {
+ adminTitle,
+ "1.0.0-SNAPSHOT", // ServletEngine.VERSION.getFullVersion(),
+ System.getProperty( "java.runtime.version" ), System.getProperty( "java.runtime.name" ),
+ System.getProperty( "java.vm.name" ), System.getProperty( "java.vm.version" ),
+ System.getProperty( "java.vm.info" ), new Long( totalMem ), new Long( usedMem ), new Long( freeMem ),
+ vendorWeb, productName, pageTitle, productWeb, vendorName } );
+ pw.println( header );
return pw;
}
- public static void navigation(PrintWriter pw, Collection renders, String current, boolean disabled) {
- pw.println("<p id='technav'>");
+
+ public static void navigation( PrintWriter pw, Collection renders, String current, boolean disabled )
+ {
+ pw.println( "<p id='technav'>" );
SortedMap map = new TreeMap();
- for (Iterator ri=renders.iterator(); ri.hasNext(); ) {
- Render render = (Render) ri.next();
- if (render.getLabel() == null) {
+ for ( Iterator ri = renders.iterator(); ri.hasNext(); )
+ {
+ Render render = ( Render ) ri.next();
+ if ( render.getLabel() == null )
+ {
// ignore renders without a label
- } else if (disabled || current.equals(render.getName())) {
- map.put(render.getLabel(), "<span class='technavat'>" + render.getLabel() + "</span>");
- } else {
- map.put(render.getLabel(), "<a href='" + render.getName() + "'>" + render.getLabel() + "</a></li>");
+ }
+ else if ( disabled || current.equals( render.getName() ) )
+ {
+ map.put( render.getLabel(), "<span class='technavat'>" + render.getLabel() + "</span>" );
+ }
+ else
+ {
+ map.put( render.getLabel(), "<a href='" + render.getName() + "'>" + render.getLabel() + "</a></li>" );
}
}
- for (Iterator li=map.values().iterator(); li.hasNext(); ) {
- pw.println(li.next());
+ for ( Iterator li = map.values().iterator(); li.hasNext(); )
+ {
+ pw.println( li.next() );
}
- pw.println("</p>");
+ pw.println( "</p>" );
}
- public static void endHhtml(PrintWriter pw) {
- pw.println("</body>");
- pw.println("</html>");
+
+ public static void endHhtml( PrintWriter pw )
+ {
+ pw.println( "</body>" );
+ pw.println( "</html>" );
}
- public static void startScript(PrintWriter pw) {
- pw.println("<script type='text/javascript'>");
- pw.println("// <![CDATA[");
+
+ public static void startScript( PrintWriter pw )
+ {
+ pw.println( "<script type='text/javascript'>" );
+ pw.println( "// <![CDATA[" );
}
- public static void endScript(PrintWriter pw) {
- pw.println("// ]]>");
- pw.println("</script>");
+
+ public static void endScript( PrintWriter pw )
+ {
+ pw.println( "// ]]>" );
+ pw.println( "</script>" );
}
- public static void spool(String res, HttpServletResponse resp) throws IOException {
- InputStream ins = getResource(res);
- if (ins != null) {
- try {
- IOUtils.copy(ins, resp.getOutputStream());
- } finally {
- IOUtils.closeQuietly(ins);
+
+ public static void spool( String res, HttpServletResponse resp ) throws IOException
+ {
+ InputStream ins = getResource( res );
+ if ( ins != null )
+ {
+ try
+ {
+ IOUtils.copy( ins, resp.getOutputStream() );
+ }
+ finally
+ {
+ IOUtils.closeQuietly( ins );
}
}
}
- private static InputStream getResource(String resource) {
- return Util.class.getResourceAsStream(resource);
+
+ private static InputStream getResource( String resource )
+ {
+ return Util.class.getResourceAsStream( resource );
}
}
Oops, something went wrong.

0 comments on commit edfad55

Please sign in to comment.