felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r979472 - in /websites/staging/felix/trunk/content: ./ documentation/subprojects/apache-felix-dependency-manager/guides/dm-lambda.html
Date Thu, 04 Feb 2016 16:42:39 GMT
Author: buildbot
Date: Thu Feb  4 16:42:39 2016
New Revision: 979472

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/guides/dm-lambda.html

Propchange: websites/staging/felix/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Thu Feb  4 16:42:39 2016
@@ -1 +1 @@
-1728416
+1728505

Modified: websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager/guides/dm-lambda.html
==============================================================================
--- websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager/guides/dm-lambda.html
(original)
+++ websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager/guides/dm-lambda.html
Thu Feb  4 16:42:39 2016
@@ -91,6 +91,7 @@ h2:hover > .headerlink, h3:hover > .head
 <hr />
 <p>Since the R7 version, a new dm-lambda library has been introduced in the DM distribution.
This new library allows to programmatically declare OSGi components
 using a bit more fluent, concise and type-safe API that is based on Java8 Lambda expressions
and other goodies like method references.</p>
+<p>(Please notice that using the dm-lambda library requires the usage of a recent Java8
jvm (the library has been tested with java version "1.8.0_71").</p>
 <h2 id="principle">Principle<a class="headerlink" href="#principle" title="Permanent
link">&para;</a></h2>
 <p>The new library is based on the <code>builder</code> design pattern
applied to java8 lambdas. Basically, you call a chain of methods from a 
 fluent <code>builder</code>, and at the end of the chain, you call "<code>build()</code>"
which returns the actual DM objects that you already know from 
@@ -143,7 +144,7 @@ for dm-lambda activators:</p>
 
 
 <p>Now, most of the time, in an Activator you usually create a Component and immediately
add it to the <code>dm</code> object.
-So, in order to reduce the code size, you can then use a special overloaded factory method
that accepts a lambda which takes as 
+So, in order to reduce the code size, you can then use a component() method that accepts
a lambda which takes as 
 argument a <code>Consumer&lt;ComponentBuilder&gt;</code> parameter.
 So, the lambda has just to invoke the chain of necessary methods from the builder, without
having to call the last "<code>build</code>" method. 
 The constructed Component is then automatically added to the <code>dm</code>
object.</p>
@@ -231,12 +232,12 @@ But like in the current DM API, you can
 
 <p>The <code>cb</code> method accepts a varargs of strings (up to 4 method
names):</p>
 <ol>
-<li>when using one argument, the first argument is used as the <code>add</code>
callback.</li>
-<li>when using two argument, the first argument is used as the <code>add</code>
callback, and the second one as the <code>remove</code> callback.</li>
-<li>when using three arguments, the first argument is used as the <code>add</code>
callback, the second one as the "change" callback, and the third one as the <code>remove</code>
callback.</li>
-<li>when using four arguments, the given argument is used as the <code>add</code>
callback, the second one as the "change" callback, the third one as the <code>remove</code>
callback, and the last one as the <code>swap</code> callback.</li>
+<li>when using one argument, it is used as the <code>add</code> callback.</li>
+<li>when using two arguments, the first arg is used as the <code>add</code>
callback, and the second one as the <code>remove</code> callback.</li>
+<li>when using three arguments, the first arg is used as the <code>add</code>
callback, the second one as the <code>change</code> callback, and the third one
as the <code>remove</code> callback.</li>
+<li>when using four arguments, the first arg is used as the <code>add</code>
callback, the second one as the <code>change</code> callback, the third one as
the <code>remove</code> callback, and the last one as the <code>swap</code>
callback.</li>
 </ol>
-<p>The add/change/remove callbacks accepts the following kind of method signatures
("S" represents the type of the service dependency):</p>
+<p>The add/change/remove callbacks accept the following kind of method signatures ("S"
represents the type of the service dependency):</p>
 <div class="codehilite"><pre><span class="n">method</span><span
class="p">(</span><span class="n">S</span> <span class="n">service</span><span
class="p">)</span>
 <span class="n">method</span><span class="p">(</span><span class="n">S</span>
<span class="n">service</span><span class="p">,</span> <span class="n">Map</span><span
class="o">&lt;</span><span class="n">String</span><span class="p">,</span>
<span class="n">Object</span><span class="o">&gt;</span> <span
class="n">serviceProperties</span><span class="p">)</span>
 <span class="n">method</span><span class="p">(</span><span class="n">S</span>
<span class="n">service</span><span class="p">,</span> <span class="n">Dictionary</span><span
class="o">&lt;</span><span class="n">String</span><span class="p">,</span>
<span class="n">Object</span><span class="o">&gt;</span> <span
class="n">serviceProperties</span><span class="p">)</span>
@@ -495,6 +496,12 @@ then have to cache the injected Tracked
 <p>Also, notice that when the page is injected in the setPage() method, you absolutely
don't need to deal with
 synchronization at all because in DM, all lifecycle and dependency callbacks are safely scheduled
in a "serial queue" associated to the
 component.</p>
+<h2 id="another-example-with-completablefuture-and-rxjava">Another Example with CompletableFuture
and RxJava.<a class="headerlink" href="#another-example-with-completablefuture-and-rxjava"
title="Permanent link">&para;</a></h2>
+<p>We just introduced the new FutureDependency. Allowing to use a CompletableFuture
as a dependency is useful because CF is a powerful abstraction
+that allows to wrap any asynchronous events or async libraries with a standard jdk tool (CompletableFuture).
+In this section, we present a way to "wait for" RxJava "Observables" using DM.</p>
+<p>RxJava, like the CompletableFuture java8 tool, allows to react on events, but using
non blocking push paradigm.</p>
+<p>TODO: finish this section.</p>
 <h2 id="comparing-two-activators-using-old-and-new-api">Comparing two activators using
old and new API:<a class="headerlink" href="#comparing-two-activators-using-old-and-new-api"
title="Permanent link">&para;</a></h2>
 <p>Assume we have a <code>ServiceConsumer</code> which depends on the following
services:</p>
 <ul>
@@ -617,7 +624,7 @@ and the service is registered.</p>
 <p>Caution: if you are using a corporate http proxy, you have to fix the Activator
in order to configure the ip addr and port number of your
 http proxy.</p>
       <div class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
-        Rev. 1728413 by pderop on Thu, 4 Feb 2016 07:44:09 +0000
+        Rev. 1728505 by pderop on Thu, 4 Feb 2016 16:42:10 +0000
       </div>
       <div class="trademarkFooter"> 
         Apache Felix, Felix, Apache, the Apache feather logo, and the Apache Felix project



Mime
View raw message