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.

Reply via email to