Jonathan Hart | fe99038 | 2013-02-06 15:22:32 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
HIGUCHI Yuta | 88f3bf3 | 2013-06-20 10:37:47 -0700 | [diff] [blame] | 3 | if [ -z "${MVN}" ]; then |
| 4 | MVN="mvn" |
| 5 | fi |
| 6 | |
Jonathan Hart | 0b6ef8f | 2013-11-18 12:00:20 -0800 | [diff] [blame^] | 7 | BASE_DIR=`dirname $0` |
HIGUCHI Yuta | e7aa925 | 2013-06-06 14:54:21 -0700 | [diff] [blame] | 8 | ONOS_DIR="`dirname $0`/.." |
| 9 | #CP=$( echo `dirname $0`/../lib/*.jar `dirname $0`/../lib/titan/*.jar . | sed 's/ /:/g') |
Jonathan Hart | 0b6ef8f | 2013-11-18 12:00:20 -0800 | [diff] [blame^] | 10 | #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 |
| 13 | CP=`${BASE_DIR}/../scripts/parse-classpath.py` |
| 14 | |
| 15 | if [[ "$CP" == *"Error reading classpath file"* ]]; then |
| 16 | echo $CP |
| 17 | exit 1 |
| 18 | fi |
Jonathan Hart | fe99038 | 2013-02-06 15:22:32 -0800 | [diff] [blame] | 19 | |
| 20 | # Find Java |
| 21 | if [ "$JAVA_HOME" = "" ] ; then |
| 22 | JAVA="java -server" |
| 23 | else |
| 24 | JAVA="$JAVA_HOME/bin/java -server" |
| 25 | fi |
| 26 | |
| 27 | # Set Java options |
| 28 | if [ "$JAVA_OPTIONS" = "" ] ; then |
| 29 | JAVA_OPTIONS="-Xms32m -Xmx512m" |
| 30 | fi |
| 31 | |
| 32 | # Launch the application |
| 33 | if [ "$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 |
| 44 | else |
| 45 | if [ "$1" = "-v" ]; then |
| 46 | $JAVA $JAVA_OPTIONS -cp $CP:$CLASSPATH com.tinkerpop.gremlin.Version |
| 47 | else |
Jonathan Hart | 0b6ef8f | 2013-11-18 12:00:20 -0800 | [diff] [blame^] | 48 | pushd $BASE_DIR >/dev/null |
Jonathan Hart | fe99038 | 2013-02-06 15:22:32 -0800 | [diff] [blame] | 49 | $JAVA $JAVA_OPTIONS -cp $CP:$CLASSPATH com.thinkaurelius.titan.tinkerpop.gremlin.Console |
Jonathan Hart | 0b6ef8f | 2013-11-18 12:00:20 -0800 | [diff] [blame^] | 50 | popd >/dev/null |
Jonathan Hart | fe99038 | 2013-02-06 15:22:32 -0800 | [diff] [blame] | 51 | fi |
| 52 | fi |
| 53 | |
| 54 | # Return the program's exit code |
| 55 | exit $? |