#!/bin/sh
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
#
# Copyright (c) 2013 Open Source Solution Technology Corporation
# All Rights Reserved
#
# The contents of this file are subject to the terms
# of the Common Development and Distribution License
# (the License). You may not use this file except in
# compliance with the License.
#
# You can obtain a copy of the License at
# http://forgerock.org/license/CDDLv1.0.html
# See the License for the specific language governing
# permission and limitations under the License.
#
# When distributing Covered Code, include this CDDL
# Header Notice in each file and include the License file
# at http://forgerock.org/license/CDDLv1.0.html
# If applicable, add the following below the CDDL Header,
# with the fields enclosed by brackets [] replaced by
# your own identifying information:
# "Portions Copyrighted [year] [name of copyright owner]"
#

function usage {
  echo "Usage: ssoconfigurator -f|--file configuration file"
  echo ""
}

if [ $# -eq 3 ] ; then
  usage
  exit
fi

if [ "$1" = "-f" -o "$1" = "--file"  ] ; then
  config="$2"
fi

if [ "$config" = "" ] ; then
  usage
  exit
fi

if [ -z "$JAVA_HOME" ] ; then
        JAVA_HOME="/usr/lib/jvm/jre-1.7.0"
fi

TOOLS_HOME="/opt/osstech/share/openam11/ssoConfigTools"

CLASSPATH="$TOOLS_HOME/lib/openam-configurator-tool-11.0.0.jar"

$JAVA_HOME/bin/java -Xms256m -Xmx512m -cp "$CLASSPATH" \
    com.sun.identity.setup.OpenSSOConfigurator -f $config 
