Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [osgi-users] OSGi DS field-option question
  • From: Thomas Watson <tjwatson@xxxxxxxxxx>
  • Date: Fri, 10 Jun 2022 13:00:37 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=us.ibm.com; dmarc=pass action=none header.from=us.ibm.com; dkim=pass header.d=us.ibm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=LDsJofc3fGFELO/VEA+FNuShA31aKbEOlly8RHoyAOg=; b=bnRyu9SrQxX643aAn6SFewUm1cekCYDqsLDs6XZm5vV9ZxZIW50UqnPi0KVY4HrwkJjIcbH9bkhKSFi13UInK6UJMMn2iyDi2o+hNQLGGycnbXEQdUnZZ0egyVm2WLnAop1AD2OlOsBEzqE9dghufSoa1pKQkd+pcxUUjOnN2nyCyH2Gt7nf8z3oq5gD7ENNX1VKZ7Mnqw1UTGxi9acQZ5LaDqx8EpikZdaLx6ArwySTmllZkjGmQtk7Xg5CFiQyMqDwl0DRSSUKjQHKhFr1P3pKUkQTof5xz64BhMyqWRv7Cp13wHgNL4PaTTP4xgvpH1pd+T+IkPFnsqXZHHnuBg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UiKL1htBNnU2CK4lrxEgeLlaOrGUzKpPGn8q4pScauNyW83KZkpMebDl3f6gl1vOxVDZec0/X3UMHyxtdPG+dYqJr7sqHEyq7Av+JFBTH18sB4m7u28vrvWQ1kHputcfucxJtuqprQ76d8z74jQwbQfu/kXr4nWPC+GFO7FUNaai43UtPRc3jBmKfTbSz3mIG1AcYi7uLjlPmjMFQzU7yMXrP6IvTeK1jYhDvpYzVi4jbGIY9Iyz2DulfESQVHtrPdYvuioe11U9V9AX3kKqQbM/Pbradv/3LbxAQP5U8KvVOJIP7glTGo/zZXhZo/Kv25bYDgO36i7e6AwquhNS3Q==
  • Delivered-to: osgi-users@xxxxxxxxxxx
  • List-archive: <https://dev.eclipse.org/mailman/private/osgi-users/>
  • List-help: <mailto:osgi-users-request@eclipse.org?subject=help>
  • List-subscribe: <https://dev.eclipse.org/mailman/listinfo/osgi-users>, <mailto:osgi-users-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://dev.eclipse.org/mailman/options/osgi-users>, <mailto:osgi-users-request@eclipse.org?subject=unsubscribe>
  • Suggested_attachment_session_id: f04b7b93-4e8c-d907-eadb-0087944523f2
  • Thread-index: Adh8r+Bnr9k2HZg0R7+AtAr/cUXRdQAGZCGe
  • Thread-topic: OSGi DS field-option question

At first glance this appears to be a bug.  I suggest you open an issue against Felix SCR (assuming that is what you use).   Be sure to include an example to reproduce.  Before that, ensure that the cardinality is set to 0..n in the component XML that is generated.

Tom


From: osgi-users <osgi-users-bounces@xxxxxxxxxxx> on behalf of Fauth Dirk (ETAS/ENA) via osgi-users <osgi-users@xxxxxxxxxxx>
Sent: Friday, June 10, 2022 5:13 AM
To: This is a community mail list for OSGi technology. Any OSGi technical discussion or questions are acceptable here. <osgi-users@xxxxxxxxxxx>
Cc: Fauth Dirk (ETAS/ENA) <dirk.fauth@xxxxxxxxxxxx>
Subject: [EXTERNAL] [osgi-users] OSGi DS field-option question
 
Hi, I am trying to create a service that stores some other service references and exchange them based on a target property. @Component(service = StringModifierRegistry.class) public class StringModifierRegistry { ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍
ZjQcmQRYFpfptBannerStart
This Message Is From an External Sender
This message came from outside your organization.
 
ZjQcmQRYFpfptBannerEnd

Hi,

 

I am trying to create a service that stores some other service references and exchange them based on a target property.

 

@Component(service = StringModifierRegistry.class)

public class StringModifierRegistry {

 

      @Reference(target = "(!(service.intents=jaxrs))", policy = ReferencePolicy.DYNAMIC)

      final List<StringModifier> stringModifier = new CopyOnWriteArrayList<>();

     

      @Activate

      void activate() {

             System.out.println("registry activated");

      }

     

      @Deactivate

      void deactivate() {

             System.out.println("registry deactivated");

      }

     

      public List<StringModifier> getStringModifier() {

             return this.stringModifier;

      }

}

 

Since the policy is DYNAMIC and the list is final which leads to field-option="update" I would have expected that the list is updated and not replaced if I change the target filter via ConfigurationAdmin. But what I see is that the component gets deactivated and activated whenever I update the configuration.

Switching to event binding also causes deactivate and activate. Maybe it is then not related to the collection update, but I am not sure.

 

Is the deactivate and activate caused by the configuration update of the target target property or because the bound services change? I haven’t found a passage in the specification on that topic. But maybe I looked in the wrong sections.

 

Mit freundlichen Grüßen / Best regards

Dirk Fauth

ETAS Advance Engineering

T +49 711 3423-2174
Dirk.Fauth@xxxxxxxx

ETAS GmbH, ETAS/ENA
Borsigstraße 24, 70469 Stuttgart, Germany
www.etas.com

ETAS – Empowering Tomorrow’s Automotive Software


Managing Directors: Christoph Hartung, Günter Gromeier, Götz Nigge
Chairman of the Supervisory Board: Dr. Walter Schirm
Registered Office: Stuttgart, Registration Court: Amtsgericht Stuttgart, HRB: 19033


Back to the top