|
|
|
My first URE Component in JavaHow to create a new URE based application ? The documentation is quite hard to find, but the main important thing is: create a UNO component implementing the com.sun.star.lang.XMain interface. This one will contain a method run() I'll explain how to create a "Hello URE World" application. The project will be organized in the following way:
UNOIDL file definitionThe file idl/org/unotest/Main.idl will describe a simple service org.unotest.Main exporting the XMain interface this gives the following code:
module org { module unotest {
service Main: com::sun::star::lang::XMain {
create ();
}
}; };
Note that this service is a new style one: defining constructors and
exporting a single interface.Java implementationNow just create a org.unotest.comp.MyMain Java class in the
source/org/unotest/comp/MyMain.java
file. This class will implement the following three methods:
public int run (String[] arguments) {
// Printing Hello URE World ;) and exit
System.out.println("Hello URE World ;)");
return 0;
}
__getServiceFactory(...) and __writeRegistryServiceInfo(...) are
used for the component registration. They implementation is fully described
in the
chapters 4.5.3 and 4.5.4 of the OpenOffice.org Developer Guide Generation of the componentThe component generation works like the OpenOffice.org components generation, however there are some tricky things to know:
Launching the applicationIn the unotest file, you just have to put a call to the uno tool contained in the URE:
$URE_HOME/bin/uno -c org.unotest.comp.MyMain \
-l file://`pwd`/program/unotest.uno.jar \
-ro program/services.rdb \
-ro program/types.rdb \
-ro $URE_HOME/share/misc/services.rdb \
-ro $URE_HOME/share/misc/types.rdb
Thus when launching the unotest file, you will launch the URE with you
org.unotest.comp.MyMain as the main class to load at the beginning. This
will print you the expected "Hello URE World ;)"The next step is to do the same with a C++ component... but I'm still working on it. Important announcement: Join the Nuxeo team and contribute to the Nuxeo project! We have open positions in France and the UK for open source Java EE developers and sales engineers, both junior and senior.
Posted by Cedric Bosdonnat @ 10/10/2005 01:57 PM.
-
Categories:
openoffice
-
0 comments
|
Nuxeo Bloggers: Log in!
Search
Search Nuxeo Blogs
Categories
Nuxeo Bloggers
Photos and Pictures
|
|
Nuxeo -
Indesko -
Nuxeo 5 Project
All content is copyrighted by their author. CPSSkins is Copyright © 2003-2006 by Jean-Marc Orliaguet. | CPS is Copyright © 2002-2006 by Nuxeo SAS. |