#
# IBM Confidential
#
# OCO Source Materials
#
# 5724-R46
#
# (C) COPYRIGHT IBM CORP. 2006,2007
#
# The source code for this program is not published or otherwise
# divested of its trade secrets, irrespective of what has been
# deposited with the U.S. Copyright Office.
#
#!/bin/sh
#

# running this program.
# This script is used for running Java client programs that are written
# to access MAXIMO business objects.
# Prereqs:
# 
# In order to run this, you must have WebSphere Application Client software
# installed. Prior to running this, you must setup the environment using 
# setupClient.bat file located in the bin directory of the WebSphere 
# Application Client software installation directory. Also, note that this
# can only be run with the JVM that's shipped with the WebSphere Application
# client software.
# Make sure to edit the nodename and the servername properties.
# Also copy the mboejb.jar files from the deployed folders of the WebSphere 
# application server into this directory.

# WAS_HOME not set
washomenotset() {
echo " 
The IBM WebSphere Server environment is not setup. 
Please run the setupClient.sh command from the WebSphere Application client install folder."

exit 1
}

if [ "$WAS_HOME" = "" ]
then
    washomenotset
fi

MAXIMOHOSTNAME=localhost
MAXIMONODENAME=localhostNode01
MAXIMOSERVERNAME=server1
IIOPPORT=2809
MAXIMOROOT=./../../..
MAXIMOAPPROOT=$MAXIMOROOT/applications/maximo
MAXIMOJ2EECLIENTROOT=.



ROOTJNDI_CONTEXT=cell/nodes/$MAXIMONODENAME/servers/$MAXIMOSERVERNAME
ACCESSTOKEN_JNDI_NAME=ejb/maximo/remote/accesstokenprovider

PROVIDERURL=corbaloc:iiop:$MAXIMOHOSTNAME:$IIOPPORT
CLIENTBOOTCLASSNAME=com.ibm.tivoli.maximo.thinclient.LaunchThinClient

MAXIMOCLASSPATH=$MAXIMOAPPROOT/businessobjects/classes:$MAXIMOAPPROOT/mbojava/javamodule:$MAXIMOAPPROOT/resources:$MAXIMOJ2EECLIENTROOT/mboejbclient.jar:




$JAVA_HOME/bin/java -Xbootclasspath/p:$WAS_BOOTCLASSPATH-Djava.security.auth.login.config="./jaas_client.conf" -classpath "$WAS_CLASSPATH:$MAXIMOCLASSPATH" -Djava.ext.dirs=$WAS_EXT_DIRS -Djava.naming.provider.url=$PROVIDERURL -Djava.naming.factory.initial=com.ibm.websphere.naming.WsnInitialContextFactory -Dmaximo.jndi.rootContext=$ROOTJNDI_CONTEXT -Dmaximo.jndi.ejb.accesstoken=$ACCESSTOKEN_JNDI_NAME   "$SERVER_ROOT" "$CLIENTSAS" $CLIENTBOOTCLASSNAME websphere $1 $2 $3 $4 $5
