FELIX-4025 Cleanup InventoryPrinter API

- Rename PrinterMode to Format
- Reorder InventoryPrinter.print arguments
- Rename InventoryPrinter constants
- Relax InventoryPrinter service property requirements

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1468887 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/inventory/src/main/java/org/apache/felix/inventory/Format.java b/inventory/src/main/java/org/apache/felix/inventory/Format.java
new file mode 100644
index 0000000..3ef7bd9
--- /dev/null
+++ b/inventory/src/main/java/org/apache/felix/inventory/Format.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.inventory;
+
+/**
+ * Java 1.4 compatible enumeration of formats used for inventory printing.
+ * <p>
+ * {@link InventoryPrinter} services indicate supported formats listing any of
+ * these values in their {@link InventoryPrinter#FORMAT} service
+ * properties.
+ * <p>
+ * Requestors of inventory printing indicate the desired output format by
+ * specifying the respective constant when calling the
+ * {@link InventoryPrinter#print(java.io.PrintWriter, Format, boolean)} method.
+ * <p>
+ * Round-tripping is guaranteed between the {@link #toString()} and
+ * {@link #valueOf(String)} methods.
+ */
+public final class Format
+{
+
+    /**
+     * Inventory is printed in plain text format.
+     */
+    public static Format TEXT = new Format("TEXT");
+
+    /**
+     * Inventory is printed in HTML format.
+     * <p>
+     * Technically the output is expected to be an HTML fragment which is
+     * intended to be inserted into any block element, such as {@code <div>},
+     * within a HTML {@code <body>}.
+     */
+    public static Format HTML = new Format("HTML");
+
+    /**
+     * Inventory is printed in JSON format.
+     * <p>
+     * The output is expected to be a valid JSON object. That is, the output
+     * must start with an opening curly brace (<code>{</code>) and end with a
+     * closing curly brace (<code>}</code>).
+     */
+    public static Format JSON = new Format("JSON");
+
+    private final String format;
+
+    private Format(final String format)
+    {
+        this.format = format;
+    }
+
+    /**
+     * Converts the given {@code format} string into an instance of
+     * this class.
+     *
+     * @param format The string value to be converted into a {@code Format}.
+     * @return One of the defined {@code Format} constants or {@code null}.
+     */
+    public static Format valueOf(final String format)
+    {
+        if (TEXT.format.equalsIgnoreCase(format))
+        {
+            return TEXT;
+        }
+        else if (HTML.format.equalsIgnoreCase(format))
+        {
+            return HTML;
+        }
+        else if (JSON.format.equalsIgnoreCase(format))
+        {
+            return JSON;
+        }
+        return null;
+    }
+
+    /**
+     * Returns the string value of this format.
+     */
+    public String toString()
+    {
+        return format;
+    }
+}
diff --git a/inventory/src/main/java/org/apache/felix/inventory/InventoryPrinter.java b/inventory/src/main/java/org/apache/felix/inventory/InventoryPrinter.java
index d1807cf..6ba5dd2 100644
--- a/inventory/src/main/java/org/apache/felix/inventory/InventoryPrinter.java
+++ b/inventory/src/main/java/org/apache/felix/inventory/InventoryPrinter.java
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License. You may obtain a copy of the License at
- * 
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -24,15 +24,15 @@
  * 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
+ * <p>
+ * The following service registration properties further declare the
+ * {@code InventoryPrinter} service:
  * <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 #FORMAT} - the supported formats</li>
+ * <li>{@link #TITLE} - the printer title</li>
+ * <li>{@link #NAME} - the printer name</li>
+ * <li>{@link #WEBCONSOLE} - whether to confine the printer to the Web Console</li>
  * </ul>
- * 
  */
 public interface InventoryPrinter
 {
@@ -41,60 +41,67 @@
      * The service name under which services of this class must be registered
      * to be picked for inclusion in the configuration report.
      */
-    String SERVICE = InventoryPrinter.class.getName(); //$NON-NLS-1$
+    String SERVICE = "org.apache.felix.inventory.InventoryPrinter"; //$NON-NLS-1$
 
     /**
-     * The property defining the supported rendering modes.
-     * 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.
+     * The property defining one or more supported formats. The value of this
+     * property is either a string, a string array or a Collection<String>
+     * containing valid names of the constants defined in the {@link Format}
+     * class.
+     * <p>
+     * Any unknown formats are ignored. If this property is not declared or does
+     * not declare any known formats, the {@link Format#TEXT} format is assumed
+     * as the printer's supported format.
      */
-    String CONFIG_PRINTER_MODES = "felix.inventory.printer.modes"; //$NON-NLS-1$
+    String FORMAT = "felix.inventory.printer.format"; //$NON-NLS-1$
 
     /**
-     * The unique name of the printer.
-     * If this property is missing the printer is ignored.
-     * If there are two or more services with the same name, the
-     * service with the highest ranking is used.
+     * The unique name (or label) of the printer.
+     * <p>
+     * If this property is missing or an empty string, the name is constructed
+     * from the string {@code InventoryPrinter} and the service's
+     * {@code service.id} property.
      */
-    String CONFIG_NAME = "felix.inventory.printer.name"; //$NON-NLS-1$
+    String NAME = "felix.inventory.printer.name"; //$NON-NLS-1$
 
     /**
      * The title displayed by tools when this printer is used. It should be
      * descriptive but short.
-     * If this property is missing the printer is ignored.
+     * <p>
+     * If this property is missing or an empty string, the {@link #NAME} value
+     * is used as the title.
      */
-    String CONFIG_TITLE = "felix.inventory.printer.title"; //$NON-NLS-1$
+    String TITLE = "felix.inventory.printer.title"; //$NON-NLS-1$
 
     /**
-     * Optional property controlling whether the printer will be displayed
-     * in the web console. By default, a printer is displayed in the
-     * web console, unless this property is added with the value 'false'.
-     * The property value can either be a boolean or a string.
+     * The inventory printer feature has first class integration with the
+     * Apache Felix Web Console. This service registration property can be used
+     * to hide an inventory printer service from the Web Console. The service
+     * will still be called to generate the single file or ZIP file output of
+     * inventory printers.
+     * <p>
+     * By default, a printer is displayed in the web console, unless this
+     * property is set to {@code false}. The property value can either be a
+     * boolean or a string.
      */
-    String CONFIG_WEBCONSOLE = "felix.inventory.printer.webconsole"; //$NON-NLS-1$
+    String WEBCONSOLE = "felix.inventory.printer.webconsole"; //$NON-NLS-1$
 
     /**
      * 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})
+     * <p>
+     * If a printer is invoked with a format it doesn't support ( {@link #FORMAT})
      * the printer should just do/print nothing and directly return.
-     * 
+     * <p>
      * 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 data. Implementations may flush the
+     *            writer but must not close it.
+     * @param format The render format.
      * @param isZip whether this is included in a ZIP file or used directly
      */
-    void print(PrinterMode mode, PrintWriter printWriter, boolean isZip);
+    void print(PrintWriter printWriter, Format format, boolean isZip);
 }
diff --git a/inventory/src/main/java/org/apache/felix/inventory/PrinterMode.java b/inventory/src/main/java/org/apache/felix/inventory/PrinterMode.java
deleted file mode 100644
index b213bbe..0000000
--- a/inventory/src/main/java/org/apache/felix/inventory/PrinterMode.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.felix.inventory;
-
-/**
- * Enumeration for the different printer modes.
- */
-public final class PrinterMode
-{
-
-    // plain text
-    public static PrinterMode TEXT = new PrinterMode("TEXT");
-
-    // valid HTML fragment (no external references)
-    public static PrinterMode HTML_FRAGMENT = new PrinterMode("HTML_FRAGMENT");
-
-    // JSON output
-    public static PrinterMode JSON = new PrinterMode("JSON");
-
-    private final String mode;
-
-    private PrinterMode(final String mode)
-    {
-        this.mode = mode;
-    }
-
-    public static PrinterMode valueOf(final String m)
-    {
-        if (TEXT.name().equalsIgnoreCase(m))
-        {
-            return TEXT;
-        }
-        else if (HTML_FRAGMENT.name().equalsIgnoreCase(m))
-        {
-            return HTML_FRAGMENT;
-        }
-        else if (JSON.name().equalsIgnoreCase(m))
-        {
-            return JSON;
-        }
-        return null;
-    }
-
-    public String name()
-    {
-        return this.mode;
-    }
-
-    public String toString()
-    {
-        return name();
-    }
-}
diff --git a/inventory/src/main/java/org/apache/felix/inventory/impl/AbstractWebConsolePlugin.java b/inventory/src/main/java/org/apache/felix/inventory/impl/AbstractWebConsolePlugin.java
index d5ae348..51855c3 100644
--- a/inventory/src/main/java/org/apache/felix/inventory/impl/AbstractWebConsolePlugin.java
+++ b/inventory/src/main/java/org/apache/felix/inventory/impl/AbstractWebConsolePlugin.java
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
- * 
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,7 +31,7 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.felix.inventory.PrinterMode;
+import org.apache.felix.inventory.Format;
 
 /**
  * The web console plugin for a inventory printer.
@@ -46,7 +46,7 @@
 
     /**
      * Constructor
-     * 
+     *
      * @param inventoryPrinterManager The manager
      */
     AbstractWebConsolePlugin(final InventoryPrinterManagerImpl inventoryPrinterManager)
@@ -56,22 +56,22 @@
 
     protected abstract InventoryPrinterHandler getInventoryPrinterHandler();
 
-    private void printConfigurationInventory(final ConfigurationWriter pw, final PrinterMode mode,
+    private void printConfigurationInventory(final ConfigurationWriter pw, final Format format,
         final InventoryPrinterHandler handler) throws IOException
     {
         if (handler == null)
         {
-            final InventoryPrinterHandler[] adapters = this.inventoryPrinterManager.getHandlers(mode);
+            final InventoryPrinterHandler[] adapters = this.inventoryPrinterManager.getHandlers(format);
             for (int i = 0; i < adapters.length; i++)
             {
-                pw.printInventory(mode, adapters[i]);
+                pw.printInventory(format, adapters[i]);
             }
         }
         else
         {
-            if (handler.supports(mode))
+            if (handler.supports(format))
             {
-                pw.printInventory(mode, handler);
+                pw.printInventory(format, handler);
             }
         }
     }
@@ -83,7 +83,7 @@
      * <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)
@@ -120,7 +120,7 @@
         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);
+            printConfigurationInventory(pw, Format.TEXT, handler);
             pw.flush();
         }
         else if (request.getPathInfo().endsWith(".zip")) { //$NON-NLS-2$
@@ -140,7 +140,7 @@
             final ZipEntry entry = new ZipEntry("timestamp.txt"); //$NON-NLS-2$
             entry.setTime(now.getTime());
             zip.putNextEntry(entry);
-            final StringBuilder sb = new StringBuilder();
+            final StringBuffer sb = new StringBuffer();
             sb.append("Date: ");
             synchronized (InventoryPrinterAdapter.DISPLAY_DATE_FORMAT)
             {
@@ -154,8 +154,8 @@
             zip.closeEntry();
 
             final ZipConfigurationWriter pw = new ZipConfigurationWriter(zip);
-            printConfigurationInventory(pw, PrinterMode.TEXT, handler);
-            printConfigurationInventory(pw, PrinterMode.JSON, handler);
+            printConfigurationInventory(pw, Format.TEXT, handler);
+            printConfigurationInventory(pw, Format.JSON, handler);
 
             zip.finish();
         }
@@ -174,20 +174,20 @@
             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(Format.HTML))
             {
-                handler.print(PrinterMode.HTML_FRAGMENT, pw, false);
+                handler.print(pw, Format.HTML, false);
             }
-            else if (handler.supports(PrinterMode.TEXT))
+            else if (handler.supports(Format.TEXT))
             {
                 pw.enableFilter(true);
-                handler.print(PrinterMode.TEXT, pw, false);
+                handler.print(pw, Format.TEXT, false);
                 pw.enableFilter(false);
             }
             else
             {
                 pw.enableFilter(true);
-                handler.print(PrinterMode.JSON, pw, false);
+                handler.print(pw, Format.JSON, false);
                 pw.enableFilter(false);
             }
             pw.println("</div></body></html>");
@@ -204,17 +204,17 @@
             response.setCharacterEncoding("UTF-8"); //$NON-NLS-1$
 
             final JSONConfigurationWriter jcw = new JSONConfigurationWriter(response.getWriter());
-            final PrinterMode mode;
-            if (handler.supports(PrinterMode.JSON))
+            final Format format;
+            if (handler.supports(Format.JSON))
             {
-                mode = PrinterMode.JSON;
+                format = Format.JSON;
             }
             else
             {
-                mode = PrinterMode.TEXT;
+                format = Format.TEXT;
                 jcw.startJSONWrapper();
             }
-            printConfigurationInventory(jcw, mode, handler);
+            printConfigurationInventory(jcw, format, handler);
             jcw.endJSONWrapper();
             jcw.flush();
         }
@@ -260,26 +260,26 @@
             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(Format.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(Format.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(Format.HTML))
             {
-                handler.print(PrinterMode.HTML_FRAGMENT, pw, false);
+                handler.print(pw, Format.HTML, false);
             }
             else
             {
                 pw.enableFilter(true);
-                handler.print(PrinterMode.TEXT, pw, false);
+                handler.print(pw, Format.TEXT, false);
                 pw.enableFilter(false);
             }
             pw.print("</div>");
@@ -307,10 +307,10 @@
             // dummy implementation
         }
 
-        public void printInventory(final PrinterMode mode, final InventoryPrinterHandler handler) throws IOException
+        public void printInventory(final Format format, final InventoryPrinterHandler handler) throws IOException
         {
             this.title(handler.getTitle());
-            handler.print(mode, this, false);
+            handler.print(this, format, false);
             this.end();
         }
     }
@@ -555,14 +555,14 @@
 
         /**
          * 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)
         {
-            final StringBuilder sb = new StringBuilder(text.length() * 4 / 3);
+            final StringBuffer sb = new StringBuffer(text.length() * 4 / 3);
             char ch, oldch = '_';
             for (int i = 0; i < text.length(); i++)
             {
@@ -637,29 +637,29 @@
             this.zip = zip;
         }
 
-        public void printInventory(final PrinterMode mode, final InventoryPrinterHandler handler) throws IOException
+        public void printInventory(final Format format, final InventoryPrinterHandler handler) throws IOException
         {
-            if (mode == PrinterMode.TEXT)
+            if (format == Format.TEXT)
             {
                 final ZipEntry entry = new ZipEntry(handler.getName().concat(".txt"));
                 zip.putNextEntry(entry);
-                handler.print(mode, this, false);
+                handler.print(this, format, false);
                 flush();
                 zip.closeEntry();
 
                 handler.addAttachments(handler.getName().concat("/"), this.zip);
             }
-            else if (mode == PrinterMode.JSON)
+            else if (format == Format.JSON)
             {
                 final String name = "json/".concat(handler.getName()).concat(".json");
 
                 final ZipEntry entry = new ZipEntry(name);
                 zip.putNextEntry(entry);
-                handler.print(PrinterMode.JSON, this, true);
+                handler.print(this, Format.JSON, true);
                 flush();
 
                 zip.closeEntry();
-                if (!handler.supports(PrinterMode.TEXT))
+                if (!handler.supports(Format.TEXT))
                 {
                     handler.addAttachments(handler.getName().concat("/"), this.zip);
                 }
diff --git a/inventory/src/main/java/org/apache/felix/inventory/impl/DefaultWebConsolePlugin.java b/inventory/src/main/java/org/apache/felix/inventory/impl/DefaultWebConsolePlugin.java
index 2e013aa..be50540 100644
--- a/inventory/src/main/java/org/apache/felix/inventory/impl/DefaultWebConsolePlugin.java
+++ b/inventory/src/main/java/org/apache/felix/inventory/impl/DefaultWebConsolePlugin.java
@@ -20,7 +20,7 @@
 import java.io.PrintWriter;
 import java.util.zip.ZipOutputStream;
 
-import org.apache.felix.inventory.PrinterMode;
+import org.apache.felix.inventory.Format;
 import org.apache.felix.inventory.impl.webconsole.ConsoleConstants;
 
 /**
@@ -63,27 +63,27 @@
     }
 
     /**
-     * @see org.apache.felix.inventory..implInventoryPrinterHandler#getModes()
+     * @see org.apache.felix.inventory..implInventoryPrinterHandler#getformats()
      */
-    public PrinterMode[] getModes()
+    public Format[] getFormats()
     {
-        return new PrinterMode[]
-            { PrinterMode.TEXT };
+        return new Format[]
+            { Format.TEXT };
     }
 
     /**
-     * @see org.apache.felix.inventory.impl.InventoryPrinterHandler#supports(org.apache.felix.inventory.PrinterMode)
+     * @see org.apache.felix.inventory.impl.InventoryPrinterHandler#supports(org.apache.felix.inventory.Format)
      */
-    public boolean supports(final PrinterMode mode)
+    public boolean supports(final Format format)
     {
-        return mode == PrinterMode.TEXT;
+        return format == Format.TEXT;
     }
 
     /**
-     * @see org.apache.felix.inventory.InventoryPrinter#print(org.apache.felix.inventory.PrinterMode,
-     *      java.io.PrintWriter, boolean)
+     * @see org.apache.felix.inventory.InventoryPrinter#print(java.io.PrintWriter,
+     *      org.apache.felix.inventory.Format, boolean)
      */
-    public void print(final PrinterMode mode, final PrintWriter printWriter, final boolean isZip)
+    public void print(final PrintWriter printWriter, final Format format, final boolean isZip)
     {
         final InventoryPrinterHandler[] handlers = this.inventoryPrinterManager.getAllHandlers();
         printWriter.print("Currently registered ");
diff --git a/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterAdapter.java b/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterAdapter.java
index 7e2e8df..b57c55f 100644
--- a/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterAdapter.java
+++ b/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterAdapter.java
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
- * 
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,14 +24,14 @@
 import java.util.zip.ZipOutputStream;
 
 import org.apache.felix.inventory.InventoryPrinter;
-import org.apache.felix.inventory.PrinterMode;
+import org.apache.felix.inventory.Format;
 import org.apache.felix.inventory.ZipAttachmentProvider;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
 
 /**
  * Helper class for a inventory printer.
- * 
+ *
  * The adapter simplifies accessing and working with the inventory printer.
  */
 public class InventoryPrinterAdapter implements InventoryPrinterHandler, Comparable
@@ -77,7 +77,7 @@
     {
         if (this.registration == null)
         {
-            final Object value = this.description.getServiceReference().getProperty(InventoryPrinter.CONFIG_WEBCONSOLE);
+            final Object value = this.description.getServiceReference().getProperty(InventoryPrinter.WEBCONSOLE);
             if (value == null || !"false".equalsIgnoreCase(value.toString()))
             {
                 this.registration = WebConsolePlugin.register(context, manager, this.description);
@@ -111,11 +111,11 @@
     }
 
     /**
-     * All supported modes.
+     * All supported formats.
      */
-    public PrinterMode[] getModes()
+    public Format[] getFormats()
     {
-        return this.description.getModes();
+        return this.description.getFormats();
     }
 
     /**
@@ -131,13 +131,13 @@
     }
 
     /**
-     * Whether the printer supports this mode.
+     * Whether the printer supports this format.
      */
-    public boolean supports(final PrinterMode mode)
+    public boolean supports(final Format format)
     {
-        for (int i = 0; i < this.description.getModes().length; i++)
+        for (int i = 0; i < this.description.getFormats().length; i++)
         {
-            if (this.description.getModes()[i] == mode)
+            if (this.description.getFormats()[i] == format)
             {
                 return true;
             }
@@ -146,14 +146,14 @@
     }
 
     /**
-     * @see org.apache.felix.inventory.InventoryPrinter#print(org.apache.felix.inventory.PrinterMode,
+     * @see org.apache.felix.inventory.InventoryPrinter#print(org.apache.felix.inventory.Format,
      *      java.io.PrintWriter)
      */
-    public void print(final PrinterMode mode, final PrintWriter printWriter, final boolean isZip)
+    public void print(final PrintWriter printWriter, final Format format, final boolean isZip)
     {
-        if (this.supports(mode))
+        if (this.supports(format))
         {
-            this.printer.print(mode, printWriter, isZip);
+            this.printer.print(printWriter, format, isZip);
         }
     }
 
diff --git a/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterDescription.java b/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterDescription.java
index a563ddf..3952c43 100644
--- a/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterDescription.java
+++ b/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterDescription.java
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
- * 
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,10 +16,11 @@
  */
 package org.apache.felix.inventory.impl;
 
+import java.util.ArrayList;
 import java.util.Arrays;
-
 import org.apache.felix.inventory.InventoryPrinter;
-import org.apache.felix.inventory.PrinterMode;
+import org.apache.felix.inventory.Format;
+import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceReference;
 
 /**
@@ -30,7 +31,7 @@
 
     private final ServiceReference reference;
 
-    private final PrinterMode[] modes;
+    private final Format[] formats;
 
     private final String name;
 
@@ -42,76 +43,79 @@
     {
         this.reference = ref;
 
-        // check modes
-        final Object modesCfg = ref.getProperty(InventoryPrinter.CONFIG_PRINTER_MODES);
-        if (modesCfg instanceof String)
+        // check formats
+        Format[] formats = null;
+        final Object formatsCfg = ref.getProperty(InventoryPrinter.FORMAT);
+        if (formatsCfg instanceof String)
         {
-            final PrinterMode mode = PrinterMode.valueOf((String) modesCfg);
-            if (mode != null)
+            final Format format = Format.valueOf((String) formatsCfg);
+            if (format != null)
             {
-                this.modes = new PrinterMode[]
-                    { mode };
-            }
-            else
-            {
-                this.modes = null;
+                formats = new Format[]
+                    { format };
             }
         }
-        else if (modesCfg instanceof String[])
+        else if (formatsCfg 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++)
+            final String[] formatsCfgArray = (String[]) formatsCfg;
+            final ArrayList formatList = new ArrayList();
+            for (int i = 0; i < formatsCfgArray.length; i++)
             {
-                pModes[i] = PrinterMode.valueOf(modesCfgArray[i]);
-                if (pModes[i] == null)
+                final Format format = Format.valueOf(formatsCfgArray[i]);
+                if (format != null)
                 {
-                    invalid = true;
+                    formatList.add(format);
                 }
             }
-            if (invalid)
+            if (!formatList.isEmpty())
             {
-                this.modes = null;
+                formats = (Format[]) formatList.toArray(new Format[formatList.size()]);
             }
-            else
-            {
-                this.modes = pModes;
-            }
-        }
-        else
-        {
-            this.modes = null;
         }
 
         // check name
-        if (ref.getProperty(InventoryPrinter.CONFIG_NAME) != null)
+        final String name;
+        if (ref.getProperty(InventoryPrinter.NAME) != null)
         {
-            this.name = ref.getProperty(InventoryPrinter.CONFIG_NAME).toString();
+            name = ref.getProperty(InventoryPrinter.NAME).toString();
         }
         else
         {
-            this.name = null;
+            name = "InventoryPrinter." + ref.getProperty(Constants.SERVICE_ID);
         }
 
         // check title
-        if (ref.getProperty(InventoryPrinter.CONFIG_TITLE) != null)
+        final String title;
+        String sortKey = null;
+        if (ref.getProperty(InventoryPrinter.TITLE) != null)
         {
-            this.title = ref.getProperty(InventoryPrinter.CONFIG_TITLE).toString();
-            if (this.title.startsWith("%"))
+            title = ref.getProperty(InventoryPrinter.TITLE).toString();
+            if (title.startsWith("%"))
             {
-                this.sortKey = this.title.substring(1);
-            }
-            else
-            {
-                this.sortKey = this.title;
+                sortKey = title.substring(1);
             }
         }
         else
         {
-            this.title = null;
-            this.sortKey = null;
+            title = name;
         }
+
+        // cleanup
+        if (formats == null)
+        {
+            formats = new Format[]
+                { Format.TEXT };
+        }
+        if (sortKey == null)
+        {
+            sortKey = title;
+        }
+
+        // set fields
+        this.formats = formats;
+        this.name = name;
+        this.title = title;
+        this.sortKey = sortKey;
     }
 
     public String getTitle()
@@ -129,9 +133,9 @@
         return this.name;
     }
 
-    public PrinterMode[] getModes()
+    public Format[] getFormats()
     {
-        return this.modes;
+        return this.formats;
     }
 
     public ServiceReference getServiceReference()
@@ -159,7 +163,7 @@
 
     public String toString()
     {
-        return "InventoryPrinterDescription [title=" + title + ", name=" + name + ", modes=" + Arrays.toString(modes)
+        return "InventoryPrinterDescription [title=" + title + ", name=" + name + ", formats=" + Arrays.toString(formats)
             + ", sortKey=" + sortKey + "]";
     }
 }
diff --git a/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterHandler.java b/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterHandler.java
index b630b6e..6ddb19a 100644
--- a/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterHandler.java
+++ b/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterHandler.java
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License. You may obtain a copy of the License at
- * 
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -19,13 +19,13 @@
 package org.apache.felix.inventory.impl;
 
 import org.apache.felix.inventory.InventoryPrinter;
-import org.apache.felix.inventory.PrinterMode;
+import org.apache.felix.inventory.Format;
 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.
  */
@@ -38,9 +38,9 @@
     /** The human readable title for the inventory printer. */
     String getTitle();
 
-    /** All supported modes. */
-    PrinterMode[] getModes();
+    /** All supported formats. */
+    Format[] getFormats();
 
-    /** Whether the printer supports this mode. */
-    boolean supports(final PrinterMode mode);
+    /** Whether the printer supports this format. */
+    boolean supports(final Format format);
 }
\ No newline at end of file
diff --git a/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterManagerImpl.java b/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterManagerImpl.java
index 17ab8f7..0d564b4 100644
--- a/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterManagerImpl.java
+++ b/inventory/src/main/java/org/apache/felix/inventory/impl/InventoryPrinterManagerImpl.java
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
- * 
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,7 +30,7 @@
 import java.util.concurrent.ConcurrentSkipListSet;
 
 import org.apache.felix.inventory.InventoryPrinter;
-import org.apache.felix.inventory.PrinterMode;
+import org.apache.felix.inventory.Format;
 import org.apache.felix.inventory.impl.webconsole.ConsoleConstants;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
@@ -38,7 +38,6 @@
 import org.osgi.framework.ServiceFactory;
 import org.osgi.framework.ServiceReference;
 import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.log.LogService;
 import org.osgi.util.tracker.ServiceTracker;
 import org.osgi.util.tracker.ServiceTrackerCustomizer;
 
@@ -70,7 +69,7 @@
 
     /**
      * Create the inventory printer manager
-     * 
+     *
      * @param btx Bundle Context
      * @throws InvalidSyntaxException Should only happen if we have an error in
      *             the code
@@ -153,34 +152,8 @@
     private void addService(final ServiceReference reference, final InventoryPrinter obj)
     {
         final InventoryPrinterDescription desc = new InventoryPrinterDescription(reference);
+        final InventoryPrinterAdapter adapter = new InventoryPrinterAdapter(desc, obj);
 
-        boolean valid = true;
-        if (desc.getModes() == null)
-        {
-            Activator.log(null, LogService.LOG_INFO,
-                "Ignoring inventory printer - printer modes configuration is missing: " + reference, null);
-            valid = false;
-        }
-        if (desc.getName() == null)
-        {
-            Activator.log(null, LogService.LOG_INFO, "Ignoring inventory printer - name configuration is missing: "
-                + reference, null);
-            valid = false;
-        }
-        if (desc.getTitle() == null)
-        {
-            Activator.log(null, LogService.LOG_INFO, "Ignoring inventory printer - title configuration is missing: "
-                + reference, null);
-            valid = false;
-        }
-        if (valid)
-        {
-            this.addAdapter(new InventoryPrinterAdapter(desc, obj));
-        }
-    }
-
-    private void addAdapter(final InventoryPrinterAdapter adapter)
-    {
         InventoryPrinterAdapter removeAdapter = null;
         InventoryPrinterAdapter addAdapter = null;
 
@@ -281,7 +254,7 @@
 
     /**
      * Get all inventory printer handlers.
-     * 
+     *
      * @return A list of handlers - might be empty.
      */
     public InventoryPrinterHandler[] getAllHandlers()
@@ -291,18 +264,18 @@
     }
 
     /**
-     * Get all handlers supporting the mode.
-     * 
+     * Get all handlers supporting the format.
+     *
      * @return A list of handlers - might be empty.
      */
-    public InventoryPrinterHandler[] getHandlers(final PrinterMode mode)
+    public InventoryPrinterHandler[] getHandlers(final Format format)
     {
         final List result = new ArrayList();
         final Iterator i = this.usedAdapters.iterator();
         while (i.hasNext())
         {
             final InventoryPrinterAdapter printer = (InventoryPrinterAdapter) i.next();
-            if (printer.supports(mode))
+            if (printer.supports(format))
             {
                 result.add(printer);
             }
@@ -312,7 +285,7 @@
 
     /**
      * Return a handler for the unique name.
-     * 
+     *
      * @return The corresponding handler or <code>null</code>.
      */
     public InventoryPrinterHandler getHandler(final String name)
diff --git a/inventory/src/main/java/org/apache/felix/inventory/impl/webconsole/ConfigurationPrinterAdapter.java b/inventory/src/main/java/org/apache/felix/inventory/impl/webconsole/ConfigurationPrinterAdapter.java
index 0b76aee..2148f32 100644
--- a/inventory/src/main/java/org/apache/felix/inventory/impl/webconsole/ConfigurationPrinterAdapter.java
+++ b/inventory/src/main/java/org/apache/felix/inventory/impl/webconsole/ConfigurationPrinterAdapter.java
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
- * 
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,7 +25,7 @@
 import java.util.List;
 import java.util.Set;
 
-import org.apache.felix.inventory.PrinterMode;
+import org.apache.felix.inventory.Format;
 import org.osgi.framework.ServiceReference;
 
 /**
@@ -213,17 +213,17 @@
         final Set list = new HashSet();
         if (this.match(ConsoleConstants.MODE_TXT) || this.match(ConsoleConstants.MODE_ZIP))
         {
-            list.add(PrinterMode.TEXT.name());
+            list.add(Format.TEXT.toString());
         }
         if (this.match(ConsoleConstants.MODE_WEB))
         {
             if (!escapeHtml)
             {
-                list.add(PrinterMode.HTML_FRAGMENT.name());
+                list.add(Format.HTML.toString());
             }
             else
             {
-                list.add(PrinterMode.TEXT.name());
+                list.add(Format.TEXT.toString());
             }
         }
         return (String[]) list.toArray(new String[list.size()]);
diff --git a/inventory/src/main/java/org/apache/felix/inventory/impl/webconsole/WebConsoleAdapter.java b/inventory/src/main/java/org/apache/felix/inventory/impl/webconsole/WebConsoleAdapter.java
index 299c9e7..24a57dc 100644
--- a/inventory/src/main/java/org/apache/felix/inventory/impl/webconsole/WebConsoleAdapter.java
+++ b/inventory/src/main/java/org/apache/felix/inventory/impl/webconsole/WebConsoleAdapter.java
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
- * 
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,7 +32,7 @@
 import java.util.zip.ZipOutputStream;
 
 import org.apache.felix.inventory.InventoryPrinter;
-import org.apache.felix.inventory.PrinterMode;
+import org.apache.felix.inventory.Format;
 import org.apache.felix.inventory.ZipAttachmentProvider;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
@@ -112,9 +112,9 @@
                 cpa.label = cpa.title;
             }
             final Dictionary props = new Hashtable();
-            props.put(InventoryPrinter.CONFIG_NAME, cpa.label);
-            props.put(InventoryPrinter.CONFIG_TITLE, cpa.title);
-            props.put(InventoryPrinter.CONFIG_PRINTER_MODES, cpa.getPrinterModes());
+            props.put(InventoryPrinter.NAME, cpa.label);
+            props.put(InventoryPrinter.TITLE, cpa.title);
+            props.put(InventoryPrinter.FORMAT, cpa.getPrinterModes());
 
             final ServiceRegistration reg = this.bundleContext.registerService(InventoryPrinter.class.getName(),
                 new WebConsolePrinter(cpa), props);
@@ -182,21 +182,21 @@
         }
 
         /**
-         * @see org.apache.felix.inventory.InventoryPrinter#print(org.apache.felix.inventory.PrinterMode,
+         * @see org.apache.felix.inventory.InventoryPrinter#print(org.apache.felix.inventory.Format,
          *      java.io.PrintWriter)
          */
-        public void print(final PrinterMode mode, final PrintWriter printWriter, final boolean isZip)
+        public void print(final PrintWriter printWriter, final Format format, final boolean isZip)
         {
             final String m;
-            if (!isZip && mode == PrinterMode.HTML_FRAGMENT)
+            if (!isZip && format == Format.HTML)
             {
                 m = ConsoleConstants.MODE_WEB;
             }
-            else if (!isZip && mode == PrinterMode.TEXT)
+            else if (!isZip && format == Format.TEXT)
             {
                 m = ConsoleConstants.MODE_TXT;
             }
-            else if (isZip && (mode == PrinterMode.TEXT || mode == PrinterMode.HTML_FRAGMENT))
+            else if (isZip && (format == Format.TEXT || format == Format.HTML))
             {
                 m = ConsoleConstants.MODE_ZIP;
             }
diff --git a/inventory/src/test/java/org/apache/felix/inventory/FormatTest.java b/inventory/src/test/java/org/apache/felix/inventory/FormatTest.java
new file mode 100644
index 0000000..5d3131c
--- /dev/null
+++ b/inventory/src/test/java/org/apache/felix/inventory/FormatTest.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.inventory;
+
+import junit.framework.TestCase;
+
+public class FormatTest extends TestCase
+{
+
+    public void test_valueOf()
+    {
+        TestCase.assertSame(Format.TEXT, Format.valueOf("TEXT"));
+        TestCase.assertSame(Format.JSON, Format.valueOf("JSON"));
+        TestCase.assertSame(Format.HTML, Format.valueOf("HTML"));
+
+        TestCase.assertSame(Format.TEXT, Format.valueOf("text"));
+        TestCase.assertSame(Format.JSON, Format.valueOf("json"));
+        TestCase.assertSame(Format.HTML, Format.valueOf("html"));
+
+        TestCase.assertSame(Format.TEXT, Format.valueOf("Text"));
+        TestCase.assertSame(Format.JSON, Format.valueOf("Json"));
+        TestCase.assertSame(Format.HTML, Format.valueOf("HtMl"));
+
+        TestCase.assertNull(Format.valueOf("unsupported_name"));
+    }
+
+    public void test_toString()
+    {
+        TestCase.assertEquals("TEXT", Format.TEXT.toString());
+        TestCase.assertEquals("JSON", Format.JSON.toString());
+        TestCase.assertEquals("HTML", Format.HTML.toString());
+    }
+
+    public void test_equals()
+    {
+        TestCase.assertTrue(Format.TEXT.equals(Format.TEXT));
+        TestCase.assertFalse(Format.TEXT.equals(Format.JSON));
+        TestCase.assertFalse(Format.TEXT.equals(Format.HTML));
+
+        TestCase.assertFalse(Format.JSON.equals(Format.TEXT));
+        TestCase.assertTrue(Format.JSON.equals(Format.JSON));
+        TestCase.assertFalse(Format.JSON.equals(Format.HTML));
+
+        TestCase.assertFalse(Format.HTML.equals(Format.TEXT));
+        TestCase.assertFalse(Format.HTML.equals(Format.JSON));
+        TestCase.assertTrue(Format.HTML.equals(Format.HTML));
+    }
+
+}
diff --git a/inventory/src/test/java/org/apache/felix/inventory/PrinterModeTest.java b/inventory/src/test/java/org/apache/felix/inventory/PrinterModeTest.java
deleted file mode 100644
index f2db39d..0000000
--- a/inventory/src/test/java/org/apache/felix/inventory/PrinterModeTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.felix.inventory;
-
-import junit.framework.TestCase;
-
-public class PrinterModeTest extends TestCase
-{
-
-    public void test_valueOf()
-    {
-        TestCase.assertSame(PrinterMode.TEXT, PrinterMode.valueOf("TEXT"));
-        TestCase.assertSame(PrinterMode.JSON, PrinterMode.valueOf("JSON"));
-        TestCase.assertSame(PrinterMode.HTML_FRAGMENT, PrinterMode.valueOf("HTML_FRAGMENT"));
-
-        TestCase.assertSame(PrinterMode.TEXT, PrinterMode.valueOf("text"));
-        TestCase.assertSame(PrinterMode.JSON, PrinterMode.valueOf("json"));
-        TestCase.assertSame(PrinterMode.HTML_FRAGMENT, PrinterMode.valueOf("html_fragment"));
-
-        TestCase.assertSame(PrinterMode.TEXT, PrinterMode.valueOf("Text"));
-        TestCase.assertSame(PrinterMode.JSON, PrinterMode.valueOf("Json"));
-        TestCase.assertSame(PrinterMode.HTML_FRAGMENT, PrinterMode.valueOf("HTML_Fragment"));
-
-        TestCase.assertNull(PrinterMode.valueOf("unsupported_name"));
-    }
-
-    public void test_name()
-    {
-        TestCase.assertEquals("TEXT", PrinterMode.TEXT.name());
-        TestCase.assertEquals("JSON", PrinterMode.JSON.name());
-        TestCase.assertEquals("HTML_FRAGMENT", PrinterMode.HTML_FRAGMENT.name());
-    }
-
-    public void test_equals()
-    {
-        TestCase.assertTrue(PrinterMode.TEXT.equals(PrinterMode.TEXT));
-        TestCase.assertFalse(PrinterMode.TEXT.equals(PrinterMode.JSON));
-        TestCase.assertFalse(PrinterMode.TEXT.equals(PrinterMode.HTML_FRAGMENT));
-
-        TestCase.assertFalse(PrinterMode.JSON.equals(PrinterMode.TEXT));
-        TestCase.assertTrue(PrinterMode.JSON.equals(PrinterMode.JSON));
-        TestCase.assertFalse(PrinterMode.JSON.equals(PrinterMode.HTML_FRAGMENT));
-
-        TestCase.assertFalse(PrinterMode.HTML_FRAGMENT.equals(PrinterMode.TEXT));
-        TestCase.assertFalse(PrinterMode.HTML_FRAGMENT.equals(PrinterMode.JSON));
-        TestCase.assertTrue(PrinterMode.HTML_FRAGMENT.equals(PrinterMode.HTML_FRAGMENT));
-    }
-
-}