This demo illustrates how to import data from the Java PetStore
demo application in XML format over HTTP, displaying it as part
of a StarOffice spreadsheet. Follow these steps to
import the data:
- Install the Java Pet Store application. In subsequent
instructions, the directory where the Pet Store is installed
is referred to as
JPS_HOME .
- Install StarOffice version 5.2. This can be downloaded from
http://www.sun.com/products/staroffice. In subsequent
instructions, the directory where staroffice is installed is
referred to as
SOFFICE_HOME .
- Ensure that the version of your JDK is at least
1.1.8. Ensure that the JRE version installed is also at
least 1.1.8.
- Install the StarOffice SDK 1.0. This can be downloaded from
http://soldc.sun.com/staroffice/#kit. In subsequent
instructions, the directory where staroffice SDK is
installed is referred to as
SOFFICE_SDK_HOME .
- Ensure that the JAXP optional API package is installed. This
can be downloaded from http://java.sun.com/xml . In subsequent
instructions, the directory where JAXP is installed is
referred to as
JAXP_HOME .
- Replace the jar files in default staroffice installation
with those in the staroffice SDK. To do this copy the file:
SOFFICE_SDK_HOME/addon/java/samples/sandbox.jar to
SOFFICE_HOME/program/classes/sandbox.jar
- Add the following line to the
[Common] section of file
SOFFICE_HOME/user/sofficerc
(or, for Windows users, SOFFICE_HOME\user\soffice.ini )
Connection=socket,host=localhost,port=8100;iiop;
- Ensure that the files
SOFFICE_HOME/program/classes/sandbox.jar
SOFFICE_HOME/program/classes/jurt.jar
SOFFICE_HOME/program/classes/unoil.jar
are part of the SystemClassPath in file
SOFFICE_HOME/user/config/javarc (or, for
Windows users,
SOFFICE_HOME\user\config\java.ini )
- Start the StarOffice application with command:
SOFFICE_HOME/soffice
-
Select Tools->Options->Browser->Other. Add the
directory
JPS_HOME to the
ClassPath text entry.
- Ensure that the following files are part of the
CLASSPATH environment variable:
SOFFICE_HOME/program/classes/sandbox.jar
SOFFICE_HOME/program/classes/jurt.jar
SOFFICE_HOME/program/classes/unoil.jar
JAXP_HOME/jaxp.jar
JAXP_HOME/parser.jar
Current Working Directory
- Change directory to
JPS_HOME/src/petstoreadmin/staroffice . Compile
PendingOrders.java using the command:
javac PendingOrders.java
- Start the Java Pet Store application and buy some pets and
commit the orders.
- Change directory to
JPS_HOME/staroffice .
- Execute the command:
java PendingOrders
Note: This program assumes the
Java Pet Store is running on localhost
at port 8000 .
- The program will get the pending orders from the Pet Store
database and display the details in a StarOffice spreadsheet
document.
|