Yup, ordering is a pain when it is not based on service dependencies. The 
actual problem you point out was noticed during the design phase but it was 
deemed very important  by some EEG member that the WAR file acted as a WAR 
according to the Java EE Servlet Spec, which prohibited that it played nice in 
the OSGi world. This impedance mismatch between Blueprint and the Web Extender 
was therefore accepted.

After working with these kind of problems for a long time (even long before 
OSGi) I've come to the conclusion that only services work well in all cases. 
You therefore have to translate the problem to a service problem. iPOJO, DS, 
Blueprint are all experts in handling service dependencies and ordering is a 
dependency problem. In this particular case the problem is that the WAR 
extender is oblivious of any dependencies and assumes the world is ready when 
it is ready, ok and the extendee. In this case, the WAR extender will create a 
servlet. The simplest solution is to create a ServletDepender servlet. This 
dummy servlet must be parameterized with a filter. Once it starts, it gets the 
service if it exists, or waits until it is registered.

In your Blueprint code you just register the servlet you want as a service.

This model uses services to handle dependencies and thus ordering. Almost all 
of the OSGi machinery is geared to make service dependencies work reliable and 
actually quite nicely. 

Kind regards,

        Peter Kriens




On 30 apr 2010, at 17:49, Richard S. Hall wrote:

> 
> 
> On 4/30/10 2:30, ext2 wrote:
>> Hi:
>>      In osgi, extender is a very useful pattern. But sometimes if we use
>> several extenders to extending the same bundle's function.  They may cause
>> un-desirable underlying sequential coupling;
>> 
>>      For example: WEB Container in OSGI  use a extender to recognize  a
>> War Bundle , and also Spring-DM use a extender to recognize a Spring bundle.
>> So if I write a bundle which is a war-bundle and also a spring-dm bundle.
>> The servlet (in bundle) use a osgi-service  injected by spring-dm; for this
>> example , I wish  the spring-extender works before the Web-Extender, so the
>> servlet created by Web-Extender can safely call the osgi-service injected by
>> the spring-extender;
>>      But in osgi framework, how could I control the extenders work order
>> while they extending the sample bundle?
>> 
>> Thanks any suggestion;
>>      
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>> 
>>   


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to