J2EE Blueprints

Java TM Pet Store Demo

 pet store administrator
   configuring the administrator
 
This release of the Java Pet Store includes a new Administration application, which allows the Pet Store Administrator to change the status of all pending orders. This separate application operates independently of the Java Pet Store application (although it shares and manipulates parts of the Pet Store's data model).


Creating the admin user

The admin application appears in the directory $JPS_HOME/src/petstoreadmin. The application requires a user id admin in the J2EE server. Follow these steps to create the admin user (with password admin, in the server's default realm):
  1. Stop the j2ee server if it is running:
    j2ee -stop
  2. Create the user with the command:
    $J2EE_HOME/bin/realmtool -add admin admin default
  3. Restart the J2EE server:
    j2ee


Deploying the Administration application

The Enterprise Archive ("ear" file) for the Administration application is distributed with the Java Pet Store in the file $JPS_HOME/petstoreadmin.ear. To deploy the Administration application, follow these steps:
  1. Configure and deploy the petstore application, as explained in the section appropriate for your operating system, in installation and configuration.
  2. Repeat steps 9 & 10 of the installation instructions in the previous step, but replace the file name petstore.ear with petstoreadmin.ear.
  3. Use the Pet Store application to order some pets.
  4. To access the administration module, use your browser to visit the URL http://localhost:8000/admin. You may need to replace localhost with the name of your J2EE server, and 8000 with the J2EE server port address.
  5. You should see the "Admin Welcome Page". Click on the Enter.. link to log in.
  6. Enter admin as the user name, and admin as the password.
  7. A successful login will take you to the administration screen. In this screen, you can choose either to update orders or to log out.
  8. Clicking on the update order button will display all pending Pet Store orders. Change order status to (A)pproved or (D)enied by clicking the appropriate boxes. The Update button updates the status of all marked orders.


Rebuilding the Administration application

To rebuild the Administration application:
  1. change directory to $JPS_HOME/src/petstoreadmin/src
  2. sh build.sh (or build if you are using Windows)
  3. Deploy the new enterprise archive file cd $JPS_HOME/src/petstoreadmin/build/petstoreadmin.ear created in the build step