Oliver Brinzing wrote:
Hi Juergen,

i think you don't necessarily need your own factory. Or better it
depends on what exactly do you want to achieve.

IMHO a singleton should be a singleton. I am not sure about, if all
developers will realize that one can create a second instance from
a singleton using CreateUnoService() from OO Basic...
i agree but i would see it more as an implementation detail. The name of the function already says it "CreateUnoService", you will create a new instance of a service ;-) You are probably right that many users probably don't get the difference and it is better to provide an own factory. But in general a singleton should be used with the singleton name and ideally via the "get" function or context.getValueByName("/singletons/XYZ")

The problem here is that the get function is not directly supported in Basic, it's a missing feature that we will provide for the next version (probably 3.3). I think at least for well defined singletons in IDL. With the upcoming OOo3.2 we will at least support service constructor methods in Basic.

For example a service com.example.XY in IDL can be created in Basic with com.example.XY.create(). The context parameter is implicitly used but can bet set as well. All other parameters are used as usual.

Juergen


I think i will create a complete example and will document it in detail
to make this clear.

this would be great :-)

Oliver



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

Reply via email to