shuber 2005/10/07 16:08:02 CEST
Modified files:
core jahia.iml project.xml
core/src/java/org/jahia/bin HypersonicLauncherServlet.java
JahiaConfigurationWizard.java
core/src/java/org/jahia/bin/filters/esi ESIFilter.java
core/src/webapp/WEB-INF/etc/spring
applicationcontext-hibernate.xml
Log:
- Improve HSQLDB start/shutdown code, still some improvements to be made but
already a big improvement.
- Updated HSQLDB to version 1.7.3.3
- Added more detailed logging in ESIFilter
- Added parameter to configure batch size in Hibernate spring configuration
file.
Revision Changes Path
1.16 +11 -11 jahia/core/jahia.iml
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/jahia.iml.diff?r1=1.15&r2=1.16&f=h
1.82 +1 -1 jahia/core/project.xml
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/project.xml.diff?r1=1.81&r2=1.82&f=h
1.5 +25 -20
jahia/core/src/java/org/jahia/bin/HypersonicLauncherServlet.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/bin/HypersonicLauncherServlet.java.diff?r1=1.4&r2=1.5&f=h
1.28 +52 -46
jahia/core/src/java/org/jahia/bin/JahiaConfigurationWizard.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/bin/JahiaConfigurationWizard.java.diff?r1=1.27&r2=1.28&f=h
1.2 +3 -0
jahia/core/src/java/org/jahia/bin/filters/esi/ESIFilter.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/bin/filters/esi/ESIFilter.java.diff?r1=1.1&r2=1.2&f=h
1.7 +4 -0
jahia/core/src/webapp/WEB-INF/etc/spring/applicationcontext-hibernate.xml
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/webapp/WEB-INF/etc/spring/applicationcontext-hibernate.xml.diff?r1=1.6&r2=1.7&f=h
Index: jahia.iml
===================================================================
RCS file: /home/cvs/repository/jahia/core/jahia.iml,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- jahia.iml 30 Sep 2005 16:31:03 -0000 1.15
+++ jahia.iml 7 Oct 2005 14:08:00 -0000 1.16
@@ -247,15 +247,6 @@
<orderEntry type="module-library">
<library>
<CLASSES>
- <root url="jar://$maven-rep$/hsqldb/jars/hsqldb-1.7.3.0.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
<root url="jar://$MODULE_DIR$/lib/jackrabbit-0.16.2-dev.jar!/" />
</CLASSES>
<JAVADOC />
@@ -1205,6 +1196,15 @@
<SOURCES />
</library>
</orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$maven-rep$/hsqldb/jars/hsqldb-1.7.3.3.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
<orderEntryProperties />
</component>
<component name="WebModuleBuildComponent">
@@ -1409,8 +1409,8 @@
</containerElement>
<containerElement type="library" level="module">
<attribute name="method" value="1" />
- <attribute name="URI" value="/WEB-INF/lib/hsqldb-1.7.3.0.jar" />
- <url>jar://$maven-rep$/hsqldb/jars/hsqldb-1.7.3.0.jar!/</url>
+ <attribute name="URI" value="/WEB-INF/lib/hsqldb-1.7.3.3.jar" />
+ <url>jar://$maven-rep$/hsqldb/jars/hsqldb-1.7.3.3.jar!/</url>
</containerElement>
<containerElement type="library" level="module">
<attribute name="method" value="1" />
Index: project.xml
===================================================================
RCS file: /home/cvs/repository/jahia/core/project.xml,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -r1.81 -r1.82
--- project.xml 3 Oct 2005 10:11:44 -0000 1.81
+++ project.xml 7 Oct 2005 14:08:00 -0000 1.82
@@ -310,7 +310,7 @@
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
- <version>1.7.3.0</version>
+ <version>1.7.3.3</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
Index: HypersonicLauncherServlet.java
===================================================================
RCS file:
/home/cvs/repository/jahia/core/src/java/org/jahia/bin/HypersonicLauncherServlet.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- HypersonicLauncherServlet.java 25 Jun 2004 15:28:42 -0000 1.4
+++ HypersonicLauncherServlet.java 7 Oct 2005 14:08:01 -0000 1.5
@@ -1,5 +1,8 @@
package org.jahia.bin;
+import org.hsqldb.Server;
+import org.hsqldb.ServerConstants;
+
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -16,10 +19,11 @@
import java.io.FileNotFoundException;
import java.io.IOException;
-public class HypersonicLauncherServlet extends HttpServlet implements
Runnable {
+public class HypersonicLauncherServlet extends HttpServlet {
String args[] = new String[10];
Thread serverThread;
+ Server hsqldbServer;
String dbLocation;
String dbPortStr;
String dbSilent;
@@ -63,20 +67,19 @@
}
}
- args[0] = "-database";
- args[1] = realPath;
- args[2] = "-port";
- args[3] = dbPortStr;
- args[4] = "-silent";
- args[5] = dbSilent;
- args[6] = "-trace";
- args[7] = dbTrace;
- args[8] = "-no_system_exit";
- args[9] = "true";
-
- serverThread = new Thread(this);
- serverThread.setDaemon(true);
- serverThread.start();
+ hsqldbServer = new Server();
+ // hsqldbServer.setDatabaseName(0,"hsqldbjahia");
+ hsqldbServer.setDatabasePath(0,"file:"+realPath);
+ //hsqldbServer.setLogWriter(null);
+ //hsqldbServer.setErrWriter(null);
+ hsqldbServer.setNoSystemExit(true);
+ hsqldbServer.setPort(Integer.parseInt(dbPortStr));
+ hsqldbServer.setTrace(Boolean.valueOf(dbTrace).booleanValue());
+ hsqldbServer.setSilent(Boolean.valueOf(dbSilent).booleanValue());
+ getServletContext().log("Starting HSQLDB server");
+ hsqldbServer.start();
+
+ startHSQLServer = true;
// now let's wait until the database is ready.
getServletContext().log("Waiting for database to start...");
@@ -102,14 +105,16 @@
getServletContext().log("Should never be called");
}
- public void run() {
- getServletContext().log("Starting HSQLDB server");
- org.hsqldb.Server.main(args);
- }
-
public void destroy() {
if (startHSQLServer) {
kill(Integer.parseInt(dbPortStr), "sa", "");
+ hsqldbServer.stop();
+ System.out.println("HSQLDB server stopping, waiting...");
+ while (hsqldbServer.getState() !=
ServerConstants.SERVER_STATE_SHUTDOWN) {
+ // loop
+ }
+ System.out.println("HSQLDB now properly shutdown.");
+ startHSQLServer = false;
}
}
Index: JahiaConfigurationWizard.java
===================================================================
RCS file:
/home/cvs/repository/jahia/core/src/java/org/jahia/bin/JahiaConfigurationWizard.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- JahiaConfigurationWizard.java 5 Oct 2005 13:49:11 -0000 1.27
+++ JahiaConfigurationWizard.java 7 Oct 2005 14:08:01 -0000 1.28
@@ -1,4 +1,4 @@
-// $Id: JahiaConfigurationWizard.java,v 1.27 2005/10/05 13:49:11 cmailleux
Exp $
+// $Id: JahiaConfigurationWizard.java,v 1.28 2005/10/07 14:08:01 shuber Exp $
//
// ____.
// __/\ ______| |__/\. _______
@@ -1294,8 +1294,58 @@
// store jahia.properties file...
properties.storeProperties(Jahia.getJahiaPropertiesFileName());
+ final StringBuffer script = new
StringBuffer().append(dbScriptsPath);
+ script.append(File.separator);
+ script.append((String) values.get("database_script"));
+ Properties dbProperties = new Properties();
+ dbProperties.load(new FileInputStream(script.toString()));
+ String pathToSpringManagerFile =
pathResolver.resolvePath("WEB-INF/etc/spring/applicationcontext-manager.xml");
+
SpringManagerConfigurator.updateDataSourceConfiguration(pathToSpringManagerFile,pathToSpringManagerFile,
+
dbProperties);
+ String pathToSpringHibernateFile =
pathResolver.resolvePath("WEB-INF/etc/spring/applicationcontext-hibernate.xml");
+
SpringHibernateConfigurator.updateDataSourceConfiguration(pathToSpringHibernateFile,pathToSpringHibernateFile,
+
dbProperties);
+ String pathToQuartzFile =
pathResolver.resolvePath("WEB-INF/etc/config/quartz.properties");
+
QuartzConfigurator.updateDataSourceConfiguration(pathToQuartzFile,pathToQuartzFile,
+
dbProperties);
+ String pathToSlideFile =
pathResolver.resolvePath("WEB-INF/etc/slide/defs.xml");
+
SlideConfigurator.updateDataSourceConfiguration(pathToSlideFile,pathToSlideFile,
+ values);
+ String pathToSpringServicesFile =
pathResolver.resolvePath("WEB-INF/etc/spring/applicationcontext-services.xml");
+
SpringServicesConfigurator.updateDataSourceConfiguration(pathToSpringServicesFile,pathToSpringServicesFile,
+ values);
+ configureHibernateDialect(context, values);
+ // Copy slide files to default site
+ final ServletContext context = config.getServletContext();
+ final PathResolver pathResolver = new
WebAppPathResolver(context);
+
+ final String slideContentDiskPath = "WEB-INF/var/content/slide/";
+ logger.debug("slideContentDiskPath: " + slideContentDiskPath);
+ JahiaTools.copyFolderContent(
+ pathResolver.resolvePath(slideContentDiskPath +
"myjahiasite" + File.separator + "store"),
+ pathResolver.resolvePath(slideContentDiskPath +
properties.getProperty("defautSite") + File.separator + "store"));
+ final File dir = new
File(pathResolver.resolvePath(slideContentDiskPath + "myjahiasite"));
+ logger.debug("Dir: " + dir.getAbsolutePath());
+ JahiaTools.deleteFile(dir);
+
+ // okay, everthing is okay... set error to false
+ error = false;
+
+ // call the appropriate method... We do this before the
+ // final step of updating the context descriptor, as this
+ // triggers re-deployment.
+ if (error) { // process
generates errors...
+ request.setAttribute("step", "7");
+ request.setAttribute("steps", STEPS);
+ request.setAttribute("errormsg", msg);
+ displayError(request, response);
+ } else {
+ displayFinalStep(request, response); // everything
is okay, continue...
+ }
+
// Update Tomcat specific context descritor that contains
- // database configuration.
+ // database configuration. We do this last as it has for effect
+ // of restarting the web application.
String serverInfo = context.getServerInfo();
if (serverInfo.indexOf(JahiaConstants.SERVER_TOMCAT) != -1) {
@@ -1335,42 +1385,7 @@
configurator.updateDataSourceConfiguration(jahiaXml,
jahiaXml, values);
}
- final StringBuffer script = new
StringBuffer().append(dbScriptsPath);
- script.append(File.separator);
- script.append((String) values.get("database_script"));
- Properties properties = new Properties();
- properties.load(new FileInputStream(script.toString()));
- String pathToSpringManagerFile =
pathResolver.resolvePath("WEB-INF/etc/spring/applicationcontext-manager.xml");
-
SpringManagerConfigurator.updateDataSourceConfiguration(pathToSpringManagerFile,pathToSpringManagerFile,
-
properties);
- String pathToSpringHibernateFile =
pathResolver.resolvePath("WEB-INF/etc/spring/applicationcontext-hibernate.xml");
-
SpringHibernateConfigurator.updateDataSourceConfiguration(pathToSpringHibernateFile,pathToSpringHibernateFile,
-
properties);
- String pathToQuartzFile =
pathResolver.resolvePath("WEB-INF/etc/config/quartz.properties");
-
QuartzConfigurator.updateDataSourceConfiguration(pathToQuartzFile,pathToQuartzFile,
-
properties);
- String pathToSlideFile =
pathResolver.resolvePath("WEB-INF/etc/slide/defs.xml");
-
SlideConfigurator.updateDataSourceConfiguration(pathToSlideFile,pathToSlideFile,
- values);
- String pathToSpringServicesFile =
pathResolver.resolvePath("WEB-INF/etc/spring/applicationcontext-services.xml");
-
SpringServicesConfigurator.updateDataSourceConfiguration(pathToSpringServicesFile,pathToSpringServicesFile,
- values);
- configureHibernateDialect(context, values);
- // Copy slide files to default site
- final ServletContext context = config.getServletContext();
- final PathResolver pathResolver = new
WebAppPathResolver(context);
- final String slideContentDiskPath = "WEB-INF/var/content/slide/";
- logger.debug("slideContentDiskPath: " + slideContentDiskPath);
- JahiaTools.copyFolderContent(
- pathResolver.resolvePath(slideContentDiskPath +
"myjahiasite" + File.separator + "store"),
- pathResolver.resolvePath(slideContentDiskPath +
properties.getProperty("defautSite") + File.separator + "store"));
- final File dir = new
File(pathResolver.resolvePath(slideContentDiskPath + "myjahiasite"));
- logger.debug("Dir: " + dir.getAbsolutePath());
- JahiaTools.deleteFile(dir);
-
- // okay, everthing is okay... set error to false
- error = false;
} catch (Exception e) {
logger.debug("Exception", e);
@@ -1380,15 +1395,6 @@
}
}
- // call the appropriate method...
- if (error) { // process
generates errors...
- request.setAttribute("step", "7");
- request.setAttribute("steps", STEPS);
- request.setAttribute("errormsg", msg);
- displayError(request, response);
- } else {
- displayFinalStep(request, response); // everything is
okay, continue...
- }
}
private void configureHibernateDialect(final ServletContext context,
final HashMap values) {
Index: ESIFilter.java
===================================================================
RCS file:
/home/cvs/repository/jahia/core/src/java/org/jahia/bin/filters/esi/ESIFilter.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ESIFilter.java 9 Sep 2005 12:48:06 -0000 1.1
+++ ESIFilter.java 7 Oct 2005 14:08:01 -0000 1.2
@@ -87,6 +87,9 @@
} catch (ServletException se) {
logger.error("ESIFilter - ServletException");
se.printStackTrace();
+ if (se.getRootCause() != null) {
+ se.getRootCause().printStackTrace();
+ }
}
}
Index: applicationcontext-hibernate.xml
===================================================================
RCS file:
/home/cvs/repository/jahia/core/src/webapp/WEB-INF/etc/spring/applicationcontext-hibernate.xml,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- applicationcontext-hibernate.xml 5 Oct 2005 13:49:12 -0000 1.6
+++ applicationcontext-hibernate.xml 7 Oct 2005 14:08:01 -0000 1.7
@@ -120,6 +120,10 @@
<prop key="hibernate.show_sql">false</prop>
<prop
key="hibernate.cache.provider_class">org.jahia.hibernate.cache.OSCacheProvider</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
+ <!-- uncomment the batch size property if you need to debug
-->
+ <!--
+ <prop key="hibernate.jdbc.batch_size">0</prop>
+ -->
<prop key="hibernate.default_batch_fetch_size">16</prop>
<prop key="hibernate.max_fetch_depth">3</prop>
<prop key="hibernate.query.substitutions">true 1, false
0</prop>