geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
Subject svn commit: r390687 - in /geronimo/trunk: applications/console-framework/src/webapp/WEB-INF/ applications/console-standard/src/java/org/apache/geronimo/console/car/ applications/console-standard/src/webapp/WEB-INF/ applications/console-standard/src/web...
Date Sat, 01 Apr 2006 15:54:05 GMT
Author: ammulder
Date: Sat Apr  1 07:54:02 2006
New Revision: 390687

URL: http://svn.apache.org/viewcvs?rev=390687&view=rev
Log:
Now one Geronimo server can pull configurations from another
 - Expose the contents of the Geronimo config-store & repository as a Maven
   repository.
 - Add an authentication option to the import configuration process.
 - Switch the configuration descriptor file to XML and add more detail

Added:
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/GeronimoAsMavenServlet.java   (with props)
    geronimo/trunk/modules/system/src/schema/config-list.xsd   (with props)
Modified:
    geronimo/trunk/applications/console-framework/src/webapp/WEB-INF/web.xml
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/DownloadCARHandler.java
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/IndexHandler.java
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/ListHandler.java
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/ResultsHandler.java
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/download.jsp
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/index.jsp
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/list.jsp
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/results.jsp
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/web.xml
    geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java
    geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandListConfigurations.java
    geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigInstallerGBean.java
    geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationInstaller.java
    geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationMetadata.java

Modified: geronimo/trunk/applications/console-framework/src/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-framework/src/webapp/WEB-INF/web.xml?rev=390687&r1=390686&r2=390687&view=diff
==============================================================================
--- geronimo/trunk/applications/console-framework/src/webapp/WEB-INF/web.xml (original)
+++ geronimo/trunk/applications/console-framework/src/webapp/WEB-INF/web.xml Sat Apr  1 07:54:02 2006
@@ -44,6 +44,20 @@
         </init-param>
     </servlet>
 
+    <servlet>
+        <display-name>CAR Export Forward Servlet</display-name>
+        <servlet-name>car-export-forward</servlet-name>
+        <servlet-class>org.apache.geronimo.console.servlet.ContextForwardServlet</servlet-class>
+        <init-param>
+           <param-name>context-path</param-name>
+           <param-value>/console-standard</param-value>
+        </init-param>
+        <init-param>
+           <param-name>servlet-path</param-name>
+           <param-value>/car-export</param-value>
+        </init-param>
+    </servlet>
+
     <servlet-mapping>
         <servlet-name>se-console</servlet-name>
         <url-pattern>/portal/*</url-pattern>

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/DownloadCARHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/DownloadCARHandler.java?rev=390687&r1=390686&r2=390687&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/DownloadCARHandler.java (original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/DownloadCARHandler.java Sat Apr  1 07:54:02 2006
@@ -51,8 +51,12 @@
     public String actionBeforeView(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("configId", configId);
         response.setRenderParameter("repository", repo);
+        if(!isEmpty(user)) response.setRenderParameter("repo-user", user);
+        if(!isEmpty(pass)) response.setRenderParameter("repo-pass", pass);
 
         return getMode();
     }
@@ -60,9 +64,11 @@
     public void renderView(RenderRequest request, RenderResponse 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");
         ConfigurationMetadata config;
         try {
-            config = PortletManager.getConfigurationInstaller(request).loadDependencies(new URL(repo), new ConfigurationMetadata(new URI(configId), null, null, false));
+            config = PortletManager.getConfigurationInstaller(request).loadDependencies(new URL(repo), user, pass, new ConfigurationMetadata(new URI(configId), null, null, false, true));
         } catch (URISyntaxException e) {
             throw new PortletException("Unable to format URI", e);
         }
@@ -70,16 +76,20 @@
         request.setAttribute("parents", config.getParents());
         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");
             DownloadResults results;
             try {
-                results = PortletManager.getConfigurationInstaller(request).install(new URL(repo), new URI(configId));
+                results = PortletManager.getConfigurationInstaller(request).install(new URL(repo), user, pass, new URI(configId));
             } catch (URISyntaxException e) {
                 throw new PortletException("Unable to format URI", e);
             }
@@ -104,6 +114,9 @@
             request.getPortletSession(true).setAttribute("car.install.configurations", configs);
             request.getPortletSession(true).setAttribute("car.install.dependencies", deps);
             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;
     }

Added: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/GeronimoAsMavenServlet.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/GeronimoAsMavenServlet.java?rev=390687&view=auto
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/GeronimoAsMavenServlet.java (added)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/GeronimoAsMavenServlet.java Sat Apr  1 07:54:02 2006
@@ -0,0 +1,203 @@
+/**
+ *
+ * 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.car;
+
+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.ConfigurationManager;
+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.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
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class GeronimoAsMavenServlet extends HttpServlet {
+    private final static Log log = LogFactory.getLog(GeronimoAsMavenServlet.class);
+    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+        String path = request.getPathInfo();
+        if(path == null) {
+            throw new ServletException("No configId specified for CAR download");
+        }
+        Kernel kernel = KernelRegistry.getSingleKernel();
+        if(path.equals("/geronimo-configs.xml")) {
+            try {
+                generateConfigFile(kernel, response.getWriter());
+            } catch (Exception e) {
+                throw new ServletException("Unable to generate Geronimo configuration list", e);
+            }
+        } else {
+            if(path.startsWith("/")) {
+                path = path.substring(1);
+            }
+            String[] parts = path.split("/");
+            if(parts.length != 3) {
+                response.sendError(404, "Unrecognized path form "+path);
+                return;
+            }
+            String groupId = parts[0];
+            String type = parts[1].substring(0, parts[1].length()-1);
+            if(!parts[2].endsWith("."+type)) {
+                response.sendError(404, "Unrecognized path structure "+path);
+            }
+            parts[2] = parts[2].substring(0, parts[2].length()-(type.length()+1));
+            int pos = parts[2].lastIndexOf("-");
+            String version = parts[2].substring(pos+1);
+            if(version.equalsIgnoreCase("SNAPSHOT")) {
+                pos = parts[2].lastIndexOf("-", pos-1);
+                version = parts[2].substring(pos+1);
+            }
+            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);
+            }
+        }
+    }
+
+    private boolean produceDownloadFile(Kernel kernel, URI configId, HttpServletResponse response) throws IOException {
+        // 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")) {
+                ConfigurationStore store = (ConfigurationStore) kernel.getProxyManager().createProxy(name, ConfigurationStore.class);
+                if(store.containsConfiguration(configId)) {
+                    response.setContentType("application/zip");
+                    try {
+                        kernel.invoke(name, "exportConfiguration", new Object[]{configId.toString(), response.getOutputStream()}, new String[]{String.class.getName(), OutputStream.class.getName()});
+                        return true;
+                    } catch (Exception e) {
+                        log.error("Unable to export configuration ZIP", e);
+                        throw new IOException("Unable to write ZIP file: "+e.getMessage());
+                    }
+                }
+            }
+        }
+        // Step 2: check if it's in a repository
+        Set repos = kernel.listGBeans(new GBeanQuery(null, 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();
+                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());
+                }
+                OutputStream out = response.getOutputStream();
+                byte[] buf = new byte[1024];
+                int count;
+                while((count = in.read(buf)) > -1) {
+                    out.write(buf, 0, count);
+                }
+                in.close();
+                return true;
+            }
+        }
+        // Step 3: wasn't found
+        return false;
+    }
+
+    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]);
+        String version = serverInfo.getVersion();
+        ConfigurationManager mgr = ConfigurationUtil.getConfigurationManager(kernel);
+        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+        DocumentBuilder builder = factory.newDocumentBuilder();
+        Document doc = builder.newDocument();
+        Element root = doc.createElement("geronimo-config-list");
+        doc.appendChild(root);
+        List stores = mgr.listStores();
+        for (int i = 0; i < stores.size(); i++) {
+            ObjectName name = (ObjectName) stores.get(i);
+            List configs = mgr.listConfigurations(name);
+            for (int j = 0; j < configs.size(); j++) {
+                ConfigurationInfo info = (ConfigurationInfo) configs.get(j);
+                Element config = doc.createElement("configuration");
+                root.appendChild(config);
+                createText(doc, config, "name", info.getConfigID().toString());
+                createText(doc, config, "config-id", info.getConfigID().toString());
+                createText(doc, config, "category", "Geronimo Deployments");
+                createText(doc, config, "geronimo-version", version);
+                if(info.getConfigID().toString().indexOf("jetty") > -1) {
+                    createText(doc, config, "prerequisite", "geronimo/jetty");
+                } else if(info.getConfigID().toString().indexOf("tomcat") > -1) {
+                    createText(doc, config, "prerequisite", "geronimo/tomcat");
+                }
+            }
+        }
+        TransformerFactory xfactory = TransformerFactory.newInstance();
+        Transformer xform = xfactory.newTransformer();
+        xform.transform(new DOMSource(doc), new StreamResult(out));
+    }
+
+    private void createText(Document doc, Element parent, String name, String text) {
+        Element child = doc.createElement(name);
+        parent.appendChild(child);
+        Text node = doc.createTextNode(text);
+        child.appendChild(node);
+    }
+}

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

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/IndexHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/IndexHandler.java?rev=390687&r1=390686&r2=390687&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/IndexHandler.java (original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/IndexHandler.java Sat Apr  1 07:54:02 2006
@@ -48,6 +48,8 @@
 
     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;
     }
 }

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/ListHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/ListHandler.java?rev=390687&r1=390686&r2=390687&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/ListHandler.java (original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/ListHandler.java Sat Apr  1 07:54:02 2006
@@ -33,6 +33,9 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Collections;
+import java.util.Collection;
+import java.util.Iterator;
 
 /**
  * Handler for the import export list screen.
@@ -52,21 +55,29 @@
             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 {
-        ConfigurationMetadata[] data = PortletManager.getConfigurationInstaller(request).listConfigurations(new URL(repository));
+    private void loadFromRepository(RenderRequest request, String repository, String username, String password) throws IOException {
+        ConfigurationMetadata[] data = PortletManager.getConfigurationInstaller(request).listConfigurations(new URL(repository), username, password);
 
         Map results = new HashMap();
         for (int i = 0; i < data.length; i++) {
@@ -77,6 +88,11 @@
                 results.put(metadata.getCategory(), values);
             }
             values.add(metadata);
+        }
+        Collection values = results.values();
+        for (Iterator it = values.iterator(); it.hasNext();) {
+            List list = (List) it.next();
+            Collections.sort(list);
         }
         request.setAttribute("categories", results);
     }

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/ResultsHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/ResultsHandler.java?rev=390687&r1=390686&r2=390687&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/ResultsHandler.java (original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/car/ResultsHandler.java Sat Apr  1 07:54:02 2006
@@ -72,16 +72,28 @@
     }
 
     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 {
             ConfigurationManager mgr = ConfigurationUtil.getConfigurationManager(KernelRegistry.getSingleKernel());
             List list = mgr.loadRecursive(new URI(configId));
@@ -90,7 +102,7 @@
                 mgr.loadGBeans(uri);
                 mgr.start(uri);
             }
-            return LIST_MODE+BEFORE_ACTION;
+            return LIST_MODE;
         } catch (Exception e) {
             log.error("Unable to start configuration "+configId, e);
             response.setRenderParameter("configId", configId);

Modified: geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/download.jsp
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/download.jsp?rev=390687&r1=390686&r2=390687&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/download.jsp (original)
+++ geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/download.jsp Sat Apr  1 07:54:02 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>

Modified: geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/index.jsp
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/index.jsp?rev=390687&r1=390686&r2=390687&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/index.jsp (original)
+++ geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/index.jsp Sat Apr  1 07:54:02 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>

Modified: geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/list.jsp
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/list.jsp?rev=390687&r1=390686&r2=390687&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/list.jsp (original)
+++ geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/list.jsp Sat Apr  1 07:54:02 2006
@@ -18,9 +18,11 @@
           <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.description} (${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>

Modified: geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/results.jsp
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/results.jsp?rev=390687&r1=390686&r2=390687&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/results.jsp (original)
+++ geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/car/results.jsp Sat Apr  1 07:54:02 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>

Modified: geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/web.xml?rev=390687&r1=390686&r2=390687&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/web.xml (original)
+++ geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/web.xml Sat Apr  1 07:54:02 2006
@@ -745,6 +745,11 @@
   <servlet-name>car-export</servlet-name>
   <servlet-class>org.apache.geronimo.console.car.CARExportServlet</servlet-class>
 </servlet>
+<servlet>
+  <display-name>Geronimo as Maven Repo Servlet</display-name>
+  <servlet-name>maven-repo</servlet-name>
+  <servlet-class>org.apache.geronimo.console.car.GeronimoAsMavenServlet</servlet-class>
+</servlet>
 
 <servlet-mapping>
   <servlet-name>dwr-invoker</servlet-name>
@@ -753,6 +758,10 @@
 <servlet-mapping>
   <servlet-name>car-export</servlet-name>
   <url-pattern>/car-export</url-pattern>
+</servlet-mapping>
+<servlet-mapping>
+  <servlet-name>maven-repo</servlet-name>
+  <url-pattern>/maven-repo/*</url-pattern>
 </servlet-mapping>
 
 

Modified: geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java?rev=390687&r1=390686&r2=390687&view=diff
==============================================================================
--- geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java (original)
+++ geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java Sat Apr  1 07:54:02 2006
@@ -126,12 +126,12 @@
         }
     }
 
-    public ConfigurationMetadata[] listConfigurations(URL mavenRepository) throws IOException {
+    public ConfigurationMetadata[] listConfigurations(URL mavenRepository, String username, String password) throws IOException {
         Set set = kernel.listGBeans(new GBeanQuery(null, "org.apache.geronimo.system.configuration.ConfigurationInstaller"));
         for (Iterator it = set.iterator(); it.hasNext();) {
             ObjectName name = (ObjectName) it.next();
             try {
-                return (ConfigurationMetadata[]) kernel.invoke(name, "listConfigurations", new Object[]{mavenRepository}, new String[]{URL.class.getName()});
+                return (ConfigurationMetadata[]) kernel.invoke(name, "listConfigurations", new Object[]{mavenRepository, username, password}, new String[]{URL.class.getName(), String.class.getName(), String.class.getName()});
             } catch (Exception e) {
                 e.printStackTrace();
                 throw new IOException("Unable to list configurations: "+e.getMessage());
@@ -140,12 +140,12 @@
         return null;
     }
 
-    public ConfigurationMetadata loadDependencies(URL mavenRepository, ConfigurationMetadata source) throws IOException {
+    public ConfigurationMetadata loadDependencies(URL mavenRepository, String username, String password, ConfigurationMetadata source) throws IOException {
         Set set = kernel.listGBeans(new GBeanQuery(null, "org.apache.geronimo.system.configuration.ConfigurationInstaller"));
         for (Iterator it = set.iterator(); it.hasNext();) {
             ObjectName name = (ObjectName) it.next();
             try {
-                return (ConfigurationMetadata) kernel.invoke(name, "loadDependencies", new Object[]{mavenRepository, source}, new String[]{URL.class.getName(), ConfigurationMetadata.class.getName()});
+                return (ConfigurationMetadata) kernel.invoke(name, "loadDependencies", new Object[]{mavenRepository, username, password, source}, new String[]{URL.class.getName(), ConfigurationMetadata.class.getName(), String.class.getName(), String.class.getName()});
             } catch (Exception e) {
                 e.printStackTrace();
                 throw new IOException("Unable to load dependencies: "+e.getMessage());
@@ -154,12 +154,12 @@
         return null;
     }
 
-    public DownloadResults install(URL mavenRepository, URI configId) throws IOException {
+    public DownloadResults install(URL mavenRepository, String username, String password, URI configId) throws IOException {
         Set set = kernel.listGBeans(new GBeanQuery(null, "org.apache.geronimo.system.configuration.ConfigurationInstaller"));
         for (Iterator it = set.iterator(); it.hasNext();) {
             ObjectName name = (ObjectName) it.next();
             try {
-                return (DownloadResults) kernel.invoke(name, "install", new Object[]{mavenRepository, configId}, new String[]{URL.class.getName(), URI.class.getName()});
+                return (DownloadResults) kernel.invoke(name, "install", new Object[]{mavenRepository, username, password, configId}, new String[]{URL.class.getName(), String.class.getName(), String.class.getName(), URI.class.getName()});
             } catch (Exception e) {
                 e.printStackTrace();
                 throw new IOException("Unable to install configurations: "+e.getMessage());

Modified: geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandListConfigurations.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandListConfigurations.java?rev=390687&r1=390686&r2=390687&view=diff
==============================================================================
--- geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandListConfigurations.java (original)
+++ geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandListConfigurations.java Sat Apr  1 07:54:02 2006
@@ -56,6 +56,8 @@
                 "is used to add new functionality to the Geronimo server.");
     }
 
+    //todo: provide a way to handle a username and password for the remote repo?
+
     public CommandListConfigurations(String command, String group, String helpArgumentList, String helpText) {
         super(command, group, helpArgumentList, helpText);
     }
@@ -71,7 +73,7 @@
             URL repository;
             try {
                 repository = new URL(args[0]);
-                data = mgr.listConfigurations(repository);
+                data = mgr.listConfigurations(repository, null, null);
             } catch (IOException e) {
                 throw new DeploymentException("Unable to list configurations", e);
             }
@@ -118,7 +120,7 @@
                 }
                 int selection = Integer.parseInt(answer);
                 ConfigurationMetadata target = ((ConfigurationMetadata) available.get(selection - 1));
-                DownloadResults results = mgr.install(repository, target.getConfigId());
+                DownloadResults results = mgr.install(repository, null, null, target.getConfigId());
                 for (int i = 0; i < results.getConfigurationsPresent().length; i++) {
                     URI uri = results.getConfigurationsPresent()[i];
                     System.out.print(DeployUtils.reformat("Using existing configuration "+uri, 4, 72));

Modified: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigInstallerGBean.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigInstallerGBean.java?rev=390687&r1=390686&r2=390687&view=diff
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigInstallerGBean.java (original)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigInstallerGBean.java Sat Apr  1 07:54:02 2006
@@ -21,12 +21,20 @@
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
-import org.apache.geronimo.kernel.config.Configuration;
+import org.apache.geronimo.kernel.config.ConfigurationInfo;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.kernel.config.InvalidConfigException;
-import org.apache.geronimo.kernel.config.ConfigurationInfo;
 import org.apache.geronimo.kernel.repository.WriteableRepository;
-
+import org.apache.geronimo.util.encoders.Base64;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
@@ -35,6 +43,7 @@
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
+import java.net.URLConnection;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -42,7 +51,6 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Properties;
 import java.util.Set;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
@@ -65,12 +73,22 @@
         this.configStore = configStore;
     }
 
-    public ConfigurationMetadata[] listConfigurations(URL mavenRepository) throws IOException {
+    public ConfigurationMetadata[] listConfigurations(URL mavenRepository, String username, String password) throws IOException {
         String repository = mavenRepository.toString();
         if(!repository.endsWith("/")) {
             repository = repository+"/";
         }
-        URL url = new URL(repository+"geronimo-configurations.properties");
+        URL url = new URL(repository+"geronimo-configs.xml");
+        InputStream in = openStream(url, username, password);
+        try {
+            return loadConfiguration(in);
+        } catch (Exception e) {
+            log.error("Unable to load repository configuration data", e);
+            return new ConfigurationMetadata[0];
+        }
+    }
+
+    private ConfigurationMetadata[] loadConfiguration(InputStream in) throws ParserConfigurationException, URISyntaxException, IOException, SAXException {
         Set set = new HashSet();
         for (Iterator it = configStores.iterator(); it.hasNext();) {
             ConfigurationStore store = (ConfigurationStore) it.next();
@@ -80,31 +98,92 @@
                 set.add(info.getConfigID().toString());
             }
         }
-        InputStream in = url.openStream();
-        Properties props = new Properties();
-        props.load(in);
+
+        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+        DocumentBuilder builder = factory.newDocumentBuilder();
+        Document doc = builder.parse(in);
         in.close();
+        Element root = doc.getDocumentElement();
+        NodeList configs = root.getElementsByTagName("configuration");
         List results = new ArrayList();
-        for (Iterator it = props.keySet().iterator(); it.hasNext();) {
-            String key = (String) it.next();
-            int pos = key.indexOf('.');
-            String type = key.substring(0, pos);
-            String configId = key.substring(pos + 1);
-            try {
-                results.add(new ConfigurationMetadata(new URI(configId), props.getProperty(key), type, set.contains(configId)));
-            } catch (URISyntaxException e) {
-                throw new IOException("Unable to create configID URI: "+e.getMessage());
+        for (int i = 0; i < configs.getLength(); i++) {
+            Element config = (Element) configs.item(i);
+            String configId = getChildText(config, "config-id");
+            boolean eligible = true;
+            String[] prereqs = getChildrenText(config, "prerequisite");
+            for (int j = 0; j < prereqs.length; j++) {
+                boolean found = false;
+                for (Iterator it = set.iterator(); it.hasNext();) {
+                    String id = (String) it.next();
+                    if(id.startsWith(prereqs[j])) {
+                        found = true;
+                        break;
+                    }
+                }
+                if(!found) {
+                    eligible = false;
+                    break;
+                }
             }
+            ConfigurationMetadata data = new ConfigurationMetadata(new URI(configId), getChildText(config, "name"), getChildText(config, "category"), set.contains(configId), eligible);
+            data.setGeronimoVersions(getChildrenText(config, "geronimo-version"));
+            data.setPrerequisites(prereqs);
+            results.add(data);
         }
         return (ConfigurationMetadata[]) results.toArray(new ConfigurationMetadata[results.size()]);
     }
 
-    public ConfigurationMetadata loadDependencies(URL mavenRepository, ConfigurationMetadata source) throws IOException {
+    private String getChildText(Element root, String property) {
+        NodeList children = root.getChildNodes();
+        for(int i=0; i<children.getLength(); i++) {
+            Node check = children.item(i);
+            if(check.getNodeType() == Node.ELEMENT_NODE && check.getNodeName().equals(property)) {
+                NodeList nodes = check.getChildNodes();
+                StringBuffer buf = null;
+                for(int j=0; j<nodes.getLength(); j++) {
+                    Node node = nodes.item(j);
+                    if(node.getNodeType() == Node.TEXT_NODE) {
+                        if(buf == null) {
+                            buf = new StringBuffer();
+                        }
+                        buf.append(node.getNodeValue());
+                    }
+                }
+                return buf == null ? null : buf.toString();
+            }
+        }
+        return null;
+    }
+
+    private String[] getChildrenText(Element root, String property) {
+        NodeList children = root.getChildNodes();
+        List results = new ArrayList();
+        for(int i=0; i<children.getLength(); i++) {
+            Node check = children.item(i);
+            if(check.getNodeType() == Node.ELEMENT_NODE && check.getNodeName().equals(property)) {
+                NodeList nodes = check.getChildNodes();
+                StringBuffer buf = null;
+                for(int j=0; j<nodes.getLength(); j++) {
+                    Node node = nodes.item(j);
+                    if(node.getNodeType() == Node.TEXT_NODE) {
+                        if(buf == null) {
+                            buf = new StringBuffer();
+                        }
+                        buf.append(node.getNodeValue());
+                    }
+                }
+                results.add(buf == null ? null : buf.toString());
+            }
+        }
+        return (String[]) results.toArray(new String[results.size()]);
+    }
+
+    public ConfigurationMetadata loadDependencies(URL mavenRepository, String username, String password, ConfigurationMetadata source) throws IOException {
         String conf = source.getConfigId().toString();
         File file = File.createTempFile("geronimo-download", "." + conf.substring(conf.lastIndexOf("/")+1));
         file.deleteOnExit();
         String url = getURL(conf, mavenRepository.toString());
-        downloadFile(url, file); //todo: download only SNAPSHOTS if previously available?
+        downloadFile(url, username, password, file); //todo: download only SNAPSHOTS if previously available?
         configIdToFile.put(source.getConfigId(), file);
         ZipFile zip = new ZipFile(file);
         try {
@@ -124,7 +203,7 @@
         }
     }
 
-    public DownloadResults install(URL mavenRepository, URI configId) throws IOException {
+    public DownloadResults install(URL mavenRepository, String username, String password, URI configId) throws IOException {
         Set set = new HashSet();
         for (Iterator it = configStores.iterator(); it.hasNext();) {
             ConfigurationStore store = (ConfigurationStore) it.next();
@@ -135,7 +214,7 @@
             }
         }
         DownloadResults results = new DownloadResults();
-        processConfiguration(configId,writeableRepo,mavenRepository.toString(),set,results);
+        processConfiguration(configId,writeableRepo,mavenRepository.toString(),username,password,set,results);
         return results;
     }
 
@@ -150,10 +229,23 @@
         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());
+    private InputStream openStream(URL url, String username, String password) throws IOException {
+        InputStream in;
+        if(username != null) { //todo: try connecting first and only use authentication if challenged
+            URLConnection con = url.openConnection();
+            con.setRequestProperty("Authorization", "Basic " + new String(Base64.encode((username + ":" + password).getBytes())));
+            in = con.getInputStream();
+        } else {
+            in = url.openStream();
+        }
+        return in;
+    }
+
+    private void downloadFile(String urlSource, String username, String password, File target) throws IOException {
+        log.info("Downloading "+urlSource+" to "+target.getAbsolutePath());
         byte[] buf = new byte[10240];
-        InputStream in = new URL(url).openStream();
+        URL url = new URL(urlSource);
+        InputStream in = openStream(url, username, password);
         FileOutputStream out = new FileOutputStream(target);
         int count;
         while((count = in.read(buf)) > -1) {
@@ -163,7 +255,7 @@
         out.close();
     }
 
-    private void processConfiguration(URI configId, WriteableRepository repo, String repoURL, Set configurations, DownloadResults results) throws IOException {
+    private void processConfiguration(URI configId, WriteableRepository repo, String repoURL, String username, String password, Set configurations, DownloadResults results) throws IOException {
         if(!repoURL.endsWith("/")) {
             repoURL += "/";
         }
@@ -177,7 +269,9 @@
             file.deleteOnExit();
         }
         String configUrl = getURL(id, repoURL);
-        downloadFile(configUrl, file);
+        if(!file.exists() || file.length() == 0) {
+            downloadFile(configUrl, username, password, file);
+        }
         results.addConfigurationInstalled(configId);
 
         // Process the contents of the CAR
@@ -198,7 +292,7 @@
                 }
                 String url = getURL(dep.toString(), repoURL);
                 log.info("Downloading "+url+" to local repository");
-                repo.copyToRepository(new URL(url).openStream(), dep, null);
+                repo.copyToRepository(openStream(new URL(url), username, password), dep, null);
                 results.addDependencyInstalled(dep);
             }
             // Download the parents
@@ -209,7 +303,7 @@
                         results.addConfigurationPresent(uri);
                         continue;
                     }
-                    processConfiguration(uri, repo, repoURL, configurations, results);
+                    processConfiguration(uri, repo, repoURL, username, password, configurations, results);
                 }
             }
             // Install the configuration

Modified: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationInstaller.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationInstaller.java?rev=390687&r1=390686&r2=390687&view=diff
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationInstaller.java (original)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationInstaller.java Sat Apr  1 07:54:02 2006
@@ -26,7 +26,38 @@
  * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
  */
 public interface ConfigurationInstaller {
-    public ConfigurationMetadata[] listConfigurations(URL mavenRepository) throws IOException;
-    public ConfigurationMetadata loadDependencies(URL mavenRepository, ConfigurationMetadata source) throws IOException;
-    public DownloadResults install(URL mavenRepository, URI configId) throws IOException;
+    /**
+     * Lists the configurations available for download in a particular Geronimo repository.
+     * @param mavenRepository The base URL to the maven repository
+     * @param username Optional username, if the maven repo uses HTTP Basic authentication.
+     *                 Set this to null if no authentication is required.
+     * @param password Optional password, if the maven repo uses HTTP Basic authentication.
+     *                 Set this to null if no authentication is required.
+     */
+    public ConfigurationMetadata[] listConfigurations(URL mavenRepository, String username, String password) throws IOException;
+
+    /**
+     * Populates the dependency information for a particular configuration descriptor.
+     * @param mavenRepository The base URL to the maven repository
+     * @param username Optional username, if the maven repo uses HTTP Basic authentication.
+     *                 Set this to null if no authentication is required.
+     * @param password Optional password, if the maven repo uses HTTP Basic authentication.
+     *                 Set this to null if no authentication is required.
+     * @param source   The configuration descriptor that should have dependency
+     *                 information added (though if this is a remote call a different
+     *                 object will be returned).
+     */
+    public ConfigurationMetadata loadDependencies(URL mavenRepository, String username, String password, ConfigurationMetadata source) throws IOException;
+
+    /**
+     * Installs a configuration from a remote repository into the local Geronimo server,
+     * including all its dependencies.
+     * @param mavenRepository The base URL to the maven repository
+     * @param username Optional username, if the maven repo uses HTTP Basic authentication.
+     *                 Set this to null if no authentication is required.
+     * @param password Optional password, if the maven repo uses HTTP Basic authentication.
+     *                 Set this to null if no authentication is required.
+     * @param configId The identifier of the configuration to install.
+     */
+    public DownloadResults install(URL mavenRepository, String username, String password, URI configId) throws IOException;
 }

Modified: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationMetadata.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationMetadata.java?rev=390687&r1=390686&r2=390687&view=diff
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationMetadata.java (original)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationMetadata.java Sat Apr  1 07:54:02 2006
@@ -25,19 +25,23 @@
  *
  * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
  */
-public class ConfigurationMetadata implements Serializable {
+public class ConfigurationMetadata implements Serializable, Comparable {
     private URI configId;
     private String description;
     private String category;
     private boolean installed;
+    private boolean eligible;
     private URI[] parents;
     private URI[] dependencies;
+    private String[] geronimoVersions;
+    private String[] prerequisites;
 
-    public ConfigurationMetadata(URI configId, String description, String category, boolean installed) {
+    public ConfigurationMetadata(URI configId, String description, String category, boolean installed, boolean eligible) {
         this.configId = configId;
         this.description = description;
         this.category = category;
         this.installed = installed;
+        this.eligible = eligible;
     }
 
     public void setParents(URI[] parents) {
@@ -84,5 +88,35 @@
      */
     public URI[] getDependencies() {
         return dependencies;
+    }
+
+    public String[] getGeronimoVersions() {
+        return geronimoVersions;
+    }
+
+    public void setGeronimoVersions(String[] geronimoVersions) {
+        this.geronimoVersions = geronimoVersions;
+    }
+
+    public String[] getPrerequisites() {
+        return prerequisites;
+    }
+
+    public void setPrerequisites(String[] prerequisites) {
+        this.prerequisites = prerequisites;
+    }
+
+    public boolean isEligible() {
+        return eligible;
+    }
+
+
+    public int compareTo(Object o) {
+        ConfigurationMetadata other = (ConfigurationMetadata) o;
+        int test = category.compareTo(other.category);
+        if(test != 0) return test;
+        test = description.compareTo(other.description);
+
+        return test;
     }
 }

Added: geronimo/trunk/modules/system/src/schema/config-list.xsd
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/schema/config-list.xsd?rev=390687&view=auto
==============================================================================
--- geronimo/trunk/modules/system/src/schema/config-list.xsd (added)
+++ geronimo/trunk/modules/system/src/schema/config-list.xsd Sat Apr  1 07:54:02 2006
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright 2004 The Apache Software Foundation
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+
+<xs:schema
+    targetNamespace="http://geronimo.apache.org/xml/ns/config-list-1.0"
+    xmlns:list="http://geronimo.apache.org/xml/ns/config-list-1.0"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    elementFormDefault="qualified"
+    attributeFormDefault="unqualified"
+    >
+    <xs:annotation>
+        <xs:documentation>
+            Schema for a list of Geronimo configurations available at some
+            external site (namely, a Maven repository).
+        </xs:documentation>
+    </xs:annotation>
+
+    <xs:element name="geronimo-config-list" type="list:config-listType"/>
+
+    <xs:complexType name="config-listType">
+        <xs:sequence>
+            <xs:element name="configuration" type="list:configurationType" minOccurs="0" maxOccurs="unbounded" />
+        </xs:sequence>
+    </xs:complexType>
+
+    <xs:complexType name="configurationType">
+        <xs:sequence>
+            <xs:element name="name" type="xs:string">
+                <xs:annotation>
+                    <xs:documentation>
+                        A human-readable name for this configuration.  This will be used to identify
+                        the configuration to a user when giving them a list of configurations to
+                        select from.
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+            <xs:element name="config-id" type="xs:string">
+                <xs:annotation>
+                    <xs:documentation>
+                        The Geronimo configId for this configuration, which uniquely identifies
+                        it, and also is used to construct a path to download it if necessary
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+            <xs:element name="category" type="xs:string">
+                <xs:annotation>
+                    <xs:documentation>
+                        A category name for this configuration.  The user interface typically groups
+                        configurations by their category name, so this should match the value for other
+                        configurations in the same category.
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+            <xs:element name="geronimo-version" type="xs:string" minOccurs="0" maxOccurs="unbounded">
+                <xs:annotation>
+                    <xs:documentation>
+                        Indicates a version of the Geronimo base server that this component can run in.
+                        If no geronimo-version is listed, that means the component can run in any version
+                        of Geronimo so long as the prerequisites, parents, and dependencies are present.
+                        If one or more geronimo-version elements are listed, then the current version of
+                        Geronimo must match one of them in order for this component to be installable.
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+            <xs:element name="prerequisite" type="xs:string" minOccurs="0" maxOccurs="unbounded">
+                <xs:annotation>
+                    <xs:documentation>
+                        The configId of a configuration that must be previously installed if this configuration
+                        is to be considered to be installable.  This is currently used for a web application
+                        to specify the web container it runs in (so we don't show Tomcat downloads for
+                        a Jetty installation, etc.).  It may be used for similar things in the future
+                        if more distribution choices are added to Geronimo.
+
+                        Normally parent should be used instead, indicating that if this configuration
+                        is installed, the parent configuration should also be downloaded and installed.
+                        This is only for cases where that doesn't make sense (again, Tomcat vs Jetty).
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+            <xs:element name="parent" type="xs:string" minOccurs="0" maxOccurs="unbounded">
+                <xs:annotation>
+                    <xs:documentation>
+                        The configId of a configuration that is a parent of this one.  That means that
+                        if this conifugration is selected, the parents (and their parents, etc.) must
+                        also be downloaded and installed so that this configuration can be run.
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+            <xs:element name="dependency" type="xs:string" minOccurs="0" maxOccurs="unbounded">
+                <xs:annotation>
+                    <xs:documentation>
+                        The repository URI of a 3rd party JAR that is a dependency of this
+                        configuration.  That means that the JAR must be downloaded and installed if this
+                        configuration is selectee.
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+        </xs:sequence>
+    </xs:complexType>
+</xs:schema>

Propchange: geronimo/trunk/modules/system/src/schema/config-list.xsd
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message