geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
Subject svn commit: r394030 [1/3] - in /geronimo/branches/1.1: applications/console-core/src/java/org/apache/geronimo/console/util/ applications/console-framework/src/webapp/WEB-INF/data/ applications/console-standard/src/java/org/apache/geronimo/console/ appl...
Date Fri, 14 Apr 2006 06:30:51 GMT
Author: ammulder
Date: Thu Apr 13 23:30:38 2006
New Revision: 394030

URL: http://svn.apache.org/viewcvs?rev=394030&view=rev
Log:
Finish the merge of keystore features and configuration import/export to 1.1

Added:
    geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/
      - copied from r388671, geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/
    geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/BaseImportExportHandler.java
      - copied, changed from r388671, geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/BaseImportExportHandler.java
    geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/CARExportServlet.java
      - copied, changed from r388671, geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/CARExportServlet.java
    geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/DownloadCARHandler.java
      - copied, changed from r388671, geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/DownloadCARHandler.java
    geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/GeronimoAsMavenServlet.java
      - copied, changed from r390687, geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/GeronimoAsMavenServlet.java
    geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/ImportExportPortlet.java
      - copied unchanged from r388671, geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/ImportExportPortlet.java
    geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/IndexHandler.java
      - copied, changed from r388671, geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/IndexHandler.java
    geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/ListHandler.java
      - copied, changed from r388671, geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/ListHandler.java
    geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/ResultsHandler.java
      - copied, changed from r388671, geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/ResultsHandler.java
    geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/keystores/EditKeystoreHandler.java
      - copied unchanged from r389206, geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/EditKeystoreHandler.java
    geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/keystores/LockEditKeystoreHandler.java
      - copied unchanged from r389206, geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/LockEditKeystoreHandler.java
    geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/keystores/LockKeystoreHandler.java
      - copied unchanged from r389206, geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/LockKeystoreHandler.java
    geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/keystores/UnlockKeyHandler.java
      - copied, changed from r389206, geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/UnlockKeyHandler.java
    geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/car/
      - copied from r388671, geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/
    geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/car/download.jsp
      - copied, changed from r388671, geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/download.jsp
    geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/car/index.jsp
      - copied, changed from r388671, geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/index.jsp
    geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/car/list.jsp
      - copied, changed from r388671, geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/list.jsp
    geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/car/results.jsp
      - copied, changed from r388671, geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/results.jsp
    geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/keystore/unlockKey.jsp
      - copied unchanged from r389206, geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/keystore/unlockKey.jsp
    geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/GeronimoDeploymentManager.java   (with props)
    geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandListConfigurations.java   (with props)
    geronimo/branches/1.1/modules/jetty/src/java/org/apache/geronimo/jetty/connector/GeronimoSSLListener.java
      - copied, changed from r389206, geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/GeronimoSSLListener.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/NullConfigurationStore.java   (with props)
    geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigInstallerGBean.java   (with props)
    geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationInstaller.java   (with props)
    geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationMetadata.java   (with props)
    geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/DownloadResults.java   (with props)
    geronimo/branches/1.1/modules/system/src/schema/config-list.xsd
      - copied unchanged from r390687, geronimo/trunk/modules/system/src/schema/config-list.xsd
Removed:
    geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/keystore/KeyIsLocked.java
    geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/keystore/KeystoreInstance.java
    geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/keystore/KeystoreIsLocked.java
    geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/keystore/KeystoreManager.java
Modified:
    geronimo/branches/1.1/applications/console-core/src/java/org/apache/geronimo/console/util/KernelManagementHelper.java
    geronimo/branches/1.1/applications/console-framework/src/webapp/WEB-INF/data/pageregistry.xml
    geronimo/branches/1.1/applications/console-framework/src/webapp/WEB-INF/data/portletentityregistry.xml
    geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/MultiPagePortlet.java
    geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/keystores/BaseKeystoreHandler.java
    geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/keystores/KeystoresPortlet.java
    geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/keystores/ListHandler.java
    geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/keystores/UnlockKeystoreHandler.java
    geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/webmanager/ConnectorPortlet.java
    geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/portlet.xml
    geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/keystore/index.jsp
    geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/keystore/unlockKeystore.jsp
    geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/webmanager/connector/editHTTPS.jsp
    geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/web.xml
    geronimo/branches/1.1/assemblies/j2ee-installer/src/var/config/config.xml
    geronimo/branches/1.1/assemblies/j2ee-jetty-server/src/var/config/config.xml
    geronimo/branches/1.1/assemblies/j2ee-tomcat-server/src/var/config/config.xml
    geronimo/branches/1.1/configs/client-system/src/plan/plan.xml
    geronimo/branches/1.1/configs/j2ee-system/src/plan/plan.xml
    geronimo/branches/1.1/configs/jetty/project.xml
    geronimo/branches/1.1/configs/jetty/src/plan/plan.xml
    geronimo/branches/1.1/configs/rmi-naming/src/plan/plan.xml
    geronimo/branches/1.1/configs/tomcat/src/plan/plan.xml
    geronimo/branches/1.1/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
    geronimo/branches/1.1/modules/deploy-jsr88/project.xml
    geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/TargetImpl.java
    geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/jmx/JMXDeploymentManager.java
    geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java
    geronimo/branches/1.1/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java
    geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/PluginBootstrap.java
    geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/DeployTool.java
    geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTest.java
    geronimo/branches/1.1/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/J2EEServerImpl.java
    geronimo/branches/1.1/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java
    geronimo/branches/1.1/modules/jetty/src/java/org/apache/geronimo/jetty/JettyManagerImpl.java
    geronimo/branches/1.1/modules/jetty/src/java/org/apache/geronimo/jetty/JettySecureConnector.java
    geronimo/branches/1.1/modules/jetty/src/java/org/apache/geronimo/jetty/connector/HTTPSConnector.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Dependency.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/repository/Environment.java
    geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/config/ConfigurationManagerTest.java
    geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/repository/ArtifactResolverTest.java
    geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/J2EEServer.java
    geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/KeystoreInstance.java
    geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/KeystoreManager.java
    geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/keystore/FileKeystoreInstance.java
    geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/keystore/FileKeystoreManager.java
    geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java
    geronimo/branches/1.1/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java

Modified: geronimo/branches/1.1/applications/console-core/src/java/org/apache/geronimo/console/util/KernelManagementHelper.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-core/src/java/org/apache/geronimo/console/util/KernelManagementHelper.java?rev=394030&r1=394029&r2=394030&view=diff
==============================================================================
--- geronimo/branches/1.1/applications/console-core/src/java/org/apache/geronimo/console/util/KernelManagementHelper.java (original)
+++ geronimo/branches/1.1/applications/console-core/src/java/org/apache/geronimo/console/util/KernelManagementHelper.java Thu Apr 13 23:30:38 2006
@@ -763,7 +763,7 @@
         List stores = mgr.listStores();
         List results = new ArrayList();
         for (Iterator i = stores.iterator(); i.hasNext();) {
-            ObjectName storeName = (ObjectName) i.next();
+            AbstractName storeName = (AbstractName) i.next();
             try {
                 List infos = mgr.listConfigurations(storeName);
                 for (Iterator j = infos.iterator(); j.hasNext();) {

Modified: geronimo/branches/1.1/applications/console-framework/src/webapp/WEB-INF/data/pageregistry.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-framework/src/webapp/WEB-INF/data/pageregistry.xml?rev=394030&r1=394029&r2=394030&view=diff
==============================================================================
--- geronimo/branches/1.1/applications/console-framework/src/webapp/WEB-INF/data/pageregistry.xml (original)
+++ geronimo/branches/1.1/applications/console-framework/src/webapp/WEB-INF/data/pageregistry.xml Thu Apr 13 23:30:38 2006
@@ -459,6 +459,21 @@
             </fragment>
         </fragment>
 
+        <fragment name="import" type="page">
+            <navigation>
+                <title>Plugins</title>
+                <description>ico_list_16x16.gif Import and export plugins (configurations) 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.70"/>
+                    </fragment>
+                </fragment>
+            </fragment>
+        </fragment>
+
     </fragment>
 
     <fragment name="Security" type="page">

Modified: geronimo/branches/1.1/applications/console-framework/src/webapp/WEB-INF/data/portletentityregistry.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-framework/src/webapp/WEB-INF/data/portletentityregistry.xml?rev=394030&r1=394029&r2=394030&view=diff
==============================================================================
--- geronimo/branches/1.1/applications/console-framework/src/webapp/WEB-INF/data/portletentityregistry.xml (original)
+++ geronimo/branches/1.1/applications/console-framework/src/webapp/WEB-INF/data/portletentityregistry.xml Thu Apr 13 23:30:38 2006
@@ -145,7 +145,9 @@
         <portlet id="69">
             <definition-id>console-standard.Keystores</definition-id>
         </portlet>
-
+        <portlet id="70">
+            <definition-id>console-standard.ImportExport</definition-id>
+        </portlet>
         <!-- Leave some free numbers for the portlets that are in HEAD but not 1.1 yet -->
         <portlet id="80">
             <definition-id>console-standard.ThreadPool</definition-id>

Modified: geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/MultiPagePortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/MultiPagePortlet.java?rev=394030&r1=394029&r2=394030&view=diff
==============================================================================
--- geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/MultiPagePortlet.java (original)
+++ geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/MultiPagePortlet.java Thu Apr 13 23:30:38 2006
@@ -123,7 +123,9 @@
         if(mode != null) {
             actionResponse.setRenderParameter(MODE_KEY, mode);
         }
-        model.save(actionResponse, actionRequest.getPortletSession(true));
+        if(model != null) {
+            model.save(actionResponse, actionRequest.getPortletSession(true));
+        }
     }
 
     protected void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException {
@@ -158,8 +160,8 @@
     }
 
     protected String getDefaultMode() {
-        if(helpers.containsKey("list")) return "list";
         if(helpers.containsKey("index")) return "index";
+        if(helpers.containsKey("list")) return "list";
         return null;
     }
 

Copied: geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/BaseImportExportHandler.java (from r388671, geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/BaseImportExportHandler.java)
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/BaseImportExportHandler.java?p2=geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/BaseImportExportHandler.java&p1=geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/BaseImportExportHandler.java&r1=388671&r2=394030&rev=394030&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/BaseImportExportHandler.java (original)
+++ geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/BaseImportExportHandler.java Thu Apr 13 23:30:38 2006
@@ -17,25 +17,6 @@
 package org.apache.geronimo.console.car;
 
 import org.apache.geronimo.console.MultiPageAbstractHandler;
-import org.apache.geronimo.console.MultiPageModel;
-import org.apache.geronimo.console.keystores.BaseKeystoreHandler;
-import org.apache.geronimo.security.keystore.KeystoreInstance;
-import org.apache.geronimo.util.CertificateUtil;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.portlet.PortletRequest;
-import javax.portlet.ActionResponse;
-import java.io.Serializable;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import java.io.FileInputStream;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Collection;
-import java.security.cert.CertificateException;
-import java.security.cert.CertificateFactory;
-import java.security.cert.X509Certificate;
 
 /**
  * The base class for all handlers for this portlet
@@ -43,7 +24,6 @@
  * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
  */
 public abstract class BaseImportExportHandler extends MultiPageAbstractHandler {
-    private final static Log log = LogFactory.getLog(BaseImportExportHandler.class);
     protected static final String INDEX_MODE = "index";
     protected static final String LIST_MODE = "list";
     protected static final String DOWNLOAD_MODE = "download";

Copied: geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/CARExportServlet.java (from r388671, geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/CARExportServlet.java)
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/CARExportServlet.java?p2=geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/CARExportServlet.java&p1=geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/CARExportServlet.java&r1=388671&r2=394030&rev=394030&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/CARExportServlet.java (original)
+++ geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/CARExportServlet.java Thu Apr 13 23:30:38 2006
@@ -18,19 +18,17 @@
 
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.KernelRegistry;
+import org.apache.geronimo.kernel.config.ConfigurationManager;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
-import org.apache.geronimo.gbean.GBeanQuery;
-import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.kernel.config.ConfigurationUtil;
+import org.apache.geronimo.kernel.config.NoSuchConfigException;
+import org.apache.geronimo.kernel.repository.Artifact;
 
+import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import javax.servlet.ServletException;
-import javax.management.ObjectName;
 import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Set;
-import java.util.Iterator;
 
 /**
  * Servlet that lets you download a CAR from the repository
@@ -43,21 +41,15 @@
         if(configId == null) {
             throw new ServletException("No configId specified for CAR download");
         }
+        Artifact artifact = Artifact.create(configId);
         Kernel kernel = KernelRegistry.getSingleKernel();
-        Set set = kernel.listGBeans(new GBeanQuery(null, ConfigurationStore.class.getName()));
-        for (Iterator it = set.iterator(); it.hasNext();) {
-            ObjectName name = (ObjectName) it.next();
-            if(name.getKeyProperty(NameFactory.J2EE_NAME).equals("Local")) {
-                response.setContentType("application/zip");
-                try {
-                    kernel.invoke(name, "exportConfiguration", new Object[]{configId, response.getOutputStream()}, new String[]{String.class.getName(), OutputStream.class.getName()});
-                    return;
-                } catch (Exception e) {
-                    throw new IOException("Unable to write ZIP file: "+e.getMessage());
-                }
-            }
+        ConfigurationManager mgr = ConfigurationUtil.getConfigurationManager(kernel);
+        ConfigurationStore store = mgr.getStoreForConfiguration(artifact);
+        try {
+            response.setContentType("application/zip");
+            store.exportConfiguration(artifact, response.getOutputStream());
+        } catch (NoSuchConfigException e) {
+            throw new ServletException("No such configuration '"+configId+"'");
         }
-        response.setContentType("text/html");
-        response.getWriter().println("<html><body><p>Error: no LocalConfigStore found in kernel</p></body></html>");
     }
 }

Copied: geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/DownloadCARHandler.java (from r388671, geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/DownloadCARHandler.java)
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/DownloadCARHandler.java?p2=geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/DownloadCARHandler.java&p1=geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/DownloadCARHandler.java&r1=388671&r2=394030&rev=394030&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/DownloadCARHandler.java (original)
+++ geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/DownloadCARHandler.java Thu Apr 13 23:30:38 2006
@@ -16,40 +16,23 @@
  */
 package org.apache.geronimo.console.car;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.geronimo.console.MultiPageModel;
-import org.apache.geronimo.console.util.PortletManager;
-import org.apache.geronimo.gbean.GBeanData;
-import org.apache.geronimo.gbean.GBeanQuery;
-import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.kernel.KernelRegistry;
-import org.apache.geronimo.kernel.config.ConfigurationStore;
-import org.apache.geronimo.kernel.repository.Repository;
-import org.apache.geronimo.kernel.repository.WriteableRepository;
-
-import javax.management.ObjectName;
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.PortletException;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import java.io.File;
-import java.io.FileOutputStream;
 import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
 import java.io.Serializable;
-import java.net.URI;
-import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
-import java.util.Set;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.console.MultiPageModel;
+import org.apache.geronimo.console.util.PortletManager;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.system.configuration.ConfigurationMetadata;
+import org.apache.geronimo.system.configuration.DownloadResults;
 
 /**
  * Handler for the initial download screen.
@@ -66,16 +49,12 @@
     public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
         String configId = request.getParameter("configId");
         String repo = request.getParameter("repository");
-        if(!repo.endsWith("/")) {
-            repo += "/";
-        }
-        String url = getURL(configId, repo);
-        File file = File.createTempFile("geronimo-download", "." + configId.substring(configId.lastIndexOf("/")+1));
-        file.deleteOnExit();
-        downloadFile(url, file);
+        String user = request.getParameter("repo-user");
+        String pass = request.getParameter("repo-pass");
         response.setRenderParameter("configId", configId);
-        response.setRenderParameter("file", file.getAbsolutePath());
         response.setRenderParameter("repository", repo);
+        if(!isEmpty(user)) response.setRenderParameter("repo-user", user);
+        if(!isEmpty(pass)) response.setRenderParameter("repo-pass", pass);
 
         return getMode();
     }
@@ -83,139 +62,49 @@
     public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException {
         String configId = request.getParameter("configId");
         String repo = request.getParameter("repository");
-        File file = new File(request.getParameter("file"));
-        ZipFile zip = new ZipFile(file);
-        try {
-            ZipEntry entry = zip.getEntry("META-INF/config.ser");
-            ObjectInputStream serIn = new ObjectInputStream(zip.getInputStream(entry));
-            GBeanData config = new GBeanData();
-            config.readExternal(serIn);
-            URI[] parentIds = (URI[]) config.getAttribute("parentId");
-            List dependencies = (List) config.getAttribute("dependencies");
-            request.setAttribute("file", file.getAbsolutePath());
-            request.setAttribute("configId", configId);
-            request.setAttribute("parents", parentIds);
-            request.setAttribute("dependencies", dependencies);
-            request.setAttribute("repository", repo);
-        } catch (ClassNotFoundException e) {
-            throw new PortletException("Unable to deserialize GBeanData", e);
-        } finally {
-            zip.close();
-        }
+        String user = request.getParameter("repo-user");
+        String pass = request.getParameter("repo-pass");
+        ConfigurationMetadata config;
+        config = PortletManager.getCurrentServer(request).getConfigurationInstaller().loadDependencies(new URL(repo), user, pass, new ConfigurationMetadata(Artifact.create(configId), null, null, false, false));
+        request.setAttribute("configId", configId);
+        request.setAttribute("dependencies", config.getDependencies());
+        request.setAttribute("repository", repo);
+        request.setAttribute("repouser", user);
+        request.setAttribute("repopass", pass);
     }
 
     public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
         String repo = request.getParameter("repository");
+        String user = request.getParameter("repo-user");
+        String pass = request.getParameter("repo-pass");
         boolean proceed = Boolean.valueOf(request.getParameter("proceed")).booleanValue();
         if(proceed) {
             String configId = request.getParameter("configId");
-            File file = new File(request.getParameter("file"));
-
-            WriteableRepository[] repos = PortletManager.getWritableRepositories(request);
-            if(repos.length < 1) {
-                throw new PortletException("No writeable repository available in kernel");
+            DownloadResults results;
+            results = PortletManager.getCurrentServer(request).getConfigurationInstaller().install(new URL(repo), user, pass, Artifact.create(configId));
+            List dependencies = new ArrayList();
+            for (int i = 0; i < results.getDependenciesInstalled().length; i++) {
+                Artifact uri = results.getDependenciesInstalled()[i];
+                dependencies.add(new InstallResults(uri.toString(), "installed"));
+            }
+            for (int i = 0; i < results.getDependenciesPresent().length; i++) {
+                Artifact uri = results.getDependenciesPresent()[i];
+                dependencies.add(new InstallResults(uri.toString(), "already present"));
             }
-            List configs = new ArrayList();
-            List deps = new ArrayList();
-            downloadConfiguration(file, repos[0], repo, configs, deps);
-            request.getPortletSession(true).setAttribute("car.install.configurations", configs);
-            request.getPortletSession(true).setAttribute("car.install.dependencies", deps);
+            request.getPortletSession(true).setAttribute("car.install.results", dependencies);
             response.setRenderParameter("configId", configId);
+            response.setRenderParameter("repository", repo);
+            if(!isEmpty(user)) response.setRenderParameter("repo-user", user);
+            if(!isEmpty(pass)) response.setRenderParameter("repo-pass", pass);
         }
         return RESULTS_MODE+BEFORE_ACTION;
     }
 
-    private void downloadConfiguration(File file, WriteableRepository repo, String repoURL, List configResults, List dependencyResults) throws IOException, PortletException {
-        Kernel kernel = KernelRegistry.getSingleKernel();
-        Set set = kernel.listGBeans(new GBeanQuery(null, ConfigurationStore.class.getName()));
-        ConfigurationStore stores[] = new ConfigurationStore[set.size()];
-        int index = 0;
-        for (Iterator it = set.iterator(); it.hasNext(); ++index) {
-            ObjectName name = (ObjectName) it.next();
-            stores[index] = (ConfigurationStore) kernel.getProxyManager().createProxy(name, ConfigurationStore.class);
-        }
-        ZipFile zip = new ZipFile(file);
-        try {
-            ZipEntry entry = zip.getEntry("META-INF/config.ser");
-            ObjectInputStream serIn = new ObjectInputStream(zip.getInputStream(entry));
-            GBeanData config = new GBeanData();
-            config.readExternal(serIn);
-            URI[] parentIds = (URI[]) config.getAttribute("parentId");
-            List dependencies = (List) config.getAttribute("dependencies");
-            // Download the dependencies
-            for (int i = 0; i < dependencies.size(); i++) {
-                URI dep = (URI) dependencies.get(i);
-                if(((Repository)repo).hasURI(dep)) {
-                    dependencyResults.add(new DownloadResults(dep.toString(), "already present"));
-                    continue;
-                }
-                String url = getURL(dep.toString(), repoURL);
-                log.info("Downloading "+url+" to local repository");
-                repo.copyToRepository(new URL(url).openStream(), dep, null);
-                dependencyResults.add(new DownloadResults(dep.toString(), "downloaded and installed"));
-            }
-            // Download the parents
-            parents:
-            for (int i = 0; i < parentIds.length; i++) {
-                String id = parentIds[i].toString();
-                URI uri = new URI(id);
-                for (int j = 0; j < stores.length; j++) {
-                    ConfigurationStore store = stores[j];
-                    if(store.containsConfiguration(uri)) {
-                        configResults.add(new DownloadResults(uri.toString(), "already present"));
-                        continue parents;
-                    }
-                }
-                File next = File.createTempFile("geronimo-download", "." + id.substring(id.lastIndexOf("/")+1));
-                file.deleteOnExit();
-                String url = getURL(id, repoURL);
-                downloadFile(url, next);
-                downloadConfiguration(next, repo, repoURL, configResults, dependencyResults);
-            }
-            // Install the configuration
-            for (Iterator it = set.iterator(); it.hasNext();) {
-                ObjectName name = (ObjectName) it.next();
-                if(name.getKeyProperty(NameFactory.J2EE_NAME).equals("Local")) {
-                    try {
-                        URI uri = (URI)kernel.invoke(name, "install", new Object[]{file.toURL()}, new String[]{URL.class.getName()});
-                        configResults.add(new DownloadResults(uri.toString(), "downloaded and installed"));
-                    } catch (Exception e) {
-                        throw new IOException("Unable to write ZIP file: "+e.getMessage());
-                    }
-                }
-            }
-        } catch (URISyntaxException e) {
-            throw new PortletException("Unable to process parent configurations", e);
-        } catch (ClassNotFoundException e) {
-            throw new PortletException("Unable to deserialize GBeanData", e);
-        } finally {
-            zip.close();
-        }
-    }
-
-    private String getURL(String configId, String baseRepositoryURL) {
-        String[] parts = configId.split("/");
-        return baseRepositoryURL+parts[0]+"/"+parts[3]+"s/"+parts[1]+"-"+parts[2]+"."+parts[3];
-    }
-
-    private void downloadFile(String url, File target) throws IOException {
-        log.info("Downloading "+url+" to "+target.getAbsolutePath());
-        byte[] buf = new byte[10240];
-        InputStream in = new URL(url).openStream();
-        FileOutputStream out = new FileOutputStream(target);
-        int count;
-        while((count = in.read(buf)) > -1) {
-            out.write(buf, 0, count);
-        }
-        in.close();
-        out.close();
-    }
-
-    public static class DownloadResults implements Serializable {
+    public static class InstallResults implements Serializable {
         private String name;
         private String action;
 
-        public DownloadResults(String name, String action) {
+        public InstallResults(String name, String action) {
             this.name = name;
             this.action = action;
         }

Copied: geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/GeronimoAsMavenServlet.java (from r390687, geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/GeronimoAsMavenServlet.java)
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/GeronimoAsMavenServlet.java?p2=geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/GeronimoAsMavenServlet.java&p1=geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/GeronimoAsMavenServlet.java&r1=390687&r2=394030&rev=394030&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/GeronimoAsMavenServlet.java (original)
+++ geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/GeronimoAsMavenServlet.java Thu Apr 13 23:30:38 2006
@@ -16,50 +16,49 @@
  */
 package org.apache.geronimo.console.car;
 
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import javax.management.ObjectName;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.console.util.KernelManagementHelper;
+import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.KernelRegistry;
-import org.apache.geronimo.kernel.repository.Repository;
-import org.apache.geronimo.kernel.config.ConfigurationStore;
+import org.apache.geronimo.kernel.config.ConfigurationInfo;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.kernel.config.ConfigurationUtil;
-import org.apache.geronimo.kernel.config.ConfigurationInfo;
 import org.apache.geronimo.kernel.config.NoSuchStoreException;
-import org.apache.geronimo.gbean.GBeanQuery;
-import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.apache.geronimo.console.util.KernelManagementHelper;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
-import org.w3c.dom.Node;
 import org.w3c.dom.Text;
 
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.ServletException;
-import javax.management.ObjectName;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.dom.DOMSource;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.io.File;
-import java.io.InputStream;
-import java.util.Set;
-import java.util.Iterator;
-import java.util.List;
-import java.net.URI;
-import java.net.URL;
-import java.net.URISyntaxException;
-
 /**
  * Servlet that lets you download a CAR from the repository
  *
@@ -102,23 +101,21 @@
             }
             String artifactId = parts[2].substring(0, pos);
             String configId = groupId+"/"+artifactId+"/"+version+"/"+type;
-            try {
-                if(!produceDownloadFile(kernel, new URI(configId), response)) {
-                    response.sendError(404, "Cannot locate download file "+path);
-                }
-            } catch (URISyntaxException e) {
-                response.sendError(404, "Unable to compose path as URI "+path);
+            if(!produceDownloadFile(kernel, Artifact.create(configId), response)) {
+                response.sendError(404, "Cannot locate download file "+path);
             }
         }
     }
 
-    private boolean produceDownloadFile(Kernel kernel, URI configId, HttpServletResponse response) throws IOException {
+    private boolean produceDownloadFile(Kernel kernel, Artifact configId, HttpServletResponse response) throws IOException {
+        //todo: replace kernel mumbo jumbo with JSR-77 navigation
         // Step 1: check if it's in a configuration store
         ConfigurationManager mgr = ConfigurationUtil.getConfigurationManager(kernel);
         List stores = mgr.listStores();
         for (int i = 0; i < stores.size(); i++) {
-            ObjectName name = (ObjectName) stores.get(i);
-            if(name.getKeyProperty(NameFactory.J2EE_NAME).equals("Local")) {
+            AbstractName name = (AbstractName) stores.get(i);
+            //todo: this is bad!!!
+            if(name.getName().get(NameFactory.J2EE_NAME).equals("Local")) {
                 ConfigurationStore store = (ConfigurationStore) kernel.getProxyManager().createProxy(name, ConfigurationStore.class);
                 if(store.containsConfiguration(configId)) {
                     response.setContentType("application/zip");
@@ -133,19 +130,16 @@
             }
         }
         // Step 2: check if it's in a repository
-        Set repos = kernel.listGBeans(new GBeanQuery(null, Repository.class.getName()));
+        Set repos = kernel.listGBeans(new AbstractNameQuery(Repository.class.getName()));
         for (Iterator it = repos.iterator(); it.hasNext();) {
             ObjectName name = (ObjectName) it.next();
             Repository repo = (Repository) kernel.getProxyManager().createProxy(name, Repository.class);
-            if(repo.hasURI(configId)) {
-                URL path = repo.getURL(configId);
-                InputStream in = path.openStream();
+            if(repo.contains(configId)) {
+                File path = repo.getLocation(configId);
+                if(!path.exists()) throw new IllegalStateException("Can't check length of file '"+path.getAbsolutePath()+"'");
+                InputStream in = new BufferedInputStream(new FileInputStream(path));
                 response.setContentType("application/zip");
-                if(path.getProtocol().equals("file")) {
-                    File file = new File(path.getPath());
-                    if(!file.exists()) throw new IllegalStateException("Can't check length of file '"+file.getAbsolutePath()+"'");
-                    response.setContentLength((int)file.length());
-                }
+                response.setContentLength((int)path.length());
                 OutputStream out = response.getOutputStream();
                 byte[] buf = new byte[1024];
                 int count;
@@ -162,7 +156,7 @@
 
     private void generateConfigFile(Kernel kernel, PrintWriter out) throws ParserConfigurationException, NoSuchStoreException, TransformerException {
         KernelManagementHelper helper = new KernelManagementHelper(kernel);
-        ServerInfo serverInfo = helper.getServerInfo(helper.getServers(helper.getDomains()[0])[0]);
+        ServerInfo serverInfo = helper.getServers(helper.getDomains()[0])[0].getServerInfo();
         String version = serverInfo.getVersion();
         ConfigurationManager mgr = ConfigurationUtil.getConfigurationManager(kernel);
         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
@@ -172,7 +166,7 @@
         doc.appendChild(root);
         List stores = mgr.listStores();
         for (int i = 0; i < stores.size(); i++) {
-            ObjectName name = (ObjectName) stores.get(i);
+            AbstractName name = (AbstractName) stores.get(i);
             List configs = mgr.listConfigurations(name);
             for (int j = 0; j < configs.size(); j++) {
                 ConfigurationInfo info = (ConfigurationInfo) configs.get(j);

Copied: geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/IndexHandler.java (from r388671, geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/IndexHandler.java)
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/IndexHandler.java?p2=geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/IndexHandler.java&p1=geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/IndexHandler.java&r1=388671&r2=394030&rev=394030&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/IndexHandler.java (original)
+++ geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/IndexHandler.java Thu Apr 13 23:30:38 2006
@@ -16,16 +16,15 @@
  */
 package org.apache.geronimo.console.car;
 
-import org.apache.geronimo.console.MultiPageModel;
-import org.apache.geronimo.console.util.PortletManager;
-import org.apache.geronimo.kernel.config.ConfigurationInfo;
-
+import java.io.IOException;
 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 org.apache.geronimo.console.MultiPageModel;
+import org.apache.geronimo.console.util.ConfigurationData;
+import org.apache.geronimo.console.util.PortletManager;
 
 /**
  * Handler for the import export main screen.
@@ -42,12 +41,14 @@
     }
 
     public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException {
-        ConfigurationInfo[] configs = PortletManager.getConfigurations(request, null, false);
+        ConfigurationData[] configs = PortletManager.getConfigurations(request, null, false);
         request.setAttribute("configurations", configs);
     }
 
     public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
         request.setAttribute("repository", request.getParameter("repository"));
+        request.setAttribute("repo-user", request.getParameter("username"));
+        request.setAttribute("repo-pass", request.getParameter("password"));
         return LIST_MODE+BEFORE_ACTION;
     }
 }

Copied: geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/ListHandler.java (from r388671, geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/ListHandler.java)
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/ListHandler.java?p2=geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/ListHandler.java&p1=geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/ListHandler.java&r1=388671&r2=394030&rev=394030&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/ListHandler.java (original)
+++ geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/ListHandler.java Thu Apr 13 23:30:38 2006
@@ -16,32 +16,25 @@
  */
 package org.apache.geronimo.console.car;
 
-import org.apache.geronimo.console.keystores.BaseKeystoreHandler;
-import org.apache.geronimo.console.MultiPageModel;
-import org.apache.geronimo.console.util.PortletManager;
-import org.apache.geronimo.security.keystore.KeystoreManager;
-import org.apache.geronimo.kernel.config.ConfigurationInfo;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 import javax.portlet.ActionRequest;
 import javax.portlet.ActionResponse;
 import javax.portlet.PortletException;
 import javax.portlet.RenderRequest;
 import javax.portlet.RenderResponse;
-import javax.portlet.PortletSession;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Serializable;
-import java.net.URL;
-import java.util.Properties;
-import java.util.Map;
-import java.util.HashMap;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.console.MultiPageModel;
+import org.apache.geronimo.console.util.PortletManager;
+import org.apache.geronimo.system.configuration.ConfigurationMetadata;
+import java.util.Collections;
+import java.util.Collection;
 import java.util.Iterator;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Set;
-import java.util.HashSet;
 
 /**
  * Handler for the import export list screen.
@@ -61,78 +54,44 @@
             return INDEX_MODE+BEFORE_ACTION;
         }
         response.setRenderParameter("repository", repository);
+        String user = (String) request.getAttribute("repo-user");
+        String pass = (String) request.getAttribute("repo-pass");
+        if(!isEmpty(user)) response.setRenderParameter("repo-user", user);
+        if(!isEmpty(pass)) response.setRenderParameter("repo-pass", pass);
         return getMode();
     }
 
     public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException {
         String repository = request.getParameter("repository");
-        loadFromRepository(request, repository);
+        String user = request.getParameter("repo-user");
+        String pass = request.getParameter("repo-pass");
+        loadFromRepository(request, repository, user, pass);
         request.setAttribute("repository", repository);
+        request.setAttribute("repouser", user);
+        request.setAttribute("repopass", pass);
     }
 
     public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
         return getMode()+BEFORE_ACTION;
     }
 
-    private void loadFromRepository(RenderRequest request, String repository) throws IOException {
-        if(!repository.endsWith("/")) {
-            repository = repository+"/";
-        }
-        URL url = new URL(repository+"geronimo-configurations.properties");
-        Set set = new HashSet();
-        ConfigurationInfo[] installed = PortletManager.getConfigurations(request, null, false);
-        for (int i = 0; i < installed.length; i++) {
-            ConfigurationInfo info = installed[i];
-            set.add(info.getConfigID().toString());
-        }
-        InputStream in = url.openStream();
-        Properties props = new Properties();
-        props.load(in);
-        in.close();
+    private void loadFromRepository(RenderRequest request, String repository, String username, String password) throws IOException {
+        ConfigurationMetadata[] data = PortletManager.getCurrentServer(request).getConfigurationInstaller().listConfigurations(new URL(repository), username, password);
         Map results = new HashMap();
-        for (Iterator it = props.keySet().iterator(); it.hasNext();) {
-            String key = (String) it.next();
-            int pos = key.indexOf('.');
-            String type = key.substring(0, pos);
-            List values = (List) results.get(type);
+        for (int i = 0; i < data.length; i++) {
+            ConfigurationMetadata metadata = data[i];
+            List values = (List) results.get(metadata.getCategory());
             if(values == null) {
                 values = new ArrayList();
-                results.put(type, values);
+                results.put(metadata.getCategory(), values);
             }
-            String configId = key.substring(pos + 1);
-            values.add(new RepositoryEntry(configId, props.getProperty(key), set.contains(configId)));
+            values.add(metadata);
         }
-        request.setAttribute("categories", results);
-    }
-
-    public static class RepositoryEntry implements Serializable {
-        private String configId;
-        private String name;
-        private boolean installed;
-        private String version;
-
-        public RepositoryEntry(String configId, String name, boolean installed) {
-            this.configId = configId;
-            this.name = name;
-            this.installed = installed;
-            String[] parts = configId.split("/");
-            version = parts[2];
-        }
-
-        public String getConfigId() {
-            return configId;
-        }
-
-        public String getName() {
-            return name;
-        }
-
-        public boolean isInstalled() {
-            return installed;
-        }
-
-        public String getVersion() {
-            return version;
+        Collection values = results.values();
+        for (Iterator it = values.iterator(); it.hasNext();) {
+            List list = (List) it.next();
+            Collections.sort(list);
         }
+        request.setAttribute("categories", results);
     }
 }

Copied: geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/ResultsHandler.java (from r388671, geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/ResultsHandler.java)
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/ResultsHandler.java?p2=geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/ResultsHandler.java&p1=geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/ResultsHandler.java&r1=388671&r2=394030&rev=394030&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/ResultsHandler.java (original)
+++ geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/car/ResultsHandler.java Thu Apr 13 23:30:38 2006
@@ -16,44 +16,20 @@
  */
 package org.apache.geronimo.console.car;
 
+import java.io.IOException;
+import java.util.List;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.console.MultiPageModel;
-import org.apache.geronimo.console.util.PortletManager;
-import org.apache.geronimo.gbean.GBeanData;
-import org.apache.geronimo.gbean.GBeanQuery;
-import org.apache.geronimo.kernel.repository.WriteableRepository;
-import org.apache.geronimo.kernel.repository.Repository;
-import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.KernelRegistry;
-import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
 import org.apache.geronimo.kernel.config.ConfigurationUtil;
-import org.apache.geronimo.kernel.config.NoSuchConfigException;
-import org.apache.geronimo.kernel.config.InvalidConfigException;
-import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-
-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 java.io.IOException;
-import java.io.File;
-import java.io.ObjectInputStream;
-import java.io.InputStream;
-import java.io.FileOutputStream;
-import java.io.Serializable;
-import java.util.zip.ZipFile;
-import java.util.zip.ZipEntry;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Set;
-import java.util.Iterator;
-import java.net.URI;
-import java.net.URL;
-import java.net.URISyntaxException;
+import org.apache.geronimo.kernel.repository.Artifact;
 
 /**
  * Handler for the import results screen.
@@ -72,25 +48,35 @@
     }
 
     public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException {
+        String repo = request.getParameter("repository");
+        String user = request.getParameter("repo-user");
+        String pass = request.getParameter("repo-pass");
         String configId = request.getParameter("configId");
         request.setAttribute("configId", configId);
         List configs = (List) request.getPortletSession(true).getAttribute("car.install.configurations");
         List deps = (List) request.getPortletSession(true).getAttribute("car.install.dependencies");
         request.setAttribute("dependencies", deps);
         request.setAttribute("configurations", configs);
+        request.setAttribute("repository", repo);
+        request.setAttribute("repouser", user);
+        request.setAttribute("repopass", pass);
     }
 
     public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
         String configId = request.getParameter("configId");
+        String repo = request.getParameter("repository");
+        String user = request.getParameter("repo-user");
+        String pass = request.getParameter("repo-pass");
+        response.setRenderParameter("repository", repo);
+        if(!isEmpty(user)) response.setRenderParameter("repo-user", user);
+        if(!isEmpty(pass)) response.setRenderParameter("repo-pass", pass);
         try {
+            //todo: hide this in PortletManager/ManagementHelper
             ConfigurationManager mgr = ConfigurationUtil.getConfigurationManager(KernelRegistry.getSingleKernel());
-            List list = mgr.loadRecursive(new URI(configId));
-            for (Iterator it = list.iterator(); it.hasNext();) {
-                URI uri = (URI) it.next();
-                mgr.loadGBeans(uri);
-                mgr.start(uri);
-            }
-            return LIST_MODE+BEFORE_ACTION;
+            Artifact artifact = Artifact.create(configId);
+            mgr.loadConfiguration(artifact);
+            mgr.startConfiguration(artifact);
+            return LIST_MODE;
         } catch (Exception e) {
             log.error("Unable to start configuration "+configId, e);
             response.setRenderParameter("configId", configId);

Modified: geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/keystores/BaseKeystoreHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/keystores/BaseKeystoreHandler.java?rev=394030&r1=394029&r2=394030&view=diff
==============================================================================
--- geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/keystores/BaseKeystoreHandler.java (original)
+++ geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/keystores/BaseKeystoreHandler.java Thu Apr 13 23:30:38 2006
@@ -47,6 +47,7 @@
     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 UNLOCK_KEY = "unlockKey";
     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";
@@ -85,6 +86,11 @@
 
         public void setPassword(char[] password) {
             this.password = password;
+            if(password == null) { // If locking, clear all saved data
+                certificates = null;
+                keys = null;
+                fingerprints = null;
+            }
         }
 
         public boolean isLocked() {

Modified: geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/keystores/KeystoresPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/keystores/KeystoresPortlet.java?rev=394030&r1=394029&r2=394030&view=diff
==============================================================================
--- geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/keystores/KeystoresPortlet.java (original)
+++ geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/keystores/KeystoresPortlet.java Thu Apr 13 23:30:38 2006
@@ -32,6 +32,7 @@
     public void init(PortletConfig config) throws PortletException {
         super.init(config);
         addHelper(new ListHandler(), config);
+        addHelper(new EditKeystoreHandler(), config);
         addHelper(new UnlockKeystoreHandler(), config);
         addHelper(new CreateKeystoreHandler(), config);
         addHelper(new ViewKeystoreHandler(), config);
@@ -39,6 +40,9 @@
         addHelper(new ConfirmCertificateHandler(), config);
         addHelper(new ConfigureNewKeyHandler(), config);
         addHelper(new ConfirmKeyHandler(), config);
+        addHelper(new LockEditKeystoreHandler(), config);
+        addHelper(new LockKeystoreHandler(), config);
+        addHelper(new UnlockKeyHandler(), config);
     }
 
     protected String getModelJSPVariableName() {

Modified: geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/keystores/ListHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/keystores/ListHandler.java?rev=394030&r1=394029&r2=394030&view=diff
==============================================================================
--- geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/keystores/ListHandler.java (original)
+++ geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/keystores/ListHandler.java Thu Apr 13 23:30:38 2006
@@ -17,6 +17,8 @@
 package org.apache.geronimo.console.keystores;
 
 import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
 import javax.portlet.ActionRequest;
 import javax.portlet.ActionResponse;
 import javax.portlet.PortletException;
@@ -28,6 +30,7 @@
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.management.geronimo.KeystoreInstance;
+import org.apache.geronimo.management.geronimo.KeystoreIsLocked;
 import org.apache.geronimo.management.geronimo.KeystoreManager;
 
 /**
@@ -49,6 +52,7 @@
         KeystoreInstance[] keystores = manager.getKeystores();
         PortletSession session = request.getPortletSession(true);
         KeystoreData[] datas = new KeystoreData[keystores.length];
+        Map keys = new HashMap();
         for (int i = 0; i < datas.length; i++) {
             AbstractName aName = PortletManager.getNameFor(request, keystores[i]);
             String name = (String) aName.getName().get(NameFactory.J2EE_NAME);
@@ -59,8 +63,19 @@
                 session.setAttribute(KEYSTORE_DATA_PREFIX+name, data);
             }
             datas[i] = data;
+            if(!data.getInstance().isKeystoreLocked()) {
+                try {
+                    String[] all = data.getInstance().getUnlockedKeys();
+                    if(all.length > 0) {
+                        keys.put(data.getInstance().getKeystoreName(), all.length+" key"+(all.length > 1 ? "s" : "")+" ready");
+                    } else {
+                        keys.put(data.getInstance().getKeystoreName(), "NO KEYS READY");
+                    }
+                } catch (KeystoreIsLocked locked) {}
+            }
         }
         request.setAttribute("keystores", keystores);
+        request.setAttribute("keys", keys);
     }
 
     public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {

Copied: geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/keystores/UnlockKeyHandler.java (from r389206, geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/UnlockKeyHandler.java)
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/keystores/UnlockKeyHandler.java?p2=geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/keystores/UnlockKeyHandler.java&p1=geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/UnlockKeyHandler.java&r1=389206&r2=394030&rev=394030&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/keystores/UnlockKeyHandler.java (original)
+++ geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/keystores/UnlockKeyHandler.java Thu Apr 13 23:30:38 2006
@@ -17,7 +17,7 @@
 package org.apache.geronimo.console.keystores;
 
 import org.apache.geronimo.console.MultiPageModel;
-import org.apache.geronimo.security.keystore.KeystoreIsLocked;
+import org.apache.geronimo.management.geronimo.KeystoreIsLocked;
 
 import javax.portlet.ActionRequest;
 import javax.portlet.ActionResponse;

Modified: geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/keystores/UnlockKeystoreHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/keystores/UnlockKeystoreHandler.java?rev=394030&r1=394029&r2=394030&view=diff
==============================================================================
--- geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/keystores/UnlockKeystoreHandler.java (original)
+++ geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/keystores/UnlockKeystoreHandler.java Thu Apr 13 23:30:38 2006
@@ -17,6 +17,7 @@
 package org.apache.geronimo.console.keystores;
 
 import org.apache.geronimo.console.MultiPageModel;
+import org.apache.geronimo.management.geronimo.KeystoreIsLocked;
 
 import javax.portlet.ActionRequest;
 import javax.portlet.ActionResponse;
@@ -32,34 +33,50 @@
  */
 public class UnlockKeystoreHandler extends BaseKeystoreHandler {
     public UnlockKeystoreHandler() {
-        super(UNLOCK_KEYSTORE_FOR_EDITING, "/WEB-INF/view/keystore/unlockKeystore.jsp");
+        super(UNLOCK_KEYSTORE_FOR_USAGE, "/WEB-INF/view/keystore/unlockKeystore.jsp");
     }
 
     public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
-        String id = request.getParameter("id");
-        if(id != null) {
-            response.setRenderParameter("id", id);
+        String keystore = request.getParameter("keystore");
+        if(keystore != null) {
+            response.setRenderParameter("keystore", keystore);
         } // 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("id", request.getParameter("id"));
+        String keystore = request.getParameter("keystore");
+        request.setAttribute("keystore", keystore);
+        request.setAttribute("mode", "unlockKeystore");
+        KeystoreData data = ((KeystoreData) request.getPortletSession(true).getAttribute(KEYSTORE_DATA_PREFIX + keystore));
+        request.setAttribute("keys", data.getKeys());
     }
 
     public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
-        String id = request.getParameter("keystore");
+        String keystore = request.getParameter("keystore");
         String password = request.getParameter("password");
-        if(id == null || id.equals("")) {
+        String alias = request.getParameter("keyAlias");
+        String keyPassword = request.getParameter("keyPassword");
+        if(keystore == null || keystore.equals("")) {
             return getMode(); // todo: this is bad; if there's no ID, then the form on the page is just not valid!
         } else if(password == null) {
-            response.setRenderParameter("id", id);
+            response.setRenderParameter("keystore", keystore);
+            return getMode();
         }
-        KeystoreData data = ((KeystoreData) request.getPortletSession(true).getAttribute(KEYSTORE_DATA_PREFIX + id));
+        KeystoreData data = ((KeystoreData) request.getPortletSession(true).getAttribute(KEYSTORE_DATA_PREFIX + keystore));
         char[] storePass = password.toCharArray();
-        data.setPassword(storePass);
-        data.setCertificates(data.getInstance().listTrustCertificates(storePass));
-        data.setKeys(data.getInstance().listPrivateKeys(storePass));
+        data.getInstance().unlockKeystore(storePass);
+        if(data.getKeys() != null && data.getKeys().length > 0) {
+            try {
+                data.getInstance().unlockPrivateKey(alias, keyPassword.toCharArray());
+            } catch (KeystoreIsLocked e) {
+                throw new PortletException("Invalid password for keystore", e);
+            }
+        } else {
+            response.setRenderParameter("keystore", keystore);
+            response.setRenderParameter("password", password);
+            return UNLOCK_KEY+BEFORE_ACTION;
+        }
         return LIST_MODE+BEFORE_ACTION;
     }
 }

Modified: geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/webmanager/ConnectorPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/webmanager/ConnectorPortlet.java?rev=394030&r1=394029&r2=394030&view=diff
==============================================================================
--- geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/webmanager/ConnectorPortlet.java (original)
+++ geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/webmanager/ConnectorPortlet.java Thu Apr 13 23:30:38 2006
@@ -17,18 +17,12 @@
 
 package org.apache.geronimo.console.webmanager;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.geronimo.console.BasePortlet;
-import org.apache.geronimo.console.util.PortletManager;
-import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.apache.geronimo.kernel.proxy.GeronimoManagedBean;
-import org.apache.geronimo.management.geronimo.SecureConnector;
-import org.apache.geronimo.management.geronimo.WebConnector;
-import org.apache.geronimo.management.geronimo.WebContainer;
-import org.apache.geronimo.management.geronimo.WebManager;
-import org.apache.geronimo.gbean.AbstractName;
-
+import java.io.IOException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 import javax.portlet.ActionRequest;
@@ -40,10 +34,20 @@
 import javax.portlet.RenderRequest;
 import javax.portlet.RenderResponse;
 import javax.portlet.WindowState;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.net.URI;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.console.BasePortlet;
+import org.apache.geronimo.console.util.PortletManager;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.kernel.proxy.GeronimoManagedBean;
+import org.apache.geronimo.management.geronimo.KeystoreInstance;
+import org.apache.geronimo.management.geronimo.KeystoreIsLocked;
+import org.apache.geronimo.management.geronimo.KeystoreManager;
+import org.apache.geronimo.management.geronimo.SecureConnector;
+import org.apache.geronimo.management.geronimo.WebConnector;
+import org.apache.geronimo.management.geronimo.WebContainer;
+import org.apache.geronimo.management.geronimo.WebManager;
 
 /**
  * A portlet that lets you list, add, remove, start, stop, and edit web
@@ -64,14 +68,14 @@
     protected PortletRequestDispatcher editHttpsView;
 
     public void processAction(ActionRequest actionRequest,
-            ActionResponse actionResponse) throws PortletException, IOException {
+                              ActionResponse actionResponse) throws PortletException, IOException {
         String mode = actionRequest.getParameter("mode");
         String managerName = actionRequest.getParameter("managerObjectName");
         String containerName = actionRequest.getParameter("containerObjectName");
         if(managerName != null) actionResponse.setRenderParameter("managerObjectName", managerName);
         if(containerName != null) actionResponse.setRenderParameter("containerObjectName", containerName);
 
-        String server = null;
+        String server;
         if(containerName != null) {
             WebContainer container = PortletManager.getWebContainer(actionRequest, new AbstractName(URI.create(containerName)));
             server = getWebServerType(container.getClass());
@@ -103,11 +107,9 @@
                 if(minThreads != null) {
                     setProperty(connector, "minThreads", minThreads);
                 }
-            }
-            else if (server.equals(WEB_SERVER_TOMCAT)) {
+            } else if (server.equals(WEB_SERVER_TOMCAT)) {
                 //todo:   Any Tomcat specific processing?
-            }
-            else {
+            } else {
                 //todo:   Handle "should not occur" condition
             }
             if(protocol.equals(WebManager.PROTOCOL_HTTPS)) {
@@ -130,13 +132,33 @@
                 secure.setClientAuthRequired(clientAuth);
                 if(server.equals(WEB_SERVER_JETTY)) {
                     if(isValid(privateKeyPass)) {setProperty(secure, "keyPassword", privateKeyPass);}
-                }
-                else if (server.equals(WEB_SERVER_TOMCAT)) {
+                    String keyStore = actionRequest.getParameter("unlockKeyStore");
+                    setProperty(secure, "keyStore", keyStore);
+                    try {
+                        KeystoreInstance[] keystores = PortletManager.getCurrentServer(actionRequest).getKeystoreManager().getKeystores();
+
+                        String[] keys = null;
+                        for (int i = 0; i < keystores.length; i++) {
+                            KeystoreInstance keystore = keystores[i];
+                            if(keystore.getKeystoreName().equals(keyStore)) {
+                                keys = keystore.getUnlockedKeys();
+                            }
+                        }
+                        if(keys != null && keys.length == 1) {
+                            setProperty(secure, "keyAlias", keys[0]);
+                        } else {
+                            throw new PortletException("Cannot handle keystores with anything but 1 unlocked private key");
+                        }
+                    } catch (KeystoreIsLocked locked) {
+                        throw new PortletException(locked.getMessage());
+                    }
+                    String trustStore = actionRequest.getParameter("unlockTrustStore");
+                    if(isValid(trustStore)) {setProperty(secure, "trustStore", trustStore);}
+                } else if (server.equals(WEB_SERVER_TOMCAT)) {
                     if(isValid(truststoreType)) {setProperty(secure, "truststoreType", truststoreType);}
                     if(isValid(truststoreFile)) {setProperty(secure, "truststoreFileName", truststoreFile);}
                     if(isValid(truststorePass)) {setProperty(secure, "truststorePassword", truststorePass);}
-                }
-                else {
+                } else {
                     //todo:   Handle "should not occur" condition
                 }
             }
@@ -281,7 +303,7 @@
     }
 
     protected void doView(RenderRequest renderRequest,
-            RenderResponse renderResponse) throws IOException, PortletException {
+                          RenderResponse renderResponse) throws IOException, PortletException {
         if (WindowState.MINIMIZED.equals(renderRequest.getWindowState())) {
             return;
         }
@@ -309,6 +331,26 @@
                 renderRequest.setAttribute("maxThreads", "50");
                 if(server.equals(WEB_SERVER_JETTY)) {
                     renderRequest.setAttribute("minThreads", "10");
+                    KeystoreManager mgr = PortletManager.getCurrentServer(renderRequest).getKeystoreManager();
+                    KeystoreInstance[] stores = mgr.getUnlockedKeyStores();
+                    String[] storeNames = new String[stores.length];
+                    for (int i = 0; i < storeNames.length; i++) {
+                        storeNames[i] = stores[i].getKeystoreName();
+                    }
+                    renderRequest.setAttribute("keyStores", storeNames);
+                    KeystoreInstance[] trusts = mgr.getUnlockedTrustStores();
+                    String[] trustNames = new String[trusts.length];
+                    for (int i = 0; i < trustNames.length; i++) {
+                        trustNames[i] = trusts[i].getKeystoreName();
+                    }
+                    renderRequest.setAttribute("trustStores", trustNames);
+                    Map aliases = new HashMap();
+                    for (int i = 0; i < stores.length; i++) {
+                        try {
+                            aliases.put(stores[i].getKeystoreName(), stores[i].getUnlockedKeys());
+                        } catch (KeystoreIsLocked locked) {}
+                    }
+                    renderRequest.setAttribute("unlockedKeys", aliases);
                 }
                 else if (server.equals(WEB_SERVER_TOMCAT)) {
                     //todo:   Any Tomcat specific processing?
@@ -500,7 +542,7 @@
     }
 
     protected void doHelp(RenderRequest renderRequest,
-            RenderResponse renderResponse) throws PortletException, IOException {
+                          RenderResponse renderResponse) throws PortletException, IOException {
         helpView.include(renderRequest, renderResponse);
     }
 

Modified: geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/portlet.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/portlet.xml?rev=394030&r1=394029&r2=394030&view=diff
==============================================================================
--- geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/portlet.xml (original)
+++ geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/portlet.xml Thu Apr 13 23:30:38 2006
@@ -1090,5 +1090,29 @@
         </portlet-info>
     </portlet>
 
+    <portlet>
+        <description>Portlet for CAR Import/Export</description>
+        <portlet-name>ImportExport</portlet-name>
+        <display-name>CAR Import/Export Portlet</display-name>
+
+        <portlet-class>org.apache.geronimo.console.car.ImportExportPortlet</portlet-class>
+
+        <expiration-cache>-1</expiration-cache>
+
+        <supports>
+            <mime-type>text/html</mime-type>
+            <portlet-mode>VIEW</portlet-mode>
+            <portlet-mode>HELP</portlet-mode>
+        </supports>
+
+        <supported-locale>en</supported-locale>
+
+        <portlet-info>
+            <title>Import/Export Configurations</title>
+            <short-title>Import/Export</short-title>
+            <keywords>Import Export CAR Configuration</keywords>
+        </portlet-info>
+    </portlet>
+
     <!-- End of console portlets -->
 </portlet-app>

Copied: geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/car/download.jsp (from r388671, geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/download.jsp)
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/car/download.jsp?p2=geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/car/download.jsp&p1=geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/download.jsp&r1=388671&r2=394030&rev=394030&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/download.jsp (original)
+++ geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/car/download.jsp Thu Apr 13 23:30:38 2006
@@ -25,6 +25,8 @@
     <input type="hidden" name="configId" value="${configId}" />
     <input type="hidden" name="mode" value="download-after" />
     <input type="hidden" name="repository" value="${repository}" />
+    <input type="hidden" name="repo-user" value="${repouser}" />
+    <input type="hidden" name="repo-pass" value="${repopass}" />
     <input type="hidden" name="proceed" value="true" />
     <input type="submit" value="Install Configuration" />
 </form>

Copied: geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/car/index.jsp (from r388671, geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/index.jsp)
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/car/index.jsp?p2=geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/car/index.jsp&p1=geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/index.jsp&r1=388671&r2=394030&rev=394030&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/index.jsp (original)
+++ geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/car/index.jsp Thu Apr 13 23:30:38 2006
@@ -8,7 +8,8 @@
 
 <h2>Export Configurations</h2>
 
-<p>Choose a configuration in the current Geronimo server to export:</p>
+<p>Choose a configuration in the current Geronimo server to export.  The configuration
+  will be saved as a CAR file to your local filesystem.</p>
 
 <form action="<%=request.getContextPath()%>/car-export">
     <select name="configId">
@@ -23,12 +24,19 @@
 <h2>Import Configurations</h2>
 
 <p>Choose a remote repository to inspect for available Geronimo configurations.  The
-repository must have a geronimo-configurations.properties file in the root directory
-listing the available configurations in the repository (this requirement should be
-relaxed in a future update).</p>
+repository must have a geronimo-configs.xml file in the root directory
+listing the available configurations in the repository.</p>
+
+<p>If you want to point to a remote Geronimo server, enter a URL such as
+<tt>http://geronimo-server:8080/console-standard/maven-repo/</tt> and the enter
+the administrator username and password in the optional authentication fields.</p>
 
 <form name="<portlet:namespace/>KeystoreForm" action="<portlet:actionURL/>">
     <input type="hidden" name="mode" value="index-after" />
-    Repository: <input type="text" name="repository" value="http://localhost/maven/" size="20" maxlength="200" />
+    Repository: <input type="text" name="repository" value="${repository}" size="20" maxlength="200" />
     <input type="submit" value="Search for Configurations" />
+    <br />Optional Authentication:
+       User: <input type="text" name="username" value="${repouser}" size="20" maxlength="200" />
+       Password: <input type="password" name="password" value="${repopass}" size="20" maxlength="200" />
+
 </form>

Copied: geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/car/list.jsp (from r388671, geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/list.jsp)
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/car/list.jsp?p2=geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/car/list.jsp&p1=geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/list.jsp&r1=388671&r2=394030&rev=394030&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/list.jsp (original)
+++ geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/car/list.jsp Thu Apr 13 23:30:38 2006
@@ -15,12 +15,14 @@
     <c:forEach var="entry" items="${category.value}">
       <c:choose>
         <c:when test="${entry.installed}">
-          <li>${entry.name}</li>
+          <li>${entry.description}</li>
         </c:when>
         <c:otherwise>
-          <li><a href="<portlet:actionURL><portlet:param name="configId" value="${entry.configId}"/><portlet:param name="repository" value="${repository}"/><portlet:param name="mode" value="download-before"/></portlet:actionURL>">${entry.name} (${entry.version})</a></li>
+          <li><a href="<portlet:actionURL><portlet:param name="configId" value="${entry.configId}"/><portlet:param name="repository" value="${repository}"/><portlet:param name="repo-user" value="${repouser}"/><portlet:param name="repo-pass" value="${repopass}"/><portlet:param name="mode" value="download-before"/></portlet:actionURL>">${entry.description}<c:if test="${entry.description ne entry.configId}"> (${entry.version})</c:if></a></li>
         </c:otherwise>
       </c:choose>
     </c:forEach>
   </ul>
 </c:forEach>
+
+<p><a href="<portlet:actionURL portletMode="view"><portlet:param name="mode" value="index-before" /></portlet:actionURL>">Cancel</a></p>

Copied: geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/car/results.jsp (from r388671, geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/results.jsp)
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/car/results.jsp?p2=geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/car/results.jsp&p1=geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/results.jsp&r1=388671&r2=394030&rev=394030&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/results.jsp (original)
+++ geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/car/results.jsp Thu Apr 13 23:30:38 2006
@@ -26,5 +26,8 @@
 <form name="<portlet:namespace/>KeystoreForm" action="<portlet:actionURL/>">
     <input type="hidden" name="mode" value="results-after" />
     <input type="hidden" name="configId" value="${configId}" />
+    <input type="hidden" name="repository" value="${repository}" />
+    <input type="hidden" name="repo-user" value="${repouser}" />
+    <input type="hidden" name="repo-pass" value="${repopass}" />
     <input type="submit" value="Start ${configId}" />
 </form>



Mime
View raw message