 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 -
 - JASS: Java Advanced tranSaction Support
 -
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 -
 - This module was originally developed by 
 -
 -    LSD (Distributed Systems Lab, http://lsd.ls.fi.upm.es/lsd/lsd.htm)
 -    at Universidad Politecnica de Madrid (UPM) as an ObjectWeb Consortium
 -    (http://www.objectweb.org) project.
 -
 -    This project has been partially funded by the European Commission under
 -    the IST programme of V FP grant IST-2001-37126 and by the Spanish
 -    Ministry of Science & Technology (MCyT) grants TIC2002-10376-E and
 -    TIC2001-1586-C03-02
 -
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 -  The original code and portions created by LSD are 
 -  Copyright (c) 2004 LSD (UPM)  
 -  All rights reserved.
 -  
 - Redistribution and use in source and binary forms, with or without 
 - modification, are permitted provided that the following conditions are met:
 -
 - -Redistributions of source code must retain the above copyright notice, this
 - list of conditions and the following disclaimer. 
 -
 - -Redistributions in binary form must reproduce the above copyright notice, 
 - this list of conditions and the following disclaimer in the documentation 
 - and/or other materials provided with the distribution. 
 -
 - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
 - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
 - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
 - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
 - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
 - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
 - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
 - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
 - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
 - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
 - POSSIBILITY OF SUCH DAMAGE.
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 -
 -  Author: Francisco Perez Sorrosal (frperezs)
 -
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-----------------------------------
ADAPT Activity Service Installation
-----------------------------------

(1) Distribution Files:
-----------------------

- README.INSTALL (this file)
- activityservice.jar (interfaces and classes for the Activity Service)
- opennestedtx.jar (interfaces and classes for the Open Nested Transaction 
  model)
- jaas-as.sar (Activity Service implementation)
- jaas-ont.sar (Open Nested Transactions implementation)
- postgres-ds.xml (JBOSS datasource configuration for the example application)
- adapt-test.ear (J2EE example application)
- adapt-test-wsc.jar (client side of the web service example application)
- adapt-test-wss.jar (server side of the web service example application)
- deploy.wsdd (deployment descriptor for the web service example application)
- undeploy.wsdd (undeployment descriptor for the web service example 
  application)
- build.xml (ANT installation file for the AS and ONT libraries, AS and ONT 
  JBOSS implementations and for the J2EE example application)

 ------------------------------- oooOOOOOOooo --------------------------------

(2) Important Notes:
--------------------

-We assume that JBOSS 3.2.1 with TOMCAT is installed on your system and the 
$JBOSS_HOME system variable points to the local JBOSS installation directory 
(e.g. /usr/local/jboss-3.2.1_tomcat-4.1.24). 

-In order to run the example application, a Postgresql database manager must be
installed and running on your system, accepting TCP/IP connections in the 
default port (to do that, run postmaster with -i option). Also, be sure that 
you have installed the correct JDBC driver for your Postgresql version in 
the $JBOSS_HOME/server/all/lib directory and the user specified in 
postgres-ds.xml has access permissions to the databases.

In order to configure postgresql, the next steps are needed:

1-Create a user account called "postgres" in order to manage postgresql.

2- Initialize the postgres repository

    2.1--Create a directory to store the postgres repository
    
          # mkdir /var/lib/pgsql/data
          # chown postgres /var/lib/pgsql/data
          
    2.2--Set and export the PGDATA environment variable pointing to directory
          /var/lib/pgsql/data
          
          # export PGDATA= /var/lib/pgsql/data
          
    2.3--Change to the "postgres" account.
    
    2.4--Initialize the repository
    
          $ initdb
          
3-Create a user account in postgres in order to create and access databases.
   This USER_NAME is the same name specified in the postgres-ds.xml file.
   
   $ createuser USER_NAME
   
4-Initialize the postgresql database manager

    $ postmaster -i
 	
You must create the next two databases:

DB 1 Name -> "adaptairline"
----------------------------

In order to create the database:

 - Use the "createdb" command to create the database:
   $ createdb adaptairline
 
 -Use "psql" command to connect to the database
   $ psql adaptairline
   
 -Create a table named "flights" with a field "seats" (integer).
 
    CREATE TABLE flights (seats INTEGER DEFAULT 10);
    
 -Set a value for the field "seats"

    INSERT INTO flights VALUES (10);


DB 2 Name -> "adapthotel"
-------------------------

In order to create this database proceed as above.

 -Create a table named "departments" with a field "rooms" (integer).
 
    CREATE TABLE departments (rooms INTEGER DEFAULT 10);
    
 -Set a value for the field "rooms"
   
    INSERT INTO departments VALUES (10);


 ------------------------------- oooOOOOOOooo --------------------------------


(3a) Installation (If you have ANT installed):
----------------------------------------------

1-Shutdown the JBOSS server if it is running on your system

2-Run "ant" command on the distribution directory

3-Start the JBOSS server

4-Access the J2EE example application

  Start a web browser and go to "http://HOST:PORT/adapt/reservation" and
  follow the application instructions on the web page.

 ------------------------------- oooOOOOOOooo --------------------------------

(3b) Installation (If you do not have ANT installed):
-----------------------------------------------------

1-Shutdown the JBOSS server if it is running on your system

2-Install the required libraries

  2.1--Install the activity service library

     Copy the activityservice.jar file to $JBOSS_HOME/server/all/lib directory.

  2.2--Install the open nested library

     Copy the opennested.jar file to $JBOSS_HOME/server/all/lib directory.

  2.3--Set JBOSS datasources for the example application

     Copy to or modify with the provided file, the contents of the 
     postgres-ds.xml file in $JBOSS_HOME/server/all/deploy directory.

3-Start the JBOSS server

4-Install the Activity Service implementation

  4.1--Deploy the JBOSS service

     Copy the adapt-as.sar file to $JBOSS_HOME/server/all/deploy directory.

5-Install the Open Nested Transaction implementation

  5.1--Deploy the JBOSS service

     Copy the adapt-ont.sar file to $JBOSS_HOME/server/all/deploy directory.

6-Deploy the J2EE example application

  Copy the adapttest.ear file to $JBOSS_HOME/server/all/deploy directory.

7-Access the J2EE example application

  Start a web browser and go to "http://HOST:PORT/adapt/reservation" and
  follow the application instructions on the web page.

 ------------------------------- oooOOOOOOooo --------------------------------
 
(4) Web Service Example
-----------------------

The same example as above is provided as a web service. There are four files
needed in order to deploy the web service and run the client:

- adapt-test-wsc.jar (client side)
- adapt-test-wss.jar (server side)
- deploy.wsdd (web service deployment descriptor)
- undeploy.wsdd (web service undeployment descriptor)

Important Notes:
----------------

- Be sure that the application server is stopped.

- You must configure AXIS with JBOSS in order to deploy web services.

- Upgrade the AXIS files provided with JBOSS 3.2.1 on
  $JBOSS_HOME/server/all/deploy/jboss-net.sar/*.jar with those provided by
  the AXIS 1.1 distribution (http://ws.apache.org/axis)
  


Installation
------------

1-Install AS and ONT (with or without ant).

2-Copy the adapt-test-wss.jar file to the lib directory of the AXIS 
installation in JBOSS (e.g. $JBOSS_HOME/server/all/deploy/axis.war/WEB-INF/lib)

3-Be sure you have in your $CLASSPATH the following files of the AXIS 1.1
distribution: 

 -axis.jar
 -jaxrpc.jar
 -saaj.jar
 -wsdl4j.jar
 -commons-discovery.jar
 -commons-logging.jar

4-Start the application server and postgres (if it is not running).

5-Deploy the web service.

  $ java org.apache.axis.client.AdminClient deploy.wsdd

6-In order to run the client apllication, type in the command line:
  
  $ java -classpath $CLASSPATH:adapt-test-wsc.jar 
  org.objectweb.jass.examples.travelagency.ws.WSClient RESERVATION_NAME
  NUMBER_OF_SEATS_TO_RESERVE NUMBER_OF_ROOMS_TO_RESERVE