#!/bin/sh -f
################################################################################
## NAME                                                                       ##
## run                                                                        ##
################################################################################
## SYNOPSIS                                                                   ##
## run.sh [ class_file ] [ ... ]                                              ##
################################################################################
## DESCRIPTION                                                                ##
## This scripts runs the class file specified in argument.                    ##
################################################################################
## COPYRIGHTS                                                                 ##
## Copyrights 2002 by GAEL Consultant - All rights reserved.                  ##
## GAEL Consultant proprietary - Delivered under license agreement.           ##
## Copying and disclosure prohibited without express written permission from  ##
## GAEL Consultant.                                                           ##
################################################################################
## ADMINISTRATION                                                             ##
## Stephane MBAYE   | 15.09.02 | v01.00 | Creation of the SW component        ##
## Christ. DEMANGE  | 07.10.02 | v01.01 | Add extra libraries and Xprof option##
## Jean-G. DUBUIS   | 14.10.02 | v01.02 | Add extra libraries for online help ##
## Jean-G. DUBUIS   | 11.03.03 | v01.03 | Added Acrobat packages              ##
## Christ. DEMANGE  | 20.05.03 | v01.04 | Added test and JUnit to classpath   ##
## Brice   MOUGE    | 30.07.03 | v01.05 | Added dynamic classpath             ##
## Jean-G. DUBUIS   | 19.08.03 | v01.06 | Added Acrobat packages (zip ext.)   ##
################################################################################

################################################################################
## Profiler option, depends on called command name                            ##
################################################################################
prof=""
if [ "`basename $0`" = "run_prof" ]
then
   prof="-Xprof"
#   prof="-Xrunhprof:cpu=times,heap=sites"
fi
################################################################################
## Set shortcut variables                                                     ##
################################################################################
software_dir="`dirname $0`/.."
software_src="${software_dir}/src"
software_tst="${software_dir}/test"
software_lib="${software_dir}/lib"
software_classes="${software_dir}/target/classes"
################################################################################
## Set paths to the relevant jars                                             ##
################################################################################
CLA="/usr/java/apache-ant-1.5.4/lib/xercesImpl.jar"
classpath="$software_dir/target/drb-2-2-SNAPSHOT.jar:.:log4j.properties:${CLASSPATH}";

for i in `find ${software_lib} -name "*.jar" -print`;
do
   classpath="${i}:${classpath}";
done

#classpath="${classpath}:${software_lib}"

################################################################################
## Lauches the class                                                          ##
################################################################################
#java ${prof} -classpath $classpath $*
#java ${prof} -Xmx256m -classpath $classpath "$1" "$2" "$3" "$4" "$5" "$6" "$7"
java ${prof} -Xmx32m -classpath $classpath "$1" "$2" "$3" "$4" "$5" "$6" "$7"
exit $?;
