incubator-wadi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdud...@apache.org
Subject svn commit: r356933 [26/35] - in /incubator/wadi/trunk: ./ etc/ modules/ modules/assembly/ modules/assembly/src/ modules/assembly/src/bin/ modules/assembly/src/conf/ modules/assembly/src/main/ modules/assembly/src/main/assembly/ modules/core/ modules/c...
Date Wed, 14 Dec 2005 23:36:16 GMT
Added: incubator/wadi/trunk/modules/tomcat50/src/main/java/org/codehaus/wadi/tomcat50/TomcatManager.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/tomcat50/src/main/java/org/codehaus/wadi/tomcat50/TomcatManager.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/tomcat50/src/main/java/org/codehaus/wadi/tomcat50/TomcatManager.java (added)
+++ incubator/wadi/trunk/modules/tomcat50/src/main/java/org/codehaus/wadi/tomcat50/TomcatManager.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,298 @@
+/**
+ *
+ * Copyright 2003-2005 Core Developers Network Ltd.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.codehaus.wadi.tomcat50;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Pattern;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpSessionAttributeListener;
+import javax.servlet.http.HttpSessionListener;
+
+import org.apache.catalina.Container;
+import org.apache.catalina.Context;
+import org.apache.catalina.DefaultContext;
+import org.apache.catalina.Lifecycle;
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.LifecycleListener;
+import org.apache.catalina.Manager;
+import org.apache.catalina.Session;
+import org.apache.catalina.core.StandardContext;
+import org.apache.catalina.deploy.FilterDef;
+import org.apache.catalina.deploy.FilterMap;
+import org.apache.catalina.util.LifecycleSupport;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.codehaus.wadi.ManagerConfig;
+import org.codehaus.wadi.impl.StandardManager;
+import org.codehaus.wadi.impl.StandardSessionWrapperFactory;
+import org.codehaus.wadi.impl.Filter;
+import org.codehaus.wadi.impl.SpringManagerFactory;
+
+public class TomcatManager implements ManagerConfig, Lifecycle, Manager
+{
+	protected static final Log _log = LogFactory.getLog(TomcatManager.class);
+
+	protected StandardManager _wadi;
+	protected Container _container;
+	protected DefaultContext _defaultContext;
+	protected boolean _distributable;
+	protected int _sessionCounter; // push back into WADI - TODO
+	protected int _maxActive; // exactly what does this mean ? - probably only valid for some Evicter types... - TODO
+	protected int _expiredSessions; // TODO - wire up
+	protected int _rejectedSessions; // TODO - wire up
+	protected PropertyChangeSupport _propertyChangeListeners=new PropertyChangeSupport(this); 	// actual notifications are done by aspects...
+
+	// org.codehaus.wadi.ManagerConfig
+
+	public ServletContext getServletContext() {
+		return ((Context)_container).getServletContext();
+	}
+
+	public void callback(StandardManager manager) {
+		// install Listeners ...
+		Context context=((Context)_container);
+
+		Object[] sessionListeners=context.getApplicationLifecycleListeners();
+		List sll=new ArrayList();
+		for (int i=0; i<sessionListeners.length; i++) {
+			Object listener=sessionListeners[i];
+			if (listener instanceof HttpSessionListener)
+				sll.add((HttpSessionListener)listener);
+		}
+		manager.setSessionListeners((HttpSessionListener[])sll.toArray(new HttpSessionListener[sll.size()]));
+
+		Object[] attributeListeners=context.getApplicationEventListeners();
+		List all=new ArrayList();
+		for (int i=0; i<attributeListeners.length; i++) {
+			Object listener=attributeListeners[i];
+			if (listener instanceof HttpSessionAttributeListener)
+				all.add((HttpSessionAttributeListener)listener);
+		}
+		manager.setAttributelisteners((HttpSessionAttributeListener[])all.toArray(new HttpSessionAttributeListener[all.size()]));
+	}
+
+	// org.apache.catalina.Lifecycle
+
+	// actual notifications are done by aspects...
+	protected LifecycleSupport _lifecycleListeners=new LifecycleSupport(this);
+
+	public void addLifecycleListener(LifecycleListener listener) {
+		_lifecycleListeners.addLifecycleListener(listener);
+	}
+
+	public LifecycleListener[] findLifecycleListeners() {
+		return _lifecycleListeners.findLifecycleListeners();
+	}
+
+	public void removeLifecycleListener(LifecycleListener listener) {
+		_lifecycleListeners.removeLifecycleListener(listener);
+	}
+
+	public void start() throws LifecycleException {
+		try {
+			InputStream is=getServletContext().getResourceAsStream("/WEB-INF/wadi-web.xml");
+			_wadi=(StandardManager)SpringManagerFactory.create(is, "SessionManager", new TomcatSessionFactory(), new StandardSessionWrapperFactory());
+		} catch (Exception e) {
+			throw new RuntimeException("Required resource: '/WEB-INF/wadi-web.xml' not found - please check the web app.", e);
+		}
+
+		_wadi.init(this);
+		try {
+			_wadi.start();
+
+			if (_container==null) {
+				_log.warn("container not set - fn-ality will be limited");
+			} else {
+				Context context=((Context)_container);
+
+				// install Valve
+				((StandardContext)context).addValve(new Valve(Pattern.compile("127\\.0\\.0\\.1|192\\.168\\.0\\.\\d{1,3}")));
+
+				// install filter
+				String filterName="WadiFilter";
+				FilterDef fd=new FilterDef();
+				fd.setFilterName(filterName);
+				fd.setFilterClass(Filter.class.getName());
+				context.addFilterDef(fd);
+				FilterMap fm=new FilterMap();
+				fm.setFilterName(filterName);
+				fm.setURLPattern("/*");
+				context.addFilterMap(fm);
+
+//				// is this a distributable webapp ?
+//				boolean distributable=context.getDistributable();
+//				if (distributable && !_distributable)
+//				setDistributable(distributable);
+			}
+
+		} catch (Exception e) {
+			throw new LifecycleException(e);
+		}
+	}
+
+	public void stop() throws LifecycleException {
+		try {
+			_wadi.stop();
+		} catch (Exception e) {
+			throw new LifecycleException(e);
+		}
+	}
+
+	// org.apache.catalina.Manager
+
+	public Container getContainer() {
+		return _container;
+	}
+
+	public void setContainer(Container container) {
+		_container=container;
+	}
+
+	public DefaultContext getDefaultContext() {
+		return _defaultContext;
+	}
+
+	public void setDefaultContext(DefaultContext defaultContext) {
+		_defaultContext=defaultContext;
+	}
+
+	public boolean getDistributable() {
+		return _distributable;
+	}
+
+	public void setDistributable(boolean distributable) { // TODO - reconcile with WADI's idea of this setting...
+		_distributable=distributable;
+	}
+
+	public String getInfo() {
+		return "<code>&lt;"+getClass().getName()+"&gt;/&lt;1.0b&gt;</code>";
+	}
+
+	public int getMaxInactiveInterval() {
+		return _wadi.getMaxInactiveInterval();
+	}
+
+	public void setMaxInactiveInterval(int interval) {
+		_wadi.setMaxInactiveInterval(interval);
+	}
+
+	public int getSessionIdLength() {
+		return _wadi.getSessionIdFactory().getSessionIdLength();
+	}
+
+	public void setSessionIdLength(int sessionIdLength) {
+		_wadi.getSessionIdFactory().setSessionIdLength(sessionIdLength);
+	}
+
+	public int getSessionCounter() {
+		return _sessionCounter;
+	}
+
+	public void setSessionCounter(int sessionCounter) {
+		_sessionCounter=sessionCounter;
+	}
+
+	public int getMaxActive() {
+		return _maxActive;
+	}
+
+	public void setMaxActive(int maxActive) {
+		_maxActive=maxActive;
+	}
+
+	public int getActiveSessions() {
+		// probably the size of the Memory map... - TODO
+		return 0;
+	}
+
+	public int getExpiredSessions() {
+		return _expiredSessions;
+	}
+
+	public void setExpiredSessions(int expiredSessions) {
+		_expiredSessions=expiredSessions;
+	}
+
+	public int getRejectedSessions() {
+		return _rejectedSessions;
+	}
+
+	public void setRejectedSessions(int rejectedSessions) {
+		_rejectedSessions=rejectedSessions;
+	}
+
+	public void add(Session session) {
+		// perhaps hook up to an Immoter ? - TODO
+	}
+
+	public void addPropertyChangeListener(PropertyChangeListener listener) {
+		_propertyChangeListeners.addPropertyChangeListener(listener);
+	}
+
+	public Session createEmptySession() {
+		throw new UnsupportedOperationException();
+	}
+
+	public Session createSession() {
+		return (TomcatSession)_wadi.create();
+	}
+
+	public Session findSession(String id) throws IOException {
+		//throw new UnsupportedOperationException();
+		if (_log.isWarnEnabled()) _log.warn("findSession("+id+") called - currently unsupported");
+		return null;
+	}
+	
+	public Session[] findSessions() {
+		throw new UnsupportedOperationException();
+	}
+
+	public void load() throws ClassNotFoundException, IOException {
+		// perhaps hook up to promoteToLocal();
+	}
+
+	public void remove(Session session) {
+		// perhaps hook up to an Emoter - TODO
+	}
+
+	public void removePropertyChangeListener(PropertyChangeListener listener) {
+		_propertyChangeListeners.removePropertyChangeListener(listener);
+	}
+
+	public void unload() throws IOException {
+		// perhaps hook up to demoteToShared();
+	}
+
+	public void backgroundProcess() {
+		// not used - Evicter is attached to a Timer by super()...
+	}
+
+	// TODO - what was I doing with these ?
+
+//	public void notifySessionCreated(HttpSessionListener listener, HttpSessionEvent event){super.notifySessionCreated(listener,event);}
+//	public void notifySessionDestroyed(HttpSessionListener listener, HttpSessionEvent event){super.notifySessionDestroyed(listener, event);}
+//	public void notifySessionAttributeAdded(HttpSessionAttributeListener listener, HttpSessionBindingEvent event){super.notifySessionAttributeAdded(listener, event);}
+//	public void notifySessionAttributeRemoved(HttpSessionAttributeListener listener, HttpSessionBindingEvent event){super.notifySessionAttributeRemoved(listener, event);}
+//	public void notifySessionAttributeReplaced(HttpSessionAttributeListener listener, HttpSessionBindingEvent event){super.notifySessionAttributeReplaced(listener, event);}
+
+}

Added: incubator/wadi/trunk/modules/tomcat50/src/main/java/org/codehaus/wadi/tomcat50/TomcatSession.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/tomcat50/src/main/java/org/codehaus/wadi/tomcat50/TomcatSession.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/tomcat50/src/main/java/org/codehaus/wadi/tomcat50/TomcatSession.java (added)
+++ incubator/wadi/trunk/modules/tomcat50/src/main/java/org/codehaus/wadi/tomcat50/TomcatSession.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,210 @@
+/**
+ *
+ * Copyright 2003-2005 Core Developers Network Ltd.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.codehaus.wadi.tomcat50;
+
+import java.security.Principal;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpSession;
+
+import org.apache.catalina.Manager;
+import org.apache.catalina.Session;
+import org.apache.catalina.SessionListener;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.codehaus.wadi.DistributableSessionConfig;
+import org.codehaus.wadi.impl.DistributableSession;
+
+/**
+ * Interestingly, in Tomcat a Session is a facade (for internal use) over an HttpSession (for external use), but
+ * in WADI we have a Session (rich implementation for internal use) which is facaded by an HttpSession (constrains
+ * available API for external use). Thus, our implementation is Tomcat's facade and vice versa ! Confused ? I was...
+ *
+ * @author <a href="mailto:jules@coredevelopers.net">Jules Gosnell</a>
+ * @version $Revision: 1.4 $
+ */
+
+public class TomcatSession extends DistributableSession implements Session {
+
+  protected static final Log _log = LogFactory.getLog(TomcatSession.class);
+
+  public TomcatSession(DistributableSessionConfig config) {
+    super(config);
+  }
+
+  public void destroy() {
+	  _authType=null;
+	  _principal=null;
+	  _notes.clear();
+	  _listeners.clear();
+	  try {
+		  super.destroy();
+	  } catch (Exception e) {
+		  _log.warn("unexpected problem destroying session", e);
+	  }
+  }
+
+  public void setId(String id) {
+    // we set our id via init() method...
+    throw new UnsupportedOperationException("WADI does not support the use of Session.setId(String)");
+  }
+
+  public void setCreationTime(long creationTime) {
+    // we set our creationTime via init() method...
+    throw new UnsupportedOperationException("WADI does not support the use of Session.setCreationTime(long)");
+  }
+
+  public String getInfo() {
+    return getClass().getName()+" v2.0";
+  }
+
+  public HttpSession getSession() {
+    return _wrapper;
+  }
+
+  public Manager getManager() {
+    return (Manager)_config;
+  }
+
+  public void setManager(Manager manager) {
+    // initialises backptr to Manager - we already have this as we
+    // were given it as our _config on construction...
+
+    // called by Manager, but we don't call it and do not expect to be called...
+    throw new UnsupportedOperationException("WADI does not support the use of Session.setManager(Manager)");
+  }
+
+  protected transient String _authType;
+
+  public String getAuthType() {
+    return _authType;
+  }
+
+  public void setAuthType(String authType) {
+    _authType=authType;
+  }
+
+  protected transient Principal _principal;
+
+  public Principal getPrincipal() {
+    return _principal;
+  }
+
+  public void setPrincipal(Principal principal) {
+    _principal=principal;
+  }
+
+  protected transient final Map _notes=Collections.synchronizedMap(new HashMap());
+
+  public void setNote(String name, Object value) {
+    _notes.put(name, value);
+  }
+
+  public Object getNote(String name) {
+    return _notes.get(name);
+  }
+
+  public void removeNote(String name) {
+    _notes.remove(name);
+  }
+
+  public Iterator getNoteNames() {
+    return _notes.keySet().iterator();
+  }
+
+  protected List _listeners=Collections.synchronizedList(new ArrayList());
+
+  public List getSessionListeners(){return _listeners;} // not Tomcat - used by aspect
+
+  public void addSessionListener(SessionListener listener) {
+    _listeners.add(listener);
+  }
+
+  public void removeSessionListener(SessionListener listener) {
+    _listeners.remove(listener);
+  }
+
+  public void setValid(boolean isValid) {
+    // WADI invalidates a Session by releasing its Id. Thus
+    // we don't need to maintain a seperate flag in every Session.
+
+    // Tomcat only seems to call this from Manager and Session -
+    // we don't use it and are not expecting it to be called.
+    throw new UnsupportedOperationException("WADI does not support the use of Session.setValid(boolean)");
+  }
+
+  public boolean isValid() {
+    // Tomcat checks for expiry in this method and uses it to validate
+    // Session access...
+
+    // WADI takes the approach that if a Session is in the Container
+    // at the time a request arrives, it would be foolish to invalidate
+    // it - in fact, you would not be able to, because the visiting thread
+    // would already have a lock...
+
+    // I don't think we use this method...
+    throw new UnsupportedOperationException("WADI does not support the use of Session.isValid()");
+  }
+
+  public void setNew(boolean isNew) {
+    // WADI tests whether creation and lastAccessed time are the same
+    // to determine whether a session has been joined... It saves carrying
+    // an extra flag in every session.
+
+    // Tomcat only seems to call this from Manager and Session - we do not use it...
+    throw new UnsupportedOperationException("WADI does not support the use of Session.setNew(boolean)");
+  }
+
+  public void access() {
+    // since there is no way to externally query whether the session is currently
+    // being accessed, these must be notifications for the session's internal use.
+    // WADI does not currently require them, so they remain unimplemented.
+
+    // if/when WADI implements e.g. writing sessions out at the end of an event group,
+    // it will be done by acquiring a exclusive lock on the session, so won't need
+    // this aproach...
+
+    // doesn't need to do anything - wasted cycles
+  }
+
+  public void endAccess() {
+    // used to maintain an accessCount - not needed (see above)
+    // used to unset 'new' flag - not needed - see setNew()
+
+    // doesn't need to do anything - wasted cycles
+  }
+
+  public void recycle() {
+    // used by some Tomcat Managers to recycle Session objects
+    // Our Manager uses alternate means - we are not expecting to be called...
+
+    throw new UnsupportedOperationException("WADI does not support the use of Session.recycle()");
+  }
+
+  public void expire() {
+    // only seems to be called by Manager
+    // We don't use it and don't expect it to be called...
+
+    throw new UnsupportedOperationException("WADI does not support the use of Session.expire()");
+  }
+
+}

Added: incubator/wadi/trunk/modules/tomcat50/src/main/java/org/codehaus/wadi/tomcat50/TomcatSessionFactory.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/tomcat50/src/main/java/org/codehaus/wadi/tomcat50/TomcatSessionFactory.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/tomcat50/src/main/java/org/codehaus/wadi/tomcat50/TomcatSessionFactory.java (added)
+++ incubator/wadi/trunk/modules/tomcat50/src/main/java/org/codehaus/wadi/tomcat50/TomcatSessionFactory.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,30 @@
+/**
+ *
+ * Copyright 2003-2005 Core Developers Network Ltd.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.codehaus.wadi.tomcat50;
+
+import org.codehaus.wadi.DistributableSessionConfig;
+import org.codehaus.wadi.Session;
+import org.codehaus.wadi.SessionConfig;
+import org.codehaus.wadi.SessionFactory;
+
+public class TomcatSessionFactory implements SessionFactory {
+
+    public Session create(SessionConfig config) {
+        return new TomcatSession((DistributableSessionConfig)config);
+    }
+
+}

Added: incubator/wadi/trunk/modules/tomcat50/src/main/java/org/codehaus/wadi/tomcat50/Valve.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/tomcat50/src/main/java/org/codehaus/wadi/tomcat50/Valve.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/tomcat50/src/main/java/org/codehaus/wadi/tomcat50/Valve.java (added)
+++ incubator/wadi/trunk/modules/tomcat50/src/main/java/org/codehaus/wadi/tomcat50/Valve.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,78 @@
+/**
+ *
+ * Copyright 2003-2005 Core Developers Network Ltd.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.codehaus.wadi.tomcat50;
+
+import java.io.IOException;
+import java.util.regex.Pattern;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.catalina.HttpRequest;
+import org.apache.catalina.Request;
+import org.apache.catalina.Response;
+import org.apache.catalina.ValveContext;
+import org.apache.catalina.valves.ValveBase;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * A Tomcat Valve which checks incoming proxied requests to see if they were originally from
+ * a secure connection. If this is the case, it modifies the request object so that it encodes
+ * this fact.
+ *
+ * @author <a href="mailto:jules@coredevelopers.net">Jules Gosnell</a>
+ * @version $Revision: 1.2 $
+ */
+
+// how do we install this ?
+
+public class Valve extends ValveBase {
+	
+	protected final Log _log=LogFactory.getLog(getClass());
+	protected final Pattern _trustedIps;
+	
+	public Valve(Pattern trustedIps) {
+		_trustedIps=trustedIps;
+		if (_log.isInfoEnabled()) _log.info("WADI Valve in place: "+_trustedIps.pattern());
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.apache.catalina.Valve#invoke(org.apache.catalina.Request, org.apache.catalina.Response, org.apache.catalina.ValveContext)
+	 */
+	public void invoke(Request request, Response response, ValveContext context) throws IOException, ServletException {
+		if (request instanceof HttpRequest) {
+			HttpServletRequest hreq=(HttpServletRequest) request;
+			// request must have been :
+			//  proxied by WADI
+			String val=hreq.getHeader("Via");
+			if (val!=null && val.endsWith("\"WADI\"")) { // TODO - should we ignore case ?
+				String ip=hreq.getRemoteAddr();
+				//  from a trusted IP...
+				if (_trustedIps.matcher(ip).matches()) {
+					if (_log.isTraceEnabled()) _log.trace("securing proxied request: "+hreq.getRequestURL());
+					request.setSecure(true);
+				} else {
+					// otherwise we have a configuration issue or are being spoofed...
+					if (_log.isWarnEnabled()) _log.warn("purported WADI request arrived from suspect IP address: "+_trustedIps.pattern()+" !~ "+ip);
+				}
+			}
+		}
+		context.invokeNext(request, response);
+	}
+	
+}

Added: incubator/wadi/trunk/modules/tomcat50/src/site/apt/license.apt
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/tomcat50/src/site/apt/license.apt?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/tomcat50/src/site/apt/license.apt (added)
+++ incubator/wadi/trunk/modules/tomcat50/src/site/apt/license.apt Wed Dec 14 15:32:56 2005
@@ -0,0 +1,210 @@
+Overiew
+
+  Typically the licenses listed for the project are that of the project itself, and not of dependencies.
+  
+Project License
+
+---------------
+
+                                Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+

Added: incubator/wadi/trunk/modules/tomcat50/src/site/resources/css/maven-theme.css
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/tomcat50/src/site/resources/css/maven-theme.css?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/tomcat50/src/site/resources/css/maven-theme.css (added)
+++ incubator/wadi/trunk/modules/tomcat50/src/site/resources/css/maven-theme.css Wed Dec 14 15:32:56 2005
@@ -0,0 +1,175 @@
+body {
+        background-color: #fff;
+	font-family: Verdana, Helvetica, Arial, sans-serif;
+	margin-left: auto;
+	margin-right: auto;
+	background-repeat: repeat-y;
+	font-size: 13px;
+	padding: 0px;
+}
+td, select, input, li{
+	font-family: Verdana, Helvetica, Arial, sans-serif;
+	font-size: 12px;
+	color:#333333;
+}
+code{
+  font-size: 12px;
+}
+a {
+  text-decoration: none;
+}
+a:link {
+  color:#47a;
+}
+a:visited  {
+  color:#666666;
+}
+a:active, a:hover {
+  color:#990000;
+}
+#legend li.externalLink {
+  background: url(../images/external.png) left top no-repeat;
+  padding-left: 18px;
+}
+a.externalLink, a.externalLink:link, a.externalLink:visited, a.externalLink:active, a.externalLink:hover {
+  background: url(../images/external.png) right center no-repeat;
+  padding-right: 18px;
+}
+#legend li.newWindow {
+  background: url(../images/newwindow.png) left top no-repeat;
+  padding-left: 18px;
+}
+a.newWindow, a.newWindow:link, a.newWindow:visited, a.newWindow:active, a.newWindow:hover {
+  background: url(../images/newwindow.png) right center no-repeat;
+  padding-right: 18px;
+}
+h2 {
+	font-size: 17px;
+	color: #333333;  
+}
+h3 {
+	padding: 4px 4px 4px 24px;
+	color: #666;
+	background-color: #ccc;
+	font-weight: bold;
+	font-size: 14px;
+	background-repeat: no-repeat;
+	background-position: left bottom;
+}
+p {
+  line-height: 1.3em;
+  font-size: 12px;
+  color: #000;
+}
+#breadcrumbs {
+	height: 13px;
+	background-image: url(../images/breadcrumbs.jpg);
+	padding: 5px 10px 14px 20px;
+}
+* html #breadcrumbs {
+	padding-bottom: 8px;
+}
+#leftColumn {
+	margin: 10px 0 10px 0;
+	border-top-color: #ccc;
+	border-top-style: solid;
+	border-top-width: 1px;
+	border-right-color: #ccc;
+	border-right-style: solid;
+	border-right-width: 1px;
+	border-bottom-color: #ccc;
+	border-bottom-style: solid;
+	border-bottom-width: 1px;
+	padding-right: 5px;
+	padding-left: 5px;
+}
+#navcolumn h5 {
+	font-size: smaller;
+	border-bottom: 1px solid #aaaaaa;
+	padding-top: 2px;
+	padding-left: 9px;
+	color: #49635a;
+	background-image: url(../images/h5.jpg);
+	background-repeat: no-repeat;
+	background-position: left bottom;
+}
+
+table.bodyTable th {
+  color: white;
+  background-color: #bbb;
+  text-align: left;
+  font-weight: bold;
+}
+
+table.bodyTable th, table.bodyTable td {
+  font-size: 11px;
+}
+
+table.bodyTable tr.a {
+  background-color: #ddd;
+}
+
+table.bodyTable tr.b {
+  background-color: #eee;
+}
+
+.source {
+  border: 1px solid #999;
+  overflow:auto
+}
+dt {
+	padding: 4px 4px 4px 24px;
+	color: #333333;
+	background-color: #ccc;
+	font-weight: bold;
+	font-size: 14px;
+	background-repeat: no-repeat;
+	background-position: left bottom;
+}
+.subsectionTitle {
+	font-size: 13px;
+	font-weight: bold;
+	color: #666;
+
+}
+
+table {
+	font-size: 10px;
+}
+.xright a:link, .xright a:visited, .xright a:active {
+  color: #666;
+}
+.xright a:hover {
+  color: #003300;
+}
+#banner {
+	height: 93px;
+}
+#navcolumn ul {
+	margin: 5px 0 15px -0em;
+}
+#navcolumn ul a {
+	color: #333333;
+}
+#navcolumn ul a:hover {
+	color: red;
+}
+#intro {
+	border: solid #ccc 1px;
+	margin: 6px 0px 0px 0px;
+	padding: 10px 40px 10px 40px;
+}
+.subsection {
+	margin-left: 3px;
+	color: #333333;
+}
+
+.subsection p {
+	font-size: 12px;
+}
+#footer {
+  padding: 10px;
+  margin: 20px 0px 20px 0px;
+  border-top: solid #ccc 1px; 
+  color: #333333;
+}

Added: incubator/wadi/trunk/modules/tomcat50/src/site/resources/css/site.css
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/tomcat50/src/site/resources/css/site.css?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/tomcat50/src/site/resources/css/site.css (added)
+++ incubator/wadi/trunk/modules/tomcat50/src/site/resources/css/site.css Wed Dec 14 15:32:56 2005
@@ -0,0 +1,52 @@
+a.externalLink, a.externalLink:link, a.externalLink:visited, a.externalLink:active, a.externalLink:hover {
+  background: none;
+  padding-right: 0;
+}
+
+/*
+body ul {
+  list-style-type: square;
+}
+*/
+
+#downloadbox {
+  float: right;
+  margin: 0 10px 20px 20px;
+  padding: 5px;
+  border: 1px solid #999;
+  background-color: #eee;
+}
+
+#downloadbox h5 {
+  color: #000;
+  margin: 0;
+  border-bottom: 1px solid #aaaaaa;
+  font-size: smaller;
+  padding: 0;
+}
+
+#downloadbox p {
+  margin-top: 1em;
+  margin-bottom: 0;
+}
+
+#downloadbox ul {
+  margin-top: 0;
+  margin-bottom: 1em;
+  list-style-type: disc;
+}
+
+#downloadbox li {
+  font-size: smaller;
+}
+
+/*
+h4 {
+  padding: 0;
+  border: none;
+  color: #000;
+  margin: 0;
+  font-size: larger;
+  font-weight: bold;
+}
+*/

Added: incubator/wadi/trunk/modules/tomcat50/src/site/resources/images/breadcrumbs.jpg
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/tomcat50/src/site/resources/images/breadcrumbs.jpg?rev=356933&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wadi/trunk/modules/tomcat50/src/site/resources/images/breadcrumbs.jpg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/wadi/trunk/modules/tomcat50/src/site/resources/images/codehaus-small.png
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/tomcat50/src/site/resources/images/codehaus-small.png?rev=356933&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wadi/trunk/modules/tomcat50/src/site/resources/images/codehaus-small.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/wadi/trunk/modules/tomcat50/src/site/resources/images/folder-open.gif
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/tomcat50/src/site/resources/images/folder-open.gif?rev=356933&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wadi/trunk/modules/tomcat50/src/site/resources/images/folder-open.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/wadi/trunk/modules/tomcat50/src/site/resources/images/h5.jpg
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/tomcat50/src/site/resources/images/h5.jpg?rev=356933&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wadi/trunk/modules/tomcat50/src/site/resources/images/h5.jpg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/wadi/trunk/modules/tomcat50/src/site/resources/images/wadi.png
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/tomcat50/src/site/resources/images/wadi.png?rev=356933&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wadi/trunk/modules/tomcat50/src/site/resources/images/wadi.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/wadi/trunk/modules/tomcat50/src/site/site.xml
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/tomcat50/src/site/site.xml?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/tomcat50/src/site/site.xml (added)
+++ incubator/wadi/trunk/modules/tomcat50/src/site/site.xml Wed Dec 14 15:32:56 2005
@@ -0,0 +1,24 @@
+<project name="Mojo">
+   <bannerLeft>
+      <name>WADI</name>
+      <src>/images/wadi.png</src>
+      <href>http://wadi.codehaus.org</href>
+   </bannerLeft>
+   <bannerRight>
+      <name>Codehaus</name>
+      <src>/images/codehaus-small.png</src>
+      <href>http://www.codehaus.org</href>
+   </bannerRight>
+   <body>
+      <links>
+         <item name="Geronimo" href="http://geronimo.apache.org"/>
+         <item name="Tomcat" href="http://tomcat.apache.org"/>
+         <item name="Jetty" href="http://jetty.mortbay.org/jetty/index.html"/>
+      </links>
+      
+      <menu name="WADI">
+         <item name="Wadi" href="../index.html"/>
+      </menu>
+      ${reports}
+   </body>
+</project>

Added: incubator/wadi/trunk/modules/tomcat50/src/test/java/org/codehaus/wadi/test/FilterInstance.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/tomcat50/src/test/java/org/codehaus/wadi/test/FilterInstance.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/tomcat50/src/test/java/org/codehaus/wadi/test/FilterInstance.java (added)
+++ incubator/wadi/trunk/modules/tomcat50/src/test/java/org/codehaus/wadi/test/FilterInstance.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,65 @@
+/**
+ *
+ * Copyright 2003-2005 Core Developers Network Ltd.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.codehaus.wadi.test;
+
+import java.io.IOException;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+/**
+ * A Class that can be instantiated to a Filter that will wrap-n-delegate to
+ * another Filter instance.
+ *
+ * @author <a href="mailto:jules@coredevelopers.net">Jules Gosnell </a>
+ * @version $Revision: 1.1 $
+ */
+
+public class FilterInstance implements Filter {
+
+	protected FilterConfig _config;
+	protected Filter _instance;
+
+	public void init(FilterConfig config) {
+		_config=config;
+	}
+
+	public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws ServletException, IOException {
+		_instance.doFilter(req, res, chain);
+	}
+
+	public void destroy() {
+		if (_instance!=null) {
+			_instance.destroy();
+			_instance=null;
+		}
+	}
+
+	public void setInstance(Filter instance) throws ServletException {
+		_instance=instance;
+		_instance.init(_config);
+	}
+
+	public Filter getInstance() {
+		return _instance;
+	}
+}
+

Added: incubator/wadi/trunk/modules/tomcat50/src/test/java/org/codehaus/wadi/test/Node.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/tomcat50/src/test/java/org/codehaus/wadi/test/Node.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/tomcat50/src/test/java/org/codehaus/wadi/test/Node.java (added)
+++ incubator/wadi/trunk/modules/tomcat50/src/test/java/org/codehaus/wadi/test/Node.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,40 @@
+/**
+ *
+ * Copyright 2003-2005 Core Developers Network Ltd.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.codehaus.wadi.test;
+
+import javax.servlet.Filter;
+import javax.servlet.Servlet;
+
+import org.codehaus.wadi.Securable;
+
+
+/**
+ * TODO - JavaDoc this type
+ *
+ * @author <a href="mailto:jules@coredevelopers.net">Jules Gosnell</a>
+ * @version $Revision: 1.1 $
+ */
+
+public interface Node extends Securable {
+	Filter getFilter();
+
+	Servlet getServlet();
+
+	void start() throws Exception;
+
+	void stop() throws Exception;
+}

Added: incubator/wadi/trunk/modules/tomcat50/src/test/java/org/codehaus/wadi/test/ServletInstance.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/tomcat50/src/test/java/org/codehaus/wadi/test/ServletInstance.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/tomcat50/src/test/java/org/codehaus/wadi/test/ServletInstance.java (added)
+++ incubator/wadi/trunk/modules/tomcat50/src/test/java/org/codehaus/wadi/test/ServletInstance.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,71 @@
+/**
+ *
+ * Copyright 2003-2005 Core Developers Network Ltd.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.codehaus.wadi.test;
+
+import java.io.IOException;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+/**
+ * A Class that will instantiate to a Servlet that will wrap-n-delegate to
+ * another Servlet instance.
+ *
+ * @author <a href="mailto:jules@coredevelopers.net">Jules Gosnell </a>
+ * @version $Revision: 1.1 $
+ */
+
+public class ServletInstance implements Servlet {
+
+	protected ServletConfig _config;
+	protected Servlet _instance;
+
+	public void init(ServletConfig config) {
+		_config=config;
+	}
+
+	public ServletConfig getServletConfig() {
+		return _instance.getServletConfig();
+	}
+
+	public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
+		_instance.service(req, res);
+	}
+
+	public String getServletInfo() {
+		return _instance.getServletInfo();
+	}
+
+	public void destroy() {
+		if (_instance!=null) {
+			_instance.destroy();
+			_instance=null;
+		}
+	}
+
+	public void setInstance(Servlet instance) throws ServletException {
+		_instance=instance;
+		_instance.init(_config);
+	}
+
+	public Servlet getInstance() {
+		return _instance;
+	}
+}

Added: incubator/wadi/trunk/modules/tomcat50/src/test/java/org/codehaus/wadi/test/TomcatNode.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/tomcat50/src/test/java/org/codehaus/wadi/test/TomcatNode.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/tomcat50/src/test/java/org/codehaus/wadi/test/TomcatNode.java (added)
+++ incubator/wadi/trunk/modules/tomcat50/src/test/java/org/codehaus/wadi/test/TomcatNode.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,138 @@
+/**
+ *
+ * Copyright 2003-2005 Core Developers Network Ltd.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.codehaus.wadi.test;
+
+
+import java.util.regex.Pattern;
+
+import javax.servlet.Filter;
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+
+import org.apache.catalina.Connector;
+import org.apache.catalina.Engine;
+import org.apache.catalina.Host;
+import org.apache.catalina.core.FilterConfigHelper;
+import org.apache.catalina.core.StandardContext;
+import org.apache.catalina.core.StandardWrapper;
+import org.apache.catalina.startup.Embedded;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.codehaus.wadi.tomcat50.Valve;
+
+/**
+ * TODO - JavaDoc this type
+ *
+ * @author <a href="mailto:jules@coredevelopers.net">Jules Gosnell</a>
+ * @version $Revision: 1.4 $
+ */
+
+public class TomcatNode implements Node {
+	protected final Log _log = LogFactory.getLog(getClass());
+	protected final Embedded _server;
+	protected final Engine _engine;
+	protected final Host _host;
+	protected final Connector _connector;
+	protected final StandardContext _context;
+	protected StandardWrapper _wrapper;
+	protected final Filter _filter;
+	protected final Servlet _servlet;
+
+	/**
+	 *
+	 */
+	public TomcatNode(String name, String host, int port, String context, String webApp, Filter filter, Servlet servlet) {
+		super();
+		// TODO Auto-generated method stub
+		String home="/usr/local/java/jakarta-tomcat-5.0.28";
+		System.setProperty("catalina.home", home);
+		System.setProperty("catalina.base", home);
+		_server=new Embedded();
+
+	    // Context
+	    _context=(StandardContext)_server.createContext(context, webApp);
+//	    _context.setSaveConfig(false);
+//	    _context.setOverride(true);
+//	    _context.setTldValidation(false);
+	    _context.addValve(new Valve(Pattern.compile("127\\.0\\.0\\.1|192\\.168\\.0\\.\\d{1,3}")));
+	    //_context.start();
+
+	    // Host
+	    _host=_server.createHost("localhost", "/home/jules/workspace/wadi/webapps");
+	    _host.addChild(_context);
+	    // Engine
+	    _engine=_server.createEngine();
+	    _engine.setDefaultHost("localhost");
+	    _engine.addChild(_host);
+
+	    // Server
+	    _server.addEngine(_engine);
+
+	    // Assemble and install a default HTTP connector
+	    _connector=_server.createConnector((String)null, port, false);
+	    _connector.setRedirectPort(0);
+	    _server.addConnector(_connector);
+
+	    _filter=filter;
+	    _servlet=servlet;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.codehaus.wadi.sandbox.context.test.Node#getFilter()
+	 */
+	public Filter getFilter() {
+		return FilterConfigHelper.getFilter(_context.findFilterConfig("Filter"));
+	}
+
+	/* (non-Javadoc)
+	 * @see org.codehaus.wadi.sandbox.context.test.Node#getServlet()
+	 */
+	public Servlet getServlet() {
+		Servlet servlet=null;
+		try {
+			servlet=_wrapper.allocate();
+		} catch (ServletException e) {
+		  _log.error(e);
+        }
+		return servlet;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.codehaus.wadi.sandbox.context.test.Node#start()
+	 */
+	public void start() throws Exception {
+		//_context.start();
+	    _server.start();
+
+	    _wrapper=(StandardWrapper)_context.findChild("Servlet");
+		_wrapper.setMaxInstances(1);
+
+		((FilterInstance)getFilter()).setInstance(_filter);
+		((ServletInstance)getServlet()).setInstance(_servlet);	}
+
+	/* (non-Javadoc)
+	 * @see org.codehaus.wadi.sandbox.context.test.Node#stop()
+	 */
+	public void stop() throws Exception {
+		// TODO Auto-generated method stub
+		_server.stop();
+	}
+
+	// Securable - NYI
+	public boolean getSecure(){return _connector.getSecure();}
+	public void setSecure(boolean secure){_connector.setSecure(secure);}
+}

Added: incubator/wadi/trunk/modules/tomcat55/.classpath
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/tomcat55/.classpath?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/tomcat55/.classpath (added)
+++ incubator/wadi/trunk/modules/tomcat55/.classpath Wed Dec 14 15:32:56 2005
@@ -0,0 +1,26 @@
+<classpath>
+  <classpathentry kind="src" path="src/main/java"/>
+  <classpathentry kind="src" path="src/main/resources"/>
+  <classpathentry kind="output" path="target/classes"/>
+  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+  <classpathentry kind="var" path="M2_REPO/concurrent/concurrent/1.3.4/concurrent-1.3.4.jar" sourcepath="M2_REPO/concurrent/concurrent/1.3.4/concurrent-1.3.4-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/backport-util-concurrent/backport-util-concurrent/2.0_01_pd/backport-util-concurrent-2.0_01_pd.jar"/>
+  <classpathentry kind="var" path="M2_REPO/geronimo-spec/geronimo-spec-servlet/2.4-rc4/geronimo-spec-servlet-2.4-rc4.jar" sourcepath="M2_REPO/geronimo-spec/geronimo-spec-servlet/2.4-rc4/geronimo-spec-servlet-2.4-rc4-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar" sourcepath="M2_REPO/junit/junit/3.8.1/junit-3.8.1-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/axion/axion/1.0-M3-dev/axion-1.0-M3-dev.jar"/>
+  <classpathentry kind="var" path="M2_REPO/jcache/jcache/1.0-dev-2/jcache-1.0-dev-2.jar"/>
+  <classpathentry kind="var" path="M2_REPO/tomcat/catalina/5.5.12/catalina-5.5.12.jar"/>
+  <classpathentry kind="var" path="M2_REPO/activemq/activemq/WADI-3.2/activemq-WADI-3.2.jar"/>
+  <classpathentry kind="var" path="M2_REPO/geronimo-spec/geronimo-spec-j2ee-management/1.0-rc4/geronimo-spec-j2ee-management-1.0-rc4.jar"/>
+  <classpathentry kind="var" path="M2_REPO/commons-primitives/commons-primitives/1.0/commons-primitives-1.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/springframework/spring/1.2.5/spring-1.2.5.jar"/>
+  <classpathentry kind="var" path="M2_REPO/commons-collections/commons-collections/3.1/commons-collections-3.1.jar" sourcepath="M2_REPO/commons-collections/commons-collections/3.1/commons-collections-3.1-sources.jar"/>
+  <classpathentry kind="src" path="/wadi-core"/>
+  <classpathentry kind="var" path="M2_REPO/geronimo-spec/geronimo-spec-jms/1.1-rc4/geronimo-spec-jms-1.1-rc4.jar"/>
+  <classpathentry kind="var" path="M2_REPO/mx4j/mx4j/3.0.1/mx4j-3.0.1.jar"/>
+  <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging-api/1.0.4/commons-logging-api-1.0.4.jar"/>
+  <classpathentry kind="var" path="M2_REPO/commons-el/commons-el/1.0/commons-el-1.0.jar" sourcepath="M2_REPO/commons-el/commons-el/1.0/commons-el-1.0-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/regexp/regexp/1.3/regexp-1.3.jar"/>
+  <classpathentry kind="var" path="M2_REPO/commons-httpclient/commons-httpclient/2.0.2/commons-httpclient-2.0.2.jar"/>
+  <classpathentry kind="var" path="M2_REPO/activecluster/activecluster/1.2-20051115174934/activecluster-1.2-20051115174934.jar"/>
+</classpath>
\ No newline at end of file

Added: incubator/wadi/trunk/modules/tomcat55/.cvsignore
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/tomcat55/.cvsignore?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/tomcat55/.cvsignore (added)
+++ incubator/wadi/trunk/modules/tomcat55/.cvsignore Wed Dec 14 15:32:56 2005
@@ -0,0 +1,5 @@
+.classpath
+.project
+.settings
+.wtpmodules
+target

Added: incubator/wadi/trunk/modules/tomcat55/.project
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/tomcat55/.project?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/tomcat55/.project (added)
+++ incubator/wadi/trunk/modules/tomcat55/.project Wed Dec 14 15:32:56 2005
@@ -0,0 +1,30 @@
+<projectDescription>
+  <name>wadi-tomcat55</name>
+  <comment/>
+  <projects>
+    <project>wadi-core</project>
+  </projects>
+  <buildSpec>
+    <buildCommand>
+      <name>org.eclipse.wst.common.modulecore.ComponentStructuralBuilder</name>
+      <arguments/>
+    </buildCommand>
+    <buildCommand>
+      <name>org.eclipse.jdt.core.javabuilder</name>
+      <arguments/>
+    </buildCommand>
+    <buildCommand>
+      <name>org.eclipse.wst.validation.validationbuilder</name>
+      <arguments/>
+    </buildCommand>
+    <buildCommand>
+      <name>org.eclipse.wst.common.modulecore.ComponentStructuralBuilderDependencyResolver</name>
+      <arguments/>
+    </buildCommand>
+  </buildSpec>
+  <natures>
+    <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
+    <nature>org.eclipse.jdt.core.javanature</nature>
+    <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+  </natures>
+</projectDescription>
\ No newline at end of file

Added: incubator/wadi/trunk/modules/tomcat55/.settings/org.eclipse.jdt.core.prefs
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/tomcat55/.settings/org.eclipse.jdt.core.prefs?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/tomcat55/.settings/org.eclipse.jdt.core.prefs (added)
+++ incubator/wadi/trunk/modules/tomcat55/.settings/org.eclipse.jdt.core.prefs Wed Dec 14 15:32:56 2005
@@ -0,0 +1,5 @@
+#Mon Dec 12 06:18:26 MST 2005
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.source=1.4
+org.eclipse.jdt.core.compiler.compliance=1.4

Added: incubator/wadi/trunk/modules/tomcat55/.wtpmodules
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/tomcat55/.wtpmodules?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/tomcat55/.wtpmodules (added)
+++ incubator/wadi/trunk/modules/tomcat55/.wtpmodules Wed Dec 14 15:32:56 2005
@@ -0,0 +1,9 @@
+<project-modules id="moduleCoreId">
+  <wb-module deploy-name="wadi-tomcat55">
+    <module-type module-type-id="jst.utility">
+      <property name="java-output-path" value="/target/classes"/>
+    </module-type>
+    <wb-resource deploy-path="/" source-path="src/main/java"/>
+    <wb-resource deploy-path="/" source-path="src/main/resources"/>
+  </wb-module>
+</project-modules>
\ No newline at end of file

Added: incubator/wadi/trunk/modules/tomcat55/pom.xml
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/tomcat55/pom.xml?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/tomcat55/pom.xml (added)
+++ incubator/wadi/trunk/modules/tomcat55/pom.xml Wed Dec 14 15:32:56 2005
@@ -0,0 +1,89 @@
+<project>
+    <parent>
+        <groupId>wadi</groupId>
+        <artifactId>wadi</artifactId>
+        <version>2.0M1</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>wadi-tomcat55</artifactId>
+    <packaging>jar</packaging>
+    <name>WADI :: Tomcat55</name>
+    <scm>
+        <connection>scm:cvs:pserver:anoncvs@cvs.wadi.codehaus.org:/home/projects/wadi/scm:wadi/modules/tomcat55</connection>
+        <developerConnection>scm:cvs:ext:${maven.username}@cvs.wadi.codehaus.org/home/projects/wadi/scm:wadi/modules/tomcat55</developerConnection>
+        <url>http://cvs.wadi.codehaus.org/viewrep/wadi/wadi/modules/tomcat55</url>
+    </scm>
+    <dependencies>
+
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging-api</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>geronimo-spec</groupId>
+            <artifactId>geronimo-spec-servlet</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>wadi</groupId>
+            <artifactId>wadi-core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>tomcat</groupId>
+            <artifactId>catalina</artifactId>
+            <version>5.5.12</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-site-plugin</artifactId>
+                <configuration>
+                    <outputDirectory>../../wadi-site/target/site/${artifactId}</outputDirectory>
+                </configuration>
+                
+            </plugin>
+            <plugin>
+              <groupId>org.apache.maven.plugins</groupId>
+              <artifactId>maven-javadoc-plugin</artifactId>
+              <configuration>
+                <source>1.4</source>
+                <destDir>../../wadi-site/target/site/${artifactId}</destDir>
+              </configuration>
+          </plugin>
+        </plugins>
+    </build>
+    <reporting>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-javadoc-plugin</artifactId>
+                <configuration>
+                    <source>1.4</source>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>surefire-report-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </reporting>
+</project>

Added: incubator/wadi/trunk/modules/tomcat55/src/main/java/org/apache/catalina/core/FilterConfigHelper.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/tomcat55/src/main/java/org/apache/catalina/core/FilterConfigHelper.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/tomcat55/src/main/java/org/apache/catalina/core/FilterConfigHelper.java (added)
+++ incubator/wadi/trunk/modules/tomcat55/src/main/java/org/apache/catalina/core/FilterConfigHelper.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,44 @@
+/**
+ *
+ * Copyright 2003-2005 Core Developers Network Ltd.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.catalina.core;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterConfig;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Has it really come to this...
+ *
+ * @author <a href="mailto:jules@coredevelopers.net">Jules Gosnell</a>
+ * @version $Revision: 1.3 $
+ */
+
+public class FilterConfigHelper {
+	protected static final Log _log=LogFactory.getLog(FilterConfigHelper.class);
+
+	public static Filter getFilter(FilterConfig config) {
+		Filter filter=null;
+		try {
+			filter=((ApplicationFilterConfig)config).getFilter();
+		} catch (Exception e) {
+		  _log.error(e);
+        }
+		return filter;
+	}
+}

Added: incubator/wadi/trunk/modules/tomcat55/src/main/java/org/codehaus/wadi/tomcat55/TomcatManager.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/tomcat55/src/main/java/org/codehaus/wadi/tomcat55/TomcatManager.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/tomcat55/src/main/java/org/codehaus/wadi/tomcat55/TomcatManager.java (added)
+++ incubator/wadi/trunk/modules/tomcat55/src/main/java/org/codehaus/wadi/tomcat55/TomcatManager.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,311 @@
+/**
+ *
+ * Copyright 2003-2005 Core Developers Network Ltd.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.codehaus.wadi.tomcat55;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Pattern;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpSessionAttributeListener;
+import javax.servlet.http.HttpSessionListener;
+
+import org.apache.catalina.Container;
+import org.apache.catalina.Context;
+import org.apache.catalina.Lifecycle;
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.LifecycleListener;
+import org.apache.catalina.Manager;
+import org.apache.catalina.Session;
+import org.apache.catalina.core.StandardContext;
+import org.apache.catalina.deploy.FilterDef;
+import org.apache.catalina.deploy.FilterMap;
+import org.apache.catalina.util.LifecycleSupport;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.codehaus.wadi.ManagerConfig;
+import org.codehaus.wadi.impl.Filter;
+import org.codehaus.wadi.impl.SpringManagerFactory;
+import org.codehaus.wadi.impl.StandardManager;
+import org.codehaus.wadi.impl.StandardSessionWrapperFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class TomcatManager implements ManagerConfig, Lifecycle, Manager
+{
+  protected static final Log _log = LogFactory.getLog(TomcatManager.class);
+
+  protected StandardManager _wadi;
+  protected Container _container;
+  protected boolean _distributable;
+  protected int _sessionCounter; // push back into WADI - TODO
+  protected int _maxActive; // exactly what does this mean ? - probably only valid for some Evicter types... - TODO
+  protected int _expiredSessions; // TODO - wire up
+  protected int _rejectedSessions; // TODO - wire up
+  protected PropertyChangeSupport _propertyChangeListeners=new PropertyChangeSupport(this); 	// actual notifications are done by aspects...
+
+  // org.codehaus.wadi.ManagerConfig
+
+  public ServletContext getServletContext() {
+    return ((Context)_container).getServletContext();
+  }
+
+  public void callback(StandardManager manager) {
+    // install Listeners ...
+    Context context=((Context)_container);
+
+    Object[] sessionListeners=context.getApplicationLifecycleListeners();
+    List sll=new ArrayList();
+    for (int i=0; i<sessionListeners.length; i++) {
+      Object listener=sessionListeners[i];
+      if (listener instanceof HttpSessionListener)
+	sll.add((HttpSessionListener)listener);
+    }
+    manager.setSessionListeners((HttpSessionListener[])sll.toArray(new HttpSessionListener[sll.size()]));
+
+    Object[] attributeListeners=context.getApplicationEventListeners();
+    List all=new ArrayList();
+    for (int i=0; i<attributeListeners.length; i++) {
+      Object listener=attributeListeners[i];
+      if (listener instanceof HttpSessionAttributeListener)
+	all.add((HttpSessionAttributeListener)listener);
+    }
+    manager.setAttributelisteners((HttpSessionAttributeListener[])all.toArray(new HttpSessionAttributeListener[all.size()]));
+  }
+
+  // org.apache.catalina.Lifecycle
+
+  // actual notifications are done by aspects...
+  protected LifecycleSupport _lifecycleListeners=new LifecycleSupport(this);
+
+  public void addLifecycleListener(LifecycleListener listener) {
+    _lifecycleListeners.addLifecycleListener(listener);
+  }
+
+  public LifecycleListener[] findLifecycleListeners() {
+    return _lifecycleListeners.findLifecycleListeners();
+  }
+
+  public void removeLifecycleListener(LifecycleListener listener) {
+    _lifecycleListeners.removeLifecycleListener(listener);
+  }
+
+  public void start() throws LifecycleException {
+	  try {
+          String resources[] = {"/org/codehaus/wadi/tomcat55/tomcat55Config.xml",
+                                "/org/codehaus/wadi/impl/wadiConfig.xml"};
+          ApplicationContext ctx = new ClassPathXmlApplicationContext(resources);
+          _wadi = (StandardManager)ctx.getBean("SessionManager");
+		  //_wadi=(StandardManager)SpringManagerFactory.create(is, "SessionManager", 
+          //      new TomcatSessionFactory(), new StandardSessionWrapperFactory());
+	  } catch (Exception e) {
+		  throw new RuntimeException("Required resource: '/WEB-INF/wadi-web.xml' not found - please check the web app.", e);
+	  }
+	  
+	  _wadi.init(this);
+	  try {
+		  _wadi.start();
+		  
+		  if (_container==null) {
+			  _log.warn("container not set - fn-ality will be limited");
+		  } else {
+			  Context context=((Context)_container);
+			  
+			  // install Valve
+			  ((StandardContext)context).addValve(new Valve(Pattern.compile("127\\.0\\.0\\.1|192\\.168\\.0\\.\\d{1,3}")));
+			  
+			  // install filter
+			  String filterName="WadiFilter";
+			  FilterDef fd=new FilterDef();
+			  fd.setFilterName(filterName);
+			  fd.setFilterClass(Filter.class.getName());
+			  context.addFilterDef(fd);
+			  FilterMap fm=new FilterMap();
+			  fm.setFilterName(filterName);
+			  fm.setURLPattern("/*");
+			  context.addFilterMap(fm);
+			  
+			  //				// is this a distributable webapp ?
+			  //				boolean distributable=context.getDistributable();
+			  //				if (distributable && !_distributable)
+			  //				setDistributable(distributable);
+		  }
+		  
+	  } catch (Exception e) {
+		  throw new LifecycleException(e);
+	  }
+  }
+
+  public void stop() throws LifecycleException {
+    try {
+      _wadi.stop();
+    } catch (Exception e) {
+      throw new LifecycleException(e);
+    }
+  }
+
+  // org.apache.catalina.Manager
+
+  public Container getContainer() {
+    return _container;
+  }
+
+  public void setContainer(Container container) {
+    _container=container;
+  }
+
+  public boolean getDistributable() {
+    return _distributable;
+  }
+
+  public void setDistributable(boolean distributable) { // TODO - reconcile with WADI's idea of this setting...
+    _distributable=distributable;
+  }
+
+  public String getInfo() {
+    return "<code>&lt;"+getClass().getName()+"&gt;/&lt;1.0b&gt;</code>";
+  }
+
+  public int getMaxInactiveInterval() {
+    return _wadi.getMaxInactiveInterval();
+  }
+
+  public void setMaxInactiveInterval(int interval) {
+    _wadi.setMaxInactiveInterval(interval);
+  }
+
+  public int getSessionIdLength() {
+    return _wadi.getSessionIdFactory().getSessionIdLength();
+  }
+
+  public void setSessionIdLength(int sessionIdLength) {
+    _wadi.getSessionIdFactory().setSessionIdLength(sessionIdLength);
+  }
+
+  public int getSessionCounter() {
+    return _sessionCounter;
+  }
+
+  public void setSessionCounter(int sessionCounter) {
+    _sessionCounter=sessionCounter;
+  }
+
+  public int getMaxActive() {
+    return _maxActive;
+  }
+
+  public void setMaxActive(int maxActive) {
+    _maxActive=maxActive;
+  }
+
+  public int getActiveSessions() {
+    // probably the size of the Memory map... - TODO
+    return 0;
+  }
+
+  public int getExpiredSessions() {
+    return _expiredSessions;
+  }
+
+  public void setExpiredSessions(int expiredSessions) {
+    _expiredSessions=expiredSessions;
+  }
+
+  public int getRejectedSessions() {
+    return _rejectedSessions;
+  }
+
+  public void setRejectedSessions(int rejectedSessions) {
+    _rejectedSessions=rejectedSessions;
+  }
+
+  public int getSessionMaxAliveTime() {
+    // TODO Auto-generated method stub
+    return 0;
+  }
+
+  public void setSessionMaxAliveTime(int arg0) {
+    // TODO Auto-generated method stub
+
+  }
+
+  public int getSessionAverageAliveTime() {
+    // TODO Auto-generated method stub
+    return 0;
+  }
+
+  public void setSessionAverageAliveTime(int arg0) {
+    // TODO Auto-generated method stub
+
+  }
+
+  public void add(Session session) {
+    // perhaps hook up to an Immoter ? - TODO
+  }
+
+  public void addPropertyChangeListener(PropertyChangeListener listener) {
+    _propertyChangeListeners.addPropertyChangeListener(listener);
+  }
+
+  public Session createEmptySession() {
+    throw new UnsupportedOperationException();
+  }
+
+  public Session createSession() {
+    return (TomcatSession)_wadi.create();
+  }
+
+  public Session createSession(String arg0) {
+      if (_log.isInfoEnabled()) _log.info("createSession("+arg0+")");
+      return (TomcatSession)_wadi.create();
+  }
+
+  public Session findSession(String id) throws IOException {
+	  //throw new UnsupportedOperationException();
+	  if (_log.isWarnEnabled()) _log.warn("findSession("+id+") called - currently unsupported");
+	  return null;
+  }
+
+  public Session[] findSessions() {
+    throw new UnsupportedOperationException();
+  }
+
+  public void load() throws ClassNotFoundException, IOException {
+    // perhaps hook up to promoteToLocal();
+  }
+
+  public void remove(Session session) {
+    // perhaps hook up to an Emoter - TODO
+  }
+
+  public void removePropertyChangeListener(PropertyChangeListener listener) {
+    _propertyChangeListeners.removePropertyChangeListener(listener);
+  }
+
+  public void unload() throws IOException {
+    // perhaps hook up to demoteToShared();
+  }
+
+  public void backgroundProcess() {
+    // not used - Evicter is attached to a Timer by super()...
+  }
+
+}

Added: incubator/wadi/trunk/modules/tomcat55/src/main/java/org/codehaus/wadi/tomcat55/TomcatSession.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/tomcat55/src/main/java/org/codehaus/wadi/tomcat55/TomcatSession.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/tomcat55/src/main/java/org/codehaus/wadi/tomcat55/TomcatSession.java (added)
+++ incubator/wadi/trunk/modules/tomcat55/src/main/java/org/codehaus/wadi/tomcat55/TomcatSession.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,218 @@
+/**
+ *
+ * Copyright 2003-2005 Core Developers Network Ltd.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.codehaus.wadi.tomcat55;
+
+import java.security.Principal;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpSession;
+
+import org.apache.catalina.Manager;
+import org.apache.catalina.Session;
+import org.apache.catalina.SessionListener;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.codehaus.wadi.ReplicableSessionConfig;
+import org.codehaus.wadi.impl.AtomicallyReplicableSession;
+
+/**
+ * Interestingly, in Tomcat a Session is a facade (for internal use) over an HttpSession (for external use), but
+ * in WADI we have a Session (rich implementation for internal use) which is facaded by an HttpSession (constrains
+ * available API for external use). Thus, our implementation is Tomcat's facade and vice versa ! Confused ? I was...
+ * This is bad news, because it makes it awkward to combine Tomcat and WADI functionality dynamically. For the moment
+ * all Tomcat sessions are ReplicableSessions. I will come up with a solution to this later.
+ *
+ * @author <a href="mailto:jules@coredevelopers.net">Jules Gosnell</a>
+ * @version $Revision: 1.7 $
+ */
+
+public class TomcatSession extends AtomicallyReplicableSession implements Session {
+
+  protected static final Log _log = LogFactory.getLog(TomcatSession.class);
+
+  public TomcatSession(ReplicableSessionConfig config) {
+    super(config);
+  }
+
+  public void destroy() {
+	  _authType=null;
+	  _principal=null;
+	  _notes.clear();
+	  _listeners.clear();
+	  try {
+		  super.destroy();
+	  } catch (Exception e) {
+		  _log.warn("unexpected problem destroying session");
+	  }
+  }
+
+  public void setId(String id) {
+    // we set our id via init() method...
+    throw new UnsupportedOperationException("WADI does not support the use of Session.setId(String)");
+  }
+
+  public void setCreationTime(long creationTime) {
+    // we set our creationTime via init() method...
+    throw new UnsupportedOperationException("WADI does not support the use of Session.setCreationTime(long)");
+  }
+
+  public String getInfo() {
+    return getClass().getName()+" v2.0";
+  }
+
+  public HttpSession getSession() {
+    return _wrapper;
+  }
+
+  public Manager getManager() {
+    return (Manager)_config;
+  }
+
+  public void setManager(Manager manager) {
+    // initialises backptr to Manager - we already have this as we
+    // were given it as our _config on construction...
+
+    // called by Manager, but we don't call it and do not expect to be called...
+    throw new UnsupportedOperationException("WADI does not support the use of Session.setManager(Manager)");
+  }
+
+  protected transient String _authType;
+
+  public String getAuthType() {
+    return _authType;
+  }
+
+  public void setAuthType(String authType) {
+    _authType=authType;
+  }
+
+  protected transient Principal _principal;
+
+  public Principal getPrincipal() {
+    return _principal;
+  }
+
+  public void setPrincipal(Principal principal) {
+    _principal=principal;
+  }
+
+  protected transient final Map _notes=Collections.synchronizedMap(new HashMap());
+
+  public void setNote(String name, Object value) {
+    _notes.put(name, value);
+  }
+
+  public Object getNote(String name) {
+    return _notes.get(name);
+  }
+
+  public void removeNote(String name) {
+    _notes.remove(name);
+  }
+
+  public Iterator getNoteNames() {
+    return _notes.keySet().iterator();
+  }
+
+  protected List _listeners=Collections.synchronizedList(new ArrayList());
+
+  public List getSessionListeners(){return _listeners;} // not Tomcat - used by aspect
+
+  public void addSessionListener(SessionListener listener) {
+    _listeners.add(listener);
+  }
+
+  public void removeSessionListener(SessionListener listener) {
+    _listeners.remove(listener);
+  }
+
+  public void setValid(boolean isValid) {
+    // WADI invalidates a Session by releasing its Id. Thus
+    // we don't need to maintain a seperate flag in every Session.
+
+    // Tomcat only seems to call this from Manager and Session -
+    // we don't use it and are not expecting it to be called.
+    throw new UnsupportedOperationException("WADI does not support the use of Session.setValid(boolean)");
+  }
+
+  public boolean isValid() {
+    // Tomcat checks for expiry in this method and uses it to validate
+    // Session access...
+
+    // WADI takes the approach that if a Session is in the Container
+    // at the time a request arrives, it would be foolish to invalidate
+    // it - in fact, you would not be able to, because the visiting thread
+    // would already have a lock...
+
+    // I don't think we use this method...
+    throw new UnsupportedOperationException("WADI does not support the use of Session.isValid()");
+  }
+
+  public void setNew(boolean isNew) {
+    // WADI tests whether creation and lastAccessed time are the same
+    // to determine whether a session has been joined... It saves carrying
+    // an extra flag in every session.
+
+    // Tomcat only seems to call this from Manager and Session - we do not use it...
+    throw new UnsupportedOperationException("WADI does not support the use of Session.setNew(boolean)");
+  }
+
+  public void access() {
+    // since there is no way to externally query whether the session is currently
+    // being accessed, these must be notifications for the session's internal use.
+    // WADI does not currently require them, so they remain unimplemented.
+
+    // if/when WADI implements e.g. writing sessions out at the end of an event group,
+    // it will be done by acquiring a exclusive lock on the session, so won't need
+    // this approach...
+
+    // doesn't need to do anything - wasted cycles
+  }
+
+  public void endAccess() {
+    // used to maintain an accessCount - not needed (see above)
+    // used to unset 'new' flag - not needed - see setNew()
+
+    // doesn't need to do anything - wasted cycles
+  }
+
+  public void recycle() {
+    // used by some Tomcat Managers to recycle Session objects
+    // Our Manager uses alternate means - we are not expecting to be called...
+
+    throw new UnsupportedOperationException("WADI does not support the use of Session.recycle()");
+  }
+
+  public void expire() {
+    // only seems to be called by Manager
+    // We don't use it and don't expect it to be called...
+
+    throw new UnsupportedOperationException("WADI does not support the use of Session.expire()");
+  }
+
+  // Tomcat 5.5.10 and later
+  
+  public String getIdInternal() {
+	  return _name;
+  }
+
+}

Added: incubator/wadi/trunk/modules/tomcat55/src/main/java/org/codehaus/wadi/tomcat55/TomcatSessionFactory.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/tomcat55/src/main/java/org/codehaus/wadi/tomcat55/TomcatSessionFactory.java?rev=356933&view=auto
==============================================================================
--- incubator/wadi/trunk/modules/tomcat55/src/main/java/org/codehaus/wadi/tomcat55/TomcatSessionFactory.java (added)
+++ incubator/wadi/trunk/modules/tomcat55/src/main/java/org/codehaus/wadi/tomcat55/TomcatSessionFactory.java Wed Dec 14 15:32:56 2005
@@ -0,0 +1,30 @@
+/**
+ *
+ * Copyright 2003-2005 Core Developers Network Ltd.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.codehaus.wadi.tomcat55;
+
+import org.codehaus.wadi.ReplicableSessionConfig;
+import org.codehaus.wadi.Session;
+import org.codehaus.wadi.SessionConfig;
+import org.codehaus.wadi.SessionFactory;
+
+public class TomcatSessionFactory implements SessionFactory {
+
+    public Session create(SessionConfig config) {
+        return new TomcatSession((ReplicableSessionConfig)config);
+    }
+
+}



Mime
View raw message