|
From: <tre...@us...> - 2007-09-07 21:40:33
|
Revision: 385
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=385&view=rev
Author: trevorolio
Date: 2007-09-07 14:40:36 -0700 (Fri, 07 Sep 2007)
Log Message:
-----------
Tweaked db log.
Added javascript login functionality such that the usual authListeners can be bypassed.
Fixed createAccount.html, which was weirdly replaced with an old ogoglio.js contents (bad cut and paste)?
Made SpaceMemberRecord creation honor the role indicated by the incoming SpaceMemberDocument.
Fixed the hanging "Receiving items..." context menu for scriptless objects.
Changed page permissions so that editors can now post contents to them.
Modified Paths:
--------------
maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/servlet/MigratedResourceServlet.java
Modified: maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/servlet/MigratedResourceServlet.java
===================================================================
--- maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/servlet/MigratedResourceServlet.java 2007-09-07 21:20:08 UTC (rev 384)
+++ maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/servlet/MigratedResourceServlet.java 2007-09-07 21:40:36 UTC (rev 385)
@@ -13,32 +13,36 @@
public abstract class MigratedResourceServlet extends AbstractResourceServlet {
private static final String HIBERNATE_SESSION_FACTORY_KEY = "com.ogoglio.hibernateSessionFactory";
+
private SessionFactory hibernateSessionFactory = null;
- public abstract MigrationSupport getMigration();
-
+
+ public abstract MigrationSupport getMigration();
+
public void init(ServletConfig config) throws ServletException {
- try {
- initBaseUrl();
- Context envCtx = (Context) initCtx.lookup("java:comp/env");
- hibernateSessionFactory = getOrCreateHibernateSessionFactory(config,envCtx);
- if (hibernateSessionFactory==null) {
- throw new IllegalStateException("Unable to create sensible hibernate configuration!");
- }
-
- //CALL THIS LAST
- super.init(config);
- } catch (NamingException e) {
- throw new ServletException("Unable to initialize Migrated resource servlet:"+e.getMessage());
- }
+ try {
+ initBaseUrl();
+ Context envCtx = (Context) initCtx.lookup("java:comp/env");
+ hibernateSessionFactory = getOrCreateHibernateSessionFactory(config, envCtx);
+ if (hibernateSessionFactory == null) {
+ throw new IllegalStateException("Unable to create sensible hibernate configuration!");
+ }
+
+ //CALL THIS LAST
+ super.init(config);
+ } catch (NamingException e) {
+ throw new ServletException("Unable to initialize Migrated resource servlet:" + e.getMessage());
+ }
}
+
public void destroy() {
- super.destroy();
+ super.destroy();
try {
hibernateSessionFactory.close();
} catch (Throwable e) {
}
super.destroy();
}
+
public SessionFactory getSessionFactory() {
return hibernateSessionFactory;
}
@@ -46,16 +50,16 @@
private SessionFactory getOrCreateHibernateSessionFactory(ServletConfig config, Context context) {
SessionFactory sessionFactory = (SessionFactory) config.getServletContext().getAttribute(HIBERNATE_SESSION_FACTORY_KEY);
if (sessionFactory == null) {
- Log.info(config.getServletName()+" checking DB Version...");
- MigrationSupport ms= getMigration();
- if (!ms.verifyVersion(config,context)) {
- throw new IllegalStateException("Cannot find a DB configuration for hibernate!");
- }
- sessionFactory= ms.getCurrentConfiguration().configure().buildSessionFactory();
+ Log.test(config.getServletName() + ": checking DB version");
+ MigrationSupport ms = getMigration();
+ if (!ms.verifyVersion(config, context)) {
+ throw new IllegalStateException("Cannot find a DB configuration for hibernate!");
+ }
+ sessionFactory = ms.getCurrentConfiguration().configure().buildSessionFactory();
config.getServletContext().setAttribute(HIBERNATE_SESSION_FACTORY_KEY, sessionFactory);
+ Log.test(config.getServletName() + ": DB version OK");
}
return sessionFactory;
}
-
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|