#!/bin/sh

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

MYCLASSPATH="$JAVA_HOME/lib/classes.zip:$WL_HOME/classes:$WL_HOME/lib/weblogicaux.jar:$MYSERVER/clientclasses:$MYSERVER/serverclasses:$WL_HOME/lib/wleorb.jar"

# 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 Converter.java ConverterHome.java ConverterResult.java ProcessingErrorException.java ConverterBean.java

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

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

# Compile ejb interfaces & client app into the clientclasses directory
javac -d $MYSERVER/clientclasses -classpath $MYCLASSPATH Converter.java ConverterHome.java ConverterResult.java ProcessingErrorException.java Client.java

# Compile servlets into the servletclasses directory
javac -d $MYSERVER/servletclasses -classpath $MYCLASSPATH ejbSimpappServlet.java
