#!/bin/sh
# CQ Jazz Connector Sync Tool Launcher
if [ -n "$TZ" ]
then
    if [ -n "$CQ_HOME" ]
    then
        source $CQ_HOME/cq_setup.sh
        export START_DIR=`pwd`      
        
        # Copy the installed cqjni.jar into the CQ JNI plugin lib directory.
        export CQ_JNI_PLUGIN_DIR=$START_DIR/../synctool/plugins/com.rational.clearquest.cqjni.71_*/lib	
        cd $CQ_JNI_PLUGIN_DIR
        if [ $? -ne 0 ];       
        then
            echo "The CQ JNI plugin directory does not exist"
            exit 1
        fi         
        
        cp -f "$CQ_HOME/cqweb/lib/cqjni.jar" .
        if [ $? -ne 0 ];
        then 
            echo "There was a problem copying the cqjni.jar file"
            cd $START_DIR
            exit 1
        fi
        
        cd $START_DIR
        export JAVA="$START_DIR/../jre/bin/java"
        export LAUNCHER=org.eclipse.equinox.launcher_1.0.101.R34x_v20081125.jar
        export JAR="$START_DIR/../synctool/plugins/$LAUNCHER"
        export APPLICATION=com.ibm.rational.connector.cq.synctools.application

        $JAVA -Xmx1024M -Dcom.ibm.rational.interop.gateway.configURL=file:cqconnector.properties -Dlog4j.configuration=file:log4j.properties -DCQ_HOME="$CQ_HOME/cqweb/lib" -jar $JAR -application $APPLICATION "$@"
    else
        echo "Your CQ_HOME variable, the name of the CQ install directory, must be set to run the synctool"
    fi
else
    echo "Your time zone variable, TZ, must be set to run clearquest, and therefore the synctool"
fi

# Licensed Materials - Property of IBM (c) Copyright IBM Corporation 2008.
# All Rights Reserved.
#
# Note to U.S. Government Users Restricted Rights: Use, duplication or
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp.

