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 2018/10/09 13:30:59 UTC

svn commit: r1843261 - /felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager/reference/component-adapter.mdtext

Author: pderop
Date: Tue Oct  9 13:30:59 2018
New Revision: 1843261

URL: http://svn.apache.org/viewvc?rev=1843261&view=rev
Log:
dm 12 updates

Modified:
    felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager/reference/component-adapter.mdtext

Modified: felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager/reference/component-adapter.mdtext
URL: http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager/reference/component-adapter.mdtext?rev=1843261&r1=1843260&r2=1843261&view=diff
==============================================================================
--- felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager/reference/component-adapter.mdtext (original)
+++ felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager/reference/component-adapter.mdtext Tue Oct  9 13:30:59 2018
@@ -1,10 +1,19 @@
 Title: Dependency Manager - Adapter
 
-Adapters, like [aspects](component-aspect.html), are used to "extend" existing services, and can publish different services based on the existing one. An example would be implementing a management interface.
+Adapters, like [aspects](component-aspect.html), are used to "extend" existing services, and can publish 
+different services based on the existing one. An example would be implementing a management interface.
 
-An adapter will be applied to any service that matches the specified interface and filter. For each matching service an adapter will be created based on the adapter implementation class. The adapter will be registered with the specified interface and existing properties from the original service plus any extra properties you supply here. It will also inherit all dependencies, and if you declare the original service as a member it will be injected.
+An adapter will be applied to any service that matches the specified interface and filter. 
+For each matching service an adapter will be created based on the adapter implementation class. 
+The adapter will be registered with the specified interface and existing properties from the original 
+service plus any extra properties you supply here. It will also inherit all dependencies, and if you declare 
+the original service as a member it will be injected.
+
+To define an adapter component, you need to create an [AdapterComponent](http://felix.staging.apache.org/apidocs/dependencymanager/r12/org/apache/felix/dm/AdapterComponent.html) component
+using the DependencyActivatorBase.createAdapterComponent() or the DependencyManager.createAdapterComponent() method.
+This interface extends the Component interface in order to add extra setters methods needed to define an adapter service component.
 
-## Usage example using API
+## Usage example
 
 Here is a sample showing a HelloServlet adapter component which creates a servlet each time a HelloService is registered in the osgi service registry with the "foo=bar" service property.
  
@@ -33,73 +42,3 @@ Here is a sample showing a HelloServlet
         }
     }
 
-## Example using Lambda API
-
-Same example using the Dependency Manager Lambda API:
-
-    :::java
-    public class Activator extends DependencyManagerActivator {
-       public void init(BundleContext ctx, DependencyManager dm) throws Exception { 
-           adapter(HelloService.class, adapt -> adapt.impl(HelloServlet.class).filter("(foo=bar)").provides(HttpServlet.class));                    
-       }
-    }
-
-## Example using annotations
-
-Same example using Dependency Manager Annotations:
-
-    :::java
-    @AdapterService(adapteeService = HelloService.class, adapteeFilter = "(foo=bar)")
-    public class HelloServlet extends HttpServlet {
-        volatile HelloService adatpee; // injected
-     
-        void doGet(HttpServletRequest req, HttpServletResponse resp) {
-            ...
-            resp.getWriter().println(adaptee.sayHello());
-        }
-    }
-
-
-### Annotation attributes:
-
-----
-**`adapteeService`**    
-*Required*: True    
-*Default*: --
-
-Sets the adaptee service interface this adapter is applying to.
-
-----
-**`provides`**    
-*Required*: False    
-*Default*: all directly implemented interfaces.
-
-Sets the adapter service interface(s). By default, the directly implemented 
-interface(s) is (are) used. 
-
-----
-**`properties`**    
-*Required*: False    
-*Default*: All inherited adaptee service properties.
-
-Sets some additional properties to use with the adapter service registration. 
-By default, the adapter will inherit all adaptee service properties.
-
-----
-**`adapteeFilter`**    
-*Required*: False    
-*Default*: --
-
-Sets the filter condition to use with the adapted service interface.
-
-----
-**`factoryMethod`**    
-*Required*: False    
-*Default*: --
-
-Sets the static method used to create the adapter service implementation 
-instance. By default, the default constructor of the annotated class is used.
-
-
-
-