X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fibex%2Fxt%2FPrevalence.java;h=a0be70b4073a8ce89dc8073b4031ecc0877549b7;hb=HEAD;hp=cd7546f0097bd95472c122aff7ea16460b2f0592;hpb=507fd40aa9c563c5fdeeac08929523f9fdd35590;p=org.ibex.xt.git diff --git a/src/org/ibex/xt/Prevalence.java b/src/org/ibex/xt/Prevalence.java index cd7546f..a0be70b 100644 --- a/src/org/ibex/xt/Prevalence.java +++ b/src/org/ibex/xt/Prevalence.java @@ -11,12 +11,32 @@ import java.net.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; -import com.thoughtworks.xstream.*; -import org.prevayler.*; -import org.prevayler.implementation.snapshot.*; +//import com.thoughtworks.xstream.*; +//import org.prevayler.*; +//import org.prevayler.implementation.snapshot.XmlSnapshotManager; public class Prevalence { + public static abstract class PrevalentServlet extends HttpServlet { + protected Hashtable prevalent; + //protected Prevayler prevayler; + protected ServletContext cx = null; + public void destroy() { try { + synchronized(this.getClass()) { + //Prevayler privatePrevayler = prevayler; + //if (prevayler == null) return; + //prevayler = null; + //Prevalence.destroy(cx, prevayler); + } + } catch (Exception e) { e.printStackTrace(); } } + + public void init(ServletConfig sc) throws ServletException { + cx = sc.getServletContext(); + //prevayler = Prevalence.getPrevayler(cx); + //prevalent = (Hashtable)prevayler.prevalentSystem(); + } + } + /* static final Hashtable prevaylers = new Hashtable(); public static void destroy(ServletContext cx, Prevayler prevayler) { try { @@ -47,23 +67,12 @@ public class Prevalence { prevayler = (Prevayler)prevaylers.get(cx); if (prevayler == null) { PrevaylerFactory pf = new PrevaylerFactory(); - String base = cx.getRealPath("/") + "WEB-INF" + File.separatorChar + "prevalent"; + String base = cx.getRealPath("/") + File.separatorChar + "WEB-INF" + File.separatorChar + "prevalent"; System.err.println("prevayling to " + base); pf.configurePrevalenceBase(base); - /* - XmlSnapshotManager manager = new XmlSnapshotManager(new JS(), base, null); { - protected XStream createXStream() { - XStream xstream = new XStream(); - xstream.alias("js", JS.class); - xstream.alias("jsdate", JSDate.class); - return xstream; - } - }; + XmlSnapshotManager manager = new XmlSnapshotManager(new Hashtable(), base); System.err.println("configuring with " + manager); pf.configureSnapshotManager(manager); - */ - pf.configureSnapshotManager(new SnapshotManager(new JS.Obj(), base)); - //pf.configureClassLoader(JSTransaction.class.getClassLoader()); prevayler = pf.create(); prevaylers.put(cx, prevayler); new SnapshotThread(cx).start(); @@ -108,4 +117,5 @@ public class Prevalence { } catch (Exception e) { throw new RuntimeException(e); } } } + */ }