/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

This sample shows how to define a dynamic dependency using annotations.
Using annotation, you can still dynamically configure from your @Init method
some dependencies which has a "name" attribute. Such dependencies will then 
be injected after your @Init method, but before your @Start method (if the dependencies
are required), or after your @Start method (if the dependencies are optional).

When you declare a Component:

- the configuration (if any) is first injected (updated callback).
- then all required dependencies are injected, except "named" dependencies whose required flag and filter can be configured
dynamically from the init method.
- then the init method (annotated with @Init) is invoked; And from there you are then able to return a Map that will be used
to configure the required flag and the filter of all named dependencies.
- then the start callback (annotated with @Start) is invoked when all required dependencies are injected, including named 
dependencies that have been configured from the init method.

In this sample, the "DynamicDependency" Components configures in its "init" method the dependency having a "storage" name. 
the dependency "required" flag and filter string are loaded from a Configuration PID 
(see the "Dynamic Dependency Configuration" PID, from webconsole), which is defined using 
Bnd MetaType Annotations.


So, first, click on the "dynamicdep.annot.bndrun" descriptor, and run it.
Then go to webconsole (http://localhost:8080/system/console/configMgr), and configure the "Dynamic Dependency Configuration" PID. 
then just type "log warn" under the gogo shell:

log warn

Then you normally see something like:

2016.02.08 21:49:26 WARNING - Bundle: org.apache.felix.dependencymanager.samples.dynamicdep.annot - MapDBStorage.store(gabu,zo)
2016.02.08 21:49:26 WARNING - Bundle: org.apache.felix.dependencymanager.samples.dynamicdep.annot - start
2016.02.08 21:49:26 WARNING - Bundle: org.apache.felix.dependencymanager.samples.dynamicdep.annot - init: storage type=mapdb, storageRequired=true


