#!/usr/bin/qsh
#
# //  DESCRIPTION:
# //      Script file configure/unconfigure the policy
# //      server host name information for using Tivoli
# //      Access Manager with WAS

. $(/usr/bin/dirname $0)/setupCmdLine

# Issue error message if we are unable to determine valid profile
CMD_NAME=`basename $0`

if [ "${INV_PRF_SPECIFIED:=}" != "" ] && [ "$INV_PRF_SPECIFIED" = "true" ]
then
    ${JAVA_HOME}/bin/java -cp "${WAS_HOME}/lib/commandlineutils.jar" com.ibm.ws.install.commandline.utils.CommandLineUtils -specifiedProfileNotExists -profileName $WAS_PROFILE_NAME
    exit 1
elif [ "${WAS_USER_SCRIPT_FILE_NOT_EXISTS:=}" != "" ] && [ "$WAS_USER_SCRIPT_FILE_NOT_EXISTS" = "true" ]
then
    ${JAVA_HOME}/bin/java -cp "${WAS_HOME}/lib/commandlineutils.jar" com.ibm.ws.install.commandline.utils.CommandLineUtils -wasUserScriptFileNotExists -wasUserScript $WAS_USER_SCRIPT
    exit 1
elif [ "${NO_DFT_PRF_EXISTS:=}" != "" ] && [ "$NO_DFT_PRF_EXISTS" = "true" ]
then
    ${JAVA_HOME}/bin/java -cp "${WAS_HOME}/lib/commandlineutils.jar" com.ibm.ws.install.commandline.utils.CommandLineUtils -noDefaultProfile -commandName $CMD_NAME
    exit 1
fi

${JAVA_HOME}/bin/java ${JAVA_PARM} \
  -Dpd.cfg.home=${USER_INSTALL_ROOT}/etc/pd \
  -Dpd.home=${USER_INSTALL_ROOT}/etc/pd/PolicyDirector \
  com.ibm.ws.bootstrap.WSLauncher \
  com.tivoli.pd.jcfg.PDJrteCfg \
    -cfgfiles_path ${USER_INSTALL_ROOT}/etc/pd \
    -was "$@"
