You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wadi-commits@incubator.apache.org by bd...@apache.org on 2005/12/20 12:34:04 UTC

svn commit: r357979 - in /incubator/wadi/trunk/modules/tomcat50/src: main/java/org/apache/catalina/core/ main/java/org/codehaus/wadi/tomcat50/ test/java/org/codehaus/wadi/test/

Author: bdudney
Date: Tue Dec 20 04:33:50 2005
New Revision: 357979

URL: http://svn.apache.org/viewcvs?rev=357979&view=rev
Log:
format & organize imports

Modified:
    incubator/wadi/trunk/modules/tomcat50/src/main/java/org/apache/catalina/core/FilterConfigHelper.java
    incubator/wadi/trunk/modules/tomcat50/src/main/java/org/codehaus/wadi/tomcat50/TomcatManager.java
    incubator/wadi/trunk/modules/tomcat50/src/main/java/org/codehaus/wadi/tomcat50/TomcatSession.java
    incubator/wadi/trunk/modules/tomcat50/src/main/java/org/codehaus/wadi/tomcat50/TomcatSessionFactory.java
    incubator/wadi/trunk/modules/tomcat50/src/main/java/org/codehaus/wadi/tomcat50/Valve.java
    incubator/wadi/trunk/modules/tomcat50/src/test/java/org/codehaus/wadi/test/FilterInstance.java
    incubator/wadi/trunk/modules/tomcat50/src/test/java/org/codehaus/wadi/test/Node.java
    incubator/wadi/trunk/modules/tomcat50/src/test/java/org/codehaus/wadi/test/ServletInstance.java
    incubator/wadi/trunk/modules/tomcat50/src/test/java/org/codehaus/wadi/test/TomcatNode.java

Modified: incubator/wadi/trunk/modules/tomcat50/src/main/java/org/apache/catalina/core/FilterConfigHelper.java
URL: http://svn.apache.org/viewcvs/incubator/wadi/trunk/modules/tomcat50/src/main/java/org/apache/catalina/core/FilterConfigHelper.java?rev=357979&r1=357978&r2=357979&view=diff
==============================================================================
--- incubator/wadi/trunk/modules/tomcat50/src/main/java/org/apache/catalina/core/FilterConfigHelper.java (original)
+++ incubator/wadi/trunk/modules/tomcat50/src/main/java/org/apache/catalina/core/FilterConfigHelper.java Tue Dec 20 04:33:50 2005
@@ -18,27 +18,26 @@
 
 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);
+    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);
+    public static Filter getFilter(FilterConfig config) {
+        Filter filter = null;
+        try {
+            filter = ((ApplicationFilterConfig) config).getFilter();
+        } catch (Exception e) {
+            _log.error(e);
         }
-		return filter;
-	}
+        return filter;
+    }
 }

Modified: 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=357979&r1=357978&r2=357979&view=diff
==============================================================================
--- incubator/wadi/trunk/modules/tomcat50/src/main/java/org/codehaus/wadi/tomcat50/TomcatManager.java (original)
+++ incubator/wadi/trunk/modules/tomcat50/src/main/java/org/codehaus/wadi/tomcat50/TomcatManager.java Tue Dec 20 04:33:50 2005
@@ -23,11 +23,9 @@
 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;
@@ -43,256 +41,262 @@
 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;
+import org.codehaus.wadi.impl.StandardManager;
+import org.codehaus.wadi.impl.StandardSessionWrapperFactory;
 
-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);}
-
+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);}
 }

Modified: 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=357979&r1=357978&r2=357979&view=diff
==============================================================================
--- incubator/wadi/trunk/modules/tomcat50/src/main/java/org/codehaus/wadi/tomcat50/TomcatSession.java (original)
+++ incubator/wadi/trunk/modules/tomcat50/src/main/java/org/codehaus/wadi/tomcat50/TomcatSession.java Tue Dec 20 04:33:50 2005
@@ -23,9 +23,7 @@
 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;
@@ -35,176 +33,184 @@
 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...
- *
+ * 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 {
+    private static final long serialVersionUID = -7231919756359770906L;
+    protected static final Log _log = LogFactory.getLog(TomcatSession.class);
 
-  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()");
-  }
-
+    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()");
+    }
 }

Modified: 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=357979&r1=357978&r2=357979&view=diff
==============================================================================
--- incubator/wadi/trunk/modules/tomcat50/src/main/java/org/codehaus/wadi/tomcat50/TomcatSessionFactory.java (original)
+++ incubator/wadi/trunk/modules/tomcat50/src/main/java/org/codehaus/wadi/tomcat50/TomcatSessionFactory.java Tue Dec 20 04:33:50 2005
@@ -22,9 +22,7 @@
 import org.codehaus.wadi.SessionFactory;
 
 public class TomcatSessionFactory implements SessionFactory {
-
     public Session create(SessionConfig config) {
-        return new TomcatSession((DistributableSessionConfig)config);
+        return new TomcatSession((DistributableSessionConfig) config);
     }
-
 }

Modified: 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=357979&r1=357978&r2=357979&view=diff
==============================================================================
--- incubator/wadi/trunk/modules/tomcat50/src/main/java/org/codehaus/wadi/tomcat50/Valve.java (original)
+++ incubator/wadi/trunk/modules/tomcat50/src/main/java/org/codehaus/wadi/tomcat50/Valve.java Tue Dec 20 04:33:50 2005
@@ -18,10 +18,8 @@
 
 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;
@@ -31,48 +29,56 @@
 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.
- *
+ * 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);
-	}
-	
+    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);
+    }
 }

Modified: 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=357979&r1=357978&r2=357979&view=diff
==============================================================================
--- incubator/wadi/trunk/modules/tomcat50/src/test/java/org/codehaus/wadi/test/FilterInstance.java (original)
+++ incubator/wadi/trunk/modules/tomcat50/src/test/java/org/codehaus/wadi/test/FilterInstance.java Tue Dec 20 04:33:50 2005
@@ -17,7 +17,6 @@
 package org.codehaus.wadi.test;
 
 import java.io.IOException;
-
 import javax.servlet.Filter;
 import javax.servlet.FilterChain;
 import javax.servlet.FilterConfig;
@@ -28,38 +27,36 @@
 /**
  * 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;
 
-	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;
-	}
+    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;
+    }
 }
-

Modified: 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=357979&r1=357978&r2=357979&view=diff
==============================================================================
--- incubator/wadi/trunk/modules/tomcat50/src/test/java/org/codehaus/wadi/test/Node.java (original)
+++ incubator/wadi/trunk/modules/tomcat50/src/test/java/org/codehaus/wadi/test/Node.java Tue Dec 20 04:33:50 2005
@@ -18,23 +18,20 @@
 
 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();
+    Filter getFilter();
 
-	Servlet getServlet();
+    Servlet getServlet();
 
-	void start() throws Exception;
+    void start() throws Exception;
 
-	void stop() throws Exception;
+    void stop() throws Exception;
 }

Modified: 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=357979&r1=357978&r2=357979&view=diff
==============================================================================
--- incubator/wadi/trunk/modules/tomcat50/src/test/java/org/codehaus/wadi/test/ServletInstance.java (original)
+++ incubator/wadi/trunk/modules/tomcat50/src/test/java/org/codehaus/wadi/test/ServletInstance.java Tue Dec 20 04:33:50 2005
@@ -17,7 +17,6 @@
 package org.codehaus.wadi.test;
 
 import java.io.IOException;
-
 import javax.servlet.Servlet;
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletException;
@@ -27,45 +26,44 @@
 /**
  * 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;
 
-	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;
-	}
+    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;
+    }
 }

Modified: 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=357979&r1=357978&r2=357979&view=diff
==============================================================================
--- incubator/wadi/trunk/modules/tomcat50/src/test/java/org/codehaus/wadi/test/TomcatNode.java (original)
+++ incubator/wadi/trunk/modules/tomcat50/src/test/java/org/codehaus/wadi/test/TomcatNode.java Tue Dec 20 04:33:50 2005
@@ -16,13 +16,10 @@
  */
 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;
@@ -36,103 +33,113 @@
 
 /**
  * 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);
+    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;
-	}
+        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);}
+    /*
+     * (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);
+    }
 }