
	=============================
	| PetStore 1.3.1_02 Example |
	=============================


Directory structure:
====================
In this directory you can find:
./build.xml and ./build.properties files, 
./jonas_petstore_src directory:
	which contains the Pet Store example files specific to JOnAS,
	(i.e. essentially ant build files and XML deployment descriptor files specific to JOnAS).
	It also contains some Pet Store sources that was modified and 'modif.info' files
	to explain this modifications.
./src directory:
	which will contain the Pet Store example customized for running on the JOnAS server.
	It is automatically created from the two previous directories via a build command.

Downloading Pet Store:
======================
Download the original petstore application 1.3.1_02 from
	http://developer.java.sun.com/developer/releases/petstore/
Extract this file in a directory.

Configuring this example:
=========================
Script environment variables
----------------------------
- set JAVA_HOME to your java installation,(you must choose jdk1.4 and higher)
- set ANT_HOME to your ant install,
- set your JONAS_ROOT and JONAS_BASE variables.

PetStore
--------
1) Set the build properties to the right values in ./build.properties:
- 'petstore_ori_install',
- 'server.name' and 'j2ee.server.port' properties: if you want to start JOnAS on another
machine than localhost and another port than 9000,
- If you use Eclipse or if you want to build applications or components independently,
you can define 'j2ee.home' and 'jonas.base' properties to replace environment variables.

2) The SQL statement are provided for cloudscape or Oracle database.
Note that with mckoi 1.0.2 and Postgres, Oracle SQL statement run well, Oracle is then
the default configuration.

If another database is used:
- add the right SQL statement in the CatalogDAOSQL.xml file in src/apps/petstore/src/docroot
- modify the parameter "param/CatalogDAODataBase" in ejb-jar.xml of catalog component
to the new reference name (in CatalogDAOSQL.xml).
- rebuild petstore.

Configuration of JOnAS server
-----------------------------
1) As for the other JOnAS examples, you have to configure a datasource.
It's JNDI name must be 'jdbc_1'.

2) Activate the mail service in JOnAS configuration
(The mail service must be present in the jonas.services property value).

3) Create a property mail file like MailSession1.properties with these parameters :
	mail.factory.name	mailSession_1
	mail.factory.type	javax.mail.Session
	mail.from			petstore@petstore.com
	mail.host 			<your mail host>
	mail.transport.protocol		smtp	
and add it in the jonas mail factories (jonas.service.mail.factories property)	
			
4) Add these JMS queues to the jonas.service.jms.queues property value:
	OrderApprovalQueue,OrdersQueue,MailCompletedOrderQueue,
	SupPurchaseOrderQueue,MailOrderApprovalQueue,MailQueue  
		
5) Add this JMS topic to the jonas.service.jms.topics property value:
	InvoiceTopic
	
Building this example:
======================
1) Execute
	ant build_petstore_JOnAS (default task)
This ant task creates a ./src directory, containing the PetStore example sources,
merged with specific PetStore files for running on JOnAS.
This also create an EARFiles directory which contain 4 ears corresponding to the
PetStore applications:
- opc.ear,
- petstore.ear,
- petstoreadmin.ear and,
- supplier.ear.

2)
- If you have set JONAS_BASE you can do:
	ant deploy
All the ear files will be copied in JONAS_BASE/apps directory.

- If JONAS_BASE is not set, copy manually the ear files in $JONAS_ROOT/apps.

Running this example:
=====================
1) Run JOnAS server:
    $ jonas start
    $ jonas admin -a opc.ear
    $ jonas admin -a petstoreadmin.ear
    $ jonas admin -a petstore.ear
    $ jonas admin -a supplier.ear


2) You can connect to PetStore application with this urls (see PetStore documentation):
- Using the Storefront at
	http://localhost:9000/petstore
- Using the Admin Client at
	http://localhost:9000/admin
- Managing the Supplier at
	http://localhost:9000/supplier	

Compiling WebServices version:
==============================
1) Go to the ./src/webservices directory.

2) You can read the README

Note:
=====
- During the ear deployment phase you should have this warning :"trans-attribute missing for method public abstract void javax.ejb.EJBLocalHome.remove
  (java.lang.Object) throws javax.ejb.RemoveException,javax.ejb.EJBException in entity bean InventoryEJB (set to the default value Supports)".
   Indeed, some Petstore Entity Beans not declared a trans attribute for all methods.

