Author: buildbot
Date: Mon Mar 9 15:57:51 2015
New Revision: 943025
Log:
Staging update by buildbot for felix
Modified:
websites/staging/felix/trunk/content/ (props changed)
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-adapter.html
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-aspect.html
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-bundle-adapter.html
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-factory-configuration-adapter.html
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-resource-adapter.html
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-singleton.html
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/components.html
Propchange: websites/staging/felix/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Mon Mar 9 15:57:51 2015
@@ -1 +1 @@
-1665202
+1665268
Modified:
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-adapter.html
==============================================================================
---
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-adapter.html
(original)
+++
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-adapter.html
Mon Mar 9 15:57:51 2015
@@ -68,19 +68,24 @@
<h1></h1>
- <h4 id="adapters">Adapters</h4>
-<p>Adapters, like aspects, are used to "extend" existing services, and can
publish different services based on the existing one. An example would be
implementing a management interface.</p>
-<h2 id="adapterservice">@AdapterService</h2>
-<p>Adapters, like with <em>@AspectService</em>, are used to "extend" existing
services,
-and can publish different services based on the existing one. An example
-would be implementing a management interface for an existing service,
-etc .... When you annotate an adapter class with the <em>@AdapterService</em>
+ <h1 id="adapters">Adapters</h1>
+<p>Adapters, like <a href="component-aspect.html">aspects</a>, are used to
"extend" existing services, and can publish different services based on the
existing one. An example would be implementing a management interface.</p>
+<p>An adapter will be applied to any service that matches the specified
interface and filter. For each matching service an adapter will be created
based on the adapter implementation class. The adapter will be registered with
the specified interface and existing properties from the original service plus
any extra properties you supply here. It will also inherit all dependencies,
and if you declare the original service as a member it will be injected.</p>
+<p>An example:</p>
+<div class="codehilite"><pre><span class="n">manager</span><span
class="p">.</span><span class="n">createAdapterService</span><span
class="p">(</span><span class="n">AdapteeService</span><span
class="p">.</span><span class="n">class</span><span class="p">,</span>
"<span class="p">(</span><span class="n">foo</span><span
class="p">=</span><span class="n">bar</span><span class="p">)</span>"<span
class="p">)</span>
+ <span class="p">.</span><span class="n">setInterface</span><span
class="p">(</span><span class="n">AdapterService</span><span
class="p">.</span><span class="n">class</span><span class="p">,</span> <span
class="n">new</span> <span class="n">Hashtable</span><span class="p">()</span>
<span class="p">)</span>
+ <span class="p">.</span><span class="n">setImplementation</span><span
class="p">(</span><span class="n">AdapterImpl</span><span
class="p">.</span><span class="n">class</span><span class="p">);</span>
+</pre></div>
+
+
+<h1 id="adapterservice">@AdapterService</h1>
+<p>Adapters, like with <em>@AspectService</em>, are used to "extend" existing
services, and can publish different services based on the existing one. When
you annotate an adapter class with the <em>@AdapterService</em>
annotation, it will be applied to any service that matches the implemented
interface and filter. The adapter will be registered with the specified
interface and existing properties from the original service plus any extra
properties you supply here. If you declare the original service as a member
it will be injected. </p>
-<h3 id="annotation-attributes">Annotation attributes:</h3>
+<h2 id="annotation-attributes">Annotation attributes:</h2>
<hr />
<p><strong><code>adapteeService</code></strong> <br />
<em>Required</em>: True <br />
@@ -109,7 +114,7 @@ By default, the adapter will inherit all
<em>Default</em>: --</p>
<p>Sets the static method used to create the adapter service implementation
instance. By default, the default constructor of the annotated class is
used.</p>
-<h3 id="usage-example">Usage example</h3>
+<h2 id="usage-example">Usage example</h2>
<p>Here, the AdapterService is registered into the OSGI registry each time an
AdapteeService is found from the registry. The AdapterImpl class adapts the
AdapteeService to the AdapterService. The AdapterService will also have a
service property (param=value), and will also include eventual service
properties found from the AdapteeService:</p>
<div class="codehilite"><pre> <span class="p">@</span><span
class="n">AdapterService</span><span class="p">(</span><span
class="n">adapteeService</span> <span class="p">=</span> <span
class="n">AdapteeService</span><span class="p">.</span><span
class="n">class</span><span class="p">,</span> <span
class="k">properties</span><span class="p">={@</span><span
class="n">Property</span><span class="p">(</span><span
class="n">name</span><span class="p">=</span>"<span
class="n">param</span>"<span class="p">,</span> <span
class="n">value</span><span class="p">=</span>"<span
class="n">value</span>"<span class="p">)})</span>
<span class="n">class</span> <span class="n">AdapterImpl</span> <span
class="n">implements</span> <span class="n">AdapterService</span> <span
class="p">{</span>
@@ -123,7 +128,7 @@ instance. By default, the default constr
<span class="p">}</span>
</pre></div>
<div class="timestamp" style="margin-top: 30px; font-size: 80%;
text-align: right;">
- Rev. 1664040 by marrs on Wed, 4 Mar 2015 15:21:58 +0000
+ Rev. 1665268 by marrs on Mon, 9 Mar 2015 15:57:25 +0000
</div>
<div class="trademarkFooter">
Apache Felix, Felix, Apache, the Apache feather logo, and the Apache
Felix project
Modified:
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-aspect.html
==============================================================================
---
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-aspect.html
(original)
+++
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-aspect.html
Mon Mar 9 15:57:51 2015
@@ -68,11 +68,12 @@
<h1></h1>
- <h4 id="aspects">Aspects</h4>
+ <h1 id="aspects">Aspects</h1>
<p>Aspects, as part of aspect oriented programming, can be used in a dynamic
environment such as OSGi to "extend" existing services and add certain
"capabilities" to them. Examples of these are adding a specific caching
mechanism to a storage service or implementing logging. Aspects in OSGi can be
applied to services and can be added and removed at runtime.</p>
-<h2 id="aspectservice">@AspectService</h2>
-<p>Aspects allow you to define an interceptor, or chain of interceptors for a
service (to add features like caching or logging, etc ...). The dependency
manager intercepts the original service, and allows you to execute some code
before invoking the original service ... The aspect will be applied to any
service that matches the specified interface and filter and will be registered
with the same interface and properties as the original service, plus any extra
properties you supply here. It will also inherit all dependencies, and if you
declare the original service as a member it will be injected.</p>
-<h3 id="annotation-attributes">Annotation attributes</h3>
+<p>Aspects allow you to define an "interceptor", or chain of interceptors for
a service to add features like caching or logging, etc. An aspect will be
applied to any service that matches the specified interface and filter. For
each matching service an aspect will be created based on the aspect
implementation class. The aspect will be registered with the same interface and
properties as the original service, plus any extra properties you supply here.
It will also inherit all dependencies, and if you declare the original service
as a member it will be injected.</p>
+<h1 id="aspectservice">@AspectService</h1>
+<p>The <em>@AspectService</em> annotation allows you to create an aspect
service. It supports the following attributes mentioned below.</p>
+<h2 id="annotation-attributes">Annotation attributes</h2>
<hr />
<p><strong><code>ranking</code></strong> <br />
<em>Required</em>: No <br />
@@ -111,7 +112,7 @@ applying to.</p>
instance. The default constructor of the annotated class is used.
The factoryMethod can be used to provide a specific aspect implements,
like a DynamicProxy.</p>
-<h3 id="usage-example">Usage example:</h3>
+<h2 id="usage-example">Usage example:</h2>
<div class="codehilite"><pre> <span class="p">@</span><span
class="n">AspectService</span><span class="p">(</span><span
class="n">ranking</span><span class="p">=</span>10<span class="p">),</span>
<span class="k">properties</span><span class="p">={@</span><span
class="n">Property</span><span class="p">(</span><span
class="n">name</span><span class="p">=</span>"<span
class="n">param</span>"<span class="p">,</span> <span
class="n">value</span><span class="p">=</span>"<span
class="n">value</span>"<span class="p">)})</span>
<span class="n">class</span> <span class="n">AspectService</span> <span
class="n">implements</span> <span class="n">InterceptedService</span> <span
class="p">{</span>
<span class="o">//</span> <span class="n">The</span> <span
class="n">service</span> <span class="n">we</span> <span class="n">are</span>
<span class="n">intercepting</span> <span class="p">(</span><span
class="n">injected</span> <span class="n">by</span> <span
class="n">reflection</span><span class="p">)</span>
@@ -123,7 +124,7 @@ like a DynamicProxy.</p>
<span class="p">}</span>
</pre></div>
<div class="timestamp" style="margin-top: 30px; font-size: 80%;
text-align: right;">
- Rev. 1664040 by marrs on Wed, 4 Mar 2015 15:21:58 +0000
+ Rev. 1665268 by marrs on Mon, 9 Mar 2015 15:57:25 +0000
</div>
<div class="trademarkFooter">
Apache Felix, Felix, Apache, the Apache feather logo, and the Apache
Felix project
Modified:
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-bundle-adapter.html
==============================================================================
---
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-bundle-adapter.html
(original)
+++
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-bundle-adapter.html
Mon Mar 9 15:57:51 2015
@@ -68,7 +68,7 @@
<h1></h1>
- <h2 id="bundleadapterservice">@BundleAdapterService</h2>
+ <h1 id="bundle-adapters">Bundle Adapters</h1>
<p>Bundle adapters are similar to AdapterService, but instead of adapting a
service, they adapt a bundle with a certain set of states
(STARTED|INSTALLED|...), and provide a service on top of it.</p>
<p>The bundle adapter will be applied to any bundle that matches the specified
@@ -78,7 +78,17 @@ based on the adapter implementation clas
with the specified interface and with service properties found from the
original bundle OSGi manifest headers plus any extra properties you supply
here. If you declare the original bundle as a member it will be injected. </p>
-<h3 id="annotation-attributes">Annotation attributes:</h3>
+<p>An example:</p>
+<div class="codehilite"><pre><span class="n">manager</span><span
class="p">.</span><span class="n">createBundleAdapterService</span><span
class="p">(</span><span class="n">Bundle</span><span class="p">.</span><span
class="n">INSTALLED</span> <span class="o">|</span> <span
class="n">Bundle</span><span class="p">.</span><span class="n">RESOLVED</span>
<span class="o">|</span> <span class="n">Bundle</span><span
class="p">.</span><span class="n">ACTIVE</span><span class="p">,</span>
+ "<span class="p">(</span><span class="n">Bundle</span><span
class="o">-</span><span class="n">SymbolicName</span><span
class="p">=</span><span class="n">org</span><span class="p">.</span><span
class="n">apache</span><span class="p">.</span><span
class="n">felix</span><span class="p">.</span><span
class="n">dependencymanager</span><span class="p">)</span>"<span
class="p">,</span> <span class="n">true</span><span class="p">)</span>
+ <span class="p">.</span><span class="n">setInterface</span><span
class="p">(</span><span class="n">AdapterService</span><span
class="p">.</span><span class="n">class</span><span class="p">.</span><span
class="n">getName</span><span class="p">(),</span> <span class="n">new</span>
<span class="n">Hashtable</span><span class="p">()</span> <span
class="p">)</span>
+ <span class="p">.</span><span class="n">setImplementation</span><span
class="p">(</span><span class="n">AdapterServiceImpl</span><span
class="p">.</span><span class="n">class</span><span class="p">);</span>
+</pre></div>
+
+
+<h1 id="bundleadapterservice">@BundleAdapterService</h1>
+<p>The following attributes are supported.</p>
+<h2 id="annotation-attributes">Annotation attributes:</h2>
<hr />
<p><strong><code>filter</code></strong> <br />
<em>Required</em>: False <br />
@@ -114,7 +124,7 @@ exposed service properties.</p>
<em>Default</em>: --</p>
<p>Sets the static method used to create the BundleAdapterService
implementation
instance.</p>
-<h3 id="usage-examples">Usage Examples</h3>
+<h2 id="usage-examples">Usage Examples</h2>
<p>In the following example, a "VideoPlayer" Service is registered into the
OSGi registry each time an active bundle containing a "Video-Path" manifest
header is detected:</p>
<div class="codehilite"><pre><span
class="nd">@BundleAdapterService</span><span class="o">(</span><span
class="n">filter</span> <span class="o">=</span> <span
class="s">"(Video-Path=*)"</span><span class="o">,</span> <span
class="n">stateMask</span> <span class="o">=</span> <span
class="n">Bundle</span><span class="o">.</span><span
class="na">ACTIVE</span><span class="o">,</span> <span
class="n">propagate</span><span class="o">=</span><span
class="kc">true</span><span class="o">)</span>
<span class="kd">public</span> <span class="kd">class</span> <span
class="nc">VideoPlayerImpl</span> <span class="kd">implements</span> <span
class="n">VideoPlayer</span> <span class="o">{</span>
@@ -129,7 +139,7 @@ instance.</p>
<span class="o">}</span>
</pre></div>
<div class="timestamp" style="margin-top: 30px; font-size: 80%;
text-align: right;">
- Rev. 1664040 by marrs on Wed, 4 Mar 2015 15:21:58 +0000
+ Rev. 1665268 by marrs on Mon, 9 Mar 2015 15:57:25 +0000
</div>
<div class="trademarkFooter">
Apache Felix, Felix, Apache, the Apache feather logo, and the Apache
Felix project
Modified:
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-factory-configuration-adapter.html
==============================================================================
---
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-factory-configuration-adapter.html
(original)
+++
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-factory-configuration-adapter.html
Mon Mar 9 15:57:51 2015
@@ -68,7 +68,16 @@
<h1></h1>
- <h2
id="factoryconfigurationadapterservice">@FactoryConfigurationAdapterService</h2>
+ <h1 id="factory-configuration-adapter-service">Factory Configuration
Adapter Service</h1>
+<p>A factory configuration adapter service creates an adapter for each
matching configuration in Configuration Admin. For each new factory
configuration matching the factoryPid, an adapter will be created based on the
adapter implementation class. The adapter will be registered with the specified
interface and with the specified adapter service properties. Depending on the
propagate parameter, every public factory configuration properties (which don't
start with ".") will be propagated along with the adapter service properties.
It will also inherit all dependencies.</p>
+<p>Usage Example:</p>
+<div class="codehilite"><pre><span class="n">manager</span><span
class="p">.</span><span
class="n">createFactoryConfigurationAdapterService</span><span
class="p">(</span>"<span class="n">MyFactoryPid</span>"<span
class="p">,</span> "<span class="n">update</span>"<span
class="p">,</span> <span class="n">true</span><span class="p">)</span>
+ <span class="p">.</span><span class="n">setInterface</span><span
class="p">(</span><span class="n">AdapterService</span><span
class="p">.</span><span class="n">class</span><span class="p">.</span><span
class="n">getName</span><span class="p">(),</span> <span class="n">new</span>
<span class="n">Hashtable</span><span class="p">()</span> <span
class="p">)</span>
+ <span class="p">.</span><span class="n">setImplementation</span><span
class="p">(</span><span class="n">AdapterServiceImpl</span><span
class="p">.</span><span class="n">class</span><span class="p">);</span>
+</pre></div>
+
+
+<h1
id="factoryconfigurationadapterservice">@FactoryConfigurationAdapterService</h1>
<p>Annotates a class that acts as a Factory Configuration Adapter Service.
For each new Config Admin factory configuration matching the specified
factoryPid, an instance of this service will be created. The adapter will be
@@ -79,7 +88,7 @@ propagated along with the adapter servic
<p>Like in @ConfigurationDependency, you can optionally specify the meta types
of
your configurations for Web Console GUI customization (configuration
heading/descriptions/default values/etc ...). </p>
-<h3 id="annotation-attributes">Annotation attributes:</h3>
+<h2 id="annotation-attributes">Annotation attributes:</h2>
<hr />
<p><strong><code>provides</code></strong> <br />
<em>Required</em>: False <br />
@@ -125,7 +134,7 @@ are merged with these. </p>
<em>Required</em>: False <br />
<em>Default</em>: --</p>
<p>Sets the static method used to create the adapter instance.</p>
-<h3 id="usage-examples">Usage Examples</h3>
+<h2 id="usage-examples">Usage Examples</h2>
<p>Here, a "Dictionary" service instance is instantiated for each existing
factory configuration instances matching the "DictionaryServiceFactory"
factory pid:</p>
@@ -205,7 +214,7 @@ it's better to use standard bnd metatype
<span class="o">}</span>
</pre></div>
<div class="timestamp" style="margin-top: 30px; font-size: 80%;
text-align: right;">
- Rev. 1664928 by pderop on Sat, 7 Mar 2015 23:05:23 +0000
+ Rev. 1665268 by marrs on Mon, 9 Mar 2015 15:57:25 +0000
</div>
<div class="trademarkFooter">
Apache Felix, Felix, Apache, the Apache feather logo, and the Apache
Felix project
Modified:
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-resource-adapter.html
==============================================================================
---
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-resource-adapter.html
(original)
+++
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-resource-adapter.html
Mon Mar 9 15:57:51 2015
@@ -68,9 +68,17 @@
<h1></h1>
- <h4 id="resource-adapters">Resource Adapters</h4>
+ <h1 id="resource-adapters">Resource Adapters</h1>
<p>Resource adapters work just like adapters, but instead of working with
services, they work with resources. Resources, represented as a URL, are an
abstraction introduced to provide a generic way of dealing with "blobs" and can
be resources inside a bundle, filesystem or some kind of data store.</p>
-<h2 id="resourceadapterservice">@ResourceAdapterService</h2>
+<p>A resource adapter will be applied to any resource that matches the
specified filter condition. For each matching resource an adapter will be
created based on the adapter implementation class. The adapter will be
registered with the specified interface and existing properties from the
original resource plus any extra properties you supply here. It will also
inherit all dependencies, and if you declare the original service as a member
it will be injected.</p>
+<p>Usage Example:</p>
+<div class="codehilite"><pre><span class="n">manager</span><span
class="p">.</span><span class="n">createResourceAdapterService</span><span
class="p">(</span>"<span class="p">(</span><span
class="o">&</span><span class="p">(</span><span class="n">path</span><span
class="p">=</span><span class="o">/</span><span class="n">test</span><span
class="p">)(</span><span class="n">repository</span><span
class="p">=</span><span class="n">TestRepository</span><span
class="p">))</span>"<span class="p">,</span> <span
class="n">true</span><span class="p">)</span>
+ <span class="p">.</span><span class="n">setInterface</span><span
class="p">(</span><span class="n">AdapterService</span><span
class="p">.</span><span class="n">class</span><span class="p">.</span><span
class="n">getName</span><span class="p">(),</span> <span class="n">new</span>
<span class="n">Hashtable</span><span class="p">()</span> <span
class="p">)</span>
+ <span class="p">.</span><span class="n">setImplementation</span><span
class="p">(</span><span class="n">AdapterServiceImpl</span><span
class="p">.</span><span class="n">class</span><span class="p">);</span>
+</pre></div>
+
+
+<h1 id="resourceadapterservice">@ResourceAdapterService</h1>
<p>Resource adapters are things that adapt a resource instead of a service,
and
provide an adapter service on top of this resource. Resources are an
abstraction that is introduced by the dependency manager, represented as a
URL. They can be implemented to serve resources embedded in bundles, somewhere
on a file system or in an http content repository server, or database.</p>
@@ -87,9 +95,9 @@ properties will be propagated from the r
<li><em>protocol</em>: the resource URL protocol</li>
<li><em>port</em>: the resource URL port </li>
</ul>
-<h3 id="annotation-attributes">Annotation attributes</h3>
+<h2 id="annotation-attributes">Annotation attributes</h2>
<p>TBD</p>
-<h3 id="usage-examples">Usage Examples:</h3>
+<h2 id="usage-examples">Usage Examples:</h2>
<p>Here, the "VideoPlayer" service provides a video service on top of any
movie
resources, with service properties "host"/"port"/"protocol"/"path" extracted
from the resource URL:</p>
@@ -104,7 +112,7 @@ from the resource URL:</p>
<span class="o">}</span>
</pre></div>
<div class="timestamp" style="margin-top: 30px; font-size: 80%;
text-align: right;">
- Rev. 1664040 by marrs on Wed, 4 Mar 2015 15:21:58 +0000
+ Rev. 1665268 by marrs on Mon, 9 Mar 2015 15:57:25 +0000
</div>
<div class="trademarkFooter">
Apache Felix, Felix, Apache, the Apache feather logo, and the Apache
Felix project
Modified:
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-singleton.html
==============================================================================
---
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-singleton.html
(original)
+++
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-singleton.html
Mon Mar 9 15:57:51 2015
@@ -68,9 +68,172 @@
<h1></h1>
-
+ <h1 id="component">Component</h1>
+<p>Components are the main building blocks for OSGi applications. They can
publish themselves as a service, and they can have dependencies. These
dependencies will influence their life cycle as component will only be
activated when all required dependencies are available.</p>
+<p>Usage example:</p>
+<div class="codehilite"><pre><span class="n">dm</span><span
class="p">.</span><span class="n">add</span><span class="p">(</span><span
class="n">createComponent</span><span class="p">()</span>
+ <span class="p">.</span><span class="n">setInterface</span><span
class="p">(</span><span class="n">TranslationService</span><span
class="p">.</span><span class="n">class</span><span class="p">.</span><span
class="n">getName</span><span class="p">(),</span> <span
class="n">null</span><span class="p">)</span>
+ <span class="p">.</span><span class="n">setImplementation</span><span
class="p">(</span><span class="n">GoogleBasedTranslationService</span><span
class="p">.</span><span class="n">class</span><span class="p">)</span>
+ <span class="p">.</span><span class="n">add</span><span
class="p">(</span><span class="n">createServiceDependency</span><span
class="p">()</span>
+ <span class="p">.</span><span class="n">setService</span><span
class="p">(</span><span class="n">LocalizationService</span><span
class="p">.</span><span class="n">class</span><span class="p">,</span>
"<span class="p">(</span><span class="n">language</span><span
class="p">=</span><span class="n">en</span><span class="p">)</span>"<span
class="p">)</span>
+ <span class="p">.</span><span class="n">setRequired</span><span
class="p">(</span><span class="n">true</span><span class="p">)</span>
+ <span class="p">)</span>
+ <span class="p">.</span><span class="n">add</span><span
class="p">(</span><span class="n">createServiceDependency</span><span
class="p">()</span>
+ <span class="p">.</span><span class="n">setService</span><span
class="p">(</span><span class="n">LogService</span><span
class="p">.</span><span class="n">class</span><span class="p">)</span>
+ <span class="p">.</span><span class="n">setRequired</span><span
class="p">(</span><span class="n">false</span><span class="p">)</span>
+ <span class="p">)</span>
+<span class="p">);</span>
+</pre></div>
+
+
+<h1 id="component_1">@Component</h1>
+<p>This annotation annotates an implementation class that optionally publishes
+an OSGi service, and optionally has some dependencies, with a managed
+lifecycle. </p>
+<h2 id="annotation-attributes">Annotation attributes</h2>
+<hr />
+<p><strong><code>provides</code></strong> <br />
+<em>Required</em>: No <br />
+<em>Default</em>: all implemented interfaces, if any. </p>
+<p>By default, the component is registered into the OSGi registry under all
+directly implemented interfaces. If no interfaces are implemented, then the
+component is not registered, but it still has a managed lifecycle, and may
+have some dependencies. If you need to explicitly define the list of
+interfaces (or classes) under which the component must be registered in the
+OSGi registry, then use the <em>provides</em> attribute. You can also set this
+property to an empty array of classes if you don't want at all your component
+to be exposed in the OSGi registry (even if it implements some
interfaces).</p>
+<hr />
+<p><strong><code>properties</code></strong> <br />
+<em>Required</em>: No <br />
+<em>Default</em>: -- </p>
+<p>the <em>properties" attribute enumerates the list of properties that are
part of
+the Service exposed by the component in the OSGi Registry.
+Each property is defined using the @Property annotation, which represents a<br
/>
+key/value pair. When a value is actually an array of strings,
+then the </em>values* attribute of the @Property annotation can be used.
+This attribute is not the only way to specify OSGi Service properties
+(see Setting Service properties in the lifecycle section).</p>
+<hr />
+<p><strong><code>factoryMethod</code></strong> <br />
+<em>Required</em>: No <br />
+<em>Default</em>: -- </p>
+<p>This attribute refers to a static method name from the annotated class
which
+can be used to instantiate the component instance. Normally, DependencyManager
+instantiates the component using its class name, and with the default
+constructor of the class, but there are some cases where it is required to
+take control of how the component is created. For instance, this method may
+be used to create the component as a dynamic proxy ...</p>
+<hr />
+<p><strong><code>factoryName</code></strong> <br />
+<em>Required</em>: No <br />
+<em>Default</em>: -- </p>
+<p>This attribute is the identifier for a component factory. By default, a
+component is automatically instantiated as a singleton when the bundle is
+started, and when all required dependencies are satisfied. But when a
+component must be created, configured, or disposed dynamically, and when
+multiple instances of the same component are needed, a factoryName can be
+used. When you use this attribute, a
<em>org.apache.felix.dm.runtime.api.ComponentFactory</em>
+OSGi Service will be provided with a <em>dm.factory.name</em> service property
matching your
+specified factoryName attribute. The ComponentFactory will be provided once
the
+component bundle is started, even if required dependencies are not available,
+and the ComponentFactory will be unregistered from the OSGi registry once the
component
+bundle is stopped or disposed using the <em>ComponentInstance.dispose()</em>
method.</p>
+<hr />
+<p><strong><code>factoryConfigure</code></strong> <br />
+<em>Required</em>: No <br />
+<em>Default</em>: -- </p>
+<p>This attributes sets the <em>configure</em> method name to be called with
the factory
+configuration. This attribute only makes sense if the <em>factoryName</em>
attribute
+is used. If specified, then this attribute references a component callback
+method, which is called for providing the configuration supplied by the
+factory that instantiated this component. The current Service properties will
+be also updated with all public properties (which don't start with a dot).</p>
+<p>Usage example:</p>
+<div class="codehilite"><pre><span class="cm">/**</span>
+<span class="cm"> * This component will be activated once the bundle is
started and when all required dependencies</span>
+<span class="cm"> * are available.</span>
+<span class="cm"> */</span>
+<span class="nd">@Component</span>
+<span class="kd">class</span> <span class="nc">X</span> <span
class="kd">implements</span> <span class="n">Z</span> <span class="o">{</span>
+ <span class="nd">@ConfigurationDependency</span><span
class="o">(</span><span class="n">pid</span><span class="o">=</span><span
class="s">"MyPid"</span><span class="o">)</span>
+ <span class="kt">void</span> <span class="nf">configure</span><span
class="o">(</span><span class="n">Dictionary</span> <span
class="n">conf</span><span class="o">)</span> <span class="o">{</span>
+ <span class="c1">// Configure or reconfigure our service.</span>
+ <span class="o">}</span>
+
+ <span class="nd">@Start</span>
+ <span class="kt">void</span> <span class="nf">start</span><span
class="o">()</span> <span class="o">{</span>
+ <span class="c1">// Our component is starting and is about to be
registered in the OSGi registry as a Z service.</span>
+ <span class="o">}</span>
+
+ <span class="kd">public</span> <span class="kt">void</span> <span
class="nf">doService</span><span class="o">()</span> <span class="o">{</span>
+ <span class="c1">// ...</span>
+ <span class="o">}</span>
+<span class="o">}</span>
+</pre></div>
+
+
+<p>Example using a factoryName, where the X component is
instantiated/updated/disposed by another Y component:</p>
+<div class="codehilite"><pre> <span class="kn">import</span> <span
class="nn">org.apache.felix.dm.runtime.api.ComponentFactory</span><span
class="o">;</span>
+ <span class="kn">import</span> <span
class="nn">org.apache.felix.dm.runtime.api.ComponentInstance</span><span
class="o">;</span>
+
+ <span class="nd">@Component</span><span class="o">(</span><span
class="n">factoryName</span><span class="o">=</span><span
class="s">"MyComponentFactory"</span><span class="o">,</span> <span
class="n">factoryConfigure</span><span class="o">=</span><span
class="s">"configure"</span><span class="o">)</span>
+ <span class="kd">class</span> <span class="nc">X</span> <span
class="kd">implements</span> <span class="n">Z</span> <span class="o">{</span>
+ <span class="kt">void</span> <span class="nf">configure</span><span
class="o">(</span><span class="n">Dictionary</span> <span
class="n">conf</span><span class="o">)</span> <span class="o">{</span>
+ <span class="c1">// Configure or reconfigure our component. The conf
is provided by </span>
+ <span class="c1">// the factory, and all public properties (which
don't</span>
+ <span class="c1">// start with a dot) are propagated with the
Service</span>
+ <span class="c1">// properties eventually specified in the
properties</span>
+ <span class="c1">// annotation attribute.</span>
+ <span class="o">}</span>
+
+ <span class="nd">@ServiceDependency</span>
+ <span class="kt">void</span> <span
class="nf">bindOtherService</span><span class="o">(</span><span
class="n">OtherService</span> <span class="n">other</span><span
class="o">)</span> <span class="o">{</span>
+ <span class="c1">// store this require dependency</span>
+ <span class="o">}</span>
+
+ <span class="nd">@Start</span>
+ <span class="kt">void</span> <span class="nf">start</span><span
class="o">()</span> <span class="o">{</span>
+ <span class="c1">// Our component is starting and is about to be
registered</span>
+ <span class="c1">// in the OSGi registry as a Z service.</span>
+ <span class="o">}</span>
+
+ <span class="kd">public</span> <span class="kt">void</span> <span
class="nf">doService</span><span class="o">()</span> <span class="o">{</span>
+ <span class="c1">// ... part of Z interface</span>
+ <span class="o">}</span>
+ <span class="o">}</span>
+
+ <span class="cm">/**</span>
+<span class="cm"> * This class will instantiate some X component
instances</span>
+<span class="cm"> */</span>
+ <span class="nd">@Component</span>
+ <span class="kd">class</span> <span class="nc">Y</span> <span
class="o">{</span>
+ <span class="c1">// This Set acts as a Factory API for creating X
component instances.</span>
+ <span class="nd">@ServiceDependency</span><span class="o">(</span><span
class="n">filter</span><span class="o">=</span><span
class="s">"(dm.factory.name=MyComponentFactory)"</span><span
class="o">)</span>
+ <span class="n">ComponentFactory</span> <span
class="n">_XFactory</span><span class="o">;</span>
+
+ <span class="nd">@Start</span>
+ <span class="kt">void</span> <span class="nf">start</span><span
class="o">()</span> <span class="o">{</span>
+ <span class="c1">// Instantiate a X component instance</span>
+ <span class="n">Dictionary</span> <span class="n">x1</span> <span
class="o">=</span> <span class="k">new</span> <span
class="n">Hashtable</span><span class="o">()</span> <span class="o">;</span>
+ <span class="n">ComponentInstance</span> <span class="n">i1</span>
<span class="o">=</span> <span class="n">_XFactory</span><span
class="o">.</span><span class="na">newInstance</span><span
class="o">(</span><span class="n">x1</span><span class="o">);</span>
+
+ <span class="c1">// Instantiate another X component instance</span>
+ <span class="n">Dictionary</span> <span class="n">x2</span> <span
class="o">=</span> <span class="k">new</span> <span
class="n">Hashtable</span><span class="o">()</span> <span class="o">;</span>
+ <span class="n">ComponentInstance</span> <span class="n">i2</span>
<span class="o">=</span> <span class="n">_XFactory</span><span
class="o">.</span><span class="na">newInstance</span><span
class="o">(</span><span class="n">x2</span><span class="o">);</span>
+
+ <span class="c1">// Update the first X component instance</span>
+ <span class="n">x1</span> <span class="o">=</span> <span
class="k">new</span> <span class="n">Hashtable</span><span class="o">()</span>
<span class="o">;</span>
+ <span class="n">i1</span><span class="o">.</span><span
class="na">update</span><span class="o">(</span><span class="n">x1</span><span
class="o">);</span>
+
+ <span class="c1">// Destroy components</span>
+ <span class="n">i1</span><span class="o">.</span><span
class="na">dispose</span><span class="o">();</span>
+ <span class="n">i2</span><span class="o">.</span><span
class="na">dispose</span><span class="o">();</span>
+ <span class="o">}</span>
+<span class="o">}</span>
+</pre></div>
<div class="timestamp" style="margin-top: 30px; font-size: 80%;
text-align: right;">
- Rev. 1663924 by marrs on Wed, 4 Mar 2015 10:39:19 +0000
+ Rev. 1665268 by marrs on Mon, 9 Mar 2015 15:57:25 +0000
</div>
<div class="trademarkFooter">
Apache Felix, Felix, Apache, the Apache feather logo, and the Apache
Felix project
Modified:
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/components.html
==============================================================================
---
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/components.html
(original)
+++
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/components.html
Mon Mar 9 15:57:51 2015
@@ -80,8 +80,7 @@
<li><a href="component-singleton.html"><em>Resource Adapter Service</em></a>:
creates an OSGi service on top of a specific Resource.</li>
<li><a href="component-singleton.html"><em>Factory Configuration Adapter
Service</em></a>: creates an OSGi service from ConfigAdmin, using a factoryPid,
and a ManagedServiceFactory.</li>
</ul>
-<h1 id="component">Component</h1>
-<h2 id="life-cycle">Life cycle</h2>
+<h1 id="life-cycle">Life cycle</h1>
<p>The dependency manager, as part of a bundle, shares the generic bundle life
cycle explained in the OSGi specification. The life cycle of the dependency
manager itself, and the components it manages, can be located inside the
<em>active</em> state of the hosting bundle.</p>
<p>Each component you define gets its own life cycle, which is explained in
the state diagram below.</p>
<p>TODO {gliffy:name=state-diagram|align=center|size=L|version=2}</p>
@@ -95,165 +94,18 @@
</ul>
<p>The dependency manager will look for methods with these names and one of
the following signatures in this order:</p>
<ul>
-<li>(Component),</li>
-<li>().</li>
+<li><code>(Component)</code>,</li>
+<li><code>()</code>.</li>
</ul>
<p>If you don't specify anything, the methods with these names will be invoked
on the instance. By using <code>setCallbacks()</code> you can however change
this behavior: You can change the names of the methods to look for. Any methods
that are set to <code>null</code> will not be invoked at all. Another thing you
can do is to specify a different instance to invoke these methods on. If you do
that, you will usually want to use the first signature, which gives you a
reference to the <code>Component</code> whose life cycle method was invoked.</p>
-<h2 id="interfaces-and-properties">Interfaces and properties</h2>
+<h1 id="interfaces-and-properties">Interfaces and properties</h1>
<p>Components in the context of the dependency manager can be published as
OSGi services under one or more interface names, plus optionally a set of
properties. This is no different than a normal OSGi service. It's important to
mention that you don't have to register a service. If you don't, you basically
created a component that can do work and have dependencies and a managed life
cycle.</p>
-<h2 id="composition">Composition</h2>
+<h1 id="composition">Composition</h1>
<p>When implementing more complex components, you often find yourself using
more than one instance. However, several of these instances might want to have
dependencies injected. In such cases you need to tell the dependency manager
which instances to consider. This has to be a fixed set of instances
however.</p>
-<h2 id="factories">Factories</h2>
+<h1 id="factories">Factories</h1>
<p>Out of the box, there already is support for lazy instantiation, meaning
that the dependency manager can create component instances for you when their
required dependencies are resolved. However, sometimes creating a single
instance using a default constructor is not enough. In those cases, you can
tell the dependency manager to delegate the creation process to a factory.</p>
-<h1 id="annotations">Annotations</h1>
-<h2 id="component_1">@Component</h2>
-<p>This annotation annotates an implementation class that optionally publishes
-an OSGi service, and optionally has some dependencies, with a managed
-lifecycle. </p>
-<h3 id="annotation-attributes">Annotation attributes</h3>
-<hr />
-<p><strong><code>provides</code></strong> <br />
-<em>Required</em>: No <br />
-<em>Default</em>: all implemented interfaces, if any. </p>
-<p>By default, the component is registered into the OSGi registry under all
-directly implemented interfaces. If no interfaces are implemented, then the
-component is not registered, but it still has a managed lifecycle, and may
-have some dependencies. If you need to explicitly define the list of
-interfaces (or classes) under which the component must be registered in the
-OSGi registry, then use the <em>provides</em> attribute. You can also set this
-property to an empty array of classes if you don't want at all your component
-to be exposed in the OSGi registry (even if it implements some
interfaces).</p>
-<hr />
-<p><strong><code>properties</code></strong> <br />
-<em>Required</em>: No <br />
-<em>Default</em>: -- </p>
-<p>the <em>properties" attribute enumerates the list of properties that are
part of
-the Service exposed by the component in the OSGi Registry.
-Each property is defined using the @Property annotation, which represents a<br
/>
-key/value pair. When a value is actually an array of strings,
-then the </em>values* attribute of the @Property annotation can be used.
-This attribute is not the only way to specify OSGi Service properties
-(see Setting Service properties in the lifecycle section).</p>
-<hr />
-<p><strong><code>factoryMethod</code></strong> <br />
-<em>Required</em>: No <br />
-<em>Default</em>: -- </p>
-<p>This attribute refers to a static method name from the annotated class
which
-can be used to instantiate the component instance. Normally, DependencyManager
-instantiates the component using its class name, and with the default
-constructor of the class, but there are some cases where it is required to
-take control of how the component is created. For instance, this method may
-be used to create the component as a dynamic proxy ...</p>
-<hr />
-<p><strong><code>factoryName</code></strong> <br />
-<em>Required</em>: No <br />
-<em>Default</em>: -- </p>
-<p>This attribute is the identifier for a component factory. By default, a
-component is automatically instantiated as a singleton when the bundle is
-started, and when all required dependencies are satisfied. But when a
-component must be created, configured, or disposed dynamically, and when
-multiple instances of the same component are needed, a factoryName can be
-used. When you use this attribute, a
<em>org.apache.felix.dm.runtime.api.ComponentFactory</em>
-OSGi Service will be provided with a <em>dm.factory.name</em> service property
matching your
-specified factoryName attribute. The ComponentFactory will be provided once
the
-component bundle is started, even if required dependencies are not available,
-and the ComponentFactory will be unregistered from the OSGi registry once the
component
-bundle is stopped or disposed using the <em>ComponentInstance.dispose()</em>
method.</p>
-<hr />
-<p><strong><code>factoryConfigure</code></strong> <br />
-<em>Required</em>: No <br />
-<em>Default</em>: -- </p>
-<p>This attributes sets the <em>configure</em> method name to be called with
the factory
-configuration. This attribute only makes sense if the <em>factoryName</em>
attribute
-is used. If specified, then this attribute references a component callback
-method, which is called for providing the configuration supplied by the
-factory that instantiated this component. The current Service properties will
-be also updated with all public properties (which don't start with a dot).</p>
-<p>Usage example:</p>
-<div class="codehilite"><pre><span class="cm">/**</span>
-<span class="cm"> * This component will be activated once the bundle is
started and when all required dependencies</span>
-<span class="cm"> * are available.</span>
-<span class="cm"> */</span>
-<span class="nd">@Component</span>
-<span class="kd">class</span> <span class="nc">X</span> <span
class="kd">implements</span> <span class="n">Z</span> <span class="o">{</span>
- <span class="nd">@ConfigurationDependency</span><span
class="o">(</span><span class="n">pid</span><span class="o">=</span><span
class="s">"MyPid"</span><span class="o">)</span>
- <span class="kt">void</span> <span class="nf">configure</span><span
class="o">(</span><span class="n">Dictionary</span> <span
class="n">conf</span><span class="o">)</span> <span class="o">{</span>
- <span class="c1">// Configure or reconfigure our service.</span>
- <span class="o">}</span>
-
- <span class="nd">@Start</span>
- <span class="kt">void</span> <span class="nf">start</span><span
class="o">()</span> <span class="o">{</span>
- <span class="c1">// Our component is starting and is about to be
registered in the OSGi registry as a Z service.</span>
- <span class="o">}</span>
-
- <span class="kd">public</span> <span class="kt">void</span> <span
class="nf">doService</span><span class="o">()</span> <span class="o">{</span>
- <span class="c1">// ...</span>
- <span class="o">}</span>
-<span class="o">}</span>
-</pre></div>
-
-
-<p>Example using a factoryName, where the X component is
instantiated/updated/disposed by another Y component:</p>
-<div class="codehilite"><pre> <span class="kn">import</span> <span
class="nn">org.apache.felix.dm.runtime.api.ComponentFactory</span><span
class="o">;</span>
- <span class="kn">import</span> <span
class="nn">org.apache.felix.dm.runtime.api.ComponentInstance</span><span
class="o">;</span>
-
- <span class="nd">@Component</span><span class="o">(</span><span
class="n">factoryName</span><span class="o">=</span><span
class="s">"MyComponentFactory"</span><span class="o">,</span> <span
class="n">factoryConfigure</span><span class="o">=</span><span
class="s">"configure"</span><span class="o">)</span>
- <span class="kd">class</span> <span class="nc">X</span> <span
class="kd">implements</span> <span class="n">Z</span> <span class="o">{</span>
- <span class="kt">void</span> <span class="nf">configure</span><span
class="o">(</span><span class="n">Dictionary</span> <span
class="n">conf</span><span class="o">)</span> <span class="o">{</span>
- <span class="c1">// Configure or reconfigure our component. The conf
is provided by </span>
- <span class="c1">// the factory, and all public properties (which
don't</span>
- <span class="c1">// start with a dot) are propagated with the
Service</span>
- <span class="c1">// properties eventually specified in the
properties</span>
- <span class="c1">// annotation attribute.</span>
- <span class="o">}</span>
-
- <span class="nd">@ServiceDependency</span>
- <span class="kt">void</span> <span
class="nf">bindOtherService</span><span class="o">(</span><span
class="n">OtherService</span> <span class="n">other</span><span
class="o">)</span> <span class="o">{</span>
- <span class="c1">// store this require dependency</span>
- <span class="o">}</span>
-
- <span class="nd">@Start</span>
- <span class="kt">void</span> <span class="nf">start</span><span
class="o">()</span> <span class="o">{</span>
- <span class="c1">// Our component is starting and is about to be
registered</span>
- <span class="c1">// in the OSGi registry as a Z service.</span>
- <span class="o">}</span>
-
- <span class="kd">public</span> <span class="kt">void</span> <span
class="nf">doService</span><span class="o">()</span> <span class="o">{</span>
- <span class="c1">// ... part of Z interface</span>
- <span class="o">}</span>
- <span class="o">}</span>
-
- <span class="cm">/**</span>
-<span class="cm"> * This class will instantiate some X component
instances</span>
-<span class="cm"> */</span>
- <span class="nd">@Component</span>
- <span class="kd">class</span> <span class="nc">Y</span> <span
class="o">{</span>
- <span class="c1">// This Set acts as a Factory API for creating X
component instances.</span>
- <span class="nd">@ServiceDependency</span><span class="o">(</span><span
class="n">filter</span><span class="o">=</span><span
class="s">"(dm.factory.name=MyComponentFactory)"</span><span
class="o">)</span>
- <span class="n">ComponentFactory</span> <span
class="n">_XFactory</span><span class="o">;</span>
-
- <span class="nd">@Start</span>
- <span class="kt">void</span> <span class="nf">start</span><span
class="o">()</span> <span class="o">{</span>
- <span class="c1">// Instantiate a X component instance</span>
- <span class="n">Dictionary</span> <span class="n">x1</span> <span
class="o">=</span> <span class="k">new</span> <span
class="n">Hashtable</span><span class="o">()</span> <span class="o">;</span>
- <span class="n">ComponentInstance</span> <span class="n">i1</span>
<span class="o">=</span> <span class="n">_XFactory</span><span
class="o">.</span><span class="na">newInstance</span><span
class="o">(</span><span class="n">x1</span><span class="o">);</span>
-
- <span class="c1">// Instantiate another X component instance</span>
- <span class="n">Dictionary</span> <span class="n">x2</span> <span
class="o">=</span> <span class="k">new</span> <span
class="n">Hashtable</span><span class="o">()</span> <span class="o">;</span>
- <span class="n">ComponentInstance</span> <span class="n">i2</span>
<span class="o">=</span> <span class="n">_XFactory</span><span
class="o">.</span><span class="na">newInstance</span><span
class="o">(</span><span class="n">x2</span><span class="o">);</span>
-
- <span class="c1">// Update the first X component instance</span>
- <span class="n">x1</span> <span class="o">=</span> <span
class="k">new</span> <span class="n">Hashtable</span><span class="o">()</span>
<span class="o">;</span>
- <span class="n">i1</span><span class="o">.</span><span
class="na">update</span><span class="o">(</span><span class="n">x1</span><span
class="o">);</span>
-
- <span class="c1">// Destroy components</span>
- <span class="n">i1</span><span class="o">.</span><span
class="na">dispose</span><span class="o">();</span>
- <span class="n">i2</span><span class="o">.</span><span
class="na">dispose</span><span class="o">();</span>
- <span class="o">}</span>
-<span class="o">}</span>
-</pre></div>
<div class="timestamp" style="margin-top: 30px; font-size: 80%;
text-align: right;">
- Rev. 1664923 by pderop on Sat, 7 Mar 2015 21:41:46 +0000
+ Rev. 1665268 by marrs on Mon, 9 Mar 2015 15:57:25 +0000
</div>
<div class="trademarkFooter">
Apache Felix, Felix, Apache, the Apache feather logo, and the Apache
Felix project