#!/bin/sh

# Copyright (c) 2000 BEA Systems, Inc. All Rights Reserved.

# Adjust these variables to match your environment
JDK_HOME=${JDK_HOME:-"/usr/lib/java"}
WL_HOME=${WL_HOME:-"/weblogic"}
MYSERVER="$WL_HOME/myserver"

# UNIX or DOS conventions
if [ -e /dev/null ]
then
  MYCLASSPATH="$JDK_HOME/lib/classes.zip:$WL_HOME/classes:$WL_HOME/lib/weblogicaux.jar:$MYSERVER/clientclasses:$WL_HOME/examples/cluster/ejb/account/build:$WL_HOME/examples/cluster/ejb/teller/build:$WL_HOME/examples/cluster/utils"
else
  MYCLASSPATH="$JDK_HOME/lib/classes.zip;$WL_HOME/classes;$WL_HOME/lib/weblogicaux.jar;$MYSERVER/clientclasses;$WL_HOME/examples/cluster/ejb/account/build;$WL_HOME/examples/cluster/ejb/teller/build;$WL_HOME/examples/cluster/utils"
fi

# Create the build directory, and copy the deployment descriptors into it
mkdir -p build build/META-INF
cp -f ejb-jar.xml weblogic-ejb-jar.xml build/META-INF

# Compile ejb classes into the build directory (jar preparation)
javac -d build -classpath $MYCLASSPATH Teller.java TellerHome.java TellerResult.java TellerException.java TellerBean.java

# Make a standard ejb jar file, including XML deployment descriptors
(cd build; jar cv0f std_ejb_cluster_Teller.jar META-INF examples; cd ..)

# Run ejbc to create the deployable jar file
java -classpath $MYCLASSPATH -Dweblogic.home=$WL_HOME weblogic.ejbc \
    -compiler javac build/std_ejb_cluster_Teller.jar \
    $MYSERVER/ejb_cluster_Teller.jar

# Compile cluster utilities into default directory
javac -d $WL_HOME/examples/cluster/utils \
    -classpath $MYCLASSPATH \
    $WL_HOME/examples/cluster/utils/ClusterUtils.java

# Compile ejb interfaces & client app into the clientclasses directory
javac -d $MYSERVER/clientclasses \
    -classpath $MYCLASSPATH Teller.java TellerHome.java TellerResult.java \
    TellerException.java \
    ../Client.java

