#! /bin/bash
cyflexlogevent -t generic -m 1 -m "script" -m "$0" 

# $Version: 6.3.0       $


#
# Script name: launcher xml_file [icon_path]
#
# Purpose: Bring up the program launcher.
#
# xml_file - The xml file containing the launcher configuration.
# icon_path - Optional directory containing icons to be displayed.
#
# Notes: If no arguments are given, brief usage information is output.
#
# History:
#    09/12/07 - Rob Janes - Initial release.
#

. configure_java

BASE=$CYFLEX

# No arguments - output usage information.
if (( $# < 1 )); then
   echo 'Usage: launcher XML_FILE [ICON_PATH]'
   echo '   where:'
   echo '      XML_FILE is an XML file containing launcher information.'
   echo '      ICON_PATH is an optional entry pointing to a directory'
   echo '         containing icons for display by the launcher.'
   echo
   exit 0
fi

# The first comment line argument must be an existing file.
if [ ! -f $1 ]; then
   echo The 1st argument must be an existing file.
   exit 7
fi

# Two arguments means there's an icon path argument.
if (( $# == 2 )) ; then
   if [ ! -d $2 ]; then
      echo The 2nd argument must be an existing directory.
      exit 7
   fi
   ICON_PATH=$2
fi

XSD_FILE=$GUI/xmlfiles/launcher.xsd

CLASSPATH=$GUI/applications.jar:$GUI/specfilegui.jar
export CLASSPATH
java com.cybermetrix.cyflex.applications.Launcher $1 $XSD_FILE $ICON_PATH
