You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ma...@apache.org on 2015/01/27 11:52:31 UTC

stratos git commit: Fixed STRATOS-1145 - Create BAT file to run CLI in windows environment

Repository: stratos
Updated Branches:
  refs/heads/master 2a9e2d478 -> 9a2d8a92c


Fixed STRATOS-1145 - Create BAT file to run CLI in windows environment


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/9a2d8a92
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/9a2d8a92
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/9a2d8a92

Branch: refs/heads/master
Commit: 9a2d8a92ce272a9a185bb18622d7d3cb57077060
Parents: 2a9e2d4
Author: Manula Thantriwatte <ma...@apache.org>
Authored: Tue Jan 27 10:51:54 2015 +0000
Committer: Manula Thantriwatte <ma...@apache.org>
Committed: Tue Jan 27 10:51:54 2015 +0000

----------------------------------------------------------------------
 .../distribution/src/main/bin/stratos.bat       | 54 ++++++++++++++++++--
 1 file changed, 49 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/9a2d8a92/products/stratos-cli/distribution/src/main/bin/stratos.bat
----------------------------------------------------------------------
diff --git a/products/stratos-cli/distribution/src/main/bin/stratos.bat b/products/stratos-cli/distribution/src/main/bin/stratos.bat
index ed3c4f5..a63c43c 100644
--- a/products/stratos-cli/distribution/src/main/bin/stratos.bat
+++ b/products/stratos-cli/distribution/src/main/bin/stratos.bat
@@ -1,4 +1,5 @@
 @echo off
+
 rem ---------------------------------------------------------------------------
 rem  Licensed to the Apache Software Foundation (ASF) under one
 rem  or more contributor license agreements.  See the NOTICE file
@@ -21,16 +22,59 @@ rem  Main Script for Apache Stratos CLI
 rem
 rem  Environment Variable Prequisites
 rem
-rem   STRATOS_CLI_HOME   Home of Stratos CLI Tool
+rem   JAVA_HOME          Java home path
 rem
 rem   STRATOS_URL        The URL of the Stratos Controller
 rem ---------------------------------------------------------------------------
 
-rem ----- Only set STRATOS_CLI_HOME if not already set ----------------------------
+:checkStratoURL
+if "%STRATOS_URL%" == "" goto noStratosURL
+goto checkJava
+
+:noStratosURL
+echo "You must set the STRATOS_URL variable before running the CLI"
+goto end
+
+:checkJava
+if "%JAVA_HOME%" == "" goto noJavaHome
+if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
+goto checkServer
+
+:noJavaHome
+echo "You must set the JAVA_HOME variable before running CLI."
+goto end
+
+:checkServer
+rem %~sdp0 is expanded pathname of the current script under NT with spaces in the path removed
+if "%CARBON_HOME%"=="" set CARBON_HOME=%~sdp0..
+SET curDrive=%cd:~0,1%
+SET wsasDrive=%CARBON_HOME:~0,1%
+if not "%curDrive%" == "%wsasDrive%" %wsasDrive%:
+
+rem ----- update classpath -----------------------------------------------------
+:updateClasspath
+
+setlocal EnableDelayedExpansion
+cd %CARBON_HOME%
+set CARBON_CLASSPATH=
+FOR %%C in ("%CARBON_HOME%\lib\*.jar") DO set CARBON_CLASSPATH=!CARBON_CLASSPATH!;".\lib\%%~nC%%~xC"
+
+set CARBON_CLASSPATH="%JAVA_HOME%\lib\tools.jar";%CARBON_CLASSPATH%;
+
+set CMD=RUN %*
+
+rem ----------------- Execute The Requested Command ----------------------------
+
+:runServer
+cd %CARBON_HOME%
+set JAVA_ENDORSED="%JAVA_HOME%jre\lib\endorsed";"%JAVA_HOME%lib\endorsed"
 
-if "%STRATOS_CLI_HOME%"=="" set STRATOS_CLI_HOME=%CD%
+:runJava
+"%JAVA_HOME%\bin\java" -cp %CARBON_CLASSPATH% org.apache.stratos.cli.Main
 
-cd %STRATOS_CLI_HOME%
+:end
+goto endlocal
 
-rem TODO: Update according to stratos.sh
+:endlocal
+:END