/*
 * 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 from a Component's init method.

Let's recap the lifecycle of a DM component:

- the configuration (if any) is first injected (updated callback).
- then optional dependencies on class fields are injected.
- then all required dependencies are injected.
- then the init(Component c) method is invoked; And from there you are then able to add dynamic dependencies using any previously
injected services (either configuration injected in update method, or other injected services declared from the Activator).
- then the start callback is invoked when all required dependencies declared from the init method are injected.

In this sample, the "DynamicDependency" Component defines in its "init" method a dynamic dependency on a Storage service. 
But it first loads the "storage type" and "storage required" dependency informations 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.api.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:54:16 WARNING - Bundle: org.apache.felix.dependencymanager.samples.dynamicdep.api - MapDBStorage.store(gabu,zo)
2016.02.08 21:54:16 WARNING - Bundle: org.apache.felix.dependencymanager.samples.dynamicdep.api - start
2016.02.08 21:54:16 WARNING - Bundle: org.apache.felix.dependencymanager.samples.dynamicdep.api - init: storage type=mapdb, storageRequired=true
