felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r942347 - in /websites/staging/felix/trunk/content: ./ documentation/subprojects/apache-felix-dependency-manager-4/tutorials/getting-started.html documentation/subprojects/apache-felix-dependency-manager-4/tutorials/leveraging-the-shell.html
Date Wed, 04 Mar 2015 18:52:37 GMT
Author: buildbot
Date: Wed Mar  4 18:52:37 2015
New Revision: 942347

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/tutorials/getting-started.html
    websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/tutorials/leveraging-the-shell.html

Propchange: websites/staging/felix/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Wed Mar  4 18:52:37 2015
@@ -1 +1 @@
-1664094
+1664113

Modified: websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/tutorials/getting-started.html
==============================================================================
--- websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/tutorials/getting-started.html
(original)
+++ websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/tutorials/getting-started.html
Wed Mar  4 18:52:37 2015
@@ -76,8 +76,9 @@
 </ol>
 <p>When using the dependency manager, your bundle activator is a subclass of <code>DependencyActivatorBase</code>.
It needs to implement the <code>init</code> life cycle method and can optionally
also implement a <code>destroy</code> method. Both methods take two arguments:
<code>BundleContext</code> and <code>DependencyManager</code>. The
latter is your interface to the declarative API you can use to define your components and
dependencies.</p>
 <p>The following paragraphs will show various examples that explain how to do this.
Subsequently, some more advanced scenarios will be covered that involve listening to dependency
and component state changes and interacting with the OSGi framework from within your component
implementation.</p>
+<p>To use the dependency manager, you should put the <code>org.apache.felix.dependencymanager.jar</code>
in your classpath while compiling and in your OSGi framework when running.</p>
 <h3 id="registering-a-service">Registering a service</h3>
-<p>The first example is about registering a service. We extend <code>DependencyActivatorBase</code>
and in the init method we use the reference to the <code>DependencyManager</code>
to create and add a component. For this component we subsequently set its service interface
and implementation. In this case the interface is the <code>Store</code> interface,
the second parameter, null, allows you to provide properties along with the service registration.
For the implementation, we only mention the <code>Class</code> of the implementation,
which means the dependency manager will lazily instantiate it. In this case, there is not
much point in doing that because the component has no dependencies, but if it had, the instantiation
would only happen when those dependencies were resolved.</p>
+<p>The first example is about registering a service. We extend <code>DependencyActivatorBase</code>
and in the <code>init</code> method we use the reference to the <code>DependencyManager</code>
to create and add a component. For this component we subsequently set its service interface
and implementation. In this case the interface is the <code>Store</code> interface,
the second parameter, <code>null</code>, allows you to provide properties along
with the service registration. For the implementation, we only mention the <code>Class</code>
of the implementation, which means the dependency manager will lazily instantiate it. In this
case, there is not much point in doing that because the component has no dependencies, but
if it had, the instantiation would only happen when those dependencies were resolved.</p>
 <p>Notice that the dependency manager API uses method chaining to create a more or
less "fluent" API that, with proper indentation, is very easy to read.</p>
 <div class="codehilite"><pre><span class="n">public</span> <span
class="n">class</span> <span class="n">Activator</span> <span class="n">extends</span>
<span class="n">DependencyActivatorBase</span> <span class="p">{</span>
     <span class="n">public</span> <span class="n">void</span> <span
class="n">init</span><span class="p">(</span><span class="n">BundleContext</span>
<span class="n">context</span><span class="p">,</span> <span class="n">DependencyManager</span>
<span class="n">manager</span><span class="p">)</span> <span class="n">throws</span>
<span class="n">Exception</span> <span class="p">{</span>
@@ -86,8 +87,6 @@
             <span class="p">.</span><span class="n">setImplementation</span><span
class="p">(</span><span class="n">MemoryStore</span><span class="p">.</span><span
class="n">class</span><span class="p">)</span>
         <span class="p">);</span>
     <span class="p">}</span>
-
-    <span class="n">public</span> <span class="n">void</span> <span
class="n">destroy</span><span class="p">(</span><span class="n">BundleContext</span>
<span class="n">context</span><span class="p">,</span> <span class="n">DependencyManager</span>
<span class="n">manager</span><span class="p">)</span> <span class="n">throws</span>
<span class="n">Exception</span> <span class="p">{}</span>
 <span class="p">}</span>
 </pre></div>
 
@@ -131,8 +130,6 @@
             <span class="p">)</span>
         <span class="p">);</span>
     <span class="p">}</span>
-
-    <span class="n">public</span> <span class="n">void</span> <span
class="n">destroy</span><span class="p">(</span><span class="n">BundleContext</span>
<span class="n">context</span><span class="p">,</span> <span class="n">DependencyManager</span>
<span class="n">manager</span><span class="p">)</span> <span class="n">throws</span>
<span class="n">Exception</span> <span class="p">{}</span>
 <span class="p">}</span>
 </pre></div>
 
@@ -166,8 +163,6 @@
             <span class="p">)</span>
         <span class="p">);</span>
     <span class="p">}</span>
-
-    <span class="n">public</span> <span class="n">void</span> <span
class="n">destroy</span><span class="p">(</span><span class="n">BundleContext</span>
<span class="n">context</span><span class="p">,</span> <span class="n">DependencyManager</span>
<span class="n">manager</span><span class="p">)</span> <span class="n">throws</span>
<span class="n">Exception</span> <span class="p">{}</span>
 <span class="p">}</span>
 </pre></div>
 
@@ -215,8 +210,6 @@
             <span class="p">)</span>
         <span class="p">);</span>
     <span class="p">}</span>
-
-    <span class="n">public</span> <span class="n">void</span> <span
class="n">destroy</span><span class="p">(</span><span class="n">BundleContext</span>
<span class="n">context</span><span class="p">,</span> <span class="n">DependencyManager</span>
<span class="n">manager</span><span class="p">)</span> <span class="n">throws</span>
<span class="n">Exception</span> <span class="p">{}</span>
 <span class="p">}</span>
 </pre></div>
 
@@ -240,7 +233,7 @@
 <span class="p">}</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. 1664113 by marrs on Wed, 4 Mar 2015 18:52:20 +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/tutorials/leveraging-the-shell.html
==============================================================================
--- websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/tutorials/leveraging-the-shell.html
(original)
+++ websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/tutorials/leveraging-the-shell.html
Wed Mar  4 18:52:37 2015
@@ -80,11 +80,18 @@
       <span class="n">stats</span><span class="p">,</span> <span
class="n">stat</span><span class="p">,</span> <span class="n">st</span>
  <span class="n">Displays</span> <span class="n">components</span>
<span class="n">statistics</span>
       <span class="n">wtf</span>               <span class="n">Detects</span>
<span class="n">where</span> <span class="n">are</span> <span class="n">the</span>
<span class="n">root</span> <span class="n">failures</span>
    <span class="n">options</span><span class="p">:</span>
-      <span class="n">bundleIds</span><span class="p">,</span> <span
class="n">bid</span><span class="p">,</span> <span class="n">bi</span><span
class="p">,</span> <span class="n">b</span> <span class="o">&lt;</span><span
class="n">List</span> <span class="n">of</span> <span class="n">bundle</span>
<span class="n">ids</span> <span class="n">or</span> <span class="n">bundle</span>
<span class="n">symbolic</span> <span class="n">names</span> <span
class="n">to</span> <span class="n">display</span> <span class="p">(</span><span
class="n">comma</span> <span class="n">separated</span><span class="p">)</span><span
class="o">&gt;</span> <span class="p">[</span><span class="n">optional</span><span
class="p">]</span>
-      <span class="n">componentIds</span><span class="p">,</span>
<span class="n">cid</span><span class="p">,</span> <span class="n">ci</span>
<span class="o">&lt;</span><span class="n">List</span> <span
class="n">of</span> <span class="n">component</span> <span class="n">identifiers</span>
<span class="n">to</span> <span class="n">display</span> <span
class="p">(</span><span class="n">comma</span> <span class="n">separated</span><span
class="p">)</span><span class="o">&gt;</span> <span class="p">[</span><span
class="n">optional</span><span class="p">]</span>
-      <span class="n">components</span><span class="p">,</span> <span
class="n">c</span> <span class="o">&lt;</span><span class="n">Regex</span><span
class="p">(</span><span class="n">s</span><span class="p">)</span>
<span class="n">used</span> <span class="n">to</span> <span class="n">filter</span>
<span class="n">on</span> <span class="n">component</span> <span
class="n">implementation</span> <span class="n">class</span> <span
class="n">names</span> <span class="p">(</span><span class="n">comma</span>
<span class="n">separated</span><span class="p">),</span> <span
class="n">can</span> <span class="n">be</span> <span class="n">negated</span>
<span class="n">using</span> &quot;!&quot; <span class="n">prefix</span><span
class="o">&gt;</span> <span class="p">[</span><span class="n">optional</span><span
class="p">]</span>
-      <span class="n">services</span><span class="p">,</span> <span
class="n">s</span> <span class="o">&lt;</span><span class="n">OSGi</span>
<span class="n">filter</span> <span class="n">used</span> <span
class="n">to</span> <span class="n">filter</span> <span class="n">some</span>
<span class="n">service</span> <span class="k">properties</span><span
class="o">&gt;</span> <span class="p">[</span><span class="n">optional</span><span
class="p">]</span>
-      <span class="n">top</span> <span class="o">&lt;</span><span
class="n">Max</span> <span class="n">number</span> <span class="n">of</span>
<span class="n">top</span> <span class="n">components</span> <span
class="n">to</span> <span class="n">display</span> <span class="p">(</span>0<span
class="p">=</span><span class="n">all</span><span class="p">)</span><span
class="o">&gt;</span> <span class="n">This</span> <span class="n">command</span>
<span class="n">displays</span> <span class="n">components</span>
<span class="n">callbacks</span> <span class="p">(</span><span
class="n">init</span><span class="o">/</span><span class="n">start</span><span
class="p">)</span> <span class="n">times</span><span class="o">&gt;</span>
<span class="p">[</span><span class="n">optional</span><span class="p">]</span>
+      <span class="n">bundleIds</span><span class="p">,</span> <span
class="n">bid</span><span class="p">,</span> <span class="n">bi</span><span
class="p">,</span> <span class="n">b</span> <span class="o">&lt;</span><span
class="n">List</span> <span class="n">of</span> <span class="n">bundle</span>
<span class="n">ids</span> <span class="n">or</span> <span class="n">bundle</span>
<span class="n">symbolic</span>
+          <span class="n">names</span> <span class="n">to</span>
<span class="n">display</span> <span class="p">(</span><span class="n">comma</span>
<span class="n">separated</span><span class="p">)</span><span class="o">&gt;</span>
<span class="p">[</span><span class="n">optional</span><span class="p">]</span>
+      <span class="n">componentIds</span><span class="p">,</span>
<span class="n">cid</span><span class="p">,</span> <span class="n">ci</span>
<span class="o">&lt;</span><span class="n">List</span> <span
class="n">of</span> <span class="n">component</span> <span class="n">identifiers</span>
<span class="n">to</span> <span class="n">display</span>
+          <span class="p">(</span><span class="n">comma</span> <span
class="n">separated</span><span class="p">)</span><span class="o">&gt;</span>
<span class="p">[</span><span class="n">optional</span><span class="p">]</span>
+      <span class="n">components</span><span class="p">,</span> <span
class="n">c</span> <span class="o">&lt;</span><span class="n">Regex</span><span
class="p">(</span><span class="n">s</span><span class="p">)</span>
<span class="n">used</span> <span class="n">to</span> <span class="n">filter</span>
<span class="n">on</span> <span class="n">component</span>
+          <span class="n">implementation</span> <span class="n">class</span>
<span class="n">names</span> <span class="p">(</span><span class="n">comma</span>
<span class="n">separated</span><span class="p">),</span> <span
class="n">can</span> <span class="n">be</span>
+          <span class="n">negated</span> <span class="n">using</span>
&quot;!&quot; <span class="n">prefix</span><span class="o">&gt;</span>
<span class="p">[</span><span class="n">optional</span><span class="p">]</span>
+      <span class="n">services</span><span class="p">,</span> <span
class="n">s</span> <span class="o">&lt;</span><span class="n">OSGi</span>
<span class="n">filter</span> <span class="n">used</span> <span
class="n">to</span> <span class="n">filter</span> <span class="n">some</span>
<span class="n">service</span> 
+          <span class="k">properties</span><span class="o">&gt;</span>
<span class="p">[</span><span class="n">optional</span><span class="p">]</span>
+      <span class="n">top</span> <span class="o">&lt;</span><span
class="n">Max</span> <span class="n">number</span> <span class="n">of</span>
<span class="n">top</span> <span class="n">components</span> <span
class="n">to</span> <span class="n">display</span> <span class="p">(</span>0<span
class="p">=</span><span class="n">all</span><span class="p">)</span><span
class="o">&gt;</span> <span class="n">This</span>
+          <span class="n">command</span> <span class="n">displays</span>
<span class="n">components</span> <span class="n">callbacks</span>
<span class="p">(</span><span class="n">init</span><span class="o">/</span><span
class="n">start</span><span class="p">)</span>
+          <span class="n">times</span><span class="o">&gt;</span>
<span class="p">[</span><span class="n">optional</span><span class="p">]</span>
    <span class="n">parameters</span><span class="p">:</span>
       <span class="n">CommandSession</span>
 </pre></div>
@@ -94,7 +101,7 @@
 <p>Below are some examples for typical usage of the dependency manager shell commands.
The examples are based on a simple component model with a dashboard which has a required dependency
on four probes (temperature, humidity, radiation, pressure). The radiation probe requires
a Sensor service but this sensor is not available.</p>
 <p><strong>List all dependency manager components</strong></p>
 <p><code>dm</code></p>
-<p>Sample output</p>
+<p>Sample output:</p>
 <div class="codehilite"><pre><span class="p">[</span>9<span class="p">]</span>
<span class="n">dm</span><span class="p">.</span><span class="n">demo</span>
  <span class="p">[</span>6<span class="p">]</span> <span class="n">dm</span><span
class="p">.</span><span class="n">demo</span><span class="p">.</span><span
class="n">Probe</span><span class="p">(</span><span class="n">type</span><span
class="p">=</span><span class="n">radiation</span><span class="p">)</span>
<span class="n">unregistered</span>
     <span class="n">dm</span><span class="p">.</span><span class="n">demo</span><span
class="p">.</span><span class="n">Sensor</span> <span class="n">service</span>
<span class="n">required</span> <span class="n">unavailable</span>
@@ -134,13 +141,13 @@
 <p>The flags can be used in conjunction with the other command options.</p>
 <p><strong>Find all components for a given classname</strong></p>
 <p><code>dm c .*ProbeImpl</code></p>
-<p>dm c or components finds all components for which the classname of the implementation
matches the regular expression.</p>
+<p><code>dm c</code> or <code>components</code> finds all components
for which the classname of the implementation matches the regular expression.</p>
 <p><strong>Find all services matching a service filter</strong></p>
 <p><code>dm s "(type=temperature)"</code></p>
-<p>dm s allows finding components based on the service properties of their registered
services in the service registry using a standard OSGi service filter.</p>
+<p><code>dm s</code> allows finding components based on the service properties
of their registered services in the service registry using a standard OSGi service filter.</p>
 <p><strong>Find out why components are not registered</strong></p>
 <p><code>dm wtf</code></p>
-<p>Sample output</p>
+<p>Sample output:</p>
 <div class="codehilite"><pre><span class="gh">2 missing dependencies found.</span>
 <span class="gh">-----------------------------</span>
 The following service(s) are missing: 
@@ -148,9 +155,9 @@ The following service(s) are missing:
 </pre></div>
 
 
-<p>wtf gives the root cause for components not being registered and therefore their
services not being available. In a typical application components have dependencies on services
implemented by components that have dependencies on services etcetera. This transitivity means
that an entire chain of components could be unregistered due to a (few) root dependencies
not being satisified. wtf is about discovering those dependencies.</p>
+<p><code>wtf</code> gives the root cause for components not being registered
and therefore their services not being available. In a typical application components have
dependencies on services implemented by components that have dependencies on services etcetera.
This transitivity means that an entire chain of components could be unregistered due to a
(few) root dependencies not being satisfied. <code>wtf</code> is about discovering
those dependencies.</p>
       <div class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
-        Rev. 1663933 by marrs on Wed, 4 Mar 2015 10:59:46 +0000
+        Rev. 1664113 by marrs on Wed, 4 Mar 2015 18:52:20 +0000
       </div>
       <div class="trademarkFooter"> 
         Apache Felix, Felix, Apache, the Apache feather logo, and the Apache Felix project



Mime
View raw message