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:
parent
058e86b4c8
commit
777e4ce0e8
2
.gitignore
vendored
2
.gitignore
vendored
@ -12,4 +12,4 @@ extensions/jython/module/MOD-INF/classes/
|
|||||||
extensions/jython/module/MOD-INF/lib/cachedir/
|
extensions/jython/module/MOD-INF/lib/cachedir/
|
||||||
broker/appengine/module/MOD-INF/classes/
|
broker/appengine/module/MOD-INF/classes/
|
||||||
broker/core/module/MOD-INF/classes/
|
broker/core/module/MOD-INF/classes/
|
||||||
broker/local/module/MOD-INF/classes/
|
broker/core/WEB-INF/lib/
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
#
|
|
||||||
# Butterfly Modules Configuration
|
|
||||||
#
|
|
||||||
|
|
||||||
appengine-broker = /
|
|
@ -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>
|
|
@ -1,5 +1,4 @@
|
|||||||
name = appengine-broker
|
name = broker
|
||||||
extends = broker
|
description = Google App Engine implementation of Gridworks Broker
|
||||||
description = Google App Engine implementation of Gridworks Broker Module
|
module-impl = com.metaweb.gridworks.broker.AppEngineGridworksBrokerImpl
|
||||||
module-impl = com.metaweb.gridworks.broker.AppEngineGridworksBroker
|
|
||||||
templating = false
|
templating = false
|
||||||
|
@ -28,7 +28,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
import com.google.appengine.api.datastore.Text;
|
import com.google.appengine.api.datastore.Text;
|
||||||
import com.metaweb.gridworks.appengine.AppEngineClientConnectionManager;
|
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");
|
protected static final Logger logger = LoggerFactory.getLogger("gridworks.broker.appengine");
|
||||||
|
|
@ -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/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-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="/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/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/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 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"/>
|
||||||
|
@ -19,7 +19,7 @@ butterfly.url = /
|
|||||||
|
|
||||||
# ---------- Module ------
|
# ---------- Module ------
|
||||||
|
|
||||||
butterfly.modules.path = modules
|
butterfly.modules.path = ./
|
||||||
|
|
||||||
butterfly.modules.wirings = WEB-INF/modules.properties
|
butterfly.modules.wirings = WEB-INF/modules.properties
|
||||||
|
|
@ -2,4 +2,4 @@
|
|||||||
# Butterfly Modules Configuration
|
# Butterfly Modules Configuration
|
||||||
#
|
#
|
||||||
|
|
||||||
local-broker = /
|
broker = /
|
@ -1,4 +1,4 @@
|
|||||||
name = broker
|
name = broker
|
||||||
description = Gridworks Broker
|
description = Local Gridworks Broker
|
||||||
module-impl = com.metaweb.gridworks.broker.GridworksBroker
|
module-impl = com.metaweb.gridworks.broker.GridworksBrokerImpl
|
||||||
templating = false
|
templating = false
|
||||||
|
@ -81,9 +81,9 @@ public abstract class GridworksBroker extends ButterflyModuleImpl {
|
|||||||
@Override
|
@Override
|
||||||
public boolean process(String path, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
public boolean process(String path, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug("> process {}", path);
|
logger.debug("> process '{}'", path);
|
||||||
} else {
|
} else {
|
||||||
logger.info("process {}", path);
|
logger.info("process '{}'", path);
|
||||||
}
|
}
|
||||||
|
|
||||||
response.setCharacterEncoding("UTF-8");
|
response.setCharacterEncoding("UTF-8");
|
||||||
@ -115,19 +115,23 @@ public abstract class GridworksBroker extends ButterflyModuleImpl {
|
|||||||
startProject(response, pid, uid, getParameter(request, "lock"), getParameter(request, "data"));
|
startProject(response, pid, uid, getParameter(request, "lock"), getParameter(request, "data"));
|
||||||
} else if ("get".equals(path)) {
|
} else if ("get".equals(path)) {
|
||||||
getProject(response, pid);
|
getProject(response, pid);
|
||||||
|
} else {
|
||||||
|
boolean value = super.process(path, request, response);
|
||||||
|
if (logger.isDebugEnabled()) logger.debug("< process '{}'", path);
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
logger.error("runtime error", e);
|
logger.error("runtime error", e.getMessage());
|
||||||
respondError(response, e.getMessage());
|
respondError(response, e.getMessage());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("internal error", e);
|
logger.error("internal error", e);
|
||||||
respondException(response, 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------
|
||||||
|
@ -27,7 +27,7 @@ import com.sleepycat.persist.StoreConfig;
|
|||||||
import com.sleepycat.persist.model.Entity;
|
import com.sleepycat.persist.model.Entity;
|
||||||
import com.sleepycat.persist.model.PrimaryKey;
|
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");
|
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);
|
timer.schedule(expirer, LOCK_EXPIRATION_CHECK_DELAY, LOCK_EXPIRATION_CHECK_DELAY);
|
||||||
|
|
||||||
File dataPath = new File("data"); // FIXME: data should be configurable;
|
File dataPath = new File("data"); // FIXME: data should be configurable;
|
||||||
|
if (!dataPath.exists()) dataPath.mkdirs();
|
||||||
|
|
||||||
EnvironmentConfig envConfig = new EnvironmentConfig();
|
EnvironmentConfig envConfig = new EnvironmentConfig();
|
||||||
envConfig.setAllowCreate(true);
|
envConfig.setAllowCreate(true);
|
||||||
@ -86,12 +87,14 @@ public class LocalGridworksBroker extends GridworksBroker {
|
|||||||
|
|
||||||
class LockExpirer extends TimerTask {
|
class LockExpirer extends TimerTask {
|
||||||
public void run() {
|
public void run() {
|
||||||
for (Lock lock : lockByProject.entities()) {
|
if (lockByProject != null) {
|
||||||
if (lock.timestamp + LOCK_DURATION < System.currentTimeMillis()) {
|
for (Lock lock : lockByProject.entities()) {
|
||||||
try {
|
if (lock.timestamp + LOCK_DURATION < System.currentTimeMillis()) {
|
||||||
releaseLock(null, lock.pid, lock.uid, lock.id);
|
try {
|
||||||
} catch (Exception e) {
|
releaseLock(null, lock.pid, lock.uid, lock.id);
|
||||||
logger.error("Exception while expiring lock for project '" + lock.pid + "'", e);
|
} catch (Exception e) {
|
||||||
|
logger.error("Exception while expiring lock for project '" + lock.pid + "'", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -265,7 +268,7 @@ public class LocalGridworksBroker extends GridworksBroker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
class Project {
|
static class Project {
|
||||||
|
|
||||||
@PrimaryKey
|
@PrimaryKey
|
||||||
String pid;
|
String pid;
|
||||||
@ -317,7 +320,7 @@ public class LocalGridworksBroker extends GridworksBroker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
class Lock {
|
static class Lock {
|
||||||
|
|
||||||
@PrimaryKey
|
@PrimaryKey
|
||||||
String pid;
|
String pid;
|
@ -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>
|
|
@ -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>
|
|
@ -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
|
|
||||||
|
|
@ -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
|
|
175
build.xml
175
build.xml
@ -30,7 +30,7 @@
|
|||||||
<not><isset property="dist.dir"/></not>
|
<not><isset property="dist.dir"/></not>
|
||||||
</condition>
|
</condition>
|
||||||
|
|
||||||
<condition property="appengine.app_id" value="mygridworks">
|
<condition property="appengine.app_id" value="gridworks-broker">
|
||||||
<not><isset property="appengine.app_id"/></not>
|
<not><isset property="appengine.app_id"/></not>
|
||||||
</condition>
|
</condition>
|
||||||
|
|
||||||
@ -56,12 +56,10 @@
|
|||||||
<property name="server.lib.dir" value="${server.dir}/lib" />
|
<property name="server.lib.dir" value="${server.dir}/lib" />
|
||||||
<property name="server.classes.dir" value="${server.dir}/classes" />
|
<property name="server.classes.dir" value="${server.dir}/classes" />
|
||||||
|
|
||||||
<property name="appengine.dir" value="${basedir}/appengine" />
|
<property name="broker.dir" value="${basedir}/broker" />
|
||||||
<property name="appengine.src.dir" value="${appengine.dir}/src" />
|
<property name="broker.core.dir" value="${broker.dir}/core" />
|
||||||
<property name="appengine.webapp.dir" value="${appengine.dir}/webapp" />
|
<property name="broker.appengine.dir" value="${broker.dir}/appengine" />
|
||||||
<property name="appengine.lib.dir" value="${appengine.webapp.dir}/WEB-INF/lib" />
|
|
||||||
<property name="appengine.classes.dir" value="${appengine.dir}/classes" />
|
|
||||||
|
|
||||||
<property name="tests.dir" value="${main.dir}/tests" />
|
<property name="tests.dir" value="${main.dir}/tests" />
|
||||||
<property name="server.tests.dir" value="${tests.dir}/server" />
|
<property name="server.tests.dir" value="${tests.dir}/server" />
|
||||||
<property name="server.tests.lib.dir" value="${server.tests.dir}/lib" />
|
<property name="server.tests.lib.dir" value="${server.tests.dir}/lib" />
|
||||||
@ -76,7 +74,8 @@
|
|||||||
|
|
||||||
<property name="built.webapp.name" value="webapp" />
|
<property name="built.webapp.name" value="webapp" />
|
||||||
<property name="built.webapp.dir" value="${build.dir}/${built.webapp.name}" />
|
<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="mac.dir" value="${build.dir}/mac" />
|
||||||
<property name="windows.dir" value="${build.dir}/windows" />
|
<property name="windows.dir" value="${build.dir}/windows" />
|
||||||
@ -102,13 +101,6 @@
|
|||||||
<pathelement location="${webapp.classes.dir}"/>
|
<pathelement location="${webapp.classes.dir}"/>
|
||||||
</path>
|
</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 id="tests.class.path">
|
||||||
<path refid="webapp.class.path"/>
|
<path refid="webapp.class.path"/>
|
||||||
<fileset dir="${server.tests.lib.dir}">
|
<fileset dir="${server.tests.lib.dir}">
|
||||||
@ -116,6 +108,35 @@
|
|||||||
</fileset>
|
</fileset>
|
||||||
</path>
|
</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">
|
<target name="build_server">
|
||||||
@ -135,14 +156,6 @@
|
|||||||
<copy file="${webapp.src.dir}/log4j.properties" tofile="${webapp.classes.dir}/log4j.properties"/>
|
<copy file="${webapp.src.dir}/log4j.properties" tofile="${webapp.classes.dir}/log4j.properties"/>
|
||||||
</target>
|
</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">
|
<target name="build_tests" depends="build_webapp, build_server">
|
||||||
<mkdir dir="${server.tests.classes.dir}" />
|
<mkdir dir="${server.tests.classes.dir}" />
|
||||||
<javac srcdir="${server.tests.src.dir}" destdir="${server.tests.classes.dir}" debug="true" includeAntRuntime="no">
|
<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" 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">
|
<target name="jar_server" depends="build_server">
|
||||||
@ -167,10 +206,6 @@
|
|||||||
<jar destfile="${build.dir}/${fullname}.jar" basedir="${webapp.classes.dir}"/>
|
<jar destfile="${build.dir}/${fullname}.jar" basedir="${webapp.classes.dir}"/>
|
||||||
</target>
|
</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"/>
|
<target name="jar" depends="jar_server, jar_webapp"/>
|
||||||
|
|
||||||
<!-- ================================================================== -->
|
<!-- ================================================================== -->
|
||||||
@ -416,33 +451,78 @@
|
|||||||
|
|
||||||
<!-- ================================================================== -->
|
<!-- ================================================================== -->
|
||||||
|
|
||||||
<target name="prepare_webapp_appengine" depends="jar_appengine">
|
<target name="prepare_broker" depends="jar_server, build_broker_local">
|
||||||
<mkdir dir="${built.appengine.webapp.dir}" />
|
<copy todir="${broker.core.dir}/WEB-INF/lib">
|
||||||
|
<fileset dir="${webapp.lib.dir}">
|
||||||
<copy todir="${built.appengine.webapp.dir}">
|
<include name="**/butterfly*.jar" />
|
||||||
<fileset dir="${webapp.dir}">
|
<include name="**/rhino*.jar" />
|
||||||
<include name="WEB-INF/lib/slf4j**"/>
|
<include name="**/commons-collections*.jar" />
|
||||||
<exclude name="WEB-INF/lib/slf4j-log4j*"/>
|
<include name="**/velocity*.jar" />
|
||||||
<exclude name="WEB-INF/lib-src/**"/>
|
<include name="**/lessen*.jar" />
|
||||||
<exclude name="WEB-INF/classes/**"/>
|
<include name="**/slf4j*.jar" />
|
||||||
|
<include name="**/log4j*.jar" />
|
||||||
|
|
||||||
|
<include name="**/json*.jar" />
|
||||||
|
<include name="**/http*.jar" />
|
||||||
|
<include name="**/jcl*.jar" />
|
||||||
</fileset>
|
</fileset>
|
||||||
</copy>
|
</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 file="${build.dir}/${fullname}-appengine.jar" tofile="${built.appengine.webapp.dir}/WEB-INF/lib/${fullname}-appengine.jar"/>
|
<copy todir="${built.broker.webapp.dir}/appengine">
|
||||||
|
<fileset dir="${broker.appengine.dir}">
|
||||||
<copy todir="${built.appengine.webapp.dir}/WEB-INF/lib" flatten="true">
|
<include name="WEB-INF/**"/>
|
||||||
|
<exclude name="WEB-INF/jdo*"/>
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
|
||||||
|
<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.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">
|
<fileset dir="${appengine.sdk.dir}/lib/user">
|
||||||
<include name="**/*.jar" />
|
<include name="**/*.jar" />
|
||||||
</fileset>
|
</fileset>
|
||||||
</copy>
|
</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="$APPID" value="${appengine.app_id}"/>
|
||||||
<replacefilter token="$VERSION" value="${appengine.version}"/>
|
<replacefilter token="$VERSION" value="${appengine.version}"/>
|
||||||
</replace>
|
</replace>
|
||||||
@ -455,8 +535,9 @@
|
|||||||
<delete file="${build.dir}/${fullname}-server.jar" />
|
<delete file="${build.dir}/${fullname}-server.jar" />
|
||||||
<delete dir="${server.classes.dir}" />
|
<delete dir="${server.classes.dir}" />
|
||||||
<delete dir="${webapp.classes.dir}" />
|
<delete dir="${webapp.classes.dir}" />
|
||||||
<delete dir="${appengine.classes.dir}" />
|
|
||||||
<delete dir="${server.tests.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>
|
||||||
|
|
||||||
<target name="distclean" depends="clean">
|
<target name="distclean" depends="clean">
|
||||||
|
183
gridworks
183
gridworks
@ -55,31 +55,32 @@ where [options] include:
|
|||||||
|
|
||||||
and <action> is one of
|
and <action> is one of
|
||||||
|
|
||||||
build ............................ Build Gridworks
|
build ............................... Build Gridworks
|
||||||
run .............................. Run Gridworks [default]
|
run ................................. Run Gridworks [default]
|
||||||
|
|
||||||
test ............................. Run all Gridworks tests
|
test ................................ Run all Gridworks tests
|
||||||
server_test ...................... Run only the server tests
|
server_test ......................... Run only the server tests
|
||||||
ui_test .......................... Run only the UI tests
|
ui_test ............................. Run only the UI tests
|
||||||
|
|
||||||
appengine_build <id> <version> ... Build Gridworks for Google App Engine
|
broker .............................. Run Gridworks Broker
|
||||||
appengine_run <id> <version> ..... Run Gridworks for Google App Engine in local server
|
|
||||||
appengine_upload <id> <version>... Upload Gridworks to Google App Engine
|
|
||||||
|
|
||||||
findbugs ......................... Run Findbugs against Gridworks
|
broker_appengine_run <id> <ver> ..... Run Gridworks Broker for Google App Engine in local server
|
||||||
pmd .............................. Run PMD against Gridworks
|
broker_appengine_upload <id> <ver> .. Upload Gridworks to Google App Engine
|
||||||
cpd .............................. Run Copy/Paste Detection against Gridworks
|
|
||||||
jslint ........................... Run JSlint against Gridworks
|
findbugs ............................ Run Findbugs against Gridworks
|
||||||
|
pmd ................................. Run PMD against Gridworks
|
||||||
|
cpd ................................. Run Copy/Paste Detection against Gridworks
|
||||||
|
jslint .............................. Run JSlint against Gridworks
|
||||||
|
|
||||||
whitespace <extension> ........... Normalize whitespace in files with the given extension
|
whitespace <extension> .............. Normalize whitespace in files with the given extension
|
||||||
|
|
||||||
mac_dist <version> ............... Make MacOSX binary distribution
|
mac_dist <version> .................. Make MacOSX binary distribution
|
||||||
windows_dist <version> ........... Make Windows binary distribution
|
windows_dist <version> .............. Make Windows binary distribution
|
||||||
linux_dist <version> ............. Make Linux binary distribution
|
linux_dist <version> ................ Make Linux binary distribution
|
||||||
dist <version> ................... Make all distributions
|
dist <version> ...................... Make all distributions
|
||||||
|
|
||||||
clean ............................ Clean compiled classes
|
clean ............................... Clean compiled classes
|
||||||
distclean ........................ Remove all generated files
|
distclean ........................... Remove all generated files
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
exit 1
|
exit 1
|
||||||
@ -566,37 +567,15 @@ server_test() {
|
|||||||
$RUN_CMD || error "Failed passing server tests"
|
$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() {
|
run() {
|
||||||
FORK=$1
|
FORK=$1
|
||||||
|
|
||||||
|
check_running
|
||||||
|
|
||||||
|
if [ -z "$NOT_RUNNING" ]; then
|
||||||
|
warn "Gridworks is already running."
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! -d $GRIDWORKS_CLASSES_DIR ]; then
|
if [ ! -d $GRIDWORKS_CLASSES_DIR ]; then
|
||||||
IS_JAR=`ls $GRIDWORKS_LIB_DIR | grep gridworks`
|
IS_JAR=`ls $GRIDWORKS_LIB_DIR | grep gridworks`
|
||||||
if [ -z "$IS_JAR" ]; then
|
if [ -z "$IS_JAR" ]; then
|
||||||
@ -604,13 +583,7 @@ run() {
|
|||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
check_running
|
|
||||||
|
|
||||||
if [ -z "$NOT_RUNNING" ]; then
|
|
||||||
warn "Gridworks is already running."
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -d $GRIDWORKS_CLASSES_DIR ]; then
|
if [ -d $GRIDWORKS_CLASSES_DIR ]; then
|
||||||
add_option "-Dgridworks.autoreloading=true"
|
add_option "-Dgridworks.autoreloading=true"
|
||||||
fi
|
fi
|
||||||
@ -622,7 +595,19 @@ run() {
|
|||||||
if [ "$GRIDWORKS_DATA_DIR" ]; then
|
if [ "$GRIDWORKS_DATA_DIR" ]; then
|
||||||
add_option "-Dgridworks.data_dir=$GRIDWORKS_DATA_DIR"
|
add_option "-Dgridworks.data_dir=$GRIDWORKS_DATA_DIR"
|
||||||
fi
|
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/*"
|
CLASSPATH="$GRIDWORKS_CLASSES_DIR${SEP}$GRIDWORKS_LIB_DIR/*"
|
||||||
|
|
||||||
RUN_CMD="$JAVA -cp $CLASSPATH $OPTS com.metaweb.gridworks.Gridworks"
|
RUN_CMD="$JAVA -cp $CLASSPATH $OPTS com.metaweb.gridworks.Gridworks"
|
||||||
@ -641,6 +626,85 @@ run() {
|
|||||||
fi
|
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() {
|
||||||
findbugs_prepare
|
findbugs_prepare
|
||||||
|
|
||||||
@ -789,17 +853,14 @@ add_option "-Xms256M -Xmx$GRIDWORKS_MEMORY -Dgridworks.memory=$GRIDWORKS_MEMORY"
|
|||||||
if [ -z "$GRIDWORKS_PORT" ]; then
|
if [ -z "$GRIDWORKS_PORT" ]; then
|
||||||
GRIDWORKS_PORT="3333"
|
GRIDWORKS_PORT="3333"
|
||||||
fi
|
fi
|
||||||
add_option "-Dgridworks.port=$GRIDWORKS_PORT"
|
|
||||||
|
|
||||||
if [ -z "$GRIDWORKS_HOST" ]; then
|
if [ -z "$GRIDWORKS_HOST" ]; then
|
||||||
GRIDWORKS_HOST="127.0.0.1"
|
GRIDWORKS_HOST="127.0.0.1"
|
||||||
fi
|
fi
|
||||||
add_option "-Dgridworks.host=$GRIDWORKS_HOST"
|
|
||||||
|
|
||||||
if [ -z "$GRIDWORKS_WEBAPP" ]; then
|
if [ -z "$GRIDWORKS_WEBAPP" ]; then
|
||||||
GRIDWORKS_WEBAPP="main/webapp"
|
GRIDWORKS_WEBAPP="main/webapp"
|
||||||
fi
|
fi
|
||||||
add_option "-Dgridworks.webapp=$GRIDWORKS_WEBAPP"
|
|
||||||
|
|
||||||
if [ -z "$GRIDWORKS_TEST_DIR" ]; then
|
if [ -z "$GRIDWORKS_TEST_DIR" ]; then
|
||||||
GRIDWORKS_TEST_DIR="main/tests"
|
GRIDWORKS_TEST_DIR="main/tests"
|
||||||
@ -855,9 +916,9 @@ case "$ACTION" in
|
|||||||
cpd) cpd;;
|
cpd) cpd;;
|
||||||
jslint) jslint;;
|
jslint) jslint;;
|
||||||
run) run;;
|
run) run;;
|
||||||
appengine_build) appengine_build $1 $2;;
|
broker) broker_run;;
|
||||||
appengine_run) appengine_run $1 $2;;
|
broker_appengine_run) broker_appengine_run $1 $2;;
|
||||||
appengine_upload) appengine_upload $1 $2;;
|
broker_appengine_upload) broker_appengine_upload $1 $2;;
|
||||||
mac_dist) mac_dist $1;;
|
mac_dist) mac_dist $1;;
|
||||||
windows_dist) windows_dist $1;;
|
windows_dist) windows_dist $1;;
|
||||||
linux_dist) linux_dist $1;;
|
linux_dist) linux_dist $1;;
|
||||||
|
Loading…
Reference in New Issue
Block a user