You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-dev@xml.apache.org by vg...@apache.org on 2004/01/22 04:28:16 UTC

cvs commit: xml-xindice/bin xindice

vgritsenko    2004/01/21 19:28:16

  Modified:    bin      xindice
  Log:
  rework, add XINDICE_CONFIG parameter, add cygwin support, etc.
  
  Revision  Changes    Path
  1.5       +48 -39    xml-xindice/bin/xindice
  
  Index: xindice
  ===================================================================
  RCS file: /home/cvs/xml-xindice/bin/xindice,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- xindice	27 Oct 2002 00:02:50 -0000	1.4
  +++ xindice	22 Jan 2004 03:28:16 -0000	1.5
  @@ -1,50 +1,59 @@
   #!/bin/sh
  +# -----------------------------------------------------------------------------
  +# Xindice Command Line Tool Unix Shell Script for SRC distribution
  +#
  +# $Id$
  +# -----------------------------------------------------------------------------
  +
  +# ----- OS specific support ----------------------------------------------------
  +
  +cygwin=false;
  +darwin=false;
  +case "`uname`" in
  +  CYGWIN*) cygwin=true ;;
  +  Darwin*) darwin=true
  +           if [ -z "$JAVA_HOME" ] ; then
  +             JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home   
  +           fi
  +           ;;
  +esac
  +
   
  -if test -z "$JAVA_HOME"; then
  -   echo "\$JAVA_HOME Is Not Set"
  -   exit
  +# ----- Verify and Set Required Environment Variables -------------------------
  +
  +if [ "$JAVA_HOME" = "" ] ; then
  +  echo You must set JAVA_HOME to point at your Java Development Kit installation
  +  exit 1
   fi
   
  -if test -z "$XINDICE_HOME"; then
  -   echo "\$XINDICE_HOME Is Not Set"
  -   exit
  +if [ "$XINDICE_HOME" = "" ] ; then
  +  XINDICE_HOME=`dirname $0`/..
  +  echo "WARNING: The environment variable XINDICE_HOME is not set."
  +  echo "         Defaulting to $XINDICE_HOME"
   fi
   
  -CMD_HOME=`dirname $0`
  -CMD_NAME=`basename $0`
  +if [ "$XINDICE_DB_HOME" = "" ] ; then XINDICE_DB_HOME=$XINDICE_HOME ; fi
  +if [ "$XINDICE_CONFIG" = "" ] ; then XINDICE_CONFIG=$XINDICE_HOME/config/system.xml ; fi
  +if [ "$LOGGER" = "" ] ; then LOGGER=org.apache.commons.logging.impl.SimpleLog ; fi
  +if [ "$LOGLEVEL" = "" ] ; then LOGLEVEL=INFO ; fi
   
  -CLASSPATH=$XINDICE_HOME/classgen:$XINDICE_HOME/config:$CLASSPATH
   
  -# Read in the list of Xindice Jars to include in the CLASSPATH
  -JAR_LIST=""
  -JARS=`ls -1 $XINDICE_HOME/java/lib/*.jar`
  -for jar in $JARS ; do
  -   JAR_LIST="$JAR_LIST `basename $jar`"
  -   CLASSPATH=$jar:$CLASSPATH ;
  -done
  -JARS=`ls -1 $XINDICE_HOME/dist/xindice*.jar`
  -for jar in $JARS ; do
  -   JAR_LIST="$JAR_LIST `basename $jar`"
  -   CLASSPATH=$jar:$CLASSPATH ;
  -done
  -
  -# Read in the extra VM paramters for starting the program
  -VMPROPS=""
  -if test -f $XINDICE_HOME/config/vm.cfg; then
  -   PROPS="`cat $XINDICE_HOME/config/vm.cfg`"
  -   for prop in $PROPS
  -   do
  -      VMPROPS="$VMPROPS $prop"
  -   done
  -fi
  +# ----- Set Classpath ----------------------------------------------------------
  +
  +CP=$XINDICE_HOME/classes
  +for i in `ls $XINDICE_HOME/java/lib/*.jar` ; do CP=$CP:$i ; done
  +for i in `ls $XINDICE_HOME/dist/xindice*.jar` ; do CP=$CP:$i ; done
   
  -case $CMD_NAME in
  -   xindice)       CLASS_NAME="org.apache.xindice.tools.XMLTools" ;;
  -   *)           echo "Error mapping command link to Java class"
  -                exit 1 ;;
  -esac
   
  -LOGGER=org.apache.commons.logging.impl.SimpleLog
  -LOGLEVEL=debug
  +# ----- Run Tools --------------------------------------------------------------
  +
  +JAVACMD=$JAVA_HOME/bin/java
  +# For Cygwin, switch paths to Windows format before running java
  +if $cygwin; then
  +  CP=`cygpath --path --windows "$CP"`
  +  XINDICE_HOME=`cygpath --path --windows "$XINDICE_HOME"`
  +  XINDICE_DB_HOME=`cygpath --path --windows "$XINDICE_DB_HOME"`
  +  XINDICE_CONFIG=`cygpath --path --windows "$XINDICE_CONFIG"`
  +fi
   
  -$JAVA_HOME/bin/java -Xms16m -Xmx128m -Dxindice.home="$XINDICE_HOME" -Dorg.apache.commons.logging.Log="$LOGGER" -Dorg.apache.commons.logging.simplelog.defaultlog="$LOGLEVEL" -Dcmd.home="$CMD_HOME" $VMPROPS -classpath "$CLASSPATH" $CLASS_NAME $*
  +$JAVA_HOME/bin/java -Xms16m -Xmx128m -Dxindice.home="$XINDICE_HOME" -Dxindice.db.home="$XINDICE_DB_HOME" -Dxindice.configuration="$XINDICE_CONFIG" -Dorg.apache.commons.logging.Log="$LOGGER" -Dorg.apache.commons.logging.simplelog.defaultlog="$LOGLEVEL" -Dcmd.home="$XINDICE_HOME" -classpath "$CP" org.apache.xindice.tools.XMLTools $*