Return-Path: X-Original-To: apmail-felix-commits-archive@www.apache.org Delivered-To: apmail-felix-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C899018845 for ; Wed, 24 Feb 2016 00:11:55 +0000 (UTC) Received: (qmail 22518 invoked by uid 500); 24 Feb 2016 00:11:55 -0000 Delivered-To: apmail-felix-commits-archive@felix.apache.org Received: (qmail 22478 invoked by uid 500); 24 Feb 2016 00:11:55 -0000 Mailing-List: contact commits-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list commits@felix.apache.org Received: (qmail 22469 invoked by uid 99); 24 Feb 2016 00:11:55 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Feb 2016 00:11:55 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 24E78C0013 for ; Wed, 24 Feb 2016 00:11:55 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.999 X-Spam-Level: ** X-Spam-Status: No, score=2.999 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, KAM_MANYCOMMENTS=1.2, RP_MATCHES_RCVD=-0.001] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id WTCmn1mNoexN for ; Wed, 24 Feb 2016 00:11:48 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id C141B5FBA2 for ; Wed, 24 Feb 2016 00:11:47 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id A7F61E12A4 for ; Wed, 24 Feb 2016 00:11:45 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id A5CCF3A0A3F for ; Wed, 24 Feb 2016 00:11:45 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1731995 [16/38] - in /felix/site/trunk/content/apidocs: dependencymanager.annotations/r7/ dependencymanager.annotations/r7/org/ dependencymanager.annotations/r7/org/apache/ dependencymanager.annotations/r7/org/apache/felix/ dependencymanag... Date: Wed, 24 Feb 2016 00:11:43 -0000 To: commits@felix.apache.org From: pderop@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20160224001145.A5CCF3A0A3F@svn01-us-west.apache.org> Modified: felix/site/trunk/content/apidocs/dependencymanager.lambda/r7/org/apache/felix/dm/lambda/ServiceDependencyBuilder.html URL: http://svn.apache.org/viewvc/felix/site/trunk/content/apidocs/dependencymanager.lambda/r7/org/apache/felix/dm/lambda/ServiceDependencyBuilder.html?rev=1731995&r1=1731994&r2=1731995&view=diff ============================================================================== --- felix/site/trunk/content/apidocs/dependencymanager.lambda/r7/org/apache/felix/dm/lambda/ServiceDependencyBuilder.html (original) +++ felix/site/trunk/content/apidocs/dependencymanager.lambda/r7/org/apache/felix/dm/lambda/ServiceDependencyBuilder.html Wed Feb 24 00:11:41 2016 @@ -2,9 +2,9 @@ - + ServiceDependencyBuilder - + @@ -110,10 +110,23 @@ var activeTableTab = "activeTableTab";
public interface ServiceDependencyBuilder<S>
 extends DependencyBuilder<org.apache.felix.dm.ServiceDependency>, ServiceCallbacksBuilder<S,ServiceDependencyBuilder<S>>
-
Builds a Dependency Manager Service Dependency. Dependency callbacks can be defined using methods reflection like - in original DM API, or using Java8 method references. +
Builds a Dependency Manager Service Dependency. +

When a service dependency is not explicitly defined as "required" or "optional", then it is assumed to be required by default. - Unlike with original DM, dependencies are required by default.

+

Sample code: + +

 
+ public class Activator extends DependencyManagerActivator {
+    public void init(BundleContext ctx, DependencyManager dm) throws Exception {
+       component(comp -> comp
+          .impl(Pojo.class)
+          .withSrv(ConfigurationAdmin.class, "(vendor=apache)") // required service with a filter, injected in class field
+          .withSrv(Coordinator.class, LogService.class) // varargs of required dependencies injected on class fields
+          .withSrv(HttpService.class, svc -> srv.add(Pojo::setHttpService)) // required dependency injected using a method ref
+          .withSrv(ConnectorService.class, svc -> svc.optional()) // optional dependency, injected in class field with a NullObject if unavailable (before start() callback).
+          .withSrv(Tracked.class, srv -> srv.optional().add(Pojo::addTracked)) // optional dependency, injected using method ref, after the start() callback
+    }
+ }
@@ -242,7 +255,7 @@ extends ServiceCallbacksBuilder -cb, cb, cb, cb, cb, cb, cb, cb, cb, cb, cb, cb, cb, cb, cb, cb, cb, cb, cb, cb, cb, cb, cb, cb, cb, cb, cb, cb, cbi, cbi, cbi, cbi, cbi, cbi, cbi, cbi, cbi, cbi, cbi, cbi, cbi, cbi, cbi, cbi, cbi, cbi, cbi, cbi, cbi, cbi, cbi, cbi, cbi, cbi, cbi, cbi, sw, sw, sw, sw, swi, swi, swi, swi +add, add, add, add, add, add, add, add, add, add, add, add, add, callbackInstance, change, change, change, change, change, change, change, change, change, change, change, change, change, remove, remove, remove, remove, remove, remo ve, remove, remove, remove, remove, remove, remove, remove, swap, swap, swap, swap, swap, swap, swap, swap, swap @@ -297,7 +310,7 @@ extends

optional

ServiceDependencyBuilder<S> optional()
-
Configures this dependency as optional. By default, a dependency is required.
+
Configures this dependency as optional.
Returns:
this builder
@@ -311,7 +324,7 @@ extends

required

ServiceDependencyBuilder<S> required()
-
Configures this dependency as required. By default, a dependency is required.
+
Configures this dependency as required.
Returns:
this builder
@@ -328,7 +341,7 @@ extends Configures whether this dependency is required or not.
Parameters:
-
required - true if the dependency is required, false if not. Unlike with the original DM API, service dependencies are required by default.
+
required - true if the dependency is required, false if not.
Returns:
this builder
@@ -453,7 +466,7 @@ extends

timeout

ServiceDependencyBuilder<S> timeout(long timeout)
-
Sets a timeout for this dependency. A timed dependency blocks the invoker thread is the required dependency is currently unavailable, until it comes up again.
+
Sets a timeout for this dependency. A timed dependency blocks the invoker thread if the required dependency is currently unavailable, until it comes up again.
Parameters:
timeout - the timeout to wait in milliseconds when the service disappears. If the timeout expires, an IllegalStateException is thrown Added: felix/site/trunk/content/apidocs/dependencymanager.lambda/r7/org/apache/felix/dm/lambda/callbacks/Cb.html URL: http://svn.apache.org/viewvc/felix/site/trunk/content/apidocs/dependencymanager.lambda/r7/org/apache/felix/dm/lambda/callbacks/Cb.html?rev=1731995&view=auto ============================================================================== --- felix/site/trunk/content/apidocs/dependencymanager.lambda/r7/org/apache/felix/dm/lambda/callbacks/Cb.html (added) +++ felix/site/trunk/content/apidocs/dependencymanager.lambda/r7/org/apache/felix/dm/lambda/callbacks/Cb.html Wed Feb 24 00:11:41 2016 @@ -0,0 +1,253 @@ + + + + + +Cb + + + + + + + + + + + + +
+
org.apache.felix.dm.lambda.callbacks
+

Interface Cb<T>

+
+
+
+
    +
  • +
    +
    All Superinterfaces:
    +
    java.io.Serializable, SerializableLambda
    +
    +
    +
    Functional Interface:
    +
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
    +
    +
    +
    +
    @FunctionalInterface
    +public interface Cb<T>
    +extends SerializableLambda
    +
    Represents a java8 method reference to a zero-argument method from a given component implementation class. +

    The type of the class on which the callback is invoked on is represented by the T generic parameter.

    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Method Detail

      + + + + + +
        +
      • +

        accept

        +
        void accept(T t)
        +
        Invokes the callback method on the given component implementation instance.
        +
        +
        Parameters:
        +
        t - the component implementation instance the callback is invoked on.
        +
        +
      • +
      + + + +
        +
      • +

        andThen

        +
        default Cb<T> andThen(Cb<? super T> after)
        +
      • +
      +
    • +
    +
  • +
+
+
+ + + + + + + Modified: felix/site/trunk/content/apidocs/dependencymanager.lambda/r7/org/apache/felix/dm/lambda/callbacks/CbBundle.html URL: http://svn.apache.org/viewvc/felix/site/trunk/content/apidocs/dependencymanager.lambda/r7/org/apache/felix/dm/lambda/callbacks/CbBundle.html?rev=1731995&r1=1731994&r2=1731995&view=diff ============================================================================== --- felix/site/trunk/content/apidocs/dependencymanager.lambda/r7/org/apache/felix/dm/lambda/callbacks/CbBundle.html (original) +++ felix/site/trunk/content/apidocs/dependencymanager.lambda/r7/org/apache/felix/dm/lambda/callbacks/CbBundle.html Wed Feb 24 00:11:41 2016 @@ -2,9 +2,9 @@ - + CbBundle - + @@ -48,8 +48,8 @@ var activeTableTab = "activeTableTab"; @@ -132,13 +133,14 @@ extends void -accept(org.osgi.framework.Bundle bundle) -
Handles the given argument.
+accept(T instance, + org.osgi.framework.Bundle bundle) +
Handles the given arguments.
-default CbBundle -andThen(CbBundle after)  +default CbBundle<T> +andThen(CbBundle<? super T> after)  @@ -155,16 +157,20 @@ extends + + +
  • accept

    -
    void accept(org.osgi.framework.Bundle bundle)
    -
    Handles the given argument.
    +
    void accept(T instance,
    +            org.osgi.framework.Bundle bundle)
    +
    Handles the given arguments.
    Parameters:
    +
    instance - the Component implementation instance on which the callback is invoked on.
    bundle - the callback parameter
  • @@ -175,7 +181,7 @@ extends
  • andThen

    -
    default CbBundle andThen(CbBundle after)
    +
    default CbBundle<T> andThen(CbBundle<? super T> after)
@@ -205,8 +211,8 @@ extends