@echo OFF
rem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
rem JaDOrT: JASMINe Deployment Orchestration Tool
rem Copyright (C) 2008-2009 Bull S.A.S.
rem Copyright (C) 2008-2009 France Telecom R&D
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-117
rem USA
rem
rem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
rem $Id: example_maintain.bat 3536 2009-04-23 13:10:06Z alitokmen $
rem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

rem the JaDOrT Console JAR command, change the path as needed
set cmd=java -jar target\jadort-console-1.3.0-SNAPSHOT-jar-with-dependencies.jar

%cmd% createNewOperation test_maintain

rem use 1 as operationId because we are not able to put the return of the last command on a local variable
%cmd% loadTopology 1 "%~dp0\..\jadort-documentation-and-samples\src\main\resources\Topology with JOnAS servers.xml"
%cmd% getGroups 1
%cmd% selectGroup 1 "xyleme-MyStore"
%cmd% selectOperationType 1 "MAINTAIN"
%cmd% getSelectedGroup 1
%cmd% selectServers 1 "jonas1" "jonas2" 

rem Go to the first maintenance step: stop workers / wait for all sessions to end
%cmd% next 1
%cmd% getServerProgressList 1

rem You have to wait for ' canGoNextToNextStep 1 == 1" (1 = true)
pause

rem Go to the second maintenance step: stop servers / stop workers
%cmd% next 1
%cmd% getServerProgressList 1

rem etc.
