had to shuffle around a bunch of classes to separate the main server classloader from the context classloader and allow reloading to happen for real

git-svn-id: http://google-refine.googlecode.com/svn/trunk@377 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
Stefano Mazzocchi 2010-04-03 01:01:11 +00:00
parent 72203cd3d5
commit c24ec94835
11 changed files with 40 additions and 17 deletions

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/server/java"/>
<classpathentry kind="src" path="tests/src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib/servlet-api-2.5.jar" sourcepath="lib-src/servlet-api-2.5-sources.jar"/>
@ -22,5 +23,5 @@
<classpathentry kind="lib" path="lib/jython-2.5.1.jar"/>
<classpathentry kind="lib" path="lib/clojure-1.1.0.jar"/>
<classpathentry kind="lib" path="tests/lib/junit-4.8.1.jar" sourcepath="tests/lib-src/junit-4.8.1-sources.jar"/>
<classpathentry kind="output" path="build/classes"/>
<classpathentry kind="output" path="src/main/webapp/WEB-INF/classes"/>
</classpath>

View File

@ -22,13 +22,15 @@
<property environment="env"/>
<property name="src.dir" value="${basedir}/src/main/java" />
<property name="server.src.dir" value="${basedir}/src/server/java" />
<property name="graphics.dir" value="${basedir}/src/graphics" />
<property name="conf.dir" value="${basedir}/src/conf" />
<property name="lib.dir" value="${basedir}/lib" />
<property name="tools.dir" value="${basedir}/thirdparty" />
<property name="tests.dir" value="${basedir}/tests" />
<property name="classes.dir" value="${build.dir}/classes" />
<property name="server_classes.dir" value="${build.dir}/classes" />
<property name="webapp_classes.dir" value="${basedir}/src/main/webapp/WEB-INF/classes" />
<property name="tests_classes.dir" value="${tests.dir}/classes" />
<property name="webapp.name" value="webapp" />
<property name="webapp.dir" value="${build.dir}/${webapp.name}" />
@ -43,19 +45,31 @@
</fileset>
</path>
<path id="webapp.class.path">
<pathelement path="${server_classes.dir}"/>
<path refid="class.path"/>
</path>
<path id="tests.class.path">
<path refid="class.path"/>
<fileset dir="${tests.dir}/lib">
<include name="**/*.jar" />
</fileset>
</path>
<target name="build">
<mkdir dir="${classes.dir}" />
<javac srcdir="${src.dir}" destdir="${classes.dir}" debug="true" includeAntRuntime="no">
<target name="build_server">
<mkdir dir="${server_classes.dir}" />
<javac srcdir="${server.src.dir}" destdir="${server_classes.dir}" debug="true" includeAntRuntime="no">
<classpath refid="class.path" />
</javac>
</target>
<target name="build" depends="build_server">
<mkdir dir="${webapp_classes.dir}" />
<javac srcdir="${src.dir}" destdir="${webapp_classes.dir}" debug="true" includeAntRuntime="no">
<classpath refid="webapp.class.path" />
</javac>
</target>
<target name="build_tests" depends="build">
<mkdir dir="${tests_classes.dir}" />
@ -65,7 +79,8 @@
</target>
<target name="jar" depends="build">
<jar destfile="${build.dir}/gridworks.jar" basedir="${classes.dir}"/>
<jar destfile="${build.dir}/gridworks.jar" basedir="${webapp_classes.dir}"/>
<jar destfile="${build.dir}/gridworks-server.jar" basedir="${server_classes.dir}"/>
</target>
<target name="prepare_webapp">
@ -74,6 +89,7 @@
<copy todir="${webapp.dir}">
<fileset dir="${basedir}/src/main/webapp">
<include name="**/*"/>
<exclude name="WEB-INF/classes/**"/>
</fileset>
</copy>
@ -114,6 +130,7 @@
<include name="**/*.jar" />
</jarfileset>
<jarfilelist dir="${build.dir}" files="gridworks.jar" />
<jarfilelist dir="${build.dir}" files="gridworks-server.jar" />
<resourcefileset dir="${webapp.dir}/..">
<include name="${webapp.name}/**" />
</resourcefileset>
@ -165,6 +182,7 @@
</fileset>
</copy>
<copy file="${build.dir}/gridworks.jar" tofile="${windows.dir}/lib/gridworks-${version}-${revision}.jar"/>
<copy file="${build.dir}/gridworks-server.jar" tofile="${windows.dir}/lib/gridworks-server-${version}-${revision}.jar"/>
<copy todir="${windows.dir}/webapp">
<fileset dir="${webapp.dir}">
<include name="**"/>
@ -195,6 +213,7 @@
</copy>
<copy file="${build.dir}/gridworks.jar" tofile="${linux.dir}/lib/gridworks-${version}-${revision}.jar"/>
<copy file="${build.dir}/gridworks-server.jar" tofile="${linux.dir}/lib/gridworks-server-${version}-${revision}.jar"/>
<copy todir="${linux.dir}/src/main/webapp">
<fileset dir="${webapp.dir}">
@ -211,6 +230,8 @@
<copy file="${basedir}/README.txt" tofile="${linux.dir}/README.txt"/>
<copy file="${basedir}/gridworks" tofile="${linux.dir}/gridworks"/>
<echo file="${linux.dir}/.revision" append="false">${revision}</echo>
<tar longfile="gnu" compression="gzip" destfile="${dist.dir}/gridworks-${version}-${revision}.tar.gz">
<tarfileset dir="${linux.dir}/.." filemode="755">
<include name="${linux.name}/gridworks"/>
@ -224,11 +245,12 @@
<target name="clean">
<delete file="${build.dir}/gridworks.jar" />
<delete dir="${classes.dir}" />
<delete dir="${server_classes.dir}" />
<delete dir="${webapp_classes.dir}" />
<delete dir="${tests_classes.dir}" />
</target>
<target name="distclean">
<target name="distclean" depends="clean">
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
</target>

View File

@ -138,6 +138,8 @@ get_revision() {
INFO=`svn info`
elif [ -d ".git" ]; then
INFO=`git svn info`
elif [ -f ".revision" ]; then
REVISION=`cat .revision`
else
error "cannot obtain revision, exiting!"
fi

View File

@ -127,7 +127,7 @@ public class GridworksServlet extends HttpServlet {
super.init();
ProjectManager.initialize();
if (_timer == null) {
_timer = new Timer();
}

View File

@ -193,7 +193,7 @@ public class CreateProjectCommand extends Command {
}
}
}
Gridworks.log("Most frequent extensions: " + exts.toString());
Gridworks.log("**** Most frequent extensions: " + exts.toString());
} else if (fileName.endsWith(".zip")) {

View File

@ -139,7 +139,6 @@ class GridworksServer extends Server {
this.addConnector(connector);
final File contextRoot = new File(Configurations.get("gridworks.webapp","webapp"));
final File classRoot = new File(Configurations.get("gridworks.classes","build/classes"));
final String contextPath = Configurations.get("gridworks.context_path","/");
File webXml = new File(contextRoot, "WEB-INF/web.xml");
@ -159,7 +158,7 @@ class GridworksServer extends Server {
// Enable context autoreloading
if (Configurations.getBoolean("gridworks.autoreloading",false)) {
scanForUpdates(contextRoot, classRoot, context);
scanForUpdates(contextRoot, context);
}
this.start();
@ -178,14 +177,13 @@ class GridworksServer extends Server {
}
}
private void scanForUpdates(final File contextRoot, final File classRoot, final WebAppContext context) {
private void scanForUpdates(final File contextRoot, final WebAppContext context) {
List<File> scanList = new ArrayList<File>();
scanList.add(new File(contextRoot, "WEB-INF/web.xml"));
findFiles(".class", new File(contextRoot, "WEB-INF"), scanList);
findFiles(".class", classRoot, scanList);
findFiles(".class", new File(contextRoot, "WEB-INF/classes"), scanList);
Gridworks.info("Starting autoreloading scanner... [class dir: " + classRoot.getAbsolutePath() + "]");
Gridworks.info("Starting autoreloading scanner... ");
Scanner scanner = new Scanner();
scanner.setScanInterval(Configurations.getInteger("gridworks.scanner.period",1));