-
1. Re: osgi:list updtate dynamically
ccustine Jul 30, 2009 1:10 AM (in response to vector_jdev.work)In your example, any OSGi service that is registered/unregistered with the interface com.sample.services.api.ResponseHandler should automatically be added/removed from the List (no matter if you register it with OSGi API or with Spring). This concept is fairly well documented here.
If you need to perform special processing when the service is registered/unregistered then you can add an <osgi:listener> declaration as shown here.
For the Spring OSGi bits, things behave a little differently than the traditional IOC part of Spring. If you read the Spring DM docs closely you'll see that this service functionality is dynamic and occurs at runtime so it is very powerful and quite easy to use.
If you have any other questions or if I misunderstood your problem let me know.
Thanks,
Chris
Edited by: ccustine on Jul 29, 2009 11:10 PM
-
2. Re: osgi:list updtate dynamically
vector_jdev.work Jul 31, 2009 7:27 AM (in response to ccustine)I have
<osgi:list id="handlers" interface="com.sample.services.api.Handler"/>
<bean id="ussRouter" class="com.samples.services.router.UssRouter">
<property name="services" ref="handlers"/>
</bean>
public void setServices(List<Handler> services) {
System.out.println("Setting serviceList = " + services);
this.services = services;
}
When I start my handlers, then UssRouter I have 'Setting serviceList = " + services' message. It means list is updated ok.
When I start my UssRouter, then handlers I don't have any messages. It mean that list is not updated and property not set automatically.
How can I do that then?