Rename status printer to inventory
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1448277 13f79535-47bb-0310-9956-ffa450edef68
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 8310730..4683373 100644
--- a/inventory/src/main/java/org/apache/felix/inventory/InventoryPrinter.java
+++ b/inventory/src/main/java/org/apache/felix/inventory/InventoryPrinter.java
@@ -21,24 +21,24 @@
import java.io.PrintWriter;
/**
- * The <code>StatusPrinter</code> is a service interface to be
+ * 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 status 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>
* </ul>
*/
-public interface StatusPrinter {
+public interface InventoryPrinter {
/**
* The service name under which services of this class must be registered
* to be picked for inclusion in the configuration report.
*/
- String SERVICE = StatusPrinter.class.getName(); //$NON-NLS-1$
+ String SERVICE = InventoryPrinter.class.getName(); //$NON-NLS-1$
/**
* The property defining the supported rendering modes.
@@ -48,7 +48,7 @@
* If this property is missing or contains invalid values,
* the printer is ignored.
*/
- String CONFIG_PRINTER_MODES = "felix.statusprinter.modes"; //$NON-NLS-1$
+ String CONFIG_PRINTER_MODES = "felix.inventory.printer.modes"; //$NON-NLS-1$
/**
* The unique name of the printer.
@@ -56,20 +56,20 @@
* If there are two or more services with the same name, the
* services with the highest ranking is used.
*/
- String CONFIG_NAME = "felix.statusprinter.name"; //$NON-NLS-1$
+ String CONFIG_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.
*/
- String CONFIG_TITLE = "felix.statusprinter.title"; //$NON-NLS-1$
+ String CONFIG_TITLE = "felix.inventory.printer.title"; //$NON-NLS-1$
/**
* The category under which this printer is categorized.
* This property is optional.
*/
- String CONFIG_CATEGORY = "felix.statusprinter.category"; //$NON-NLS-1$
+ String CONFIG_CATEGORY = "felix.inventory.printer.category"; //$NON-NLS-1$
/**
* Prints the configuration report to the given <code>printWriter</code>.
diff --git a/inventory/src/main/java/org/apache/felix/inventory/InventoryPrinterHandler.java b/inventory/src/main/java/org/apache/felix/inventory/InventoryPrinterHandler.java
index af58e8c..1c51a21 100644
--- a/inventory/src/main/java/org/apache/felix/inventory/InventoryPrinterHandler.java
+++ b/inventory/src/main/java/org/apache/felix/inventory/InventoryPrinterHandler.java
@@ -20,19 +20,19 @@
/**
- * The status printer handler can be used by clients to access
- * a status printer. The handlers can be get from the {@link StatusPrinterManager}.
+ * The inventory printer handler can be used by clients to access
+ * a inventory printer. The handlers can be get from the {@link InventoryPrinterManager}.
*
- * For clients using status printers, a handler simplifies accessing and
- * working with the status printer. A client should never lookup a
- * status printer directly.
+ * For clients using inventory printers, a handler simplifies accessing and
+ * working with the inventory printer. A client should never lookup a
+ * inventory printer directly.
*/
-public interface StatusPrinterHandler extends StatusPrinter, ZipAttachmentProvider {
+public interface InventoryPrinterHandler extends InventoryPrinter, ZipAttachmentProvider {
/** The unique name of the printer. */
String getName();
- /** The human readable title for the status printer. */
+ /** The human readable title for the inventory printer. */
String getTitle();
/** The optional category for this printer. */
diff --git a/inventory/src/main/java/org/apache/felix/inventory/InventoryPrinterManager.java b/inventory/src/main/java/org/apache/felix/inventory/InventoryPrinterManager.java
index 84b785f..16ba159 100644
--- a/inventory/src/main/java/org/apache/felix/inventory/InventoryPrinterManager.java
+++ b/inventory/src/main/java/org/apache/felix/inventory/InventoryPrinterManager.java
@@ -19,28 +19,28 @@
package org.apache.felix.inventory;
/**
- * The manager allows to access status printers.
- * Instead of directly returning a status printer, a status
+ * The manager allows to access inventory printers.
+ * Instead of directly returning a inventory printer, a inventory
* printer handler is returned which provides access to the
* meta information of the printer and other utility methods.
*/
-public interface StatusPrinterManager {
+public interface InventoryPrinterManager {
/**
- * Get all status printer handlers.
+ * Get all inventory printer handlers.
* @return A list of handlers - might be empty.
*/
- StatusPrinterHandler[] getAllHandlers();
+ InventoryPrinterHandler[] getAllHandlers();
/**
* Get all handlers supporting the mode.
* @return A list of handlers - might be empty.
*/
- StatusPrinterHandler[] getHandlers( final PrinterMode mode);
+ InventoryPrinterHandler[] getHandlers( final PrinterMode mode);
/**
* Return a handler for the unique name.
* @return The corresponding handler or <code>null</code>.
*/
- StatusPrinterHandler getHandler( final String name );
+ InventoryPrinterHandler getHandler( final String name );
}
diff --git a/inventory/src/main/java/org/apache/felix/inventory/ZipAttachmentProvider.java b/inventory/src/main/java/org/apache/felix/inventory/ZipAttachmentProvider.java
index f60691c..e1e0e2c 100644
--- a/inventory/src/main/java/org/apache/felix/inventory/ZipAttachmentProvider.java
+++ b/inventory/src/main/java/org/apache/felix/inventory/ZipAttachmentProvider.java
@@ -22,18 +22,18 @@
import java.util.zip.ZipOutputStream;
/**
- * This is an optional extension of the {@link StatusPrinter}.
- * If a status printer implements this interface, the printer
+ * This is an optional extension of the {@link InventoryPrinter}.
+ * If a inventory printer implements this interface, the printer
* can add additional attachments to the output of the
- * configuration zip.
+ * configuration ZIP.
*
* A service implementing this method must still register itself
- * as a {@link StatusPrinter} but not as a
+ * 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 extends StatusPrinter {
+public interface ZipAttachmentProvider extends InventoryPrinter {
/**
* Add attachments to the zip output stream.
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 c9767ce..b70efef 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
@@ -31,41 +31,41 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.apache.felix.inventory.InventoryPrinterHandler;
+import org.apache.felix.inventory.InventoryPrinterManager;
import org.apache.felix.inventory.PrinterMode;
-import org.apache.felix.inventory.StatusPrinterHandler;
-import org.apache.felix.inventory.StatusPrinterManager;
/**
- * The web console plugin for a status printer.
+ * The web console plugin for a inventory printer.
*/
public abstract class AbstractWebConsolePlugin extends HttpServlet {
private static final long serialVersionUID = 1L;
- /** The status printer manager. */
- protected final StatusPrinterManager statusPrinterManager;
+ /** The inventory printer manager. */
+ protected final InventoryPrinterManager inventoryPrinterManager;
/**
* Constructor
- * @param statusPrinterManager The manager
+ * @param inventoryPrinterManager The manager
*/
- AbstractWebConsolePlugin(final StatusPrinterManager statusPrinterManager) {
- this.statusPrinterManager = statusPrinterManager;
+ AbstractWebConsolePlugin(final InventoryPrinterManager inventoryPrinterManager) {
+ this.inventoryPrinterManager = inventoryPrinterManager;
}
- protected abstract StatusPrinterHandler getStatusPrinterHandler();
+ protected abstract InventoryPrinterHandler getInventoryPrinterHandler();
- private void printConfigurationStatus( final ConfigurationWriter pw,
+ private void printConfigurationInventory( final ConfigurationWriter pw,
final PrinterMode mode,
- final StatusPrinterHandler handler )
+ final InventoryPrinterHandler handler )
throws IOException {
if ( handler == null ) {
- for(final StatusPrinterHandler sph : this.statusPrinterManager.getHandlers(mode)) {
- pw.printStatus(mode, sph);
+ for(final InventoryPrinterHandler sph : this.inventoryPrinterManager.getHandlers(mode)) {
+ pw.printInventory(mode, sph);
}
} else {
if ( handler.supports(mode) ) {
- pw.printStatus(mode, handler);
+ pw.printInventory(mode, handler);
}
}
}
@@ -96,11 +96,11 @@
this.setNoCache( response );
// full request?
- final StatusPrinterHandler handler;
+ final InventoryPrinterHandler handler;
if ( request.getPathInfo().lastIndexOf('/') > 0 ) {
handler = null; // all;
} else {
- handler = this.getStatusPrinterHandler();
+ handler = this.getInventoryPrinterHandler();
if ( handler == null ) {
response.sendError( HttpServletResponse.SC_NOT_FOUND );
return;
@@ -110,7 +110,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() );
- printConfigurationStatus( pw, PrinterMode.TEXT, handler );
+ printConfigurationInventory( pw, PrinterMode.TEXT, handler );
pw.flush();
} else if ( request.getPathInfo().endsWith( ".zip" ) ) { //$NON-NLS-2$
String type = getServletContext().getMimeType( request.getPathInfo() );
@@ -130,8 +130,8 @@
zip.putNextEntry( entry );
final StringBuilder sb = new StringBuilder();
sb.append("Date: ");
- synchronized ( StatusPrinterAdapter.DISPLAY_DATE_FORMAT ) {
- sb.append(StatusPrinterAdapter.DISPLAY_DATE_FORMAT.format(now));
+ synchronized ( InventoryPrinterAdapter.DISPLAY_DATE_FORMAT ) {
+ sb.append(InventoryPrinterAdapter.DISPLAY_DATE_FORMAT.format(now));
}
sb.append(" (");
sb.append(String.valueOf(now.getTime()));
@@ -141,9 +141,9 @@
zip.closeEntry();
final ZipConfigurationWriter pw = new ZipConfigurationWriter( zip );
- printConfigurationStatus( pw, PrinterMode.ZIP_FILE_TEXT, handler );
+ printConfigurationInventory( pw, PrinterMode.ZIP_FILE_TEXT, handler );
pw.counter = 0;
- printConfigurationStatus( pw, PrinterMode.ZIP_FILE_JSON, handler );
+ printConfigurationInventory( pw, PrinterMode.ZIP_FILE_JSON, handler );
zip.finish();
} else if ( request.getPathInfo().endsWith( ".nfo" ) ) {
@@ -177,7 +177,7 @@
response.setCharacterEncoding( "UTF-8" ); //$NON-NLS-1$
final JSONConfigurationWriter jcw = new JSONConfigurationWriter(response.getWriter());
- printConfigurationStatus( jcw, PrinterMode.JSON, handler );
+ printConfigurationInventory( jcw, PrinterMode.JSON, handler );
} else {
if ( handler == null ) {
response.sendError( HttpServletResponse.SC_NOT_FOUND);
@@ -209,9 +209,9 @@
pw.println( "<br/><p class=\"statline\">");
final Date currentTime = new Date();
- synchronized ( StatusPrinterAdapter.DISPLAY_DATE_FORMAT ) {
+ synchronized ( InventoryPrinterAdapter.DISPLAY_DATE_FORMAT ) {
pw.print("Date: ");
- pw.println(StatusPrinterAdapter.DISPLAY_DATE_FORMAT.format(currentTime));
+ pw.println(InventoryPrinterAdapter.DISPLAY_DATE_FORMAT.format(currentTime));
}
pw.print("<button type=\"button\" class=\"downloadFullZip\" style=\"float: right; margin-right: 30px; margin-top: 5px;\">Download Full Zip</button>");
@@ -258,9 +258,9 @@
// dummy implementation
}
- public void printStatus(
+ public void printInventory(
final PrinterMode mode,
- final StatusPrinterHandler handler)
+ final InventoryPrinterHandler handler)
throws IOException {
this.title(handler.getTitle());
handler.print(mode, this);
@@ -413,9 +413,9 @@
/**
* The ZIP configuration writer creates a zip with
- * - txt output of a status printers (if supported)
- * - json output of a status printers (if supported)
- * - attachments from a status printer (if supported)
+ * - txt output of a inventory printers (if supported)
+ * - json output of a inventory printers (if supported)
+ * - attachments from a inventory printer (if supported)
*/
private static class ZipConfigurationWriter extends ConfigurationWriter {
@@ -451,13 +451,13 @@
}
@Override
- public void printStatus(
+ public void printInventory(
final PrinterMode mode,
- final StatusPrinterHandler handler)
+ final InventoryPrinterHandler handler)
throws IOException {
final String title = getFormattedTitle(handler.getTitle());
if ( mode == PrinterMode.ZIP_FILE_TEXT ) {
- super.printStatus(mode, handler);
+ super.printInventory(mode, handler);
handler.addAttachments(title.concat("/"), this.zip);
} else {
counter++;
diff --git a/inventory/src/main/java/org/apache/felix/inventory/impl/Activator.java b/inventory/src/main/java/org/apache/felix/inventory/impl/Activator.java
index 504992a..959973c 100644
--- a/inventory/src/main/java/org/apache/felix/inventory/impl/Activator.java
+++ b/inventory/src/main/java/org/apache/felix/inventory/impl/Activator.java
@@ -19,7 +19,7 @@
import java.util.Dictionary;
import java.util.Hashtable;
-import org.apache.felix.inventory.StatusPrinterManager;
+import org.apache.felix.inventory.InventoryPrinterManager;
import org.apache.felix.inventory.impl.webconsole.WebConsoleAdapter;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
@@ -31,7 +31,7 @@
*/
public class Activator implements BundleActivator {
- private StatusPrinterManagerImpl printerManager;
+ private InventoryPrinterManagerImpl printerManager;
private ServiceRegistration managerRegistration;
@@ -42,12 +42,12 @@
*/
public void start(final BundleContext context) throws Exception {
this.webAdapter = new WebConsoleAdapter(context);
- this.printerManager = new StatusPrinterManagerImpl(context);
+ this.printerManager = new InventoryPrinterManagerImpl(context);
final Dictionary<String, Object> props = new Hashtable<String, Object>();
- props.put(Constants.SERVICE_DESCRIPTION, "Apache Felix Status Printer Manager");
+ props.put(Constants.SERVICE_DESCRIPTION, "Apache Felix Inventory Printer Manager");
props.put(Constants.SERVICE_VENDOR, "The Apache Software Foundation");
this.managerRegistration = context.registerService(
- StatusPrinterManager.class.getName(),
+ InventoryPrinterManager.class.getName(),
this.printerManager, props);
}
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 2f90611..66f0d85 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
@@ -22,9 +22,9 @@
import java.util.Hashtable;
import java.util.zip.ZipOutputStream;
+import org.apache.felix.inventory.InventoryPrinterHandler;
+import org.apache.felix.inventory.InventoryPrinterManager;
import org.apache.felix.inventory.PrinterMode;
-import org.apache.felix.inventory.StatusPrinterHandler;
-import org.apache.felix.inventory.StatusPrinterManager;
import org.apache.felix.inventory.impl.webconsole.ConsoleConstants;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -32,76 +32,76 @@
import org.osgi.framework.ServiceRegistration;
/**
- * The web console plugin for a status printer.
+ * The web console plugin for a inventory printer.
*/
-public class DefaultWebConsolePlugin extends AbstractWebConsolePlugin implements StatusPrinterHandler {
+public class DefaultWebConsolePlugin extends AbstractWebConsolePlugin implements InventoryPrinterHandler {
private static final long serialVersionUID = 1L;
/**
* Constructor
- * @param statusPrinterAdapter The adapter
+ * @param inventoryPrinterAdapter The adapter
*/
- DefaultWebConsolePlugin(final StatusPrinterManager statusPrinterManager) {
- super(statusPrinterManager);
+ DefaultWebConsolePlugin(final InventoryPrinterManager inventoryPrinterManager) {
+ super(inventoryPrinterManager);
}
@Override
- protected StatusPrinterHandler getStatusPrinterHandler() {
+ protected InventoryPrinterHandler getInventoryPrinterHandler() {
return this;
}
/**
- * @see org.apache.felix.status.StatusPrinterHandler#getTitle()
+ * @see org.apache.felix.inventory.InventoryPrinterHandler#getTitle()
*/
public String getTitle() {
return "Overview";
}
/**
- * @see org.apache.felix.status.StatusPrinterHandler#getName()
+ * @see org.apache.felix.inventory.InventoryPrinterHandler#getName()
*/
public String getName() {
return "config";
}
/**
- * @see org.apache.felix.status.StatusPrinterHandler#getCategory()
+ * @see org.apache.felix.inventory.InventoryPrinterHandler#getCategory()
*/
public String getCategory() {
- return "Status";
+ return "Inventory";
}
/**
- * @see org.apache.felix.status.StatusPrinterHandler#getModes()
+ * @see org.apache.felix.inventory.InventoryPrinterHandler#getModes()
*/
public PrinterMode[] getModes() {
return new PrinterMode[] {PrinterMode.TEXT};
}
/**
- * @see org.apache.felix.status.StatusPrinterHandler#supports(org.apache.felix.status.PrinterMode)
+ * @see org.apache.felix.inventory.InventoryPrinterHandler#supports(org.apache.felix.inventory.PrinterMode)
*/
public boolean supports(final PrinterMode mode) {
return mode == PrinterMode.TEXT;
}
/**
- * @see org.apache.felix.status.StatusPrinter#print(org.apache.felix.status.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 StatusPrinterHandler[] handlers = this.statusPrinterManager.getAllHandlers();
+ final InventoryPrinterHandler[] handlers = this.inventoryPrinterManager.getAllHandlers();
printWriter.print("Currently registered ");
printWriter.print(String.valueOf(handlers.length));
- printWriter.println(" status printer.");
+ printWriter.println(" inventory printer.");
printWriter.println();
- for(final StatusPrinterHandler handler : handlers) {
+ for(final InventoryPrinterHandler handler : handlers) {
printWriter.println(handler.getTitle());
}
}
/**
- * @see org.apache.felix.status.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 {
@@ -109,7 +109,7 @@
}
public static ServiceRegistration register(final BundleContext context,
- final StatusPrinterManager manager) {
+ final InventoryPrinterManager manager) {
final DefaultWebConsolePlugin dwcp = new DefaultWebConsolePlugin(manager);
final Dictionary<String, Object> props = new Hashtable<String, Object>();
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 12ac846..ab12d52 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
@@ -24,21 +24,21 @@
import java.util.Locale;
import java.util.zip.ZipOutputStream;
+import org.apache.felix.inventory.InventoryPrinter;
+import org.apache.felix.inventory.InventoryPrinterHandler;
+import org.apache.felix.inventory.InventoryPrinterManager;
import org.apache.felix.inventory.PrinterMode;
-import org.apache.felix.inventory.StatusPrinter;
-import org.apache.felix.inventory.StatusPrinterHandler;
-import org.apache.felix.inventory.StatusPrinterManager;
import org.apache.felix.inventory.ZipAttachmentProvider;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
/**
- * Helper class for a status printer.
+ * Helper class for a inventory printer.
*/
-public class StatusPrinterAdapter implements StatusPrinterHandler, Comparable<StatusPrinterAdapter> {
+public class InventoryPrinterAdapter implements InventoryPrinterHandler, Comparable<InventoryPrinterAdapter> {
/**
- * Formatter pattern to render the current time of status generation.
+ * Formatter pattern to render the current time of inventory generation.
*/
static final DateFormat DISPLAY_DATE_FORMAT = DateFormat.getDateTimeInstance( DateFormat.LONG,
DateFormat.LONG, Locale.US );
@@ -48,11 +48,11 @@
* the print method.
* @return An adapter or <code>null</code> if the method is missing.
*/
- public static StatusPrinterAdapter createAdapter(final StatusPrinterDescription description,
+ public static InventoryPrinterAdapter createAdapter(final InventoryPrinterDescription description,
final Object service) {
Method printMethod = null;
- if ( !(service instanceof StatusPrinter) ) {
+ if ( !(service instanceof InventoryPrinter) ) {
// print(String, PrintWriter)
printMethod = ClassUtils.searchMethod(service.getClass(), "print",
@@ -68,7 +68,7 @@
attachmentMethod = ClassUtils.searchMethod(service.getClass(), "addAttachments",
new Class[] {String.class, ZipOutputStream.class});
}
- return new StatusPrinterAdapter(
+ return new InventoryPrinterAdapter(
description,
service,
printMethod,
@@ -78,18 +78,18 @@
/**
* Comparator for adapters based on the service ranking.
*/
- public static final Comparator<StatusPrinterAdapter> RANKING_COMPARATOR = new Comparator<StatusPrinterAdapter>() {
+ public static final Comparator<InventoryPrinterAdapter> RANKING_COMPARATOR = new Comparator<InventoryPrinterAdapter>() {
- public int compare(final StatusPrinterAdapter o1, final StatusPrinterAdapter o2) {
+ public int compare(final InventoryPrinterAdapter o1, final InventoryPrinterAdapter o2) {
return o1.description.compareTo(o2.description);
}
};
- /** The status printer service. */
+ /** The Inventory printer service. */
private final Object printer;
/** The printer description. */
- private final StatusPrinterDescription description;
+ private final InventoryPrinterDescription description;
/** The method to use if printer does not implement the service interface. */
private final Method printMethod;
@@ -102,7 +102,7 @@
/**
* Constructor.
*/
- public StatusPrinterAdapter( final StatusPrinterDescription description,
+ public InventoryPrinterAdapter( final InventoryPrinterDescription description,
final Object printer,
final Method printMethod,
final Method attachmentMethod) {
@@ -112,7 +112,7 @@
this.attachmentMethod = attachmentMethod;
}
- public void registerConsole(final BundleContext context, final StatusPrinterManager manager) {
+ public void registerConsole(final BundleContext context, final InventoryPrinterManager manager) {
if ( this.registration == null &&
(supports(PrinterMode.HTML_BODY) || supports(PrinterMode.TEXT))) {
this.registration = WebConsolePlugin.register(context, manager, this.description);
@@ -127,35 +127,35 @@
}
/**
- * @see org.apache.felix.status.StatusPrinterHandler#getTitle()
+ * @see org.apache.felix.inventory.InventoryPrinterHandler#getTitle()
*/
public String getTitle() {
return this.description.getTitle();
}
/**
- * @see org.apache.felix.status.StatusPrinterHandler#getName()
+ * @see org.apache.felix.inventory.InventoryPrinterHandler#getName()
*/
public String getName() {
return this.description.getName();
}
/**
- * @see org.apache.felix.status.StatusPrinterHandler#getCategory()
+ * @see org.apache.felix.inventory.InventoryPrinterHandler#getCategory()
*/
public String getCategory() {
return this.description.getCategory();
}
/**
- * @see org.apache.felix.status.StatusPrinterHandler#getModes()
+ * @see org.apache.felix.inventory.InventoryPrinterHandler#getModes()
*/
public PrinterMode[] getModes() {
return this.description.getModes();
}
/**
- * @see org.apache.felix.status.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 {
@@ -168,7 +168,7 @@
}
/**
- * @see org.apache.felix.status.StatusPrinterHandler#supports(org.apache.felix.status.PrinterMode)
+ * @see org.apache.felix.inventory.InventoryPrinterHandler#supports(org.apache.felix.inventory.PrinterMode)
*/
public boolean supports(final PrinterMode mode) {
for(int i=0; i<this.description.getModes().length; i++) {
@@ -180,13 +180,13 @@
}
/**
- * @see org.apache.felix.status.StatusPrinter#print(org.apache.felix.status.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) {
if ( this.supports(mode) ) {
- if ( this.printer instanceof StatusPrinter ) {
- ((StatusPrinter)this.printer).print(mode, printWriter);
+ if ( this.printer instanceof InventoryPrinter ) {
+ ((InventoryPrinter)this.printer).print(mode, printWriter);
} else {
ClassUtils.invoke(this.printer, this.printMethod, new Object[] {mode.toString(), printWriter});
}
@@ -204,11 +204,11 @@
/**
* @see java.lang.Comparable#compareTo(java.lang.Object)
*/
- public int compareTo(final StatusPrinterAdapter spa) {
+ public int compareTo(final InventoryPrinterAdapter spa) {
return this.description.getSortKey().compareTo(spa.description.getSortKey());
}
- public StatusPrinterDescription getDescription() {
+ public InventoryPrinterDescription getDescription() {
return this.description;
}
}
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 d564449..677f26e 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
@@ -18,14 +18,14 @@
import java.util.Arrays;
+import org.apache.felix.inventory.InventoryPrinter;
import org.apache.felix.inventory.PrinterMode;
-import org.apache.felix.inventory.StatusPrinter;
import org.osgi.framework.ServiceReference;
/**
* Helper class for a configuration printer.
*/
-public class StatusPrinterDescription implements Comparable<StatusPrinterDescription> {
+public class InventoryPrinterDescription implements Comparable<InventoryPrinterDescription> {
private final ServiceReference reference;
@@ -39,11 +39,11 @@
private final String category;
- public StatusPrinterDescription(final ServiceReference ref) {
+ public InventoryPrinterDescription(final ServiceReference ref) {
this.reference = ref;
// check modes
- final Object modesCfg = ref.getProperty(StatusPrinter.CONFIG_PRINTER_MODES);
+ final Object modesCfg = ref.getProperty(InventoryPrinter.CONFIG_PRINTER_MODES);
if ( modesCfg instanceof String ) {
this.modes = new PrinterMode[] { PrinterMode.valueOf((String)modesCfg)};
} else if ( modesCfg instanceof String[] ) {
@@ -57,15 +57,15 @@
}
// check name
- if ( ref.getProperty(StatusPrinter.CONFIG_NAME) != null ) {
- this.name = ref.getProperty(StatusPrinter.CONFIG_NAME).toString();
+ if ( ref.getProperty(InventoryPrinter.CONFIG_NAME) != null ) {
+ this.name = ref.getProperty(InventoryPrinter.CONFIG_NAME).toString();
} else {
this.name = null;
}
// check title
- if ( ref.getProperty(StatusPrinter.CONFIG_TITLE) != null ) {
- this.title = ref.getProperty(StatusPrinter.CONFIG_TITLE).toString();
+ if ( ref.getProperty(InventoryPrinter.CONFIG_TITLE) != null ) {
+ this.title = ref.getProperty(InventoryPrinter.CONFIG_TITLE).toString();
if ( this.title.startsWith("%") ) {
this.sortKey = this.title.substring(1);
} else {
@@ -77,8 +77,8 @@
}
// check category
- if ( ref.getProperty(StatusPrinter.CONFIG_CATEGORY) != null ) {
- this.category = ref.getProperty(StatusPrinter.CONFIG_CATEGORY).toString();
+ if ( ref.getProperty(InventoryPrinter.CONFIG_CATEGORY) != null ) {
+ this.category = ref.getProperty(InventoryPrinter.CONFIG_CATEGORY).toString();
} else {
this.category = null;
}
@@ -111,7 +111,7 @@
/**
* @see java.lang.Comparable#compareTo(java.lang.Object)
*/
- public int compareTo(final StatusPrinterDescription spa) {
+ public int compareTo(final InventoryPrinterDescription spa) {
return this.reference.compareTo(spa.reference);
}
@@ -127,7 +127,7 @@
@Override
public String toString() {
- return "StatusPrinterDescription [title=" + title + ", name=" + name
+ return "InventoryPrinterDescription [title=" + title + ", name=" + name
+ ", modes=" + Arrays.toString(modes) + ", sortKey=" + sortKey
+ ", category=" + category + "]";
}
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 79fd7d2..489cbd0 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
@@ -27,10 +27,10 @@
import java.util.Set;
import java.util.concurrent.ConcurrentSkipListSet;
+import org.apache.felix.inventory.InventoryPrinter;
+import org.apache.felix.inventory.InventoryPrinterHandler;
+import org.apache.felix.inventory.InventoryPrinterManager;
import org.apache.felix.inventory.PrinterMode;
-import org.apache.felix.inventory.StatusPrinter;
-import org.apache.felix.inventory.StatusPrinterHandler;
-import org.apache.felix.inventory.StatusPrinterManager;
import org.osgi.framework.BundleContext;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceReference;
@@ -42,11 +42,11 @@
/**
- * The manager keeps track of all status printers and maintains them
+ * 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 StatusPrinterManagerImpl implements StatusPrinterManager,
+public class InventoryPrinterManagerImpl implements InventoryPrinterManager,
ServiceTrackerCustomizer {
/** Logger. */
@@ -55,29 +55,29 @@
/** Bundle Context .*/
private final BundleContext bundleContext;
- /** Service tracker for status printers. */
+ /** Service tracker for Inventory printers. */
private final ServiceTracker cfgPrinterTracker;
/** All adapters mapped by their name. */
- private final Map<String, List<StatusPrinterAdapter>> allAdapters = new HashMap<String, List<StatusPrinterAdapter>>();
+ private final Map<String, List<InventoryPrinterAdapter>> allAdapters = new HashMap<String, List<InventoryPrinterAdapter>>();
/** Used adapters. */
- private final Set<StatusPrinterAdapter> usedAdapters = new ConcurrentSkipListSet<StatusPrinterAdapter>();
+ private final Set<InventoryPrinterAdapter> usedAdapters = new ConcurrentSkipListSet<InventoryPrinterAdapter>();
/** Registration for the web console. */
private final ServiceRegistration pluginRegistration;
/**
- * Create the status printer
+ * Create the inventory printer manager
* @param btx Bundle Context
* @throws InvalidSyntaxException Should only happen if we have an error in the code
*/
- public StatusPrinterManagerImpl(final BundleContext btx) throws InvalidSyntaxException {
+ public InventoryPrinterManagerImpl(final BundleContext btx) throws InvalidSyntaxException {
this.bundleContext = btx;
this.cfgPrinterTracker = new ServiceTracker( this.bundleContext,
- this.bundleContext.createFilter("(&(" + StatusPrinter.CONFIG_PRINTER_MODES + "=*)"
- + "(" + StatusPrinter.CONFIG_NAME + "=*)"
- + "(" + StatusPrinter.CONFIG_TITLE + "=*))"),
+ this.bundleContext.createFilter("(&(" + InventoryPrinter.CONFIG_PRINTER_MODES + "=*)"
+ + "(" + InventoryPrinter.CONFIG_NAME + "=*)"
+ + "(" + InventoryPrinter.CONFIG_TITLE + "=*))"),
this );
this.cfgPrinterTracker.open();
@@ -118,48 +118,48 @@
}
private void addService(final ServiceReference reference, final Object obj) {
- final StatusPrinterDescription desc = new StatusPrinterDescription(reference);
+ final InventoryPrinterDescription desc = new InventoryPrinterDescription(reference);
boolean valid = true;
if ( desc.getModes() == null ) {
- logger.info("Ignoring status printer - printer modes configuration is missing: {}", reference);
+ logger.info("Ignoring inventory printer - printer modes configuration is missing: {}", reference);
valid = false;
}
if ( desc.getName() == null ) {
- logger.info("Ignoring status printer - name configuration is missing: {}", reference);
+ logger.info("Ignoring inventory printer - name configuration is missing: {}", reference);
valid = false;
}
if ( desc.getTitle() == null ) {
- logger.info("Ignoring status printer - title configuration is missing: {}", reference);
+ logger.info("Ignoring inventory printer - title configuration is missing: {}", reference);
valid = false;
}
if ( valid ) {
- final StatusPrinterAdapter adapter = StatusPrinterAdapter.createAdapter(desc, obj);
+ final InventoryPrinterAdapter adapter = InventoryPrinterAdapter.createAdapter(desc, obj);
if ( adapter == null ) {
- logger.info("Ignoring status printer - printer method is missing: {}", reference);
+ logger.info("Ignoring inventory printer - printer method is missing: {}", reference);
} else {
this.addAdapter(adapter);
}
}
}
- private void addAdapter(final StatusPrinterAdapter adapter) {
- StatusPrinterAdapter removeAdapter = null;
- StatusPrinterAdapter addAdapter = null;
+ private void addAdapter(final InventoryPrinterAdapter adapter) {
+ InventoryPrinterAdapter removeAdapter = null;
+ InventoryPrinterAdapter addAdapter = null;
final String key = adapter.getName();
synchronized ( this.allAdapters ) {
- List<StatusPrinterAdapter> list = this.allAdapters.get(key);
- final StatusPrinterAdapter first;
+ List<InventoryPrinterAdapter> list = this.allAdapters.get(key);
+ final InventoryPrinterAdapter first;
if ( list == null ) {
- list = new LinkedList<StatusPrinterAdapter>();
+ list = new LinkedList<InventoryPrinterAdapter>();
this.allAdapters.put(key, list);
first = null;
} else {
first = list.get(0);
}
list.add(adapter);
- Collections.sort(list, StatusPrinterAdapter.RANKING_COMPARATOR);
+ Collections.sort(list, InventoryPrinterAdapter.RANKING_COMPARATOR);
if ( first != null ) {
if ( first != list.get(0) ) {
// update
@@ -172,7 +172,7 @@
}
}
if ( removeAdapter != null ) {
- final Iterator<StatusPrinterAdapter> i = this.usedAdapters.iterator();
+ final Iterator<InventoryPrinterAdapter> i = this.usedAdapters.iterator();
while ( i.hasNext() ) {
if ( i.next() == removeAdapter ) {
i.remove();
@@ -197,13 +197,13 @@
private void removeService(final ServiceReference reference) {
synchronized ( this.allAdapters ) {
- final Iterator<Map.Entry<String, List<StatusPrinterAdapter>>> i = this.allAdapters.entrySet().iterator();
+ final Iterator<Map.Entry<String, List<InventoryPrinterAdapter>>> i = this.allAdapters.entrySet().iterator();
while ( i.hasNext() ) {
- final Map.Entry<String, List<StatusPrinterAdapter>> entry = i.next();
- final Iterator<StatusPrinterAdapter> iter = entry.getValue().iterator();
+ final Map.Entry<String, List<InventoryPrinterAdapter>> entry = i.next();
+ final Iterator<InventoryPrinterAdapter> iter = entry.getValue().iterator();
boolean removed = false;
while ( iter.hasNext() ) {
- final StatusPrinterAdapter adapter = iter.next();
+ final InventoryPrinterAdapter adapter = iter.next();
if ( adapter.getDescription().getServiceReference().compareTo(reference) == 0 ) {
iter.remove();
removed = true;
@@ -218,9 +218,9 @@
}
}
}
- final Iterator<StatusPrinterAdapter> iter = this.usedAdapters.iterator();
+ final Iterator<InventoryPrinterAdapter> iter = this.usedAdapters.iterator();
while ( iter.hasNext() ) {
- final StatusPrinterAdapter adapter = iter.next();
+ final InventoryPrinterAdapter adapter = iter.next();
if ( adapter.getDescription().getServiceReference().compareTo(reference) == 0 ) {
iter.remove();
adapter.unregisterConsole();
@@ -230,30 +230,30 @@
}
/**
- * @see org.apache.felix.status.StatusPrinterManager#getAllHandlers()
+ * @see org.apache.felix.inventory.InventoryPrinterManager#getAllHandlers()
*/
- public StatusPrinterHandler[] getAllHandlers() {
- return this.usedAdapters.toArray(new StatusPrinterHandler[this.usedAdapters.size()]);
+ public InventoryPrinterHandler[] getAllHandlers() {
+ return this.usedAdapters.toArray(new InventoryPrinterHandler[this.usedAdapters.size()]);
}
/**
- * @see org.apache.felix.status.StatusPrinterManager#getHandlers(org.apache.felix.status.PrinterMode)
+ * @see org.apache.felix.inventory.InventoryPrinterManager#getHandlers(org.apache.felix.inventory.PrinterMode)
*/
- public StatusPrinterHandler[] getHandlers(final PrinterMode mode) {
- final List<StatusPrinterHandler> result = new ArrayList<StatusPrinterHandler>();
- for(final StatusPrinterAdapter printer : this.usedAdapters) {
+ public InventoryPrinterHandler[] getHandlers(final PrinterMode mode) {
+ final List<InventoryPrinterHandler> result = new ArrayList<InventoryPrinterHandler>();
+ for(final InventoryPrinterAdapter printer : this.usedAdapters) {
if ( printer.supports(mode) ) {
result.add(printer);
}
}
- return result.toArray(new StatusPrinterHandler[result.size()]);
+ return result.toArray(new InventoryPrinterHandler[result.size()]);
}
/**
- * @see org.apache.felix.status.StatusPrinterManager#getHandler(java.lang.String)
+ * @see org.apache.felix.inventory.InventoryPrinterManager#getHandler(java.lang.String)
*/
- public StatusPrinterHandler getHandler(final String name) {
- for(final StatusPrinterAdapter printer : this.usedAdapters) {
+ public InventoryPrinterHandler getHandler(final String name) {
+ for(final InventoryPrinterAdapter printer : this.usedAdapters) {
if ( name.equals(printer.getName()) ) {
return printer;
}
diff --git a/inventory/src/main/java/org/apache/felix/inventory/impl/WebConsolePlugin.java b/inventory/src/main/java/org/apache/felix/inventory/impl/WebConsolePlugin.java
index 221a9cb..809b793 100644
--- a/inventory/src/main/java/org/apache/felix/inventory/impl/WebConsolePlugin.java
+++ b/inventory/src/main/java/org/apache/felix/inventory/impl/WebConsolePlugin.java
@@ -19,8 +19,8 @@
import java.util.Dictionary;
import java.util.Hashtable;
-import org.apache.felix.inventory.StatusPrinterHandler;
-import org.apache.felix.inventory.StatusPrinterManager;
+import org.apache.felix.inventory.InventoryPrinterHandler;
+import org.apache.felix.inventory.InventoryPrinterManager;
import org.apache.felix.inventory.impl.webconsole.ConsoleConstants;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -28,7 +28,7 @@
import org.osgi.framework.ServiceRegistration;
/**
- * The web console plugin for a status printer.
+ * The web console plugin for a inventory printer.
*/
public class WebConsolePlugin extends AbstractWebConsolePlugin {
@@ -39,28 +39,28 @@
/**
* Constructor
- * @param statusPrinterManager The status printer manager.
+ * @param inventoryPrinterManager The inventory printer manager.
* @param printerName The name of the printer this plugin is displaying.
*/
- WebConsolePlugin(final StatusPrinterManager statusPrinterManager,
+ WebConsolePlugin(final InventoryPrinterManager inventoryPrinterManager,
final String printerName) {
- super(statusPrinterManager);
+ super(inventoryPrinterManager);
this.printerName = printerName;
}
@Override
- protected StatusPrinterHandler getStatusPrinterHandler() {
- return this.statusPrinterManager.getHandler(this.printerName);
+ protected InventoryPrinterHandler getInventoryPrinterHandler() {
+ return this.inventoryPrinterManager.getHandler(this.printerName);
}
public static ServiceRegistration register(
final BundleContext context,
- final StatusPrinterManager manager,
- final StatusPrinterDescription desc) {
+ final InventoryPrinterManager manager,
+ final InventoryPrinterDescription desc) {
final Dictionary<String, Object> props = new Hashtable<String, Object>();
- props.put(ConsoleConstants.PLUGIN_LABEL, "status-" + desc.getName());
+ props.put(ConsoleConstants.PLUGIN_LABEL, "inventory-" + desc.getName());
props.put(ConsoleConstants.PLUGIN_TITLE, desc.getTitle());
- props.put(ConsoleConstants.PLUGIN_CATEGORY, desc.getCategory() == null ? "Status" : desc.getCategory());
+ props.put(ConsoleConstants.PLUGIN_CATEGORY, desc.getCategory() == null ? "Inventory" : desc.getCategory());
return context.registerService(ConsoleConstants.INTERFACE_SERVLET, new ServiceFactory() {
public void ungetService(final Bundle bundle, final ServiceRegistration registration,
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 18d7195..1ec7020 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
@@ -178,7 +178,7 @@
}
/**
- * Map the modes to status printer modes
+ * Map the modes to inventory printer modes
*/
public String[] getPrinterModes() {
final Set<String> list = new HashSet<String>();
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 d048ca6..bfd30ca 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
@@ -29,8 +29,8 @@
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
+import org.apache.felix.inventory.InventoryPrinter;
import org.apache.felix.inventory.PrinterMode;
-import org.apache.felix.inventory.StatusPrinter;
import org.apache.felix.inventory.ZipAttachmentProvider;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
@@ -95,17 +95,17 @@
cpa.label = cpa.title;
}
final Dictionary<String, Object> props = new Hashtable<String, Object>();
- props.put(StatusPrinter.CONFIG_NAME, cpa.label);
- props.put(StatusPrinter.CONFIG_TITLE, cpa.title);
- props.put(StatusPrinter.CONFIG_PRINTER_MODES, cpa.getPrinterModes());
+ props.put(InventoryPrinter.CONFIG_NAME, cpa.label);
+ props.put(InventoryPrinter.CONFIG_TITLE, cpa.title);
+ props.put(InventoryPrinter.CONFIG_PRINTER_MODES, cpa.getPrinterModes());
if ( reference.getProperty(ConsoleConstants.PLUGIN_CATEGORY) != null ) {
- props.put(StatusPrinter.CONFIG_CATEGORY, reference.getProperty(ConsoleConstants.PLUGIN_CATEGORY));
+ props.put(InventoryPrinter.CONFIG_CATEGORY, reference.getProperty(ConsoleConstants.PLUGIN_CATEGORY));
}
- final ServiceRegistration reg = this.bundleContext.registerService(StatusPrinter.class.getName(), new ZipAttachmentProvider() {
+ final ServiceRegistration reg = this.bundleContext.registerService(InventoryPrinter.class.getName(), new ZipAttachmentProvider() {
/**
- * @see org.apache.felix.status.StatusPrinter#print(org.apache.felix.status.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 String m;
@@ -124,7 +124,7 @@
}
/**
- * @see org.apache.felix.status.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 {
diff --git a/inventory/src/main/java/org/apache/felix/inventory/package-info.java b/inventory/src/main/java/org/apache/felix/inventory/package-info.java
index 1350c24..83a97ed 100644
--- a/inventory/src/main/java/org/apache/felix/inventory/package-info.java
+++ b/inventory/src/main/java/org/apache/felix/inventory/package-info.java
@@ -18,7 +18,7 @@
*/
/**
- * Interfaces for getting status information about the current instance
+ * Interfaces for getting inventory information about the current instance
*
* @version 1.0.0
*/