Incubator > Beehive
 

Beehive Web Service Sample: Petstore Dashboard

The Petstore Dashboard Sample

Petstore has both a web site and a web service interface. The web site is designed for customer access; the web service is for employee access. Through the web service, employees update the prices and inventory seen on the customer web site. The Petstore Dashboard is a Swing client application for this web service. Updates made on the Dashboard are passed to the web service, and ultimately the updates appear on the Petstore web site.

Running the Dashboard Sample

Requirements for Running the Sample

To run the Sample, you need:

  • Beehive
  • Tomcat 5
  • J2SE 5
  • Ant 1.6.2
  • activation.jar (details below)
  • mailapi.jar (details below)

To Deploy Petstore

The Petstore Dashboard is a view on the Petstore web application. So the Petstore Dashboard assumes that the Petstore web application is live and running.

To ensure that the Petstore web app is live and running complete the instructions in the following topic: Beehive Sample: Petstore

When you have completed the instructions, leave the instance of Tomcat server (with Petstore deployed) running.

To Copy the Petstore Dashboard Application to a Project Folder

To keep your Beehive distribution directory pristine, you should copy the PetStoreDashboard folder to another location before proceeding. The following instructions assume that you have copied the folder PetStoreDashboard into the directory C:/beehive_projects, resulting in the following directory structure.

C:
  beehive_projects
    PetStoreDashboard

To Download Required JAR Files

Before you can build Petstore Dashboard you must download 1) activation.jar and 2) mailapi.jar.

1) Download activation.jar (http://java.sun.com/products/javabeans/glasgow/jaf.html)

Note that activation.jar is archived in the JAF 1.0.2 distribution ZIP file. Download the JAF 1.0.2 ZIP, extract activation.jar, and copy activation.jar into both

C:/beehive_projects/PetstoreDashboard/lib/ 

and

C:/beehive_projects/petstoreWeb/WEB-INF/lib

2) Dowload mailapi.jar (http://java.sun.com/products/javamail/downloads/index.html)

Note that mailapi.jar is archived in the JavaMail 1.3.2 distribution ZIP file. Download the JavaMail 1.3.2 ZIP, extract mailapi.jar, and copy mailapi.jar into both

C:/beehive_projects/PetstoreDashboard/lib/ 

and

C:/beehive_projects/petstoreWeb/WEB-INF/lib

To Recompile and Redeploy Petstore

In this step you will recompile and redeploy Petstore. The following instructions assume that you have Petstore up and running on an instance of Tomcat server. If Petstore is not up and running, complete the following instructions before proceeding: Beehive Sample: Petstore.

To recompile the Petstore web app, run the following Ant command.

ant 
  -f C:\beehive_projects\petstoreWeb\WEB-INF\src\build.xml
  build

Copy and Paste version:
ant -f C:\beehive_projects\petstoreWeb\WEB-INF\src\build.xml build

To redeploy the Petstore web app, click the following link. (We recommend opening the link in a new window. After deployment has completed, the browser window will display a status message. After the status message has been displayed, you may close the browser window.)

http://localhost:8080/manager/deploy?path=/petstoreWeb&war=file:C:/pageflow_projects/petstoreWeb&update=true

To Launch Dashboard

To launch the Dashboard, run the following Ant command.

Note: you do not need to run any particular Ant target in the build.xml file. The appropriate default target will run when you call the build.xml file shown below.

ant -f C:\beehive_projects\PetstoreDashboard\build.xml

The Swing application comes up in its own window. Click on the different categories and modify price and quantity. The changes show up on the Petstore site (when the browser is refreshed).

Note: If the petstoreWeb sample is deployed to Tomcat with a context.path different from "petstoreWeb", or if it is deployed to a different server than localhost:8080, then the file C:/beehive_projects/PetstoreDashboard/build.xml needs to be modified accordingly. The Dashboard client generator relies on these default values.