them against JNDIs in use or configured in the deployed BPEL processes on the same server.
Script:
# ################################################################################ # # Author: Ahmed Aboulnaga # Filename: check_jndi_bpel.sh # Creation: 2008-11-06 # Description: Checks if JNDIs in deployed BPEL processes actually exist. # # ################################################################################ # ---------------------------------------- # Configurable parameters # ---------------------------------------- ORACLE_HOME=/u01/app/oracle/product/10.1.3/soa_as_1 CURRENTDIR=$PWD TMPDIRFILES=$PWD # ---------------------------------------- # Basic checks # ---------------------------------------- if [ $# -ne 1 ]; then echo "Using ORACLE_HOME=$ORACLE_HOME" fi CURRENTDIR=$PWD TMPDIRFILES=$PWD # ---------------------------------------- # Create the temp extract directory # ---------------------------------------- if [ ! -d $ORACLE_HOME ]; then echo "\nERROR: $ORACLE_HOME not found.\n" exit fi # ---------------------------------------- # Get list of unique JNDIs configured on Oracle App Server # ---------------------------------------- cat /dev/null > $TMPDIRFILES/existing_jndi_bpel.tmp2 for i in `ls $ORACLE_HOME/j2ee/oc4j_soa/application-deployments/default` do if [ -d $ORACLE_HOME/j2ee/oc4j_soa/application-deployments/default/$i ]; then for j in `ls $ORACLE_HOME/j2ee/oc4j_soa/application-deployments/default/$i` do do if [ -f $ORACLE_HOME/j2ee/oc4j_soa/application-deployments/default/$i/$j ]; then cat $ORACLE_HOME/j2ee/oc4j_soa/application-deployments/default/$i/$j | sed -n '/<!--/,/-->/!p' | grep "<connector-factory location=" | cut -f2 -d'"' >> $TMPDIRFILES/existing_jndi_bpel.tmp2 fi done fi done cat $TMPDIRFILES/existing_jndi_bpel.tmp2 | sort -u > $TMPDIRFILES/existing_jndi_bpel.tmp rm -f $TMPDIRFILES/existing_jndi_bpel.tmp2 # ---------------------------------------- # Header output # ---------------------------------------- echo "" printf "%-15s \n" "JNDI" printf "%-15s %-30s %-20s %-30s \n" "on App Srvr" "JNDI Name" "BPEL Domain" "BPEL Process" printf "%-15s %-30s %-20s %-30s \n" "------------" "----------------------" "--------------" "-----------------------------" # ---------------------------------------- # Dump list of JNDIs to flat file # ---------------------------------------- #echo "JNDIs configured on Application Server" >> $CURRENTDIR/check_jndi_bpel.csv #echo "--------------------------------------" >> $CURRENTDIR/check_jndi_bpel.csv #cat $TMPDIRFILES/existing_jndi_bpel.tmp >> $CURRENTDIR/check_jndi_bpel.csv # ---------------------------------------- # Loop through deployed BPEL processes # ---------------------------------------- echo "Message,BPEL domain,BPEL process,BPEL process version,WSDL that was parsed,JNDI found in WSDL" > $CURRENTDIR/check_jndi_bpel.csv for DOMAIN in `ls $ORACLE_HOME/bpel/domains` do for BPELPROCESS in `ls -a $ORACLE_HOME/bpel/domains/$DOMAIN/tmp | grep ".bpel"` do for WSDLFILE in `ls $ORACLE_HOME/bpel/domains/$DOMAIN/tmp/$BPELPROCESS/*.wsdl` do JNDI=`sed -n '/<!--/,/-->/!p' $WSDLFILE | grep "<jca:address location" | cut -f2 -d"=" | cut -f2 -d'"'` if [ ! "$JNDI" == "" ]; then FOUND=`grep $JNDI $TMPDIRFILES/existing_jndi_bpel.tmp` BPELPROCESSDISPLAY=`echo $BPELPROCESS | cut -b7- | sed 's^.tmp^^' | sed 's/.\{33\}$//'` BPELPROCESSVERSION=`echo $BPELPROCESSDISPLAY | awk -F '_' '{print $NF}'` BPELPROCESSDISPLAY=`echo $BPELPROCESSDISPLAY | sed -e "s/\(.*\)_/\1|/g" | awk -F '|' '{print $1}'` WSDLFILEDISPLAY=`echo $WSDLFILE | sed 's^.*/^^'` if [ "${FOUND}" == "" ]; then printf "%-15s %-30s %-20s %-30s \n" "Missing" "$JNDI" "$DOMAIN" "$BPELPROCESSDISPLAY" echo "JNDI not configured in App Server,$DOMAIN,$BPELPROCESSDISPLAY,$BPELPROCESSVERSION,$WSDLFILEDISPLAY,$JNDI" >> $CURRENTDIR/check_jndi_bpel.csv else printf "%-15s %-30s %-20s %-30s \n" "Found" "$JNDI" "$DOMAIN" "$BPELPROCESSDISPLAY" echo "JNDI configured in App Server,$DOMAIN,$BPELPROCESSDISPLAY,$BPELPROCESSVERSION,$WSDLFILEDISPLAY,$JNDI" >> $CURRENTDIR/check_jndi_bpel.csv fi fi done done done # ---------------------------------------- # Cleanup # ---------------------------------------- echo "" echo "Output file created in: $CURRENTDIR/check_jndi_bpel.csv" echo "" rm -f $TMPDIRFILES/existing_jndi_bpel.tmp
Applicable Versions:
- Oracle SOA Suite 10g (Advanced install)
No comments:
Post a Comment