Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Gemini » List of Services: Wait for all Services?
List of Services: Wait for all Services? [message #1004427] Wed, 23 January 2013 08:07 Go to next message
Tobias P. is currently offline Tobias P.Friend
Messages: 43
Registered: April 2012
Member
I am Using Eclipse Virgo/Gemini Blueprint and have an Interface with multiple implementations:

Implementation 1:
    <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">

	<bean id="MyID1"
		class="ImplementationCLass1">
	</bean>

	<service ref="MyID1"
		interface="MyInterface" />

</blueprint>


Implementation 2:

<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">

	<bean id="MYID2"
		class="ImplementationClass2">
	</bean>

	<service ref="MYID2"
		interface="MyInterface" />

</blueprint>

Implementation 3:

<
blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">

	<bean id="MyID3"
		class="ImplementationClass3">
	</bean>

	<service ref="MyID3"
		interface="MyInterface" />

</blueprint>


And a Client:

<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">

	<reference-list id="MyImplementations"
		interface="MyInterface" />

	<bean id="clientID" class="ClientClass"
		init-method="startUp">

		<property name="services" ref="MyImplementations"></property>

	</bean>

</blueprint>



The startUp method is a simple method which iterates over the whole list and prints out a simple string (for testing purpose)

The Problem is if i install the client Bundle only two out of tree Services are in my List.
If i stop and start the Bundle again, all three Services are in my List.

Any ideas/sugesstions why?

Is it possible to tell Blueprint that the list MUST contain all Services matching MyInterface?

If you need additional information feel free to ask
Re: List of Services: Wait for all Services? [message #1004507 is a reply to message #1004427] Wed, 23 January 2013 11:14 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
It sounds like the service providing bundles have not finished publishing their services and the client bundle is racing with the services appearing. Have you definitely allowed the service providing bundles to publish their services - which you could check using the Virgo admin console - before starting the client bundle?

There is no way to tell blueprint that the list must contain all services because it should do anyway.
Re: List of Services: Wait for all Services? [message #1004545 is a reply to message #1004427] Wed, 23 January 2013 12:35 Go to previous messageGo to next message
Tobias P. is currently offline Tobias P.Friend
Messages: 43
Registered: April 2012
Member
Maybe i must add, i am publishing all my Bundles as a single PAR File
Re: List of Services: Wait for all Services? [message #1004555 is a reply to message #1004545] Wed, 23 January 2013 12:56 Go to previous messageGo to next message
Sebastian Lorenz is currently offline Sebastian LorenzFriend
Messages: 42
Registered: November 2010
Member
I had the same problem with reference lists in my application and use start levels to make sure that the bundles that provide the service are started before the consuming bundle. But I think start levels are not an option in PAR files?
Re: List of Services: Wait for all Services? [message #1004585 is a reply to message #1004555] Wed, 23 January 2013 13:58 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
That's your problem - the Blueprint start processing for the various bundles are in a race. Working as designed I'm afraid.
Re: List of Services: Wait for all Services? [message #1004599 is a reply to message #1004555] Wed, 23 January 2013 14:20 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
Sebastian Lorenz wrote on Wed, 23 January 2013 12:56
I had the same problem with reference lists in my application and use start levels to make sure that the bundles that provide the service are started before the consuming bundle. But I think start levels are not an option in PAR files?


Correct.
Re: List of Services: Wait for all Services? [message #1004653 is a reply to message #1004599] Wed, 23 January 2013 15:46 Go to previous message
Tobias P. is currently offline Tobias P.Friend
Messages: 43
Registered: April 2012
Member
Ok guys, thank you so far. The only reason i am using a par file, is because i dont know how to properly deploy the bundles. I am using the maven-bundle-plugin first to create my Bundles, then the maven-par-plugin to obtain a single par file with all Bundles and deploy it manually via the web deployer...

Is there a simple way to deploy my Bundles using maven?

Previous Topic:Gemini JPA / DBAccess - best way to configure JDBC properties?
Next Topic:Gemini DBAccess Maven Artifacts
Goto Forum:
  


Current Time: Sun Dec 21 02:07:40 GMT 2014

Powered by FUDForum. Page generated in 0.11705 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software