Return-Path: X-Original-To: apmail-felix-dev-archive@www.apache.org Delivered-To: apmail-felix-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 53EE410725 for ; Thu, 19 Mar 2015 06:01:41 +0000 (UTC) Received: (qmail 26290 invoked by uid 500); 19 Mar 2015 06:01:40 -0000 Delivered-To: apmail-felix-dev-archive@felix.apache.org Received: (qmail 26233 invoked by uid 500); 19 Mar 2015 06:01:40 -0000 Mailing-List: contact dev-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list dev@felix.apache.org Received: (qmail 26117 invoked by uid 99); 19 Mar 2015 06:01:40 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Mar 2015 06:01:40 +0000 Date: Thu, 19 Mar 2015 06:01:40 +0000 (UTC) From: "Pierre De Rop (JIRA)" To: dev@felix.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Closed] (FELIX-4805) Deprecate DM annotation metatypes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/FELIX-4805?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Pierre De Rop closed FELIX-4805. -------------------------------- > Deprecate DM annotation metatypes > --------------------------------- > > Key: FELIX-4805 > URL: https://issues.apache.org/jira/browse/FELIX-4805 > Project: Felix > Issue Type: Improvement > Components: Dependency Manager Annotations, Dependency Manager Runtime > Affects Versions: dependencymanager.annotations-3.2.0, dependencymanager.runtime-3.2.0 > Reporter: Pierre De Rop > Assignee: Pierre De Rop > Priority: Trivial > Fix For: org.apache.felix.dependencymanager-r1 > > > In the Dependency Manager annotations, the DM metatype annotations should be deprecated and the nice bndtools metatype annotations should be used instead. > For example, the following Dictionary service is defining configuration metatypes using bndtools metatype annotations (see http://www.aqute.biz/Bnd/MetaType): > {code} > package sample; > import aQute.bnd.annotation.metatype.Meta.AD; > import aQute.bnd.annotation.metatype.Meta.OCD; > @OCD(factory = true, description = "Declare here some Dictionary instances.") > public interface DictionaryConfiguration { > @AD(description = "Describes the dictionary language.", deflt = "en") > String lang(); > @AD(description = "Declare here the list of dictionary words.") > List words(); > } > {code} > and Here is the definition of the Dictionary service which is using the "Configurable" bnd helper that can be used to instantiate the DictionaryConfiguration: > {code} > package sample; > import aQute.bnd.annotation.metatype.Configurable; > @FactoryConfigurationAdapterService(factoryPidClass = DictionaryConfiguration.class) > public class DictionaryImpl implements DictionaryService { > private CopyOnWriteArrayList m_words = > new CopyOnWriteArrayList(); > private String m_lang; > protected void updated(Dictionary 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_lang = cnf.lang(); > m_words.clear(); > for (String word : cnf.words()) { > m_words.add(word); > } > } > } > public boolean checkWord(String word) { > return m_words.contains(word); > } > } > {code} > In addition, a "pidClass" attribute should be added in the ConfigurationDependency annotation, in order to specify the pid using a class name, instead of a String. The same applies for the FactoryConfigurationAdapterService annotation (see the example above). -- This message was sent by Atlassian JIRA (v6.3.4#6332)