Remote communication demo |
Overview
Usage
Description
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 .
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).
share/config/registry/instance/org/openoffice/Setup.xml
file.
You need to modify the tag ooSetupConnectionURL
.
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.
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 |
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 $) |