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:32:32 UTC

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

Author: pderop
Date: Tue Oct  9 13:32:32 2018
New Revision: 1843263

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

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

Modified: felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager/reference/component-bundle-adapter.mdtext
URL: http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager/reference/component-bundle-adapter.mdtext?rev=1843263&r1=1843262&r2=1843263&view=diff
==============================================================================
--- felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager/reference/component-bundle-adapter.mdtext (original)
+++ felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager/reference/component-bundle-adapter.mdtext Tue Oct  9 13:32:32 2018
@@ -1,7 +1,8 @@
 Title: Dependency Manager - Bundle Adapter
 
 Bundle adapters are similar to AdapterService, but instead of adapting a 
-service, they adapt a bundle with a certain set of states (STARTED|INSTALLED|...), and provide a service on top of it.
+service, they adapt a bundle with a certain set of states (STARTED|INSTALLED|...), 
+and provide a service on top of it.
 
 The bundle adapter will be applied to any bundle that matches the specified 
 bundle state mask and filter conditions, which may match some of the bundle 
@@ -11,7 +12,13 @@ with the specified interface and with se
 original bundle OSGi manifest headers plus any extra properties you supply 
 here. If you declare the original bundle as a member it will be injected. 
 
-## Example using API:
+To define a bundle adapter component, you need to create a [BundleComponent](http://felix.staging.apache.org/apidocs/dependencymanager/r12/org/apache/felix/dm/BundleComponent.html) component
+using the DependencyActivatorBase.createBundleComponent() or the DependencyManager.createBundleComponent() method.
+
+This interface extends the Component interface in order to add extra setters methods needed to define a bundle adapter service component.
+
+
+## Example usage
 
 In the following example, a "VideoPlayer" Service is registered into the OSGi registry each time an active bundle containing a "Video-Path" manifest header is detected:
 
@@ -26,32 +33,3 @@ In the following example, a "VideoPlayer
         }
     }
 
-## Example using DM Lambda:
-
-    :::java
-    public class Activator extends DependencyManagerActivator {
-        public void init(BundleContext ctx, DependencyManager dm) throws Exception { 
-           bundleAdapter(adapt -> adapt
-               .impl(VideoPlayerImpl.class)
-               .provides(VideoPlayer.class, foo -> "bar")
-               .mask(Bundle.ACTIVE)
-               .filter("(Video-Path=*)"));
-        }
-    }
-
-## Example using annotations:
-
-    :::java
-    @BundleAdapterService(filter = "(Video-Path=*)", stateMask = Bundle.ACTIVE)
-    public class VideoPlayerImpl implements VideoPlayer {
-        volatile Bundle bundle; // Injected by reflection
-             
-        void play() {
-            URL mpegFile = bundle.getEntry(bundle.getHeaders().get("Video-Path"));
-            // play the video provided by the bundle ...
-        }
-           
-        void stop() {}
-    }
-
-