Hi Daan,
> If the two interfaces have the same methods, why create two separate
> interfaces at all. The RegistrationClass (JudasComponent in your case)
> does not need to have an UNO interface, so you can also leave the
> JudasComponent idl files out (but if you want to define some extra
> methods on it, you'll need the idl files of course).
Good hint. I deleted the JudasComponent.idl file and it still works. Thanks!
I now changed my XSpringLoader.idl file like this:
-----%<-----
#ifndef __de_twc_oocom_comp_xspringloader_idl__
#define __de_twc_oocom_comp_xspringloader_idl__
#include <com/sun/star/uno/XWeak.idl>
module de { module twc { module oocom { module comp {
published interface XSpringLoader : com::sun::star::uno::XWeak {
void initSpring();
};
}; }; }; };
#endif
-----%<-----
> I would recommend to name your idl files according to the name of the
> interface / service / singleton that is defined in it. So I would rename
> the ild file containing the singleton to twcSpringLoader.idl (OOo
> convention is to use 'the' for singletons, so it would become
> theSpringLoader).
I did this already. You gave me the hint in your first mail. Thanks!
Now I have three idl files:
- XJudasComponent.idl
- XSpringLoader.idl
- theSpringLoader.idl
> According to this document:
> http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/WritingU
> NO/Core_Interfaces_to_Implement it is recommended to implement the
> interface XTypeProvider, XServiceInfo and XWeak. Since XWeak extends the
> other interfaces (as well as XInterface) you can extend your interface
> from XWeak. There is also a helper class in Java called WeakBase that
> does implement all methods defined in those interfaces.
OK. I did this as you can see above.
> Creating an implementation in Java is nothing different from an
> implementation for an ordinary service:
I did this as you adviced me. Here my code:
-----%<-----
package de.twc.oocom.comp;
import com.sun.star.lib.uno.helper.WeakBase;
public class SpringLoaderImpl extends WeakBase implements XSpringLoader {
public static final String __singeltonName =
"de.twc.oocom.comp.theSpringLoader";
public static final String __serviceName =
"de.twc.oocom.comp.SpringLoaderImpl";
public void initSpring() {
// TODO init Spring
}
}
-----%<-----
>>>>> 4. Store the singleton by adding the following code to
>>>>> __writeRegistryServiceInfo in you component registration class:
Here the changes in my __writeRegistryServiceInfo:
-----%<-----
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;
}
boolean regJudas = FactoryHelper.writeRegistryServiceInfo(
JudasProtocolHandler.class.getName(),
JudasProtocolHandler.SERVICENAME, regKey);
return regJudas;
}
-----%<-----
>>>>> 5. __getComponentFactory can be updated as you would do for an
>>>>> ordinary service (no special handling for singletons required)
[...]
>> Is this correct?
> Yes, I think it is, but note that you need SpringLoaderImpl.class to
> refer the implementation that you created in Java, not to the singleton
After doing all these things, I still have the error "no service object
raising singleton /singletons/de.twc.oocom.comp.theSpringLoader" when
calling the singleton.
To sum up what I did:
- I have the three idl files in my component.
- I have the Java class SpringLoaderImpl as shown above.
- I completed the JudasComponent class with the code you adviced me.
I have no more ideas. Do you have any more idea?
Greetings, Tobias
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]