Permalink
Browse files

Initial copy of maglev repository, before Allen's change to use new p…

…ack-unpack
  • Loading branch information...
1 parent e377567 commit 6a86d67620abcd7d10c58b1a5cf4860af3cf3883 Monty Williams committed Jul 21, 2008
Showing 2,722 changed files with 625,579 additions and 1 deletion.
View
@@ -0,0 +1,6 @@
+# You don't have to do this unless you're building it from scratch
+# This has already been done in the external distribution
+- Unzip a gemstone product distribution into the gemstone/ directory
+- Copy the ruby extent from gemstone/bin to data/extent0.ruby.dbf
+- Copy a key to etc/maglev.demo.key
+- Load MagLev-avi.170.mcz or later
View
@@ -0,0 +1,40 @@
+Quick Start:
+
+You can run everything in MagLev using the 'gemstone' bash script in the bin subdirectory.
+For best results, set MAGLEV_HOME, and add $MAGLEV_HOME/bin to your PATH
+
+Usage:
+gemstone {start|start-debug|stop|restart|status|topaz|ruby|squeak|preload|force-reload|help}
+
+First, control the GemStone server from one terminal session:
+gemstone start - Start GemStone server processes
+gemstone start-debug - Start GemStone server processes with verbose output
+gemstone start-parser - Force parser process to start if it's dead
+gemstone stop - Stop GemStone server processes
+gemstone restart - Restart GemStone server processes
+gemstone status - Display GemStone server status
+gemstone preload <file> - Load and commit a file into an already running system
+gemstone force-reload - Stop GemStone server, overwrite with empty repository!!!
+
+Next, in a second terminal session, run other gemstone commands:
+gemstone ruby <file> - Execute a Ruby file
+gemstone topaz - Enter a Topaz shell
+gemstone topaz-debug - Enter a Topaz shell useful for debugging
+gemstone squeak - Start optional Squeak development environment
+gemstone help - Display this text
+
+Note:
+- set MAGLEV_HOME to the full path of this directory, and add $MAGLEV_HOME/bin to your PATH.
+ Then you can use "gemstone ruby" etc from anywhere.
+- if you have multiple installations, set JRUBY_PORT to control
+ which port the parser server listens on
+- the first (and ony the first) time you run a gemstone command that runs Ruby code,
+ it will load and compile prims.rb, which takes up to a minute to run.
+- gemstone ruby prints a topaz banner every time it is run. This will be fixed in a
+ future release. If you run "gemstone topaz" and then "maglev" you'll be in an irb-like
+ environment, and you won't get a banner on every command.
+
+Ruby code:
+- src/ and src/lib/ are both on the require path
+- src/kernel/ has the core Array, String etc files
+
View
@@ -0,0 +1,304 @@
+#!/bin/bash
+#
+# Runs GemStone scripts that used to be invoked as individual commands
+
+# Environment variable settings
+if [ -z "$MAGLEV_HOME" ]; then
+ if [ -x $PWD/gemstone/bin/startstone ]; then
+ # echo "using $PWD as MAGLEV_HOME"
+ export MAGLEV_HOME=$PWD
+ else
+ echo "$PWD is not a valid MAGLEV_HOME directory"
+ echo "To fix this, set a valid MAGLEV_HOME in your .bashrc"
+ exit 1
+ fi
+fi
+#
+if [ -z "$JRUBY_PORT" ]; then
+ # echo "using 2000 as JRUBY_PORT"
+ export JRUBY_PORT=2000
+fi
+#
+if [ -z "$JAVA_HOME" ]; then
+ # for MacOSX use current installed Java
+ if [[ "`uname -sr | cut -f1 -d '.'`" = "Darwin 9" && -e /Library/Java/Home ]]; then
+ export JAVA_HOME=/Library/Java/Home
+ else
+ # for Linux use either java-1.5 or java-6
+ if [ -e /usr/lib/jvm/java-1.5.0-sun ]; then
+ export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun
+ else
+ if [ -e /usr/lib/jvm/java-6-sun ]; then
+ export JAVA_HOME=/usr/lib/jvm/java-6-sun
+ fi
+ fi
+ fi
+fi
+#
+export GEMSTONE_GLOBAL_DIR=$MAGLEV_HOME
+export GEMSTONE_SYS_CONF=$MAGLEV_HOME/etc/system.conf
+export GEMSTONE_LOG=$MAGLEV_HOME/log/gs64stone.log
+export GEMSTONE=$MAGLEV_HOME/gemstone
+export TOPAZ_CMD="$GEMSTONE/bin/topaz -q -I $MAGLEV_HOME/etc/.topazini -l "
+export TOPAZDEBUG_CMD="$GEMSTONE/bin/topaz -I $MAGLEV_HOME/etc/.topazdebugini -l "
+export JRUBY_HOME=$MAGLEV_HOME/bin
+
+# Commands
+startserver() {
+ $GEMSTONE/bin/startnetldi -g &>/dev/null
+ $GEMSTONE/bin/startstone gs64stone &>/dev/null
+ $GEMSTONE/bin/waitstone gs64stone &>/dev/null
+ echo "GemStone server gs64stone started"
+}
+
+startserver-debug() {
+ $GEMSTONE/bin/startnetldi -g
+ $GEMSTONE/bin/startstone -z $MAGLEV_HOME/etc/system-debug.conf gs64stone
+ $GEMSTONE/bin/waitstone gs64stone
+ echo "GemStone server gs64stone started in verbose mode"
+}
+
+startparser() {
+ if [ -z "`lsof -Fp -iTCP:${JRUBY_PORT}`" ]; then
+ nohup $MAGLEV_HOME/bin/jruby $MAGLEV_HOME/bin/parser.rb \
+ >$MAGLEV_HOME/log/parser.log 2>/dev/null &
+ PARSER_PID="$!"
+ echo "MagLev Parse Server process $PARSER_PID started on port $JRUBY_PORT"
+ else
+ echo "MagLev Parse Server process already running on port $JRUBY_PORT"
+ fi
+}
+
+forceparser() {
+ nohup $MAGLEV_HOME/bin/jruby $MAGLEV_HOME/bin/parser.rb \
+ >$MAGLEV_HOME/log/parser.log 2>/dev/null &
+ PARSER_PID="$!"
+}
+
+startparser-debug() {
+ if [ -z "`lsof -Fp -iTCP:${JRUBY_PORT}`" ]; then
+ nohup $MAGLEV_HOME/bin/jruby $MAGLEV_HOME/bin/parser.rb \
+ >$MAGLEV_HOME/log/parser.log 2>$MAGLEV_HOME/log/parser.err &
+ PARSER_PID="$!"
+ echo "MagLev Parse Server process $PARSER_PID started on port $JRUBY_PORT in verbose mode"
+ echo "Parser logfiles are \$MAGLEV_HOME/log/parser.*"
+ else
+ echo "MagLev Parse Server process already running on port $JRUBY_PORT"
+ fi
+}
+
+stopserver() {
+ $GEMSTONE/bin/stopstone gs64stone DataCurator swordfish -i
+ $GEMSTONE/bin/stopnetldi
+}
+
+stopparser() {
+ if [ ! -z "`lsof -Fp -iTCP:${JRUBY_PORT}`" ]; then
+ kill `lsof -Fp -iTCP:${JRUBY_PORT} | cut -c2-`
+ fi
+}
+
+status() {
+ echo "MAGLEV_HOME = $MAGLEV_HOME"
+ $GEMSTONE/bin/gslist -clv
+ if [ ! -z "`lsof -Fp -iTCP:${JRUBY_PORT}`" ]; then
+ echo "MagLev Parse Server port = $JRUBY_PORT"
+ lsof -P -iTCP:${JRUBY_PORT}
+ netstat -an | grep "[:.]$JRUBY_PORT " | grep "LISTEN"
+ else
+ echo "MagLev Parse Server is not running on port $JRUBY_PORT"
+ fi
+}
+
+ruby() {
+ FILE=$PWD/$2
+ $TOPAZ_CMD <<ENDRUBY
+run
+RubyContext load.
+RubyContext loadFileNamed: '$FILE'.
+%
+exit
+ENDRUBY
+}
+
+spec() {
+ WD=$PWD
+ $TOPAZ_CMD <<ENDSPEC
+run
+RubyContext load.
+RubyContext requireFileNamed: 'mspec.rb'.
+RubyCompiler new evaluateString: '\$formatter = DottedFormatter.new; \$formatter.register'.
+('$*' findTokens: Character space) allButFirst do:
+ [:ea |
+ RubyContext loadFileNamed: '$WD/', ea].
+RubyCompiler new evaluateString: '\$formatter.finish'
+%
+exit
+ENDSPEC
+}
+
+topaz() {
+ if [ -z "`which rlwrap`" ]; then
+ $TOPAZ_CMD $@
+ else
+ rlwrap $TOPAZ_CMD $@
+ fi
+}
+
+topaz-debug() {
+ if [ -z "`which rlwrap`" ]; then
+ $TOPAZDEBUG_CMD $@
+ else
+ rlwrap $TOPAZDEBUG_CMD $@
+ fi
+}
+
+initialize() {
+ # grab a virgin repository if no repository exists
+ if [ ! -e $MAGLEV_HOME/data/extent0.ruby.dbf ]; then
+ cp -p $GEMSTONE/bin/extent0.ruby.dbf $MAGLEV_HOME/data/
+ chmod 660 $MAGLEV_HOME/data/extent0.ruby.dbf
+ fi
+}
+
+preload() {
+ $TOPAZ_CMD <<ENDPRELOAD
+run
+RubyContext load.
+RubyContext default loadFileNamed: '$1'.
+RubyContext save.
+%
+commit
+maglev
+puts 'MagLev preload $1 completed'
+quit
+exit
+ENDPRELOAD
+}
+
+destroy() {
+ rm -rf $MAGLEV_HOME/data/*dbf $MAGLEV_HOME/log/* $MAGLEV_HOME/locks/*
+}
+
+squeak() {
+ # If you use Squeak for development and debugging
+ if [ -e /Applications/GemTools.app ]; then
+ open /Applications/GemTools.app
+ else
+ echo "The application used by the 'squeak' command was not found on your system"
+ echo "To fix this, correct the 'squeak' command in the gemstone script"
+ fi
+}
+
+mri() {
+ export DYLD_LIBRARY_PATH=$GEMSTONE/lib32
+ irb -I $MAGLEV_HOME/gci -rgci
+}
+
+gemx() {
+ # If you use Squeak for development and debugging
+ if [ -e /Applications/GemX.app ]; then
+ open /Applications/GemX.app
+ else
+ echo "The application used by the 'gemx' command was not found on your system"
+ echo "To fix this, correct the 'gemx' command in the gemstone script"
+ fi
+}
+
+
+help() {
+cat <<ENDHELP
+Server Commands:
+gemstone start - Start GemStone server processes
+gemstone start-debug - Start GemStone server processes with verbose output
+gemstone start-parser - Force parser process to start if it's dead
+gemstone stop - Stop GemStone server processes
+gemstone restart - Restart GemStone server processes
+gemstone status - Display GemStone server status
+gemstone preload <file> - Load and commit a file into an already running system
+gemstone force-reload - Stop GemStone server, overwrite with empty repository!!!
+
+User Commands:
+gemstone ruby <file> - Execute a Ruby file
+gemstone topaz - Enter a Topaz shell
+gemstone topaz-debug - Enter a Topaz shell useful for debugging
+gemstone squeak - Start optional Squeak development environment
+gemstone help - Display this text
+
+Note:
+For best results, set MAGLEV_HOME, and add \$MAGLEV_HOME/bin to your PATH
+ENDHELP
+}
+
+# See what we were asked to do
+case "$1" in
+ start)
+ initialize
+ startserver
+ startparser
+ ;;
+ start-parser)
+ initialize
+ forceparser
+ ;;
+ start-debug)
+ initialize
+ startserver-debug
+ startparser-debug
+ ;;
+ stop)
+ stopserver
+ stopparser
+ ;;
+ restart)
+ stopserver
+ stopparser
+ startserver
+ startparser
+ ;;
+ status)
+ status
+ ;;
+ topaz)
+ shift
+ # pass params so we can execute 'gemstone topaz -T200000'
+ topaz $@
+ ;;
+ topaz-debug)
+ shift
+ # pass params so we can execute 'gemstone topaz -T200000'
+ topaz-debug $@
+ ;;
+ ruby)
+ # pass params so we can execute 'gemstone ruby <FILE>'
+ ruby $@
+ ;;
+ spec)
+ spec $@
+ ;;
+ squeak)
+ squeak
+ ;;
+ mri)
+ mri
+ ;;
+ gemx)
+ gemx
+ ;;
+ preload)
+ preload $2
+ ;;
+ force-reload)
+ stopserver
+ stopparser
+ destroy
+ initialize
+ ;;
+ help)
+ help
+ ;;
+ *)
+ echo $"Usage: "
+ echo $"gemstone {start|start-debug|stop|restart|status|topaz|topaz-debug|ruby|squeak|preload|force-reload|help}"
+ exit 1
+esac
Oops, something went wrong.

0 comments on commit 6a86d67

Please sign in to comment.