User: jules_gosnell
Date: 02/01/03 12:51:05
Modified: jetty/src/main/org/jboss/jetty
JBossWebApplicationContext.java
Added: jetty/src/main/org/jboss/jetty
DistributedSessionManager.java
Log:
Infrastructure for the first cut of distributed HttpSessions - including
changes to Jetty. NB - implementation to follow....
Revision Changes Path
1.12 +10 -4
contrib/jetty/src/main/org/jboss/jetty/JBossWebApplicationContext.java
Index: JBossWebApplicationContext.java
===================================================================
RCS file:
/cvsroot/jboss/contrib/jetty/src/main/org/jboss/jetty/JBossWebApplicationContext.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- JBossWebApplicationContext.java 2001/12/22 01:45:29 1.11
+++ JBossWebApplicationContext.java 2002/01/03 20:51:05 1.12
@@ -5,7 +5,7 @@
* See terms of license at gnu.org.
*/
-// $Id: JBossWebApplicationContext.java,v 1.11 2001/12/22 01:45:29 jules_gosnell
Exp $
+// $Id: JBossWebApplicationContext.java,v 1.12 2002/01/03 20:51:05 jules_gosnell
Exp $
// A Jetty HttpServer with the interface expected by JBoss'
// J2EEDeployer...
@@ -34,6 +34,7 @@
WebDescriptorParser _descriptorParser;
WebApplication _webApp;
DocumentBuilder _parser;
+ boolean _distributed=false;
public
JBossWebApplicationContext(HttpServer httpServer,
@@ -44,9 +45,7 @@
{
super(httpServer, contextPathSpec);
- _log = Logger.getLogger(JBossWebApplicationContext.class.getName() +
- "#" + contextPathSpec);
-
+ _log = Logger.getLogger(getClass().getName()+"#" +
contextPathSpec);
_descriptorParser = descriptorParser;
_webApp = webApp;
_parser = parser;
@@ -105,12 +104,19 @@
initWebXmlElement(String element, org.mortbay.xml.XmlParser.Node node)
throws Exception
{
+ // this is ugly - should be dispatched through a hash-table or
introspection...
+
// these are handled by AbstractWebContainer
if ("resource-ref".equals(element) ||
"env-entry".equals(element) ||
"ejb-ref".equals(element))
{
//_log.info("Don't moan : "+element);
+ }
+ else if ("distributable".equals(element))
+ {
+ _distributed=true;
+ getServletHandler().setSessionManager(new DistributedSessionManager(this));
}
// these are handled by Jetty
else
1.1
contrib/jetty/src/main/org/jboss/jetty/DistributedSessionManager.java
Index: DistributedSessionManager.java
===================================================================
/*
* jBoss, the OpenSource EJB server
*
* Distributable under GPL license.
* See terms of license at gnu.org.
*/
// $Id: DistributedSessionManager.java,v 1.1 2002/01/03 20:51:05 jules_gosnell Exp $
// A Jetty HttpServer with the interface expected by JBoss'
// J2EEDeployer...
package org.jboss.jetty;
import java.util.EventListener;
import javax.servlet.http.HttpSession;
import org.jboss.logging.Logger;
import org.mortbay.jetty.servlet.ServletHandler;
import org.mortbay.util.LifeCycle;
/* --------------------------------------------------------------------- */
/**
*
* @version $Id: DistributedSessionManager.java,v 1.1 2002/01/03 20:51:05
jules_gosnell Exp $
* @author [EMAIL PROTECTED]
*/
public class DistributedSessionManager
extends org.mortbay.jetty.servlet.HashSessionManager
{
Logger _log;
JBossWebApplicationContext _context;
// CoarseHttpSessionHome _home;
DistributedSessionManager(JBossWebApplicationContext context)
{
super(context.getServletHandler());
_context=context;
_log = Logger.getLogger(getClass().getName()+"#" +_context.getContextPath());
}
// public HttpSession getHttpSession(String id) {}
// public synchronized HttpSession newHttpSession() {}
// public synchronized void setMaxInactiveInterval(int seconds) {}
// public synchronized void setScavangePeriod(int seconds) {}
// public void addEventListener(EventListener listener) throws
IllegalArgumentException {}
// public void removeEventListener(EventListener listener) {}
// lifecycle
// public boolean isStarted() {}
public void
start()
throws Exception
{
super.start();
_log.info("creating/activating distributed representation - NYI");
}
public void
stop()
{
_log.info("destroying/passivating distributed representation - NYI");
super.stop();
}
// scavenging
// private void scavenge() {}
//
// class SessionScavenger
// extends Thread
// {
// public void run() {}
// SessionScavenger() {}
// }
//
class Session
extends org.mortbay.jetty.servlet.HashSessionManager.Session
{
// lifecycle - needs init/ctor and destroy()...
Session()
{
super();
}
void
destroy()
{
// if (isDistributed() && !outOfTime())
// {
// // persist ourself...
// }
// else
// {
// // clean up and throw ourself away...
// }
}
// HttpSessionEvent getHttpSessionEvent() {}
// public void access() {}
// public boolean isValid() {}
// public ServletContext getServletContext() {}
// public String getId() throws IllegalStateException {}
// public long getCreationTime() throws IllegalStateException {}
// public long getLastAccessedTime() throws IllegalStateException {}
// public int getMaxInactiveInterval() {}
// public HttpSessionContext getSessionContext() throws
IllegalStateException {}
// public void setMaxInactiveInterval(int secs) {}
// public synchronized void invalidate() throws IllegalStateException {}
// public boolean isNew() throws IllegalStateException {}
// attributes
// public Object getAttribute(String name) {}
// public Enumeration getAttributeNames() {}
// public void setAttribute(String name, Object value) {}
// public void removeAttribute(String name) {}
// public Object getValue(String name) throws IllegalStateException {}
// public synchronized String[] getValueNames() throws IllegalStateException
{}
// public void putValue(String name, Object value) throws
IllegalStateException {}
// public void removeValue(String name) throws IllegalStateException {}
// private void bindValue(String name, Object value) {}
// private void unbindValue(String name, Object value) {}
}
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development