2 Replies Latest reply on Jul 31, 2009 7:27 AM by vector_jdev.work

    osgi:list updtate dynamically

    vector_jdev.work Newbie

      I posted a  question on SpringDM forum , but nobody answers it there, so I am trying to ask here.

      That is conceptual problem for us - we are trying to have plugins (developed by other programmers) placed in work without any other bundles restarting/redeploying. We use

      <osgi:list id="responseHandlers" interface="com.sample.services.api.ResponseHandler"/>

      to collect all available plugins.

      The problem is that we need to restart host bundle to update osgi:list references and the question is are there any ways to avoid it?

        • 1. Re: osgi:list updtate dynamically
          Chris Custine Newbie

          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 Newbie

            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?