Index: applications/welcome/project.xml
===================================================================
--- applications/welcome/project.xml	(revision 399866)
+++ applications/welcome/project.xml	(working copy)
@@ -32,6 +32,56 @@
     </description>
 
     <dependencies>
+
+    <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-servlet_2.4_spec</artifactId>
+            <version>${geronimo_spec_servlet_version}</version>
+        </dependency>
+
+     <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+            <version>${commons_logging_version}</version>
+        </dependency>
+
+     <dependency>
+      <groupId>geronimo</groupId>
+      <artifactId>geronimo-kernel</artifactId>
+      <version>${geronimo_version}</version>
+    </dependency>
+
+     <dependency>
+      <groupId>geronimo</groupId>
+      <artifactId>geronimo-naming</artifactId>
+      <version>${geronimo_version}</version>
+    </dependency>
+
+     <dependency>
+      <groupId>geronimo</groupId>
+      <artifactId>geronimo-management</artifactId>
+      <version>${geronimo_version}</version>
+    </dependency>
+
+     <dependency>
+      <groupId>geronimo</groupId>
+      <artifactId>geronimo-system</artifactId>
+      <version>${geronimo_version}</version>
+    </dependency>
+
+     <dependency>
+         <groupId>mx4j</groupId>
+         <artifactId>mx4j</artifactId>
+         <version>${mx4j_version}</version>
+     </dependency>
+
+        <dependency>
+            <groupId>mx4j</groupId>
+            <artifactId>mx4j-remote</artifactId>
+            <version>${mx4j_version}</version>
+        </dependency>
+
+
         <!-- todo these are here purely to force the deployer to be built - work out how to remove them --> 
 <!--
         <dependency>
@@ -48,4 +98,5 @@
         </dependency>
 -->
     </dependencies>
+
 </project>
Index: applications/welcome/src/java/org/apache/geronimo/welcome/InstallSamplesServlet.java
===================================================================
--- applications/welcome/src/java/org/apache/geronimo/welcome/InstallSamplesServlet.java	(revision 0)
+++ applications/welcome/src/java/org/apache/geronimo/welcome/InstallSamplesServlet.java	(revision 0)
@@ -0,0 +1,325 @@
+/**
+ *
+ * Copyright 2005 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.
+ */
+package org.apache.geronimo.welcome;
+
+
+import java.io.File;
+import java.io.InputStream;
+import java.io.FileOutputStream;
+import java.io.ObjectOutputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.URL;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Properties;
+import java.util.Set;
+import java.util.StringTokenizer;
+import javax.naming.InitialContext;
+import javax.security.auth.login.FailedLoginException;
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.kernel.GBeanNotFoundException;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.KernelRegistry;
+import org.apache.geronimo.kernel.config.Configuration;
+import org.apache.geronimo.kernel.config.ConfigurationInfo;
+import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.ConfigurationModuleType;
+import org.apache.geronimo.kernel.config.ConfigurationStore;
+import org.apache.geronimo.kernel.config.ConfigurationUtil;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.management.geronimo.J2EEApplication;
+import org.apache.geronimo.management.geronimo.J2EEDomain;
+import org.apache.geronimo.management.geronimo.J2EEServer;
+import org.apache.geronimo.management.geronimo.WebModule;
+import org.apache.geronimo.system.plugin.PluginList;
+import org.apache.geronimo.system.plugin.PluginInstaller;
+import org.apache.geronimo.system.plugin.DownloadResults;
+
+/**
+ * Servlet that redirects to a sample app if it exists
+ * or gives the option of downloading the app as a plugin.
+ *
+ */
+public class InstallSamplesServlet extends HttpServlet {
+    private final static Log log = LogFactory.getLog(InstallSamplesServlet.class);
+
+    private Kernel kernel = null;
+    private RequestDispatcher rd = null;
+    private ConfigurationManager configurationManager = null;
+    private PluginInstaller pluginInstaller = null;
+    private String moduleType = "war";
+    private String hostname = "localhost";
+    private final String msg = "MESSAGE";
+    private String EXCEPTION_MSG = null;
+    private String repository;
+    private String[] configIds ;
+    private Properties props;
+
+
+    /**
+     * Initialize the Kernel and ConfigurationManager
+     *
+     **/
+    public void init(ServletConfig config) {
+        try {
+            super.init(config);
+            kernel = (Kernel) new InitialContext().lookup("java:comp/GeronimoKernel");
+        }
+        catch (Exception e) {
+            kernel = KernelRegistry.getSingleKernel();
+        }
+
+        if (kernel != null) {
+            configurationManager =  ConfigurationUtil.getConfigurationManager(kernel);
+            Set domainNames = kernel.listGBeans(new AbstractNameQuery(J2EEDomain.class.getName()));
+            AbstractName domainName = (AbstractName) domainNames.iterator().next();
+            J2EEDomain domain = (J2EEDomain) kernel.getProxyManager().createProxy(domainName, J2EEDomain.class);
+            J2EEServer server = domain.getServerInstances()[0];
+            pluginInstaller = server.getPluginInstaller(); 
+        }
+        else {
+            EXCEPTION_MSG = "Couldn't find Kernel";
+        }
+
+        try {
+            props = new Properties();
+            InputStream is = getClass().getResourceAsStream("welcome.properties");
+            props.load(is);
+            repository = props.getProperty("welcome.plugin.repository");
+
+            boolean jetty = config.getServletContext().getServerInfo().toLowerCase().indexOf("jetty") > -1;
+            String container = "tomcat";
+            if (jetty)
+                container = "jetty";
+            String configs = props.getProperty("welcome.examples." + container);
+            StringTokenizer str = new StringTokenizer(configs, ",");
+            configIds = new String[str.countTokens()];
+            for (int i =0; str.hasMoreTokens(); configIds[i++] = str.nextToken().trim());
+        }
+        catch (Exception e) {
+            EXCEPTION_MSG = e.toString();
+        }
+
+        rd = config.getServletContext().getRequestDispatcher("/handleMessage.jsp");
+    }
+
+    public void debug(String str) {
+        System.out.println(str);
+    }
+
+    /**
+     * read request parameter "sampleConfigId"
+     * if sample not installed, prompt to go to plugin page
+     * if installed but not running, prompt to start the app
+     * if running, serve the app
+     **/
+    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+        HttpSession session = request.getSession();
+        hostname = request.getLocalName();
+        String configId = request.getParameter("sampleConfigId");
+
+        String START_MSG = "This example has previously been installed but it is currently stopped. If you could like to start it by using the admin console, click <a href=\"http://" + hostname + ":8080/console/portal/apps/apps_" + moduleType + "\">here</a>";
+
+        if (EXCEPTION_MSG == null) {
+            if (configId == null || configId.trim().equals("")) {
+                for (int i=0; i< configIds.length; i++) {
+                    configId = configIds[i];
+                    Artifact artifact = Artifact.create(configId);
+                    try {
+                        installSample(repository, artifact, session);
+                    }
+                    catch (Exception e) {
+                        EXCEPTION_MSG = e.toString();
+                    }
+                }
+                if (EXCEPTION_MSG == null) {
+                    props.setProperty("welcome.examples.installed", "true");
+                    FileOutputStream fos = new FileOutputStream(getServletContext().getRealPath("/") + "/props.ser");
+                    ObjectOutputStream oos = new ObjectOutputStream(fos);
+                    oos.writeObject(props);
+                    response.sendRedirect("http://" + hostname + ":8080/");
+                    return;
+                }
+            }
+            else {
+                if (configurationManager != null) {
+                    Artifact artifact = Artifact.create(configId);
+                    if (configurationManager.isInstalled(artifact)) {
+                        String moduleType = getModuleType(artifact);
+
+                        if (configurationManager.isRunning(artifact)) {
+                            // app installed and running. Serve the app.
+                            String contextPath = getContextPath(artifact);
+                            if (contextPath != null) {
+                                response.sendRedirect(contextPath);
+                                return;
+                            }
+                        }
+                        else {
+                            // app installed but stopped. Prompt to start.
+                            request.setAttribute(msg, START_MSG);
+                            rd.forward(request, response);
+                            return;
+                        }
+                    }
+                    else {
+                        // app not installed. Prompt to install.
+                        //request.setAttribute(msg, PLUGIN_MSG);
+                        try {
+                            installSample(repository, artifact, session);
+                            String contextPath = getContextPath(artifact);
+                            response.sendRedirect(contextPath);
+                            return;
+                        }
+                        catch (Exception e) {
+                            EXCEPTION_MSG = e.toString();
+                        }
+                    }
+                }
+            }
+        }
+
+        request.setAttribute(msg, EXCEPTION_MSG);
+        rd.forward(request, response);
+    }
+
+
+
+
+    /**
+     * get ContextPath for a running configuration
+     **/
+    private String getContextPath(Artifact artifact) {
+        Configuration config = configurationManager.getConfiguration(artifact);
+        ConfigurationModuleType type = config.getModuleType();
+        AbstractName result;
+        WebModule webModule;
+        try {
+            if (type.equals(ConfigurationModuleType.WAR)) {
+                result = config.findGBean(new AbstractNameQuery(WebModule.class.getName()));
+                webModule = (WebModule) kernel.getProxyManager().createProxy(result, getClass().getClassLoader());
+            }
+            else if (type.equals(ConfigurationModuleType.EAR)) {
+                result = config.findGBean(new AbstractNameQuery(J2EEApplication.class.getName()));
+                J2EEApplication application = (J2EEApplication) kernel.getProxyManager().createProxy(result, getClass().getClassLoader());
+                webModule = application.getWebModules()[0];
+            }
+            else {
+                EXCEPTION_MSG = "Unknown module type";
+                return null;
+            }
+            return webModule.getContextPath();
+        }
+        catch (GBeanNotFoundException e) {
+            EXCEPTION_MSG = "Bad config ID: " + e.getMessage();
+            return null;
+        }
+    }
+
+
+    /**
+     * get the module type.
+     * This method is needed because the above method works only on a running configuration
+     **/
+    private String getModuleType(Artifact artifact) {
+        String type = "war";
+        ConfigurationStore configStore = configurationManager.getStoreForConfiguration(artifact);
+        List list = configStore.listConfigurations();
+        for (ListIterator iterator = list.listIterator(); iterator.hasNext();) {
+            ConfigurationInfo configurationInfo = (ConfigurationInfo) iterator.next();
+            if (configurationInfo.getConfigID().equals(artifact)) {
+                ConfigurationModuleType moduleType = configurationInfo.getType();
+                if (moduleType.equals(ConfigurationModuleType.EAR))
+                    type = "ear";
+            }
+        }
+        return type;
+    }
+
+
+    private void installSample(String repository, Artifact artifact, HttpSession session) throws Exception {
+        if (configurationManager.isInstalled(artifact))
+            return;
+
+        PluginList installList;
+        try {
+            PluginList list = pluginInstaller.listPlugins(new URL(repository), null, null);
+            installList = PluginList.createInstallList(list, artifact);
+        }
+        catch (FailedLoginException e) {
+            throw new Exception("Invalid login for Maven repository '"+repository+"'", e);
+        }
+        if (installList == null) {
+            throw new Exception("No configuration found for '"+artifact.toString()+"'");
+        }
+        Object downloadKey = pluginInstaller.startInstall(installList, null, null);
+        Thread t = new Thread(new Installer(pluginInstaller, downloadKey, session));
+        t.start();
+        t.join();
+
+        configurationManager.loadConfiguration(artifact);
+        configurationManager.startConfiguration(artifact);
+    }
+
+    public static class Installer implements Runnable {
+        private PluginInstaller pluginInstaller;
+        private Object downloadKey;
+        private HttpSession session;
+
+        public Installer(PluginInstaller pluginInstaller, Object downloadKey, HttpSession session) {
+            this.pluginInstaller = pluginInstaller;
+            this.downloadKey = downloadKey;
+            this.session = session;
+        }
+
+        public void run() {
+            DownloadResults results;
+            while (true) {
+                results = pluginInstaller.checkOnInstall(downloadKey);
+                System.out.println(results.getCurrentMessage());
+                if (results.isFinished()) {
+                    log.info("Installation finished");
+                    System.out.println("Installation finished");
+                    session.setAttribute("DOWNLOAD_RESULTS_SESSION_KEY", results);
+                    break;
+                }
+                else {
+                    try {
+                        Thread.sleep(1000);
+                    }
+                    catch (InterruptedException e) {
+                        log.error("Download monitor thread interrupted", e);
+                    }
+                }
+            }
+        }
+    }
+}
Index: applications/welcome/src/java/org/apache/geronimo/welcome/ServeSamplesServlet.java
===================================================================
--- applications/welcome/src/java/org/apache/geronimo/welcome/ServeSamplesServlet.java	(revision 0)
+++ applications/welcome/src/java/org/apache/geronimo/welcome/ServeSamplesServlet.java	(revision 0)
@@ -0,0 +1,198 @@
+/**
+ *
+ * Copyright 2005 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.
+ */
+package org.apache.geronimo.welcome;
+
+
+import java.io.IOException;
+import java.util.List;
+import java.util.ListIterator;
+import javax.naming.InitialContext;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.kernel.GBeanNotFoundException;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.KernelRegistry;
+import org.apache.geronimo.kernel.config.Configuration;
+import org.apache.geronimo.kernel.config.ConfigurationInfo;
+import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.ConfigurationModuleType;
+import org.apache.geronimo.kernel.config.ConfigurationStore;
+import org.apache.geronimo.kernel.config.ConfigurationUtil;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.management.geronimo.J2EEApplication;
+import org.apache.geronimo.management.geronimo.WebModule;
+
+/**
+ * Servlet that redirects to a sample app if it exists
+ * or gives the option of downloading the app as a plugin.
+ *
+ */
+public class ServeSamplesServlet extends HttpServlet {
+    private final static Log log = LogFactory.getLog(ServeSamplesServlet.class);
+
+    private Kernel kernel = null;
+    private RequestDispatcher rd = null;
+    private ConfigurationManager configurationManager = null;
+    private String moduleType = "war";
+    private String hostname = "localhost";
+    private final String msg = "MESSAGE";
+    private String EXCEPTION_MSG;
+
+
+    /**
+     * Initialize the Kernel and ConfigurationManager
+     *
+     **/
+    public void init(ServletConfig config) {
+        try {
+            super.init(config);
+            kernel = (Kernel) new InitialContext().lookup("java:comp/GeronimoKernel");
+        }
+        catch (Exception e) {
+            EXCEPTION_MSG = e.toString();
+            kernel = KernelRegistry.getSingleKernel();
+        }
+
+        if (kernel != null) {
+            configurationManager =  ConfigurationUtil.getConfigurationManager(kernel);
+        }
+
+
+        rd = config.getServletContext().getRequestDispatcher("/handleMessage.jsp");
+    }
+
+    public void debug(String str) {
+        System.out.println(str);
+    }
+
+    /**
+     * read request parameter "sampleConfigId"
+     * if sample not installed, go to a servlet that silently installs it.
+     * if installed but not running, prompt to start the app
+     * if running, serve the app
+     **/
+    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+        hostname = request.getLocalName();
+        String configId = request.getParameter("sampleConfigId");
+
+        String ERROR_MSG = "Parameter <code>sampleConfigId</code> is missing";
+        String START_MSG = "This example has previously been installed but it is currently stopped. If you could like to start it by using the admin console, click <a href=\"http://" + hostname + ":8080/console/portal/apps/apps_" + moduleType + "\">here</a>";
+        String PLUGIN_MSG = "This example is not currently installed. Click <a href=\"http://" + hostname + ":8080/console/portal/apps/apps_import\">here</a> to install it using the admin console. <br> (NOTE: The admin console requires you to logon. The default userid is <code>system</code> and the default password is <code>manager</code>)";
+        String BACK_MSG = "Click <a href=\"http://" + hostname + ":8080/\">here</a> to go back";
+
+
+        if (configId != null && !configId.trim().equals("")) {
+
+            if (configurationManager != null) {
+                Artifact artifact = Artifact.create(configId);
+                if (configurationManager.isInstalled(artifact)) {
+                    String moduleType = getModuleType(artifact);
+
+                    if (configurationManager.isRunning(artifact)) {
+                        // app installed and running. Serve the app.
+                        String contextPath = getContextPath(artifact);
+                        response.sendRedirect(contextPath);
+                        return;
+                    }
+                    else {
+                        // app installed but stopped. Prompt to start.
+                        request.setAttribute(msg, START_MSG);
+                    }
+                }
+                else {
+                    // app not installed
+                    //request.setAttribute(msg, PLUGIN_MSG);
+                    response.sendRedirect("http://" + hostname + ":8080/installSamples?sampleConfigId=" + configId);
+                    return;
+                }
+            }
+            else {
+                request.setAttribute(msg, EXCEPTION_MSG);
+            }
+        }
+        else {
+            request.setAttribute(msg, ERROR_MSG);
+        }
+
+        rd.forward(request, response);
+    }
+
+
+
+
+    /**
+     * get ContextPath for a running configuration
+     **/
+    private String getContextPath(Artifact artifact) {
+        Configuration config = configurationManager.getConfiguration(artifact);
+        ConfigurationModuleType type = config.getModuleType();
+        AbstractName result;
+        WebModule webModule;
+        try {
+            if (type.equals(ConfigurationModuleType.WAR)) {
+                result = config.findGBean(new AbstractNameQuery(WebModule.class.getName()));
+                webModule = (WebModule) kernel.getProxyManager().createProxy(result, getClass().getClassLoader());
+            }
+            else if (type.equals(ConfigurationModuleType.EAR)) {
+                result = config.findGBean(new AbstractNameQuery(J2EEApplication.class.getName()));
+                J2EEApplication application = (J2EEApplication) kernel.getProxyManager().createProxy(result, getClass().getClassLoader());
+                webModule = application.getWebModules()[0];
+            }
+            else {
+                return null;
+            }
+            return webModule.getContextPath();
+        }
+        catch (GBeanNotFoundException e) {
+            EXCEPTION_MSG = "Bad config ID: " + e.getMessage();
+            return null;
+        }
+    }
+
+
+    /**
+     * get the module type.
+     * This method is needed because the above method works only on a running configuration
+     **/
+    private String getModuleType(Artifact artifact) {
+        String type = "war";
+        ConfigurationStore configStore = configurationManager.getStoreForConfiguration(artifact);
+        List list = configStore.listConfigurations();
+        for (ListIterator iterator = list.listIterator(); iterator.hasNext();) {
+            ConfigurationInfo configurationInfo = (ConfigurationInfo) iterator.next();
+            if (configurationInfo.getConfigID().equals(artifact)) {
+                ConfigurationModuleType moduleType = configurationInfo.getType();
+                if (moduleType.equals(ConfigurationModuleType.EAR))
+                    type = "ear";
+            }
+        }
+        return type;
+    }
+
+}
+
Index: applications/welcome/src/resources/org/apache/geronimo/welcome/welcome.properties
===================================================================
--- applications/welcome/src/resources/org/apache/geronimo/welcome/welcome.properties	(revision 0)
+++ applications/welcome/src/resources/org/apache/geronimo/welcome/welcome.properties	(revision 0)
@@ -0,0 +1,6 @@
+#default repository to install plugins (examples) from.
+welcome.plugin.repository=http://www.geronimoplugins.com/repository/geronimo-1.1
+
+# list of examples to install separated by a , (comma)
+welcome.examples.jetty=geronimo/jsp-examples-jetty/1.1-SNAPSHOT/car, geronimo/servlets-examples-jetty/1.1-SNAPSHOT/car
+welcome.examples.tomcat=geronimo/jsp-examples-tomcat/1.1-SNAPSHOT/car, geronimo/servlets-examples-tomcat/1.1-SNAPSHOT/car
Index: applications/welcome/src/webapp/handleMessage.jsp
===================================================================
--- applications/welcome/src/webapp/handleMessage.jsp	(revision 0)
+++ applications/welcome/src/webapp/handleMessage.jsp	(revision 0)
@@ -0,0 +1,56 @@
+<%--
+    Copyright 2005 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.
+--%>
+<!-- $Rev: 357437 $ $Date: 2005-12-18 00:23:31 -0500 (Sun, 18 Dec 2005) $ -->
+<!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>
+    <link rel="stylesheet" href="main.css" type="text/css"/>
+</head>
+
+<body>
+
+<!-- Header -->
+<table width="100%">
+  <tr>
+    <td>
+      <table width="100%" height="86"  border="0" cellpadding="0" cellspacing="0">
+        <tr>
+          <td height="86" class="GeronimoLogo" border="0"></td>
+          <td height="86" class="Top"  border="0">&nbsp;</TD>
+        </tr>
+        <tr>
+          <td algin="right" border="0">&nbsp;</td>
+          <td algin="right" border="0">&nbsp;</td>
+        </tr>
+      </table>
+    </td>
+  </tr>
+</table>
+
+<br />
+
+<BR>
+<BR>
+<BR>
+
+<p> <%= request.getAttribute("MESSAGE") %> </p>
+
+
+</body>
+</html>
Index: applications/welcome/src/webapp/images/head_about_51x86.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: applications\welcome\src\webapp\images\head_about_51x86.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Index: applications/welcome/src/webapp/images/head_left_login_586x86.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: applications\welcome\src\webapp\images\head_left_login_586x86.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Index: applications/welcome/src/webapp/images/login_lock_64x55.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: applications\welcome\src\webapp\images\login_lock_64x55.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Index: applications/welcome/src/webapp/images/logo_head_570x86.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: applications\welcome\src\webapp\images\logo_head_570x86.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Index: applications/welcome/src/webapp/index.jsp
===================================================================
--- applications/welcome/src/webapp/index.jsp	(revision 399866)
+++ applications/welcome/src/webapp/index.jsp	(working copy)
@@ -16,6 +16,8 @@
 <!-- $Rev$ $Date$ -->
 <!doctype html public "-//w3c//dtd html 4.0 transitional//en" "http://www.w3.org/TR/REC-html40/strict.dtd">
 <%@ page session="false" %>
+<%@ page import="java.io.File" %>
+
 <html>
     <head>
     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
@@ -25,6 +27,8 @@
 
 <body>
 
+<% boolean jetty = application.getServerInfo().toLowerCase().indexOf("jetty") > -1; %>
+
 <!-- Header -->
 <table width="100%">
   <tr>
@@ -92,14 +96,30 @@
                         <font face="Verdana" size="+1">Geronimo Examples&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font>
                     </td>
                 </tr>
-                <tr>
+                <% File foo = new File(application.getRealPath("/") + "/props.ser");
+                   if (foo.exists()) { 
+                    %>
+               <tr>
                     <td bgcolor="#FFFFFF" bordercolor="#000000" nowrap>
-                        <a href="/servlets-examples/">Servlet Examples </a><br />
-                        <a href="/jsp-examples/">JSP Examples </a><br />
-                        <a href="/ldap-demo/">LDAP Demo</a><br />
+                    <% if(jetty) { %>
+                        <a href="/serveSamples?sampleConfigId=geronimo/servlets-examples-jetty/1.1-SNAPSHOT/car">Servlet Examples </a><br />
+                        <a href="/serveSamples?sampleConfigId=geronimo/jsp-examples-jetty/1.1-SNAPSHOT/car">JSP Examples </a><br />
+                        <a href="/serveSamples?sampleConfigId=geronimo/ldap-demo-jetty/1.1-SNAPSHOT/car">LDAP Demo</a><br />
+                    <% } else { %>
+                        <a href="/serveSamples?sampleConfigId=geronimo/servlets-examples-tomcat/1.1-SNAPSHOT/car">Servlet Examples </a><br />
+                        <a href="/serveSamples?sampleConfigId=geronimo/jsp-examples-tomcat/1.1-SNAPSHOT/car">JSP Examples </a><br />
+                        <a href="/serveSamples?sampleConfigId=geronimo/ldap-demo-tomcat/1.1-SNAPSHOT/car">LDAP Demo</a><br />
+                    <% } %>
                         <a href="http://geronimo.apache.org/redirects/additionalSamples.html">Additional Samples</a><br />
                     </td>
+                </tr> 
+                <% } else { %>
+                <tr>
+                    <td bgcolor="#FFFFFF" bordercolor="#000000" nowrap>
+                    To install examples, click <A HREF="/installSamples">here</A>. <BR>This requires internet connectivity.
+                    </td>
                 </tr>
+                <% } %>
             </table>
         </td>
 
@@ -111,7 +131,7 @@
             Apache Geronimo&#8482; successfully. Congratulations!</b></center></p>
 
             <p>As you may have guessed by now, this is the default home page for Geronimo. 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
+                and you don't think you should be, then 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.  If you need help
                 setting up or administering Geronimo, see the
                 <a href="http://geronimo.apache.org/documentation.html">Geronimo Documentation</a>.</p>
@@ -138,7 +158,6 @@
     &lt;context-priority-classloader&gt;false&lt;/context-priority-classloader&gt;
 &lt;/web-app&gt;</pre>
                 <p>Then you can stop this application and deploy yours from the <a href="/console">Admin Console</a> or from the command line with a sequence of commands like this:</p>
-                <% boolean jetty = application.getServerInfo().toLowerCase().indexOf("jetty") > -1; %>
 <pre>java -jar bin/deployer.jar stop geronimo/welcome-<% if(jetty) {%>jetty<%} else {%>tomcat<%}%>/1.0/car
 java -jar bin/deployer.jar deploy MyWebApp.war</pre>
             </div>
Index: applications/welcome/src/webapp/login.jsp
===================================================================
--- applications/welcome/src/webapp/login.jsp	(revision 0)
+++ applications/welcome/src/webapp/login.jsp	(revision 0)
@@ -0,0 +1,115 @@
+<html>
+<head>
+<title>Geronimo Console Login</title>
+<link href="<%=request.getContextPath()%>/main.css" rel="stylesheet" type="text/css">
+<link rel="SHORTCUT ICON" href="<%=request.getContextPath()%>/favicon.ico" type="image/x-icon"/>
+</head>
+
+<% String configId = request.getParameter("sampleConfigId"); %>
+<body onload="document.login.j_username.focus()" leftmargin="0" topmargin="0" rightmargin="0">
+
+<form name="login" action="j_security_check" method="GET">
+<input name="sampleConfigId" type="hidden" value="<%=configId%>" />
+
+  <%--  Top table is the banner --%>
+      <TABLE width="100%" HEIGHT="86" BORDER="0" CELLSPACING="0" CELLPADDING="0">
+        <TR>
+          <td height="86" class="LoginLogo" border="0"></td>
+          <td height="86" class="Top" border="0">&nbsp; </TD>
+          <td height="86" class="Top" border="0" width="40">
+<a href="<%=request.getContextPath()%>/console/about.jsp"><img border="0" src="<%=request.getContextPath()%>/images/head_about_51x86.gif"></a>
+          </td>
+        </TR>
+        <TR>
+          <td>&nbsp;</td>
+          <td>&nbsp;</td>
+        </TR>
+        <TR>
+          <td>&nbsp;</td>
+          <td>&nbsp;</td>
+        </TR>
+      </TABLE>
+
+  <%--  Main body --%>
+  <table WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
+    <TR CLASS="Content">
+      <td width="30%" >&nbsp;</td>
+
+      <td class="Body" align="CENTER" height="300" valign="top">
+      <TABLE border>
+      <TR>
+      <TD>
+      <table width="550" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td class="ReallyDarkBackground"><strong>&nbsp;Log in to the Geronimo Console</td>
+        </tr>
+        <tr>
+          <td class="MediumBackground">&nbsp;</td>
+        </tr>
+        <tr>
+          <td>
+          <table width="100%"  border="0" cellspacing="0" cellpadding="0">
+              <tr>
+                <td width="25%" class="MediumBackground">&nbsp;</td> 
+                <td align="right" class="MediumBackground">&nbsp;</td>
+                <td width="6" class="MediumBackground">&nbsp;</td>
+                <td width="1" class="MediumBackground">&nbsp;</td>
+                <td class="MediumBackground">&nbsp;</td>
+                <td width="25%" class="MediumBackground">&nbsp;</td>
+              </tr>
+              <tr>
+                <td class="MediumBackground" ROWSPAN=3 ALIGN="center" ><img border="0" align="center" src="<%=request.getContextPath()%>/images/login_lock_64x55.gif"></td> 
+                <td align="right" class="MediumBackground"><strong>Username</strong></td>
+                <td class="MediumBackground"><strong>:</strong></td>
+                <td width="1" class="MediumBackground">&nbsp;</td>
+                <td class="MediumBackground"><input name="j_username" type="text" class="InputField" value="" size="20px" maxlength="25"/></td>
+                <td width="17" class="MediumBackground">&nbsp;</td>
+              </tr>
+              <tr>
+                <td align="right" class="MediumBackground"><strong>Password</strong></td>
+                <td class="MediumBackground"><strong>:</strong></td>
+                <td width="1" class="MediumBackground">&nbsp;</td>
+                <td class="MediumBackground"><input name="j_password" type="password" class="InputField" value="" size="20px" maxlength="25"/></td>
+                <td class="MediumBackground">&nbsp;</td>
+              </tr>
+              <tr>
+                <td class="MediumBackground">&nbsp;</td>
+                <td class="MediumBackground">&nbsp;</td>
+                <td class="MediumBackground">&nbsp;</td>
+                <td class="MediumBackground">&nbsp;</td>
+                <td class="MediumBackground">&nbsp;</td>
+              </tr>
+              <tr>
+                <td class="MediumBackground">&nbsp;</td>
+                <td colspan="4" align="center" class="MediumBackground"><input name="submit" type="submit" value="Login"/></td>
+                <td class="MediumBackground">&nbsp;</td>
+              </tr>
+              <tr>
+                <td class="MediumBackground">&nbsp;</td>
+                <td class="MediumBackground">&nbsp;</td>
+                <td class="MediumBackground">&nbsp;</td>
+                <td class="MediumBackground">&nbsp;</td>
+                <td class="MediumBackground">&nbsp;</td>
+                <td class="MediumBackground">&nbsp;</td>
+              </tr>
+          </table>
+          </td>
+        </tr>
+
+        <tr>
+          <td>This example is not currently installed. Please login to install it.  
+          <br>  The default userid is <code>system</code> and the default password is <code>manager</code>
+          </td>
+        </TR>
+      </table>
+      </TD>
+      </TR>
+      </TABLE>
+      </td>
+
+      <td width="30%" >&nbsp;</td>
+    </tr>
+  </table>
+</form>
+</body>
+</html>
Index: applications/welcome/src/webapp/login_success.jsp
===================================================================
--- applications/welcome/src/webapp/login_success.jsp	(revision 0)
+++ applications/welcome/src/webapp/login_success.jsp	(revision 0)
@@ -0,0 +1,6 @@
+<HTML>
+<HEAD><TITLE>Login Successful</TITLE></HEAD>
+<BODY>
+Login Successfull. <a href="<%=request.getContextPath()%>/portal/test"> Click here to return to the portal tests.</A>
+</BODY>
+</HTML>
\ No newline at end of file
Index: applications/welcome/src/webapp/loginerror.jsp
===================================================================
--- applications/welcome/src/webapp/loginerror.jsp	(revision 0)
+++ applications/welcome/src/webapp/loginerror.jsp	(revision 0)
@@ -0,0 +1,141 @@
+<html>
+<head>
+<title>Geronimo Console Login</title>
+<link href="<%=request.getContextPath()%>/main.css" rel="stylesheet" type="text/css">
+<link rel="SHORTCUT ICON" href="<%=request.getContextPath()%>/favicon.ico" type="image/x-icon"/>
+</head>
+
+<body onload="document.login.j_username.focus()" leftmargin="0" topmargin="0" rightmargin="0">
+
+<form name="login" action="j_security_check" method="POST">
+  <%--  Top table is the banner --%>
+      <TABLE width="100%" HEIGHT="86" BORDER="0" CELLSPACING="0" CELLPADDING="0">
+        <TR>
+          <td height="86" class="LoginLogo" border="0"></td>
+          <td height="86" class="Top" border="0">&nbsp; </TD>
+          <td height="86" class="Top" border="0" width="40">
+<a href="<%=request.getContextPath()%>/about.jsp"><img border="0" src="<%=request.getContextPath()%>/images/head_about_51x86.gif"></a>
+          </td>
+        </TR>
+        <TR>
+          <td>&nbsp;</td>
+          <td>&nbsp;</td>
+        </TR>
+        <TR>
+          <td>&nbsp;</td>
+          <td>&nbsp;</td>
+        </TR>
+      </TABLE>
+
+  <%--  Main body --%>
+  <table WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
+    <TR CLASS="Content">
+      <td width="30%" >&nbsp;</td>
+
+      <td class="Body" align="CENTER" height="300" valign="top">
+      <TABLE border>
+      <TR>
+      <TD>
+      <table width="550" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td class="ReallyDarkBackground"><strong>&nbsp;Log In to the Geronimo Console</td>
+        </tr>
+        <tr>
+          <td class="MediumBackground" align="center"><font color="red"><b><i>Invalid Username and/or Password!</i></b></font></td>
+        </tr>
+        <tr>
+          <td>
+          <table width="100%"  border="0" cellspacing="0" cellpadding="0">
+              <tr>
+                <td width="25%" class="MediumBackground">&nbsp;</td> 
+                <td align="right" class="MediumBackground">&nbsp;</td>
+                <td width="6" class="MediumBackground">&nbsp;</td>
+                <td width="1" class="MediumBackground">&nbsp;</td>
+                <td class="MediumBackground">&nbsp;</td>
+                <td width="25%" class="MediumBackground">&nbsp;</td>
+              </tr>
+              <tr>
+                <td class="MediumBackground" ROWSPAN=3 ALIGN="center" ><img border="0" align="center" src="<%=request.getContextPath()%>/images/login_lock_64x55.gif"></td> 
+                <td align="right" class="MediumBackground"><strong>Username</strong></td>
+                <td class="MediumBackground"><strong>:</strong></td>
+                <td width="1" class="MediumBackground">&nbsp;</td>
+                <td class="MediumBackground"><input name="j_username" type="text" class="InputField" value="" size="20px" maxlength="25"/></td>
+                <td width="17" class="MediumBackground">&nbsp;</td>
+              </tr>
+              <tr>
+                <td align="right" class="MediumBackground"><strong>Password</strong></td>
+                <td class="MediumBackground"><strong>:</strong></td>
+                <td width="1" class="MediumBackground">&nbsp;</td>
+                <td class="MediumBackground"><input name="j_password" type="password" class="InputField" value="" size="20px" maxlength="25"/></td>
+                <td class="MediumBackground">&nbsp;</td>
+              </tr>
+              <tr>
+                <td class="MediumBackground">&nbsp;</td>
+                <td class="MediumBackground">&nbsp;</td>
+                <td class="MediumBackground">&nbsp;</td>
+                <td class="MediumBackground">&nbsp;</td>
+                <td class="MediumBackground">&nbsp;</td>
+              </tr>
+              <tr>
+                <td class="MediumBackground">&nbsp;</td>
+                <td colspan="4" align="center" class="MediumBackground"><input name="submit" type="submit" value="Login"/></td>
+                <td class="MediumBackground">&nbsp;</td>
+              </tr>
+              <tr>
+                <td class="MediumBackground">&nbsp;</td>
+                <td class="MediumBackground">&nbsp;</td>
+                <td class="MediumBackground">&nbsp;</td>
+                <td class="MediumBackground">&nbsp;</td>
+                <td class="MediumBackground">&nbsp;</td>
+                <td class="MediumBackground">&nbsp;</td>
+              </tr>
+          </table>
+          </td>
+        </tr>
+
+        <tr>
+          <td><font size="1"><STRONG>Welcome to the Geronimo&#8482; Console</FONT></td>
+        </TR>
+        <tr>
+          <TD>
+          <table width="100%"  border="0" cellspacing="1" cellpadding="5">
+            <tr>
+              <td width="5">&nbsp;</td>
+              <td> <strong>GERONIMO&#8482;</strong> is a Java-certified, production-grade platform designed to allow developers to rapidly deploy and manage their applications. The result is an integrated, highly functional application platform that leverages the latest innovations from the open source community and simplifies application deployment and maintenance. </td>
+              <td width="5">&nbsp;</td>
+            </tr>
+
+            <tr>
+              <td>&nbsp;</td>
+              <td>&nbsp;</td>
+              <td>&nbsp;</td>
+            </tr>
+
+            <tr>
+              <td>&nbsp;</td>
+              <td> <strong>Geronimo&#8482;</strong> has integrated the following components:<BR/>
+                &nbsp;&nbsp;&#149;&nbsp; Application server (Apache Geronimo)<br/>
+                &nbsp;&nbsp;&#149;&nbsp; Web server and servlet engine (Tomcat)<br/>
+                &nbsp;&nbsp;&#149;&nbsp; Web server and servlet engine (Jetty)<br/>
+                &nbsp;&nbsp;&#149;&nbsp; JSP compiler (Jasper)<br/>
+                &nbsp;&nbsp;&#149;&nbsp; Relational database (Apache Derby)<br/>
+                &nbsp;&nbsp;&#149;&nbsp; Messaging (ActiveMQ)<br/>
+                &nbsp;&nbsp;&#149;&nbsp; User management services<br/>
+                &nbsp;&nbsp;&#149;&nbsp; Centralized administration console<br/>
+              <td>&nbsp;</td>
+            </tr>
+          </table>
+          </TD>
+        </TR>
+      </table>
+      </TD>
+      </TR>
+      </TABLE>
+
+      <td width="30%" >&nbsp;</td>
+    </tr>
+  </table>
+</form>
+</body>
+</html>
+
Index: applications/welcome/src/webapp/main.css
===================================================================
--- applications/welcome/src/webapp/main.css	(revision 399866)
+++ applications/welcome/src/webapp/main.css	(working copy)
@@ -58,6 +58,20 @@
 	font-weight: bold;
 }
 
+.GeronimoLogo
+{
+	background-image:url("images/logo_head_570x86.gif");
+	background-repeat: no-repeat;
+	width: 570px;
+	height: 86px;
+	font-size: 35px;
+	font-family: Verdana, Tahoma, Arial, Helvetica, sans-serif;
+	text-align: right;
+	vertical-align: bottom; 
+	line-height: 30px;
+	font-weight: bold;
+}
+
 .LoginLogo
 {
 	background-image:url("images/head_left_login_586x86.gif");
Index: applications/welcome/src/webapp/WEB-INF/web.xml
===================================================================
--- applications/welcome/src/webapp/WEB-INF/web.xml	(revision 399866)
+++ applications/welcome/src/webapp/WEB-INF/web.xml	(working copy)
@@ -10,4 +10,48 @@
         Welcome to Geronimo
     </description>
 
+    <servlet>
+    <servlet-name>installSamples</servlet-name>
+    <servlet-class>org.apache.geronimo.welcome.InstallSamplesServlet</servlet-class>
+    </servlet>
+
+    <servlet>
+    <servlet-name>serveSamples</servlet-name>
+    <servlet-class>org.apache.geronimo.welcome.ServeSamplesServlet</servlet-class>
+    </servlet>
+
+    <servlet-mapping>
+        <servlet-name>installSamples</servlet-name>
+        <url-pattern>/installSamples</url-pattern>
+    </servlet-mapping>
+
+    <servlet-mapping>
+        <servlet-name>serveSamples</servlet-name>
+        <url-pattern>/serveSamples</url-pattern>
+    </servlet-mapping>
+
+    <security-constraint>
+       <web-resource-collection>
+           <web-resource-name></web-resource-name>
+           <url-pattern>/installSamples/*</url-pattern>
+           <http-method>GET</http-method>
+           <http-method>POST</http-method>
+           <http-method>PUT</http-method>
+       </web-resource-collection>
+       <auth-constraint>
+            <role-name>admin</role-name>
+        </auth-constraint>
+    </security-constraint>
+    <login-config>
+        <auth-method>FORM</auth-method>
+        <realm-name>geronimo-properties-realm</realm-name>
+        <form-login-config>
+            <form-login-page>/login.jsp</form-login-page>
+            <form-error-page>/loginerror.jsp</form-error-page>
+      </form-login-config>
+    </login-config>
+    <security-role>
+        <role-name>admin</role-name>
+    </security-role>
+
 </web-app>
Index: configs/welcome-jetty/src/plan/plan.xml
===================================================================
--- configs/welcome-jetty/src/plan/plan.xml	(revision 399866)
+++ configs/welcome-jetty/src/plan/plan.xml	(working copy)
@@ -24,4 +24,18 @@
 
     <context-root>/</context-root>
     <context-priority-classloader>false</context-priority-classloader>
+    <security-realm-name>geronimo-properties-realm</security-realm-name>
+
+    <security>
+        <default-principal realm-name="geronimo-properties-realm">
+            <principal class="org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal" name="system"/>
+        </default-principal>
+        <role-mappings>
+            <role role-name="admin">
+                <realm realm-name="geronimo-properties-realm">
+                    <principal class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal" name="admin" designated-run-as="true"/>
+                </realm>
+            </role>
+        </role-mappings>
+    </security>
 </web-app>
Index: configs/welcome-tomcat/src/plan/plan.xml
===================================================================
--- configs/welcome-tomcat/src/plan/plan.xml	(revision 399866)
+++ configs/welcome-tomcat/src/plan/plan.xml	(working copy)
@@ -24,4 +24,18 @@
 
     <context-root>/</context-root>
     <context-priority-classloader>false</context-priority-classloader>
+    <security-realm-name>geronimo-properties-realm</security-realm-name>
+
+    <security>
+        <default-principal realm-name="geronimo-properties-realm">
+            <principal class="org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal" name="system"/>
+        </default-principal>
+        <role-mappings>
+            <role role-name="admin">
+                <realm realm-name="geronimo-properties-realm">
+                    <principal class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal" name="admin" designated-run-as="true"/>
+                </realm>
+            </role>
+        </role-mappings>
+    </security>
 </web-app>
