#!/bin/bash
# -*- ksh -*-
# $Id: eventGUI,v 1.6 2011/11/30 22:54:32 jschwarz Exp $
#
# DESCRIPTION
#    Starts the ACS Event Browser
#
#
# OPTIONS
#    No options
#
#
# AUTHOR
#    Joseph Schwarz, 30 June 2010

. acsstartupAcsPorts
. acsstartupConstants
. acsstartupAcsInstance

#Set the port numbers...
ACS_MANAGER_PORT=`getManagerPort`
ACS_MANAGER_PORT=`getManagerPort`
ACS_NAMING_SERVICE_PORT=`getNamingServicePort`
ACS_IR_PORT=`getIRPort`
export HOST=`getIP`

if [ X"$MANAGER_REFERENCE" = X ]; then  
   export MANAGER_REFERENCE=corbaloc::$HOST:$ACS_MANAGER_PORT/Manager
fi

ACS_LOG_DEBUG "acsStartJava" "ACS Manager: $MANAGER_REFERENCE"

export MANAGER_COMPUTER_NAME=`echo $MANAGER_REFERENCE | awk -F: '{print $3}'`

# If $ACS_NAME_SERVICE is not set, take the computer
# where Manager is located

if [ X"$ACS_NAME_SERVICE" = X ]; then
   export ACS_NAME_SERVICE=corbaloc::$MANAGER_COMPUTER_NAME:$ACS_NAMING_SERVICE_PORT/NameService
fi

ACS_LOG_DEBUG "acsStartJava" "ACS Name Service: $ACS_NAME_SERVICE"

#If $ACS_INTERFACE_REPOSITORY is not set, take the computer, where Manager
#is located

if [ X"$ACS_INTERFACE_REPOSITORY" = X ]; then
   export ACS_INTERFACE_REPOSITORY=corbaloc::$MANAGER_COMPUTER_NAME:$ACS_IR_PORT/InterfaceRepository
fi

dir=$(searchFile bin/eventGUI)

$dir/lib/ACS_eventGUI/eventGUI \
     -consoleLog \
     -vmargs \
     -DACS.repository=$ACS_INTERFACE_REPOSITORY \
     -DACS.manager=$MANAGER_REFERENCE \
     -DORBInitRef.NameService=$ACS_NAME_SERVICE \
     -DACS.tmp=$ACS_TMP \
     -Dorg.omg.CORBA.ORBClass=org.jacorb.orb.ORB \
     -Dorg.omg.CORBA.ORBSingletonClass=org.jacorb.orb.ORBSingleton \
     $JAVA_OPTIONS


