You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Eric Blanchard <er...@alcatel-lucent.fr> on 2007/10/16 11:03:27 UTC

Hints request for Service interfaces deployment

Hello community,

I'm looking for some advises to organize the project
layout/split in order to be able to provide the best
environment for developing/deploying a set of N consumers
and P providers OSGi services (I will use Declarative
Services technique for that).

Each Service is represented by a Java Interface. I plan to
package each classes with associated documentation in a
separate jar to make the java interfaces available for
developers (service providers and services consumers).

Service providers and service consumers projects will depend
on the provided jar. They will build bundles that will have
the package of the service interface in their Import-Package:
directive.

At deployment, what is the best way to make the Service
interface available in the OSGi framework ?

- Should I package each interface class in a separate bundle
  and install them in the framework before consumers and providers
  are resolved ? The risk is to end up with a great number
  of bundles (may be not very efficient to have one class loader
  per service interface).

- Should I put each interface in a fragment ? If yes, should I
  attach this fragment to the System bundle ? (may need to extend
  the Export-Package list each time I want to add a new services).

- Should I let each service consumer bundle to embed a copy of
  the interface ?  (I possibly loose coherency).

- Any other solutions ?

For the moment I prefer the first solution, but I'm afraid that
the order and the number of bundles will be difficult to manage.

Thanks in advance for your help.

--
Eric




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Hints request for Service interfaces deployment

Posted by Eric Blanchard <er...@alcatel-lucent.fr>.
Marcel Offermans a écrit :
> On Oct 16, 2007, at 15:48 , Richard S. Hall wrote:
> 
>>> - Should I package each interface class in a separate bundle
>>>   and install them in the framework before consumers and providers
>>>   are resolved ? The risk is to end up with a great number
>>>   of bundles (may be not very efficient to have one class loader
>>>   per service interface).
>>
>> This would be okay.
> 
> Alternatively, depending on your application, you might also be able to
> bundle a set of related interfaces into a single bundle. From past
> experiences, I have seen many cases where a whole set of domain
> interfaces exist which are basically the contracts that everybody needs
> to respect.

Yes, It seems to me a good approach for all contracts that are ready
in the same time, but I also need to take care of services that can
appear latter in the project life. These would require a separate
packaging.

> 
>>> - Any other solutions ?
>>
>> I, personally, would have each service provider embed the service
>> interface package and then import/export it. If your service interface
>> packages are small, then this should not add much overhead.
> 
> I agree with Richard here, either you embed the service interfaces in
> the provider bundles, or you make them available separately (possibly
> grouping interfaces as suggested above). Also, you might find that
> during development, a different strategy might be convenient than when
> deploying the application (but in general, it's best to keep those the
> same).
> 
> Greetings, Marcel
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Hints request for Service interfaces deployment

Posted by Marcel Offermans <ma...@luminis.nl>.
On Oct 16, 2007, at 15:48 , Richard S. Hall wrote:

>> - Should I package each interface class in a separate bundle
>>   and install them in the framework before consumers and providers
>>   are resolved ? The risk is to end up with a great number
>>   of bundles (may be not very efficient to have one class loader
>>   per service interface).
>
> This would be okay.

Alternatively, depending on your application, you might also be able  
to bundle a set of related interfaces into a single bundle. From past  
experiences, I have seen many cases where a whole set of domain  
interfaces exist which are basically the contracts that everybody  
needs to respect.

>> - Any other solutions ?
>
> I, personally, would have each service provider embed the service  
> interface package and then import/export it. If your service  
> interface packages are small, then this should not add much overhead.

I agree with Richard here, either you embed the service interfaces in  
the provider bundles, or you make them available separately (possibly  
grouping interfaces as suggested above). Also, you might find that  
during development, a different strategy might be convenient than  
when deploying the application (but in general, it's best to keep  
those the same).

Greetings, Marcel


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Hints request for Service interfaces deployment

Posted by Eric Blanchard <er...@alcatel-lucent.fr>.
Richard S. Hall a écrit :
> Eric Blanchard wrote:
>> Hello community,
>>
>> I'm looking for some advises to organize the project
>> layout/split in order to be able to provide the best
>> environment for developing/deploying a set of N consumers
>> and P providers OSGi services (I will use Declarative
>> Services technique for that).
>>
>> Each Service is represented by a Java Interface. I plan to
>> package each classes with associated documentation in a
>> separate jar to make the java interfaces available for
>> developers (service providers and services consumers).
>>
>> Service providers and service consumers projects will depend
>> on the provided jar. They will build bundles that will have
>> the package of the service interface in their Import-Package:
>> directive.
>>
>> At deployment, what is the best way to make the Service
>> interface available in the OSGi framework ?
>>
>> - Should I package each interface class in a separate bundle
>>   and install them in the framework before consumers and providers
>>   are resolved ? The risk is to end up with a great number
>>   of bundles (may be not very efficient to have one class loader
>>   per service interface).
>>   
> 
> This would be okay.
> 
>> - Should I put each interface in a fragment ? If yes, should I
>>   attach this fragment to the System bundle ? (may need to extend
>>   the Export-Package list each time I want to add a new services).
>>   
> 
> I would not recommend this approach, since it is not really the intended
> use case of fragments.
> 

OK

>> - Should I let each service consumer bundle to embed a copy of
>>   the interface ?  (I possibly loose coherency).
>>   
> 
> Well, you wouldn't lose coherency, but usually consumers do not embed
> the interface, rather the service providers embed the interface and then
> they import AND export the service interface package so that they can
> either use their own copy or share with another bundle that is already
> providing the package.
> 
>> - Any other solutions ?
>>   
> 
> I, personally, would have each service provider embed the service
> interface package and then import/export it. If your service interface
> packages are small, then this should not add much overhead.

OK, but I also plan to have these services "optional".
Using Declarative Service will help me in the dynamic binding and
I can refer to service interface as Dynamic-Import: in service
consumer bundles to let them resolved, but I plan to use a Proxy
pattern in consumers to hide the dynamic aspect of the service, so
I need to have access to the service interface even if no service
provider is loaded in the framework.

> 
> -> richard

Thanks a lot for your help.
--
Eric

> 
>> For the moment I prefer the first solution, but I'm afraid that
>> the order and the number of bundles will be difficult to manage.
>>
>> Thanks in advance for your help.
>>
>> -- 
>> Eric
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>   
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Hints request for Service interfaces deployment

Posted by "Richard S. Hall" <he...@ungoverned.org>.
Eric Blanchard wrote:
> Hello community,
>
> I'm looking for some advises to organize the project
> layout/split in order to be able to provide the best
> environment for developing/deploying a set of N consumers
> and P providers OSGi services (I will use Declarative
> Services technique for that).
>
> Each Service is represented by a Java Interface. I plan to
> package each classes with associated documentation in a
> separate jar to make the java interfaces available for
> developers (service providers and services consumers).
>
> Service providers and service consumers projects will depend
> on the provided jar. They will build bundles that will have
> the package of the service interface in their Import-Package:
> directive.
>
> At deployment, what is the best way to make the Service
> interface available in the OSGi framework ?
>
> - Should I package each interface class in a separate bundle
>   and install them in the framework before consumers and providers
>   are resolved ? The risk is to end up with a great number
>   of bundles (may be not very efficient to have one class loader
>   per service interface).
>   

This would be okay.

> - Should I put each interface in a fragment ? If yes, should I
>   attach this fragment to the System bundle ? (may need to extend
>   the Export-Package list each time I want to add a new services).
>   

I would not recommend this approach, since it is not really the intended 
use case of fragments.

> - Should I let each service consumer bundle to embed a copy of
>   the interface ?  (I possibly loose coherency).
>   

Well, you wouldn't lose coherency, but usually consumers do not embed 
the interface, rather the service providers embed the interface and then 
they import AND export the service interface package so that they can 
either use their own copy or share with another bundle that is already 
providing the package.

> - Any other solutions ?
>   

I, personally, would have each service provider embed the service 
interface package and then import/export it. If your service interface 
packages are small, then this should not add much overhead.

-> richard

> For the moment I prefer the first solution, but I'm afraid that
> the order and the number of bundles will be difficult to manage.
>
> Thanks in advance for your help.
>
> --
> Eric
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Hints request for Service interfaces deployment

Posted by "Richard S. Hall" <he...@ungoverned.org>.
jerome moliere wrote:
> Hi eric,
> as far as I know, this is not the perfect place for your question...
> This list if felix centric and design questions should be sent to other
> places like the developers list....
>   

This is an okay place to send this question. This list is for people 
interested in using Felix and this question relates to using Felix.

-> richard

> I'm convinced that as always you must find the middle position between
> monolithic deployment and too many bundles...It's just a trade-off..
>
> my 2 pieces
> Cheers
> Jerome
>
> 2007/10/16, Eric Blanchard <er...@alcatel-lucent.fr>:
>   
>> Hello community,
>>
>> I'm looking for some advises to organize the project
>> layout/split in order to be able to provide the best
>> environment for developing/deploying a set of N consumers
>> and P providers OSGi services (I will use Declarative
>> Services technique for that).
>>
>> Each Service is represented by a Java Interface. I plan to
>> package each classes with associated documentation in a
>> separate jar to make the java interfaces available for
>> developers (service providers and services consumers).
>>
>> Service providers and service consumers projects will depend
>> on the provided jar. They will build bundles that will have
>> the package of the service interface in their Import-Package:
>> directive.
>>
>> At deployment, what is the best way to make the Service
>> interface available in the OSGi framework ?
>>
>> - Should I package each interface class in a separate bundle
>>   and install them in the framework before consumers and providers
>>   are resolved ? The risk is to end up with a great number
>>   of bundles (may be not very efficient to have one class loader
>>   per service interface).
>>
>> - Should I put each interface in a fragment ? If yes, should I
>>   attach this fragment to the System bundle ? (may need to extend
>>   the Export-Package list each time I want to add a new services).
>>
>> - Should I let each service consumer bundle to embed a copy of
>>   the interface ?  (I possibly loose coherency).
>>
>> - Any other solutions ?
>>
>> For the moment I prefer the first solution, but I'm afraid that
>> the order and the number of bundles will be difficult to manage.
>>
>> Thanks in advance for your help.
>>
>> --
>> Eric
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
>>     
>
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Hints request for Service interfaces deployment

Posted by jerome moliere <je...@gmail.com>.
Hi eric,
as far as I know, this is not the perfect place for your question...
This list if felix centric and design questions should be sent to other
places like the developers list....

I'm convinced that as always you must find the middle position between
monolithic deployment and too many bundles...It's just a trade-off..

my 2 pieces
Cheers
Jerome

2007/10/16, Eric Blanchard <er...@alcatel-lucent.fr>:
>
> Hello community,
>
> I'm looking for some advises to organize the project
> layout/split in order to be able to provide the best
> environment for developing/deploying a set of N consumers
> and P providers OSGi services (I will use Declarative
> Services technique for that).
>
> Each Service is represented by a Java Interface. I plan to
> package each classes with associated documentation in a
> separate jar to make the java interfaces available for
> developers (service providers and services consumers).
>
> Service providers and service consumers projects will depend
> on the provided jar. They will build bundles that will have
> the package of the service interface in their Import-Package:
> directive.
>
> At deployment, what is the best way to make the Service
> interface available in the OSGi framework ?
>
> - Should I package each interface class in a separate bundle
>   and install them in the framework before consumers and providers
>   are resolved ? The risk is to end up with a great number
>   of bundles (may be not very efficient to have one class loader
>   per service interface).
>
> - Should I put each interface in a fragment ? If yes, should I
>   attach this fragment to the System bundle ? (may need to extend
>   the Export-Package list each time I want to add a new services).
>
> - Should I let each service consumer bundle to embed a copy of
>   the interface ?  (I possibly loose coherency).
>
> - Any other solutions ?
>
> For the moment I prefer the first solution, but I'm afraid that
> the order and the number of bundles will be difficult to manage.
>
> Thanks in advance for your help.
>
> --
> Eric
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>


-- 
Jerome Moliere - Mentor/J
http://romjethoughts.blogspot.com/
auteur Eyrolles