You are right, we created some utility classes for service registration, and I missed this part (it's been some since we wrote it). Anyway, I'm glad you solved it.
Daan > -----Original Message----- > From: Tobias Krais [mailto:[EMAIL PROTECTED] > Sent: Tuesday, July 15, 2008 12:00 > To: [email protected] > Subject: Re: [api-dev] [SOLVED] Loading Extension on startup of OpenOffice > and use it later > > Hi Daan, > > I solved the problem! Here is how I did it: > >> ================== > [...] > >> } else if (implName.equals(SpringLoaderImpl.class.getName())) { > >> xSingleServiceFactory = Factory.createComponentFactory( > >> SpringLoaderImpl.class, > >> new String[] {SpringLoaderImpl.__singeltonName} > >> ); > >> } > [...] > >> ======================== > > Here the failure resides in. I had to pass not only the singleton name > to the Factory.createComponentFactory method, but also the service name. > > I had to change my __writeRegistryServiceInfo like this: > -----%<----- > public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { > try { > XRegistryKey newKey = regKey.createKey( > SpringLoaderImpl.class.getName() + > "/UNO/SINGLETONS/" + > theSpringLoader.class.getName()); > newKey.setStringValue(SpringLoaderImpl.__singeltonName); > } catch (InvalidRegistryException e) { > return false; > } > > // NOTE: use the service Names!!! > boolean regSpring = FactoryHelper.writeRegistryServiceInfo( > SpringLoaderImpl.class.getName(), > SpringLoaderImpl.__serviceNames, regKey); > > boolean regJudas = FactoryHelper.writeRegistryServiceInfo( > JudasProtocolHandler.class.getName(), > JudasProtocolHandler.SERVICENAME, regKey); > return regJudas && regSpring; > } > -----%<----- > > And my __getComponentFactory like this: > -----%<----- > public static XSingleComponentFactory __getComponentFactory (String > implName) { > XSingleComponentFactory xSingleComponentFactory = null; > > if (implName.equals(JudasProtocolHandler.class.getName())) { > xSingleComponentFactory = > Factory.createComponentFactory( > JudasProtocolHandler.class, > new String[] > {JudasProtocolHandler.SERVICENAME} > ); > } > else if (implName.equals(SpringLoaderImpl.class.getName())) { > xSingleComponentFactory = > Factory.createComponentFactory( > SpringLoaderImpl.class, > SpringLoaderImpl.__serviceNames > ); > } > return xSingleComponentFactory; > } > -----%<----- > > While __serviceNames is defined as: > -----%<----- > public static final String[] __serviceNames = { > "de.twc.oocom.comp.SpringLoaderImpl", > "de.twc.oocom.comp.theSpringLoader"}; > -----%<----- > > Daan, your mails and answers were very helpful! Thanks a lot! > > Greetings, Tobias > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
