#!/usr/bin/qsh
# // THIS PRODUCT CONTAINS RESTRICTED MATERIALS OF IBM
# // 5724-I63, 5724-H88, 5655-N01, 5733-W61 (C) COPYRIGHT International Business Machines Corp., 1997, 2006
# // All Rights Reserved * Licensed Materials - Property of IBM
# // US Government Users Restricted Rights - Use, duplication or disclosure
# // restricted by GSA ADP Schedule Contract with IBM Corp.
#
# //  DESCRIPTION:
# //      Script file used to deploy ejb jar files into deployed jar files.

WAS_OS400_FILE_CREATE_AUTH="*RX"
WAS_OS400_DIR_CREATE_AUTH="*RX"

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

BOOTPATH=${ITP_LOC}/batchboot.jar:${WAS_INSTALL_ROOT}/java/ext/iwsorbutil.jar

CP=${ITP_LOC}/batch2.jar:${ITP_LOC}/batch2_nl1.jar

WAS_EXT_DIRS=${WAS_INSTALL_ROOT}/plugins/j2ee.javax_1.4.0:${WAS_INSTALL_ROOT}/plugins:${WAS_INSTALL_ROOT}/plugins/com.ibm.ws.runtime_6.1.0:$WAS_EXT_DIRS

java ${JAVA_FLAGS} \
  -Xbootclasspath/a:${BOOTPATH} \
  -Dwebsphere.lib.dir=${WAS_INSTALL_ROOT}/lib \
  -Ditp.loc=${ITP_LOC} \
  -Dejbdeploy.user.install.root=${USER_INSTALL_ROOT}/ejbdeploy \
  -Dcom.ibm.sse.model.structuredbuilder="off" \
  -classpath ${CP} \
  -Dws.ext.dirs=${WAS_EXT_DIRS} \
  -Dos400.security.properties=${SECURITY_CFG} \
  com.ibm.etools.ejbdeploy.EJBDeploy "$@"

RETCODE=$?

# Ensure QEJBSVR all access to deploytool's itp/configuration directory if it exists
if [ -d ${WAS_INSTALL_ROOT}/deploytool/itp/configuration ]; then
  chown -R QEJBSVR ${WAS_INSTALL_ROOT}/deploytool/itp/configuration 2> /dev/null
fi
# Ensure QEJBSVR all access to ejbdeploy.user.install.root location
if [ -d ${USER_INSTALL_ROOT}/ejbdeploy ]; then
  chown -R QEJBSVR ${USER_INSTALL_ROOT}/ejbdeploy 2> /dev/null
fi

exit $RETCODE