#! /bin/sh

# Shift all arguments by one to get command parameters
getArguments () {
    k="first"
    args=""
    while [ "X$1" !=  "X" ] ; do
        if [ $k = "first" ]; then
            args="$1"
            args="${args} getRsvData"
            k="not"
        else
            args="${args} $1"
        fi
        shift
    done
    echo $args
}

usage() { 
/bin/cat >&2 << EOF

Get detailed information about a reservation.

Options:
	help | usage         	    Display usage
	version          	    Display command version
	rsvName			    Reservation name 
EOF
} 


##### MAIN #####

# Make sure GLOBUS_LOCATION is set
if [ ! -d "$GLOBUS_LOCATION" ] ; then
    echo "Error: GLOBUS_LOCATION invalid or not set: $GLOBUS_LOCATION" 1>&2
    exit 2
fi

full=`which $0`
dir=`dirname $full`
CONFIG="${dir}/csf.sh"
if [ -r "${CONFIG}" ] ; then
   . "${CONFIG}"
else
   echo "Error: Cannot find ${CONFIG} configuration file"
   exit
fi

##### MAIN #####
if [ $# -lt 1 ]; then
    usage
    exit 1
else
    if [ $1 = "help" -o $1 = "usage" ]; then
        usage
        exit 1
    elif [ $1 = "version" ]; then
       echo $0 version ${CSF_VERSION}
       exit 1 
    fi
fi

ARGS=`getArguments "$@"`
java ${RSV_CLIENT} $ARGS
return_code=$?

exit $return_code


