#! /bin/sh

# Shift all arguments by one to get command parameters
getArguments () {
    args=""
    while [ "X$1" !=  "X" ] ; do
        args="${args} $1"
        shift
    done
    echo $args
}

usage() { 
/bin/cat >&2 << EOF
Get queue configuration information. 
                                                                                
Options:
        help | usage                Display usage
        version                     Display command version
        queueName                   Queue 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"
#echo $CONFIG
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 "$@"`
eval java ${QUEUING_CLIENT} ${QUEUING_SERVICE} getQueueConfigParams $ARGS
return_code=$?

  exit $return_code


