You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jg...@apache.org on 2005/07/18 00:25:41 UTC

svn commit: r219406 - in /geronimo/trunk/modules/tomcat/src: java/org/apache/geronimo/tomcat/ test/org/apache/geronimo/tomcat/ var/ROOT/ var/ROOT/WEB-INF/

Author: jgenender
Date: Sun Jul 17 15:25:40 2005
New Revision: 219406

URL: http://svn.apache.org/viewcvs?rev=219406&view=rev
Log:
Fixed some small bugs and rearranged host/engine dependency.  Added a ROOT context too.

Added:
    geronimo/trunk/modules/tomcat/src/var/ROOT/
    geronimo/trunk/modules/tomcat/src/var/ROOT/WEB-INF/
    geronimo/trunk/modules/tomcat/src/var/ROOT/WEB-INF/web.xml
    geronimo/trunk/modules/tomcat/src/var/ROOT/geronimo-logo.png   (with props)
    geronimo/trunk/modules/tomcat/src/var/ROOT/index.jsp
    geronimo/trunk/modules/tomcat/src/var/ROOT/tomcat-power.gif   (with props)
    geronimo/trunk/modules/tomcat/src/var/ROOT/tomcat.gif   (with props)
Modified:
    geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/ConnectorGBean.java
    geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/EngineGBean.java
    geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/HostGBean.java
    geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java
    geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatGeronimoEmbedded.java
    geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/ValveGBean.java
    geronimo/trunk/modules/tomcat/src/test/org/apache/geronimo/tomcat/AbstractWebModuleTest.java
    geronimo/trunk/modules/tomcat/src/test/org/apache/geronimo/tomcat/ContainerTest.java

Modified: geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/ConnectorGBean.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/ConnectorGBean.java?rev=219406&r1=219405&r2=219406&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/ConnectorGBean.java (original)
+++ geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/ConnectorGBean.java Sun Jul 17 15:25:40 2005
@@ -16,38 +16,54 @@
 */
 package org.apache.geronimo.tomcat;
 
-import java.util.Map;
-import java.util.Iterator;
-import java.net.InetSocketAddress;
 import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.util.Map;
 
 import org.apache.catalina.LifecycleException;
 import org.apache.catalina.connector.Connector;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.system.serverinfo.ServerInfo;
 
 public class ConnectorGBean extends BaseGBean implements GBeanLifecycle, ObjectRetriever {
+
+    private static final Log log = LogFactory.getLog(ConnectorGBean.class);
     
     private final Connector connector;
     private final TomcatContainer container;
+    private final ServerInfo serverInfo;
     private String name;
     private int port;
 
-    public ConnectorGBean(String name, String protocol, Map initParams, TomcatContainer container) throws Exception {
+    public ConnectorGBean(String name, String protocol, Map initParams, TomcatContainer container, ServerInfo serverInfo) throws Exception {
         super(); // TODO: make it an attribute
         
         if (container == null){
             throw new IllegalArgumentException("container cannot be null.");
         }
+ 
+        if (serverInfo == null){
+            throw new IllegalArgumentException("classLoader cannot be null.");
+        }
         
         this.name = name;
         this.container = container;
-
+        this.serverInfo = serverInfo;
+        
         //Create the Connector object
         connector = new Connector(protocol);
 
+        //Resolve the keystore file path if we have this parameter
+        String keystoreFile = (String)initParams.get("keystoreFile");
+        if (keystoreFile != null){
+            initParams.put("keystoreFile", serverInfo.resolvePath(keystoreFile));
+        }
+
         //Set the parameters
         setParameters(connector, initParams);
         
@@ -77,13 +93,21 @@
     public void doStart() throws LifecycleException {
         container.addConnector(connector);
         connector.start();
-    }
+        log.info(name + " connector started");
+   }
 
     public void doStop() {
+        try{
+            connector.stop();
+        } catch (LifecycleException e){
+            log.error(e);
+        }
         container.removeConnector(connector);
+        log.info(name + " connector stopped");
     }
 
     public void doFail() {
+        log.info(name + " connector failed");
         doStop();
     }
 
@@ -97,7 +121,8 @@
         infoFactory.addAttribute("initParams", Map.class, true);
         infoFactory.addReference("TomcatContainer", TomcatContainer.class, NameFactory.GERONIMO_SERVICE);
         infoFactory.addOperation("getInternalObject");
-        infoFactory.setConstructor(new String[] { "name", "protocol", "initParams", "TomcatContainer"});
+        infoFactory.addReference("ServerInfo", ServerInfo.class, "GBean");
+        infoFactory.setConstructor(new String[] { "name", "protocol", "initParams", "TomcatContainer", "ServerInfo"});
         GBEAN_INFO = infoFactory.getBeanInfo();
     }
 

Modified: geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/EngineGBean.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/EngineGBean.java?rev=219406&r1=219405&r2=219406&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/EngineGBean.java (original)
+++ geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/EngineGBean.java Sun Jul 17 15:25:40 2005
@@ -16,24 +16,32 @@
 */
 package org.apache.geronimo.tomcat;
 
-import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
 import java.util.Map;
 
 import org.apache.catalina.Engine;
+import org.apache.catalina.Host;
 import org.apache.catalina.Realm;
 import org.apache.catalina.Valve;
 import org.apache.catalina.core.StandardEngine;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.gbean.ReferenceCollection;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 
 public class EngineGBean extends BaseGBean implements GBeanLifecycle, ObjectRetriever {
     
+    private static final Log log = LogFactory.getLog(EngineGBean.class);
+   
     private final Engine engine;
 
     public EngineGBean(String className, 
             Map initParams, 
+            Collection hosts,
             ObjectRetriever realmGBean,            
             ValveGBean tomcatValveChain) throws Exception {
         super(); // TODO: make it an attribute
@@ -54,7 +62,6 @@
         //Add the valve list
         if (engine instanceof StandardEngine){
             if (tomcatValveChain != null){
-                ArrayList chain = new ArrayList();
                 ValveGBean valveGBean = tomcatValveChain;
                 while(valveGBean != null){
                     ((StandardEngine)engine).addValve((Valve)valveGBean.getInternalObject());
@@ -62,7 +69,20 @@
                 }
             }
         }
+        
+        //Add the hosts
+        ReferenceCollection refs = (ReferenceCollection)hosts;
+        Iterator iterator = refs.iterator();
+        while (iterator.hasNext()){
+            ObjectRetriever objRetriever = (ObjectRetriever)iterator.next();
+            Host host = (Host)objRetriever.getInternalObject();
+            
+            //If we didn't set a realm, then use the default
+            if (host.getRealm() == null)
+                host.setRealm(engine.getRealm());
 
+            engine.addChild(host);
+        }
     }
 
     public Object getInternalObject() {
@@ -70,12 +90,15 @@
     }
 
     public void doFail() {
+        log.info("Failed");
     }
 
     public void doStart() throws Exception {
+        log.info("Started");
     }
 
     public void doStop() throws Exception {
+        log.info("Stopped");
     }
 
     public static final GBeanInfo GBEAN_INFO;
@@ -84,10 +107,11 @@
         GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("TomcatEngine", EngineGBean.class);
         infoFactory.addAttribute("className", String.class, true);
         infoFactory.addAttribute("initParams", Map.class, true);
+        infoFactory.addReference("hosts", ObjectRetriever.class, HostGBean.J2EE_TYPE);
         infoFactory.addReference("realmGBean", ObjectRetriever.class, NameFactory.GERONIMO_SERVICE);
         infoFactory.addReference("TomcatValveChain", ValveGBean.class, ValveGBean.J2EE_TYPE);
         infoFactory.addOperation("getInternalObject");
-        infoFactory.setConstructor(new String[] { "className", "initParams", "realmGBean", "TomcatValveChain" });
+        infoFactory.setConstructor(new String[] { "className", "initParams", "hosts", "realmGBean", "TomcatValveChain" });
         GBEAN_INFO = infoFactory.getBeanInfo();
     }
 

Modified: geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/HostGBean.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/HostGBean.java?rev=219406&r1=219405&r2=219406&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/HostGBean.java (original)
+++ geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/HostGBean.java Sun Jul 17 15:25:40 2005
@@ -16,26 +16,29 @@
 */
 package org.apache.geronimo.tomcat;
 
-import java.util.ArrayList;
 import java.util.Map;
 
-import org.apache.catalina.Engine;
 import org.apache.catalina.Host;
 import org.apache.catalina.Realm;
 import org.apache.catalina.Valve;
 import org.apache.catalina.core.StandardHost;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 
 public class HostGBean extends BaseGBean implements GBeanLifecycle, ObjectRetriever {
+
+    private static final Log log = LogFactory.getLog(HostGBean.class);
+    
+    public static final String J2EE_TYPE = "Host";
     
     private final Host host;
 
     public HostGBean(String className, 
             Map initParams, 
-            ObjectRetriever engineGBean, 
             ObjectRetriever realmGBean,            
             ValveGBean tomcatValveChain) throws Exception {
         super(); // TODO: make it an attribute
@@ -45,27 +48,18 @@
             className = "org.apache.catalina.core.StandardHost";
         }
         
-        if (engineGBean == null){
-            throw new IllegalArgumentException("engineGBean cannot be null.");
-        }
-                
         //Create the Host object
         host = (Host)Class.forName(className).newInstance();
         
         //Set the parameters
         setParameters(host, initParams);
         
-        Engine engine = ((Engine)engineGBean.getInternalObject());
-
         if (realmGBean != null)
             host.setRealm((Realm)realmGBean.getInternalObject());
-        else
-            host.setRealm(engine.getRealm());
 
         //Add the valve list
         if (host instanceof StandardHost){
             if (tomcatValveChain != null){
-                ArrayList chain = new ArrayList();
                 ValveGBean valveGBean = tomcatValveChain;
                 while(valveGBean != null){
                     ((StandardHost)host).addValve((Valve)valveGBean.getInternalObject());
@@ -74,9 +68,6 @@
             }
         }
         
-        //Add the host to the engine
-        engine.addChild(host);
-        
     }
 
     public Object getInternalObject() {
@@ -84,25 +75,27 @@
     }
 
     public void doFail() {
+        log.info("Falied");
     }
 
     public void doStart() throws Exception {
+        log.info("Started");
     }
 
     public void doStop() throws Exception {
+        log.info("Stopped");
     }
 
     public static final GBeanInfo GBEAN_INFO;
 
     static {
-        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("TomcatHost", HostGBean.class);
+        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("TomcatHost", HostGBean.class, J2EE_TYPE);
         infoFactory.addAttribute("className", String.class, true);
         infoFactory.addAttribute("initParams", Map.class, true);
-        infoFactory.addReference("engineGBean", ObjectRetriever.class, NameFactory.GERONIMO_SERVICE);
         infoFactory.addReference("realmGBean", ObjectRetriever.class, NameFactory.GERONIMO_SERVICE);
         infoFactory.addReference("TomcatValveChain", ValveGBean.class, ValveGBean.J2EE_TYPE);
         infoFactory.addOperation("getInternalObject");
-        infoFactory.setConstructor(new String[] { "className", "initParams", "engineGBean", "realmGBean", "TomcatValveChain" });
+        infoFactory.setConstructor(new String[] { "className", "initParams", "realmGBean", "TomcatValveChain" });
         GBEAN_INFO = infoFactory.getBeanInfo();
     }
 

Modified: geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java?rev=219406&r1=219405&r2=219406&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java (original)
+++ geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatContainer.java Sun Jul 17 15:25:40 2005
@@ -16,6 +16,11 @@
  */
 package org.apache.geronimo.tomcat;
 
+import java.io.File;
+import java.io.FileFilter;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -61,22 +66,10 @@
     private Engine engine;
 
     /**
-     * Tomcat default Context
-     * 
-     * TODO: Make it a gbean
-     */
-    private Context defaultContext;
-
-    /**
      * Geronimo class loader
      **/
     private ClassLoader classLoader;
 
-    /**
-     * Used only to resolve the paths
-     */
-    private ServerInfo serverInfo;
-
     private final Map webServices = new HashMap();
 
     // Required as it's referenced by deployed webapps
@@ -105,7 +98,6 @@
         this.classLoader = classLoader;
         
         this.engine = (Engine)engineGBean.getInternalObject();
-        this.serverInfo = serverInfo;
     }
 
     public void doFail() {
@@ -144,9 +136,10 @@
         embedded.setUseNaming(false);
 
         //Add default contexts
+        TomcatClassLoader tcl = createRootClassLoader(new File(System.getProperty("catalina.home") + "/ROOT"), classLoader);
         Container[] hosts = engine.findChildren();
         for(int i = 0; i < hosts.length; i++){
-            Context defaultContext = embedded.createContext("","", classLoader);
+            Context defaultContext = embedded.createContext("","ROOT", tcl);
             hosts[i].addChild(defaultContext);
         }
         
@@ -256,6 +249,37 @@
         webServices.remove(contextPath);
     }
 
+    private TomcatClassLoader createRootClassLoader(File baseDir, ClassLoader cl) throws Exception{
+        ArrayList urls = new ArrayList();
+        
+        File webInfDir = new File(baseDir, "WEB-INF");
+
+        // check for a classes dir
+        File classesDir = new File(webInfDir, "classes");
+        if (classesDir.isDirectory()) {
+            urls.add(classesDir.toURL());
+        }
+
+        // add all of the libs
+        File libDir = new File(webInfDir, "lib");
+        if (libDir.isDirectory()) {
+            File[] libs = libDir.listFiles(new FileFilter() {
+                public boolean accept(File file) {
+                    return file.isFile() && file.getName().endsWith(".jar");
+                }
+            });
+
+            if (libs != null) {
+                for (int i = 0; i < libs.length; i++) {
+                    File lib = libs[i];
+                    urls.add(lib.toURL());
+                }
+            }
+        } 
+        
+        return new TomcatClassLoader((URL[])urls.toArray(new URL[0]), null, cl, false);
+    }
+    
     public static final GBeanInfo GBEAN_INFO;
 
     static {

Modified: geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatGeronimoEmbedded.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatGeronimoEmbedded.java?rev=219406&r1=219405&r2=219406&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatGeronimoEmbedded.java (original)
+++ geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/TomcatGeronimoEmbedded.java Sun Jul 17 15:25:40 2005
@@ -38,7 +38,9 @@
 
         context.setDocBase(docBase);
         context.setPath(path);
-        context.setParentClassLoader(cl);
+        
+        if (cl != null)
+            context.setParentClassLoader(cl);
         
         ContextConfig config = new ContextConfig();
         config.setCustomAuthenticators(authenticators);

Modified: geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/ValveGBean.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/ValveGBean.java?rev=219406&r1=219405&r2=219406&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/ValveGBean.java (original)
+++ geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/ValveGBean.java Sun Jul 17 15:25:40 2005
@@ -20,22 +20,30 @@
 import java.util.Map;
 
 import org.apache.catalina.Valve;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 
+import sun.tools.tree.ThisExpression;
+
 public class ValveGBean extends BaseGBean implements GBeanLifecycle, ObjectRetriever {
 
+    private static final Log log = LogFactory.getLog(ValveGBean.class);
+
     public static final String J2EE_TYPE = "TomcatValve";
         
     private final Valve valve;
     private final ValveGBean nextValve;
+    private final String className;
  
     
     public ValveGBean(){      
         valve = null;
         nextValve = null;
+        className = null;
     }
     
     public ValveGBean(String className, Map initParams, ValveGBean nextValve) throws Exception{
@@ -55,6 +63,8 @@
             this.nextValve = null;
         }
         
+        this.className = className;
+        
         //Create the Valve object
         valve = (Valve)Class.forName(className).newInstance();
 
@@ -64,12 +74,15 @@
     }
     
     public void doStart() throws Exception {
+        log.info(className + " started.");
     }
 
     public void doStop() throws Exception {
+        log.info(className + " stopped.");
     }
 
     public void doFail() {
+        log.info(className + " failed.");
     }
 
     public Object getInternalObject() {

Modified: geronimo/trunk/modules/tomcat/src/test/org/apache/geronimo/tomcat/AbstractWebModuleTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/test/org/apache/geronimo/tomcat/AbstractWebModuleTest.java?rev=219406&r1=219405&r2=219406&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat/src/test/org/apache/geronimo/tomcat/AbstractWebModuleTest.java (original)
+++ geronimo/trunk/modules/tomcat/src/test/org/apache/geronimo/tomcat/AbstractWebModuleTest.java Sun Jul 17 15:25:40 2005
@@ -303,6 +303,16 @@
             start(realm);
         }
 
+        //Default Host
+        initParams.clear();
+        initParams.put("workDir","work");
+        initParams.put("name","localhost");
+        initParams.put("appBase","");
+        host = new GBeanData(hostName, HostGBean.GBEAN_INFO);
+        host.setAttribute("className", "org.apache.catalina.core.StandardHost");
+        host.setAttribute("initParams", initParams);
+        start(host);
+
         //Default Engine
         initParams.clear();
         initParams.put("name","Geronimo");
@@ -312,19 +322,9 @@
         engine.setAttribute("initParams", initParams);
         if (realmClass != null)
             engine.setReferencePattern("realmGBean", realmName);
+        engine.setReferencePattern("hosts", hostName);
         start(engine);
 
-        //Default Host
-        initParams.clear();
-        initParams.put("workDir","work");
-        initParams.put("name","localhost");
-        initParams.put("appBase","");
-        host = new GBeanData(hostName, HostGBean.GBEAN_INFO);
-        host.setAttribute("className", "org.apache.catalina.core.StandardHost");
-        host.setAttribute("initParams", initParams);
-        host.setReferencePattern("engineGBean", engineName);
-        start(host);
-
         // Need to override the constructor for unit tests
         container = new GBeanData(containerName, TomcatContainer.GBEAN_INFO);
         container.setAttribute("classLoader", cl);
@@ -339,6 +339,7 @@
         connector.setAttribute("initParams", initParams);
         connector.setAttribute("name", "HTTP");
         connector.setReferencePattern("TomcatContainer", containerName);
+        connector.setReferencePattern("ServerInfo", serverInfoName);
 
         start(container);
         start(connector);

Modified: geronimo/trunk/modules/tomcat/src/test/org/apache/geronimo/tomcat/ContainerTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/test/org/apache/geronimo/tomcat/ContainerTest.java?rev=219406&r1=219405&r2=219406&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat/src/test/org/apache/geronimo/tomcat/ContainerTest.java (original)
+++ geronimo/trunk/modules/tomcat/src/test/org/apache/geronimo/tomcat/ContainerTest.java Sun Jul 17 15:25:40 2005
@@ -19,6 +19,7 @@
 
 import java.net.HttpURLConnection;
 import java.net.URL;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
@@ -30,6 +31,9 @@
 
 import junit.framework.TestCase;
 import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.ReferenceCollection;
+import org.apache.geronimo.gbean.ReferenceCollectionEvent;
+import org.apache.geronimo.gbean.ReferenceCollectionListener;
 import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContext;
 import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContextImpl;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
@@ -254,15 +258,6 @@
        
        Map initParams = new HashMap();
 
-       //Default Engine
-       initParams.clear();
-       initParams.put("name","Geronimo");
-       initParams.put("defaultHost","localhost");
-       engine = new GBeanData(engineName, EngineGBean.GBEAN_INFO);
-       engine.setAttribute("className", "org.apache.geronimo.tomcat.TomcatEngine");
-       engine.setAttribute("initParams", initParams);
-       start(engine);
-
        //Default Host
        initParams.clear();
        initParams.put("workDir","work");
@@ -271,9 +266,21 @@
        host = new GBeanData(hostName, HostGBean.GBEAN_INFO);
        host.setAttribute("className", "org.apache.catalina.core.StandardHost");
        host.setAttribute("initParams", initParams);
-       host.setReferencePattern("engineGBean", engineName);
        start(host);       
 
+       //Default Engine
+//       ReferenceCollection hosts = new TestReferenceCollection();
+//       hosts.add(host);
+       
+       initParams.clear();
+       initParams.put("name","Geronimo");
+       initParams.put("defaultHost","localhost");
+       engine = new GBeanData(engineName, EngineGBean.GBEAN_INFO);
+       engine.setAttribute("className", "org.apache.geronimo.tomcat.TomcatEngine");
+       engine.setAttribute("initParams", initParams);
+       engine.setReferencePattern("hosts", hostName);
+       start(engine);
+
        container = new GBeanData(containerName, TomcatContainer.GBEAN_INFO);
        container.setAttribute("classLoader", cl);
        container.setAttribute("catalinaHome", "target/var/catalina");
@@ -286,6 +293,7 @@
        connector = new GBeanData(connectorName, ConnectorGBean.GBEAN_INFO);
        connector.setAttribute("initParams", initParams);
        connector.setReferencePattern("TomcatContainer", containerName);
+       connector.setReferencePattern("ServerInfo", serverInfoName);
        start(connector);       
    }
    
@@ -298,4 +306,33 @@
        kernel.shutdown();
    }
 
+   private static class TestReferenceCollection extends ArrayList implements ReferenceCollection {
+
+       ReferenceCollectionListener referenceCollectionListener;
+
+       public void addReferenceCollectionListener(ReferenceCollectionListener listener) {
+           this.referenceCollectionListener = listener;
+       }
+
+       public void removeReferenceCollectionListener(ReferenceCollectionListener listener) {
+           this.referenceCollectionListener = null;
+       }
+
+       public boolean add(Object o) {
+           boolean result = super.add(o);
+           if (referenceCollectionListener != null) {
+               referenceCollectionListener.memberAdded(new ReferenceCollectionEvent(null, o));
+           }
+           return result;
+       }
+
+       public boolean remove(Object o) {
+           boolean result = super.remove(o);
+           if (referenceCollectionListener != null) {
+               referenceCollectionListener.memberRemoved(new ReferenceCollectionEvent(null, o));
+           }
+           return result;
+       }
+
+   }   
 }

Added: geronimo/trunk/modules/tomcat/src/var/ROOT/WEB-INF/web.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/var/ROOT/WEB-INF/web.xml?rev=219406&view=auto
==============================================================================
--- geronimo/trunk/modules/tomcat/src/var/ROOT/WEB-INF/web.xml (added)
+++ geronimo/trunk/modules/tomcat/src/var/ROOT/WEB-INF/web.xml Sun Jul 17 15:25:40 2005
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+  Copyright 2004 The Apache Software Foundation
+
+  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.
+-->
+
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+    version="2.4">
+
+  <display-name>Welcome to Geronimo</display-name>
+  <description>
+     Welcome to Geronimo
+  </description>
+
+</web-app>

Added: geronimo/trunk/modules/tomcat/src/var/ROOT/geronimo-logo.png
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/var/ROOT/geronimo-logo.png?rev=219406&view=auto
==============================================================================
Binary file - no diff available.

Propchange: geronimo/trunk/modules/tomcat/src/var/ROOT/geronimo-logo.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: geronimo/trunk/modules/tomcat/src/var/ROOT/index.jsp
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/var/ROOT/index.jsp?rev=219406&view=auto
==============================================================================
--- geronimo/trunk/modules/tomcat/src/var/ROOT/index.jsp (added)
+++ geronimo/trunk/modules/tomcat/src/var/ROOT/index.jsp Sun Jul 17 15:25:40 2005
@@ -0,0 +1,132 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<%@ page session="false" %>
+<html>
+    <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+    <title>Apache Geronimo</title>
+    <style type="text/css">
+      <!--
+        body {
+            color: #000000;
+            background-color: #FFFFFF;
+            font-family: Arial, "Times New Roman", Times;
+            font-size: 16px;
+        }
+
+        A:link {
+            color: blue
+        }
+
+        A:visited {
+            color: blue
+        }
+
+        td {
+            color: #000000;
+            font-family: Arial, "Times New Roman", Times;
+            font-size: 16px;
+        }
+
+        .code {
+            color: #000000;
+            font-family: "Courier New", Courier;
+            font-size: 16px;
+        }
+      -->
+    </style>
+</head>
+
+<body>
+
+<!-- Header -->
+<table width="100%">
+    <tr>
+        <td align="left"><a href="http://geronimo.apache.org/"><img src="geronimo-logo.png" border="0" alt="The Geronimo Project"></a></td>
+        <td align="right" valign="top">
+            <table>
+                <tr><td align="left" valign="top"><b><%= application.getServerInfo() %></b></td></tr>
+            </table>
+        </td>
+        <td align="right" width="130"><a href="http://jakarta.apache.org/tomcat/index.html"><img src="tomcat.gif" height="92" width="130" border="0" alt="The Mighty Tomcat - MEOW!"></td>
+    </tr>
+</table>
+
+<br>
+
+<table>
+    <tr>
+
+        <!-- Table of Contents -->
+        <td valign="top">
+            <table width="100%" border="1" cellspacing="0" cellpadding="3" bordercolor="#000000">
+                <tr>
+                    <td bgcolor="#D2A41C" bordercolor="#000000" align="left" nowrap>
+                        <font face="Verdana" size="+1"><i>Documentation</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font>
+                    </td>
+                </tr>
+                <tr>
+                    <td bgcolor="#FFDC75" bordercolor="#000000" nowrap>
+                        <a href="http://geronimo.apache.org/faq.html">FAQ</a><br>
+                        <a href="http://wiki.apache.org/geronimo">Wiki</a><br>
+                        <a href="http://geronimo.apache.org/documentation.html">Geronimo Documentation</a><br>
+                        &nbsp;
+                    </td>
+                </tr>
+            </table>
+            <br>
+            <table width="100%" border="1" cellspacing="0" cellpadding="3" bordercolor="#000000">
+                <tr>
+                    <td bgcolor="#D2A41C" bordercolor="#000000" align="left" nowrap>
+                        <font face="Verdana" size="+1"><i>Geronimo Online</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font>
+                    </td>
+                </tr>
+                <tr>
+                    <td bgcolor="#FFDC75" bordercolor="#000000" nowrap>
+                        <a href="http://geronimo.apache.org/">Home Page</a><br>
+                        <a href="http://nagoya.apache.org/jira/secure/BrowseProject.jspa?id=10220">Bug Database</a><br>
+                        <a href="http://mail-archives.apache.org/mod_mbox/geronimo-user/">Users Mailing List</a><br>
+                        <a href="http://mail-archives.apache.org/mod_mbox/geronimo-dev/">Developers Mailing List</a><br>
+                        <a href="irc://irc.freenode.net/#geronimo">IRC</a><br>
+                        &nbsp;
+                    </td>
+                </tr>
+            </table>
+        </td>
+
+        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
+
+        <!-- Body -->
+        <td align="left" valign="top">
+            <p><center><b>If you're seeing this page via a web browser, it means you've setup Tomcat under Geronimo successfully. Congratulations!</b></center></p>
+
+            <p>As you may have guessed by now, this is the default Tomcat home page for Geronimo. It can be found on the local filesystem at:
+            <blockquote>
+                <p class="code">$GERONIMO_HOME/var/catalina/ROOT/index.jsp</p>
+            </blockquote>
+            </p>
+
+            <p>where "$GERONIMO_HOME" is the root of the Geronimo installation directory. If you're seeing this page, and you don't think you should be, then either you're either a user who has arrived at new installation of Geronimo, or you're an administrator who hasn't got his/her setup quite right. Providing the latter is the case, please refer to the <a href="http://geronimo.apache.org/documentation.html">Geronimo Documentation</a> for more detailed setup and administration information.</p>
+
+            <p>Geronimo mailing lists are available at the Jakarta project web site:</p>
+
+           <ul>
+               <li><b><a href="mailto:user-subscribe@geronimo.apache.org">user@geronimo.apache.org</a></b> for general questions related to configuring and using Geronimo</li>
+               <li><b><a href="mailto:dev-subscribe@geronimo.apache.org">dev@geronimo.apache.org</a></b> for developers working on Geronimo</li>
+           </ul>
+
+            <p>Thanks for using Geronimo!</p>
+
+            <p align="right"><font size=-1><img src="tomcat-power.gif" width="77" height="80"></font><br>
+            &nbsp;
+            <font size=-1>Copyright &copy; 1999-2005 Apache Software Foundation</font><br>
+            <font size=-1>All Rights Reserved</font> <br>
+            &nbsp;</p>
+            <p align="right">&nbsp;</p>
+
+        </td>
+
+    </tr>
+</table>
+
+</body>
+<ohtml>

Added: geronimo/trunk/modules/tomcat/src/var/ROOT/tomcat-power.gif
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/var/ROOT/tomcat-power.gif?rev=219406&view=auto
==============================================================================
Binary file - no diff available.

Propchange: geronimo/trunk/modules/tomcat/src/var/ROOT/tomcat-power.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: geronimo/trunk/modules/tomcat/src/var/ROOT/tomcat.gif
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/var/ROOT/tomcat.gif?rev=219406&view=auto
==============================================================================
Binary file - no diff available.

Propchange: geronimo/trunk/modules/tomcat/src/var/ROOT/tomcat.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream