0

I have a problem relating to iPOJO, as example:

  1. I define and deploy a component A which provide a “HelloService” service (interface). And an instance of component A named “instance_A”

  2. I define also a component B requiring “HelloService” service in A. the implementation of B declared a dependency:

    HelloService hello;

And in metadata.xml, I declare:

<ipojo>
     <component classname="B_class" name="B" immediate="true">
     <requires field=" hello" from="instance_A">
     </requires>
     </component>
     <instance component="B" name="call"/>
</ipojo>
  1. Now, I want implement a component C to dynamically control change (from="instance_A") in metadata to another (ex. from="instance_D")

How I can do it (component C) to change this "from"?

Thanks in advance

leppie
  • 115,091
  • 17
  • 196
  • 297
HNT
  • 147
  • 1
  • 10

1 Answers1

0

See my answer on update dynamically targeting provider in iPOJO to dynamically change dependency filter.

However in your case it seems that interceptors would give you more control: http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/ipojo-advanced-topics/service-binding-interceptors.html

  1. Create a ranking interceptor handling your dependency
  2. When a new provider arrives, sort the set of providers in the order you want. This adapts the service binding.
Community
  • 1
  • 1
Clement
  • 2,817
  • 1
  • 12
  • 11