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

#
# Script name: cyflex_reporting
#
# Purpose: Generate a report file, for example plain text or HTML, based
#    on a template file and CyFlex label values.
#
# Invoking arguments:
#    -connection CONNECTION  Optional - CyFlex connection.
#                            Default - "local". Mainly for testing.
#    -object_name NAME       Optional - Name of references in template
#                            file. Default "facade"
#    -input OUTPUT           Input template file
#
# Output:
#    Output sent to standard out.
#
# Notes:
#    Based on the Velocity open-source report generation package.
#
# History:
#   05/02/11 - Rob Janes - Initial release.
#

if (( $# == 0 )); then
cat <<eod

Usage: cyflex_reporting -input template.html -output report.html -object_name cyflex
eod
exit 1
fi

. configure_java

# Shell variables must begin with a letter.  So this can not be called
# 3RDPARTY.  D is for Directory.
D3RDPARTY=$D3
SPECFILEGUI=$GUI
PROPERTIES="-DPropertiesFile=$CELL/cui_properties.txt"

# Jar files are listing in approximate order of their use.
CLASSPATH=\
$SPECFILEGUI/applications.jar\
:$SPECFILEGUI/specfilegui.jar\
:$SPECFILEGUI/facade.jar\
:$D3RDPARTY/velocity-1.6.1-dep.jar\
:$D3RDPARTY/iText-5.0.2.jar\
:$D3RDPARTY/protobuf.jar\
:$D3RDPARTY/jcmdline.jar
export CLASSPATH

chrt -o 0 java -Xms128m -Xmx256m $PROPERTIES \
   com.cybermetrix.cyflex.applications.VelocityCyFlexInterface $*
