#!/bin/sh

MAIN_CLASS=cdac.medinfo.sdk.hl7282.tool.hl7xmldump.HL7XMLDump
MAIN_JAR=hl7xmldumptool.jar

DIRNAME=`dirname $0`

# OS specific support (must be 'true' or 'false').
cygwin=false;
case "`uname`" in
    CYGWIN*)
        cygwin=true
        ;;
esac

# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
    [ -n "$JAVA_HOME" ] &&
        JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi

# Setup the JVM
if [ "x$JAVA_HOME" != "x" ]; then
    JAVA=$JAVA_HOME/bin/java
else
    JAVA="java"
fi

# Setup the classpath
CP="$CP:$MAIN_JAR"
CP="$CP:./../lib/applicationmanagement282.jar"
CP="$CP:./../lib/hl7base282.jar"
CP="$CP:./../lib/clinicallaboratoryautomation282.jar"
CP="$CP:./../lib/en_US.jar"
CP="$CP:./../lib/financialmanagement282.jar"
CP="$CP:./../lib/masterfiles282.jar"
CP="$CP:./../lib/medicalrecords282.jar"
CP="$CP:./../lib/observationreporting282.jar"
CP="$CP:./../lib/orderentry282.jar"
CP="$CP:./../lib/patientadministration282.jar"
CP="$CP:./../lib/patientcare282.jar"
CP="$CP:./../lib/patientreferral282.jar"
CP="$CP:./../lib/personnelmanagement282.jar"
CP="$CP:./../lib/query282.jar"
CP="$CP:./../lib/scheduling282.jar"
CP="$CP:./../lib/commons-codec-1.3.jar"
CP="$CP:./../lib/commons-collections-3.2.jar"

# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
    JAVA=`cygpath --path --windows "$JAVA"`
    CP=`cygpath --path --windows "$CP"`
fi

# Execute the JVM
exec $JAVA $JAVA_OPTS -cp $CP $MAIN_CLASS "$@"
