[ 
https://issues.apache.org/jira/browse/FELIX-5177?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15141281#comment-15141281
 ] 

Pierre De Rop commented on FELIX-5177:
--------------------------------------

ok,  just committed a fix for the support of config proxy used with 
@FactoryConfigurationAdapterService.

if you use a factoryPidClass attribute that is used to guess the pid from the 
provided class, the class will then also be used as a config proxy type.
Also update the "dictionary.annot" sample code, and update the following test 
cases:

org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/MethodSignatures.java
org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/tests/MethodSignaturesTest.java

Example usage:

Here is a configuration interface, annotated with bnd metatypes:

{code}
@OCD(name="Spell Checker Dictionary", 
     factory = true, 
     description = "Declare here some Dictionary instances, allowing to 
instantiates some DictionaryService services for a given dictionary language")
public interface DictionaryConfiguration {
    @AD(description = "Describes the dictionary language", deflt = "en")
    String lang();

    @AD(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")
    List<String> words();
}
{code}

then the factory adapter:

{code}
@FactoryConfigurationAdapterService(factoryPidClass = 
DictionaryConfiguration.class)
public class DictionaryImpl implements DictionaryService {
    protected void updated(DictionaryConfiguration cnf) {
        m_lang = cnf.lang();
        m_words.clear();
        for (String word : cnf.words()) {
            m_words.add(word);
        }
    }
}
{code}


> Support injecting configuration proxies
> ---------------------------------------
>
>                 Key: FELIX-5177
>                 URL: https://issues.apache.org/jira/browse/FELIX-5177
>             Project: Felix
>          Issue Type: Improvement
>          Components: Dependency Manager, Dependency Manager Annotations, 
> Dependency Manager Lambda, Dependency Manager Runtime
>            Reporter: J.W. Janssen
>            Assignee: Pierre De Rop
>             Fix For:  org.apache.felix.dependencymanager-r7
>
>         Attachments: FELIX-5177.patch
>
>
> DM supports mandatory configurations, but does not allow anything other than 
> a dictionary to be passed to the callback. In other DI frameworks (like DS) 
> it is possible to use type-safe configurations and let those be injected 
> instead of plain dictionaries.
> It would be great if DM also would support this, as it would remove lots of 
> configuration boiler plate code from our projects.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to