#!/bin/sh

# Copyright  2004 Sun Microsystems, Inc. All rights reserved. 
# 
# Sun Microsystems, Inc. has intellectual property rights relating to
# technology embodied in the product that is described in this document.
# In particular, and without limitation, these intellectual property rights
# may include one or more of the U.S. patents listed at
# http://www.sun.com/patents and one or more additional patents or pending
# patent applications in the U.S. and in other countries.
# 
# U.S. Government Rights - Commercial software. Government users are subject
# to the Sun Microsystems, Inc. standard license agreement and applicable
# provisions of the FAR and its supplements.
# 
# Use is subject to license terms. 
# 
# This distribution may include materials developed by third parties. Sun,
# Sun Microsystems, the Sun logo, Java and Sun[tm] ONE are trademarks or
# registered trademarks of Sun Microsystems, Inc. in the U.S. and other
# countries. 
# 
# Copyright  2004 Sun Microsystems, Inc. Tous droits rservs. Sun
# Microsystems, Inc. dtient les droits de proprit intellectuels relatifs
#  la technologie incorpore dans le produit qui est dcrit dans ce document.
# En particulier, et ce sans limitation, ces droits de proprit
# intellectuelle peuvent inclure un ou plus des brevets amricains lists
#  l'adresse http://www.sun.com/patents et un ou les brevets supplmentaires
# ou les applications de brevet en attente aux Etats - Unis et dans les
# autres pays.
# 
# L'utilisation est soumise aux termes du contrat de licence.
# 
# Cette distribution peut comprendre des composants dvelopps par des
# tierces parties.
# 
# Sun, Sun Microsystems, le logo Sun, Java et Sun[tm] ONE sont des marques
# de fabrique ou des marques dposes de Sun Microsystems, Inc. aux
# Etats-Unis et dans d'autres pays.


#DP_HOME=${BASE_DIR}/${PRODUCT_DIR}/web-apps/services/WEB-INF
DP_HOME=${BASE_DIR}/${PRODUCT_DIR}
JAVA_HOME=${JDK_BASE_DIR}

JSS_HOME=JSSHOME
JAXP_HOME=${DP_HOME}/lib

JSS_SO_PATH=TAG_JSS_SO_PATH
JSS_JAR_PATH=TAG_JSS_JAR_PATH
OSTYPE=`/bin/uname -s`

if [ -z "${JAVA_HOME}" ] ; then
    if [ -d /usr/java ] ; then
        JAVA_HOME=/usr/java
    else
        echo "JAVA_HOME environment variable not set." 1>&2
        exit 1
    fi
fi

JSS_JAR="${JSS_JAR_PATH}/jss3.jar"
DPADMIN_JAR=${DP_HOME}/lib/am_sdk.jar:${DP_HOME}/lib/am_services.jar
LOCALE_HOME=${DP_HOME}/locale
DP_CONFIG=${DP_HOME}/config
DP_LIB=${DP_HOME}/lib
AM_CONFIG=IS_INSTALL_ETCDIR/IS_PRODNAME/config
SSO_CONFIG=${DP_CONFIG}/amadmin
JAXP_JARS=${JAXP_HOME}/jaxp-api.jar:${JAXP_HOME}/xercesImpl.jar:${JAXP_HOME}/sax.jar:${JAXP_HOME}/xalan.jar:${JAXP_HOME}/dom.jar
SERVLET_JAR=${DP_HOME}/lib/servlet.jar
MAIL_JARS=${DP_HOME}/lib/mail.jar:${DP_HOME}/lib/activation.jar
JAAS_JAR=${DP_HOME}/lib/jaas.jar


DP_CLASSPATH=${SSO_CONFIG}:${LOCALE_HOME}:${DPADMIN_JAR}:${AM_CONFIG}:${DP_LIB}:${DP_HOME}/lib/preference_servlet.jar:${DP_HOME}/lib/acm.jar:${XML_JAR}:${JSS_JAR}:${JAXP_JARS}:${SERVLET_JAR}:${MAIL_JARS}:${JAAS_JAR}
if [ -z "$CLASSPATH" ]
then
  CLASSPATH="${DP_CLASSPATH}:${JAVA_HOME}/lib/lib.zip"
else
  CLASSPATH="${DP_CLASSPATH}:$CLASSPATH"
fi

# Setup proper LD_LIBRARY_PATH if not already set
if [ -z "$LD_LIBRARY_PATH" ] ; then
	LD_LIBRARY_PATH="$DP_HOME/lib:$JSS_SO_PATH"
else
	LD_LIBRARY_PATH="$DP_HOME/lib:$JSS_SO_PATH:$LD_LIBRARY_PATH"
fi

if [ "$OSTYPE" = "Linux" ]; then
	LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JAVA_HOME/jre/lib/i386/native_threads
fi

export LD_LIBRARY_PATH
${JAVA_HOME}/bin/java -Xms64m -Xmx256m -classpath ${CLASSPATH} com.iplanet.services.ldap.ServerConfigMgr "$@"
