You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by pd...@apache.org on 2013/09/21 01:19:31 UTC

svn commit: r1525175 - in /felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager: ./ apache-felix-dependency-manager-using-annotations/

Author: pderop
Date: Fri Sep 20 23:19:31 2013
New Revision: 1525175

URL: http://svn.apache.org/r1525175
Log:
CMS migration

Added:
    felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager/apache-felix-dependency-manager-using-annotations/dependencymanager-annotations-composition.mdtext
      - copied, changed from r1525172, felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager/apache-felix-dependency-manager-using-annotations/apache-felix-dependency-manager-using-annotations-composition.mdtext
Removed:
    felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager/apache-felix-dependency-manager-using-annotations/apache-felix-dependency-manager-using-annotations-composition.mdtext
Modified:
    felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager/apache-felix-dependency-manager-using-annotations.mdtext

Modified: felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager/apache-felix-dependency-manager-using-annotations.mdtext
URL: http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager/apache-felix-dependency-manager-using-annotations.mdtext?rev=1525175&r1=1525174&r2=1525175&view=diff
==============================================================================
--- felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager/apache-felix-dependency-manager-using-annotations.mdtext (original)
+++ felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager/apache-felix-dependency-manager-using-annotations.mdtext Fri Sep 20 23:19:31 2013
@@ -17,6 +17,6 @@ components can interact with the dynamic
 * [{{ refs.dependencymanager-annotations-component.headers.excerpt }}]({{ refs.dependencymanager-annotations-component.path }})
 * [{{ refs.dependencymanager-annotations-dependencies.headers.excerpt }}]({{ refs.dependencymanager-annotations-dependencies.path }})
 * [{{ refs.dependencymanager-annotations-lifecycle.headers.excerpt }}]({{ refs.dependencymanager-annotations-lifecycle.path }})
-* [Composition]({{ refs.apache-felix-dependency-manager-using-annotations-composition.path }}) Explains how a component may be implemented using multiple object instances.
-* [BndTools Tutorial](https://bitbucket.org/marrs/bndtools-dmdemo) A BndTools based demo of DependencyManager annotations.
+* [{{ refs.dependencymanager-annotations-composition.headers.excerpt }}]({{ refs.dependencymanager-composition-lifecycle.path }})
+* [BndTools based demo of Dependency Manager annotations](https://bitbucket.org/marrs/bndtools-dmdemo)
 

Copied: felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager/apache-felix-dependency-manager-using-annotations/dependencymanager-annotations-composition.mdtext (from r1525172, felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager/apache-felix-dependency-manager-using-annotations/apache-felix-dependency-manager-using-annotations-composition.mdtext)
URL: http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager/apache-felix-dependency-manager-using-annotations/dependencymanager-annotations-composition.mdtext?p2=felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager/apache-felix-dependency-manager-using-annotations/dependencymanager-annotations-composition.mdtext&p1=felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager/apache-felix-dependency-manager-using-annotations/apache-felix-dependency-manager-using-annotations-composition.mdtext&r1=1525172&r2=1525175&rev=1525175&view=diff
==============================================================================
--- felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager/apache-felix-dependency-manager-using-annotations/apache-felix-dependency-manager-using-annotations-composition.mdtext (original)
+++ felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager/apache-felix-dependency-manager-using-annotations/dependencymanager-annotations-composition.mdtext Fri Sep 20 23:19:31 2013
@@ -1,30 +1,36 @@
 translation_pending: true
-Title: Apache Felix Dependency Manager - Using Annotations - Composition
+Title: Dependency Manager Service Composition
+Excerpt: Dependency Manager service composition.
 
-# Annotations - Composition
+This section shows how a component may be implemented using multiple object instances.
 
-When implementing more complex services, you often find yourself using more than one instance for a given service. 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. Within a Component (or an Aspect/Adapter), you can annotate a method with the @Composition annotation. This method is meant to return such composition of service instances, and the objects will be considered as part of the service implementation. So, all  dependencies, as well as lifecycle annotations (@Init, @Start, @Stop, @Destroy) will be applied on every objects returned by the method annotated with the @Composition annotation.
+When implementing more complex services, you often find yourself using more than one instance for a given service. 
+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. Within a Component (or an Aspect/Adapter), you can annotate a method 
+with the @Composition annotation. This method is meant to return such composition of service instances, and the objects 
+will be considered as part of the service implementation. So, all  dependencies, as well as lifecycle annotations 
+(@Init, @Start, @Stop, @Destroy) will be applied on every objects returned by the method annotated with the @Composition annotation.
 
 The following example illustrates a composition of two object instances, which are part of the implementation of a *MyService* service:
 
-
+    :::java
     /**
      * Main implementation for the MyService Service
      */
     @Component
     public class MyServiceImpl implements MyService {
       // This object instance is also used to implement the service.
-      private Helper helper = new Helper();
+      private Helper helper = new Helper();
     
       // MyServiceImpl, and Helper objects are part of the composition
-      @Composition
-      Object[] getComposition() {
-        return new Object[] { this, helper };
-      }
+      @Composition
+      Object[] getComposition() {
+        return new Object[] { this, helper };
+      }
     
       // This dependency is also applied to the Helper
-      @ServiceDependency
-      Dependency dep;
+      @ServiceDependency
+      Dependency dep;
     
       // Same thing for this dependency
       @ServiceDependency
@@ -46,7 +52,7 @@ The following example illustrates a comp
     
     public class Helper {
       // Also injected, since we are part of the composition
-      Dependency dep;
+      Dependency dep;
     
       // But since we are not interested by the Dependency2, we don't have to declare the bind(Dependency2) method ...
     
@@ -59,6 +65,6 @@ The following example illustrates a comp
          return extraServiceProperties;
       }
     }
-    
 
-Here, MyServiceImpl is the main component implementation, but is   composed of the Helper object instance. So all Dependencies defined in  MyServiceImpl will be also injected to the Helper (if the Helper  declares the fields or methods). The Helper may also declare lifecycle  callbacks (optionally).
+Here, MyServiceImpl is the main component implementation, but is   composed of the Helper object instance. So all Dependencies defined in MyServiceImpl 
+will be also injected to the Helper (if the Helper  declares the fields or methods). The Helper may also declare lifecycle  callbacks (optionally).