#!/bin/sh
#
# LFT Channel sample - IBM WebServices Gateway
# checkout.sh
# Parameters are:
# 1: test mode (wsif, wsgw or java)
# 2: WebServices Gateway dir
# 3: location of xerces.jar

echo

if [ $# -eq 3 ]; then # test there are 3 arguments

  if [ -d $2 ]; then # test 2nd argument is a directory

    if [ -f $3 ]; then # test xerces.jar exists

      java -Djava.protocol.handler.pkgs=com.ibm.axis.transport -Dlft-directory=$2/clientTemp -Dlft-piFactory=com.ibm.httpr.file.FileStateManagerFactory -Dhttpr.channelStyle=process -classpath $2/lib/wsgw-samples.jar:$2/lib/wsif.jar:$2/lib/qname.jar:$2/lib/wsgwwsiflft.jar:$2/lib/wsgwwsdllft.jar:$3:$2/lib/axis.jar:$2/lib/clutil.jar:$2/lib/wsdl4j.jar:$2/lib/httpr.jar:$2/lib/activation.jar:$2/lib/jaxrpc.jar:$2/lib/commons-logging.jar services.lftfileservice.CheckOut $1 $2

    else # couldn't find xerces.jar

      echo "xerces.jar ($3) couldn't be found."
      echo "xerces.jar is usually /opt/WebSphere/AppServer/lib/xerces.jar"

    fi

  else # second arg isn't a directory

    echo "The directory ($2) specified for WebServices Gateway doesn't exist."

  fi

else # user didn't pass 3 arguments

  echo "checkout.sh requires 3 parameters:"
  echo "1: test mode (wsif, wsgw or java)"
  echo "2: WebServices Gateway dir (no trailing /)"
  echo "3: location of xerces.jar (usually /opt/WebSphere/AppServer/lib/xerces.jar)"

fi

echo
