I use Spring remoting and OSGI.
<bean id="httpServer" class="org.springframework.remoting.support.SimpleHttpServerFactoryBean">
<property name="contexts">
<util:map>
<entry key="/remoting/Service1" value-ref="serviceBean1"/>
</util:map>
</property>
<property name="port" value="8080" />
</bean>
I declare an dynamic list as below :
<osgi:list id="serviceList" interface="com.xyz.IRemoteService" member-type="service-object">
Now these services can be registered dynamically. At one point of time serviceList will hold all the service references implementing com.xyz.IRemoteService. How can I set this service list to the contexts property?
Update 1 :
The com.xyz.IRemoteService has two methods one which returns the key i.e. the url and the other returns the SimpleHttpInvokerServiceExporter object.So I changed teh configurations to as
<bean id="httpServer" class="org.springframework.remoting.support.SimpleHttpServerFactoryBean">
<property name="contexts">
<util:map>
<entry key="/remoting/ArchiveEDSImpl" value-ref="archiveEDS" />
<entry key="#{serviceList[0].url}" value="#{serviceList[0].httpHandler}" />
<entry key="#{serviceList[1].url}" value="#{serviceList[1].httpHandler}" />
</util:map>
</property>
<property name="port" value="8081" />
</bean>
<osgi:list id="serviceList" interface="com.xyz.IRemoteServiceProvider" member-type="service-object">
</osgi:list>
This is great but works only if there are at least 2 elements in the serviceReferenceList when bean httpserver is initialized. How do I configure this dynamically based on the size in the list ??