blob: 55354e3226cae00e2346910f78afd21ff252828f [file] [log] [blame]
Jonathan Hartfe990382013-02-06 15:22:32 -08001#!/bin/bash
2
HIGUCHI Yuta88f3bf32013-06-20 10:37:47 -07003if [ -z "${MVN}" ]; then
4 MVN="mvn"
5fi
6
Jonathan Hart0b6ef8f2013-11-18 12:00:20 -08007BASE_DIR=`dirname $0`
HIGUCHI Yutae7aa9252013-06-06 14:54:21 -07008ONOS_DIR="`dirname $0`/.."
9#CP=$( echo `dirname $0`/../lib/*.jar `dirname $0`/../lib/titan/*.jar . | sed 's/ /:/g')
Jonathan Hart0b6ef8f2013-11-18 12:00:20 -080010#CP=`${MVN} -f ${ONOS_DIR}/pom.xml dependency:build-classpath -Dmdep.outputFile=/dev/stdout -l /dev/stderr`
11
12# Use a python script to parse the classpath out of the .classpath file
13CP=`${BASE_DIR}/../scripts/parse-classpath.py`
14
15if [[ "$CP" == *"Error reading classpath file"* ]]; then
16 echo $CP
17 exit 1
18fi
Jonathan Hartfe990382013-02-06 15:22:32 -080019
20# Find Java
21if [ "$JAVA_HOME" = "" ] ; then
22 JAVA="java -server"
23else
24 JAVA="$JAVA_HOME/bin/java -server"
25fi
26
27# Set Java options
28if [ "$JAVA_OPTIONS" = "" ] ; then
29 JAVA_OPTIONS="-Xms32m -Xmx512m"
30fi
31
32# Launch the application
33if [ "$1" = "-e" ]; then
34 k=$2
35 if [ $# -gt 2 ]; then
36 for (( i=3 ; i < $# + 1 ; i++ ))
37 do
38 eval a=\$$i
39 k="$k \"$a\""
40 done
41 fi
42
43 eval $JAVA $JAVA_OPTIONS -cp $CP:$CLASSPATH com.thinkaurelius.titan.tinkerpop.gremlin.ScriptExecutor $k
44else
45 if [ "$1" = "-v" ]; then
46 $JAVA $JAVA_OPTIONS -cp $CP:$CLASSPATH com.tinkerpop.gremlin.Version
47 else
Jonathan Hart0b6ef8f2013-11-18 12:00:20 -080048 pushd $BASE_DIR >/dev/null
Jonathan Hartfe990382013-02-06 15:22:32 -080049 $JAVA $JAVA_OPTIONS -cp $CP:$CLASSPATH com.thinkaurelius.titan.tinkerpop.gremlin.Console
Jonathan Hart0b6ef8f2013-11-18 12:00:20 -080050 popd >/dev/null
Jonathan Hartfe990382013-02-06 15:22:32 -080051 fi
52fi
53
54# Return the program's exit code
55exit $?