adding unix and windows startup scripts

use maven to build the eclipse scripts instead of committing them in svn which makes them less portable
(do './gridworks eclipse' at the beginning to regenerate your eclipse project files, then reload in eclipse)


git-svn-id: http://google-refine.googlecode.com/svn/trunk@59 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
Stefano Mazzocchi 2010-02-07 05:25:44 +00:00
parent 2ceaa53390
commit 2077d3f094
6 changed files with 287 additions and 40 deletions

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>gridworks</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
</natures>
</projectDescription>

View File

@ -1,9 +0,0 @@
#Sat Jan 23 16:09:34 PST 2010
activeProfiles=
eclipse.preferences.version=1
filterResources=false
includeModules=false
resolveWorkspaceProjects=true
resourceFilterGoals=process-resources resources\:testResources
useMavenFolders=false
version=1

129
gridworks Executable file
View File

@ -0,0 +1,129 @@
#!/bin/sh
fail () {
cat <<EOF
ERROR: $1
Usage: $0 [options] <action>
-h for more details
EOF
exit 1
}
usage() {
cat <<EOF
Usage: $0 [options] <action>
where [options] include:
-h print this message and exit
-p <port> is the port that gridworks will listen to
default: 3333
-d <port> enable JVM debugging (on port 8000)
-s <mode> enable profiling
(available modes are "hprof" and "yourkit")
-x enable JMX monitoring
and <action> is one of
run Run gridworks (default)
eclipse Build eclipse project files
EOF
exit 0
}
absolute_path () {
case $1 in
/*) echo $1; ;;
*) echo `pwd`/$1; ;;
esac
}
add_option () {
MAVEN_OPTS="$MAVEN_OPTS $1"
}
### Parse the command line args.
MAVEN_OPTS="$GRIDWORKS_OPTS -Djava.awt.headless=true"
while [ $# -ne 0 ] ; do
case "x$1" in
x-p) shift; GRIDWORKS_PORT="$1"; shift; ;;
x-d) shift; add_option '-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n'; ;;
x-s) shift;
case "$1" in
profile)
add_option '-Xrunhprof:heap=all,cpu=samples,thread=y,depth=3'; ;;
shark)
add_option '-Xrunshark'; ;;
yourkit)
if [ "$YOURKIT_HOME" = "" ] ; then
echo "YOURKIT_HOME should be set to Yourkit Java Profiler absolute path"
exit
fi
if [ `uname` = 'Linux' ] ; then
if [ "`uname -a | grep x86_64`" ] ; then
# Assume Linux AMD 64 has 64-bit Java
export LD_LIBRARY_PATH="$YOURKIT_HOME/bin/linux-amd64:$LD_LIBRARY_PATH"
else
# 32-bit Java
export LD_LIBRARY_PATH="$YOURKIT_HOME/bin/linux-x86-32:$LD_LIBRARY_PATH"
fi
elif [ `uname` = 'Darwin' ] ; then
# Mac OS X
export DYLD_LIBRARY_PATH="$YOURKIT_HOME/bin/mac:$DYLD_LIBRARY_PATH"
elif [ `uname` = 'SunOS' ] ; then
# Solaris, unlike Linux, probes entire LD_LIBRARY_PATH instead of stopping after first improper shared library
LD_LIBRARY_PATH="$YOURKIT_HOME/bin/solaris-sparc-32:$YOURKIT_HOME/bin/solaris-sparc-64:$YOURKIT_HOME/bin/solaris-x86-32:$YOURKIT_HOME/bin/solaris-x86-64:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH
fi
add_option '-agentlib:yjpagent=sessionname=Gridworks'; ;;
esac
shift; ;;
x-x) shift; add_option '-Dcom.sun.management.jmxremote'; ;;
x-h) usage; ;;
*) ACTION="$1"; shift; ;;
esac
done
# ----- Verify and Set Required Environment Variables -------------------------
if [ "$JAVA_OPTIONS" = "" ] ; then
JAVA_OPTIONS="-Xms256M -Xmx1024M"
fi
add_option "$JAVA_OPTIONS"
if [ "$GRIDWORKS_PORT" = "" ] ; then
GRIDWORKS_PORT="3333"
fi
add_option "-Djetty.port=$GRIDWORKS_PORT"
# ----- Respond to the action given. ----------------------------------------------------------
if ["$ACTION" == ''] ; then
ACTION='run'
fi
case "$ACTION" in
run)
OPEN=`which 'open'`
if [ $OPEN != '' ] ; then
$OPEN "http://127.0.0.1:$GRIDWORKS_PORT/"
fi
export MAVEN_OPTS
echo "[INFO] MAVEN_OPTS: '$MAVEN_OPTS'"
exec mvn $MAVEN_PARAMS jetty:run; ;;
eclipse)
mvn eclipse:clean
mvn eclipse:eclipse; ;;
*)
fail "Unknown action '$ACTION'"; ;;
esac

133
gridworks.bat Normal file
View File

@ -0,0 +1,133 @@
@echo off
rem
rem Configuration variables
rem
rem JAVA_HOME
rem Home of Java installation.
rem
rem JAVA_OPTIONS
rem Extra options to pass to the JVM
rem
rem --- First two utilities for exiting --------------------------------------------
goto endUtils
:usage
echo Usage: %0 [options] <action>
echo where [options] include:
echo.
echo /h print this message and exit
echo.
echo /p <port> the port that Gridworks will listen to
echo default: 3333
echo.
echo /d enable JVM debugging (on port 8000)
echo.
echo /s <mode> enable profiling
echo (available modes are "hprof" and "yourkit")
echo.
echo /x enable JMX monitoring (for jconsole and friends)
echo.
echo and <action> is one of
echo.
echo run Run Gridworks (default)
echo.
echo eclipse Build Eclipse project files
echo.
echo.
goto end
:fail
echo See: '%0 /h' for usage.
goto end
:endUtils
if not "%JAVA_HOME%" == "" goto gotJavaHome
echo You must set JAVA_HOME to point at your Java Development Kit installation
goto fail
:gotJavaHome
set MAVEN_OPTS=%GRIDWORKS_OPTS% -Djava.awt.headless=true
rem --- Argument parsing --------------------------------------------
:loop
if ""%1"" == """" goto endArgumentParsing
if ""%1"" == ""/h"" goto usage
if ""%1"" == ""/p"" goto arg-p
if ""%1"" == ""/d"" goto arg-d
if ""%1"" == ""/s"" goto arg-s
if ""%1"" == ""/x"" goto arg-x
goto endArgumentParsing
:arg-p
set GRIDWORKS_PORT=%2
goto shift2loop
:arg-d
set MAVEN_OPTS=%MAVEN_OPTS% -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
goto shift2loop
:arg-s
set PROFILE_MODE=%2
if ""%PROFILE_MODE%"" == ""hprof"" goto profileWithHprof
if ""%PROFILE_MODE%"" == ""yourkit"" goto profileWithYourkit
goto shift2loop
:profileWithHprof
set MAVEN_OPTS=%MAVEN_OPTS% -Xrunhprof:heap=all,cpu=samples,thread=y,depth=3
goto shift2loop
:profileWithYourkit
set MAVEN_OPTS=%MAVEN_OPTS% -agentlib:yjpagent=sessionname=Gridworks
goto shift2loop
:arg-x
set MAVEN_OPTS=%MAVEN_OPTS% -Dcom.sun.management.jmxremote
goto shift2loop
:shift2loop
shift
shift
goto loop
:endArgumentParsing
rem --- Fold in Environment Vars --------------------------------------------
if not "%JAVA_OPTIONS%" == "" goto gotJavaOptions
set JAVA_OPTIONS=-Xms32M -Xmx256M
:gotJavaOptions
set MAVEN_OPTS=%MAVEN_OPTS% %JAVA_OPTIONS%
if not "%GRIDWORKS_PORT%" == "" goto gotPort
set GRIDWORKS_PORT=3333
:gotPort
set MAVEN_OPTS=%MAVEN_OPTS% -Djetty.port=%GRIDWORKS_PORT%
rem ----- Respond to the action ----------------------------------------------------------
set ACTION=%1
if not "%ACTION%" == "" goto gotAction
set ACTION="run"
:gotJavaOptions
set MAVEN_OPTS=%MAVEN_OPTS% %JAVA_OPTIONS%
if ""%ACTION%"" == ""run"" goto doRun
if ""%ACTION%"" == ""eclipse"" goto doEclipse
:doRun
echo MAVEN_OPTS=%MAVEN_OPTS%
start http://127.0.0.1:%GRIDWORKS_PORT%/
mvn %MAVEN_PARAMS% jetty:run
goto end
:doEclipse
mvn eclipse:clean
mvn eclipse:eclipse
goto end
:end

26
pom.xml
View File

@ -30,7 +30,7 @@
<configuration> <configuration>
<connectors> <connectors>
<connector implementation="org.mortbay.jetty.bio.SocketConnector"> <connector implementation="org.mortbay.jetty.bio.SocketConnector">
<port>3333</port> <port>${jetty.port}</port>
<maxIdleTime>60000</maxIdleTime> <maxIdleTime>60000</maxIdleTime>
</connector> </connector>
</connectors> </connectors>
@ -39,9 +39,33 @@
<webAppSourceDirectory>src/main/webapp</webAppSourceDirectory> <webAppSourceDirectory>src/main/webapp</webAppSourceDirectory>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<downloadSources>true</downloadSources>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>servlets.com</groupId> <groupId>servlets.com</groupId>