Author: rareddy
Date: 2009-07-23 14:51:36 -0400 (Thu, 23 Jul 2009)
New Revision: 1175
Added:
trunk/build/kit-runtime/bin/keystore.bat
trunk/build/kit-runtime/bin/keystore.sh
Modified:
trunk/build/kit-runtime/bin/run.bat
trunk/build/kit-runtime/bin/run.sh
trunk/build/kit-runtime/bin/shutdown.bat
Log:
TEIID-729: No longer creates a keystore by running the server script. To generate the key
user must run the keystore.sh or keystore.bat script file.
Added: trunk/build/kit-runtime/bin/keystore.bat
===================================================================
--- trunk/build/kit-runtime/bin/keystore.bat (rev 0)
+++ trunk/build/kit-runtime/bin/keystore.bat 2009-07-23 18:51:36 UTC (rev 1175)
@@ -0,0 +1,71 @@
+@echo off
+rem
+rem This script file encrypts the passed in clear text and spits out encypted form
+rem
+
+@if not "%ECHO%" == "" echo %ECHO%
+@if "%OS%" == "Windows_NT" setlocal
+
+if "%OS%" == "Windows_NT" (
+ set "DIRNAME=%~dp0%"
+) else (
+ set DIRNAME=.\
+)
+
+pushd %DIRNAME%..
+if "x%TEIID_HOME%" == "x" (
+ set "TEIID_HOME=%CD%"
+)
+popd
+
+set DIRNAME=
+
+if "x%JAVA_HOME%" == "x" (
+ set JAVA=java
+ echo JAVA_HOME is not set. Unexpected results may occur.
+ echo Set JAVA_HOME to the directory of your local JDK to avoid this message.
+) else (
+ set "JAVA=%JAVA_HOME%\bin\java"
+ if exist "%JAVA_HOME%\lib\tools.jar" (
+ set "JAVAC_JAR=%JAVA_HOME%\lib\tools.jar"
+ )
+)
+
+set
TEIID_CLASSPATH=%TEIID_HOME%\lib\patches\*;%TEIID_HOME%\deploy;%TEIID_HOME%\client\*;%TEIID_HOME%\lib\*;
+set KEYSTORE_FILE=%TEIID_HOME%\deploy\teiid.keystore
+
+if "x%1%" == "x" (
+ goto prompt
+) else (
+ if "%1%" == "-create" (
+ if not exist %KEYSTORE_FILE% (
+ "%JAVA%" -classpath "%TEIID_CLASSPATH%"
com.metamatrix.common.util.crypto.CryptoUtil -genkey %KEYSTORE_FILE%
+ echo A new key with keystore generated at %KEYSTORE_FILE%
+ ) else (
+ echo %KEYSTORE_FILE% already exists. Delete the current one if you would like to
create a new keystore.
+ )
+ ) else (
+ if "%1%" == "-encrypt" (
+ if NOT "x%2%" == "x" (
+ if exist %KEYSTORE_FILE% (
+ "%JAVA%" -classpath "%TEIID_CLASSPATH%"
com.metamatrix.common.util.crypto.CryptoUtil -key %KEYSTORE_FILE% -encrypt %2%
+ ) else (
+ echo %KEYSTORE_FILE% not found. Create a keystore first by using
+ echo usage:%0% -create
+ )
+ ) else (
+ goto prompt
+ )
+ ) else (
+ goto prompt
+ )
+ )
+)
+goto end
+
+:prompt
+ echo usage:%0% -create
+ echo usage:%0% -encrypt plain-text-password
+goto end
+
+:end
\ No newline at end of file
Added: trunk/build/kit-runtime/bin/keystore.sh
===================================================================
--- trunk/build/kit-runtime/bin/keystore.sh (rev 0)
+++ trunk/build/kit-runtime/bin/keystore.sh 2009-07-23 18:51:36 UTC (rev 1175)
@@ -0,0 +1,83 @@
+#!/bin/sh
+
+DIRNAME=`dirname $0`
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false;
+linux=false;
+case "`uname`" in
+ CYGWIN*)
+ cygwin=true
+ ;;
+
+ Linux)
+ linux=true
+ ;;
+esac
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin ; then
+ [ -n "$TEIID_HOME" ] &&
+ TEIID_HOME=`cygpath --unix "$TEIID_HOME"`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+fi
+
+# Setup TEIID_HOME
+if [ "x$TEIID_HOME" = "x" ]; then
+ # get the full path (without any relative bits)
+ TEIID_HOME=`cd $DIRNAME/..; pwd`
+fi
+export TEIID_HOME
+
+# Setup the JVM
+if [ "x$JAVA" = "x" ]; then
+ if [ "x$JAVA_HOME" != "x" ]; then
+ JAVA="$JAVA_HOME/bin/java"
+ else
+ JAVA="java"
+ fi
+fi
+
+TEIID_CLASSPATH="$TEIID_HOME/lib/patches/*:$TEIID_HOME/deploy:$TEIID_HOME/client/*:$TEIID_HOME/lib/*"
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+ TEIID_HOME=`cygpath --path --windows "$TEIID_HOME"`
+ JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
+ TEIID_CLASSPATH=`cygpath --path --windows "$TEIID_CLASSPATH"`
+fi
+
+prompt() {
+ echo "usage:$0 -create"
+ echo "usage:$0 -encrypt <plain-text-password> "
+}
+
+KEYSTORE_FILE=$TEIID_HOME/deploy/teiid.keystore
+
+if [ $# -eq 0 ]
+then
+ prompt;
+else
+ if [ "${1}" = "-create" ]
+ then
+ # generate teiid.keystore if does not exist.
+ if [ ! -f $KEYSTORE_FILE ]; then
+ "$JAVA" -classpath $TEIID_CLASSPATH
com.metamatrix.common.util.crypto.CryptoUtil -genkey $KEYSTORE_FILE
+ echo "A new key with keystore generated at $KEYSTORE_FILE"
+ else
+ echo "$KEYSTORE_FILE already exists. Delete the current one if you would like to
create a new keystore"
+ fi
+ else
+ if [ "${1}" = "-encrypt" -a "${2}" != "" ];
then
+ if [ -f $KEYSTORE_FILE ]; then
+ "$JAVA" -classpath $TEIID_CLASSPATH
com.metamatrix.common.util.crypto.CryptoUtil -key $KEYSTORE_FILE -encrypt $2
+ else
+ echo "$KEYSTORE_FILE not found. Create a keystore first by using
"
+ echo "$0 -create"
+ fi
+ else
+ prompt
+ fi
+ fi
+fi
Modified: trunk/build/kit-runtime/bin/run.bat
===================================================================
--- trunk/build/kit-runtime/bin/run.bat 2009-07-23 17:54:32 UTC (rev 1174)
+++ trunk/build/kit-runtime/bin/run.bat 2009-07-23 18:51:36 UTC (rev 1175)
@@ -47,13 +47,6 @@
rem JPDA options. Uncomment and modify as appropriate to enable remote debugging.
rem set JAVA_OPTS=%JAVA_OPTS% -Xdebug
-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y
-rem Generate teiid.keystore file
-set KEYSTORE_FILE=%TEIID_HOME%\deploy\teiid.keystore
-if not exist %KEYSTORE_FILE% (
- %JAVA%" -classpath "%TEIID_CLASSPATH%"
com.metamatrix.common.util.crypto.CryptoUtil -genkey %KEYSTORE_FILE%
- echo A new key with keystore generated at %KEYSTORE_FILE%
-)
-
cd %TEIID_HOME%
set JAVA_OPTS=%JAVA_OPTS% -Dteiid.home=%TEIID_HOME%
@@ -81,6 +74,4 @@
if ERRORLEVEL 10 goto RESTART
:END
-if "x%NOPAUSE%" == "x" pause
-:END_NO_PAUSE
Modified: trunk/build/kit-runtime/bin/run.sh
===================================================================
--- trunk/build/kit-runtime/bin/run.sh 2009-07-23 17:54:32 UTC (rev 1174)
+++ trunk/build/kit-runtime/bin/run.sh 2009-07-23 18:51:36 UTC (rev 1175)
@@ -67,13 +67,6 @@
TEIID_CLASSPATH=`cygpath --path --windows "$TEIID_CLASSPATH"`
fi
-# generate teiid.keystore if does not exist.
-KEYSTORE_FILE=$TEIID_HOME/deploy/teiid.keystore
-if [ ! -f $KEYSTORE_FILE ]; then
- "$JAVA" -classpath $TEIID_CLASSPATH
com.metamatrix.common.util.crypto.CryptoUtil -genkey $KEYSTORE_FILE
- echo "A new key with keystore generated at $KEYSTORE_FILE"
-fi
-
JAVA_OPTS="$JAVA_OPTS -Dteiid.home=$TEIID_HOME"
# Display our environment
Modified: trunk/build/kit-runtime/bin/shutdown.bat
===================================================================
--- trunk/build/kit-runtime/bin/shutdown.bat 2009-07-23 17:54:32 UTC (rev 1174)
+++ trunk/build/kit-runtime/bin/shutdown.bat 2009-07-23 18:51:36 UTC (rev 1175)
@@ -64,15 +64,8 @@
echo ===============================================================================
echo.
-:RESTART
"%JAVA%" %JAVA_OPTS% ^
- -classpath "%JBOSS_CLASSPATH%" ^
+ -classpath "%TEIID_CLASSPATH%" ^
-server ^
org.teiid.Shutdown %TEIID_HOME%\deploy.properties %JMX_PORT% %*
-if ERRORLEVEL 10 goto RESTART
-
-:END
-if "x%NOPAUSE%" == "x" pause
-
-:END_NO_PAUSE
Show replies by date