You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by am...@apache.org on 2006/03/23 20:20:27 UTC

svn commit: r388236 [1/3] - in /geronimo/trunk: applications/console-core/src/java/org/apache/geronimo/console/util/ applications/console-framework/src/webapp/WEB-INF/data/ applications/console-standard/ applications/console-standard/src/java/org/apach...

Author: ammulder
Date: Thu Mar 23 11:20:22 2006
New Revision: 388236

URL: http://svn.apache.org/viewcvs?rev=388236&view=rev
Log:
Console enhancements
 - a new portlet to help configure Apache HTTP via mod_jk
 - start of a new keystore management portlet that can handle multiple
   keystores
Geronimo improvements as necesary to support those
 - new Keystore GBeans
 - more logic around parent/child module relationships

Added:
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/AJPHandler.java   (with props)
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/ApacheConfigPortlet.java   (with props)
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/BaseApacheHandler.java   (with props)
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/ConfigHandler.java   (with props)
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/IndexHandler.java   (with props)
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/ResultsHandler.java   (with props)
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/WebAppHandler.java   (with props)
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/BaseKeystoreHandler.java   (with props)
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/ConfigureNewKeyHandler.java   (with props)
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/ConfirmCertificateHandler.java   (with props)
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/ConfirmKeyHandler.java   (with props)
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/CreateKeystoreHandler.java   (with props)
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/KeystoresPortlet.java   (with props)
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/ListHandler.java   (with props)
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/UnlockKeystoreHandler.java   (with props)
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/UploadCertificateHandler.java   (with props)
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/ViewKeystoreHandler.java   (with props)
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/apache/
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/apache/jk/
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/apache/jk/ajpPort.jsp   (with props)
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/apache/jk/config.jsp   (with props)
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/apache/jk/index.jsp   (with props)
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/apache/jk/results.jsp   (with props)
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/apache/jk/webApps.jsp   (with props)
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/keystore/
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/keystore/configureKey.jsp   (with props)
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/keystore/confirmCertificate.jsp   (with props)
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/keystore/confirmKey.jsp   (with props)
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/keystore/createKeystore.jsp   (with props)
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/keystore/index.jsp   (with props)
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/keystore/unlockKeystore.jsp   (with props)
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/keystore/uploadCertificate.jsp   (with props)
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/keystore/viewKeystore.jsp   (with props)
    geronimo/trunk/assemblies/j2ee-jetty-server/src/var/security/keystores/
    geronimo/trunk/assemblies/j2ee-tomcat-server/src/var/security/keystores/
    geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/keystore/
    geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/keystore/FileKeystoreInstance.java   (with props)
    geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/keystore/FileKeystoreManager.java   (with props)
    geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/keystore/KeyIsLocked.java   (with props)
    geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/keystore/KeystoreInstance.java   (with props)
    geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/keystore/KeystoreIsLocked.java   (with props)
    geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/keystore/KeystoreManager.java   (with props)
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/CertificateUtil.java   (with props)
Modified:
    geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/KernelManagementHelper.java
    geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/ManagementHelper.java
    geronimo/trunk/applications/console-framework/src/webapp/WEB-INF/data/pageregistry.xml
    geronimo/trunk/applications/console-framework/src/webapp/WEB-INF/data/portletentityregistry.xml
    geronimo/trunk/applications/console-standard/project.xml
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/MultiPageAbstractHandler.java
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/MultiPagePortlet.java
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/JMSResourcePortlet.java
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/util/PortletManager.java
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/portlet.xml
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/web.xml
    geronimo/trunk/configs/j2ee-security/project.xml
    geronimo/trunk/configs/j2ee-security/src/plan/plan.xml
    geronimo/trunk/configs/rmi-naming/project.xml
    geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/j2eeobjectnames/NameFactory.java
    geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/J2EEServerImpl.java
    geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationInfo.java
    geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java
    geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java
    geronimo/trunk/modules/management/src/java/org/apache/geronimo/management/geronimo/J2EEServer.java
    geronimo/trunk/modules/security/project.xml

Modified: geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/KernelManagementHelper.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/KernelManagementHelper.java?rev=388236&r1=388235&r2=388236&view=diff
==============================================================================
--- geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/KernelManagementHelper.java (original)
+++ geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/KernelManagementHelper.java Thu Mar 23 11:20:22 2006
@@ -26,6 +26,8 @@
 import java.util.Set;
 import java.util.HashSet;
 import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 import javax.security.auth.Subject;
@@ -44,6 +46,11 @@
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.config.Configuration;
+import org.apache.geronimo.kernel.config.ConfigurationInfo;
+import org.apache.geronimo.kernel.config.ConfigurationModuleType;
+import org.apache.geronimo.kernel.config.ConfigurationUtil;
+import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.NoSuchStoreException;
 import org.apache.geronimo.kernel.proxy.ProxyManager;
 import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.management.AppClientModule;
@@ -81,6 +88,7 @@
 import org.apache.geronimo.security.jaas.JaasLoginModuleUse;
 import org.apache.geronimo.security.jaas.server.JaasLoginServiceMBean;
 import org.apache.geronimo.security.realm.SecurityRealm;
+import org.apache.geronimo.security.keystore.KeystoreManager;
 import org.apache.geronimo.system.logging.SystemLog;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
 
@@ -527,7 +535,7 @@
 
     public JaasLoginServiceMBean getLoginService(J2EEServer server) {
         try {
-            String name = server.getServerInfo();
+            String name = server.getLoginService();
             return (JaasLoginServiceMBean) pm.createProxy(ObjectName.getInstance(name), KernelManagementHelper.class.getClassLoader());
         } catch (Exception e) {
             log.error("Unable to look up LoginService for J2EEServer", e);
@@ -535,6 +543,16 @@
         }
     }
 
+    public KeystoreManager getKeystoreManager(J2EEServer server) {
+        try {
+            String name = server.getKeystoreManager();
+            return (KeystoreManager) pm.createProxy(ObjectName.getInstance(name), KernelManagementHelper.class.getClassLoader());
+        } catch (Exception e) {
+            log.error("Unable to look up KeystoreManager for J2EEServer", e);
+            return null;
+        }
+    }
+
     public WebManager[] getWebManagers(J2EEServer server) {
         WebManager[] result = new WebManager[0];
         try {
@@ -1086,6 +1104,44 @@
             result[i++] = kernel.getProxyManager().createProxy(name, iface.getClassLoader());
         }
         return result;
+    }
+
+    public ConfigurationInfo[] getConfigurations(ConfigurationModuleType type, boolean includeChildModules) {
+        ConfigurationManager mgr = ConfigurationUtil.getConfigurationManager(kernel);
+        List stores = mgr.listStores();
+        List results = new ArrayList();
+        for (Iterator i = stores.iterator(); i.hasNext();) {
+            ObjectName storeName = (ObjectName) i.next();
+            try {
+                List infos = mgr.listConfigurations(storeName);
+                for (Iterator j = infos.iterator(); j.hasNext();) {
+                    ConfigurationInfo info = (ConfigurationInfo) j.next();
+                    if(type == null || type.getValue() == info.getType().getValue()) {
+                        results.add(info);
+                    }
+                    if(includeChildModules && (type == null || info.getType().getValue() == ConfigurationModuleType.EAR.getValue())) {
+                        List kids = mgr.listChildConfigurations(info);
+                        for (Iterator k = kids.iterator(); k.hasNext();) {
+                            ConfigurationInfo child = (ConfigurationInfo) k.next();
+                            if(type == null || type.getValue() == child.getType().getValue()) {
+                                results.add(child);
+                            }
+                        }
+                    }
+                }
+            } catch (NoSuchStoreException e) {
+                // we just got this list so this should not happen
+                // in the unlikely event it does, just continue
+            }
+        }
+        Collections.sort(results, new Comparator() {
+            public int compare(Object o1, Object o2) {
+                ConfigurationInfo ci1 = (ConfigurationInfo) o1;
+                ConfigurationInfo ci2 = (ConfigurationInfo) o2;
+                return ci1.getConfigID().toString().compareTo(ci2.getConfigID().toString());
+            }
+        });
+        return (ConfigurationInfo[]) results.toArray(new ConfigurationInfo[results.size()]);
     }
 
     /**

Modified: geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/ManagementHelper.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/ManagementHelper.java?rev=388236&r1=388235&r2=388236&view=diff
==============================================================================
--- geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/ManagementHelper.java (original)
+++ geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/ManagementHelper.java Thu Mar 23 11:20:22 2006
@@ -22,6 +22,8 @@
 import javax.security.auth.login.LoginException;
 import javax.security.auth.spi.LoginModule;
 import org.apache.geronimo.kernel.repository.Repository;
+import org.apache.geronimo.kernel.config.ConfigurationInfo;
+import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.management.AppClientModule;
 import org.apache.geronimo.management.EJB;
 import org.apache.geronimo.management.EJBModule;
@@ -56,6 +58,7 @@
 import org.apache.geronimo.pool.GeronimoExecutor;
 import org.apache.geronimo.security.jaas.server.JaasLoginServiceMBean;
 import org.apache.geronimo.security.realm.SecurityRealm;
+import org.apache.geronimo.security.keystore.KeystoreManager;
 import org.apache.geronimo.system.logging.SystemLog;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
 
@@ -93,6 +96,7 @@
     SecurityRealm[] getSecurityRealms(J2EEServer server);
     ServerInfo getServerInfo(J2EEServer server);
     JaasLoginServiceMBean getLoginService(J2EEServer server);
+    KeystoreManager getKeystoreManager(J2EEServer server);
     WebManager[] getWebManagers(J2EEServer server);
     WebAccessLog getWebAccessLog(WebManager manager, WebContainer container);
     WebAccessLog getWebAccessLog(WebManager manager, String containerObjectName);
@@ -162,4 +166,5 @@
     void testLoginModule(J2EEServer server, LoginModule module, Map options);
     Subject testLoginModule(J2EEServer server, LoginModule module, Map options, String username, String password) throws LoginException;
     Object[] findByInterface(Class iface);
+    ConfigurationInfo[] getConfigurations(ConfigurationModuleType type, boolean includeChildModules);
 }

Modified: geronimo/trunk/applications/console-framework/src/webapp/WEB-INF/data/pageregistry.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-framework/src/webapp/WEB-INF/data/pageregistry.xml?rev=388236&r1=388235&r2=388236&view=diff
==============================================================================
--- geronimo/trunk/applications/console-framework/src/webapp/WEB-INF/data/pageregistry.xml (original)
+++ geronimo/trunk/applications/console-framework/src/webapp/WEB-INF/data/pageregistry.xml Thu Mar 23 11:20:22 2006
@@ -223,6 +223,21 @@
                 </fragment>
             </fragment>
         </fragment>
+
+        <fragment name="apachejk" type="page">
+            <navigation>
+                <title>Apache HTTP</title>
+                <description>ico_servcomp_16x16.gif Hook Geronimo up to the Apache HTTP server</description>
+            </navigation>
+
+            <fragment name="row1" type="row">
+                <fragment name="col1" type="column">
+                    <fragment name="p1" type="portlet">
+                        <property name="portlet" value="5.68"/>
+                    </fragment>
+                </fragment>
+            </fragment>
+        </fragment>
     </fragment>
 
     <fragment name="services" type="page">
@@ -469,9 +484,24 @@
             </fragment>
         </fragment>
 
+        <fragment name="keystores" type="page">
+            <navigation>
+                <title>Keystores</title>
+                <description>ico_doc_16x16.gif Manage keystores for this server</description>
+            </navigation>
+
+            <fragment name="row1" type="row">
+                <fragment name="col1" type="column">
+                    <fragment name="p1" type="portlet">
+                        <property name="portlet" value="5.69"/>
+                    </fragment>
+                </fragment>
+            </fragment>
+        </fragment>
+
         <fragment name="keystore" type="page">
             <navigation>
-                <title>Keystore</title>
+                <title>Old Keystore</title>
                 <description>ico_doc_16x16.gif Manage the keystore for this server</description>
             </navigation>
 

Modified: geronimo/trunk/applications/console-framework/src/webapp/WEB-INF/data/portletentityregistry.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-framework/src/webapp/WEB-INF/data/portletentityregistry.xml?rev=388236&r1=388235&r2=388236&view=diff
==============================================================================
--- geronimo/trunk/applications/console-framework/src/webapp/WEB-INF/data/portletentityregistry.xml (original)
+++ geronimo/trunk/applications/console-framework/src/webapp/WEB-INF/data/portletentityregistry.xml Thu Mar 23 11:20:22 2006
@@ -139,5 +139,11 @@
         <portlet id="67">
             <definition-id>console-standard.JMSWizard</definition-id>
         </portlet>
+        <portlet id="68">
+            <definition-id>console-standard.ApacheJK</definition-id>
+        </portlet>
+        <portlet id="69">
+            <definition-id>console-standard.Keystores</definition-id>
+        </portlet>
     </application>
 </portlet-entity-registry>

Modified: geronimo/trunk/applications/console-standard/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/project.xml?rev=388236&r1=388235&r2=388236&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/project.xml (original)
+++ geronimo/trunk/applications/console-standard/project.xml Thu Mar 23 11:20:22 2006
@@ -147,6 +147,11 @@
             <version>${pom.currentVersion}</version>
         </dependency>
         <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-util</artifactId>
+            <version>${pom.currentVersion}</version>
+        </dependency>
+        <dependency>
             <groupId>mx4j</groupId>
             <artifactId>mx4j</artifactId>
             <version>${mx4j_version}</version>

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/MultiPageAbstractHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/MultiPageAbstractHandler.java?rev=388236&r1=388235&r2=388236&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/MultiPageAbstractHandler.java (original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/MultiPageAbstractHandler.java Thu Mar 23 11:20:22 2006
@@ -16,6 +16,8 @@
  */
 package org.apache.geronimo.console;
 
+import org.apache.commons.fileupload.portlet.PortletFileUpload;
+
 import javax.portlet.PortletRequestDispatcher;
 import javax.portlet.PortletConfig;
 import javax.portlet.PortletException;
@@ -25,9 +27,14 @@
 import javax.portlet.RenderResponse;
 import javax.enterprise.deploy.spi.status.ProgressObject;
 import java.io.IOException;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Properties;
 
 /**
- * ReplaceMe
+ * Base class for handlers for the multi page portlet.  Each one is expected
+ * to handle a single page -- the action request before the page is rendered,
+ * the render request, and the action request after the page is rendered.
  *
  * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
  */
@@ -37,6 +44,8 @@
     protected PortletRequestDispatcher view;
     private final String mode;
     private final String viewName;
+    private Map uploadFiles = new HashMap();
+    private Properties uploadFields = new Properties();
 
     protected MultiPageAbstractHandler(String mode, String viewName) {
         this.mode = mode;
@@ -77,6 +86,13 @@
      */
     public abstract String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException;
 
+    public Map getUploadFiles() {
+        return uploadFiles;
+    }
+
+    public Properties getUploadFields() {
+        return uploadFields;
+    }
 
     protected static void waitForProgress(ProgressObject po) {
         while(po.getDeploymentStatus().isRunning()) {

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/MultiPagePortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/MultiPagePortlet.java?rev=388236&r1=388235&r2=388236&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/MultiPagePortlet.java (original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/MultiPagePortlet.java Thu Mar 23 11:20:22 2006
@@ -18,6 +18,10 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.commons.fileupload.portlet.PortletFileUpload;
+import org.apache.commons.fileupload.disk.DiskFileItemFactory;
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.FileUploadException;
 
 import javax.portlet.ActionRequest;
 import javax.portlet.ActionResponse;
@@ -30,6 +34,7 @@
 import java.util.Map;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
 import java.io.IOException;
 
 /**
@@ -55,7 +60,32 @@
 
     public void processAction(ActionRequest actionRequest,
                               ActionResponse actionResponse) throws PortletException, IOException {
-        String mode = actionRequest.getParameter(MODE_KEY);
+        String mode = null;
+        Map files = null;
+        Map fields = null;
+        if(actionRequest.getContentType() != null && actionRequest.getContentType().startsWith("multipart/form-data")) {
+            files = new HashMap();
+            fields = new HashMap();
+            PortletFileUpload request = new PortletFileUpload(new DiskFileItemFactory());
+            try {
+                List items = request.parseRequest(actionRequest);
+                for (int i = 0; i < items.size(); i++) {
+                    FileItem item = (FileItem) items.get(i);
+                    if(item.isFormField()) {
+                        if(item.getFieldName().equals(MODE_KEY)) {
+                            mode = item.getString();
+                        }
+                        fields.put(item.getFieldName(), item.getString());
+                    } else {
+                        files.put(item.getFieldName(), item);
+                    }
+                }
+            } catch (FileUploadException e) {
+                log.error("Unable to process form including a file upload", e);
+            }
+        } else {
+            mode = actionRequest.getParameter(MODE_KEY);
+        }
         MultiPageModel model = getModel(actionRequest);
         while(true) {
             if(mode == null) {
@@ -72,6 +102,13 @@
                     log.error("No handler for action mode '"+mode+"'");
                     break;
                 }
+                if(files == null) {
+                    handler.getUploadFields().clear();
+                    handler.getUploadFiles().clear();
+                } else {
+                    handler.getUploadFields().putAll(fields);
+                    handler.getUploadFiles().putAll(files);
+                }
                 log.debug("Using action handler '"+handler.getClass().getName()+"'");
                 if(type.equals("before")) {
                     mode = handler.actionBeforeView(actionRequest, actionResponse, model);
@@ -109,7 +146,7 @@
         } catch (Throwable e) {
             log.error("Unable to render portlet", e);
         }
-        renderRequest.setAttribute("data", model);
+        renderRequest.setAttribute(getModelJSPVariableName(), model);
         if(handler != null) {
             handler.getView().include(renderRequest, renderResponse);
         }
@@ -125,6 +162,8 @@
         if(helpers.containsKey("index")) return "index";
         return null;
     }
+
+    protected abstract String getModelJSPVariableName();
 
     protected abstract MultiPageModel getModel(PortletRequest request);
 }

Added: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/AJPHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/AJPHandler.java?rev=388236&view=auto
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/AJPHandler.java (added)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/AJPHandler.java Thu Mar 23 11:20:22 2006
@@ -0,0 +1,103 @@
+/**
+ *
+ * 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.console.apache.jk;
+
+import org.apache.geronimo.console.MultiPageModel;
+import org.apache.geronimo.console.util.PortletManager;
+import org.apache.geronimo.management.geronimo.WebManager;
+import org.apache.geronimo.management.geronimo.WebConnector;
+import org.apache.geronimo.kernel.proxy.GeronimoManagedBean;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+
+/**
+ * ReplaceMe
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class AJPHandler extends BaseApacheHandler {
+    private final static Log log = LogFactory.getLog(AJPHandler.class);
+
+    public AJPHandler() {
+        super(AJP_MODE, "/WEB-INF/view/apache/jk/ajpPort.jsp");
+    }
+
+    public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+        WebManager[] managers = PortletManager.getWebManagers(request);
+        // See if any AJP listeners are defined
+        for (int i = 0; i < managers.length; i++) {
+            WebManager manager = managers[i];
+            String[] connectors = manager.getConnectors(WebManager.PROTOCOL_AJP);
+            if(connectors.length > 0) {
+                log.warn("Found AJP listener on port "+PortletManager.getWebConnector(request, connectors[0]).getPort());
+                return BASIC_CONFIG_MODE+BEFORE_ACTION;
+            }
+        }
+        // Find an unused port
+        int port = 8009;
+        outer:
+        while(true) {
+            for (int i = 0; i < managers.length; i++) {
+                WebManager manager = managers[i];
+                WebConnector[] cons = PortletManager.getWebConnectors(request, ((GeronimoManagedBean)manager).getObjectName());
+                for (int j = 0; j < cons.length; j++) {
+                    WebConnector con = cons[j];
+                    if(con.getPort() == port) {
+                        port += 10;
+                        continue outer;
+                    }
+                }
+            }
+            break;
+        }
+
+        ((ApacheModel)model).setAddAjpPort(new Integer(port));
+
+        return getMode();
+    }
+
+    public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException {
+    }
+
+    public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel amodel) throws PortletException, IOException {
+        ApacheModel model = (ApacheModel) amodel;
+        // Make sure port is set and unused
+        if(model.getAddAjpPort() == null) {
+            return getMode()+BEFORE_ACTION; //todo: some sort of error message
+        }
+        WebManager[] managers = PortletManager.getWebManagers(request);
+        for (int i = 0; i < managers.length; i++) {
+            WebManager manager = managers[i];
+            WebConnector[] cons = PortletManager.getWebConnectors(request, ((GeronimoManagedBean)manager).getObjectName());
+            for (int j = 0; j < cons.length; j++) {
+                WebConnector con = cons[j];
+                if(con.getPort() == model.getAddAjpPort().intValue()) {
+                    return getMode()+BEFORE_ACTION; //todo: some sort of error message
+                }
+            }
+        }
+
+        return BASIC_CONFIG_MODE+BEFORE_ACTION;
+    }
+}

Propchange: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/AJPHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/ApacheConfigPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/ApacheConfigPortlet.java?rev=388236&view=auto
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/ApacheConfigPortlet.java (added)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/ApacheConfigPortlet.java Thu Mar 23 11:20:22 2006
@@ -0,0 +1,48 @@
+/**
+ *
+ * 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.console.apache.jk;
+
+import org.apache.geronimo.console.MultiPagePortlet;
+import org.apache.geronimo.console.MultiPageModel;
+
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequest;
+
+/**
+ * Portlet that helps you configure Geronimo for Apache 2 with mod_jk
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class ApacheConfigPortlet extends MultiPagePortlet {
+    public void init(PortletConfig config) throws PortletException {
+        super.init(config);
+        addHelper(new IndexHandler(), config);
+        addHelper(new ConfigHandler(), config);
+        addHelper(new AJPHandler(), config);
+        addHelper(new WebAppHandler(), config);
+        addHelper(new ResultsHandler(), config);
+    }
+
+    protected String getModelJSPVariableName() {
+        return "model";
+    }
+
+    protected MultiPageModel getModel(PortletRequest request) {
+        return new BaseApacheHandler.ApacheModel(request);
+    }
+}

Propchange: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/ApacheConfigPortlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/BaseApacheHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/BaseApacheHandler.java?rev=388236&view=auto
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/BaseApacheHandler.java (added)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/BaseApacheHandler.java Thu Mar 23 11:20:22 2006
@@ -0,0 +1,213 @@
+/**
+ *
+ * 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.console.apache.jk;
+
+import org.apache.geronimo.console.MultiPageAbstractHandler;
+import org.apache.geronimo.console.MultiPageModel;
+import org.apache.geronimo.console.util.PortletManager;
+
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletRequest;
+import java.util.List;
+import java.util.Map;
+import java.util.ArrayList;
+import java.io.Serializable;
+
+/**
+ * The base class for all handlers for this portlet
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public abstract class BaseApacheHandler extends MultiPageAbstractHandler {
+    protected static final String INDEX_MODE = "index";
+    protected static final String BASIC_CONFIG_MODE = "basic";
+    protected static final String AJP_MODE = "ajp";
+    protected static final String WEB_APP_MODE = "webapp";
+    protected static final String RESULTS_MODE = "results";
+
+    protected BaseApacheHandler(String mode, String viewName) {
+        super(mode, viewName);
+    }
+
+    public final static class WebAppData implements Serializable {
+        private String configId;
+        private boolean enabled;
+        private String dynamicPattern;
+        private boolean serveStaticContent;
+        private String contextRoot;
+        private String webAppDir;
+
+        public WebAppData(String configId, boolean enabled, String dynamicPattern, boolean serveStaticContent) {
+            this.configId = configId;
+            this.enabled = enabled;
+            this.dynamicPattern = dynamicPattern;
+            this.serveStaticContent = serveStaticContent;
+        }
+
+        public WebAppData(PortletRequest request, String prefix) {
+            configId = request.getParameter(prefix+"configId");
+            dynamicPattern = request.getParameter(prefix+"dynamicPattern");
+            String test = request.getParameter(prefix+"enabled");
+            enabled = test != null && !test.equals("") && !test.equals("false");
+            test = request.getParameter(prefix+"serveStaticContent");
+            serveStaticContent = test != null && !test.equals("") && !test.equals("false");
+            contextRoot = request.getParameter(prefix+"contextRoot");
+            webAppDir = request.getParameter(prefix+"webAppDir");
+        }
+
+        public void save(ActionResponse response, String prefix) {
+            response.setRenderParameter(prefix+"configId", configId);
+            response.setRenderParameter(prefix+"dynamicPattern", dynamicPattern);
+            response.setRenderParameter(prefix+"enabled", Boolean.toString(enabled));
+            response.setRenderParameter(prefix+"serveStaticContent", Boolean.toString(serveStaticContent));
+            if(contextRoot != null) response.setRenderParameter(prefix+"contextRoot", contextRoot);
+            if(webAppDir != null) response.setRenderParameter(prefix+"webAppDir", webAppDir);
+        }
+
+        public boolean isEnabled() {
+            return enabled;
+        }
+
+        public void setEnabled(boolean enabled) {
+            this.enabled = enabled;
+        }
+
+        public String getConfigId() {
+            return configId;
+        }
+
+        public void setConfigId(String configId) {
+            this.configId = configId;
+        }
+
+        public String getDynamicPattern() {
+            return dynamicPattern;
+        }
+
+        public void setDynamicPattern(String dynamicPattern) {
+            this.dynamicPattern = dynamicPattern;
+        }
+
+        public boolean isServeStaticContent() {
+            return serveStaticContent;
+        }
+
+        public void setServeStaticContent(boolean serveStaticContent) {
+            this.serveStaticContent = serveStaticContent;
+        }
+
+        public String getContextRoot() {
+            return contextRoot;
+        }
+
+        public void setContextRoot(String contextRoot) {
+            this.contextRoot = contextRoot;
+        }
+
+        public String getWebAppDir() {
+            return webAppDir;
+        }
+
+        public void setWebAppDir(String webAppDir) {
+            this.webAppDir = webAppDir;
+        }
+    }
+
+    public final static class ApacheModel implements MultiPageModel {
+        private String os;
+        private Integer addAjpPort;
+        private String logFilePath;
+        private String workersPath;
+        private List webApps = new ArrayList();
+
+        public ApacheModel(PortletRequest request) {
+            Map map = request.getParameterMap();
+            os = request.getParameter("os");
+            logFilePath = request.getParameter("logFilePath");
+            if(logFilePath == null) {
+                logFilePath = PortletManager.getServerInfo(request).resolve("var/log/apache_mod_jk.log").getPath();
+            }
+            workersPath = request.getParameter("workersPath");
+            if(workersPath == null) {
+                workersPath = PortletManager.getServerInfo(request).resolve("var/config/workers.properties").getPath();
+            }
+            String ajp = request.getParameter("addAjpPort");
+            if(!isEmpty(ajp)) addAjpPort = new Integer(ajp);
+            int index = 0;
+            while(true) {
+                String key = "webapp."+(index++)+".";
+                if(!map.containsKey(key+"configId")) {
+                    break;
+                }
+                WebAppData data = new WebAppData(request, key);
+                webApps.add(data);
+            }
+        }
+
+        public void save(ActionResponse response) {
+            if(!isEmpty(os)) response.setRenderParameter("os", os);
+            if(!isEmpty(logFilePath)) response.setRenderParameter("logFilePath", logFilePath);
+            if(!isEmpty(workersPath)) response.setRenderParameter("workersPath", workersPath);
+            if(addAjpPort != null) response.setRenderParameter("addAjpPort", addAjpPort.toString());
+            for (int i = 0; i < webApps.size(); i++) {
+                WebAppData data = (WebAppData) webApps.get(i);
+                String key = "webapp."+i+".";
+                data.save(response, key);
+            }
+        }
+
+        public String getOs() {
+            return os;
+        }
+
+        public void setOs(String os) {
+            this.os = os;
+        }
+
+        public Integer getAddAjpPort() {
+            return addAjpPort;
+        }
+
+        public void setAddAjpPort(Integer addAjpPort) {
+            this.addAjpPort = addAjpPort;
+        }
+
+        public String getLogFilePath() {
+            return logFilePath;
+        }
+
+        public void setLogFilePath(String logFilePath) {
+            this.logFilePath = logFilePath;
+        }
+
+        public String getWorkersPath() {
+            return workersPath;
+        }
+
+        public void setWorkersPath(String workersPath) {
+            this.workersPath = workersPath;
+        }
+
+        public List getWebApps() {
+            return webApps;
+        }
+
+        public void setWebApps(List webApps) {
+            this.webApps = webApps;
+        }
+    }
+}

Propchange: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/BaseApacheHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/ConfigHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/ConfigHandler.java?rev=388236&view=auto
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/ConfigHandler.java (added)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/ConfigHandler.java Thu Mar 23 11:20:22 2006
@@ -0,0 +1,48 @@
+/**
+ *
+ * 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.console.apache.jk;
+
+import org.apache.geronimo.console.MultiPageModel;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+
+/**
+ * Handler for the basic configuration screen
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class ConfigHandler extends BaseApacheHandler {
+    public ConfigHandler() {
+        super(BASIC_CONFIG_MODE, "/WEB-INF/view/apache/jk/config.jsp");
+    }
+
+    public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+        return getMode();
+    }
+
+    public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException {
+    }
+
+    public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+        return WEB_APP_MODE+BEFORE_ACTION;
+    }
+}

Propchange: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/ConfigHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/IndexHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/IndexHandler.java?rev=388236&view=auto
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/IndexHandler.java (added)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/IndexHandler.java Thu Mar 23 11:20:22 2006
@@ -0,0 +1,48 @@
+/**
+ *
+ * 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.console.apache.jk;
+
+import org.apache.geronimo.console.MultiPageModel;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+
+/**
+ * Handler for the front screen for this portlet
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class IndexHandler extends BaseApacheHandler {
+    public IndexHandler() {
+        super(INDEX_MODE, "/WEB-INF/view/apache/jk/index.jsp");
+    }
+
+    public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+        return getMode();
+    }
+
+    public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException {
+    }
+
+    public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+        return AJP_MODE+BEFORE_ACTION;
+    }
+}

Propchange: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/IndexHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/ResultsHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/ResultsHandler.java?rev=388236&view=auto
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/ResultsHandler.java (added)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/ResultsHandler.java Thu Mar 23 11:20:22 2006
@@ -0,0 +1,71 @@
+/**
+ *
+ * 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.console.apache.jk;
+
+import org.apache.geronimo.console.MultiPageModel;
+import org.apache.geronimo.console.util.PortletManager;
+import org.apache.geronimo.kernel.config.ConfigurationInfo;
+import org.apache.geronimo.kernel.config.ConfigurationModuleType;
+import org.apache.geronimo.management.geronimo.WebManager;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * Handler for the screen where you select the webapps to expose through Apache
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class ResultsHandler extends BaseApacheHandler {
+    public ResultsHandler() {
+        super(RESULTS_MODE, "/WEB-INF/view/apache/jk/results.jsp");
+    }
+
+    public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+        //todo: Add AJP Connector
+        return getMode();
+    }
+
+    public void renderView(RenderRequest request, RenderResponse response, MultiPageModel amodel) throws PortletException, IOException {
+        ApacheModel model = (ApacheModel) amodel;
+        String port = "unknown";
+        if(model.getAddAjpPort() != null) {
+            port = model.getAddAjpPort().toString();
+        } else {
+            WebManager[] managers = PortletManager.getWebManagers(request);
+            // See if any AJP listeners are defined
+            for (int i = 0; i < managers.length; i++) {
+                WebManager manager = managers[i];
+                String[] connectors = manager.getConnectors(WebManager.PROTOCOL_AJP);
+                if(connectors.length > 0) {
+                    port = Integer.toString(PortletManager.getWebConnector(request, connectors[0]).getPort());
+                    break;
+                }
+            }
+        }
+        request.setAttribute("ajpPort", port);
+    }
+
+    public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+        return getMode()+BEFORE_ACTION;
+    }
+}

Propchange: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/ResultsHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/WebAppHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/WebAppHandler.java?rev=388236&view=auto
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/WebAppHandler.java (added)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/WebAppHandler.java Thu Mar 23 11:20:22 2006
@@ -0,0 +1,99 @@
+/**
+ *
+ * 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.console.apache.jk;
+
+import org.apache.geronimo.console.MultiPageModel;
+import org.apache.geronimo.console.util.PortletManager;
+import org.apache.geronimo.kernel.config.ConfigurationInfo;
+import org.apache.geronimo.kernel.config.ConfigurationModuleType;
+import org.apache.geronimo.kernel.config.ConfigurationStore;
+import org.apache.geronimo.kernel.config.NoSuchConfigException;
+import org.apache.geronimo.management.geronimo.WebModule;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.management.ObjectName;
+import javax.management.MalformedObjectNameException;
+import java.io.IOException;
+import java.io.File;
+import java.util.List;
+import java.net.URI;
+
+/**
+ * Handler for the screen where you select the webapps to expose through Apache
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class WebAppHandler extends BaseApacheHandler {
+    private final static Log log = LogFactory.getLog(WebAppHandler.class);
+
+    public WebAppHandler() {
+        super(WEB_APP_MODE, "/WEB-INF/view/apache/jk/webApps.jsp");
+    }
+
+    public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+        return getMode();
+    }
+
+    public void renderView(RenderRequest request, RenderResponse response, MultiPageModel amodel) throws PortletException, IOException {
+        ApacheModel model = (ApacheModel) amodel;
+        ConfigurationInfo[] webApps = PortletManager.getConfigurations(request, ConfigurationModuleType.WAR, true);
+        if(model.getWebApps().size() == 0) {
+            List list = model.getWebApps();
+            for (int i = 0; i < webApps.length; i++) {
+                ConfigurationInfo app = webApps[i];
+                if(!app.getState().isRunning()) {
+                    continue;
+                }
+                ObjectName base = app.getStoreName();
+                WebAppData data = new WebAppData(app.getConfigID().toString(), false, null, false);
+                try {
+                    ObjectName module = ObjectName.getInstance(base.getDomain()+":J2EEServer="+base.getKeyProperty("J2EEServer")+",J2EEApplication="+app.getParentID()+",j2eeType=WebModule,name="+app.getConfigID());
+                    WebModule web = (WebModule) PortletManager.getManagedBean(request, module.getCanonicalName());
+                    data.setContextRoot(web.getContextPath());
+                    ConfigurationStore store = (ConfigurationStore) PortletManager.getManagedBean(request, app.getStoreName().getCanonicalName());
+                    String path = getPathToConfiguration(store, app.getParentID() == null ? app.getConfigID() : app.getParentID());
+                    if(app.getParentID() == null) {
+                        path = path + File.separator + "web";
+                    } else {
+                        path = path + File.separator + app.getConfigID();
+                    }
+                    data.setWebAppDir(path);
+                } catch (MalformedObjectNameException e) {
+                    log.error("I sure didn't expect to get this exception", e);
+                } catch (NoSuchConfigException e) {
+                    log.error("I sure didn't expect to get this exception", e);
+                }
+                list.add(data);
+            }
+        }
+        request.setAttribute("webApps", webApps);
+    }
+
+    private String getPathToConfiguration(ConfigurationStore store, URI moduleOrParentID) throws NoSuchConfigException {
+        return "PATH_IN_CONFIG_STORE"; // todo: replace this with code to actually look up the path to the module
+    }
+
+    public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel amodel) throws PortletException, IOException {
+        return RESULTS_MODE+BEFORE_ACTION;
+    }
+}

Propchange: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/apache/jk/WebAppHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/JMSResourcePortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/JMSResourcePortlet.java?rev=388236&r1=388235&r2=388236&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/JMSResourcePortlet.java (original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/wizard/JMSResourcePortlet.java Thu Mar 23 11:20:22 2006
@@ -55,6 +55,10 @@
         addHelper(new ReviewHandler(), config);
     }
 
+    protected String getModelJSPVariableName() {
+        return "data";
+    }
+
     protected MultiPageModel getModel(PortletRequest request) {
         return new AbstractHandler.JMSResourceData(request);
     }

Added: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/BaseKeystoreHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/BaseKeystoreHandler.java?rev=388236&view=auto
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/BaseKeystoreHandler.java (added)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/BaseKeystoreHandler.java Thu Mar 23 11:20:22 2006
@@ -0,0 +1,342 @@
+/**
+ *
+ * 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.console.keystores;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.console.MultiPageAbstractHandler;
+import org.apache.geronimo.console.MultiPageModel;
+import org.apache.geronimo.security.keystore.KeystoreInstance;
+import org.apache.geronimo.util.CertificateUtil;
+
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletRequest;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.io.Serializable;
+import java.io.IOException;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateFactory;
+import java.security.cert.X509Certificate;
+import java.security.NoSuchAlgorithmException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * The base class for all handlers for this portlet
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public abstract class BaseKeystoreHandler extends MultiPageAbstractHandler {
+    private final static Log log = LogFactory.getLog(BaseKeystoreHandler.class);
+    protected static final String KEYSTORE_DATA_PREFIX="org.apache.geronimo.keystore.";
+    protected static final String LIST_MODE = "list";
+    protected static final String UNLOCK_KEYSTORE_FOR_EDITING = "unlockEdit";
+    protected static final String UNLOCK_KEYSTORE_FOR_USAGE = "unlockKeystore";
+    protected static final String LOCK_KEYSTORE_FOR_EDITING = "lockEdit";
+    protected static final String LOCK_KEYSTORE_FOR_USAGE = "lockKeystore";
+    protected static final String CREATE_KEYSTORE = "createKeystore";
+    protected static final String VIEW_KEYSTORE = "viewKeystore";
+    protected static final String UPLOAD_CERTIFICATE = "uploadCertificate";
+    protected static final String CONFIRM_CERTIFICATE = "confirmCertificate";
+    protected static final String CONFIGURE_KEY = "configureKey";
+    protected static final String CONFIRM_KEY = "confirmKey";
+
+    protected BaseKeystoreHandler(String mode, String viewName) {
+        super(mode, viewName);
+    }
+
+    public final static class KeystoreModel implements MultiPageModel {
+        public KeystoreModel(PortletRequest request) {
+        }
+
+        public void save(ActionResponse response) {
+        }
+    }
+
+    public final static class KeystoreData implements Serializable {
+        private KeystoreInstance instance;
+        private char[] password;
+        private String[] certificates;
+        private String[] keys;
+        private Map fingerprints;
+
+        public KeystoreInstance getInstance() {
+            return instance;
+        }
+
+        public void setInstance(KeystoreInstance instance) {
+            this.instance = instance;
+        }
+
+        public void setPassword(char[] password) {
+            this.password = password;
+        }
+
+        public boolean isLocked() {
+            return password == null;
+        }
+
+        public String[] getCertificates() {
+            return certificates;
+        }
+
+        public void setCertificates(String[] certificates) {
+            this.certificates = certificates;
+        }
+
+        public String[] getKeys() {
+            return keys;
+        }
+
+        public void setKeys(String[] keys) {
+            this.keys = keys;
+        }
+
+        public Map getFingerprints() {
+            if(fingerprints == null) {
+                fingerprints = new HashMap();
+                for (int i = 0; i < certificates.length; i++) {
+                    String alias = certificates[i];
+                    try {
+                        fingerprints.put(alias, CertificateUtil.generateFingerprint(instance.getCertificate(alias, password), "MD5"));
+                    } catch (Exception e) {
+                        log.error("Unable to generate certificate fingerprint", e);
+                    }
+                }
+                for (int i = 0; i < keys.length; i++) {
+                    String alias = keys[i];
+                    try {
+                        fingerprints.put(alias, CertificateUtil.generateFingerprint(instance.getCertificate(alias, password), "MD5"));
+                    } catch (Exception e) {
+                        log.error("Unable to generate certificate fingerprint", e);
+                    }
+                }
+            }
+            return fingerprints;
+        }
+
+        public boolean importTrustCert(String fileName, String alias) throws FileNotFoundException, CertificateException {
+            InputStream is = new FileInputStream(fileName);
+            CertificateFactory cf = CertificateFactory.getInstance("X.509");
+            Collection certs = cf.generateCertificates(is);
+            X509Certificate cert = (X509Certificate) certs.iterator().next();
+            boolean result = instance.importTrustCertificate(cert, alias, password);
+            if(result) {
+                String[] update = new String[certificates.length+1];
+                System.arraycopy(certificates, 0, update, 0, certificates.length);
+                update[certificates.length] = alias;
+                certificates = update;
+                try {
+                    fingerprints.put(alias, CertificateUtil.generateFingerprint(instance.getCertificate(alias, password), "MD5"));
+                } catch (Exception e) {
+                    log.error("Unable to generate certificate fingerprint", e);
+                }
+            }
+            return result;
+        }
+
+        public boolean createKeyPair(String alias, String keyPassword, String keyAlgorithm, int keySize,
+                                     String signatureAlgorithm, int validity, String commonName, String orgUnit,
+                                     String organization, String locality, String state, String country) {
+            boolean result = instance.generateKeyPair(alias, password, keyPassword.toCharArray(), keyAlgorithm, keySize,
+                                     signatureAlgorithm, validity, commonName, orgUnit, organization, locality, state, country);
+            if(result) {
+                String[] update = new String[keys.length+1];
+                System.arraycopy(keys, 0, update, 0, keys.length);
+                update[keys.length] = alias;
+                keys = update;
+                try {
+                    fingerprints.put(alias, CertificateUtil.generateFingerprint(instance.getCertificate(alias, password), "MD5"));
+                } catch (Exception e) {
+                    log.error("Unable to generate certificate fingerprint", e);
+                }
+            }
+            return result;
+        }
+    }
+
+//    public final static class WebAppData implements Serializable {
+//        private String configId;
+//        private boolean enabled;
+//        private String dynamicPattern;
+//        private boolean serveStaticContent;
+//        private String contextRoot;
+//        private String webAppDir;
+//
+//        public WebAppData(String configId, boolean enabled, String dynamicPattern, boolean serveStaticContent) {
+//            this.configId = configId;
+//            this.enabled = enabled;
+//            this.dynamicPattern = dynamicPattern;
+//            this.serveStaticContent = serveStaticContent;
+//        }
+//
+//        public WebAppData(PortletRequest request, String prefix) {
+//            configId = request.getParameter(prefix+"configId");
+//            dynamicPattern = request.getParameter(prefix+"dynamicPattern");
+//            String test = request.getParameter(prefix+"enabled");
+//            enabled = test != null && !test.equals("") && !test.equals("false");
+//            test = request.getParameter(prefix+"serveStaticContent");
+//            serveStaticContent = test != null && !test.equals("") && !test.equals("false");
+//            contextRoot = request.getParameter(prefix+"contextRoot");
+//            webAppDir = request.getParameter(prefix+"webAppDir");
+//        }
+//
+//        public void save(ActionResponse response, String prefix) {
+//            response.setRenderParameter(prefix+"configId", configId);
+//            response.setRenderParameter(prefix+"dynamicPattern", dynamicPattern);
+//            response.setRenderParameter(prefix+"enabled", Boolean.toString(enabled));
+//            response.setRenderParameter(prefix+"serveStaticContent", Boolean.toString(serveStaticContent));
+//            if(contextRoot != null) response.setRenderParameter(prefix+"contextRoot", contextRoot);
+//            if(webAppDir != null) response.setRenderParameter(prefix+"webAppDir", webAppDir);
+//        }
+//
+//        public boolean isEnabled() {
+//            return enabled;
+//        }
+//
+//        public void setEnabled(boolean enabled) {
+//            this.enabled = enabled;
+//        }
+//
+//        public String getConfigId() {
+//            return configId;
+//        }
+//
+//        public void setConfigId(String configId) {
+//            this.configId = configId;
+//        }
+//
+//        public String getDynamicPattern() {
+//            return dynamicPattern;
+//        }
+//
+//        public void setDynamicPattern(String dynamicPattern) {
+//            this.dynamicPattern = dynamicPattern;
+//        }
+//
+//        public boolean isServeStaticContent() {
+//            return serveStaticContent;
+//        }
+//
+//        public void setServeStaticContent(boolean serveStaticContent) {
+//            this.serveStaticContent = serveStaticContent;
+//        }
+//
+//        public String getContextRoot() {
+//            return contextRoot;
+//        }
+//
+//        public void setContextRoot(String contextRoot) {
+//            this.contextRoot = contextRoot;
+//        }
+//
+//        public String getWebAppDir() {
+//            return webAppDir;
+//        }
+//
+//        public void setWebAppDir(String webAppDir) {
+//            this.webAppDir = webAppDir;
+//        }
+//    }
+//
+//    public final static class ApacheModel implements MultiPageModel {
+//        private String os;
+//        private Integer addAjpPort;
+//        private String logFilePath;
+//        private String workersPath;
+//        private List webApps = new ArrayList();
+//
+//        public ApacheModel(PortletRequest request) {
+//            Map map = request.getParameterMap();
+//            os = request.getParameter("os");
+//            logFilePath = request.getParameter("logFilePath");
+//            if(logFilePath == null) {
+//                logFilePath = PortletManager.getServerInfo(request).resolve("var/log/apache_mod_jk.log").getPath();
+//            }
+//            workersPath = request.getParameter("workersPath");
+//            if(workersPath == null) {
+//                workersPath = PortletManager.getServerInfo(request).resolve("var/config/workers.properties").getPath();
+//            }
+//            String ajp = request.getParameter("addAjpPort");
+//            if(!isEmpty(ajp)) addAjpPort = new Integer(ajp);
+//            int index = 0;
+//            while(true) {
+//                String key = "webapp."+(index++)+".";
+//                if(!map.containsKey(key+"configId")) {
+//                    break;
+//                }
+//                BaseKeystoreHandler.WebAppData data = new BaseKeystoreHandler.WebAppData(request, key);
+//                webApps.add(data);
+//            }
+//        }
+//
+//        public void save(ActionResponse response) {
+//            if(!isEmpty(os)) response.setRenderParameter("os", os);
+//            if(!isEmpty(logFilePath)) response.setRenderParameter("logFilePath", logFilePath);
+//            if(!isEmpty(workersPath)) response.setRenderParameter("workersPath", workersPath);
+//            if(addAjpPort != null) response.setRenderParameter("addAjpPort", addAjpPort.toString());
+//            for (int i = 0; i < webApps.size(); i++) {
+//                BaseKeystoreHandler.WebAppData data = (BaseKeystoreHandler.WebAppData) webApps.get(i);
+//                String key = "webapp."+i+".";
+//                data.save(response, key);
+//            }
+//        }
+//
+//        public String getOs() {
+//            return os;
+//        }
+//
+//        public void setOs(String os) {
+//            this.os = os;
+//        }
+//
+//        public Integer getAddAjpPort() {
+//            return addAjpPort;
+//        }
+//
+//        public void setAddAjpPort(Integer addAjpPort) {
+//            this.addAjpPort = addAjpPort;
+//        }
+//
+//        public String getLogFilePath() {
+//            return logFilePath;
+//        }
+//
+//        public void setLogFilePath(String logFilePath) {
+//            this.logFilePath = logFilePath;
+//        }
+//
+//        public String getWorkersPath() {
+//            return workersPath;
+//        }
+//
+//        public void setWorkersPath(String workersPath) {
+//            this.workersPath = workersPath;
+//        }
+//
+//        public List getWebApps() {
+//            return webApps;
+//        }
+//
+//        public void setWebApps(List webApps) {
+//            this.webApps = webApps;
+//        }
+//    }
+}

Propchange: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/BaseKeystoreHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/ConfigureNewKeyHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/ConfigureNewKeyHandler.java?rev=388236&view=auto
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/ConfigureNewKeyHandler.java (added)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/ConfigureNewKeyHandler.java Thu Mar 23 11:20:22 2006
@@ -0,0 +1,81 @@
+/**
+ *
+ * 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.console.keystores;
+
+import org.apache.geronimo.console.MultiPageModel;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+
+/**
+ * Handler for collecting the settings necessary to generate a new private key.
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class ConfigureNewKeyHandler extends BaseKeystoreHandler {
+    public ConfigureNewKeyHandler() {
+        super(CONFIGURE_KEY, "/WEB-INF/view/keystore/configureKey.jsp");
+    }
+
+    public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+        String id = request.getParameter("keystore");
+        if(id != null) {
+            response.setRenderParameter("keystore", id);
+        } // else we hope this is after a failure and the actionAfterView took care of it below!
+        return getMode();
+    }
+
+    public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException {
+        request.setAttribute("keystore", request.getParameter("keystore"));
+    }
+
+    public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+        String keystore = request.getParameter("keystore");
+        String alias = request.getParameter("alias");
+        String password = request.getParameter("password");
+        String keySize = request.getParameter("keySize");
+        String algorithm = request.getParameter("algorithm");
+        String valid = request.getParameter("valid");
+        String certCN = request.getParameter("certCN");
+        String certOU = request.getParameter("certOU");
+        String certO = request.getParameter("certO");
+        String certL = request.getParameter("certL");
+        String certST = request.getParameter("certST");
+        String certC = request.getParameter("certC");
+
+        //todo: validation
+
+        response.setRenderParameter("keystore", keystore);
+        response.setRenderParameter("alias", alias);
+        response.setRenderParameter("password", password);
+        response.setRenderParameter("keySize", keySize);
+        response.setRenderParameter("algorithm", algorithm);
+        response.setRenderParameter("valid", valid);
+        response.setRenderParameter("certCN", certCN);
+        response.setRenderParameter("certOU", certOU);
+        response.setRenderParameter("certO", certO);
+        response.setRenderParameter("certL", certL);
+        response.setRenderParameter("certST", certST);
+        response.setRenderParameter("certC", certC);
+
+        return CONFIRM_KEY+BEFORE_ACTION;
+    }
+}

Propchange: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/ConfigureNewKeyHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/ConfirmCertificateHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/ConfirmCertificateHandler.java?rev=388236&view=auto
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/ConfirmCertificateHandler.java (added)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/ConfirmCertificateHandler.java Thu Mar 23 11:20:22 2006
@@ -0,0 +1,97 @@
+/**
+ *
+ * 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.console.keystores;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.console.MultiPageModel;
+import org.apache.geronimo.util.CertificateUtil;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateFactory;
+import java.security.cert.X509Certificate;
+import java.text.SimpleDateFormat;
+import java.util.Collection;
+
+/**
+ * Handler for entering a password to unlock a keystore
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class ConfirmCertificateHandler extends BaseKeystoreHandler {
+    private final static Log log = LogFactory.getLog(ConfirmCertificateHandler.class);
+
+    public ConfirmCertificateHandler() {
+        super(CONFIRM_CERTIFICATE, "/WEB-INF/view/keystore/confirmCertificate.jsp");
+    }
+
+    public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+        return getMode();
+    }
+
+    public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException {
+        SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
+        request.setAttribute("id", request.getParameter("id"));
+        request.setAttribute("alias", request.getParameter("alias"));
+        String certFile = request.getParameter("certificate");
+        request.setAttribute("certificate", certFile);
+        InputStream is = new FileInputStream(certFile);
+        try {
+            CertificateFactory cf = CertificateFactory.getInstance("X.509");
+            Collection certificates = cf.generateCertificates(is);
+            X509Certificate cert = (X509Certificate) certificates.iterator().next();
+            request.setAttribute("fingerprint", CertificateUtil.generateFingerprint(cert, "MD5"));
+            request.setAttribute("issuer", cert.getIssuerDN().getName());
+            request.setAttribute("subject", cert.getSubjectDN().getName());
+            request.setAttribute("serial", cert.getSerialNumber());
+            request.setAttribute("validStart", sdf.format(cert.getNotBefore()));
+            request.setAttribute("validEnd", sdf.format(cert.getNotAfter()));
+        } catch (CertificateException e) {
+            log.error("Unable to process uploaded certificate", e);
+        } catch (NoSuchAlgorithmException e) {
+            log.error("Unable to process uploaded certificate", e);
+        }
+    }
+
+    public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+        String id = request.getParameter("id");
+        String alias = request.getParameter("alias");
+        String certificate = request.getParameter("certificate");
+        if(id == null || id.equals("") || alias == null || alias.equals("") || certificate == null || certificate.equals("")) {
+            return LIST_MODE+BEFORE_ACTION; //todo: better handling
+        }
+        KeystoreData data = ((KeystoreData) request.getPortletSession(true).getAttribute(KEYSTORE_DATA_PREFIX + id));
+        try {
+            if(!data.importTrustCert(certificate, alias)) {
+                log.error("Unable to import certificate");
+            }
+        } catch (CertificateException e) {
+            log.error("Unable to import certificate", e);
+        }
+        response.setRenderParameter("id", id);
+        return VIEW_KEYSTORE+BEFORE_ACTION;
+    }
+}

Propchange: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/ConfirmCertificateHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/ConfirmKeyHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/ConfirmKeyHandler.java?rev=388236&view=auto
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/ConfirmKeyHandler.java (added)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/ConfirmKeyHandler.java Thu Mar 23 11:20:22 2006
@@ -0,0 +1,104 @@
+/**
+ *
+ * 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.console.keystores;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.console.MultiPageModel;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+
+/**
+ * Handler for entering a password to unlock a keystore
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class ConfirmKeyHandler extends BaseKeystoreHandler {
+    private final static Log log = LogFactory.getLog(ConfirmKeyHandler.class);
+
+    public ConfirmKeyHandler() {
+        super(CONFIRM_KEY, "/WEB-INF/view/keystore/confirmKey.jsp");
+    }
+
+    public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+        return getMode();
+    }
+
+    public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException {
+        SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
+        String keystore = request.getParameter("keystore");
+        String alias = request.getParameter("alias");
+        String password = request.getParameter("password");
+        String keySize = request.getParameter("keySize");
+        String algorithm = request.getParameter("algorithm");
+        String valid = request.getParameter("valid");
+        String certCN = request.getParameter("certCN");
+        String certOU = request.getParameter("certOU");
+        String certO = request.getParameter("certO");
+        String certL = request.getParameter("certL");
+        String certST = request.getParameter("certST");
+        String certC = request.getParameter("certC");
+        request.setAttribute("keystore", keystore);
+        request.setAttribute("alias", alias);
+        request.setAttribute("password", password);
+        request.setAttribute("keySize", keySize);
+        request.setAttribute("algorithm", algorithm);
+        request.setAttribute("valid", valid);
+        request.setAttribute("validFrom", sdf.format(new Date()));
+        Calendar cal = new GregorianCalendar();
+        cal.add(Calendar.DAY_OF_YEAR, Integer.parseInt(valid));
+        request.setAttribute("validTo", sdf.format(cal.getTime()));
+        request.setAttribute("certCN", certCN);
+        request.setAttribute("certOU", certOU);
+        request.setAttribute("certO", certO);
+        request.setAttribute("certL", certL);
+        request.setAttribute("certST", certST);
+        request.setAttribute("certC", certC);
+    }
+
+    public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+        String keystore = request.getParameter("keystore");
+        String alias = request.getParameter("alias");
+        String password = request.getParameter("password");
+        String keySize = request.getParameter("keySize");
+        String algorithm = request.getParameter("algorithm");
+        String valid = request.getParameter("valid");
+        String certCN = request.getParameter("certCN");
+        String certOU = request.getParameter("certOU");
+        String certO = request.getParameter("certO");
+        String certL = request.getParameter("certL");
+        String certST = request.getParameter("certST");
+        String certC = request.getParameter("certC");
+
+        KeystoreData data = ((KeystoreData) request.getPortletSession(true).getAttribute(KEYSTORE_DATA_PREFIX + keystore));
+        if(!data.createKeyPair(alias, password, "RSA", Integer.parseInt(keySize), algorithm, Integer.parseInt(valid),
+                certCN, certOU, certO, certL, certST, certC)) {
+            ConfirmKeyHandler.log.error("Unable to import certificate");
+        }
+        response.setRenderParameter("id", keystore);
+        return VIEW_KEYSTORE+BEFORE_ACTION;
+    }
+}

Propchange: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/ConfirmKeyHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native