Thomas Lange - Sun Germany - ham02 - Hamburg wrote:

> Maybe createOneInstanceFactory is all that you need.
> Unfortunately there was no really wotking create...Component function to
> do that. Because of that we used the older and actually deprecated
> createOneInstanceFactory, at least that one works just fine.

The reason why the there is no "createOneInstanceComponentFactory" is
simple: OneInstanceServices are kind of deprecated, as is the old way
using ServiceFactories.

UNO now uses the concept of ComponentFactories that provide their
objects with a ComponentContext. While the factory might be implemented
in a way that there is only one instance per ComponentContext, there is
no control about how many instances of this class will be created as
basically the number of contexts is not limited. Any UNO component can
bootstrap a ComponentContext and create UNO services with it.

If you want to make sure that a particular UNO services can be
instantiated only once, use a Singleton.

But for the time being, using the code Thomas presented here is fine.
Basically this way you are creating an instance with a "default
ComponentContext" that is the backwards compatibility mode of UNO. And
then again your service will be instantiated only once. OTOH it also
means that it can't be created in any other context than the default one.

Regard,
Mathias

-- 
Mathias Bauer (mba) - Project Lead OpenOffice.org Writer
OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS
Please don't reply to "nospamfor...@gmx.de".
I use it for the OOo lists and only rarely read other mails sent to it.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lingucomponent.openoffice.org
For additional commands, e-mail: dev-h...@lingucomponent.openoffice.org

Reply via email to