#!/usr/bin/qsh
#
# //  DESCRIPTION:
# //      Script file used to run a listener for WebSphere
# //      Application Server administrative scripting during profile creation.

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

if [ -z "$JAASSOAP" ]; then
  JAASSOAP="-Djaassoap=off"
fi

WAS_CLASSPATH=${WAS_CLASSPATH}:${WAS_INSTALL_ROOT}/optionalLibraries/jython/jython.jar:${ITP_LOC}/batchboot.jar:${ITP_LOC}/batch2.jar
set_conglomerates

isJavaOption=false
for option in "$@" ; do
  if [ "$option" = "-javaoption" ] ; then
     isJavaOption=true
  else
     if [ "$isJavaOption" = "true" ] ; then
        javaoption=$option
        break
     fi
  fi
done 

java ${JAVA_PARM} \
  -classpath ${WAS_CLASSPATH} \
  -Dlocal.cell=${WAS_CELL} \
  -Dlocal.node=${WAS_NODE} \
  -Dcom.ibm.etools.EJBDeploy.debug=true \
  -Dibm.websphere.preload.classes=true \
  -Dcom.ibm.itp.location=${ITP_LOC} \
  -Dwas.repository.root=${CONFIG_ROOT} \
  -Dcom.ibm.ws.scripting.wsadminprops=${WSADMIN_PROPERTIES} \
  -Dconfig_consistency_check=${CONFIG_CONSISTENCY_CHECK} \
  -Dcom.ibm.ws.management.standalone=true \
  -Dcom.ibm.CORBA.BootstrapHost=${COMPUTERNAME} \
  ${javaoption} \
  ${JAASSOAP} \
  ${WAS_LOGGING} \
  com.ibm.wsspi.bootstrap.WSPreLauncher -nosplash -application \
  com.ibm.ws.bootstrap.WSLauncher \
  com.ibm.ws.runtime.WsProfileAdminListener "$@"

# signal the wsadmin listener is shutdown
FINISH_FILE=$1.finished
echo "wsadmin listener shutdown" > $FINISH_FILE

