felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pde...@apache.org
Subject svn commit: r1728611 - in /felix/trunk/dependencymanager/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/dictionary/api: Activator.java DictionaryAspect.java
Date Fri, 05 Feb 2016 06:59:18 GMT
Author: pderop
Date: Fri Feb  5 06:59:18 2016
New Revision: 1728611

URL: http://svn.apache.org/viewvc?rev=1728611&view=rev
Log:
FELIX-5177: use type-safe configuration dependency.

Modified:
    felix/trunk/dependencymanager/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/dictionary/api/Activator.java
    felix/trunk/dependencymanager/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/dictionary/api/DictionaryAspect.java

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/dictionary/api/Activator.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/dictionary/api/Activator.java?rev=1728611&r1=1728610&r2=1728611&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/dictionary/api/Activator.java
(original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/dictionary/api/Activator.java
Fri Feb  5 06:59:18 2016
@@ -41,7 +41,7 @@ public class Activator extends Dependenc
         // Create the Dictionary Aspect
         dm.add(createAspectService(DictionaryService.class, "(lang=en)", 10)
             .setImplementation(DictionaryAspect.class)
-            .add(createConfigurationDependency().setPid(DictionaryAspectConfiguration.class.getName()))
+            .add(createConfigurationDependency().setPid(DictionaryAspectConfiguration.class.getName()).setCallback("updated",
DictionaryConfiguration.class))
             .add(createServiceDependency().setService(LogService.class))); // NullObject
         
         // Create the SpellChecker component

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/dictionary/api/DictionaryAspect.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/dictionary/api/DictionaryAspect.java?rev=1728611&r1=1728610&r2=1728611&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/dictionary/api/DictionaryAspect.java
(original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/dictionary/api/DictionaryAspect.java
Fri Feb  5 06:59:18 2016
@@ -11,13 +11,10 @@
  */
 package org.apache.felix.dependencymanager.samples.dictionary.api;
 
-import java.util.Dictionary;
 import java.util.concurrent.CopyOnWriteArrayList;
 
 import org.osgi.service.log.LogService;
 
-import aQute.bnd.annotation.metatype.Configurable;
-
 /**
  * This aspect applies to the English DictionaryService, and allows to decorate it with some
  * custom English words, which are configurable from WebConsole.
@@ -46,12 +43,10 @@ public class DictionaryAspect implements
      * Defines a configuration dependency for retrieving our english custom words (by default,
      * our PID is our full class name).
      */
-    protected void updated(Dictionary<String, ?> config) {
+    protected void updated(DictionaryConfiguration config) {
         if (config != null) {
-            // We use the bnd "Configurable" helper in order to get an implementation for
our DictionaryConfiguration interface.
-            DictionaryConfiguration cnf = Configurable.createConfigurable(DictionaryConfiguration.class,
config);
             m_words.clear();
-            for (String word : cnf.words()) {
+            for (String word : config.words()) {
                 m_words.add(word);
             }
         }



Mime
View raw message