You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by bu...@apache.org on 2018/10/09 13:34:01 UTC

svn commit: r1036188 - in /websites/staging/felix/trunk/content: ./ documentation/subprojects/apache-felix-dependency-manager/reference/component-factory-configuration-adapter.html

Author: buildbot
Date: Tue Oct  9 13:34:01 2018
New Revision: 1036188

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/reference/component-factory-configuration-adapter.html

Propchange: websites/staging/felix/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Tue Oct  9 13:34:01 2018
@@ -1 +1 @@
-1843263
+1843265

Modified: websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager/reference/component-factory-configuration-adapter.html
==============================================================================
--- websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager/reference/component-factory-configuration-adapter.html (original)
+++ websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager/reference/component-factory-configuration-adapter.html Tue Oct  9 13:34:01 2018
@@ -88,8 +88,16 @@ h2:hover > .headerlink, h3:hover > .head
   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 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>
-<h2 id="example-using-dm-api">Example using DM API<a class="headerlink" href="#example-using-dm-api" title="Permanent link">&para;</a></h2>
+<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>To define an adapter component, you need to create an <a href="http://felix.staging.apache.org/apidocs/dependencymanager/r12/org/apache/felix/dm/FactoryComponent.html">FactoryComponent</a> component
+using the DependencyActivatorBase.createFactoryComponent() or the DependencyManager.createFactoryComponent() method.
+The FactoryComponent interface extends the Component interface in order to add extra setters methods needed to define a factory configuration adapter service component.</p>
+<p>Example usage:</p>
 <p>Here is a sample showing a "MyComponent" component, which can be instantiated multiple times using a factory configuration:</p>
 <div class="codehilite"><pre><span class="kd">public</span> <span class="kd">interface</span> <span class="nc">MyConfig</span> <span class="o">{</span>
     <span class="kt">int</span> <span class="nf">getPort</span><span class="o">();</span>
@@ -116,33 +124,8 @@ h2:hover > .headerlink, h3:hover > .head
     <span class="o">}</span>
 <span class="o">}</span>
 </pre></div>
-
-
-<h2 id="example-using-dm-lambda-api">Example using DM Lambda API<a class="headerlink" href="#example-using-dm-lambda-api" title="Permanent link">&para;</a></h2>
-<div class="codehilite"><pre><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Activator</span> <span class="kd">extends</span> <span class="n">DependencyManagerActivator</span> <span class="o">{</span>
-    <span class="kd">public</span> <span class="kt">void</span> <span class="nf">init</span><span class="o">(</span><span class="n">BundleContext</span> <span class="n">ctx</span><span class="o">,</span> <span class="n">DependencyManager</span> <span class="n">dm</span><span class="o">)</span> <span class="kd">throws</span> <span class="n">Exception</span> <span class="o">{</span> 
-        <span class="n">factoryPidAdapter</span><span class="o">(</span><span class="n">adapter</span> <span class="o">-&gt;</span> <span class="n">adapter</span>
-            <span class="o">.</span><span class="na">factoryPid</span><span class="o">(</span><span class="s">&quot;my.factory.pid&quot;</span><span class="o">)</span>
-            <span class="o">.</span><span class="na">provides</span><span class="o">(</span><span class="n">MySevice</span><span class="o">.</span><span class="na">class</span><span class="o">)</span>
-            <span class="o">.</span><span class="na">impl</span><span class="o">(</span><span class="n">DictionaryImpl</span><span class="o">.</span><span class="na">class</span><span class="o">)</span>
-            <span class="o">.</span><span class="na">update</span><span class="o">(</span><span class="n">MyConfig</span><span class="o">.</span><span class="na">class</span><span class="o">,</span> <span class="nl">MyComponent:</span><span class="o">:</span><span class="n">updated</span><span class="o">)</span>                
-   <span class="o">}</span>
-<span class="o">}</span>
-</pre></div>
-
-
-<h2 id="example-using-dm-annotations">Example using DM Annotations<a class="headerlink" href="#example-using-dm-annotations" title="Permanent link">&para;</a></h2>
-<div class="codehilite"><pre><span class="nd">@Component</span><span class="o">(</span><span class="n">factoryPid</span> <span class="o">=</span> <span class="s">&quot;my.factory.pid&quot;</span><span class="o">)</span>
-<span class="kd">public</span> <span class="kd">class</span> <span class="nc">MyComponent</span> <span class="kd">implements</span> <span class="n">MyService</span> <span class="o">{</span>
-    <span class="kt">void</span> <span class="nf">updated</span><span class="o">(</span><span class="n">MyConfig</span> <span class="n">cnf</span><span class="o">)</span> <span class="o">{</span>
-        <span class="kt">int</span> <span class="n">port</span> <span class="o">=</span> <span class="n">cnf</span><span class="o">.</span><span class="na">getPort</span><span class="o">();</span>
-        <span class="n">String</span> <span class="n">addr</span> <span class="o">=</span> <span class="n">cnf</span><span class="o">.</span><span class="na">getAddress</span><span class="o">();</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. 1842565 by pderop on Mon, 1 Oct 2018 21:06:15 +0000
+        Rev. 1843265 by pderop on Tue, 9 Oct 2018 13:33:43 +0000
       </div>
       <div class="trademarkFooter"> 
         Apache Felix, Felix, Apache, the Apache feather logo, and the Apache Felix project