blob: d4b446e902d36ab375a670ad4307f6103a8b04d6 [file] [log] [blame]
Carsten Ziegeler395a7822013-01-28 19:01:22 +00001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19package org.apache.felix.status;
20
21import java.io.PrintWriter;
22
23/**
24 * The <code>StatusPrinter</code> is a service interface to be
25 * implemented by providers which want to hook into the display of the
26 * current configuration and state of the OSGi framework and application.
27 *
28 * A status printer must configure at least these three configuration properties
29 * <ul>
30 * <li>{@link #CONFIG_PRINTER_MODES} - the supported modes</li>
31 * <li>{@link #CONFIG_TITLE} - the printer title</li>
32 * <li>{@link #CONFIG_NAME} - the printer name</li>
33 * </ul>
34 */
35public interface StatusPrinter {
36
37 /**
38 * The service name under which services of this class must be registered
39 * to be picked for inclusion in the configuration report.
40 */
41 String SERVICE = StatusPrinter.class.getName(); //$NON-NLS-1$
42
43 /**
44 * The property defining the supported rendering modes.
45 * The value of this property is either a string or a string array containing
46 * valid names of {@link PrinterMode}.
47 *
48 * If this property is missing or contains invalid values,
49 * the printer is ignored.
50 */
51 String CONFIG_PRINTER_MODES = "felix.statusprinter.modes"; //$NON-NLS-1$
52
53 /**
54 * The unique name of the printer.
55 * If this property is missing the printer is ignored.
56 * If there are two or more services with the same name, the
57 * services with the highest ranking is used.
58 */
59 String CONFIG_NAME = "felix.statusprinter.name"; //$NON-NLS-1$
60
61 /**
62 * The title displayed by tools when this printer is used. It should be
63 * descriptive but short.
64 * If this property is missing the printer is ignored.
65 */
66 String CONFIG_TITLE = "felix.statusprinter.title"; //$NON-NLS-1$
67
68 /**
69 * The category under which this printer is categorized.
70 * This property is optional.
71 */
72 String CONFIG_CATEGORY = "felix.statusprinter.category"; //$NON-NLS-1$
73
74 /**
75 * Prints the configuration report to the given <code>printWriter</code>.
76 * Implementations are free to print whatever information they deem useful.
77 *
78 * If a printer is invoked with a mode it doesn't support ({@link #CONFIG_PRINTER_MODES})
79 * the printer should just do/print nothing and directly return.
80 *
81 * @param mode The render mode.
82 * @param printWriter where to write the configuration data. It might be flushed,
83 * but must not be closed.
84 */
85 void print( PrinterMode mode, PrintWriter printWriter );
86}