Author: ivol37 at gmail.com Date: Tue Jan 18 09:54:32 2011 New Revision: 671
Log: [AMDATU-272] Added more tooling Added: trunk/amdatu-cassandra/cassandra-tools/src/main/resources/cassandra-cli trunk/amdatu-cassandra/cassandra-tools/src/main/resources/cassandra-cli.bat trunk/amdatu-cassandra/cassandra-tools/src/main/resources/clustertool trunk/amdatu-cassandra/cassandra-tools/src/main/resources/clustertool.bat Added: trunk/amdatu-cassandra/cassandra-tools/src/main/resources/cassandra-cli ============================================================================== --- (empty file) +++ trunk/amdatu-cassandra/cassandra-tools/src/main/resources/cassandra-cli Tue Jan 18 09:54:32 2011 @@ -0,0 +1,52 @@ +#!/bin/sh + +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ "x$CASSANDRA_INCLUDE" = "x" ]; then + for include in /usr/share/cassandra/cassandra.in.sh \ + /usr/local/share/cassandra/cassandra.in.sh \ + /opt/cassandra/cassandra.in.sh \ + ~/.cassandra.in.sh \ + `dirname $0`/cassandra.in.sh; do + if [ -r $include ]; then + . $include + break + fi + done +elif [ -r $CASSANDRA_INCLUDE ]; then + . $CASSANDRA_INCLUDE +fi + +# Use JAVA_HOME if set, otherwise look for java in PATH +if [ -x $JAVA_HOME/bin/java ]; then + JAVA=$JAVA_HOME/bin/java +else + JAVA=`which java` +fi + +if [ -z $CLASSPATH ]; then + echo "You must set the CLASSPATH var" >&2 + exit 1 +fi + +$JAVA -ea -cp $CLASSPATH -Xmx256M \ + -Dlog4j.configuration=log4j-tools.properties \ + -host ${cassandra.client.address} \ + -port ${cassandra.client.rpc_port} \ + org.apache.cassandra.cli.CliMain "$@" + +# vi:ai sw=4 ts=4 tw=0 et Added: trunk/amdatu-cassandra/cassandra-tools/src/main/resources/cassandra-cli.bat ============================================================================== --- (empty file) +++ trunk/amdatu-cassandra/cassandra-tools/src/main/resources/cassandra-cli.bat Tue Jan 18 09:54:32 2011 @@ -0,0 +1,51 @@ + at REM + at REM Licensed to the Apache Software Foundation (ASF) under one or more + at REM contributor license agreements. See the NOTICE file distributed with + at REM this work for additional information regarding copyright ownership. + at REM The ASF licenses this file to You under the Apache License, Version 2.0 + at REM (the "License"); you may not use this file except in compliance with + at REM the License. You may obtain a copy of the License at + at REM + at REM http://www.apache.org/licenses/LICENSE-2.0 + at REM + at REM Unless required by applicable law or agreed to in writing, software + at REM distributed under the License is distributed on an "AS IS" BASIS, + at REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + at REM See the License for the specific language governing permissions and + at REM limitations under the License. + + + at echo off +if "%OS%" == "Windows_NT" setlocal + +set CASSANDRA_HOME=. +if NOT DEFINED JAVA_HOME goto err + +REM Ensure that any user defined CLASSPATH variables are not used on startup +set CLASSPATH= + +REM For each jar in the CASSANDRA_HOME lib directory call append to build the CLASSPATH variable. +for %%i in ("%CASSANDRA_HOME%\lib\*.jar") do call :append "%%i" +goto okClasspath + +:append +set CLASSPATH=%CLASSPATH%;%1 +goto :eof + +:okClasspath +REM Include the build\classes directory so it works in development +set CASSANDRA_CLASSPATH=%CLASSPATH%;"%CASSANDRA_HOME%\build\classes" +goto runCli + +:runCli +echo Starting Cassandra Client +"%JAVA_HOME%\bin\java" -cp %CASSANDRA_CLASSPATH% org.apache.cassandra.cli.CliMain -host ${cassandra.client.address} -port ${cassandra.client.rpc_port} %* +goto finally + +:err +echo The JAVA_HOME environment variable must be set to run this program! +pause + +:finally + +ENDLOCAL Added: trunk/amdatu-cassandra/cassandra-tools/src/main/resources/clustertool ============================================================================== --- (empty file) +++ trunk/amdatu-cassandra/cassandra-tools/src/main/resources/clustertool Tue Jan 18 09:54:32 2011 @@ -0,0 +1,59 @@ +#!/bin/sh +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +if [ "x$CASSANDRA_INCLUDE" = "x" ]; then + for include in /usr/share/cassandra/cassandra.in.sh \ + /usr/local/share/cassandra/cassandra.in.sh \ + /opt/cassandra/cassandra.in.sh \ + `dirname $0`/cassandra.in.sh; do + if [ -r $include ]; then + . $include + break + fi + done +elif [ -r $CASSANDRA_INCLUDE ]; then + . $CASSANDRA_INCLUDE +fi + +# Use JAVA_HOME if set, otherwise look for java in PATH +if [ -x $JAVA_HOME/bin/java ]; then + JAVA=$JAVA_HOME/bin/java +else + JAVA=`which java` +fi + +if [ -z $CASSANDRA_CONF -o -z $CLASSPATH ]; then + echo "You must set the CASSANDRA_CONF and CLASSPATH vars" >&2 + exit 1 +fi + +# Special-case path variables. +case "`uname`" in + CYGWIN*) + CLASSPATH=`cygpath -p -w "$CLASSPATH"` + CASSANDRA_CONF=`cygpath -p -w "$CASSANDRA_CONF"` + ;; +esac + +$JAVA -cp $CLASSPATH \ + -Dlog4j.configuration=log4j-tools.properties \ + -h ${cassandra.client.address} \ + -p ${cassandra.client.jmxport} \ + org.apache.cassandra.tools.ClusterCmd $@ + +# vi:ai sw=4 ts=4 tw=0 et Added: trunk/amdatu-cassandra/cassandra-tools/src/main/resources/clustertool.bat ============================================================================== --- (empty file) +++ trunk/amdatu-cassandra/cassandra-tools/src/main/resources/clustertool.bat Tue Jan 18 09:54:32 2011 @@ -0,0 +1,67 @@ + at REM + at REM Licensed to the Apache Software Foundation (ASF) under one or more + at REM contributor license agreements. See the NOTICE file distributed with + at REM this work for additional information regarding copyright ownership. + at REM The ASF licenses this file to You under the Apache License, Version 2.0 + at REM (the "License"); you may not use this file except in compliance with + at REM the License. You may obtain a copy of the License at + at REM + at REM http://www.apache.org/licenses/LICENSE-2.0 + at REM + at REM Unless required by applicable law or agreed to in writing, software + at REM distributed under the License is distributed on an "AS IS" BASIS, + at REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + at REM See the License for the specific language governing permissions and + at REM limitations under the License. + + at echo off +if "%OS%" == "Windows_NT" setlocal + +set CASSANDRA_HOME=. +set CASSANDRA_CONF=%CASSANDRA_HOME%\conf +set CASSANDRA_MAIN=org.apache.cassandra.tools.ClusterCmd +if NOT DEFINED JAVA_HOME goto err + +REM ***** JAVA options ***** +set JAVA_OPTS=^ + -Dlog4j.configuration=log4j-tools.properties + +REM ***** CLASSPATH library setting ***** + +REM Ensure that any user defined CLASSPATH variables are not used on startup +set CLASSPATH=%CASSANDRA_HOME%\conf + +REM For each jar in the CASSANDRA_HOME lib directory call append to build the CLASSPATH variable. +for %%i in (%CASSANDRA_HOME%\lib\*.jar) do call :append %%~fi +goto okClasspath + +:append +set CLASSPATH=%CLASSPATH%;%1%2 +goto :eof + +:okClasspath +REM Include the build\classes directory so it works in development +set CASSANDRA_CLASSPATH=%CLASSPATH%;%CASSANDRA_HOME%\build\classes;%CASSANDRA_CONF% + +set CASSANDRA_PARAMS= +set TOOLS_PARAMS= + +FOR %%A IN (%*) DO call :appendToolsParams %%A + +goto runTool + +:appendToolsParams +set TOOLS_PARAMS=%TOOLS_PARAMS% %1 +goto :eof + +:runTool +"%JAVA_HOME%\bin\java" %JAVA_OPTS% %CASSANDRA_PARAMS% -cp "%CASSANDRA_CLASSPATH%" "%CASSANDRA_MAIN%" %TOOLS_PARAMS% -h ${cassandra.client.address} -p ${cassandra.client.jmxport} +goto finally + +:err +echo JAVA_HOME environment variable must be set! +pause + +:finally + +ENDLOCAL
