Author: marrs
Date: Wed Mar  4 15:21:58 2015
New Revision: 1664040

URL: http://svn.apache.org/r1664040
Log:
More changes to the documentation, still WIP.

Added:
    
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/whatsnew.mdtext
    
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-bundle-adapter.mdtext
    
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-factory-configuration-adapter.mdtext
Modified:
    
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4.mdtext
    
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/bundles-and-dependencies.mdtext
    
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/design-patterns.mdtext
    
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/development.mdtext
    
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/migrating-from-earlier-versions.mdtext
    
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/migrating-from-other-solutions.mdtext
    
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/performance-tuning.mdtext
    
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/resources.mdtext
    
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-adapter.mdtext
    
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-aspect.mdtext
    
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-resource-adapter.mdtext
    
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/components.mdtext
    
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependencies.mdtext
    
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependency-bundle.mdtext
    
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependency-configuration.mdtext
    
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependency-resource.mdtext
    
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependency-service.mdtext
    
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/external-links.mdtext

Modified: 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4.mdtext
URL: 
http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4.mdtext?rev=1664040&r1=1664039&r2=1664040&view=diff
==============================================================================
--- 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4.mdtext
 (original)
+++ 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4.mdtext
 Wed Mar  4 15:21:58 2015
@@ -28,6 +28,7 @@ Below is the full table of contents.
 
 * [History](apache-felix-dependency-manager-4/guides/history.html)
 * [Background](apache-felix-dependency-manager-4/guides/background.html)
+* [What's new in version 
4](apache-felix-dependency-manager-4/guides/whatsnew.html)
 * [Bundles and 
dependencies](apache-felix-dependency-manager-4/guides/bundles-and-dependencies.html)
 * [Migrating from earlier 
versions](apache-felix-dependency-manager-4/guides/migrating-from-earlier-versions.html)
 * [Migrating from other 
solutions](apache-felix-dependency-manager-4/guides/migrating-from-other-solutions.html)
@@ -44,6 +45,8 @@ Below is the full table of contents.
  * [Aspect](apache-felix-dependency-manager-4/reference/component-aspect.html)
  * 
[Adapter](apache-felix-dependency-manager-4/reference/component-adapter.html)
  * [Resource 
Adapter](apache-felix-dependency-manager-4/reference/component-resource-adapter.html)
+ * [Bundle 
Adapter](apache-felix-dependency-manager-4/reference/component-bundle-adapter.html)
+ * [Factory Configuration 
Adapter](apache-felix-dependency-manager-4/reference/component-factory-configuration-adapter.html)
 * [Dependencies](apache-felix-dependency-manager-4/reference/dependencies.html)
  * 
[Service](apache-felix-dependency-manager-4/reference/dependency-service.html)
  * 
[Configuration](apache-felix-dependency-manager-4/reference/dependency-configuration.html)

Modified: 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/bundles-and-dependencies.mdtext
URL: 
http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/bundles-and-dependencies.mdtext?rev=1664040&r1=1664039&r2=1664040&view=diff
==============================================================================
--- 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/bundles-and-dependencies.mdtext
 (original)
+++ 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/bundles-and-dependencies.mdtext
 Wed Mar  4 15:21:58 2015
@@ -0,0 +1,3 @@
+Title: Apache Felix Dependency Manager - Bundles and Dependencies
+
+TODO

Modified: 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/design-patterns.mdtext
URL: 
http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/design-patterns.mdtext?rev=1664040&r1=1664039&r2=1664040&view=diff
==============================================================================
--- 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/design-patterns.mdtext
 (original)
+++ 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/design-patterns.mdtext
 Wed Mar  4 15:21:58 2015
@@ -0,0 +1,163 @@
+Title: Apache Felix Dependency Manager - Design Patterns
+
+## OSGi Design Patterns
+
+This section lists a couple of design patterns as they can be applied in an 
OSGi context.
+
+### Singleton Service
+
+Provides a service as long as its dependencies are resolved.
+
+#### Motivation
+
+In a dynamic framework, services can come and go. Components that publish a 
service are often themselves dependent on other services to perform their task. 
In such cases, they have a dependency on those services and it makes sense to 
only publish their own services when these dependencies are available. Being 
able to declare such dependencies in code ensures consistent life cycle 
behavior.
+
+#### Structure
+
+{gliffy:name=singleton|space=FELIX|page=Apache Felix Dependency Manager - OSGi 
Design Patterns|pageid=9374247|align=center|size=L|border=false}
+
+#### Code Example
+
+
+    public class Activator extends DependencyActivatorBase {
+        public void init(BundleContext context, DependencyManager manager) 
throws Exception {
+            manager.add(createComponent()
+                .setInterface(UserStore.class, new Properties() {{ 
put("store.id", "users"); }})
+                .setImplementation(UserStoreImpl.class)
+                .add(createServiceDependency()
+                    .setService(Store.class)
+                    .setRequired(true)
+                )
+                .add(createServiceDependency()
+                    .setService(LogService.class)
+                    .setRequired(false)
+                )
+            );
+        }
+        
+        public void destroy(BundleContext context, DependencyManager manager) 
throws Exception {}
+    }
+
+
+### Aspect Service
+
+Provides an aspect on top of a specific type of service.
+
+#### Motivation
+
+In aspect oriented programming, supporting functions are isolated from the 
main application's business logic. This increases modularity at the source 
level by allowing the separation of cross-cutting concerns. In OSGi we want to 
extend this modularity to the runtime, therefore we implement aspects to work 
on certain services, where the aspect itself publishes that same service but 
(usually) with a higher priority. This allows you to dynamically add and remove 
aspects.
+
+#### Structure
+
+{gliffy:name=aspect|space=FELIX|page=Apache Felix Dependency Manager - OSGi 
Design Patterns|pageid=9374247|align=center|size=L|border=false}
+
+#### Code Example
+
+
+    public class Activator extends DependencyActivatorBase {
+        public void init(BundleContext context, DependencyManager manager) 
throws Exception {
+            manager.add(createAspectService(Manageable.class, 
"(monitor=true)", 50)
+                .setImplementation(ManageableMonitor.class)
+            );
+        }
+        
+        public void destroy(BundleContext context, DependencyManager manager) 
throws Exception {}
+    }
+    
+    public interface Manageable {
+        public void setProperty(String key, String value);
+    }
+    
+    public class ManageableMonitor implements Manageable {
+        private volatile Manageable m_manageable;
+    
+        public void setProperty(String key, String value) {
+            System.out.println("Someone set " + key + " to " + value);
+            m_manageable.setProperty(key, value);
+        }
+    }
+
+
+### Adapter Service
+
+Provides an adapter for a specific type of service.
+
+#### Motivation
+
+Like with aspects, sometimes you want to create adapters for certain services, 
which add certain behavior that results in the publication of (in this case) a 
different service. Adapters can dynamically be added and removed and allow you 
to keep your basic services implementations clean and simple, adding extra 
features on top of them in a modular way. 
+
+#### Structure
+
+{gliffy:name=adapter|space=FELIX|page=Apache Felix Dependency Manager - OSGi 
Design Patterns|pageid=9374247|align=center|size=L|border=false}
+
+#### Code Example
+
+
+    public class Activator extends DependencyActivatorBase {
+        public void init(BundleContext context, DependencyManager manager) 
throws Exception {
+            manager.add(createAdapterService(Manageable.class, 
"(publish=servlet)")
+                .setInterface(HttpServlet.class.getName(), null)
+                .setImplementation(ManageableServlet.class)
+            );
+        }
+        
+        public void destroy(BundleContext context, DependencyManager manager) 
throws Exception {}
+    }
+    
+    public interface Manageable {
+        public void setProperty(String key, String value);
+    }
+    
+    public class ManageableServlet implements HttpServlet {
+        private volatile Manageable m_manageable;
+    
+        public void doPost(HttpRequest req, HttpResponse response) {
+            String key = req.getProperty("key");
+            String value = req.getProperty("value");
+            m_manageable.setProperty(key, value);
+        }
+    }
+
+
+### Resource Adapter Service
+
+Provides an adapter for a specific type of resource.
+
+#### Motivation
+
+Resource adapters are similar to normal adapters, but instead of requiring a 
service, they require a resource and provide a service on top of it. Resources 
are an abstraction that is introduced by the dependency manager, represented as 
a URL. They can be implemented to serve resources embedded in bundles, 
somewhere on a file system or in a content repository or database.
+
+#### Structure
+
+{gliffy:name=resource-adapter|space=FELIX|page=Apache Felix Dependency Manager 
- OSGi Design Patterns|pageid=9374247|align=center|size=L|border=false}
+
+### Temporal Dependency
+
+Provides a proxy that hides the service dynamics of a dependency, even if it 
disappears for a short time.
+
+#### Motivation
+
+As a service consumer, you sometimes do not want to deal with the dynamics of 
services and the fact that they tend to go away for short periods of time 
whilst their hosting bundle gets updated. A temporal dependency provides you 
with a proxy that hides these dynamics and blocks your calls if you try to 
invoke a method on a service that is currently "updating". The maximum time to 
wait is configurable and you will get an exception if no new service becomes 
available before that time.
+
+#### Structure
+
+### Null Object
+
+Provides an implementation of an object that does nothing and can be used in 
the absence of the real object.
+
+#### Motivation
+
+When a component depends on a service, but the dependency is optional, it 
means that it will use this service when available, but it can still operate if 
it's not. Constantly checking in your code if a service is actually available 
tends to lead to code with a lot of "`if (service != null) service.invoke();`" 
constructions which do not help with code readability. Instead, the dependency 
manager offers you a mechanism where it will inject null objects for services 
that are currently not available so you can simply invoke methods on them that 
"do nothing".
+
+#### Structure
+
+### Whiteboard
+
+Handles listeners by leveraging the OSGi service registry to publish and look 
them up.
+
+#### Motivation
+
+The traditional model for dealing with listeners in Java needlessly 
complicates things in an OSGi context. Instead of having listeners registering 
themselves with the component that will invoke them on any change, a listener 
simply registers itself in the service registry and the component will do a 
lookup of all relevant services. This is explained in more detail on the 
OSGi.org wiki in the ["Listeners considered harmful: the 'whiteboard' 
pattern"](http://www.osgi.org/wiki/uploads/Links/whiteboard.pdf) article.
+
+#### Structure
+

Modified: 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/development.mdtext
URL: 
http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/development.mdtext?rev=1664040&r1=1664039&r2=1664040&view=diff
==============================================================================
--- 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/development.mdtext
 (original)
+++ 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/development.mdtext
 Wed Mar  4 15:21:58 2015
@@ -0,0 +1,44 @@
+Title: Apache Felix Dependency Manager - Development
+
+When downloading or checking out the source code, please also consult 
release/resources/src/README.src for up to date instructions on how to build 
that particular version.
+
+## Prerequisites
+
+If you are building a released 
`org.apache.felix.dependencymanager-r<n>-src.zip` artifact, then you also have 
to extract the `org.apache.felix.dependencymanager-r<n>-deps.zip` in the same 
directory where you have extracted the source archive. There is no need to do 
this if you have checked out from the Felix trunk in Subversion.
+
+## Compilation Using gradle:
+
+- Install Java 7.
+
+- Compile Dependendency Manager annotations bndtools plugin:
+  
+       $ ./gradlew org.apache.felix.dependencymanager.annotation:jar
+
+- Compile all other bundles:
+ 
+       $ ./gradlew jar
+
+- Run junit tests:
+
+       $ ./gradlew test
+
+- Run integration tests:
+
+       $ ./gradlew check
+
+## Compilation Using Eclipse:
+
+- Install either Eclipse Kepler SR2 or Eclipse Luna.
+- Use the dependency manager folder as the root of your workspace.
+- Configure two JREs for both Java 7 and Java 8:
+       * Go to Windows -> Preferences -> Java -> Installed JREs
+       * Add two JREs: one for Java 7, and the other for Java 8.
+       * Declare the Java 7 JRE as the default one. Java 8 is only used to 
build and run the `org.apache.felix.dependencymanager.benchmark` module, which 
is used to perform DM performance tests within Eclipse Bndtools.
+- Install BndTools 2.4.1, and (optionally) a subversion plugin for Eclipse.
+- Open BndTools perspective
+- Import Dependency Manager into Eclipse, and compile everything
+- if it's the first time you import the project into eclipse, it may happen 
that some modules that requires the Dependency Manager Annotations bnd plugin 
don't compile: It's a know issue. To work around, restart eclipse and rebuild 
every modules. 
+- Click on org.apache.felix.dependencymanager project and run it as "JUnit 
test".
+- Click on org.apache.felix.dependencymanager.shell and run it as "JUnit test"
+- Click on org.apache.felix.dependencymanager.itest and run it as "Bnd OSGi 
Test Launcher (Junit)".
+- Click on org.apache.felix.dependencymanager.runtime.itest and run it as 
""Bnd OSGi Test Launcer (Junit)".

Modified: 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/migrating-from-earlier-versions.mdtext
URL: 
http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/migrating-from-earlier-versions.mdtext?rev=1664040&r1=1664039&r2=1664040&view=diff
==============================================================================
--- 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/migrating-from-earlier-versions.mdtext
 (original)
+++ 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/migrating-from-earlier-versions.mdtext
 Wed Mar  4 15:21:58 2015
@@ -0,0 +1,20 @@
+Title: Apache Felix Dependency Manager - Migrating from earlier versions
+
+# Migrating from version 3
+
+DependencyManager 4.0 has some API changes that need to be taken into account 
when migrating from DependencyManager 3. 
+
+* A dependency can no longer be shared accross components. 
+* You no longer have to call setInstanceBound() when adding a dependency from 
within the init() method of a component. Therefore the setInstanceBound() 
method has been removed from all Dependency interfaces.
+* in the Dependency interface, the following method have been removed: 
isInstanceBound, invokeAdded, invokeRemoved, createCopy.
+* In the Component interface, the "Object Component.getService()" method has 
been replaced by the "<T> T getInstance()" method.
+* In the Component interface, the "void 
addStateListener(ComponentStateListener listener) method" has been replaced by 
the "add(ComponentStateListener listener)" method.
+* In the Component interface, the "start", "stop", "getDependencies" methods 
have been removed.
+* In the Component interface and in the DependencyManager class, the 
createTemporalServiceDependency() method is now taking a timeout parameter: 
createTemporalServiceDependency(long timeout).
+* The ComponentStateListener interface has changed: it is now providing a 
single "changed(Component c, ComponentState state)" method.
+* The DependencyManager 4 Shell commands are no longer available for framework 
specific shell implementations, and support the gogo shell only.
+* The TemporalServiceDependency interface has been removed.
+
+# Migrating from version 2
+
+...

Modified: 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/migrating-from-other-solutions.mdtext
URL: 
http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/migrating-from-other-solutions.mdtext?rev=1664040&r1=1664039&r2=1664040&view=diff
==============================================================================
--- 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/migrating-from-other-solutions.mdtext
 (original)
+++ 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/migrating-from-other-solutions.mdtext
 Wed Mar  4 15:21:58 2015
@@ -0,0 +1,11 @@
+Title: Apache Felix Dependency Manager - Migrating from other solutions
+
+TODO
+
+# Declarative Services
+
+# Blueprint
+
+# iPOJO
+
+# Service Binder

Modified: 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/performance-tuning.mdtext
URL: 
http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/performance-tuning.mdtext?rev=1664040&r1=1664039&r2=1664040&view=diff
==============================================================================
--- 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/performance-tuning.mdtext
 (original)
+++ 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/performance-tuning.mdtext
 Wed Mar  4 15:21:58 2015
@@ -0,0 +1,35 @@
+Title: Apache Felix Dependency Manager - Performance Tuning
+
+### Filter Indices
+
+Filter indices allow you to speed up the service resolution process by 
skipping the services registry, in favor of a fast index on given service 
properties.
+
+The Dependency Manager will look for a set of filter indices in the 
`org.apache.felix.dependencymanager.filterindex` system property. This system 
property uses the following syntax,
+
+    property-index ::= service-property | service-property ',' property-index
+    index ::= '*aspect*' | '*adapter*' | property-index
+    indices ::= index | indices ';' index
+
+The implementation ships with three kinds of index implementations.
+
+- *Service property indices* are based on a set of service properties, like a 
multi-column index in a database. 
+- *Aspect indices* work with Dependency Manager Aspect services, and will 
provide indexing for the specific filters that they use.
+- *Adapter indices* work like Aspect indices, but for Adapter services.
+
+#### Performance
+
+The index isn't free, but reduces the linear (and wasteful) filter-based 
lookup to an indexed log(n) lookup. You can expect noticeable speedup if you 
have at least several hundred services.
+
+#### Examples
+
+    -Dorg.apache.felix.dependencymanager.filterindex=objectClass
+Sets an index on `objectClass`, speeding up lookups for any filter that 
contains an `objectClass` in its filter (all regular services do).
+ 
+    -Dorg.apache.felix.dependencymanager.filterindex=objectClass,id
+This filter helps if you have a lot of similar services, identified by some 
`id`.
+
+    
-Dorg.apache.felix.dependencymanager.filterindex=objectClass,id;objectClass,ipAddress
+This is a set of two filter indices, helping when you have one set of services 
that has an `id`, and another set that uses an `ipAddress` for identification.
+    
+    -Dorg.apache.felix.dependencymanager.filterindex=*aspect*
+Provides indexing for all Aspect services.

Modified: 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/resources.mdtext
URL: 
http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/resources.mdtext?rev=1664040&r1=1664039&r2=1664040&view=diff
==============================================================================
--- 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/resources.mdtext
 (original)
+++ 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/resources.mdtext
 Wed Mar  4 15:21:58 2015
@@ -0,0 +1,3 @@
+Title: Apache Felix Dependency Manager - Resources
+
+...
\ No newline at end of file

Added: 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/whatsnew.mdtext
URL: 
http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/whatsnew.mdtext?rev=1664040&view=auto
==============================================================================
--- 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/whatsnew.mdtext
 (added)
+++ 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/whatsnew.mdtext
 Wed Mar  4 15:21:58 2015
@@ -0,0 +1,60 @@
+Title: Apache Felix Dependency Manager - What's new in version 4?
+
+# What's new in version 4?
+
+DependencyManager 4.0 has been significantly reworked to improve support for 
concurrency. The following principles form the basis of the new concurrency 
model in DM4.
+
+ * All external events that influence the state of dependencies are recorded 
and given to the serial executor of the component. We record whatever data 
comes in, so when the actual job is run by the serial executor, we still have 
access to the original data without having to access other sources whose state 
might have changed since.
+ * The serial executor of a component will execute a job immediately if it is 
being called by the thread that is already executing jobs.
+ * If the serial executor of a component had not yet started a job, it will 
queue and start it on the current thread.
+ * If the serial executor gets invoked from a different thread than the one 
currently executing jobs, the job will be put at the end of the queue. As 
mentioned before, any data associated with the event will also be recorded so 
it is available when the job executes.
+ * State in the component and dependency can only be modified via the serial 
executor thread. This means we don't need explicit synchronization anywhere.
+
+DependencyManager 4 now also supports parallel execution of component wiring.
+
+Added support for parallelism: To allow components to be started and handled 
in parallel, you can now register in the OSGi service registry a 
ComponentExecutorFactory service that is used to get an Executor for the 
management of all components dependencies/lifecycle callbacks. See javadoc from 
the org.apache.felix.dm.ComponentExecutorFactory interface for more information.
+   
+You can also take a look at the the org.apache.felix.dependencymanager.samples 
project, which is registering a ComponentExecutorFactory from 
org.apache.felix.dependencymanager.samples.tpool bundle.
+  
+See also the following property in the 
org.apache.felix.dependencymanager.samples/bnd.bnd 
+
+       org.apache.felix.dependencymanager.parallel=\
+               '!org.apache.felix.dependencymanager.samples.tpool, *',\
+
+Here, all components will be handled by Executors provided by the 
ComponentExecutorFactory, except those having a package starting with 
"org.apache.felix.dependencymanager.samples.tpool" (because the threadpool is 
itself defined using the Dependency Manager API).
+
+In addition, some new features have been implemented in dependency manager:
+
+* Auto Config Iterable fields: AutoConfig dependencies can be applied on 
Iterable<Service> fields in order to be able to traverse currently injected 
services safely. The Iterable must be parameterized with the Service type. See 
org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/dictionary/api/Spellcheck.java
 for an example.
+
+* AutoConfig Map field: AutoConfig dependencies can be applied on a field with 
a Map<Service, Dictionary> type, allowing to traverse currently injected 
services safely, including service properties. The Map must be traversed using 
the Map.Entry iterator. See javadoc for DependencyManager.setAutoConfig().
+
+* Inject Configuration on separate callback instance: Configuration can be 
injected on a separate callback instance, like a CompositionManager for 
example. See an example in the samples, in 
org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/compositefactory/Activator.java.
 
+See FELIX-2706
+
+* Added propagate flag for Service Adapters: you can now choose to propagate 
or not adaptee service properties. See FELIX-4600
+
+* "Top" command in the shell: a "top" command is now available from the shell 
and can be used to display all top components sorted by their init/start 
elapsed time.
+
+* The Annotations plugin can now automatically generate a Require-Capability 
header on the Dependency Manager Runtime bundle. 
+Use "add-require-capability=true" option in the plugin declaration property to 
enable this new feature (see FELIX-4676):
+**  -plugin: org.apache.felix.dm.annotation.plugin.bnd.AnnotationPlugin; 
add-require-capability=true
+
+* The Configuration Dependency Configuration dependency now supports a "name" 
attribute, allowing to dynamically configure configuration pids from the @Init 
method. see FELIX-4777
+
+* Added a benchmark tool for dependency manager (not released, only available 
from the trunk, see 
dependencymanager/org.apache.felix.dependencymanager.benchmark/README
+
+* The Annotations "Factory Sets" are deprecated and have been replaced by a 
nice api exported by the runtime bundle. See FELIX-4684
+
+# What's changed in DependencyManager 4.0
+
+* The Annotations processor is not generating anymore the 
Import-Service/Export Service by default (no need to specify the 
"build-import-export-service=false" option in the
+annotations plugin if you don't need to generate automatically the deprecated 
headers.
+
+* The Dependency Manager metatype Annotations are now deprecated and it is 
encouraged to use standard bndtools metatypes.
+See 
org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/dictionary/annot/DictionaryConfiguration.java
 for an example.
+You can also check http://www.aqute.biz/Bnd/MetaType for more information 
about the bnd metatypes annotations.
+
+
+
+

Modified: 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-adapter.mdtext
URL: 
http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-adapter.mdtext?rev=1664040&r1=1664039&r2=1664040&view=diff
==============================================================================
--- 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-adapter.mdtext
 (original)
+++ 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-adapter.mdtext
 Wed Mar  4 15:21:58 2015
@@ -0,0 +1,75 @@
+#### Adapters
+
+Adapters, like aspects, are used to "extend" existing services, and can 
publish different services based on the existing one. An example would be 
implementing a management interface.
+
+
+
+## @AdapterService
+
+Adapters, like with *@AspectService*, are used to "extend" existing services, 
+and can publish different services based on the existing one. An example 
+would be implementing a management interface for an existing service, 
+etc .... When you annotate an adapter class with the *@AdapterService* 
+annotation, it will be applied to any service that matches the implemented 
+interface and filter. The adapter will be registered with the specified 
+interface and existing properties from the original service plus any extra
+properties you supply here. If you declare the original service as a member 
+it will be injected. 
+
+### 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.
+
+### Usage example
+
+Here, the AdapterService is registered into the OSGI registry each time an 
AdapteeService is found from the registry. The AdapterImpl class adapts the 
AdapteeService to the AdapterService. The AdapterService will also have a 
service property (param=value), and will also include eventual service 
properties found from the AdapteeService:
+
+
+     @AdapterService(adapteeService = AdapteeService.class, 
properties={@Property(name="param", value="value")})
+     class AdapterImpl implements AdapterService {
+         // The service we are adapting (injected by reflection)
+         protected AdapteeService adaptee;
+       
+         public void doWork() {
+            adaptee.mehod1();
+            adaptee.method2();
+         }
+     }
+
+

Modified: 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-aspect.mdtext
URL: 
http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-aspect.mdtext?rev=1664040&r1=1664039&r2=1664040&view=diff
==============================================================================
--- 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-aspect.mdtext
 (original)
+++ 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-aspect.mdtext
 Wed Mar  4 15:21:58 2015
@@ -0,0 +1,76 @@
+#### Aspects
+
+Aspects, as part of aspect oriented programming, can be used in a dynamic 
environment such as OSGi to "extend" existing services and add certain 
"capabilities" to them. Examples of these are adding a specific caching 
mechanism to a storage service or implementing logging. Aspects in OSGi can be 
applied to services and can be added and removed at runtime.
+
+
+
+
+## @AspectService
+
+Aspects allow you to define an interceptor, or chain of interceptors for a 
service (to add features like caching or logging, etc ...). The dependency 
manager intercepts the original service, and allows you to execute some code 
before invoking the original service ... The aspect will be applied to any 
service that matches the specified interface and filter and will be registered 
with the same interface and properties as 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.
+
+### Annotation attributes
+
+----
+**`ranking`**    
+*Required*: No    
+*Default*: --  
+
+Sets the ranking of this aspect. Since aspects are chained, the ranking 
+defines the order in which they are chained. Chain ranking is implemented as 
+a service ranking so service lookups automatically retrieve the top of the 
+chain.
+
+----
+**`service`**    
+*Required*: No    
+*Default*: all directly implemented interfaces.  
+
+Sets the service interface to apply the aspect to. By default, the directly 
+implemented interface is used.
+
+----
+**`filter`**    
+*Required*: No    
+*Default*: --
+
+Sets the filter condition to use with the service interface this aspect is 
+applying to.
+
+----
+**`properties`**    
+*Required*: No    
+*Default*: --
+
+Sets Additional properties to use with the aspect service registration.
+
+----
+**`field`**    
+*Required*: No    
+*Default*: --
+
+Sets the field name where to inject the original service. By default, the 
original service is injected in any attributes in the aspect implementation 
that are of the same type as the aspect interface.
+
+----
+**`factoryMethod`**    
+*Required*: No    
+*Default*: --
+
+Sets the static method used to create the aspect service implementation 
+instance. The default constructor of the annotated class is used. 
+The factoryMethod can be used to provide a specific aspect implements, 
+like a DynamicProxy.
+
+### Usage example:
+
+     @AspectService(ranking=10), properties={@Property(name="param", 
value="value")})
+     class AspectService implements InterceptedService {
+         // The service we are intercepting (injected by reflection)
+         protected InterceptedService intercepted;
+       
+         public void doWork() {
+            intercepted.doWork();
+         }
+     }
+
+

Added: 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-bundle-adapter.mdtext
URL: 
http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-bundle-adapter.mdtext?rev=1664040&view=auto
==============================================================================
--- 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-bundle-adapter.mdtext
 (added)
+++ 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-bundle-adapter.mdtext
 Wed Mar  4 15:21:58 2015
@@ -0,0 +1,82 @@
+
+
+## @BundleAdapterService
+
+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.
+
+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 
+OSGi manifest headers. For each matching bundle an adapter will be created 
+based on the adapter implementation class. The adapter will be registered 
+with the specified interface and with service properties found from the 
+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. 
+
+### Annotation attributes:
+
+----
+**`filter`**    
+*Required*: False    
+*Default*: --
+
+The filter used to match some OSGi manifest headers from a given bundle.
+
+----
+**`provides`**    
+*Required*: False    
+*Default*: all directly implemented interfaces.
+
+The interface(s) to use when registering adapters.
+By default, the interface(s) directly implemented by the annotated class is 
(are) used.
+
+----
+**`properties`**    
+*Required*: False    
+*Default*: --
+
+Additional properties to use with the service registration.
+
+----
+**`stateMask`**    
+*Required*: False    
+*Default*: INSTALLED | RESOLVED | ACTIVE
+
+The bundle state mask to apply. The mask is made up of the flags provided by 
+the org.osgi.framework.Bundle states 
+(UNINSTALLED | INSTALLED | RESOLVED | STARTING | STARTED | ACTIVE).
+
+----
+**`propagate`**    
+*Required*: False    
+*Default*: true
+
+Specifies if manifest headers from the bundle should be propagated to the 
+exposed service properties.
+
+----
+**`factoryMethod`**    
+*Required*: False    
+*Default*: --
+
+Sets the static method used to create the BundleAdapterService implementation 
+instance.
+
+### Usage Examples
+
+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:
+
+    :::java
+    @BundleAdapterService(filter = "(Video-Path=*)", stateMask = 
Bundle.ACTIVE, propagate=true)
+    public class VideoPlayerImpl implements VideoPlayer {
+        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() {}
+    }
+
+

Added: 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-factory-configuration-adapter.mdtext
URL: 
http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-factory-configuration-adapter.mdtext?rev=1664040&view=auto
==============================================================================
--- 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-factory-configuration-adapter.mdtext
 (added)
+++ 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-factory-configuration-adapter.mdtext
 Wed Mar  4 15:21:58 2015
@@ -0,0 +1,271 @@
+## @FactoryConfigurationAdapterService
+
+Annotates a class that acts as a Factory Configuration Adapter Service. 
+For each new Config Admin factory configuration matching the specified 
+factoryPid, an instance of this service will be created. The adapter will be 
+registered with the specified interface, and with the specified adapter 
+service properties. Depending on the propagate parameter, every public 
+factory configuration properties (which don't start with ".") will be 
+propagated along with the adapter service properties.
+
+Like in @ConfigurationDependency, you can optionally specify the meta types of 
+your configurations for Web Console GUI customization (configuration 
+heading/descriptions/default values/etc ...). 
+
+### Annotation attributes:
+
+----
+**`provides`**    
+*Required*: False    
+*Default*: all directly implemented interfaces.
+The interface(s) to use when registering adapters. By default, directly 
implemented interfaces will be registered in the OSGi registry. 
+
+----
+**`properties`**    
+*Required*: False    
+*Default*: --
+
+Adapter Service properties. Notice that public factory configuration is also 
+registered in service properties, (only if propagate is true). 
+Public factory configuration properties are those which don't starts with a 
+dot (".").
+
+----
+**`factoryPid`**    
+*Required*: False    
+*Default*: The class name, including the package.
+
+Returns the factory pid whose configurations will instantiate the 
+annotated service class. 
+(By default, the pid is the service class name). 
+
+----
+**`updated`**    
+*Required*: False    
+*Default*: "updated"
+
+The Update method to invoke (defaulting to "updated"), when a factory 
+configuration is created or updated 
+
+----
+**`propagate`**    
+*Required*: False    
+*Default*: false
+
+Returns true if the configuration properties must be published 
+along with the service. Any additional service properties specified directly 
+are merged with these. 
+
+----
+**`heading`**    
+*Required*: False    
+*Default*: --
+
+The label used to display the tab name (or section) where the properties are 
+displayed. Example: "Printer Service". 
+
+----
+**`description`**    
+*Required*: False    
+*Default*: --
+
+A human readable description of the PID this annotation is associated with. 
+Example: "Configuration for the PrinterService bundle". 
+
+----
+**`factoryMethod`**    
+*Required*: False    
+*Default*: --
+
+Sets the static method used to create the adapter instance.
+
+----
+**`metadata`**    
+*Required*: False    
+*Default*: --
+An array of "PropertyMetaData annotations, specifying property types used to 
+expose properties in web console
+
+### PropertyMetaData anotation attributes: 
+
+----
+**`description`**    
+*Required*: True    
+*Default*: --
+Returns the property description. The description may be localized and must 
+describe the semantics of this type and any constraints. 
+Example: "Select the log level for the Printer Service".
+
+----
+**`type`**    
+*Required*: False    
+*Default*: String
+
+Return the property primitive type (java.lang.String.class by default). 
+If must be either one of the following types:
+
+- String.class
+- Long.class
+- Integer.class
+- Character.class
+- Byte.class
+- Double.class
+- Float.class
+- Boolean.class
+
+----
+**`defaults`**    
+*Required*: False    
+*Default*: --
+
+Return a default for this property. The object must be of the appropriate 
+type as defined by the cardinality and getType(). The return type is a list of 
+String objects that can be converted to the appropriate type. 
+The cardinality of the return array must follow the absolute cardinality of
+this type. E.g. if the cardinality = 0, the array must contain 1 element. If 
+the cardinality is 1, it must contain 0 or 1 elements. If it is -5, it must 
+contain from 0 to max 5 elements. Note that the special case of a 0 
+cardinality, meaning a single value, does not allow arrays or vectors of 0 
+elements. 
+
+----
+**`cardinality`**    
+*Required*: False    
+*Default*: --
+
+Returns the cardinality of this property (0 by default). The OSGi environment
+handles multi valued properties in arrays or in Vector objects. 
+The return value is defined as follows:
+
+- x = Integer.MIN_VALUE:  no limit, but use Vector
+- x < 0: -x = max occurrences, store in Vector
+- x > 0: x = max occurrences, store in array []({{ refs..path }})
+- x = Integer.MAX_VALUE: no limit, but use array []({{ refs..path }})
+- x = 0: 1 occurrence required
+
+----
+**`required`**    
+*Required*: False    
+*Default*: true
+
+Tells if this property is required or not. 
+
+----
+**`optionLabels`**    
+*Required*: False    
+*Default*: --
+
+Return a list of valid option labels for this property. The purpose of this 
+method is to allow menus with localized labels. It is associated with the 
+*optionValues* attribute. The labels returned here are ordered in the same 
+way as the *optionValues* attribute values. 
+
+----
+**`optionValues`**    
+*Required*: False    
+*Default*: --
+
+Return a list of option values that this property can take. This list must be 
+in the same sequence as the *optionLabels* attribute. 
+
+### Usage Examples
+
+Here, a "Dictionary" service instance is instantiated for each existing 
+factory configuration instances matching the "DictionaryServiceFactory" 
+factory pid:
+
+    :::java
+    @FactoryConfigurationAdapterService(factoryPid="DictionaryServiceFactory", 
updated="updated")
+    public class DictionaryImpl implements DictionaryService
+    {
+        /**
+          * The key of our config admin dictionary language.
+          */
+        final static String LANG = "lang";
+             
+        /**
+          * The key of our config admin dictionary values.
+          */
+        final static String WORDS = "words";
+             
+        /**
+          * We store all configured words in a thread-safe data structure, 
because ConfigAdmin
+          * may invoke our updated method at any time.
+          */
+        private CopyOnWriteArrayList<String> m_words = new 
CopyOnWriteArrayList<String>();
+             
+        /**
+          * Our Dictionary language.
+          */
+        private String m_lang;
+         
+        protected void updated(Dictionary<String, ?> config) {
+            m_lang = (String) config.get(LANG);
+            m_words.clear();
+            String[] words = (String[]) config.get(WORDS);
+            for (String word : words) {
+                m_words.add(word);
+            }
+         }   
+             // ...
+    }
+
+Here, this is the same example as above, but using meta types:
+
+    :::java
+    @FactoryConfigurationAdapterService(
+          factoryPid="DictionaryServiceFactory", 
+          propagate=true, 
+          updated="updated",
+          heading="Dictionary Services",
+          description="Declare here some Dictionary instances, allowing to 
instantiates some DictionaryService services for a given dictionary language",
+          metadata={
+              @PropertyMetaData(
+                     heading="Dictionary Language",
+                     description="Declare here the language supported by this 
dictionary. " +
+                         "This property will be propagated with the Dictionary 
Service properties.",
+                     defaults={"en"},
+                     id=DictionaryImpl.LANG,
+                     cardinality=0),
+              @PropertyMetaData(
+                     heading="Dictionary words",
+                     description="Declare here the list of words supported by 
this dictionary. This properties starts with a Dot and won't be propagated with 
Dictionary OSGi service properties.",
+                     defaults={"hello", "world"},
+                     id=DictionaryImpl.WORDS,
+                     cardinality=Integer.MAX_VALUE)
+          }
+      )  
+      public class DictionaryImpl implements DictionaryService
+      {
+         /**
+           * The key of our config admin dictionary language.
+           */
+         final static String LANG = "lang";
+             
+         /**
+           * The key of our config admin dictionary values.
+           */
+         final static String WORDS = "words";
+             
+         /**
+           * We store all configured words in a thread-safe data structure, 
because ConfigAdmin
+           * may invoke our updated method at any time.
+           */
+         private CopyOnWriteArrayList<String> m_words = new 
CopyOnWriteArrayList<String>();
+             
+         /**
+           * Our Dictionary language.
+           */
+         private String m_lang;
+         
+         protected void updated(Dictionary<String, ?> config) {
+             m_lang = (String) config.get(LANG);
+             m_words.clear();
+             String[] words = (String[]) config.get(WORDS);
+             for (String word : words) {
+                 m_words.add(word);
+             }
+         }
+             
+         // ...
+    }

Modified: 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-resource-adapter.mdtext
URL: 
http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-resource-adapter.mdtext?rev=1664040&r1=1664039&r2=1664040&view=diff
==============================================================================
--- 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-resource-adapter.mdtext
 (original)
+++ 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-resource-adapter.mdtext
 Wed Mar  4 15:21:58 2015
@@ -0,0 +1,47 @@
+#### Resource Adapters
+
+Resource adapters work just like adapters, but instead of working with 
services, they work with resources. Resources, represented as a URL, are an 
abstraction introduced to provide a generic way of dealing with "blobs" and can 
be resources inside a bundle, filesystem or some kind of data store.
+
+
+
+
+## @ResourceAdapterService
+
+Resource adapters are things that adapt a resource instead of a service, and 
+provide an adapter service on top of this resource. Resources are an 
+abstraction that is introduced by the dependency manager, represented as a 
URL. They can be implemented to serve resources embedded in bundles, somewhere 
on a file system or in an http content repository server, or database.
+
+The adapter will be applied to any resource that matches the specified filter 
+condition, which can match some part of the resource URL (with "path", 
+"protocol", "port", or "host" filters). For each matching resource an 
+adapter will be created based on the adapter implementation class. 
+The adapter will be registered with the specified interface and with any 
+extra service properties you supply here. Moreover, the following service 
+properties will be propagated from the resource URL:
+
+* *host*: this property exposes the host part of the resource URL
+* *path*: the resource URL path
+* *protocol*: the resource URL protocol
+* *port*: the resource URL port 
+
+### Annotation attributes
+
+TBD
+
+### Usage Examples:
+
+Here, the "VideoPlayer" service provides a video service on top of any movie 
+resources, with service properties "host"/"port"/"protocol"/"path" extracted 
+from the resource URL:
+
+    :::java
+    @ResourceAdapterService(filter = 
"(&(path=/videos/*.mkv)(host=localhost))", propagate = true)
+    public class VideoPlayerImpl implements VideoPlayer {
+        // Injected by reflection
+        URL resource;
+             
+        void play() {} // play video referenced by this.resource     
+        void stop() {} // stop playing the video
+        void transcode() {} // ...
+    }
+

Modified: 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/components.mdtext
URL: 
http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/components.mdtext?rev=1664040&r1=1664039&r2=1664040&view=diff
==============================================================================
--- 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/components.mdtext
 (original)
+++ 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/components.mdtext
 Wed Mar  4 15:21:58 2015
@@ -0,0 +1,223 @@
+Title: Apache Felix Dependency Manager - Components
+
+Components are declared by the dependency manager and can be implemented by 
POJOs that contain no references to the OSGi framework whatsoever. Components 
are the main building blocks of your OSGi application. They have a life cycle, 
can register themselves as services and have zero or more dependencies.
+
+## Life cycle
+
+The dependency manager, as part of a bundle, shares the generic bundle life 
cycle explained in the OSGi specification. The life cycle of the dependency 
manager itself, and the components it manages, can be located inside the 
*active* state of the hosting bundle.
+
+Each component you define gets its own life cycle, which is explained in the 
state diagram below.
+
+{gliffy:name=state-diagram|align=center|size=L|version=2}
+
+A component is associated with an instance. This instance can either be 
specified directly, or you can specify its class. If you do the latter, the 
actual instance will be created lazily. 
+
+Changes in the state of the component will trigger the following life cycle 
methods:
+* `init`, 
+* `start`, 
+* `stop` and 
+* `destroy`.
+
+The dependency manager will look for methods with these names and one of the 
following signatures in this order:
+* (Component),
+* ().
+
+If you don't specify anything, the methods with these names will be invoked on 
the instance. By using `setCallbacks()` you can however change this behavior: 
You can change the names of the methods to look for. Any methods that are set 
to ` null ` will not be invoked at all. Another thing you can do is to specify 
a different instance to invoke these methods on. If you do that, you will 
usually want to use the first signature, which gives you a reference to the ` 
Component ` whose life cycle method was invoked.
+
+## Interfaces and properties
+
+Components in the context of the dependency manager can be published as OSGi 
services under one or more interface names, plus optionally a set of 
properties. This is no different than a normal OSGi service. It's important to 
mention that you don't have to register a service. If you don't, you basically 
created a component that can do work and have dependencies and a managed life 
cycle.
+
+## Composition
+
+When implementing more complex components, you often find yourself using more 
than one instance. 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. This has to be a fixed set of instances however.
+
+## Factories
+
+Out of the box, there already is support for lazy instantiation, meaning that 
the dependency manager can create component instances for you when their 
required dependencies are resolved. However, sometimes creating a single 
instance using a default constructor is not enough. In those cases, you can 
tell the dependency manager to delegate the creation process to a factory.
+
+# Annotations
+
+This page describes the different types of Dependency Manager components:
+
+* *Component*: Components are the main building blocks for OSGi applications. 
They can publish themselves as a service, and/or they can have dependencies. 
These dependencies will influence their life cycle as component will only be 
activated when all required dependencies are available.
+* *Aspect Service*: A service that provides a non-functional aspect on top of 
an existing service. In aspect oriented programming, an aspect, or interceptor 
can sit between a client and another target service used by the client. An 
Aspect Service first tracks a target service and is created once the target 
service is detected. Then the Aspect Service is provided, but with a higher  
ranking, and the client is transparently updated with the aspect. Aspects can 
be chained and may apply to the same target service (and in this case, the 
ranking of the Aspect service is used to chain aspects in  the proper order).
+* *Adapter Service*: A Service that adapts another existing service into a new 
one. Like with aspects, sometimes you want to create adapters for certain 
services, which add certain behavior that results in the publication of (in 
this case) a different service. Adapters can dynamically be added and removed 
and allow you to keep your basic services implementations clean and simple, 
adding extra features on top of them in a modular way.
+* *Bundle Adapter Service*: creates an OSGi service a service on top of a 
given bundle.
+* *Resource Adapter Service*: creates an OSGi service on top of a specific 
Resource.
+* *Factory Configuration Adapter Service*: creates an OSGi service from 
ConfigAdmin, using a factoryPid, and a ManagedServiceFactory.
+
+## @Component
+
+This annotation annotates an implementation class that optionally publishes 
+an OSGi service, and optionally has some dependencies, with a managed 
+lifecycle. 
+
+### Annotation attributes
+
+----
+**`provides`**    
+*Required*: No    
+*Default*: all implemented interfaces, if any.   
+
+By default, the component is registered into the OSGi registry under all 
+directly implemented interfaces. If no interfaces are implemented, then the 
+component is not registered, but it still has a managed lifecycle, and may 
+have some dependencies. If you need to  explicitly define the list of 
+interfaces (or classes) under which the  component must be registered in the 
+OSGi registry, then use the *provides* attribute. You can also set this 
+property to an empty array of classes  if you don't want at all your component 
+to be exposed in the OSGi  registry (even if it implements some interfaces).
+
+----
+**`properties`**    
+*Required*: No    
+*Default*: --  
+
+the *properties" attribute enumerates the list of properties that are part of 
+the Service exposed by the component in the OSGi Registry. 
+Each property is defined using the @Property annotation, which represents a  
+key/value pair. When a value is actually an array of strings, 
+then the *values* attribute of the @Property annotation can be used. 
+This attribute  is not the only way to specify OSGi Service properties 
+(see Setting Service properties in the lifecycle section).
+
+----
+**`factoryMethod`**    
+*Required*: No    
+*Default*: --  
+
+This attribute refers to a static method name from the annotated class which 
+can be used to instantiate the component instance. Normally, DependencyManager 
+instantiates the component using its class name, and with the default 
+constructor of the class, but there are some cases where it is required to 
+take control of  how the component is created. For instance, this method may 
+be used to create the component as a dynamic proxy ...
+
+----
+**`factorySet`**    
+*Required*: No    
+*Default*: --  
+ 
+This attribute is the identifier for a component factory. By default, a 
+component is automatically instantiated as a singleton when the bundle is 
+started, and when all required dependencies are satisfied. But when a 
+component must be created, configured, or disposed dynamically, and when 
+multiple instances of the same component are needed, a factorySet should  be 
+used. When you use this attribute, a java.util.Set<Dictionary>  object is 
+registered into the OSGi regitry, with a specific *dm.factory.name* service 
+property matching the ID you specify in the attribute. 
+
+This Set<Dictionary> will act as a Factory API, and another component may 
+define a dependency on this Set and add some configuration dictionaries in it, 
+in order to fire some component instantiation/activation. There is one 
+component instantiated per added dictionary, which is passed to component 
+instances via a configurable callback method (using the *factoryConfigure* 
+attribute). All public properties will be propagated  along with eventual 
+published service. A public property is a property  which does not start with 
+a dot ("."). Properties starting with a dot are considered private to the 
+component, and won't be propagated to published service. This model is 
+actually similar to the Declarative Service "Component Factories" concept, 
+except that you don't have a dependency on a specific API, but rather on a 
+basic jdk class  (java.util.Set<Dictionary>). 
+
+Notice that, unlike in Declarative Service, the component factory is provided 
once the component 
+bundle is started, even if required dependencies are not satisfied. This is 
+useful when the component want  to dynamically configure its dependency 
+filters. So, to summarize:
+
+- Each time a new Dictionary is added into the Set, then a new instance of the 
annotated component will be instantiated, and this dictionary is passed to the 
component callback specified with the factoryConfigure attribute.
+- Each time an existing Dictionary is re-added into the Set, then the 
corresponding component instance is updated, and the updated dictionary is also 
passed to the callback specified in the factoryConfigure attribute.
+- Each time an existing Dictionary is removed from the Set, then the  
corresponding component instance will be stopped and destroyed.
+
+----
+**`factoryConfigure`**    
+*Required*: No    
+*Default*: --  
+
+This attributes sets the *configure* method name to be called with the factory 
+configuration. This attribute only makes sense if the factorySet() attribute 
+is used. If specified, then this attribute references a component callback 
+method, which is called for providing the configuration supplied by the 
+factory that instantiated this component. The current Service properties will 
+be also updated with all public properties (which don't start with a dot).
+
+Usage example:
+
+    :::java
+    /**
+      * This component will be activated once the bundle is started and when 
all required dependencies
+      * are available.
+      */
+    @Component
+    class X implements Z {
+        @ConfigurationDependency(pid="MyPid")
+        void configure(Dictionary conf) {
+             // Configure or reconfigure our service.
+        }
+    
+        @Start
+        void start() {
+            // Our component is starting and is about to be registered in the 
OSGi registry as a Z service.
+        }
+    
+        public void doService() {
+            // ...
+        }
+    }
+    
+
+Example using a factorySet, where the X component is 
instantiated/updated/disposed by another Y component:
+
+    :::java
+     @Component(factorySet="MyComponentFactory", factoryConfigure="configure")
+     class X implements Z {
+         void configure(Dictionary conf) {
+             // Configure or reconfigure our component. The conf is provided 
by the factory,
+             // and all public properties (which don't start with a dot) are 
propagated with the
+             // Service properties eventually specified in the properties 
annotation attribute.
+         }
+    
+         @ServiceDependency
+         void bindOtherService(OtherService other) {
+             // store this require dependency
+         }
+    
+         @Start
+         void start() {
+             // Our component is starting and is about to be registered in the 
OSGi registry as a Z service.
+         }
+    
+         public void doService() {
+             // ... part of Z interface
+         }
+     }
+    
+    /**
+      * This class will instantiate some X component instances
+      */
+    @Component
+    class Y {
+         @ServiceDependency(filter="(dm.factory.name=MyComponentFactory)")
+         Set<Dictionary> _XFactory; // This Set acts as a Factory API for 
creating X component instances.
+    
+         @Start
+         void start() {
+             // Instantiate a X component instance
+             Dictionary x1 = new Hashtable() {{ put("foo", "bar1"); }};
+             _XFactory.add(x1);
+    
+             // Instantiate another X component instance
+             Dictionary x2 = new Hashtable() {{ put("foo", "bar2"); }};
+             _XFactory.add(x2);
+    
+             // Update the first X component instance
+             x1.put("foo", "bar1_modified");
+             _XFactory.add(x1);
+    
+             // Destroy all components (Notice that invoking _XFactory.clear() 
also destroys every X instances)
+             _XFactory.remove(x1);
+             _XFactory.remove(x2);
+         }
+    }
+

Modified: 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependencies.mdtext
URL: 
http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependencies.mdtext?rev=1664040&r1=1664039&r2=1664040&view=diff
==============================================================================
--- 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependencies.mdtext
 (original)
+++ 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependencies.mdtext
 Wed Mar  4 15:21:58 2015
@@ -0,0 +1,24 @@
+### Dependencies
+
+The dependency manager supports many different types of dependencies, all of 
which can be required or optional. A dependency can be added to one or more 
components and it is possible to add them dynamically (even from within the 
component itself if necessary, which allows for some really dynamic dependency 
configuration).
+
+#### Injection
+
+One way to deal with dependencies is to have them injected into your component 
instances automatically. All you need to do is simply declare a field of the 
same type as your dependency, make the member volatile so any changes will 
become visible immediately and you're done. If a dependency is optional, a null 
object will be injected if the dependency is not available.
+
+Sometimes you need more control over injection, so optionally you can even 
specify the name of the field to inject into. This allows you to depend on 
different dependencies of the same type, or simply to prevent injection into 
more than one field.
+
+#### Callbacks
+
+When keeping track of multiple instances of a dependency, or when you simply 
want something to happen whenever a dependency becomes (un)available or 
changes, you can define callbacks, like `added`, `changed` and `removed`. 
Optionally, you can provide the dependency manager with an instance to invoke 
these callback methods on. If you don't, they'll be invoked on the component 
instance.
+
+#### Types of Dependencies
+
+Out of the box, several types of dependencies are supported: service, bundle, 
configuration, resource and temporal service. However, it's quite easy to add 
your own custom type of dependency too.
+
+##### Implementing Your Own Dependency
+
+All dependencies share a common API which you can implement yourself if you 
need a special type of dependency. Whilst not entirely trivial, this allows you 
to create your own types of dependencies. This can be useful for various 
scenarios where you want to have components that depend on things that are not 
services, bundles or configuration.
+
+An example implementation can be found in one of the many test cases for the 
dependency manager: ` CustomDependencyTest `. This implements a dependency that 
can be made available and unavailable by manipulating a ` Toggle ` which can be 
made available or unavailable. You basically have to implement two interfaces: 
` Dependency ` and ` DependencyActivation `. The former contains the bulk of 
the methods that you will need to implement and depending on the actual 
features you want your dependency to support, you have to implement some or all 
of them. The JavaDoc for each method plus the example code should get you 
started. The latter contains a couple of life cycle methods to start and stop 
tracking your custom dependency.
+

Modified: 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependency-bundle.mdtext
URL: 
http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependency-bundle.mdtext?rev=1664040&r1=1664039&r2=1664040&view=diff
==============================================================================
--- 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependency-bundle.mdtext
 (original)
+++ 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependency-bundle.mdtext
 Wed Mar  4 15:21:58 2015
@@ -0,0 +1,42 @@
+##### Bundle
+
+A bundle dependency allows you to depend on a bundle in a certain set of 
states, as indicated by a state mask. You can also use a filter condition that 
is matched against all manifest entries. Finally you can provide a reference to 
an existing bundle.
+
+
+
+## @BundleDependency
+
+A bundle dependency allows you to depend on a bundle in a certain set of 
states (INSTALLED\|RESOLVED\|STARTED\|...), as indicated by a state mask. You 
can also use a filter condition that is matched against all manifest entries. 
When applied on a class field, optional unavailable dependencies are injected 
with a NullObject.
+
+Attributes:
+
+* *changed*: Returns the callback method to be invoked when the service have 
changed.
+* *removed*: Returns the callback method to invoke when the service is lost.
+* *required*: Returns whether the dependency is required or not.
+* *filter*: Returns the filter dependency
+* *stateMask*: Returns the bundle state mask (Bundle.INSTALLED \| 
Bundle.ACTIVE etc ...).
+* *propagate*: Specifies if the manifest headers from the bundle should be 
propagated to the service properties.
+* *name*: The name used when dynamically configuring this dependency from the 
init method. Specifying this attribute allows to dynamically configure the 
dependency filter and required flag from the Service's init method. All unnamed 
dependencies will be injected before the init() method; so from the init() 
method, you can then pick up whatever information needed from already injected 
(unnamed) dependencies, and configure dynamically your named dependencies, 
which will then be calculated once the init() method returns.
+Please refer to [Here]({{ refs.dependencymanager-annotations-lifecycle.path 
}}).
+
+Usage Examples
+
+In the following example, the "SCR" Component allows to track all bundles 
containing a specific "Service-Component" OSGi header, in order to load and 
manage all Declarative Service components specified in the SCR xml documents 
referenced by the header:
+
+    :::java
+    @Component
+    public class SCR {
+        @BundleDependency(required = false,
+                          removed = "unloadServiceComponents",
+                          filter = "(Service-Component=*)"
+                          stateMask = Bundle.ACTIVE)
+        void loadServiceComponents(Bundle b) {
+            String descriptorPaths = (String) 
b.getHeaders().get("Service-Component");
+            // load all service component specified in the XML descriptorPaths 
files ...
+        }
+
+        void unloadServiceComponents(Bundle b) {
+            // unload all service component we loaded from our 
"loadServiceComponents" method.
+        }
+    }
+

Modified: 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependency-configuration.mdtext
URL: 
http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependency-configuration.mdtext?rev=1664040&r1=1664039&r2=1664040&view=diff
==============================================================================
--- 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependency-configuration.mdtext
 (original)
+++ 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependency-configuration.mdtext
 Wed Mar  4 15:21:58 2015
@@ -0,0 +1,61 @@
+##### Configuration
+
+A configuration dependency is always required, and allows you to depend on the 
availability of a valid configuration for your component. Optional 
configuration dependencies are not supported because in that case you can just 
as well register as a ` ManagedService ` yourself.
+
+## @ConfigurationDependency
+
+A configuration dependency is always required, and allows you to depend on the 
availability of a valid configuration for your component. This dependency 
requires the OSGi Configuration Admin Service.
+
+Annotation attributes:
+
+* *pid*: Returns the pid for a given service (by default, the pid is the 
service class name).
+* *propagate*: Returns true if the configuration properties must be published 
along with the service. Any additional service properties specified directly 
are merged with these.
+* *heading*: The label used to display the tab name (or section) where the 
properties are displayed. Example: "Printer Service".
+* *description*: A human readable description of the PID this annotation is 
associated with. Example: "Configuration for the PrinterService bundle".
+* *metadata*: an array of PropertyMetadaData\[\]({{ refs..path }}) annotation 
describing property types (see the FactoryConfigurationAdapterService section 
in the "Writing Components" section.
+
+Usage Examples
+
+In the following example, the "Printer" component depends on a configuration 
whose PID name is "org.apache.felix.sample.Printer". This service will 
initialize its ip/port number from the provided configuration:
+
+    :::java
+    package org.apache.felix.sample;
+    
+    @Component
+    public class Printer {
+        @ConfigurationDependency
+        void updated(Dictionary config) {
+            // load printer ip/port from the provided dictionary.
+        }
+    }
+
+This other example shows how to specify a configuration dependency, as well as 
meta data used to customize the WebConsole GUI. Using these meta data, you can 
specify for example the default value for your configurations data, some 
descriptions, the cardinality of configuration values, etc ...
+
+    :::java
+    package org.apache.felix.sample;
+    
+    @Component
+    public class Printer {
+        @ConfigurationDependency(
+            heading = "Printer Service",
+            description = "Declare here parameters used to configure the 
Printer service",
+            metadata = {
+                @PropertyMetaData(heading = "Ip Address",
+                                  description = "Enter the ip address for the 
Printer service",
+                                  defaults = { "127.0.0.1" },
+                                  type = String.class,
+                                  id = "IPADDR",
+                                  cardinality = 0),
+                @PropertyMetaData(heading = "Port Number",
+                                  description = "Enter the port number for the 
Printer service",
+                                  defaults = { "4444" },
+                                  type = Integer.class,
+                                  id = "PORTNUM",
+                                  cardinality = 0)
+                 }
+        )
+        void updated(Dictionary config) {
+            // load configuration from the provided dictionary.
+        }
+    }
+

Modified: 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependency-resource.mdtext
URL: 
http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependency-resource.mdtext?rev=1664040&r1=1664039&r2=1664040&view=diff
==============================================================================
--- 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependency-resource.mdtext
 (original)
+++ 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependency-resource.mdtext
 Wed Mar  4 15:21:58 2015
@@ -0,0 +1,87 @@
+##### Resource
+
+A resource dependency allows you to depend on a resource. A resource is a URL 
and you can use a filter condition based on protocol, host, port, path and URL.
+
+
+## @ResourceDependency
+
+Annotates a method of field as a Resource Dependency. A resource dependency 
allows you to depend on a resource. Resources are an abstraction that is 
introduced by the dependency manager, represented as a URL. They can be 
implemented to serve resources embedded in bundles, somewhere on a file system 
or in an http content repository server, or database.
+A resource is a URL and you can use a filter condition based on protocol, 
host, port, and path.
+
+Attributes:
+
+* *added*: Returns the callback method to be invoked when the service is 
available. This attribute is only meaningful when the annotation is applied on 
a class field.
+* *changed*: Returns the callback method to be invoked when the service 
properties have changed.
+* *removed*: Returns the callback method to invoke when the service is lost.
+* *required*: Returns whether the Service dependency is required or not.
+* *filter*: Returns the Service dependency OSGi filter.
+* *propagate*: Specifies if the resource URL properties must be propagated. If 
set to true, then the URL properties ("protocol"/"host"/"port"/"path") will be 
propagated to the service properties of the component which is using this 
dependency.
+* *name*: The name used when dynamically configuring this dependency from the 
init method. Specifying this attribute allows to dynamically configure the 
dependency filter and required flag from the Service's init method. All unnamed 
dependencies will be injected before the init() method; so from the init() 
method, you can then pick up whatever information needed from already injected 
(unnamed) dependencies, and configure dynamically your named dependencies, 
which will then be calculated once the init() method returns. Please refer to 
[Here]({{ refs.dependencymanager-annotations-lifecycle.path }}).
+
+Usage Examples
+Here, the "VideoPlayer" component plays any provided MKV video resources
+
+
+    :::java
+    @Component
+    public class VideoPlayer {
+        @ResourceDependency(required=false, filter="(path=/videos/*.mkv)")
+        void playResource(URL video) { ... }
+    }
+
+And here is an example of a VideoProvider, which provides some videos using a 
web URL. Notice that Resource providers need to depend on the DependencyManager 
API:
+
+    :::java
+    import java.net.MalformedURLException;
+    import java.net.URL;
+    import java.util.HashMap;
+    import java.util.Map;
+    
+    import org.apache.felix.dm.ResourceHandler;
+    import org.apache.felix.dm.ResourceUtil;
+    import org.apache.felix.dm.annotation.api.Component;
+    import org.apache.felix.dm.annotation.api.Init;
+    import org.apache.felix.dm.annotation.api.ServiceDependency;
+    import org.osgi.framework.BundleContext;
+    import org.osgi.framework.Filter;
+    import org.osgi.framework.InvalidSyntaxException;
+
+    @Component
+    public class VideoProvider
+    {
+        // Injected by reflection
+        private volatile BundleContext context;
+        // List of known resource handlers
+        private Map<ResourceHandler, Filter> m_handlers = new 
HashMap<ResourceHandler, Filter>();
+        // List of known video resources
+        private URL[] m_videos;
+
+        @Init
+        void init() throws MalformedURLException
+        {
+           m_videos = new URL[] {
+                   new URL("http://localhost:8080/videos/video1.mkv";),
+                   new URL("http://localhost:8080/videos/video2.mkv";),
+            };
+        }
+    
+        // Track resource handlers
+        @ServiceDependency(required = false)
+        public void add(Map<String, String> serviceProperties, ResourceHandler 
handler) throws InvalidSyntaxException
+        {
+            String filterString = serviceProperties.get("filter");
+            filterString = (filterString != null) ? filterString : "(path=*)";
+            Filter filter = context.createFilter(filterString);
+            synchronized (this)
+            {
+                m_handlers.put(handler, filter);
+            }
+            for (URL video : m_videos)
+            {
+                if (filter.match(ResourceUtil.createProperties(video)))
+                {
+                    handler.added(video);
+                }
+            }
+        }
+    }

Modified: 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependency-service.mdtext
URL: 
http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependency-service.mdtext?rev=1664040&r1=1664039&r2=1664040&view=diff
==============================================================================
--- 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependency-service.mdtext
 (original)
+++ 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependency-service.mdtext
 Wed Mar  4 15:21:58 2015
@@ -0,0 +1,79 @@
+##### Service
+
+A service dependency allows you to depend on a service, either by type or by 
using an additional filter condition. You can even depend on an existing 
service directly by providing a reference to it.
+
+## @ServiceDependency
+
+Annotates a method or a field for injecting a Service Dependency on it. When 
applied on a class field, optional unavailable dependencies are injected with a 
NullObject.
+
+Annotation attributes:
+
+* *added*: The callback method to be invoked when the service is available. 
This attribute is only meaningful when the annotation is applied on a class 
field.
+* *changed*: The callback method to be invoked when the service properties 
have changed.
+* *removed*: The callback method to invoke when the service is lost.
+* *timeout*: The max time in millis to wait for when the dependency is 
temporarily unavailable. Specifying a positive number allow to block the caller 
thread between service updates. Only useful for required stateless dependencies 
that can be replaced transparently. A Dynamic Proxy is used to wrap the actual 
service dependency (which must be an interface). When the dependency goes away, 
an attempt is made to replace it with another one which satisfies the service 
dependency criteria. If no service replacement is available, then any method 
invocation (through the dynamic proxy) will block during a configurable 
timeout. On timeout, an unchecked IllegalStateException exception is raised 
(but the service is not deactivated).
+Notice that the changed/removed callbacks are not used when the timeout 
parameter is > -1.
+-1 means no timeout at all (default). 0 means that invocation on a missing 
service will fail immediately. A positive number represents the max timeout in 
millis to wait for the service availability.
+* *name*: The name used when dynamically configuring this dependency from the 
init method. Specifying this attribute allows to dynamically configure the 
dependency filter and required flag from the Service's init method. All unnamed 
dependencies will be injected before the init() method; so from the init() 
method, you can then pick up whatever information needed from already injected 
(unnamed) dependencies, and configure dynamically your named dependencies, 
which will then be calculated once the init() method returns. Please refer to 
[Here]({{ refs.dependencymanager-annotations-lifecycle.path }}) for more 
informations about named dependencies.
+* *propagate*: Returns true if the dependency service properties must be 
published along with the service. Any additional service properties specified 
directly are merged with these.
+
+Usage Example: Here, the MyComponent component is injected with a dependency 
over a "MyDependency" service.
+
+    :::java
+    @Component
+    class MyComponent {
+         @ServiceDependency(timeout=15000)
+         MyDependency dependency;
+         // ...
+    }
+
+
+Usage example of a Service whose dependency filter is configured from 
ConfigAdmin, using a "named" dependency
+(please check [Here]({{ refs.dependencymanager-annotations-lifecycle.path }}) 
for more informations about "named" dependencies):
+
+    :::java
+    /**
+      * A Service whose service dependency "otherService" filter is configured 
from ConfigAdmin
+      */
+    @Service
+    class X {
+        private Dictionary m_config;
+    
+         /**
+           * Initialize our service from config ... and store the config for 
later usage (from our init method)
+           */
+         @ConfigurationDependency(pid="MyPid")
+         void configure(Dictionary conf) {
+               m_config = config;
+         }
+
+         /**
+          * All unnamed dependencies are injected: we can now configure other 
named
+          * dependencies, using the already injected configuration.
+          * The returned Map will be used to configure our "otherService" 
Dependency.
+          */
+         @Init
+         Map init() {
+             return new HashMap() {{
+                 put("otherService.filter", m_config.get("filter"));
+                 put("otherService.required", m_config.get("required"));
+             }};
+         }
+    
+         /**
+          * This named dependency filter/required flag will be configured by 
our init method (see above).
+          */
+         @ServiceDependency(name="otherService")
+             void bindOtherService(OtherService other) {
+         }
+
+         /**
+          * All dependencies are injected and our service is now ready to be 
published.
+          * Notice that you can also use the publisher service attribute if 
you need
+          * to take control on service exposition.
+          */
+         @Start
+         void start() {
+         }
+     }
+

Modified: 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/external-links.mdtext
URL: 
http://svn.apache.org/viewvc/felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/external-links.mdtext?rev=1664040&r1=1664039&r2=1664040&view=diff
==============================================================================
--- 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/external-links.mdtext
 (original)
+++ 
felix/site/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/external-links.mdtext
 Wed Mar  4 15:21:58 2015
@@ -0,0 +1,12 @@
+
+
+
+
+Title: Dependency Manager Resources
+Excerpt: Dependency Manager articles and resources
+
+This page regroups Dependency Manager external articles and related links.
+
+* [BndTools based demo of Dependency Manager 
annotations](https://bitbucket.org/marrs/bndtools-dmdemo)
+* [Introduction to Dependency 
Manager](http://arnhem.luminis.eu/introduction-apache-felix-dependency-manager)
+* [Introduction to Dependency Manager, part 
II](http://arnhem.luminis.eu/introduction-apache-felix-dependencymanager-part-2)


Reply via email to