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 | |
HIGUCHI Yuta | e7aa925 | 2013-06-06 14:54:21 -0700 | [diff] [blame] | 7 | ONOS_DIR="`dirname $0`/.." |
| 8 | #CP=$( echo `dirname $0`/../lib/*.jar `dirname $0`/../lib/titan/*.jar . | sed 's/ /:/g') |
HIGUCHI Yuta | 88f3bf3 | 2013-06-20 10:37:47 -0700 | [diff] [blame] | 9 | CP=`${MVN} -f ${ONOS_DIR}/pom.xml dependency:build-classpath -Dmdep.outputFile=/dev/stdout -l /dev/stderr` |
Jonathan Hart | fe99038 | 2013-02-06 15:22:32 -0800 | [diff] [blame] | 10 | |
| 11 | # Find Java |
| 12 | if [ "$JAVA_HOME" = "" ] ; then |
| 13 | JAVA="java -server" |
| 14 | else |
| 15 | JAVA="$JAVA_HOME/bin/java -server" |
| 16 | fi |
| 17 | |
| 18 | # Set Java options |
| 19 | if [ "$JAVA_OPTIONS" = "" ] ; then |
| 20 | JAVA_OPTIONS="-Xms32m -Xmx512m" |
| 21 | fi |
| 22 | |
| 23 | # Launch the application |
| 24 | if [ "$1" = "-e" ]; then |
| 25 | k=$2 |
| 26 | if [ $# -gt 2 ]; then |
| 27 | for (( i=3 ; i < $# + 1 ; i++ )) |
| 28 | do |
| 29 | eval a=\$$i |
| 30 | k="$k \"$a\"" |
| 31 | done |
| 32 | fi |
| 33 | |
| 34 | eval $JAVA $JAVA_OPTIONS -cp $CP:$CLASSPATH com.thinkaurelius.titan.tinkerpop.gremlin.ScriptExecutor $k |
| 35 | else |
| 36 | if [ "$1" = "-v" ]; then |
| 37 | $JAVA $JAVA_OPTIONS -cp $CP:$CLASSPATH com.tinkerpop.gremlin.Version |
| 38 | else |
| 39 | $JAVA $JAVA_OPTIONS -cp $CP:$CLASSPATH com.thinkaurelius.titan.tinkerpop.gremlin.Console |
| 40 | fi |
| 41 | fi |
| 42 | |
| 43 | # Return the program's exit code |
| 44 | exit $? |