Hi Frank, I'm a bit confused. Actually our driver extension is written in Java, but I guess getting the XComponentContext should be the same as if it were written in C and most of the code for providing the entry point to it was generated by NetBeans, so I didn't have to care much about it. I can see a method __getComponentFactory, which returns a XSingleComponentFactory, but all it takes is a string sImplementationName, no XMultiServiceFactory parameter. There seem to be two ways of providing the entry point for a component, the one implementing __getComponentFactory and another one implementing __getServiceFactory, which would take a XMultiServiceFactory and a XRegistryKey parameter in addition to sImplementationName. I must admit that I didn't really understand the difference between the two concepts, only that the __getComponentFactory way is the newer one and should be used for some reason. Do we need to change things to __getServiceFactory anyway or is there another solution?
Best, Micha -----Ursprüngliche Nachricht----- Von: Frank Schoenheit, Sun Microsystems Germany [mailto:frank.schoenh...@sun.com] Gesendet: Mo 28.09.2009 09:17 An: dev@dba.openoffice.org Betreff: Re: AW: [dba-dev] internationalization of exception messages in a database driver extension Hi Michaelm > Thanks for your answer. The StringResourceWithLocation service is > exactly what I was looking for. I also found some helpful example > code under http://markmail.org/message/sv2z4cvsgmgyctht, but it does > not work yet because I do need a Component Context which I do not > have (the drivers main class has a constructor with a parameter for > the Component Context, but the constructor is called with null for > this parameter) and I could not bootstrap for some reason bootstrapping is no good idea, anyway, you'd have two of them in the same process then, if it would work at all. The driver's ctor is not the top-level entry point into your component, but a C function "component_getFactory" is. This creates a XSingleServiceFactory which is invoked when an instance of your driver is requested. Depending on how you implemented this function (basically: which helpers you used), this invocation is delegated to somewhere else. Usually, this is either a static method at your driver, or some global function. (naming conventions suggest something like Driver::Create or Driver_CreateInsrance.) Both of those usually take a XMultiServiceFactory parameter. If you're inside an OOo build environment, you have access to comphelper::ComponentContext, which you can create using the MSF. Otherwise, query the MSF for the XPropertySet interface, and retrieve the "DefaultContext" property. This way, you get an XComponentContext instance which you should use all across your driver implementation. Ciao Frank -- - Frank Schönheit, Software Engineer frank.schoenh...@sun.com - - Sun Microsystems http://www.sun.com/staroffice - - OpenOffice.org Base http://dba.openoffice.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@dba.openoffice.org For additional commands, e-mail: dev-h...@dba.openoffice.org
--------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@dba.openoffice.org For additional commands, e-mail: dev-h...@dba.openoffice.org