Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 1 | package org.apache.felix.dm.lambda.samples.hello; |
| 2 | |
| 3 | import java.io.IOException; |
| 4 | import java.util.Dictionary; |
| 5 | import java.util.Hashtable; |
| 6 | |
| 7 | import org.osgi.service.cm.Configuration; |
| 8 | import org.osgi.service.cm.ConfigurationAdmin; |
| 9 | |
| 10 | public class Configurator { |
Pierre De Rop | 643674c | 2016-02-01 10:05:32 +0000 | [diff] [blame] | 11 | ConfigurationAdmin m_cm; |
| 12 | |
| 13 | void bind(ConfigurationAdmin cm) { |
| 14 | m_cm = cm; |
| 15 | } |
Pierre De Rop | faca289 | 2016-01-31 23:27:05 +0000 | [diff] [blame] | 16 | |
| 17 | void start() throws IOException { |
| 18 | // Configure the ServiceConsumer component |
| 19 | Configuration c = m_cm.getConfiguration(ServiceConsumer.class.getName(), null); |
| 20 | Dictionary<String, Object> props = new Hashtable<>(); |
| 21 | props.put("foo", "bar"); |
| 22 | c.update(props); |
| 23 | } |
| 24 | } |