On 2016-08-29T11:51:03 +0200
Peter Kriens <peter.kri...@aqute.biz> wrote:

> There is no clear cut test to see what is a component. I use the following 
> heuristics:
> 
> a) Does it have state? For example, Configuration Admin. In those case you 
> want to share a single object between different bundles

No state in the factories at all. The trees themselves are short-lived
mutable structures. I think this is a no.

> b) Do I want to add some type to the system with a bundle. I.e. 
> implementations are in different bundles. When they are all in the same 
> bundle and you do not see a future where you would deliver different impls in 
> a bundle a service is not needed

Yes. I publish an API and provide a default implementation bundle. In
the future, depending on benchmarking, I can see these trees being
pushed off-heap. A bundle implementing an off-heap tree would
inevitably involve a different set of dependencies.

> c) Does it have an interesting life cycle? Services are wonderful things to 
> signal availability

Don't think so. The tree factory either exists or it doesn't.

> In your case, the simple approach without a service seems the best choice. 
> Just using ’new’ is imho the simplest of all solutions. You only want to go 
> to a factory model if the selection process is complicated or you want to 
> hide the implementations.

Right!

M

Attachment: pgp4giOpurwpp.pgp
Description: OpenPGP digital signature

_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to