John Sisson wrote:
Hello,
The IDL documentation states that you can define a 'singleton service';
I have a definition like this:
==
module com {  module nxps {  module nxadv {  module unotest { module
services {
  /** service */
  service JsTestOne {
    interface com::nxps::nxadv::unotest::interfaces::XJsTestOne;
    interface com::sun::star::beans::XPropertySet;
    [property] string   sDocumentId;
  };
  /** singleton, please */
  singleton SingletonJsTestOne {
    service JsTestOne;
  };
}; }; }; }; };
==

In addition to what Daniel already replied: With the OOo 2.0 "UNO ease of use" features (see <http://marketing.openoffice.org/ooocon2004/presentations/friday/shinyhappyuno.pdf> or <http://udk.openoffice.org/common/man/draft/multinherit.html>), you can rewrite the above IDL as


module foo {
  interface XJsTestOneService {
    interface XJsTestOne;
    [attribute] string DocumentId;
  };
  singleton theJsTestOne: XJsTestOneService;
};

and access the singleton in your Java code (after you have registered it, as Daniel describes) with

com.sun.star.uno.XComponentContext cc = ...;
foo.XJsTestOneService s = foo.theJsTestOne.create(cc);
s.setDocumentId("bar");
System.out.println(s.getDocumentId());

-Stephan

[...]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to