blob: 8f2d1332f5288c8b6d82de24a7060613bc520a2f [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--
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
https://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.
-->
<head>
<title>Apache Felix - Apache Felix Inventory Printer</title>
<link rel="icon" href="/res/favicon.ico">
<link rel="stylesheet" href="/res/site.css" type="text/css" media="all">
<link rel="stylesheet" href="/res/codehilite.css" type="text/css" media="all">
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
</head>
<body>
<div class="title">
<div class="logo">
<a href="https://felix.apache.org/">
<img border="0" alt="Apache Felix" src="/res/logo.png">
</a>
</div>
<div class="header">
<a href="https://www.apache.org/">
<img border="0" alt="Apache" src="/res/apache.png">
</a>
</div>
</div>
<div class="menu">
<style type="text/css">
/* The following code is added by mdx_elementid.py
It was originally lifted from http://subversion.apache.org/style/site.css */
/*
* Hide class="elementid-permalink", except when an enclosing heading
* has the :hover property.
*/
.headerlink, .elementid-permalink {
visibility: hidden;
}
h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, dt:hover > .elementid-permalink { visibility: visible }</style>
<p><a href="/news.html">News</a> <br />
<a href="/license.html">License</a> <br />
<a href="/downloads.cgi">Downloads</a> <br />
<a href="/documentation.html">Documentation</a> <br />
<a href="/documentation/community/project-info.html">Project Info</a> <br />
<a href="/documentation/community/contributing.html">Contributing</a> <br />
<a href="/sitemap.html">Site Map</a> <br />
<a href="https://www.apache.org/">ASF</a> <br />
<a href="https://www.apache.org/security/">Security</a> <br />
<a href="https://www.apache.org/foundation/sponsorship.html">Sponsorship</a> <br />
<a href="https://www.apache.org/foundation/thanks.html">Sponsors</a> </p>
<iframe
src="https://www.apache.org/ads/button.html"
style="border-width:0; float: left"
frameborder="0"
scrolling="no"
width="135"
height="135">
</iframe>
</div>
<div class="main">
<div class="breadcrump" style="font-size: 80%;">
<a href="/">Home</a>&nbsp;&raquo&nbsp;<a href="/documentation.html">Documentation</a>
</div>
<h1>Apache Felix Inventory Printer</h1>
<style type="text/css">
/* The following code is added by mdx_elementid.py
It was originally lifted from http://subversion.apache.org/style/site.css */
/*
* Hide class="elementid-permalink", except when an enclosing heading
* has the :hover property.
*/
.headerlink, .elementid-permalink {
visibility: hidden;
}
h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, dt:hover > .elementid-permalink { visibility: visible }</style>
<p><a id="top"></a></p>
<div class="toc">
<ul>
<li><a href="#introduction">Introduction</a></li>
<li><a href="#requirements">Requirements</a></li>
<li><a href="#inventory-printer-services">Inventory Printer Services</a><ul>
<li><a href="#example-inventory-printer-service">Example Inventory Printer Service</a></li>
</ul>
</li>
<li><a href="#zip-attachment-provider">ZIP Attachment Provider</a></li>
<li><a href="#configuration-printer-services">Configuration Printer Services</a></li>
<li><a href="#integration-with-the-apache-felix-web-console">Integration with the Apache Felix Web Console</a></li>
<li><a href="#integration-with-the-apache-felix-gogo-shell">Integration with the Apache Felix Gogo Shell</a></li>
<li><a href="#issues">Issues</a></li>
</ul>
</div>
<p>The Apache Felix Inventory Printer is a simple and extensible framework
to retrieve inventory information about applications running in an OSGi Framework. Typical information includes currently installed bundles, their state, available configurations, framework properties, log files etc.</p>
<p>Historically the Inventory Printer evolved from the Web Console Configuration
Printer framework.</p>
<h2 id="introduction">Introduction<a class="headerlink" href="#introduction" title="Permanent link">&para;</a></h2>
<p><a href="#top">Top</a></p>
<p>When trying to find a problem or analyzing the system it would be nice to have a single place to go to and get available information. The Apache Felix inventory bundle tries to exactly fill this gap.</p>
<p>Originally, the idea started within the Apache Felix WebConsole and it's configuration printers - these pluggable printers allowed to view all available status information in a web browser or download this as zip file. While this already solves most use cases, tying this general functionality to a web console felt wrong, and that's when the inventory module started.</p>
<p>The current version of the inventory implementation, registers all available InventoryPrinters (see below) as plugins to the web console as this is still the number one use case.</p>
<h2 id="requirements">Requirements<a class="headerlink" href="#requirements" title="Permanent link">&para;</a></h2>
<p><a href="#top">Top</a></p>
<p>In and of itself the Apache Felix Inventory Printer module is independent of other modules.</p>
<p>To actually get access to the output of Inventory Printer services, though, the Apache Felix Web Console must be installed.</p>
<p>In the future <a href="#gogo-shell">Integration with the Apache Felix Gogo Shell</a> will also be provided in which case the Apache Felix Gogo Shell must be installed.</p>
<h2 id="inventory-printer-services">Inventory Printer Services<a class="headerlink" href="#inventory-printer-services" title="Permanent link">&para;</a></h2>
<p><a href="#top">Top</a></p>
<p>Inventory Printer Services are registered as <code>org.apache.felix.inventory.InventoryPrinter</code> type OSGi services with the following service registration properties:</p>
<table class="table">
<thead>
<tr>
<th>Property</th>
<th>Default Value</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>felix.inventory.printer.name</code></td>
<td>--</td>
<td>The unique name of the printer. If there are two or more services with the same name, the service with the highest ranking is used.</td>
</tr>
<tr>
<td><code>felix.inventory.printer.title</code></td>
<td>--</td>
<td>The title displayed by tools when this printer is used. It should be descriptive but short.</td>
</tr>
<tr>
<td><code>felix.inventory.printer.format</code></td>
<td>--</td>
<td>The property defining the supported rendering formats. The value of this property is either a string or a string array containing valid names of <a href="/apidocs/inventory/1.0.0/org/apache/felix/inventory/Format.html"><code>Format</code></a>. If this property is missing or contains invalid values, the printer is ignored.</td>
</tr>
<tr>
<td><code>felix.inventory.printer.webconsole</code></td>
<td><code>true</code></td>
<td>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.</td>
</tr>
</tbody>
</table>
<p>The first three properties are required for the Inventory Printer service to be accepted. Otherwise the service is ignored by the framework printing a message to the log.</p>
<p>To prevent bundle resolution failure if the <code>InventoryPrinter</code> API is not available in the framework it is suggested to register the Inventory Printer services as service factories and dynamically import the API. See the question <a href="#how-to-provide-optional-services"></a> in the Apache Felix OSGi FAQ for more details.</p>
<h3 id="example-inventory-printer-service">Example Inventory Printer Service<a class="headerlink" href="#example-inventory-printer-service" title="Permanent link">&para;</a></h3>
<div class="codehilite"><pre><span class="nd">@Component</span>
<span class="nd">@Service</span>
<span class="nd">@Properties</span><span class="o">({</span>
<span class="nd">@Property</span><span class="o">(</span><span class="n">name</span> <span class="o">=</span> <span class="s">&quot;felix.inventory.printer.name&quot;</span><span class="o">,</span> <span class="n">value</span> <span class="o">=</span> <span class="s">&quot;sample&quot;</span><span class="o">),</span>
<span class="nd">@Property</span><span class="o">(</span><span class="n">name</span> <span class="o">=</span> <span class="s">&quot;felix.inventory.printer.title&quot;</span><span class="o">,</span> <span class="n">value</span> <span class="o">=</span> <span class="s">&quot;This is a Sample&quot;</span><span class="o">),</span>
<span class="nd">@Property</span><span class="o">(</span><span class="n">name</span> <span class="o">=</span> <span class="s">&quot;felix.inventory.printer.format&quot;</span><span class="o">,</span>
<span class="n">value</span> <span class="o">=</span> <span class="o">{</span> <span class="s">&quot;TEXT&quot;</span><span class="o">,</span> <span class="s">&quot;HTML&quot;</span><span class="o">,</span> <span class="s">&quot;JSON&quot;</span> <span class="o">})</span>
<span class="o">})</span>
<span class="kd">public</span> <span class="kd">class</span> <span class="nc">SampleInvetoryPrinter</span> <span class="kd">implements</span> <span class="n">InventoryPrinter</span>
<span class="o">{</span>
<span class="kd">public</span> <span class="kt">void</span> <span class="nf">print</span><span class="o">(</span><span class="n">PrintWriter</span> <span class="n">printWriter</span><span class="o">,</span> <span class="n">Format</span> <span class="n">format</span><span class="o">,</span> <span class="kt">boolean</span> <span class="n">isZip</span><span class="o">)</span>
<span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="n">format</span> <span class="o">==</span> <span class="n">Format</span><span class="o">.</span><span class="na">JSON</span><span class="o">)</span>
<span class="o">{</span>
<span class="n">printWriter</span><span class="o">.</span><span class="na">print</span><span class="o">(</span><span class="s">&quot;{ \&quot;key\&quot;: \&quot;Sample Output\&quot; }&quot;</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">else</span> <span class="nf">if</span> <span class="o">(</span><span class="n">format</span> <span class="o">==</span> <span class="n">Format</span><span class="o">.</span><span class="na">HTML</span><span class="o">)</span>
<span class="o">{</span>
<span class="n">printWriter</span><span class="o">.</span><span class="na">print</span><span class="o">(</span><span class="s">&quot;&lt;b&gt;Sample Output&lt;/b&gt;&quot;</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">else</span>
<span class="o">{</span>
<span class="n">printWriter</span><span class="o">.</span><span class="na">print</span><span class="o">(</span><span class="s">&quot;Sample Output&quot;</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">}</span>
</pre></div>
<p>See also the <a href="/apidocs/inventory/1.0.0/">API JavaDoc</a>.</p>
<h2 id="zip-attachment-provider">ZIP Attachment Provider<a class="headerlink" href="#zip-attachment-provider" title="Permanent link">&para;</a></h2>
<p><a href="#top">Top</a></p>
<p>If an Inventory Printer wants to provide additional contents to an Inventory ZIP File, it can implement the <a href="/apidocs/inventory/1.0.0/org/apache/felix/inventory/ZipAttachmentProvider.html">ZipAttachmentProvider</a> interface and provide additional files when the zip is created.</p>
<h2 id="configuration-printer-services">Configuration Printer Services<a class="headerlink" href="#configuration-printer-services" title="Permanent link">&para;</a></h2>
<p><a href="#top">Top</a></p>
<p>For backwards compatibility the Inventory Printer framework also supports legacy Apache Felix Web Console <code>ConfigurationPrinter</code> services.</p>
<p>Configuration Printer services are wrapped in an <code>InventoryPrinter</code> adapter and re-registered as Inventory Printer services. Thus they are registered with the Web Console or the Gogo Shell as if the Configuration Printer would be an Inventory Printer.</p>
<p>Configuration Printer Services are registered as <code>org.apache.felix.webconsole.ConfigurationPrinter</code> type OSGi services with the following service registration properties:</p>
<table class="table">
<thead>
<tr>
<th>Property</th>
<th>Default Value</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>felix.webconsole.title</code></td>
<td>--</td>
<td>The title under which to display the Configuration Printer</td>
</tr>
<tr>
<td><code>felix.webconsole.configprinter.modes</code></td>
<td>--</td>
<td>The Configuration Printer modes supported. This may be one or more of the values <code>web</code>, <code>zip</code>, or <code>txt</code>. Alternatively the value <code>always</code> my be used to indicate support for all modes.</td>
</tr>
<tr>
<td><code>modes</code></td>
<td>--</td>
<td>Deprecated synonym for the <code>felix.webconsole.configprinter.modes</code> property.</td>
</tr>
<tr>
<td><code>felix.webconsole.configprinter.web.unescaped</code></td>
<td><code>false</code></td>
<td>Property indicating whether output generated in <code>web</code> mode is HTML (<code>true</code>) or plain text to be escaped for web rendering (<code>false</code>).</td>
</tr>
</tbody>
</table>
<h2 id="integration-with-the-apache-felix-web-console">Integration with the Apache Felix Web Console<a class="headerlink" href="#integration-with-the-apache-felix-web-console" title="Permanent link">&para;</a></h2>
<p><a href="#top">Top</a></p>
<p>The Inventory Printer framework has first class integration with the Apache Felix Web Console. Each <code>InventoryPrinter</code> service is registered as a plugin in the <code>Inventory</code> category of the Web Console.</p>
<p>To prevent an Invetory Printer from being registered in the Web Console, the <code>felix.inventory.printer.webconsole</code> service registration property must be set to <code>false</code>.</p>
<p><a id="gogo-shell"></a></p>
<h2 id="integration-with-the-apache-felix-gogo-shell">Integration with the Apache Felix Gogo Shell<a class="headerlink" href="#integration-with-the-apache-felix-gogo-shell" title="Permanent link">&para;</a></h2>
<p><a href="#top">Top</a></p>
<p>Gogo Shell integration is not implemented in the first version of the Apache Felix Inventory Printer module.</p>
<p>See the issue <a href="https://issues.apache.org/jira/browse/FELIX-4065">FELIX-4065 Provide Gogo Shell integration for InventoryPrinter services</a>.</p>
<h2 id="issues">Issues<a class="headerlink" href="#issues" title="Permanent link">&para;</a></h2>
<p><a href="#top">Top</a></p>
<p>Should you have any questions using the Inventory Printer, please send a
note to one of our <a href="">Mailing Lists</a>.</p>
<p>Please report any issues with the Inventory Printer in our issue tracking
system (<a href="https://issues.apache.org/jira/browse/Felix">JIRA</a>) and be sure
to report for the <em>Inventory</em> component. See our <a href="">Issue Tracking</a> page for more details.</p>
<div class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
Rev. 1522535 by fmeschbe on Thu, 12 Sep 2013 11:35:31 +0000
</div>
<div class="trademarkFooter">
Apache Felix, Felix, Apache, the Apache feather logo, and the Apache Felix project
logo are trademarks of The Apache Software Foundation. All other marks mentioned
may be trademarks or registered trademarks of their respective owners.
</div>
</div>
</body>
</html>