Use a new-style singelton (aka interface-based singleton) instead!
(Look up those terms in the DevGuide if you are not familiar with them.)
foo/XSentence.idl:
---8<---
module foo {
interface XSentence {
void reverse();
void getInput;
};
};
---8<---
foo/theSentence.idl:
---8<---
module foo {
interface XSentence;
singleton theSentence: XSentence;
};
---8<---
Java:
---8<---
foo.XSentence sentence = foo.theSentence.get(xContext);
---8<---
-Stephan
Tabish F. Mufti wrote:
I have Sentence.idl:
module com { module sun { module star { module ex { module comp {
service Sentence
{
interface com::sun::star::ex::comp::XSentence;
};
singleton theSentence
{
service com::sun::star::ex::comp::Sentence;
};
}; }; }; }; };
and XSentence.idl:
module com { module sun { module star { module ex { module comp {
interface XSentence: com::sun::star::uno::XInterface
{
void reverse();
void getInput();
};
}; }; }; }; };
I have a class Sentence.java which provides the service Sentence:
static final String SERVICENAME = "com.sun.star.ex.comp.Sentence";
I want to know how do I create a Singleton service given the above
context ?
The code which I'm using to create the service Sentence is the following:
XMultiComponentFactory factory = xContext.getServiceManager();
Object transObj = factory.createInstanceWithContext("
com.sun.star.ex.comp.Sentence", xContext);
XSentence sentence = (XSentence)UnoRuntime.queryInterface(XSentence.class,
transObj);
But this does not returns me Sentence as Singleton class infact everytime a
new instance of the class Sentence is returned.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]