more work on the broker

git-svn-id: http://google-refine.googlecode.com/svn/trunk@1033 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
Stefano Mazzocchi 2010-06-25 06:52:12 +00:00
parent 058e86b4c8
commit 777e4ce0e8
21 changed files with 281 additions and 227 deletions

2
.gitignore vendored
View File

@ -12,4 +12,4 @@ extensions/jython/module/MOD-INF/classes/
extensions/jython/module/MOD-INF/lib/cachedir/
broker/appengine/module/MOD-INF/classes/
broker/core/module/MOD-INF/classes/
broker/local/module/MOD-INF/classes/
broker/core/WEB-INF/lib/

View File

@ -1,5 +0,0 @@
#
# Butterfly Modules Configuration
#
appengine-broker = /

View File

@ -1,25 +0,0 @@
<?xml version="1.0"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5">
<servlet>
<servlet-name>Butterfly</servlet-name>
<servlet-class>edu.mit.simile.butterfly.Butterfly</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Butterfly</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<security-constraint>
<web-resource-collection>
<url-pattern>/expire_locks</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
</web-app>

View File

@ -1,5 +1,4 @@
name = appengine-broker
extends = broker
description = Google App Engine implementation of Gridworks Broker Module
module-impl = com.metaweb.gridworks.broker.AppEngineGridworksBroker
name = broker
description = Google App Engine implementation of Gridworks Broker
module-impl = com.metaweb.gridworks.broker.AppEngineGridworksBrokerImpl
templating = false

View File

@ -28,7 +28,7 @@ import org.slf4j.LoggerFactory;
import com.google.appengine.api.datastore.Text;
import com.metaweb.gridworks.appengine.AppEngineClientConnectionManager;
public class AppEngineGridworksBroker extends GridworksBroker {
public class AppEngineGridworksBrokerImpl extends GridworksBroker {
protected static final Logger logger = LoggerFactory.getLogger("gridworks.broker.appengine");

View File

@ -5,6 +5,7 @@
<classpathentry kind="lib" path="/gridworks/webapp/WEB-INF/lib/butterfly-trunk-r25.jar" sourcepath="/gridworks/webapp/WEB-INF/lib-src/butterfly-trunk-r25-sources.jar"/>
<classpathentry kind="lib" path="/gridworks-server/lib/servlet-api-2.5.jar" sourcepath="/gridworks-server/lib-src/servlet-api-2.5-sources.jar"/>
<classpathentry kind="lib" path="/gridworks/webapp/WEB-INF/lib/json-20100208.jar" sourcepath="/gridworks/webapp/WEB-INF/lib-src/json-20100208-sources.jar"/>
<classpathentry kind="lib" path="module/MOD-INF/lib/bdb-je-4.0.103.jar" sourcepath="module/MOD-INF/lib-src/bdb-je-4.0.103-sources.jar"/>
<classpathentry kind="lib" path="/gridworks/webapp/WEB-INF/lib/httpclient-4.0.1.jar" sourcepath="/gridworks/webapp/WEB-INF/lib-src/httpclient-4.0.1-sources.jar"/>
<classpathentry kind="lib" path="/gridworks/webapp/WEB-INF/lib/httpcore-4.0.1.jar" sourcepath="/gridworks/webapp/WEB-INF/lib-src/httpcore-4.0.1-sources.jar"/>
<classpathentry kind="lib" path="/gridworks/webapp/WEB-INF/lib/slf4j-api-1.5.6.jar" sourcepath="/gridworks/webapp/WEB-INF/lib-src/slf4j-api-1.5.6-sources.jar"/>

View File

@ -19,7 +19,7 @@ butterfly.url = /
# ---------- Module ------
butterfly.modules.path = modules
butterfly.modules.path = ./
butterfly.modules.wirings = WEB-INF/modules.properties

View File

@ -2,4 +2,4 @@
# Butterfly Modules Configuration
#
local-broker = /
broker = /

View File

@ -1,4 +1,4 @@
name = broker
description = Gridworks Broker
module-impl = com.metaweb.gridworks.broker.GridworksBroker
description = Local Gridworks Broker
module-impl = com.metaweb.gridworks.broker.GridworksBrokerImpl
templating = false

View File

@ -81,9 +81,9 @@ public abstract class GridworksBroker extends ButterflyModuleImpl {
@Override
public boolean process(String path, HttpServletRequest request, HttpServletResponse response) throws Exception {
if (logger.isDebugEnabled()) {
logger.debug("> process {}", path);
logger.debug("> process '{}'", path);
} else {
logger.info("process {}", path);
logger.info("process '{}'", path);
}
response.setCharacterEncoding("UTF-8");
@ -115,19 +115,23 @@ public abstract class GridworksBroker extends ButterflyModuleImpl {
startProject(response, pid, uid, getParameter(request, "lock"), getParameter(request, "data"));
} else if ("get".equals(path)) {
getProject(response, pid);
} else {
boolean value = super.process(path, request, response);
if (logger.isDebugEnabled()) logger.debug("< process '{}'", path);
return value;
}
} catch (RuntimeException e) {
logger.error("runtime error", e);
logger.error("runtime error", e.getMessage());
respondError(response, e.getMessage());
} catch (Exception e) {
logger.error("internal error", e);
respondException(response, e);
}
if (logger.isDebugEnabled()) logger.debug("< process {}", path);
if (logger.isDebugEnabled()) logger.debug("< process '{}'", path);
return super.process(path, request, response);
return true;
}
// ----------------------------------------------------------------------------------------

View File

@ -27,7 +27,7 @@ import com.sleepycat.persist.StoreConfig;
import com.sleepycat.persist.model.Entity;
import com.sleepycat.persist.model.PrimaryKey;
public class LocalGridworksBroker extends GridworksBroker {
public class GridworksBrokerImpl extends GridworksBroker {
protected static final Logger logger = LoggerFactory.getLogger("gridworks.broker.local");
@ -50,6 +50,7 @@ public class LocalGridworksBroker extends GridworksBroker {
timer.schedule(expirer, LOCK_EXPIRATION_CHECK_DELAY, LOCK_EXPIRATION_CHECK_DELAY);
File dataPath = new File("data"); // FIXME: data should be configurable;
if (!dataPath.exists()) dataPath.mkdirs();
EnvironmentConfig envConfig = new EnvironmentConfig();
envConfig.setAllowCreate(true);
@ -86,12 +87,14 @@ public class LocalGridworksBroker extends GridworksBroker {
class LockExpirer extends TimerTask {
public void run() {
for (Lock lock : lockByProject.entities()) {
if (lock.timestamp + LOCK_DURATION < System.currentTimeMillis()) {
try {
releaseLock(null, lock.pid, lock.uid, lock.id);
} catch (Exception e) {
logger.error("Exception while expiring lock for project '" + lock.pid + "'", e);
if (lockByProject != null) {
for (Lock lock : lockByProject.entities()) {
if (lock.timestamp + LOCK_DURATION < System.currentTimeMillis()) {
try {
releaseLock(null, lock.pid, lock.uid, lock.id);
} catch (Exception e) {
logger.error("Exception while expiring lock for project '" + lock.pid + "'", e);
}
}
}
}
@ -265,7 +268,7 @@ public class LocalGridworksBroker extends GridworksBroker {
}
@Entity
class Project {
static class Project {
@PrimaryKey
String pid;
@ -317,7 +320,7 @@ public class LocalGridworksBroker extends GridworksBroker {
}
@Entity
class Lock {
static class Lock {
@PrimaryKey
String pid;

View File

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="/gridworks/webapp/WEB-INF/lib/butterfly-trunk-r25.jar" sourcepath="/gridworks/webapp/WEB-INF/lib-src/butterfly-trunk-r25-sources.jar"/>
<classpathentry kind="lib" path="/gridworks-server/lib/servlet-api-2.5.jar" sourcepath="/gridworks-server/lib-src/servlet-api-2.5-sources.jar"/>
<classpathentry kind="lib" path="/gridworks/webapp/WEB-INF/lib/json-20100208.jar" sourcepath="/gridworks/webapp/WEB-INF/lib-src/json-20100208-sources.jar"/>
<classpathentry kind="lib" path="module/MOD-INF/lib/bdb-je-4.0.103.jar" sourcepath="module/MOD-INF/lib-src/bdb-je-4.0.103-sources.jar"/>
<classpathentry kind="lib" path="/gridworks/webapp/WEB-INF/lib/httpclient-4.0.1.jar" sourcepath="/gridworks/webapp/WEB-INF/lib-src/httpclient-4.0.1-sources.jar"/>
<classpathentry kind="lib" path="/gridworks/webapp/WEB-INF/lib/httpcore-4.0.1.jar" sourcepath="/gridworks/webapp/WEB-INF/lib-src/httpcore-4.0.1-sources.jar"/>
<classpathentry kind="lib" path="/gridworks/webapp/WEB-INF/lib/slf4j-api-1.5.6.jar" sourcepath="/gridworks/webapp/WEB-INF/lib-src/slf4j-api-1.5.6-sources.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/gridworks-broker"/>
<classpathentry kind="output" path="module/MOD-INF/classes"/>
</classpath>

View File

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

View File

@ -1,29 +0,0 @@
#
# Butterfly Configuration
#
# NOTE: properties passed to the JVM using '-Dkey=value' from the command line
# override the settings in this file.
# indicates the URL path where butterfly is available in the proxy URL space
# as there is no way of knowing otherwise as this information is not
# transferred thru the HTTP protocol or otherwise (different story if
# the appserver is connected thru a different protocol such as AJP)
butterfly.url = /
# ---------- Miscellaneous ----------
#butterfly.locale.language = en
#butterfly.locale.country = US
#butterfly.timeZone = GMT+09:00
# ---------- Module ------
butterfly.modules.path = modules
butterfly.modules.wirings = WEB-INF/modules.properties
# ---------- Clustering ----
#butterfly.routing.cookie.maxage = -1

View File

@ -1,5 +0,0 @@
name = local-broker
extends = broker
description = Local implementation of Gridworks Broker Module
module-impl = com.metaweb.gridworks.broker.LocalDBGridworksBroker
templating = false

169
build.xml
View File

@ -30,7 +30,7 @@
<not><isset property="dist.dir"/></not>
</condition>
<condition property="appengine.app_id" value="mygridworks">
<condition property="appengine.app_id" value="gridworks-broker">
<not><isset property="appengine.app_id"/></not>
</condition>
@ -56,11 +56,9 @@
<property name="server.lib.dir" value="${server.dir}/lib" />
<property name="server.classes.dir" value="${server.dir}/classes" />
<property name="appengine.dir" value="${basedir}/appengine" />
<property name="appengine.src.dir" value="${appengine.dir}/src" />
<property name="appengine.webapp.dir" value="${appengine.dir}/webapp" />
<property name="appengine.lib.dir" value="${appengine.webapp.dir}/WEB-INF/lib" />
<property name="appengine.classes.dir" value="${appengine.dir}/classes" />
<property name="broker.dir" value="${basedir}/broker" />
<property name="broker.core.dir" value="${broker.dir}/core" />
<property name="broker.appengine.dir" value="${broker.dir}/appengine" />
<property name="tests.dir" value="${main.dir}/tests" />
<property name="server.tests.dir" value="${tests.dir}/server" />
@ -76,7 +74,8 @@
<property name="built.webapp.name" value="webapp" />
<property name="built.webapp.dir" value="${build.dir}/${built.webapp.name}" />
<property name="built.appengine.webapp.dir" value="${build.dir}/appengine" />
<property name="built.broker.webapp.dir" value="${build.dir}/broker" />
<property name="mac.dir" value="${build.dir}/mac" />
<property name="windows.dir" value="${build.dir}/windows" />
@ -102,13 +101,6 @@
<pathelement location="${webapp.classes.dir}"/>
</path>
<path id="appengine.class.path">
<path refid="webapp.class.path"/>
<fileset dir="${appengine.sdk.dir}/lib">
<include name="shared/**/*.jar" />
</fileset>
</path>
<path id="tests.class.path">
<path refid="webapp.class.path"/>
<fileset dir="${server.tests.lib.dir}">
@ -116,6 +108,35 @@
</fileset>
</path>
<path id="broker.class.path">
<fileset dir="${server.lib.dir}">
<include name="**/servlet-api*.jar" />
</fileset>
<fileset dir="${webapp.lib.dir}">
<include name="**/butterfly*.jar" />
<include name="**/json*.jar" />
<include name="**/http*.jar" />
<include name="**/slf4j-api*.jar" />
</fileset>
</path>
<path id="broker.core.class.path">
<pathelement location="${broker.core.dir}/module/MOD-INF/classes"/>
<path refid="broker.class.path"/>
<fileset dir="${broker.core.dir}/module/MOD-INF/lib">
<include name="**/*.jar" />
</fileset>
</path>
<path id="broker.appengine.class.path">
<pathelement location="${broker.core.dir}/module/MOD-INF/classes"/>
<path refid="broker.class.path"/>
<fileset dir="${appengine.sdk.dir}/lib">
<include name="shared/**/*.jar" />
<include name="user/**/*.jar" />
</fileset>
</path>
<!-- ================================================================== -->
<target name="build_server">
@ -135,14 +156,6 @@
<copy file="${webapp.src.dir}/log4j.properties" tofile="${webapp.classes.dir}/log4j.properties"/>
</target>
<target name="build_appengine" depends="build_webapp">
<mkdir dir="${appengine.classes.dir}" />
<javac destdir="${appengine.classes.dir}" debug="true" includeAntRuntime="no">
<src path="${appengine.src.dir}"/>
<classpath refid="appengine.class.path" />
</javac>
</target>
<target name="build_tests" depends="build_webapp, build_server">
<mkdir dir="${server.tests.classes.dir}" />
<javac srcdir="${server.tests.src.dir}" destdir="${server.tests.classes.dir}" debug="true" includeAntRuntime="no">
@ -157,6 +170,32 @@
<target name="build" depends="build_server, build_webapp, build_extensions"/>
<target name="build_broker_core">
<mkdir dir="${broker.core.dir}/module/MOD-INF/classes" />
<javac destdir="${broker.core.dir}/module/MOD-INF/classes" debug="true" includeAntRuntime="no">
<src path="${broker.core.dir}/src/"/>
<classpath refid="broker.class.path" />
</javac>
</target>
<target name="build_broker_local" depends="build_broker_core">
<mkdir dir="${broker.core.dir}/module/MOD-INF/classes" />
<javac destdir="${broker.core.dir}/module/MOD-INF/classes" debug="true" includeAntRuntime="no">
<src path="${broker.core.dir}/src/"/>
<classpath refid="broker.core.class.path" />
</javac>
</target>
<target name="build_broker_appengine" depends="build_broker_core">
<mkdir dir="${broker.appengine.dir}/module/MOD-INF/classes" />
<javac destdir="${broker.appengine.dir}/module/MOD-INF/classes" debug="true" includeAntRuntime="no">
<src path="${broker.appengine.dir}/src/"/>
<classpath refid="broker.appengine.class.path" />
</javac>
</target>
<target name="build_broker" depends="build_broker_local, build_broker_appengine"/>
<!-- ================================================================== -->
<target name="jar_server" depends="build_server">
@ -167,10 +206,6 @@
<jar destfile="${build.dir}/${fullname}.jar" basedir="${webapp.classes.dir}"/>
</target>
<target name="jar_appengine" depends="build_appengine">
<jar destfile="${build.dir}/${fullname}-appengine.jar" basedir="${appengine.classes.dir}"/>
</target>
<target name="jar" depends="jar_server, jar_webapp"/>
<!-- ================================================================== -->
@ -416,33 +451,78 @@
<!-- ================================================================== -->
<target name="prepare_webapp_appengine" depends="jar_appengine">
<mkdir dir="${built.appengine.webapp.dir}" />
<target name="prepare_broker" depends="jar_server, build_broker_local">
<copy todir="${broker.core.dir}/WEB-INF/lib">
<fileset dir="${webapp.lib.dir}">
<include name="**/butterfly*.jar" />
<include name="**/rhino*.jar" />
<include name="**/commons-collections*.jar" />
<include name="**/velocity*.jar" />
<include name="**/lessen*.jar" />
<include name="**/slf4j*.jar" />
<include name="**/log4j*.jar" />
<copy todir="${built.appengine.webapp.dir}">
<fileset dir="${webapp.dir}">
<include name="WEB-INF/lib/slf4j**"/>
<exclude name="WEB-INF/lib/slf4j-log4j*"/>
<exclude name="WEB-INF/lib-src/**"/>
<exclude name="WEB-INF/classes/**"/>
<include name="**/json*.jar" />
<include name="**/http*.jar" />
<include name="**/jcl*.jar" />
</fileset>
</copy>
</target>
<target name="prepare_broker_appengine" depends="build_broker_appengine">
<mkdir dir="${built.broker.webapp.dir}/appengine" />
<mkdir dir="${built.broker.webapp.dir}/appengine/modules" />
<copy todir="${built.broker.webapp.dir}/appengine">
<fileset dir="${broker.appengine.dir}">
<include name="WEB-INF/**"/>
<exclude name="WEB-INF/jdo*"/>
</fileset>
</copy>
<copy file="${build.dir}/${fullname}-appengine.jar" tofile="${built.appengine.webapp.dir}/WEB-INF/lib/${fullname}-appengine.jar"/>
<copy todir="${built.broker.webapp.dir}/appengine/WEB-INF/classes/META-INF">
<fileset dir="${broker.appengine.dir}/WEB-INF">
<include name="jdo*"/>
</fileset>
</copy>
<copy todir="${built.appengine.webapp.dir}/WEB-INF/lib" flatten="true">
<copy todir="${built.broker.webapp.dir}/appengine/modules/appengine-broker">
<fileset dir="${broker.appengine.dir}/module">
<include name="**"/>
<exclude name="**/lib-src/**"/>
</fileset>
</copy>
<copy todir="${built.broker.webapp.dir}/appengine/modules/broker">
<fileset dir="${broker.core.dir}/module">
<include name="**"/>
<exclude name="**/lib-src/**"/>
</fileset>
</copy>
<copy todir="${built.broker.webapp.dir}/appengine/WEB-INF/lib">
<fileset dir="${webapp.lib.dir}">
<include name="**/butterfly*.jar" />
<include name="**/rhino*.jar" />
<include name="**/commons-collections*.jar" />
<include name="**/velocity*.jar" />
<include name="**/lessen*.jar" />
<include name="**/slf4j-api*.jar" />
<include name="**/jcl*.jar" />
<include name="**/json*.jar" />
<include name="**/http*.jar" />
</fileset>
</copy>
<copy todir="${built.broker.webapp.dir}/appengine/WEB-INF/lib" flatten="true">
<fileset dir="${appengine.sdk.dir}/lib/user">
<include name="**/*.jar" />
</fileset>
</copy>
<copy todir="${built.appengine.webapp.dir}">
<fileset dir="${appengine.webapp.dir}">
<include name="**/*"/>
</fileset>
</copy>
<replace file="${built.appengine.webapp.dir}/WEB-INF/appengine-web.xml">
<replace file="${built.broker.webapp.dir}/appengine/WEB-INF/appengine-web.xml">
<replacefilter token="$APPID" value="${appengine.app_id}"/>
<replacefilter token="$VERSION" value="${appengine.version}"/>
</replace>
@ -455,8 +535,9 @@
<delete file="${build.dir}/${fullname}-server.jar" />
<delete dir="${server.classes.dir}" />
<delete dir="${webapp.classes.dir}" />
<delete dir="${appengine.classes.dir}" />
<delete dir="${server.tests.classes.dir}" />
<delete dir="${broker.core.dir}/module/MOD-INF/classes" />
<delete dir="${broker.appengine.dir}/module/MOD-INF/classes" />
</target>
<target name="distclean" depends="clean">

179
gridworks
View File

@ -55,31 +55,32 @@ where [options] include:
and <action> is one of
build ............................ Build Gridworks
run .............................. Run Gridworks [default]
build ............................... Build Gridworks
run ................................. Run Gridworks [default]
test ............................. Run all Gridworks tests
server_test ...................... Run only the server tests
ui_test .......................... Run only the UI tests
test ................................ Run all Gridworks tests
server_test ......................... Run only the server tests
ui_test ............................. Run only the UI tests
appengine_build <id> <version> ... Build Gridworks for Google App Engine
appengine_run <id> <version> ..... Run Gridworks for Google App Engine in local server
appengine_upload <id> <version>... Upload Gridworks to Google App Engine
broker .............................. Run Gridworks Broker
findbugs ......................... Run Findbugs against Gridworks
pmd .............................. Run PMD against Gridworks
cpd .............................. Run Copy/Paste Detection against Gridworks
jslint ........................... Run JSlint against Gridworks
broker_appengine_run <id> <ver> ..... Run Gridworks Broker for Google App Engine in local server
broker_appengine_upload <id> <ver> .. Upload Gridworks to Google App Engine
whitespace <extension> ........... Normalize whitespace in files with the given extension
findbugs ............................ Run Findbugs against Gridworks
pmd ................................. Run PMD against Gridworks
cpd ................................. Run Copy/Paste Detection against Gridworks
jslint .............................. Run JSlint against Gridworks
mac_dist <version> ............... Make MacOSX binary distribution
windows_dist <version> ........... Make Windows binary distribution
linux_dist <version> ............. Make Linux binary distribution
dist <version> ................... Make all distributions
whitespace <extension> .............. Normalize whitespace in files with the given extension
clean ............................ Clean compiled classes
distclean ........................ Remove all generated files
mac_dist <version> .................. Make MacOSX binary distribution
windows_dist <version> .............. Make Windows binary distribution
linux_dist <version> ................ Make Linux binary distribution
dist <version> ...................... Make all distributions
clean ............................... Clean compiled classes
distclean ........................... Remove all generated files
EOF
exit 1
@ -566,37 +567,15 @@ server_test() {
$RUN_CMD || error "Failed passing server tests"
}
appengine_build() {
appengine_prepare
get_revision
ANT_PARAMS="-Dappengine.sdk.dir=${APPENGINE_HOME}"
if [ -z "$1" ]; then
error "Must specify the application id"
else
ANT_PARAMS="$ANT_PARAMS -Dappengine.app_id=$1"
fi
if [ "$2" ]; then
ANT_PARAMS="$ANT_PARAMS -Dappengine.version=$2"
fi
ant prepare_webapp_appengine
}
appengine_upload() {
appengine_build $1 $2
"$APPENGINE" update "$GRIDWORKS_BUILD_DIR/appengine"
}
appengine_run() {
appengine_build $1 $2
"$APPENGINE_LOCAL" "$GRIDWORKS_BUILD_DIR/appengine"
}
run() {
FORK=$1
check_running
if [ -z "$NOT_RUNNING" ]; then
warn "Gridworks is already running."
fi
if [ ! -d $GRIDWORKS_CLASSES_DIR ]; then
IS_JAR=`ls $GRIDWORKS_LIB_DIR | grep gridworks`
if [ -z "$IS_JAR" ]; then
@ -605,12 +584,6 @@ run() {
fi
fi
check_running
if [ -z "$NOT_RUNNING" ]; then
warn "Gridworks is already running."
fi
if [ -d $GRIDWORKS_CLASSES_DIR ]; then
add_option "-Dgridworks.autoreloading=true"
fi
@ -623,6 +596,18 @@ run() {
add_option "-Dgridworks.data_dir=$GRIDWORKS_DATA_DIR"
fi
if [ "$GRIDWORKS_WEBAPP" ]; then
add_option "-Dgridworks.webapp=$GRIDWORKS_WEBAPP"
fi
if [ "$GRIDWORKS_PORT" ]; then
add_option "-Dgridworks.port=$GRIDWORKS_PORT"
fi
if [ "$GRIDWORKS_HOST" ]; then
add_option "-Dgridworks.host=$GRIDWORKS_HOST"
fi
CLASSPATH="$GRIDWORKS_CLASSES_DIR${SEP}$GRIDWORKS_LIB_DIR/*"
RUN_CMD="$JAVA -cp $CLASSPATH $OPTS com.metaweb.gridworks.Gridworks"
@ -641,6 +626,85 @@ run() {
fi
}
broker_build() {
build_prepare
get_revision
ant prepare_broker
}
broker_run() {
FORK=$1
GRIDWORKS_HOST=127.0.0.1
GRIDWORKS_PORT=3334
check_running
if [ -z "$NOT_RUNNING" ]; then
warn "Gridworks Broker is already running."
fi
if [ ! -d "broker/core/WEB-INF/lib" ]; then
broker_build
echo ""
fi
if [ -d $GRIDWORKS_CLASSES_DIR ]; then
add_option "-Dgridworks.autoreloading=true"
fi
add_option "-Dgridworks.webapp=broker/core"
add_option "-Dgridworks.headless=true"
add_option "-Dgridworks.port=$GRIDWORKS_PORT"
add_option "-Dgridworks.host=0.0.0.0"
CLASSPATH="$GRIDWORKS_CLASSES_DIR${SEP}$GRIDWORKS_LIB_DIR/*"
RUN_CMD="$JAVA -cp $CLASSPATH $OPTS com.metaweb.gridworks.Gridworks"
#echo "$RUN_CMD"
#echo ""
echo "Starting Gridworks Broker at 'http://${GRIDWORKS_HOST}:${GRIDWORKS_PORT}/'"
echo ""
if [ -z "$FORK" ]; then
exec $RUN_CMD
else
$RUN_CMD &
GRIDWORKS_PID="$!"
fi
}
broker_appengine_build() {
appengine_prepare
get_revision
ANT_PARAMS="-Dappengine.sdk.dir=${APPENGINE_HOME}"
if [ "$1" ]; then
ANT_PARAMS="$ANT_PARAMS -Dappengine.app_id=$1"
fi
if [ "$2" ]; then
ANT_PARAMS="$ANT_PARAMS -Dappengine.version=$2"
fi
ant prepare_broker_appengine
}
broker_appengine_upload() {
broker_appengine_build $1 $2
"$APPENGINE" update "$GRIDWORKS_BUILD_DIR/broker/appengine"
}
broker_appengine_run() {
broker_appengine_build $1 $2
"$APPENGINE_LOCAL" "$GRIDWORKS_BUILD_DIR/broker/appengine"
}
findbugs() {
findbugs_prepare
@ -789,17 +853,14 @@ add_option "-Xms256M -Xmx$GRIDWORKS_MEMORY -Dgridworks.memory=$GRIDWORKS_MEMORY"
if [ -z "$GRIDWORKS_PORT" ]; then
GRIDWORKS_PORT="3333"
fi
add_option "-Dgridworks.port=$GRIDWORKS_PORT"
if [ -z "$GRIDWORKS_HOST" ]; then
GRIDWORKS_HOST="127.0.0.1"
fi
add_option "-Dgridworks.host=$GRIDWORKS_HOST"
if [ -z "$GRIDWORKS_WEBAPP" ]; then
GRIDWORKS_WEBAPP="main/webapp"
fi
add_option "-Dgridworks.webapp=$GRIDWORKS_WEBAPP"
if [ -z "$GRIDWORKS_TEST_DIR" ]; then
GRIDWORKS_TEST_DIR="main/tests"
@ -855,9 +916,9 @@ case "$ACTION" in
cpd) cpd;;
jslint) jslint;;
run) run;;
appengine_build) appengine_build $1 $2;;
appengine_run) appengine_run $1 $2;;
appengine_upload) appengine_upload $1 $2;;
broker) broker_run;;
broker_appengine_run) broker_appengine_run $1 $2;;
broker_appengine_upload) broker_appengine_upload $1 $2;;
mac_dist) mac_dist $1;;
windows_dist) windows_dist $1;;
linux_dist) linux_dist $1;;