#!/bin/sh
# status.sh
# lists status of HTTPR large file transfers
# Usage: ./status.sh <wsgw_dir> <stateFile_dir> <optional_param>, where
#  <wsgw_dir> is the WebServices Gateway Directory (no trailing slash),
#  <stateFile_dir> is the directory containing the httpr state file, stateFile (no trailing slash),
#  <optional_param> is cancel, or no parameter is typed.

echo
echo "This utility lists the status of large file transfers over HTTPR."
echo "It can be run for the sending or the receiving end, as determined by the stateFile_dir parameter."
echo

if [ $# -eq 2 -o $# -eq 3 ]; then # tests there are 1 or 2 args

  if [ -d $1 ]; then

    if [ -d $2 ]; then

      java -DSTATE_FILE=$2/stateFile -Djava.protocol.handler.pkgs=com.ibm.axis.transport -Dlft-directory=$1/serverTemp -Dlft-piFactory=com.ibm.httpr.file.FileStateManagerFactory -classpath $1/lib/wsgw-samples.jar:$1/lib/httpr.jar services.lftfileservice.status $3

    else

      echo "The directory specified for the HTTPR stateFile ($2) doesn't exist."

    fi

  else

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

  fi  

else

  echo "Usage: ./status.sh <wsgw_dir> <stateFile_dir> <optional_param>,"
  echo " where <wsgw_dir> is the WebServices Gateway Directory (no trailing slash),"
  echo " <stateFile_dir> is the directory containing the httpr state file, stateFile (no trailing slash),"
  echo " <optional_param> is cancel, or no parameter is typed."
  echo "Examples:"
  echo "(client side, no cancel option):"
  echo "./status.sh /data/W110.L020820/wsgw_was4 /data/W110.L020820/wsgw_was4/samples/services/lftfileservice"
  echo "(server side, cancel option):"
  echo "./status.sh /data/W110.L020820/wsgw_was4 /opt/WebSphere/AppServer/bin cancel"
  echo

fi
