[xep-support] RFC: Alternate XEP Wrapper for UNIX

Peter Bray xep-support at illumino.com.au
Wed Apr 2 17:13:19 PST 2003


Greetings All,

	Attached is an alternate wrapper script for XEP 3.x (for systems
using the *.sh scripts). I would greatly appreciate if others could
comment on it, suggest enhancements etc, so that one day it might be
considered a suitable replacement for the current shell scripts supplied
with XEP.

My drivers for writing a replacement including:

	- The ability to have a generic script in my PATH which
	  can handle any version of XEP.
	- Better naming convention for the XEP entry points.
	  ( I use XEP from GNU Make files and like them to be
	  both XEP version independent and as clear as possible )
	- Support for java memory options to be specified at run-time.
	- Support for concurrent installation of XEP (ie multiple versions
	  - which is actually better supported in the original version
          of the script - see the later part of the attached file)
	- Bug that *.sh script do not get the executable bit set on
	  installation.

Possible issues with the current release:

	- May have to set JAVA_HOME to XEP_JAVA_HOME (this is not
          required for Sun JDK 1.3/1.4 on Solaris Intel - your mileage
	  may vary)
	- Removal of support for com.render.xep.Driver
	- Additional error catching code to support other systems
	  (or to catch assumptions I've made which may not be true)

Installation

	- Place the script in a directory in your PATH
	- Make it executable (chmod +x xep-wrapper)
	- Create symlinks to it as described at the top of the script
	- Update the variables in the configuration section for your site
	- Execute in debugging mode first to validate the
	  constructed command line. Example:
		DO=echo xep-xsldriver -fo  <my_fo_filename>
	- Execute the command for real and validate the results
	- Experiment with the environment variables:
		XEP_JAVA_OPTIONS
		XEP_JAVA_CLASSPATH
		XEP_DIST_HOME
		XEP_MAIN_JARFILE
		XEP_JAVA_HOME

	The following is an example of a command line generated by my
Makefile:

XEP_JAVA_OPTIONS="-Xmx150m -Xms150m" xep-xsldriver -fo SystemAdministration.fo-saxon-xep


Comments and suggestions most welcome,

Peter Bray
Sydney, Australia
-------------- next part --------------
#!/bin/sh
#
# Shell Wrapper for RenderX's XEP (http://www.renderx.com/)
#
#
# One-time setup:
#       ln -s xep-wrapper xep
#       ln -s xep-wrapper xep-validate
#       ln -s xep-wrapper xep-transform
#	ln -s xep-wrapper xep-xsldriver
#
# Usage:
#       xep           <app args>...
#       xep-validate  <app args>...
#       xep-transform <app args>...
#       xep-xsldriver <app args>...
#
#
# $Id: xep-wrapper,v 1.6 2003/03/27 05:21:08 software Exp $
#

#
# Configuration
#
XEP_DIST_HOME=${XEP_DIST_HOME:-/pkgs/xep-3.3.1}
XEP_MAIN_JARFILE=${XEP_MAIN_JARFILE:-xep331_client.jar}
XEP_JAVA_HOME=${XEP_JAVA_HOME:-/pkgs/j2sdk-1.4.1/jre}

#
# User Run-Time Configuration
#
# Examples:
# XEP_JAVA_OPTIONS="-Xmx120m -Xms120m"
# XEP_JAVA_CLASSPATH="/path/file1.jar:/path/file2.jar"
#

#
# Setup and verify configuration
#

if [ ! -d "${XEP_DIST_HOME}" ]
then
    echo "${0}: Unable to find XEP distribution (${XEP_DIST_HOME}) - Aborting"
    exit 1
fi

if [ ! -d "${XEP_JAVA_HOME}" ]
then
    echo "${0}: Unable to find Java distribution (${XEP_JAVA_HOME}) - Aborting"
    exit 2
fi

xep_lib="${XEP_DIST_HOME}/lib"

xep_classpath="${XEP_JAVA_CLASSPATH}"

for jarfile in		\
    tools.jar		\
    ${XEP_MAIN_JARFILE}	\
    cryptix32.jar	\
    cryptix32-pgp.jar	\
    saxon.jar		\
    xt.jar
do
    if [ "${jarfile}" != "tools.jar" -a ! -f "${xep_lib}/${jarfile}" ]
    then
        echo "${0}: Unable to find ${xep_lib}/${jarfile} - Aborting"
        exit 3
    fi
    xep_classpath="${xep_classpath}:${xep_lib}/${jarfile}"
done

application=`basename ${0}`

case "${application}" in

    xep)              xep_main=com.renderx.xep.Driver		;;
    xep-xsldriver)    xep_main=com.renderx.xep.XSLDriver	;;
    xep-validate)     xep_main=com.renderx.xep.JAXPDriver	;;
    xep-transform)    xep_main=com.renderx.xep.Validator	;;

    *)
        echo "$0: Unknown XEP application : ${application} - Aborting"
        exit 4;
esac

#
# Run with DO=echo to see the generated command line
#
${DO} ${XEP_JAVA_HOME}/bin/java				\
    ${XEP_JAVA_OPTIONS}					\
    -classpath "${xep_classpath}"			\
    -Dcom.renderx.xep.ROOT="${XEP_DIST_HOME}"		\
    ${xep_main} "${@}"

exit

#
# The original script
#

XEP_DIST=${XEP_DIST:-/pkgs/xep-3.3.1}

#
# Lets keep it simple and use the installation generated shell scripts
# (Thus this wrapper style simply provides a convenient name
#  and location independence)
#

application=`basename ${0}`

case "${application}" in

    xep)              XEP_SCRIPT=run.sh        ;;
    xep-xsldriver)    XEP_SCRIPT=xep.sh        ;;
    xep-validate)     XEP_SCRIPT=validate.sh   ;;
    xep-transform)    XEP_SCRIPT=transform.sh  ;;

    *)
        echo "$0: Unknown XEP application : ${application} - Aborting"
        exit 1;
esac

exec ${XEP_DIST}/${XEP_SCRIPT} "${@}"


More information about the Xep-support mailing list