@Echo off

Rem   ---------------------------------------------------------------------------
Rem   JASMINe
Rem   Copyright (C) 2010 Bull S.A.S.
Rem   Contact: jasmine@ow2.org
Rem
Rem   This library is free software; you can redistribute it and/or
Rem   modify it under the terms of the GNU Lesser General Public
Rem   License as published by the Free Software Foundation; either
Rem   version 2.1 of the License, or any later version.
Rem
Rem   This library is distributed in the hope that it will be useful,
Rem   but WITHOUT ANY WARRANTY; without even the implied warranty of
Rem   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Rem   Lesser General Public License for more details.
Rem
Rem   You should have received a copy of the GNU Lesser General Public
Rem   License along with this library; if not, write to the Free Software
Rem   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
Rem   USA
Rem   ---------------------------------------------------------------------------
Rem   $Id: jasmine-agent.bat 9171 2011-10-13 14:30:56Z richardd $
Rem   ---------------------------------------------------------------------------

Rem Test JONAS_ROOT and JONAS_BASE

set JONAS_ROOT=%JASMINE_AGENT_PATH%

if ["%JONAS_ROOT%"]==[""] goto set_jonas_root
goto :args

:set_jonas_root
  echo Check that JASMINE_AGENT_PATH is set
goto :EOF

Rem ---------------------------------------------
Rem Get args
Rem ---------------------------------------------
:args

set JONAS_BASE=%JONAS_ROOT%
set PATH=%JONAS_ROOT%\bin;%PATH%

if [%1]==[]   goto no_arg
set ARGS=
:loop_on_args
set VALUE=%~1
if [%1]==[start]     goto start_arg
if [%1]==[stop]      goto stop_arg
set ARGS=%ARGS% %1
goto next_arg

:start_arg

Rem set OPTS=-Dhttp.proxyHost=
Rem set OPTS=%OPTS% -Dhttp.proxyPort=8080
Rem set OPTS=%OPTS% -Dhttp.nonProxyHosts="localhost|127.0.0.1"

jonas start -tui -n jasmine-agent -clean -bg -Djava.net.preferIPv4Stack=true -Djava.util.logging.config.file="%JONAS_BASE%\conf\dosgi-logging.properties" %OPTS%
goto :EOF

:stop_arg
jonas stop -n jasmine-agent
goto :EOF

:no_arg
echo No arguments specified.
goto usage

:usage
echo "jasmine-agent start | stop"
