J2EE Blueprints

Java TM Pet Store Demo

 pet store administrator
   staroffice demo
 
 
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:
  1. Install the Java Pet Store application. In subsequent instructions, the directory where the Pet Store is installed is referred to as JPS_HOME.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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
  7. 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;

  8. 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)
  9. Start the StarOffice application with command:

    SOFFICE_HOME/soffice

  10. Select Tools->Options->Browser->Other. Add the directory JPS_HOME to the ClassPath text entry.
  11. 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
  12. Change directory to JPS_HOME/src/petstoreadmin/staroffice. Compile PendingOrders.java using the command:
    javac PendingOrders.java
  13. Start the Java Pet Store application and buy some pets and commit the orders.
  14. Change directory to JPS_HOME/staroffice.
  15. Execute the command:
    java PendingOrders

    Note: This program assumes the Java Pet Store is running on localhost at port 8000.

  16. The program will get the pending orders from the Pet Store database and display the details in a StarOffice spreadsheet document.