#!/bin/sh
exec 2>&1
echo ======== Start BizTalk Server example build ========


# Compile BizTalk Server classes
javac -d $SERVER_CLASSES IncomingMessage.java OutgoingMessage.java BizException.java
cd ejb
javac -d $SERVER_CLASSES BizBean.java BizBeanHome.java
cd ..
javac -d $SERVER_CLASSES AdminCLU.java BizAdapter.java BizConfig.java BizHttpProtocolAdapter.java BizServer.java DOMIncomingMessage.java DOMOutgoingMessage.java

echo ======== build BizTraderBean ======== 


cd ejb/biztrader

# Create the build directory, and copy the deployment descriptors into it
if [ ! -d "build" ]
then
  mkdir build
fi

if [ ! -d "build/META-INF" ]
then
  mkdir build/META-INF
fi
cp *.xml build/META-INF

# Compile ejb classes into the build directory (jar preparation)
cd ..
javac -d biztrader/build BizBean.java BizBeanHome.java 
cd biztrader
javac -d build ProcessingErrorException.java BizTraderBean.java

# Make a standard ejb jar file, including XML deployment descriptors
cd build
jar cvf std_xml_biztalk_ejb_bizTrader.jar META-INF examples
cd ..

# Run ejbc to create the deployable jar file
java -classpath $CLASSPATH weblogic.ejbc -compiler javac build/std_xml_biztalk_ejb_bizTrader.jar -d $SERVER_CLASSES/../xml_biztalk_ejb_bizTrader.jar

echo ======== build BizTraderJournalBean ========

cd ../biztradejournal

# Create the build directory, and copy the deployment descriptors into it
if [ ! -d build ]
then
  mkdir build
fi

if [ ! -d build/META-INF ]
then
  mkdir build/META-INF
fi
cp *.xml build/META-INF

# Compile ejb classes into the build directory (jar preparation)
cd ..
javac -d biztradejournal/build BizBean.java BizBeanHome.java 
cd biztradejournal
javac -d build BizTradeJournalBean.java

# Make a standard ejb jar file, including XML deployment descriptors
cd build
jar cvf std_xml_biztalk_ejb_bizTradeJournal.jar META-INF examples
cd ..

# Run ejbc to create the deployable jar file
java -classpath $CLASSPATH weblogic.ejbc -compiler javac build/std_xml_biztalk_ejb_bizTradeJournal.jar -d $SERVER_CLASSES/../xml_biztalk_ejb_bizTradeJournal.jar

cd ../..

echo ======== end BizTalk Server example build ========
