Remote communication demo |
Contents
Overview
Usage
Description
Overview
This demo shows how to establish an interprocess bridge to a OpenOffice.org and creates four new office documents. (see also the interprocess-bridge documentation ). The source code of the example can be found in udk/remotebridges/examples .
Usage
The demo consists of a UNO-component that supports the
com.sun.star.lang.XMain
interface. The component can be started
using the uno.exe tool, which can be found in the binary output tree (it is
not installed with OpenOffice.org).
- Install an OpenOffice.org
- Before program start, please open the
share/config/registry/instance/org/openoffice/Setup.xml
file. You need to modify the tagooSetupConnectionURL
. Here's an example:<ooSetupConnectionURL cfg:type="string" >socket,host=localhost,port=2002;urp;StarOffice.NamingService</ooSetupConnectionURL>
Alternatively you can start the office with the following command line :soffice "-accept=socket,host=localhost,port=2002;urp;StarOffice.NamingService"
You can find a list of command line parameters in the framework project documentation.
- After starting the OpenOffice.org, confirm that the port is listening with `netstat -a | fgrep 2002`.
- Install the binary output tree of the current build.
- Checkout (top-level) the api/odk module from openoffice.org.
- Build the api/odk/examples/cpp/officeclient directory (formerly api/odk/examples/officeclient).
- Make the api/odk/wntmsci3/bin (on unix api/odk/unxsols3/lib) your current directory.
- Copy from the binary output tree the file wntmsci3/bin/applicat.rdb to the current directory. (wntmsci3 is dependant on your operating system for LInux use unxlngi4.pro)
- Now execute the following :
Windows :
uno -l officeclientsample.dll -c com.sun.star.comp.odk.example.OfficeClientSample -r applicat.rdb -- uno:socket,host=localhost,port=2002;urp;StarOffice.NamingService
Unix :
uno -l libofficeclientsample.so -c com.sun.star.comp.odk.example.OfficeClientSample -r applicat.rdb -- 'uno:socket,host=localhost,port=2002;urp;StarOffice.NamingService'
The component now is instantiated by the uno.exe tool and connects to the office. Please press any key when asked to do so. You should get the following output on the shell:
OStorePageBIOS::verify(): close pending. Connecting .... Creating Socket. Family: 2 Type: 1 Protocol: 0 got the remote NamingService press any key to open a new writer document ... pasting some text into the writer document press any key to close the document press any key to open a new draw document ... press any key to close the document press any key to open a new schedule document ... press any key to close the document press any key to open a new calc document ... press any key to close the document |
Description
The demo is implemented as component to show the usage of uno-exe. The advantage (compared to writing your own executable, which is also possible) is, that you do not have to care about the UNO bootstrapping.
The component first takes care, that all necessary shared libraries are
registered (registerServices) method. Afterwards it uses the
com.sun.star.bridge.UnoUrlResolver
service to establish an
interprocess-bridge to the office.
Then it retrieves the remote servicemanager and further on the
com.sun.star.frame.Desktop
service (which is a oneinstance
service).
Now it queries for the XComponentLoader interface and opens the four empty documents on demand.
Author: Jörg Budischewski ($Date: 2004/11/17 11:44:59 $) |