felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r1451624 [1/2] - in /felix/trunk/inventory/src/main/java/org/apache/felix/inventory: ./ impl/ impl/webconsole/
Date Fri, 01 Mar 2013 15:56:39 GMT
Author: fmeschbe
Date: Fri Mar  1 15:56:39 2013
New Revision: 1451624

URL: http://svn.apache.org/r1451624
Log:
Reformat to Apache Felix code conventions

Modified:
    felix/trunk/inventory/src/main/java/org/apache/felix/inventory/InventoryPrinter.java
    felix/trunk/inventory/src/main/java/org/apache/felix/inventory/PrinterMode.java
    felix/trunk/inventory/src/main/java/org/apache/felix/inventory/ZipAttachmentProvider.java
    felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/AbstractWebConsolePlugin.java
    felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/Activator.java
    felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/ClassUtils.java
    felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/DefaultWebConsolePlugin.java
    felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterAdapter.java
    felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterDescription.java
    felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterHandler.java
    felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterManagerImpl.java
    felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/WebConsolePlugin.java
    felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/webconsole/ConfigurationPrinterAdapter.java
    felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/webconsole/ConsoleConstants.java
    felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/webconsole/ResourceBundleManager.java
    felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/webconsole/WebConsoleAdapter.java

Modified: felix/trunk/inventory/src/main/java/org/apache/felix/inventory/InventoryPrinter.java
URL: http://svn.apache.org/viewvc/felix/trunk/inventory/src/main/java/org/apache/felix/inventory/InventoryPrinter.java?rev=1451624&r1=1451623&r2=1451624&view=diff
==============================================================================
--- felix/trunk/inventory/src/main/java/org/apache/felix/inventory/InventoryPrinter.java (original)
+++ felix/trunk/inventory/src/main/java/org/apache/felix/inventory/InventoryPrinter.java Fri Mar  1 15:56:39 2013
@@ -1,18 +1,18 @@
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
  * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
+ * regarding copyright ownership. The ASF licenses this file
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
+ * KIND, either express or implied. See the License for the
  * specific language governing permissions and limitations
  * under the License.
  */
@@ -24,16 +24,18 @@ import java.io.PrintWriter;
  * The <code>InventoryPrinter</code> is a service interface to be
  * implemented by providers which want to hook into the display of the
  * current configuration and state of the OSGi framework and application.
- *
- * A inventory printer must configure at least these three configuration properties
+ * 
+ * A inventory printer must configure at least these three configuration
+ * properties
  * <ul>
- *   <li>{@link #CONFIG_PRINTER_MODES} - the supported modes</li>
- *   <li>{@link #CONFIG_TITLE} - the printer title</li>
- *   <li>{@link #CONFIG_NAME} - the printer name</li>
+ * <li>{@link #CONFIG_PRINTER_MODES} - the supported modes</li>
+ * <li>{@link #CONFIG_TITLE} - the printer title</li>
+ * <li>{@link #CONFIG_NAME} - the printer name</li>
  * </ul>
- *
+ * 
  */
-public interface InventoryPrinter {
+public interface InventoryPrinter
+{
 
     /**
      * The service name under which services of this class must be registered
@@ -43,9 +45,10 @@ public interface InventoryPrinter {
 
     /**
      * The property defining the supported rendering modes.
-     * The value of this property is either a string or a string array containing
+     * The value of this property is either a string or a string array
+     * containing
      * valid names of {@link PrinterMode}.
-     *
+     * 
      * If this property is missing or contains invalid values,
      * the printer is ignored.
      */
@@ -77,19 +80,21 @@ public interface InventoryPrinter {
     /**
      * Prints the configuration report to the given <code>printWriter</code>.
      * Implementations are free to print whatever information they deem useful.
-     *
-     * If a printer is invoked with a mode it doesn't support ({@link #CONFIG_PRINTER_MODES})
+     * 
+     * If a printer is invoked with a mode it doesn't support (
+     * {@link #CONFIG_PRINTER_MODES})
      * the printer should just do/print nothing and directly return.
-     *
+     * 
      * A printer might be used in one of two different situations: either for
      * directly displaying the information to a user (like in the web console)
      * or the output is included in a ZIP. The printer might want to return
      * different output depending on the usage situation.
-     *
+     * 
      * @param mode The render mode.
-     * @param printWriter where to write the configuration data. It might be flushed,
-     * but must not be closed.
+     * @param printWriter where to write the configuration data. It might be
+     *            flushed,
+     *            but must not be closed.
      * @param isZip whether this is included in a ZIP file or used directly
      */
-    void print( PrinterMode mode, PrintWriter printWriter, boolean isZip );
+    void print(PrinterMode mode, PrintWriter printWriter, boolean isZip);
 }

Modified: felix/trunk/inventory/src/main/java/org/apache/felix/inventory/PrinterMode.java
URL: http://svn.apache.org/viewvc/felix/trunk/inventory/src/main/java/org/apache/felix/inventory/PrinterMode.java?rev=1451624&r1=1451623&r2=1451624&view=diff
==============================================================================
--- felix/trunk/inventory/src/main/java/org/apache/felix/inventory/PrinterMode.java (original)
+++ felix/trunk/inventory/src/main/java/org/apache/felix/inventory/PrinterMode.java Fri Mar  1 15:56:39 2013
@@ -1,18 +1,18 @@
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
  * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
+ * regarding copyright ownership. The ASF licenses this file
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
+ * KIND, either express or implied. See the License for the
  * specific language governing permissions and limitations
  * under the License.
  */
@@ -21,7 +21,8 @@ package org.apache.felix.inventory;
 /**
  * Enumeration for the different printer modes.
  */
-public final class PrinterMode {
+public final class PrinterMode
+{
 
     // plain text
     public static PrinterMode TEXT = new PrinterMode("TEXT");
@@ -34,43 +35,56 @@ public final class PrinterMode {
 
     private final String mode;
 
-    private PrinterMode(final String mode) {
+    private PrinterMode(final String mode)
+    {
         this.mode = mode;
     }
 
-    public static PrinterMode valueOf(final String m) {
-        if ( TEXT.name().equals(m) ) {
+    public static PrinterMode valueOf(final String m)
+    {
+        if (TEXT.name().equals(m))
+        {
             return TEXT;
-        } else if ( HTML_FRAGMENT.name().equals(m) ) {
+        }
+        else if (HTML_FRAGMENT.name().equals(m))
+        {
             return HTML_FRAGMENT;
-        } else if ( JSON.name().equals(m) ) {
+        }
+        else if (JSON.name().equals(m))
+        {
             return JSON;
         }
         return null;
     }
 
-    public String name() {
+    public String name()
+    {
         return this.mode;
     }
 
     /**
      * @see java.lang.Object#hashCode()
      */
-    public int hashCode() {
+    public int hashCode()
+    {
         return mode.hashCode();
     }
 
     /**
      * @see java.lang.Object#equals(java.lang.Object)
      */
-    public boolean equals(Object obj) {
-        if (this == obj) {
+    public boolean equals(Object obj)
+    {
+        if (this == obj)
+        {
             return true;
         }
-        if (obj == null) {
+        if (obj == null)
+        {
             return false;
         }
-        if (getClass() != obj.getClass()) {
+        if (getClass() != obj.getClass())
+        {
             return false;
         }
         final PrinterMode other = (PrinterMode) obj;

Modified: felix/trunk/inventory/src/main/java/org/apache/felix/inventory/ZipAttachmentProvider.java
URL: http://svn.apache.org/viewvc/felix/trunk/inventory/src/main/java/org/apache/felix/inventory/ZipAttachmentProvider.java?rev=1451624&r1=1451623&r2=1451624&view=diff
==============================================================================
--- felix/trunk/inventory/src/main/java/org/apache/felix/inventory/ZipAttachmentProvider.java (original)
+++ felix/trunk/inventory/src/main/java/org/apache/felix/inventory/ZipAttachmentProvider.java Fri Mar  1 15:56:39 2013
@@ -1,18 +1,18 @@
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
  * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
+ * regarding copyright ownership. The ASF licenses this file
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
+ * KIND, either express or implied. See the License for the
  * specific language governing permissions and limitations
  * under the License.
  */
@@ -26,30 +26,30 @@ import java.util.zip.ZipOutputStream;
  * If a inventory printer implements this interface, the printer
  * can add additional attachments to the output of the
  * configuration ZIP.
- *
+ * 
  * A service implementing this method must still register itself
- * as a {@link InventoryPrinter} but not as a
- * {@link ZipAttachmentProvider} service and the provider
- * should either support {@link PrinterMode.ZIP_FILE_JSON}
- * or {@link PrinterMode.ZIP_FILE_TEXT}
+ * as a {@link InventoryPrinter} but not as a {@link ZipAttachmentProvider}
+ * service and the provider
+ * should either support {@link PrinterMode.ZIP_FILE_JSON} or
+ * {@link PrinterMode.ZIP_FILE_TEXT}
  */
-public interface ZipAttachmentProvider {
+public interface ZipAttachmentProvider
+{
 
     /**
      * Add attachments to the zip output stream.
      * The attachment provider can add as many attachments in any format
      * as it wants. However it should use the namePrefix to create unique
      * names / paths inside the zip.
-     *
+     * 
      * The general pattern is: creating a zip entry by using the name prefix
      * and a name, adding the entry to the zip output stream, writing
      * the content of the file to the stream, and finally ending the
      * zip entry.
-     *
+     * 
      * @param namePrefix Name prefix to use for zip entries. Ends with a slash.
      * @param zos The zip output stream.
      * @throws IOException
      */
-    void addAttachments(final String namePrefix, final ZipOutputStream zos)
-    throws IOException;
+    void addAttachments(final String namePrefix, final ZipOutputStream zos) throws IOException;
 }

Modified: felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/AbstractWebConsolePlugin.java
URL: http://svn.apache.org/viewvc/felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/AbstractWebConsolePlugin.java?rev=1451624&r1=1451623&r2=1451624&view=diff
==============================================================================
--- felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/AbstractWebConsolePlugin.java (original)
+++ felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/AbstractWebConsolePlugin.java Fri Mar  1 15:56:39 2013
@@ -1,13 +1,13 @@
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
+ * contributor license agreements. See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
+ * the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -35,7 +35,8 @@ import org.apache.felix.inventory.Printe
 /**
  * The web console plugin for a inventory printer.
  */
-public abstract class AbstractWebConsolePlugin extends HttpServlet {
+public abstract class AbstractWebConsolePlugin extends HttpServlet
+{
 
     private static final long serialVersionUID = 1L;
 
@@ -44,25 +45,31 @@ public abstract class AbstractWebConsole
 
     /**
      * Constructor
+     * 
      * @param inventoryPrinterManager The manager
      */
-    AbstractWebConsolePlugin(final InventoryPrinterManagerImpl inventoryPrinterManager) {
+    AbstractWebConsolePlugin(final InventoryPrinterManagerImpl inventoryPrinterManager)
+    {
         this.inventoryPrinterManager = inventoryPrinterManager;
     }
 
     protected abstract InventoryPrinterHandler getInventoryPrinterHandler();
 
-    private void printConfigurationInventory( final ConfigurationWriter pw,
-            final PrinterMode mode,
-            final InventoryPrinterHandler handler )
-    throws IOException {
-        if ( handler == null ) {
+    private void printConfigurationInventory(final ConfigurationWriter pw, final PrinterMode mode,
+        final InventoryPrinterHandler handler) throws IOException
+    {
+        if (handler == null)
+        {
             final InventoryPrinterHandler[] adapters = this.inventoryPrinterManager.getHandlers(mode);
-            for(int i = 0; i < adapters.length; i++) {
+            for (int i = 0; i < adapters.length; i++)
+            {
                 pw.printInventory(mode, adapters[i]);
             }
-        } else {
-            if ( handler.supports(mode) ) {
+        }
+        else
+        {
+            if (handler.supports(mode))
+            {
                 pw.printInventory(mode, handler);
             }
         }
@@ -75,10 +82,11 @@ public abstract class AbstractWebConsole
      * <p>
      * This method sets the <code>Cache-Control</code>, <code>Expires</code>,
      * and <code>Pragma</code> headers.
-     *
+     * 
      * @param response The response for which to set the cache prevention
      */
-    private final void setNoCache(final HttpServletResponse response) {
+    private final void setNoCache(final HttpServletResponse response)
+    {
         response.setHeader("Cache-Control", "no-cache"); //$NON-NLS-1$ //$NON-NLS-2$
         response.addHeader("Cache-Control", "no-store"); //$NON-NLS-1$ //$NON-NLS-2$
         response.addHeader("Cache-Control", "must-revalidate"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -87,47 +95,54 @@ public abstract class AbstractWebConsole
         response.setHeader("Pragma", "no-cache"); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
-    protected void doGet(final HttpServletRequest request,
-            final HttpServletResponse response)
-    throws ServletException, IOException {
-        this.setNoCache( response );
+    protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException,
+        IOException
+    {
+        this.setNoCache(response);
 
         // full request?
         final InventoryPrinterHandler handler;
-        if ( request.getPathInfo().lastIndexOf('/') > 0 ) {
+        if (request.getPathInfo().lastIndexOf('/') > 0)
+        {
             handler = null; // all;
-        } else {
+        }
+        else
+        {
             handler = this.getInventoryPrinterHandler();
-            if ( handler == null ) {
-                response.sendError( HttpServletResponse.SC_NOT_FOUND );
+            if (handler == null)
+            {
+                response.sendError(HttpServletResponse.SC_NOT_FOUND);
                 return;
             }
         }
 
-        if ( request.getPathInfo().endsWith( ".txt" ) ) { //$NON-NLS-2$
-            response.setContentType( "text/plain; charset=utf-8" ); //$NON-NLS-2$
-            final ConfigurationWriter pw = new PlainTextConfigurationWriter( response.getWriter() );
-            printConfigurationInventory( pw, PrinterMode.TEXT, handler );
+        if (request.getPathInfo().endsWith(".txt")) { //$NON-NLS-2$
+            response.setContentType("text/plain; charset=utf-8"); //$NON-NLS-2$
+            final ConfigurationWriter pw = new PlainTextConfigurationWriter(response.getWriter());
+            printConfigurationInventory(pw, PrinterMode.TEXT, handler);
             pw.flush();
-        } else if ( request.getPathInfo().endsWith( ".zip" ) ) { //$NON-NLS-2$
-            String type = getServletContext().getMimeType( request.getPathInfo() );
-            if ( type == null ) {
+        }
+        else if (request.getPathInfo().endsWith(".zip")) { //$NON-NLS-2$
+            String type = getServletContext().getMimeType(request.getPathInfo());
+            if (type == null)
+            {
                 type = "application/x-zip"; //$NON-NLS-2$
             }
-            response.setContentType( type );
+            response.setContentType(type);
 
-            final ZipOutputStream zip = new ZipOutputStream( response.getOutputStream() );
-            zip.setLevel( Deflater.BEST_SPEED );
-            zip.setMethod( ZipOutputStream.DEFLATED );
+            final ZipOutputStream zip = new ZipOutputStream(response.getOutputStream());
+            zip.setLevel(Deflater.BEST_SPEED);
+            zip.setMethod(ZipOutputStream.DEFLATED);
 
             final Date now = new Date();
             // create time stamp entry
-            final ZipEntry entry = new ZipEntry( "timestamp.txt" ); //$NON-NLS-2$
+            final ZipEntry entry = new ZipEntry("timestamp.txt"); //$NON-NLS-2$
             entry.setTime(now.getTime());
-            zip.putNextEntry( entry );
+            zip.putNextEntry(entry);
             final StringBuilder sb = new StringBuilder();
             sb.append("Date: ");
-            synchronized ( InventoryPrinterAdapter.DISPLAY_DATE_FORMAT )                             {
+            synchronized (InventoryPrinterAdapter.DISPLAY_DATE_FORMAT)
+            {
                 sb.append(InventoryPrinterAdapter.DISPLAY_DATE_FORMAT.format(now));
             }
             sb.append(" (");
@@ -137,50 +152,64 @@ public abstract class AbstractWebConsole
             zip.write(sb.toString().getBytes("UTF-8"));
             zip.closeEntry();
 
-            final ZipConfigurationWriter pw = new ZipConfigurationWriter( zip );
-            printConfigurationInventory( pw, PrinterMode.TEXT, handler );
-            printConfigurationInventory( pw, PrinterMode.JSON, handler );
+            final ZipConfigurationWriter pw = new ZipConfigurationWriter(zip);
+            printConfigurationInventory(pw, PrinterMode.TEXT, handler);
+            printConfigurationInventory(pw, PrinterMode.JSON, handler);
 
             zip.finish();
-        } else if ( request.getPathInfo().endsWith( ".nfo" ) ) {
-            if ( handler == null ) {
-                response.sendError( HttpServletResponse.SC_NOT_FOUND);
+        }
+        else if (request.getPathInfo().endsWith(".nfo"))
+        {
+            if (handler == null)
+            {
+                response.sendError(HttpServletResponse.SC_NOT_FOUND);
                 return;
             }
-            response.setContentType( "text/html; charset=utf-8" );
+            response.setContentType("text/html; charset=utf-8");
 
-            final HtmlConfigurationWriter pw = new HtmlConfigurationWriter( response.getWriter() );
-            pw.println ( "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"" );
-            pw.println ( "  \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">" );
-            pw.println ( "<html xmlns=\"http://www.w3.org/1999/xhtml\">" );
-            pw.println ( "<head><title>dummy</title></head><body><div>" );
+            final HtmlConfigurationWriter pw = new HtmlConfigurationWriter(response.getWriter());
+            pw.println("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"");
+            pw.println("  \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">");
+            pw.println("<html xmlns=\"http://www.w3.org/1999/xhtml\">");
+            pw.println("<head><title>dummy</title></head><body><div>");
 
-            if ( handler.supports(PrinterMode.HTML_FRAGMENT) ) {
+            if (handler.supports(PrinterMode.HTML_FRAGMENT))
+            {
                 handler.print(PrinterMode.HTML_FRAGMENT, pw, false);
-            } else if ( handler.supports(PrinterMode.TEXT) ) {
-                pw.enableFilter( true );
+            }
+            else if (handler.supports(PrinterMode.TEXT))
+            {
+                pw.enableFilter(true);
                 handler.print(PrinterMode.TEXT, pw, false);
-                pw.enableFilter( false );
-            } else {
-                pw.enableFilter( true );
+                pw.enableFilter(false);
+            }
+            else
+            {
+                pw.enableFilter(true);
                 handler.print(PrinterMode.JSON, pw, false);
-                pw.enableFilter( false );
+                pw.enableFilter(false);
             }
-            pw.println( "</div></body></html>" );
+            pw.println("</div></body></html>");
             return;
-        } else if ( request.getPathInfo().endsWith(".json") ) {
-            if ( handler == null ) {
-                response.sendError( HttpServletResponse.SC_NOT_FOUND);
+        }
+        else if (request.getPathInfo().endsWith(".json"))
+        {
+            if (handler == null)
+            {
+                response.sendError(HttpServletResponse.SC_NOT_FOUND);
                 return;
             }
-            response.setContentType( "application/json" ); //$NON-NLS-1$
-            response.setCharacterEncoding( "UTF-8" ); //$NON-NLS-1$
+            response.setContentType("application/json"); //$NON-NLS-1$
+            response.setCharacterEncoding("UTF-8"); //$NON-NLS-1$
 
             final JSONConfigurationWriter jcw = new JSONConfigurationWriter(response.getWriter());
-            printConfigurationInventory( jcw, PrinterMode.JSON, handler );
-        } else {
-            if ( handler == null ) {
-                response.sendError( HttpServletResponse.SC_NOT_FOUND);
+            printConfigurationInventory(jcw, PrinterMode.JSON, handler);
+        }
+        else
+        {
+            if (handler == null)
+            {
+                response.sendError(HttpServletResponse.SC_NOT_FOUND);
                 return;
             }
             final HtmlConfigurationWriter pw = new HtmlConfigurationWriter(response.getWriter());
@@ -206,10 +235,11 @@ public abstract class AbstractWebConsole
             pw.println("});");
             pw.println("// ]]>");
             pw.println("</script>");
-            pw.println( "<br/><p class=\"statline\">");
+            pw.println("<br/><p class=\"statline\">");
 
             final Date currentTime = new Date();
-            synchronized ( InventoryPrinterAdapter.DISPLAY_DATE_FORMAT )                             {
+            synchronized (InventoryPrinterAdapter.DISPLAY_DATE_FORMAT)
+            {
                 pw.print("Date: ");
                 pw.println(InventoryPrinterAdapter.DISPLAY_DATE_FORMAT.format(currentTime));
             }
@@ -217,22 +247,27 @@ public abstract class AbstractWebConsole
             pw.print("<button type=\"button\" class=\"downloadFullZip\" style=\"float: right; margin-right: 30px; margin-top: 5px;\">Download Full Zip</button>");
             pw.print("<button type=\"button\" class=\"downloadFullTxt\" style=\"float: right; margin-right: 30px; margin-top: 5px;\">Download Full Text</button>");
 
-            if ( handler.supports(PrinterMode.JSON) ) {
+            if (handler.supports(PrinterMode.JSON))
+            {
                 pw.print("<button type=\"button\" class=\"downloadJson\" style=\"float: right; margin-right: 30px; margin-top: 5px;\">Download As JSON</button>");
             }
             pw.print("<button type=\"button\" class=\"downloadZip\" style=\"float: right; margin-right: 30px; margin-top: 5px;\">Download As Zip</button>");
-            if ( handler.supports(PrinterMode.TEXT ) ) {
+            if (handler.supports(PrinterMode.TEXT))
+            {
                 pw.print("<button type=\"button\" class=\"downloadTxt\" style=\"float: right; margin-right: 30px; margin-top: 5px;\">Download As Text</button>");
             }
 
             pw.println("<br/>&nbsp;</p>"); // status line
             pw.print("<div>");
-            if ( handler.supports(PrinterMode.HTML_FRAGMENT) ) {
+            if (handler.supports(PrinterMode.HTML_FRAGMENT))
+            {
                 handler.print(PrinterMode.HTML_FRAGMENT, pw, false);
-            } else {
-                pw.enableFilter( true );
+            }
+            else
+            {
+                pw.enableFilter(true);
                 handler.print(PrinterMode.TEXT, pw, false);
-                pw.enableFilter( false );
+                pw.enableFilter(false);
             }
             pw.print("</div>");
         }
@@ -241,25 +276,26 @@ public abstract class AbstractWebConsole
     /**
      * Base class for all configuration writers.
      */
-    private abstract static class ConfigurationWriter extends PrintWriter {
+    private abstract static class ConfigurationWriter extends PrintWriter
+    {
 
-        ConfigurationWriter( final Writer delegatee ) {
-            super( delegatee );
+        ConfigurationWriter(final Writer delegatee)
+        {
+            super(delegatee);
         }
 
-        protected void title( final String title ) throws IOException {
+        protected void title(final String title) throws IOException
+        {
             // dummy implementation
         }
 
-
-        protected void end() throws IOException {
+        protected void end() throws IOException
+        {
             // dummy implementation
         }
 
-        public void printInventory(
-                final PrinterMode mode,
-                final InventoryPrinterHandler handler)
-        throws IOException {
+        public void printInventory(final PrinterMode mode, final InventoryPrinterHandler handler) throws IOException
+        {
             this.title(handler.getTitle());
             handler.print(mode, this, false);
             this.end();
@@ -269,57 +305,68 @@ public abstract class AbstractWebConsole
     /**
      * The JSON configuration writer
      */
-    private static class JSONConfigurationWriter extends ConfigurationWriter {
+    private static class JSONConfigurationWriter extends ConfigurationWriter
+    {
 
-        JSONConfigurationWriter( final Writer delegatee ) {
-            super( delegatee );
+        JSONConfigurationWriter(final Writer delegatee)
+        {
+            super(delegatee);
         }
     }
 
     /**
      * The HTML configuration writer outputs the status as an HTML snippet.
      */
-    private static class HtmlConfigurationWriter extends ConfigurationWriter {
+    private static class HtmlConfigurationWriter extends ConfigurationWriter
+    {
 
         // whether or not to filter "<" signs in the output
         private boolean doFilter;
 
-
-        HtmlConfigurationWriter( final Writer delegatee ) {
-            super( delegatee );
+        HtmlConfigurationWriter(final Writer delegatee)
+        {
+            super(delegatee);
         }
 
-
-        void enableFilter( final boolean doFilter ) {
+        void enableFilter(final boolean doFilter)
+        {
             this.doFilter = doFilter;
         }
 
         // IE has an issue with white-space:pre in our case so, we write
         // <br/> instead of [CR]LF to get the line break. This also works
         // in other browsers.
-        public void println() {
-            if ( doFilter ) {
+        public void println()
+        {
+            if (doFilter)
+            {
                 this.write('\n'); // write <br/>
-            } else {
+            }
+            else
+            {
                 super.println();
             }
         }
 
-        // some VM implementation directly write in underlying stream, instead of
-        // delegation to the write() method. So we need to override this, to make
+        // some VM implementation directly write in underlying stream, instead
+        // of
+        // delegation to the write() method. So we need to override this, to
+        // make
         // sure, that everything is escaped correctly
-        public void print(final String str) {
+        public void print(final String str)
+        {
             final char[] chars = str.toCharArray();
             write(chars, 0, chars.length);
         }
 
-
         private final char[] oneChar = new char[1];
 
         // always delegate to write(char[], int, int) otherwise in some VM
         // it cause endless cycle and StackOverflowError
-        public void write(final int character) {
-            synchronized (oneChar) {
+        public void write(final int character)
+        {
+            synchronized (oneChar)
+            {
                 oneChar[0] = (char) character;
                 write(oneChar, 0, 1);
             }
@@ -327,8 +374,10 @@ public abstract class AbstractWebConsole
 
         // write the characters unmodified unless filtering is enabled in
         // which case the writeFiltered(String) method is called for filtering
-        public void write(char[] chars, int off, int len) {
-            if (doFilter) {
+        public void write(char[] chars, int off, int len)
+        {
+            if (doFilter)
+            {
                 chars = this.escapeHtml(new String(chars, off, len)).toCharArray();
                 off = 0;
                 len = chars.length;
@@ -338,22 +387,26 @@ public abstract class AbstractWebConsole
 
         // write the string unmodified unless filtering is enabled in
         // which case the writeFiltered(String) method is called for filtering
-        public void write( final String string, final int off, final int len ) {
+        public void write(final String string, final int off, final int len)
+        {
             write(string.toCharArray(), off, len);
         }
 
         /**
          * Escapes HTML special chars like: <>&\r\n and space
-         *
-         *
+         * 
+         * 
          * @param text the text to escape
          * @return the escaped text
          */
-        private String escapeHtml(final String text) {
+        private String escapeHtml(final String text)
+        {
             final StringBuilder sb = new StringBuilder(text.length() * 4 / 3);
             char ch, oldch = '_';
-            for (int i = 0; i < text.length(); i++) {
-                switch (ch = text.charAt(i)) {
+            for (int i = 0; i < text.length(); i++)
+            {
+                switch (ch = text.charAt(i))
+                {
                     case '<':
                         sb.append("&lt;"); //$NON-NLS-1$
                         break;
@@ -368,7 +421,8 @@ public abstract class AbstractWebConsole
                         break;
                     case '\r':
                     case '\n':
-                        if (oldch != '\r' && oldch != '\n') // don't add twice <br>
+                        if (oldch != '\r' && oldch != '\n') // don't add twice
+                                                            // <br>
                             sb.append("<br/>\n"); //$NON-NLS-1$
                         break;
                     default:
@@ -384,20 +438,23 @@ public abstract class AbstractWebConsole
     /**
      * The plain text configuration writer outputs the status as plain text.
      */
-    private static class PlainTextConfigurationWriter extends ConfigurationWriter {
+    private static class PlainTextConfigurationWriter extends ConfigurationWriter
+    {
 
-        PlainTextConfigurationWriter( final Writer delegatee ) {
-            super( delegatee );
+        PlainTextConfigurationWriter(final Writer delegatee)
+        {
+            super(delegatee);
         }
 
-        protected void title( final String title ) throws IOException {
-            print( "*** " );
-            print( title );
-            println( ":" );
+        protected void title(final String title) throws IOException
+        {
+            print("*** ");
+            print(title);
+            println(":");
         }
 
-
-        protected void end() throws IOException {
+        protected void end() throws IOException
+        {
             println();
         }
     }
@@ -408,37 +465,41 @@ public abstract class AbstractWebConsole
      * - json output of a inventory printers (if supported)
      * - attachments from a inventory printer (if supported)
      */
-    private static class ZipConfigurationWriter extends ConfigurationWriter {
+    private static class ZipConfigurationWriter extends ConfigurationWriter
+    {
 
         private final ZipOutputStream zip;
 
-        ZipConfigurationWriter( final ZipOutputStream zip ) {
-            super( new OutputStreamWriter( zip ) );
+        ZipConfigurationWriter(final ZipOutputStream zip)
+        {
+            super(new OutputStreamWriter(zip));
             this.zip = zip;
         }
 
-        public void printInventory(
-                final PrinterMode mode,
-                final InventoryPrinterHandler handler)
-        throws IOException {
-            if ( mode == PrinterMode.TEXT ) {
-                final ZipEntry entry = new ZipEntry( handler.getName().concat(".txt") );
-                zip.putNextEntry( entry );
+        public void printInventory(final PrinterMode mode, final InventoryPrinterHandler handler) throws IOException
+        {
+            if (mode == PrinterMode.TEXT)
+            {
+                final ZipEntry entry = new ZipEntry(handler.getName().concat(".txt"));
+                zip.putNextEntry(entry);
                 handler.print(mode, this, false);
                 flush();
                 zip.closeEntry();
 
                 handler.addAttachments(handler.getName().concat("/"), this.zip);
-            } else if ( mode == PrinterMode.JSON ) {
+            }
+            else if (mode == PrinterMode.JSON)
+            {
                 final String name = "json/".concat(handler.getName()).concat(".json");
 
-                final ZipEntry entry = new ZipEntry( name );
-                zip.putNextEntry( entry );
+                final ZipEntry entry = new ZipEntry(name);
+                zip.putNextEntry(entry);
                 handler.print(PrinterMode.JSON, this, true);
                 flush();
 
                 zip.closeEntry();
-                if ( !handler.supports(PrinterMode.TEXT) ) {
+                if (!handler.supports(PrinterMode.TEXT))
+                {
                     handler.addAttachments(handler.getName().concat("/"), this.zip);
                 }
             }

Modified: felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/Activator.java
URL: http://svn.apache.org/viewvc/felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/Activator.java?rev=1451624&r1=1451623&r2=1451624&view=diff
==============================================================================
--- felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/Activator.java (original)
+++ felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/Activator.java Fri Mar  1 15:56:39 2013
@@ -1,13 +1,13 @@
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
+ * contributor license agreements. See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
+ * the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -23,7 +23,8 @@ import org.osgi.framework.BundleContext;
 /**
  * Activate bridges and internal manager.
  */
-public class Activator implements BundleActivator {
+public class Activator implements BundleActivator
+{
 
     private InventoryPrinterManagerImpl printerManager;
 
@@ -32,20 +33,24 @@ public class Activator implements Bundle
     /**
      * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
      */
-    public void start(final BundleContext context) throws Exception {
+    public void start(final BundleContext context) throws Exception
+    {
         this.webAdapter = new WebConsoleAdapter(context);
         this.printerManager = new InventoryPrinterManagerImpl(context);
-}
+    }
 
     /**
      * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
      */
-    public void stop(final BundleContext context) throws Exception {
-        if ( this.printerManager != null ) {
+    public void stop(final BundleContext context) throws Exception
+    {
+        if (this.printerManager != null)
+        {
             this.printerManager.dispose();
             this.printerManager = null;
         }
-        if ( this.webAdapter != null ) {
+        if (this.webAdapter != null)
+        {
             this.webAdapter.dispose();
             this.webAdapter = null;
         }

Modified: felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/ClassUtils.java
URL: http://svn.apache.org/viewvc/felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/ClassUtils.java?rev=1451624&r1=1451623&r2=1451624&view=diff
==============================================================================
--- felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/ClassUtils.java (original)
+++ felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/ClassUtils.java Fri Mar  1 15:56:39 2013
@@ -1,13 +1,13 @@
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
+ * contributor license agreements. See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
+ * the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,22 +21,30 @@ import java.lang.reflect.Method;
 /**
  * Utility methods for dynamic method invocations
  */
-public class ClassUtils {
+public class ClassUtils
+{
 
     /**
      * Search a method with the given name and signature.
+     * 
      * @return The method or <code>null</code> if not found.
      */
-    public static Method searchMethod(final Class clazz, final String mName, final Class[] params) {
-        try {
+    public static Method searchMethod(final Class clazz, final String mName, final Class[] params)
+    {
+        try
+        {
             final Method m = clazz.getMethod(mName, params);
             m.setAccessible(true);
             return m;
-        } catch (Throwable nsme) {
-            // ignore, we catch Throwable above to not only catch NoSuchMethodException
+        }
+        catch (Throwable nsme)
+        {
+            // ignore, we catch Throwable above to not only catch
+            // NoSuchMethodException
             // but also other ones like ClassDefNotFoundError etc.
         }
-        if ( clazz.getSuperclass() != null ) {
+        if (clazz.getSuperclass() != null)
+        {
             // try super class
             return searchMethod(clazz.getSuperclass(), mName, params);
         }
@@ -45,12 +53,18 @@ public class ClassUtils {
 
     /**
      * Invoke the method on the object with the arguments.
-     * @return The result of the method invocation or <code>null</code> if an exception occurs.
+     * 
+     * @return The result of the method invocation or <code>null</code> if an
+     *         exception occurs.
      */
-    public static Object invoke(final Object obj, final Method m, final Object[] args) {
-        try {
+    public static Object invoke(final Object obj, final Method m, final Object[] args)
+    {
+        try
+        {
             return m.invoke(obj, args);
-        } catch (final Throwable e) {
+        }
+        catch (final Throwable e)
+        {
             // ignore
         }
         return null;

Modified: felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/DefaultWebConsolePlugin.java
URL: http://svn.apache.org/viewvc/felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/DefaultWebConsolePlugin.java?rev=1451624&r1=1451623&r2=1451624&view=diff
==============================================================================
--- felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/DefaultWebConsolePlugin.java (original)
+++ felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/DefaultWebConsolePlugin.java Fri Mar  1 15:56:39 2013
@@ -1,13 +1,13 @@
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
+ * contributor license agreements. See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
+ * the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,88 +32,103 @@ import org.osgi.framework.ServiceRegistr
 /**
  * The web console plugin for a inventory printer.
  */
-public class DefaultWebConsolePlugin extends AbstractWebConsolePlugin implements InventoryPrinterHandler {
+public class DefaultWebConsolePlugin extends AbstractWebConsolePlugin implements InventoryPrinterHandler
+{
 
     private static final long serialVersionUID = 1L;
 
     /**
      * Constructor
+     * 
      * @param inventoryPrinterAdapter The adapter
      */
-    DefaultWebConsolePlugin(final InventoryPrinterManagerImpl inventoryPrinterManager) {
+    DefaultWebConsolePlugin(final InventoryPrinterManagerImpl inventoryPrinterManager)
+    {
         super(inventoryPrinterManager);
     }
 
-    protected InventoryPrinterHandler getInventoryPrinterHandler() {
+    protected InventoryPrinterHandler getInventoryPrinterHandler()
+    {
         return this;
     }
 
     /**
      * @see org.apache.felix.inventory.impl.InventoryPrinterHandler#getTitle()
      */
-    public String getTitle() {
+    public String getTitle()
+    {
         return "Overview";
     }
 
     /**
      * @see org.apache.felix.inventory.impl.InventoryPrinterHandler#getName()
      */
-    public String getName() {
+    public String getName()
+    {
         return "config";
     }
 
     /**
      * @see org.apache.felix.inventory..implInventoryPrinterHandler#getModes()
      */
-    public PrinterMode[] getModes() {
-        return new PrinterMode[] {PrinterMode.TEXT};
+    public PrinterMode[] getModes()
+    {
+        return new PrinterMode[]
+            { PrinterMode.TEXT };
     }
 
     /**
      * @see org.apache.felix.inventory.impl.InventoryPrinterHandler#supports(org.apache.felix.inventory.PrinterMode)
      */
-    public boolean supports(final PrinterMode mode) {
+    public boolean supports(final PrinterMode mode)
+    {
         return mode == PrinterMode.TEXT;
     }
 
     /**
-     * @see org.apache.felix.inventory.InventoryPrinter#print(org.apache.felix.inventory.PrinterMode, java.io.PrintWriter, boolean)
+     * @see org.apache.felix.inventory.InventoryPrinter#print(org.apache.felix.inventory.PrinterMode,
+     *      java.io.PrintWriter, boolean)
      */
-    public void print(final PrinterMode mode, final PrintWriter printWriter, final boolean isZip) {
+    public void print(final PrinterMode mode, final PrintWriter printWriter, final boolean isZip)
+    {
         final InventoryPrinterHandler[] handlers = this.inventoryPrinterManager.getAllHandlers();
         printWriter.print("Currently registered ");
         printWriter.print(String.valueOf(handlers.length));
         printWriter.println(" printer(s).");
         printWriter.println();
-        for(int i=0; i<handlers.length; i++) {
+        for (int i = 0; i < handlers.length; i++)
+        {
             printWriter.println(handlers[i].getTitle());
         }
     }
 
     /**
-     * @see org.apache.felix.inventory.ZipAttachmentProvider#addAttachments(java.lang.String, java.util.zip.ZipOutputStream)
+     * @see org.apache.felix.inventory.ZipAttachmentProvider#addAttachments(java.lang.String,
+     *      java.util.zip.ZipOutputStream)
      */
-    public void addAttachments(String namePrefix, ZipOutputStream zos)
-    throws IOException {
+    public void addAttachments(String namePrefix, ZipOutputStream zos) throws IOException
+    {
         // no attachments support
     }
 
-    public static ServiceRegistration register(final BundleContext context,
-            final InventoryPrinterManagerImpl manager) {
+    public static ServiceRegistration register(final BundleContext context, final InventoryPrinterManagerImpl manager)
+    {
         final DefaultWebConsolePlugin dwcp = new DefaultWebConsolePlugin(manager);
 
         final Dictionary props = new Hashtable();
         props.put(ConsoleConstants.PLUGIN_LABEL, dwcp.getName());
         props.put(ConsoleConstants.PLUGIN_TITLE, dwcp.getTitle());
         props.put(ConsoleConstants.PLUGIN_CATEGORY, ConsoleConstants.WEB_CONSOLE_CATEGORY);
-        return context.registerService(ConsoleConstants.INTERFACE_SERVLET, new ServiceFactory() {
+        return context.registerService(ConsoleConstants.INTERFACE_SERVLET, new ServiceFactory()
+        {
 
-            public void ungetService(final Bundle bundle, final ServiceRegistration registration,
-                    final Object service) {
+            public void ungetService(final Bundle bundle, final ServiceRegistration registration, final Object service)
+            {
                 // nothing to do
             }
 
-            public Object getService(final Bundle bundle, final ServiceRegistration registration) {
+            public Object getService(final Bundle bundle, final ServiceRegistration registration)
+            {
                 return dwcp;
             }
 

Modified: felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterAdapter.java
URL: http://svn.apache.org/viewvc/felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterAdapter.java?rev=1451624&r1=1451623&r2=1451624&view=diff
==============================================================================
--- felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterAdapter.java (original)
+++ felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterAdapter.java Fri Mar  1 15:56:39 2013
@@ -1,13 +1,13 @@
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
+ * contributor license agreements. See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
+ * the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,56 +32,61 @@ import org.osgi.framework.ServiceRegistr
 
 /**
  * Helper class for a inventory printer.
- *
+ * 
  * The adapter simplifies accessing and working with the inventory printer.
  */
-public class InventoryPrinterAdapter implements InventoryPrinterHandler, Comparable {
+public class InventoryPrinterAdapter implements InventoryPrinterHandler, Comparable
+{
 
     /**
      * Formatter pattern to render the current time of inventory generation.
      */
-    static final DateFormat DISPLAY_DATE_FORMAT = DateFormat.getDateTimeInstance( DateFormat.LONG,
-        DateFormat.LONG, Locale.US );
+    static final DateFormat DISPLAY_DATE_FORMAT = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG,
+        Locale.US);
 
     /**
-     * Create a new adapter if the provided service is either a printer or provides
+     * Create a new adapter if the provided service is either a printer or
+     * provides
      * the print method.
+     * 
      * @return An adapter or <code>null</code> if the method is missing.
      */
     public static InventoryPrinterAdapter createAdapter(final InventoryPrinterDescription description,
-            final Object service) {
+        final Object service)
+    {
 
         Method printMethod = null;
-        if ( !(service instanceof InventoryPrinter) ) {
+        if (!(service instanceof InventoryPrinter))
+        {
 
             // print(String, PrintWriter)
-            printMethod = ClassUtils.searchMethod(service.getClass(), "print",
-                    new Class[] {String.class, PrintWriter.class, Boolean.class});
-            if ( printMethod == null ) {
+            printMethod = ClassUtils.searchMethod(service.getClass(), "print", new Class[]
+                { String.class, PrintWriter.class, Boolean.class });
+            if (printMethod == null)
+            {
                 return null;
             }
         }
         Method attachmentMethod = null;
-        if ( !(service instanceof ZipAttachmentProvider) ) {
+        if (!(service instanceof ZipAttachmentProvider))
+        {
 
             // addAttachments()
-            attachmentMethod = ClassUtils.searchMethod(service.getClass(), "addAttachments",
-                    new Class[] {String.class, ZipOutputStream.class});
+            attachmentMethod = ClassUtils.searchMethod(service.getClass(), "addAttachments", new Class[]
+                { String.class, ZipOutputStream.class });
         }
-        return new InventoryPrinterAdapter(
-                description,
-                service,
-                printMethod,
-                attachmentMethod);
+        return new InventoryPrinterAdapter(description, service, printMethod, attachmentMethod);
     }
 
     /**
      * Comparator for adapters based on the service ranking.
      */
-    public static final Comparator RANKING_COMPARATOR = new Comparator() {
+    public static final Comparator RANKING_COMPARATOR = new Comparator()
+    {
 
-        public int compare(final Object o1, final Object o2) {
-            return ((InventoryPrinterAdapter)o1).description.compareTo(((InventoryPrinterAdapter)o2).description);
+        public int compare(final Object o1, final Object o2)
+        {
+            return ((InventoryPrinterAdapter) o1).description.compareTo(((InventoryPrinterAdapter) o2).description);
         }
     };
 
@@ -102,27 +107,31 @@ public class InventoryPrinterAdapter imp
     /**
      * Constructor.
      */
-    public InventoryPrinterAdapter( final InventoryPrinterDescription description,
-            final Object printer,
-            final Method printMethod,
-            final Method attachmentMethod) {
+    public InventoryPrinterAdapter(final InventoryPrinterDescription description, final Object printer,
+        final Method printMethod, final Method attachmentMethod)
+    {
         this.description = description;
         this.printer = printer;
         this.printMethod = printMethod;
         this.attachmentMethod = attachmentMethod;
     }
 
-    public void registerConsole(final BundleContext context, final InventoryPrinterManagerImpl manager) {
-        if ( this.registration == null ) {
+    public void registerConsole(final BundleContext context, final InventoryPrinterManagerImpl manager)
+    {
+        if (this.registration == null)
+        {
             final Object value = this.description.getServiceReference().getProperty(InventoryPrinter.CONFIG_WEBCONSOLE);
-            if ( value == null || !"false".equalsIgnoreCase(value.toString()) ) {
+            if (value == null || !"false".equalsIgnoreCase(value.toString()))
+            {
                 this.registration = WebConsolePlugin.register(context, manager, this.description);
             }
         }
     }
 
-    public void unregisterConsole() {
-        if ( this.registration != null ) {
+    public void unregisterConsole()
+    {
+        if (this.registration != null)
+        {
             this.registration.unregister();
             this.registration = null;
         }
@@ -131,43 +140,54 @@ public class InventoryPrinterAdapter imp
     /**
      * The human readable title for the inventory printer.
      */
-    public String getTitle() {
+    public String getTitle()
+    {
         return this.description.getTitle();
     }
 
     /**
      * The unique name of the printer.
      */
-    public String getName() {
+    public String getName()
+    {
         return this.description.getName();
     }
 
     /**
      * All supported modes.
      */
-    public PrinterMode[] getModes() {
+    public PrinterMode[] getModes()
+    {
         return this.description.getModes();
     }
 
     /**
-     * @see org.apache.felix.inventory.ZipAttachmentProvider#addAttachments(java.lang.String, java.util.zip.ZipOutputStream)
+     * @see org.apache.felix.inventory.ZipAttachmentProvider#addAttachments(java.lang.String,
+     *      java.util.zip.ZipOutputStream)
      */
-    public void addAttachments(final String namePrefix, final ZipOutputStream zos)
-    throws IOException {
+    public void addAttachments(final String namePrefix, final ZipOutputStream zos) throws IOException
+    {
         // check if printer implements ZipAttachmentProvider
-        if ( printer instanceof ZipAttachmentProvider ) {
-            ((ZipAttachmentProvider)printer).addAttachments(namePrefix, zos);
-        } else if ( this.attachmentMethod != null ) {
-            ClassUtils.invoke(this.printer, this.attachmentMethod, new Object[] {namePrefix, zos});
+        if (printer instanceof ZipAttachmentProvider)
+        {
+            ((ZipAttachmentProvider) printer).addAttachments(namePrefix, zos);
+        }
+        else if (this.attachmentMethod != null)
+        {
+            ClassUtils.invoke(this.printer, this.attachmentMethod, new Object[]
+                { namePrefix, zos });
         }
     }
 
     /**
      * Whether the printer supports this mode.
      */
-    public boolean supports(final PrinterMode mode) {
-        for(int i=0; i<this.description.getModes().length; i++) {
-            if ( this.description.getModes()[i] == mode ) {
+    public boolean supports(final PrinterMode mode)
+    {
+        for (int i = 0; i < this.description.getModes().length; i++)
+        {
+            if (this.description.getModes()[i] == mode)
+            {
                 return true;
             }
         }
@@ -175,16 +195,21 @@ public class InventoryPrinterAdapter imp
     }
 
     /**
-     * @see org.apache.felix.inventory.InventoryPrinter#print(org.apache.felix.inventory.PrinterMode, java.io.PrintWriter)
+     * @see org.apache.felix.inventory.InventoryPrinter#print(org.apache.felix.inventory.PrinterMode,
+     *      java.io.PrintWriter)
      */
-    public void print(final PrinterMode mode,
-            final PrintWriter printWriter,
-            final boolean isZip) {
-        if ( this.supports(mode) ) {
-            if ( this.printer instanceof InventoryPrinter ) {
-                ((InventoryPrinter)this.printer).print(mode, printWriter, isZip);
-            } else {
-                ClassUtils.invoke(this.printer, this.printMethod, new Object[] {mode.toString(), printWriter, Boolean.valueOf(isZip)});
+    public void print(final PrinterMode mode, final PrintWriter printWriter, final boolean isZip)
+    {
+        if (this.supports(mode))
+        {
+            if (this.printer instanceof InventoryPrinter)
+            {
+                ((InventoryPrinter) this.printer).print(mode, printWriter, isZip);
+            }
+            else
+            {
+                ClassUtils.invoke(this.printer, this.printMethod, new Object[]
+                    { mode.toString(), printWriter, Boolean.valueOf(isZip) });
             }
         }
     }
@@ -192,18 +217,21 @@ public class InventoryPrinterAdapter imp
     /**
      * @see java.lang.Object#toString()
      */
-    public String toString() {
+    public String toString()
+    {
         return printer.getClass() + "(" + super.toString() + ")";
     }
 
     /**
      * @see java.lang.Comparable#compareTo(java.lang.Object)
      */
-    public int compareTo(final Object spa) {
-        return this.description.getSortKey().compareTo(((InventoryPrinterAdapter)spa).description.getSortKey());
+    public int compareTo(final Object spa)
+    {
+        return this.description.getSortKey().compareTo(((InventoryPrinterAdapter) spa).description.getSortKey());
     }
 
-    public InventoryPrinterDescription getDescription() {
+    public InventoryPrinterDescription getDescription()
+    {
         return this.description;
     }
- }
+}

Modified: felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterDescription.java
URL: http://svn.apache.org/viewvc/felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterDescription.java?rev=1451624&r1=1451623&r2=1451624&view=diff
==============================================================================
--- felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterDescription.java (original)
+++ felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterDescription.java Fri Mar  1 15:56:39 2013
@@ -1,13 +1,13 @@
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
+ * contributor license agreements. See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
+ * the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,7 +25,8 @@ import org.osgi.framework.ServiceReferen
 /**
  * Helper class for a configuration printer.
  */
-public class InventoryPrinterDescription implements Comparable {
+public class InventoryPrinterDescription implements Comparable
+{
 
     private final ServiceReference reference;
 
@@ -37,95 +38,128 @@ public class InventoryPrinterDescription
 
     private final String sortKey;
 
-    public InventoryPrinterDescription(final ServiceReference ref) {
+    public InventoryPrinterDescription(final ServiceReference ref)
+    {
         this.reference = ref;
 
         // check modes
         final Object modesCfg = ref.getProperty(InventoryPrinter.CONFIG_PRINTER_MODES);
-        if ( modesCfg instanceof String ) {
-            final PrinterMode mode = PrinterMode.valueOf((String)modesCfg);
-            if ( mode != null ) {
-                this.modes = new PrinterMode[] {mode};
-            } else {
+        if (modesCfg instanceof String)
+        {
+            final PrinterMode mode = PrinterMode.valueOf((String) modesCfg);
+            if (mode != null)
+            {
+                this.modes = new PrinterMode[]
+                    { mode };
+            }
+            else
+            {
                 this.modes = null;
             }
-        } else if ( modesCfg instanceof String[] ) {
-            final String[] modesCfgArray = (String[])modesCfg;
+        }
+        else if (modesCfg instanceof String[])
+        {
+            final String[] modesCfgArray = (String[]) modesCfg;
             final PrinterMode[] pModes = new PrinterMode[modesCfgArray.length];
             boolean invalid = false;
-            for(int i=0; i<modesCfgArray.length;i++) {
+            for (int i = 0; i < modesCfgArray.length; i++)
+            {
                 pModes[i] = PrinterMode.valueOf(modesCfgArray[i]);
-                if ( pModes[i] == null ) {
+                if (pModes[i] == null)
+                {
                     invalid = true;
                 }
             }
-            if ( invalid ) {
+            if (invalid)
+            {
                 this.modes = null;
-            } else {
+            }
+            else
+            {
                 this.modes = pModes;
             }
-        } else {
+        }
+        else
+        {
             this.modes = null;
         }
 
         // check name
-        if ( ref.getProperty(InventoryPrinter.CONFIG_NAME) != null ) {
+        if (ref.getProperty(InventoryPrinter.CONFIG_NAME) != null)
+        {
             this.name = ref.getProperty(InventoryPrinter.CONFIG_NAME).toString();
-        } else {
+        }
+        else
+        {
             this.name = null;
         }
 
         // check title
-        if ( ref.getProperty(InventoryPrinter.CONFIG_TITLE) != null ) {
+        if (ref.getProperty(InventoryPrinter.CONFIG_TITLE) != null)
+        {
             this.title = ref.getProperty(InventoryPrinter.CONFIG_TITLE).toString();
-            if ( this.title.startsWith("%") ) {
+            if (this.title.startsWith("%"))
+            {
                 this.sortKey = this.title.substring(1);
-            } else {
+            }
+            else
+            {
                 this.sortKey = this.title;
             }
-        } else {
+        }
+        else
+        {
             this.title = null;
             this.sortKey = null;
         }
     }
 
-    public String getTitle() {
+    public String getTitle()
+    {
         return this.title;
     }
 
-    public String getSortKey() {
+    public String getSortKey()
+    {
         return this.sortKey;
     }
 
-    public String getName() {
+    public String getName()
+    {
         return this.name;
     }
 
-    public PrinterMode[] getModes() {
+    public PrinterMode[] getModes()
+    {
         return this.modes;
     }
 
-    public ServiceReference getServiceReference() {
+    public ServiceReference getServiceReference()
+    {
         return this.reference;
     }
 
     /**
      * @see java.lang.Comparable#compareTo(java.lang.Object)
      */
-    public int compareTo(final Object spa) {
-        return this.reference.compareTo(((InventoryPrinterDescription)spa).reference);
+    public int compareTo(final Object spa)
+    {
+        return this.reference.compareTo(((InventoryPrinterDescription) spa).reference);
     }
 
-    public boolean equals(final Object obj) {
+    public boolean equals(final Object obj)
+    {
         return this.reference.equals(obj);
     }
 
-    public int hashCode() {
+    public int hashCode()
+    {
         return this.reference.hashCode();
     }
 
-    public String toString() {
-        return "InventoryPrinterDescription [title=" + title + ", name=" + name
-                + ", modes=" + Arrays.toString(modes) + ", sortKey=" + sortKey + "]";
+    public String toString()
+    {
+        return "InventoryPrinterDescription [title=" + title + ", name=" + name + ", modes=" + Arrays.toString(modes)
+            + ", sortKey=" + sortKey + "]";
     }
 }

Modified: felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterHandler.java?rev=1451624&r1=1451623&r2=1451624&view=diff
==============================================================================
--- felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterHandler.java (original)
+++ felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterHandler.java Fri Mar  1 15:56:39 2013
@@ -1,18 +1,18 @@
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
  * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
+ * regarding copyright ownership. The ASF licenses this file
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
+ * KIND, either express or implied. See the License for the
  * specific language governing permissions and limitations
  * under the License.
  */
@@ -22,15 +22,15 @@ import org.apache.felix.inventory.Invent
 import org.apache.felix.inventory.PrinterMode;
 import org.apache.felix.inventory.ZipAttachmentProvider;
 
-
 /**
  * The inventory printer handler can be used by clients to access
  * a inventory printer.
- *
+ * 
  * For clients using inventory printers, a handler simplifies accessing and
  * working with the inventory printer.
  */
-public interface InventoryPrinterHandler extends InventoryPrinter, ZipAttachmentProvider {
+public interface InventoryPrinterHandler extends InventoryPrinter, ZipAttachmentProvider
+{
 
     /** The unique name of the printer. */
     String getName();
@@ -42,5 +42,5 @@ public interface InventoryPrinterHandler
     PrinterMode[] getModes();
 
     /** Whether the printer supports this mode. */
-    boolean supports( final PrinterMode mode );
+    boolean supports(final PrinterMode mode);
 }
\ No newline at end of file

Modified: felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterManagerImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterManagerImpl.java?rev=1451624&r1=1451623&r2=1451624&view=diff
==============================================================================
--- felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterManagerImpl.java (original)
+++ felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterManagerImpl.java Fri Mar  1 15:56:39 2013
@@ -1,13 +1,13 @@
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
+ * contributor license agreements. See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
+ * the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,7 +16,6 @@
  */
 package org.apache.felix.inventory.impl;
 
-
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
@@ -39,24 +38,27 @@ import org.osgi.util.tracker.ServiceTrac
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
 /**
  * The manager keeps track of all inventory printers and maintains them
  * based on their name. If more than one printer with the same name
  * is registered, the one with highest service ranking is used.
  */
-public class InventoryPrinterManagerImpl implements ServiceTrackerCustomizer {
+public class InventoryPrinterManagerImpl implements ServiceTrackerCustomizer
+{
 
     /** Logger. */
     private final Logger logger = LoggerFactory.getLogger(this.getClass());
 
-    /** Bundle Context .*/
+    /** Bundle Context . */
     private final BundleContext bundleContext;
 
     /** Service tracker for Inventory printers. */
     private final ServiceTracker cfgPrinterTracker;
 
-    /** All adapters mapped by their name. Type of the map: String, List<InventoryPrinterAdapter> */
+    /**
+     * All adapters mapped by their name. Type of the map: String,
+     * List<InventoryPrinterAdapter>
+     */
     private final Map allAdapters = new HashMap();
 
     /** Used adapters. Type of the set: InventoryPrinterAdapter */
@@ -67,16 +69,17 @@ public class InventoryPrinterManagerImpl
 
     /**
      * Create the inventory printer manager
+     * 
      * @param btx Bundle Context
-     * @throws InvalidSyntaxException Should only happen if we have an error in the code
+     * @throws InvalidSyntaxException Should only happen if we have an error in
+     *             the code
      */
-    public InventoryPrinterManagerImpl(final BundleContext btx) throws InvalidSyntaxException {
+    public InventoryPrinterManagerImpl(final BundleContext btx) throws InvalidSyntaxException
+    {
         this.bundleContext = btx;
-        this.cfgPrinterTracker = new ServiceTracker( this.bundleContext,
-                this.bundleContext.createFilter("(&(" + InventoryPrinter.CONFIG_PRINTER_MODES + "=*)"
-                        + "(" + InventoryPrinter.CONFIG_NAME + "=*)"
-                        + "(" + InventoryPrinter.CONFIG_TITLE + "=*))"),
-                this );
+        this.cfgPrinterTracker = new ServiceTracker(this.bundleContext, this.bundleContext.createFilter("(&("
+            + InventoryPrinter.CONFIG_PRINTER_MODES + "=*)" + "(" + InventoryPrinter.CONFIG_NAME + "=*)" + "("
+            + InventoryPrinter.CONFIG_TITLE + "=*))"), this);
         this.cfgPrinterTracker.open();
 
         this.pluginRegistration = DefaultWebConsolePlugin.register(btx, this);
@@ -85,12 +88,15 @@ public class InventoryPrinterManagerImpl
     /**
      * Dispose this service
      */
-    public void dispose() {
-        if ( this.pluginRegistration != null ) {
+    public void dispose()
+    {
+        if (this.pluginRegistration != null)
+        {
             this.pluginRegistration.unregister();
         }
         this.cfgPrinterTracker.close();
-        synchronized ( this.allAdapters ) {
+        synchronized (this.allAdapters)
+        {
             this.allAdapters.clear();
         }
         this.usedAdapters.clear();
@@ -99,117 +105,151 @@ public class InventoryPrinterManagerImpl
     /**
      * @see org.osgi.util.tracker.ServiceTrackerCustomizer#addingService(org.osgi.framework.ServiceReference)
      */
-    public Object addingService(final ServiceReference reference) {
+    public Object addingService(final ServiceReference reference)
+    {
         final Object obj = this.bundleContext.getService(reference);
-        if ( obj != null ) {
+        if (obj != null)
+        {
             this.addService(reference, obj);
         }
         return obj;
     }
 
     /**
-     * @see org.osgi.util.tracker.ServiceTrackerCustomizer#modifiedService(org.osgi.framework.ServiceReference, java.lang.Object)
+     * @see org.osgi.util.tracker.ServiceTrackerCustomizer#modifiedService(org.osgi.framework.ServiceReference,
+     *      java.lang.Object)
      */
-    public void modifiedService(final ServiceReference reference, final Object service) {
+    public void modifiedService(final ServiceReference reference, final Object service)
+    {
         this.removeService(reference);
         this.addService(reference, service);
     }
 
-    private void addService(final ServiceReference reference, final Object obj) {
+    private void addService(final ServiceReference reference, final Object obj)
+    {
         final InventoryPrinterDescription desc = new InventoryPrinterDescription(reference);
 
         boolean valid = true;
-        if ( desc.getModes() == null ) {
+        if (desc.getModes() == null)
+        {
             logger.info("Ignoring inventory printer - printer modes configuration is missing: {}", reference);
             valid = false;
         }
-        if ( desc.getName() == null ) {
+        if (desc.getName() == null)
+        {
             logger.info("Ignoring inventory printer - name configuration is missing: {}", reference);
             valid = false;
         }
-        if ( desc.getTitle() == null ) {
+        if (desc.getTitle() == null)
+        {
             logger.info("Ignoring inventory printer - title configuration is missing: {}", reference);
             valid = false;
         }
-        if ( valid ) {
+        if (valid)
+        {
             final InventoryPrinterAdapter adapter = InventoryPrinterAdapter.createAdapter(desc, obj);
-            if ( adapter == null ) {
+            if (adapter == null)
+            {
                 logger.info("Ignoring inventory printer - printer method is missing: {}", reference);
-            } else {
+            }
+            else
+            {
                 this.addAdapter(adapter);
             }
         }
     }
 
-    private void addAdapter(final InventoryPrinterAdapter adapter) {
+    private void addAdapter(final InventoryPrinterAdapter adapter)
+    {
         InventoryPrinterAdapter removeAdapter = null;
         InventoryPrinterAdapter addAdapter = null;
 
         final String key = adapter.getName();
-        synchronized ( this.allAdapters ) {
+        synchronized (this.allAdapters)
+        {
             List list = (List) this.allAdapters.get(key);
             final InventoryPrinterAdapter first;
-            if ( list == null ) {
+            if (list == null)
+            {
                 list = new LinkedList();
                 this.allAdapters.put(key, list);
                 first = null;
-            } else {
+            }
+            else
+            {
                 first = (InventoryPrinterAdapter) list.get(0);
             }
             list.add(adapter);
             Collections.sort(list, InventoryPrinterAdapter.RANKING_COMPARATOR);
-            if ( first != null ) {
-                if ( first != list.get(0) ) {
+            if (first != null)
+            {
+                if (first != list.get(0))
+                {
                     // update
                     removeAdapter = first;
                     addAdapter = adapter;
                 }
-            } else {
+            }
+            else
+            {
                 // add
                 addAdapter = adapter;
             }
         }
-        if ( removeAdapter != null ) {
+        if (removeAdapter != null)
+        {
             final Iterator i = this.usedAdapters.iterator();
-            while ( i.hasNext() ) {
-                if ( i.next() == removeAdapter ) {
+            while (i.hasNext())
+            {
+                if (i.next() == removeAdapter)
+                {
                     i.remove();
                     break;
                 }
             }
             removeAdapter.unregisterConsole();
         }
-        if ( addAdapter != null ) {
+        if (addAdapter != null)
+        {
             this.usedAdapters.add(addAdapter);
             addAdapter.registerConsole(this.bundleContext, this);
         }
     }
 
     /**
-     * @see org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(org.osgi.framework.ServiceReference, java.lang.Object)
+     * @see org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(org.osgi.framework.ServiceReference,
+     *      java.lang.Object)
      */
-    public void removedService(final ServiceReference reference, final Object service) {
+    public void removedService(final ServiceReference reference, final Object service)
+    {
         this.removeService(reference);
         this.bundleContext.ungetService(reference);
     }
 
-    private void removeService(final ServiceReference reference) {
-        synchronized ( this.allAdapters ) {
+    private void removeService(final ServiceReference reference)
+    {
+        synchronized (this.allAdapters)
+        {
             final Iterator i = this.allAdapters.entrySet().iterator();
-            while ( i.hasNext() ) {
+            while (i.hasNext())
+            {
                 final Map.Entry entry = (Entry) i.next();
                 final Iterator iter = ((List) entry.getValue()).iterator();
                 boolean removed = false;
-                while ( iter.hasNext() ) {
+                while (iter.hasNext())
+                {
                     final InventoryPrinterAdapter adapter = (InventoryPrinterAdapter) iter.next();
-                    if ( adapter.getDescription().getServiceReference().compareTo(reference) == 0 ) {
+                    if (adapter.getDescription().getServiceReference().compareTo(reference) == 0)
+                    {
                         iter.remove();
                         removed = true;
                         break;
                     }
                 }
-                if ( removed ) {
-                    if ( ((List)entry.getValue()).size() == 0 ) {
+                if (removed)
+                {
+                    if (((List) entry.getValue()).size() == 0)
+                    {
                         i.remove();
                     }
                     break;
@@ -217,9 +257,11 @@ public class InventoryPrinterManagerImpl
             }
         }
         final Iterator iter = this.usedAdapters.iterator();
-        while ( iter.hasNext() ) {
+        while (iter.hasNext())
+        {
             final InventoryPrinterAdapter adapter = (InventoryPrinterAdapter) iter.next();
-            if ( adapter.getDescription().getServiceReference().compareTo(reference) == 0 ) {
+            if (adapter.getDescription().getServiceReference().compareTo(reference) == 0)
+            {
                 iter.remove();
                 adapter.unregisterConsole();
                 break;
@@ -229,22 +271,29 @@ public class InventoryPrinterManagerImpl
 
     /**
      * Get all inventory printer handlers.
+     * 
      * @return A list of handlers - might be empty.
      */
-    public InventoryPrinterHandler[] getAllHandlers() {
-        return (InventoryPrinterHandler[]) this.usedAdapters.toArray(new InventoryPrinterHandler[this.usedAdapters.size()]);
+    public InventoryPrinterHandler[] getAllHandlers()
+    {
+        return (InventoryPrinterHandler[]) this.usedAdapters.toArray(new InventoryPrinterHandler[this.usedAdapters
+            .size()]);
     }
 
     /**
      * Get all handlers supporting the mode.
+     * 
      * @return A list of handlers - might be empty.
      */
-    public InventoryPrinterHandler[] getHandlers(final PrinterMode mode) {
+    public InventoryPrinterHandler[] getHandlers(final PrinterMode mode)
+    {
         final List result = new ArrayList();
         final Iterator i = this.usedAdapters.iterator();
-        while ( i .hasNext() ) {
+        while (i.hasNext())
+        {
             final InventoryPrinterAdapter printer = (InventoryPrinterAdapter) i.next();
-            if ( printer.supports(mode) ) {
+            if (printer.supports(mode))
+            {
                 result.add(printer);
             }
         }
@@ -253,13 +302,17 @@ public class InventoryPrinterManagerImpl
 
     /**
      * Return a handler for the unique name.
+     * 
      * @return The corresponding handler or <code>null</code>.
      */
-    public InventoryPrinterHandler getHandler(final String name) {
+    public InventoryPrinterHandler getHandler(final String name)
+    {
         final Iterator i = this.usedAdapters.iterator();
-        while ( i .hasNext() ) {
+        while (i.hasNext())
+        {
             final InventoryPrinterAdapter printer = (InventoryPrinterAdapter) i.next();
-            if ( name.equals(printer.getName()) ) {
+            if (name.equals(printer.getName()))
+            {
                 return printer;
             }
         }

Modified: felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/WebConsolePlugin.java
URL: http://svn.apache.org/viewvc/felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/WebConsolePlugin.java?rev=1451624&r1=1451623&r2=1451624&view=diff
==============================================================================
--- felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/WebConsolePlugin.java (original)
+++ felix/trunk/inventory/src/main/java/org/apache/felix/inventory/impl/WebConsolePlugin.java Fri Mar  1 15:56:39 2013
@@ -1,13 +1,13 @@
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
+ * contributor license agreements. See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
+ * the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,7 +28,8 @@ import org.osgi.framework.ServiceRegistr
 /**
  * The web console plugin for a inventory printer.
  */
-public class WebConsolePlugin extends AbstractWebConsolePlugin {
+public class WebConsolePlugin extends AbstractWebConsolePlugin
+{
 
     private static final long serialVersionUID = 1L;
 
@@ -37,35 +38,38 @@ public class WebConsolePlugin extends Ab
 
     /**
      * Constructor
+     * 
      * @param inventoryPrinterManager The inventory printer manager.
      * @param printerName The name of the printer this plugin is displaying.
      */
-    WebConsolePlugin(final InventoryPrinterManagerImpl inventoryPrinterManager,
-            final String printerName) {
+    WebConsolePlugin(final InventoryPrinterManagerImpl inventoryPrinterManager, final String printerName)
+    {
         super(inventoryPrinterManager);
         this.printerName = printerName;
     }
 
-    protected InventoryPrinterHandler getInventoryPrinterHandler() {
+    protected InventoryPrinterHandler getInventoryPrinterHandler()
+    {
         return this.inventoryPrinterManager.getHandler(this.printerName);
     }
 
-    public static ServiceRegistration register(
-            final BundleContext context,
-            final InventoryPrinterManagerImpl manager,
-            final InventoryPrinterDescription desc) {
+    public static ServiceRegistration register(final BundleContext context, final InventoryPrinterManagerImpl manager,
+        final InventoryPrinterDescription desc)
+    {
         final Dictionary props = new Hashtable();
         props.put(ConsoleConstants.PLUGIN_LABEL, "status-" + desc.getName());
         props.put(ConsoleConstants.PLUGIN_TITLE, desc.getTitle());
         props.put(ConsoleConstants.PLUGIN_CATEGORY, ConsoleConstants.WEB_CONSOLE_CATEGORY);
-        return context.registerService(ConsoleConstants.INTERFACE_SERVLET, new ServiceFactory() {
+        return context.registerService(ConsoleConstants.INTERFACE_SERVLET, new ServiceFactory()
+        {
 
-            public void ungetService(final Bundle bundle, final ServiceRegistration registration,
-                    final Object service) {
+            public void ungetService(final Bundle bundle, final ServiceRegistration registration, final Object service)
+            {
                 // nothing to do
             }
 
-            public Object getService(final Bundle bundle, final ServiceRegistration registration) {
+            public Object getService(final Bundle bundle, final ServiceRegistration registration)
+            {
                 return new WebConsolePlugin(manager, desc.getName());
             }
 



Mime
View raw message