#!/bin/sh
TAUROOT=/usr
CONFIG_ARCH=

PERFDMF_HOME=${TAUROOT}/tools/src/perfdmf
PERFDMF_JAR=/usr/share/java/perfdmf.jar
XMLSAX_JAR=/usr/share/java/xerces-j2.jar
JARGS_JAR=/usr/share/java/jargs.jar
COMMON_JAR=/usr/share/java/tau-common.jar
#CONFIG_FILE=${HOME}/.ParaProf/perfdmf.cfg

if [ "x$TAUROOT" = "x" ] 
then
	echo "TAUROOT not set.  Please run 'configure' in the tau root directory."
	exit
fi

if [ ! -r ${PERFDMF_JAR} ]
then
	echo ""
	echo "$PERFDMF_JAR not found."
	echo "Please run make in the perfdmf directory."
	echo ""
	exit 
fi

if [ ! -r ${XMLSAX_JAR} ]
then
	echo ""
	echo "$XMLSAX_JAR not found."
	echo ""
	exit
fi

if [ ! -r ${JARGS_JAR} ]
then
	echo ""
	echo "$JARGS_JAR not found."
	echo ""
	exit
fi

# JAVA class loader will load the JDBC driver.
# get the jdbc jar file from the configuration file
#JDBC_JAR=`grep jdbc_db_jarfile ${CONFIG_FILE} 2>/dev/null | sed s/jdbc_db_jarfile://`
#JDBC_TYPE=`grep jdbc_db_type ${CONFIG_FILE} | sed s/jdbc_db_type://`

#if [ ! "${JDBC_TYPE}" = "db2" ]; then
#	if [ ! -z ${JDBC_JAR} ]; then
#    	if [ ! -r ${JDBC_JAR} ]; then
#        	echo ""
#        	echo "Error: JDBC driver '$JDBC_JAR' not found."
#        	echo ""
#		exit
#    	fi
#	fi
#fi


java \
-Dderby.system.home=${HOME}/.ParaProf \
-cp ${PERFDMF_JAR}:${XMLSAX_JAR}:${JARGS_JAR}:${COMMON_JAR} \
edu.uoregon.tau.perfdmf.loader.CreateExperiment \
"$@"
