Hi Soniya,


although I do not know much about Spring's HttpInvoker, you could try the 
following.



You need to create the beans (platformService, applicactionAServices, and 
applicationBService) and the related SimpleHttpInvokerServiceExporter in the 
belonging bundle and expose the created SimpleHttpInvokerServiceExporter as

OSGi-services. Those Services should have a (service-)property containing the 
context path. This is the only way to 

avoid your dependency problem.

 
In your "platform bundle" you can then get references to all 
SimpleHttpInvokerServiceExporter-OSGi-Serives and put

them in a Map with the respective Serive-Property as the Key. This map is the 
Context-Configuration for your SimpleHttpServerFactoryBean.

 
I'm not sure if it is a good idea to use three Spring-Contextes in an 
OSGi-Enviroment. So you might do the configuration of your
beans programmatically.

 
I would prefer using blueprint in this case.

 
Best Regards, Andreas
 
-----Ursprüngliche Nachricht-----
Von:Soniya Chavan <[email protected]>
Gesendet:Fr 26.07.2013 08:18
Betreff:[osgi-dev] Need help to declare OGSi service using Spring HttpInvoker
Anlage:inline.txt
An:[email protected]; 
 
Hi All,

 

 
 

We are facing the below problem when declaring OSGi using Spring HttpInvoker. 
Really appreciate if I can get any help.

 

 
 

Our application uses OSGi and Spring httpInvoker for remote calls being made to 
the OSGi services.The bundles are grouped into 3 levels Platform, ApplicationA 
and ApplicationB. Both the Application level bundles depend on Platform bundles 
but are independent of each other. The requirement is to deploy these 
applications together as well as independently.

 

 
 

There are 3 services:

 

1.      Platform level service (Required for both Applications)

 

2.      Application A level service 

 

3.      Application B level service

 

 
 

A section of the xml file from Platform bundle is given below. We cannot add 
the references to the Application A or B service in the platform bundle since 
the platform level bundle should be independent of the Application bundles. 
There cannot be two xml files with the service declarations since both these 
applications need to be deployed together. Is there an alternative way to 
declare these services in the Application bundles?

 

 
 

<bean id="platformService" 
class="com.platform.service.impl.PlatformService"></bean>

 

<bean id="applicationAService" 
class="com.appA.service.impl.ApplicationAService"></bean>

 

<bean id="applicationBService" 
class="com.appB.service.impl.ApplicationBService"></bean>

 

 
 

<bean name="platformServiceExporter"    
class="org.springframework.remoting.httpinvoker.SimpleHttpInvokerServiceExporter"
 

 

<property name="service" ref="platformService"/>

 

      <property name="serviceInterface" 
value="com.platform.service.IPlatformService"/>

 

</bean>

 

 
 

<bean name="applicationAServiceExporter"    
class="org.springframework.remoting.httpinvoker.SimpleHttpInvokerServiceExporter"
 

 

<property name="service" ref="applicationAService"/>

 

      <property name="serviceInterface" 
value="com.appA.service.IApplicationAService"/>

 

</bean>

 

 
 

<bean name="applicationBServiceExporter"    
class="org.springframework.remoting.httpinvoker.SimpleHttpInvokerServiceExporter"
 

 

<property name="service" ref="applicationBService"/>

 

      <property name="serviceInterface" 
value="com.appB.service.IApplicationBService"/>

 

</bean>

 

 
 

 
 

<bean id="httpServer" 
class="org.springframework.remoting.support.SimpleHttpServerFactoryBean">

 

      <property name="contexts">

 

<util:map>

 

<entry key="/remoting/PlatformService" value-ref="platformServiceExporter"/>

 

<entry key="/remoting/ApplicationAService" 
value-ref="applicationAServiceExporter"/>

 

<entry key="/remoting/ApplicationBService" 
value-ref="applicationBServiceExporter"/>

 

            </util:map>

 

      </property>

 

<property name="port" value="8080" />

 

</bean>

 

 
 

Thanks

 

Soniya

 

 
 

DISCLAIMER ========== This e-mail may contain privileged and confidential 
information which is the property of Persistent Systems Ltd. It is intended 
only for the use of the individual or entity to which it is addressed. If you 
are not the intended recipient, you are not authorized to read, retain, copy, 
print, distribute or use this message. If you have received this communication 
in error, please notify the sender and delete all copies of this message. 
Persistent Systems Ltd. does not accept any liability for virus infected mails.

 
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to