#!/bin/sh
#set -xv
# ---------------------------------------------------------------------------
# JOnAS: Java(TM) Open Application Server
# Copyright (C) 2006 Bull S.A.S.
# Contact: jonas-team@objectweb.org
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
# USA
#
# Initial developer(s): Guillaume Sauthier
#
# ---------------------------------------------------------------------------
# $Id: env.sh.include 11267 2007-08-08 16:51:45Z sauthieg $
# ---------------------------------------------------------------------------

# Environment
# --------------------------------
JONAS_ROOT=@JONAS_ROOT@
export JONAS_ROOT
SERVER_NAME=jonas
export SERVER_NAME

# Allow that script to be executed without hard-writing
# the JVM and Ant version to use
VAR_HOME_SET=@VAR_HOME_SET@

# Fix the JAVA_HOME value
if [ "$VAR_HOME_SET" = "true" ]; then
#JAVA_HOME=@JAVA_HOME@
#export JAVA_HOME
    echo -n
fi
# Fix the ANT_HOME value
if [ "$VAR_HOME_SET" = "true" ]; then
#ANT_HOME=@ANT_HOME@
#export ANT_HOME
    echo -n
fi


# JVM Memory options
# ---------------------------------
# example : 128m
INI_HEAP_SIZE=""
MAX_HEAP_SIZE=""
THREAD_STACK_SIZE=""

[ "$INI_HEAP_SIZE" != ""  ] && JAVA_OPTS=$JAVA_OPTS" -Xms"$INI_HEAP_SIZE
[ "$MAX_HEAP_SIZE" != ""  ] && JAVA_OPTS=$JAVA_OPTS" -Xmx"$MAX_HEAP_SIZE
[ "$THREAD_STACK_SIZE" != ""  ] && JAVA_OPTS=$JAVA_OPTS" -Xss"$THREAD_STACK_SIZE

# JVM Misc Options
# --------------------------------
# Uncomment the following line
#JAVA_OPTS=$JAVA_OPTS" -Dyour.property=value"

export JAVA_OPTS

# Classpath
# --------------------------------
if [ "$CLASSPATH" != "" ]; then
    S="\033[1;31m"
    E="\033[0m"
    printf "${S}Warning : CLASSPATH should be empty with JOnAS !$E\n"
    printf "Please use ${S}JONAS_BASE/lib/apps$E or ${S}JONAS_BASE/lib/commons$E ...\n"
fi
# You may add jars here, but this is not recommended
CLASSPATH=$CLASSPATH
export CLASSPATH

# Script Debug
# --------------------------------
if [ "$ENV_DEBUG" = "yes" ]; then
    echo "* -------------------------------------------"
    echo "* Returned by $0 :"
    echo "* JONAS_ROOT  = $JONAS_ROOT"
    echo "* SERVER_NAME = $SERVER_NAME"
    echo "* JAVA_HOME   = $JAVA_HOME"
    echo "* ANT_HOME    = $ANT_HOME"
    echo "* JAVA_OPTS   = $JAVA_OPTS"
    echo "* CLASSPATH   = $CLASSPATH"
    echo "* -------------------------------------------"
fi
