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:
parent
72203cd3d5
commit
c24ec94835
@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src/main/java"/>
|
<classpathentry kind="src" path="src/main/java"/>
|
||||||
|
<classpathentry kind="src" path="src/server/java"/>
|
||||||
<classpathentry kind="src" path="tests/src"/>
|
<classpathentry kind="src" path="tests/src"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
<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"/>
|
<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/jython-2.5.1.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/clojure-1.1.0.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="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>
|
</classpath>
|
||||||
|
38
build.xml
38
build.xml
@ -22,13 +22,15 @@
|
|||||||
<property environment="env"/>
|
<property environment="env"/>
|
||||||
|
|
||||||
<property name="src.dir" value="${basedir}/src/main/java" />
|
<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="graphics.dir" value="${basedir}/src/graphics" />
|
||||||
<property name="conf.dir" value="${basedir}/src/conf" />
|
<property name="conf.dir" value="${basedir}/src/conf" />
|
||||||
<property name="lib.dir" value="${basedir}/lib" />
|
<property name="lib.dir" value="${basedir}/lib" />
|
||||||
<property name="tools.dir" value="${basedir}/thirdparty" />
|
<property name="tools.dir" value="${basedir}/thirdparty" />
|
||||||
<property name="tests.dir" value="${basedir}/tests" />
|
<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="tests_classes.dir" value="${tests.dir}/classes" />
|
||||||
<property name="webapp.name" value="webapp" />
|
<property name="webapp.name" value="webapp" />
|
||||||
<property name="webapp.dir" value="${build.dir}/${webapp.name}" />
|
<property name="webapp.dir" value="${build.dir}/${webapp.name}" />
|
||||||
@ -43,19 +45,31 @@
|
|||||||
</fileset>
|
</fileset>
|
||||||
</path>
|
</path>
|
||||||
|
|
||||||
|
<path id="webapp.class.path">
|
||||||
|
<pathelement path="${server_classes.dir}"/>
|
||||||
|
<path refid="class.path"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
<path id="tests.class.path">
|
<path id="tests.class.path">
|
||||||
<path refid="class.path"/>
|
<path refid="class.path"/>
|
||||||
<fileset dir="${tests.dir}/lib">
|
<fileset dir="${tests.dir}/lib">
|
||||||
<include name="**/*.jar" />
|
<include name="**/*.jar" />
|
||||||
</fileset>
|
</fileset>
|
||||||
</path>
|
</path>
|
||||||
|
|
||||||
<target name="build">
|
<target name="build_server">
|
||||||
<mkdir dir="${classes.dir}" />
|
<mkdir dir="${server_classes.dir}" />
|
||||||
<javac srcdir="${src.dir}" destdir="${classes.dir}" debug="true" includeAntRuntime="no">
|
<javac srcdir="${server.src.dir}" destdir="${server_classes.dir}" debug="true" includeAntRuntime="no">
|
||||||
<classpath refid="class.path" />
|
<classpath refid="class.path" />
|
||||||
</javac>
|
</javac>
|
||||||
</target>
|
</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">
|
<target name="build_tests" depends="build">
|
||||||
<mkdir dir="${tests_classes.dir}" />
|
<mkdir dir="${tests_classes.dir}" />
|
||||||
@ -65,7 +79,8 @@
|
|||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="jar" depends="build">
|
<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>
|
||||||
|
|
||||||
<target name="prepare_webapp">
|
<target name="prepare_webapp">
|
||||||
@ -74,6 +89,7 @@
|
|||||||
<copy todir="${webapp.dir}">
|
<copy todir="${webapp.dir}">
|
||||||
<fileset dir="${basedir}/src/main/webapp">
|
<fileset dir="${basedir}/src/main/webapp">
|
||||||
<include name="**/*"/>
|
<include name="**/*"/>
|
||||||
|
<exclude name="WEB-INF/classes/**"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
</copy>
|
</copy>
|
||||||
|
|
||||||
@ -114,6 +130,7 @@
|
|||||||
<include name="**/*.jar" />
|
<include name="**/*.jar" />
|
||||||
</jarfileset>
|
</jarfileset>
|
||||||
<jarfilelist dir="${build.dir}" files="gridworks.jar" />
|
<jarfilelist dir="${build.dir}" files="gridworks.jar" />
|
||||||
|
<jarfilelist dir="${build.dir}" files="gridworks-server.jar" />
|
||||||
<resourcefileset dir="${webapp.dir}/..">
|
<resourcefileset dir="${webapp.dir}/..">
|
||||||
<include name="${webapp.name}/**" />
|
<include name="${webapp.name}/**" />
|
||||||
</resourcefileset>
|
</resourcefileset>
|
||||||
@ -165,6 +182,7 @@
|
|||||||
</fileset>
|
</fileset>
|
||||||
</copy>
|
</copy>
|
||||||
<copy file="${build.dir}/gridworks.jar" tofile="${windows.dir}/lib/gridworks-${version}-${revision}.jar"/>
|
<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">
|
<copy todir="${windows.dir}/webapp">
|
||||||
<fileset dir="${webapp.dir}">
|
<fileset dir="${webapp.dir}">
|
||||||
<include name="**"/>
|
<include name="**"/>
|
||||||
@ -195,6 +213,7 @@
|
|||||||
</copy>
|
</copy>
|
||||||
|
|
||||||
<copy file="${build.dir}/gridworks.jar" tofile="${linux.dir}/lib/gridworks-${version}-${revision}.jar"/>
|
<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">
|
<copy todir="${linux.dir}/src/main/webapp">
|
||||||
<fileset dir="${webapp.dir}">
|
<fileset dir="${webapp.dir}">
|
||||||
@ -211,6 +230,8 @@
|
|||||||
<copy file="${basedir}/README.txt" tofile="${linux.dir}/README.txt"/>
|
<copy file="${basedir}/README.txt" tofile="${linux.dir}/README.txt"/>
|
||||||
<copy file="${basedir}/gridworks" tofile="${linux.dir}/gridworks"/>
|
<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">
|
<tar longfile="gnu" compression="gzip" destfile="${dist.dir}/gridworks-${version}-${revision}.tar.gz">
|
||||||
<tarfileset dir="${linux.dir}/.." filemode="755">
|
<tarfileset dir="${linux.dir}/.." filemode="755">
|
||||||
<include name="${linux.name}/gridworks"/>
|
<include name="${linux.name}/gridworks"/>
|
||||||
@ -224,11 +245,12 @@
|
|||||||
|
|
||||||
<target name="clean">
|
<target name="clean">
|
||||||
<delete file="${build.dir}/gridworks.jar" />
|
<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}" />
|
<delete dir="${tests_classes.dir}" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="distclean">
|
<target name="distclean" depends="clean">
|
||||||
<delete dir="${build.dir}" />
|
<delete dir="${build.dir}" />
|
||||||
<delete dir="${dist.dir}" />
|
<delete dir="${dist.dir}" />
|
||||||
</target>
|
</target>
|
||||||
|
@ -138,6 +138,8 @@ get_revision() {
|
|||||||
INFO=`svn info`
|
INFO=`svn info`
|
||||||
elif [ -d ".git" ]; then
|
elif [ -d ".git" ]; then
|
||||||
INFO=`git svn info`
|
INFO=`git svn info`
|
||||||
|
elif [ -f ".revision" ]; then
|
||||||
|
REVISION=`cat .revision`
|
||||||
else
|
else
|
||||||
error "cannot obtain revision, exiting!"
|
error "cannot obtain revision, exiting!"
|
||||||
fi
|
fi
|
||||||
|
@ -127,7 +127,7 @@ public class GridworksServlet extends HttpServlet {
|
|||||||
super.init();
|
super.init();
|
||||||
|
|
||||||
ProjectManager.initialize();
|
ProjectManager.initialize();
|
||||||
|
|
||||||
if (_timer == null) {
|
if (_timer == null) {
|
||||||
_timer = new Timer();
|
_timer = new Timer();
|
||||||
}
|
}
|
||||||
|
@ -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")) {
|
} else if (fileName.endsWith(".zip")) {
|
||||||
|
@ -139,7 +139,6 @@ class GridworksServer extends Server {
|
|||||||
this.addConnector(connector);
|
this.addConnector(connector);
|
||||||
|
|
||||||
final File contextRoot = new File(Configurations.get("gridworks.webapp","webapp"));
|
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","/");
|
final String contextPath = Configurations.get("gridworks.context_path","/");
|
||||||
|
|
||||||
File webXml = new File(contextRoot, "WEB-INF/web.xml");
|
File webXml = new File(contextRoot, "WEB-INF/web.xml");
|
||||||
@ -159,7 +158,7 @@ class GridworksServer extends Server {
|
|||||||
|
|
||||||
// Enable context autoreloading
|
// Enable context autoreloading
|
||||||
if (Configurations.getBoolean("gridworks.autoreloading",false)) {
|
if (Configurations.getBoolean("gridworks.autoreloading",false)) {
|
||||||
scanForUpdates(contextRoot, classRoot, context);
|
scanForUpdates(contextRoot, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.start();
|
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>();
|
List<File> scanList = new ArrayList<File>();
|
||||||
|
|
||||||
scanList.add(new File(contextRoot, "WEB-INF/web.xml"));
|
scanList.add(new File(contextRoot, "WEB-INF/web.xml"));
|
||||||
findFiles(".class", new File(contextRoot, "WEB-INF"), scanList);
|
findFiles(".class", new File(contextRoot, "WEB-INF/classes"), scanList);
|
||||||
findFiles(".class", classRoot, scanList);
|
|
||||||
|
|
||||||
Gridworks.info("Starting autoreloading scanner... [class dir: " + classRoot.getAbsolutePath() + "]");
|
Gridworks.info("Starting autoreloading scanner... ");
|
||||||
|
|
||||||
Scanner scanner = new Scanner();
|
Scanner scanner = new Scanner();
|
||||||
scanner.setScanInterval(Configurations.getInteger("gridworks.scanner.period",1));
|
scanner.setScanInterval(Configurations.getInteger("gridworks.scanner.period",1));
|
Loading…
Reference in New Issue
Block a user