geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
Subject svn commit: r394439 [2/3] - in /geronimo/branches/1.1: ./ applications/console-core/src/java/org/apache/geronimo/console/util/ applications/console-standard/src/java/org/apache/geronimo/console/car/ applications/console-standard/src/webapp/WEB-INF/view...
Date Sun, 16 Apr 2006 06:35:13 GMT
Modified: geronimo/branches/1.1/modules/service-builder/src/test/org/apache/geronimo/deployment/service/ServiceConfigBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/service-builder/src/test/org/apache/geronimo/deployment/service/ServiceConfigBuilderTest.java?rev=394439&r1=394438&r2=394439&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/service-builder/src/test/org/apache/geronimo/deployment/service/ServiceConfigBuilderTest.java (original)
+++ geronimo/branches/1.1/modules/service-builder/src/test/org/apache/geronimo/deployment/service/ServiceConfigBuilderTest.java Sat Apr 15 23:35:09 2006
@@ -30,6 +30,7 @@
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.ListableRepository;
 import org.apache.geronimo.kernel.Jsr77Naming;
 import org.apache.geronimo.kernel.Naming;
 
@@ -39,6 +40,8 @@
 import java.util.ArrayList;
 import java.util.Set;
 import java.util.LinkedHashSet;
+import java.util.SortedSet;
+import java.util.TreeSet;
 
 /**
  * @version $Rev$ $Date$
@@ -103,7 +106,7 @@
         file.delete();
     }
 
-    private static class MockRepository implements Repository {
+    private static class MockRepository implements ListableRepository {
         public boolean contains(Artifact artifact) {
             return true;
         }
@@ -114,6 +117,15 @@
 
         public LinkedHashSet getDependencies(Artifact artifact) {
             return new LinkedHashSet();
+        }
+
+        public SortedSet list() {
+            return new TreeSet();
+        }
+
+        public SortedSet list(Artifact query) {
+            System.out.println("LOOKING FOR "+query);
+            return new TreeSet();
         }
     }
     private static class MockReferenceCollection extends ArrayList implements ReferenceCollection {

Modified: geronimo/branches/1.1/modules/system/maven.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/maven.xml?rev=394439&r1=394438&r2=394439&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/maven.xml (original)
+++ geronimo/branches/1.1/modules/system/maven.xml Sat Apr 15 23:35:09 2006
@@ -55,6 +55,12 @@
             <!-- Create the temporary directory where the configurations will reside -->
             <delete dir="${maven.build.dir}/tmp"/>
             <mkdir dir="${maven.build.dir}/tmp"/>
+            <mkdir dir="${maven.build.dir}/m1"/>
+            <mkdir dir="${maven.build.dir}/m2"/>
+            <copy todir="${maven.build.dir}/m1">
+              <fileset dir="${basedir}/src/test-repo/m1" /></copy>
+            <copy todir="${maven.build.dir}/m2">
+              <fileset dir="${basedir}/src/test-repo/m2" /></copy>
         </j:jelly>
 
     </postGoal>

Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigInstallerGBean.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigInstallerGBean.java?rev=394439&r1=394438&r2=394439&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigInstallerGBean.java (original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigInstallerGBean.java Sat Apr 15 23:35:09 2006
@@ -18,14 +18,18 @@
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.FileNotFoundException;
+import java.net.HttpURLConnection;
 import java.net.URL;
 import java.net.URLConnection;
+import java.net.MalformedURLException;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Set;
+import java.util.LinkedList;
+import java.util.Arrays;
+import javax.security.auth.login.FailedLoginException;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
@@ -34,15 +38,18 @@
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.kernel.config.ConfigurationData;
-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.InvalidConfigException;
 import org.apache.geronimo.kernel.config.NoSuchConfigException;
 import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.ArtifactResolver;
+import org.apache.geronimo.kernel.repository.DefaultArtifactResolver;
 import org.apache.geronimo.kernel.repository.Dependency;
 import org.apache.geronimo.kernel.repository.WritableListableRepository;
+import org.apache.geronimo.kernel.repository.MissingDependencyException;
 import org.apache.geronimo.util.encoders.Base64;
+import org.apache.geronimo.system.serverinfo.ServerInfo;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -59,39 +66,37 @@
     private ConfigurationManager configManager;
     private WritableListableRepository writeableRepo;
     private ConfigurationStore configStore;
+    private ArtifactResolver resolver;
+    private ServerInfo serverInfo;
 
-    public ConfigInstallerGBean(ConfigurationManager configManager, WritableListableRepository repository, ConfigurationStore configStore) {
+    public ConfigInstallerGBean(ConfigurationManager configManager, WritableListableRepository repository, ConfigurationStore configStore, ServerInfo serverInfo) {
         this.configManager = configManager;
         this.writeableRepo = repository;
         this.configStore = configStore;
+        this.serverInfo = serverInfo;
+        resolver = new DefaultArtifactResolver(null, writeableRepo);
     }
 
-    public ConfigurationMetadata[] listConfigurations(URL mavenRepository, String username, String password) throws IOException {
+    public ConfigurationList listConfigurations(URL mavenRepository, String username, String password) throws IOException, FailedLoginException {
         String repository = mavenRepository.toString();
         if(!repository.endsWith("/")) {
             repository = repository+"/";
         }
-        URL url = new URL(repository+"geronimo-configs.xml");
-        InputStream in = openStream(url, username, password);
+        //todo: Try downloading a .gz first
+        URL url = new URL(repository+"geronimo-plugins.xml");
         try {
-            return loadConfiguration(in);
+            InputStream in = openStream(null, url, new URL[0], username, password);
+            return loadConfiguration(mavenRepository, in);
+        } catch (MissingDependencyException e) {
+            log.error("Cannot find plugin index at site "+url);
+            return null;
         } catch (Exception e) {
             log.error("Unable to load repository configuration data", e);
-            return new ConfigurationMetadata[0];
+            return null;
         }
     }
 
-    private ConfigurationMetadata[] loadConfiguration(InputStream in) throws ParserConfigurationException, IOException, SAXException {
-        ConfigurationStore[] stores = configManager.getStores();
-        Set set = new HashSet();
-        for (int i = 0; i < stores.length; i++) {
-            ConfigurationStore store = stores[i];
-            List list = store.listConfigurations();
-            for (int j = 0; j < list.size(); j++) {
-                ConfigurationInfo info = (ConfigurationInfo) list.get(i);
-                set.add(info.getConfigID().toString());
-            }
-        }
+    private ConfigurationList loadConfiguration(URL repo, InputStream in) throws ParserConfigurationException, IOException, SAXException {
         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
         DocumentBuilder builder = factory.newDocumentBuilder();
         Document doc = builder.parse(in);
@@ -102,29 +107,76 @@
         for (int i = 0; i < configs.getLength(); i++) {
             Element config = (Element) configs.item(i);
             String configId = getChildText(config, "config-id");
+            NodeList licenseNodes = config.getElementsByTagName("license");
+            ConfigurationMetadata.License[] licenses = new ConfigurationMetadata.License[licenseNodes.getLength()];
+            for(int j=0; j<licenseNodes.getLength(); j++) {
+                Element node = (Element) licenseNodes.item(j);
+                licenses[j] = new ConfigurationMetadata.License(getText(node), Boolean.valueOf(node.getAttribute("osi-approved")).booleanValue());
+            }
             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;
+            NodeList preNodes = config.getElementsByTagName("prerequisite");
+            ConfigurationMetadata.Prerequisite[] prereqs = new ConfigurationMetadata.Prerequisite[preNodes.getLength()];
+            for(int j=0; j<preNodes.getLength(); j++) {
+                Element node = (Element) preNodes.item(j);
+                String originalConfigId = getChildText(node, "id");
+                Artifact artifact = Artifact.create(originalConfigId.replaceAll("\\*", ""));
+                boolean present = resolver.queryArtifacts(artifact).length > 0;
+                prereqs[j] = new ConfigurationMetadata.Prerequisite(artifact, present,
+                        getChildText(node, "resource-type"), getChildText(node, "description"));
+                if(!present) {
+                    log.info(configId+" is not eligible due to missing "+prereqs[j].getConfigId());
+                    eligible = false;
+                }
+            }
+            String[] gerVersions = getChildrenText(config, "geronimo-version");
+            if(gerVersions.length > 0) {
+                String version = serverInfo.getVersion();
+                boolean match = false;
+                for (int j = 0; j < gerVersions.length; j++) {
+                    String gerVersion = gerVersions[j];
+                    if(gerVersion.equals(version)) {
+                        match = true;
                         break;
                     }
                 }
-                if(!found) {
-                    eligible = false;
-                    break;
+                if(!match) eligible = false;
+            }
+            String[] jvmVersions = getChildrenText(config, "jvm-version");
+            if(jvmVersions.length > 0) {
+                String version = System.getProperty("java.version");
+                boolean match = false;
+                for (int j = 0; j < jvmVersions.length; j++) {
+                    String jvmVersion = jvmVersions[j];
+                    if(version.startsWith(jvmVersion)) {
+                        match = true;
+                        break;
+                    }
                 }
+                if(!match) eligible = false;
             }
             Artifact artifact = Artifact.create(configId);
-            ConfigurationMetadata data = new ConfigurationMetadata(artifact, getChildText(config, "name"), getChildText(config, "category"), configManager.isLoaded(artifact), eligible);
-            data.setGeronimoVersions(getChildrenText(config, "geronimo-version"));
+            boolean installed = configManager.isLoaded(artifact);
+            log.info("Checking "+configId+": installed="+installed+", eligible="+eligible);
+            ConfigurationMetadata data = new ConfigurationMetadata(artifact, getChildText(config, "name"), getChildText(config, "category"), installed, eligible);
+            data.setGeronimoVersions(gerVersions);
+            data.setJvmVersions(jvmVersions);
+            data.setLicenses(licenses);
             data.setPrerequisites(prereqs);
+            data.setDependencies(getChildrenText(config, "dependency"));
             results.add(data);
         }
-        return (ConfigurationMetadata[]) results.toArray(new ConfigurationMetadata[results.size()]);
+        String[] backups = getChildrenText(root, "backup-repository");
+        URL[] backupURLs = new URL[backups.length];
+        for(int i = 0; i < backups.length; i++) {
+            if(backups[i].endsWith("/")) {
+                backupURLs[i] = new URL(backups[i]);
+            } else {
+                backupURLs[i] = new URL(backups[i]+"/");
+            }
+        }
+
+        ConfigurationMetadata[] data = (ConfigurationMetadata[]) results.toArray(new ConfigurationMetadata[results.size()]);
+        return new ConfigurationList(repo, backupURLs, data);
     }
 
     private String getChildText(Element root, String property) {
@@ -132,23 +184,27 @@
         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 getText(check);
             }
         }
         return null;
     }
 
+    private String getText(Node target) {
+        NodeList nodes = target.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();
+    }
+
     private String[] getChildrenText(Element root, String property) {
         NodeList children = root.getChildNodes();
         List results = new ArrayList();
@@ -172,68 +228,26 @@
         return (String[]) results.toArray(new String[results.size()]);
     }
 
-    public ConfigurationMetadata loadDependencies(URL mavenRepository, String username, String password, ConfigurationMetadata source) throws IOException {
-        String configId = source.getConfigId().toString();
-        String url = getURL(configId, mavenRepository.toString());
-
-        Artifact artifact = Artifact.create(configId);
-        InputStream in = openStream(new URL(url), username, password);
-        try { //todo: use a file status monitor
-            writeableRepo.copyToRepository(in, artifact, null); //todo: download only SNAPSHOTS if previously available?
-        } finally {
-            in.close();
-        }
-        try {
-            ConfigurationData data = configStore.loadConfiguration(artifact);
-            source.setDependencies(getDependencies(data));
-            return source;
-        } catch (NoSuchConfigException e) {
-            throw new IllegalStateException("Installed configuration into repository but ConfigStore does not see it: "+e.getMessage());
-        } catch (InvalidConfigException e) {
-            throw new IllegalStateException("Installed configuration into repository but ConfigStore cannot load it: "+e.getMessage());
-        }
-    }
-
-    private static Dependency[] getDependencies(ConfigurationData data) {
-        List dependencies = data.getEnvironment().getDependencies();
-        Collection children = data.getChildConfigurations().values();
-        for (Iterator it = children.iterator(); it.hasNext();) {
-            ConfigurationData child = (ConfigurationData) it.next();
-            dependencies.addAll(child.getEnvironment().getDependencies());
-        }
-        return (Dependency[]) children.toArray(new Dependency[children.size()]);
-    }
 
-    public DownloadResults install(URL mavenRepository, String username, String password, Artifact configId) throws IOException {
+    public DownloadResults install(ConfigurationList list, String username, String password) throws IOException, FailedLoginException, MissingDependencyException {
         DownloadResults results = new DownloadResults();
-        downloadConfigurationDeps(configId,mavenRepository.toString(),username,password,results);
-        return results;
-    }
-
-    private String getURL(String configId, String baseRepositoryURL) {
-        if(!baseRepositoryURL.endsWith("/")) {
-            baseRepositoryURL += "/";
+        for (int i = 0; i < list.getConfigurations().length; i++) {
+            ConfigurationMetadata metadata = list.getConfigurations()[i];
+            downloadConfiguration(metadata.getConfigId(),list.getMainRepository(),list.getBackupRepositories(),username,password,results);
         }
-        String[] parts = configId.split("/");
-        return baseRepositoryURL+parts[0]+"/"+parts[3]+"s/"+parts[1]+"-"+parts[2]+"."+parts[3];
+        return results;
     }
 
-    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();
+    private void downloadConfiguration(Artifact configID, URL repoURL, URL[] backups, String username, String password, DownloadResults results) throws IOException, FailedLoginException, MissingDependencyException {
+        if(!configStore.containsConfiguration(configID)) {
+            InputStream in = openStream(configID, repoURL, backups, username, password);
+            try { //todo: use a file status monitor
+                writeableRepo.copyToRepository(in, configID, null); //todo: download only SNAPSHOTS if previously available?
+            } finally {
+                in.close();
+            }
         }
-        return in;
-    }
 
-    private void downloadConfigurationDeps(Artifact configID, String repoURL, String username, String password, DownloadResults results) throws IOException {
-        if(!repoURL.endsWith("/")) {
-            repoURL += "/";
-        }
         try {
             ConfigurationData data = null;
             if(configStore.containsConfiguration(configID)) {
@@ -252,11 +266,10 @@
                     results.addDependencyPresent(artifact);
                     continue;
                 }
-                String url = getURL(dep.toString(), repoURL);
                 //todo: use a file status monitor
-                writeableRepo.copyToRepository(openStream(new URL(url), username, password), artifact, null);
+                writeableRepo.copyToRepository(openStream(dep.getArtifact(), repoURL, backups, username, password), artifact, null);
                 results.addDependencyInstalled(artifact);
-                downloadConfigurationDeps(artifact, repoURL, username, password, results);
+                downloadConfiguration(artifact, repoURL, backups, username, password, results);
             }
         } catch (NoSuchConfigException e) {
             throw new IllegalStateException("Installed configuration into repository but ConfigStore does not see it: "+e.getMessage());
@@ -265,6 +278,75 @@
         }
     }
 
+    private static Dependency[] getDependencies(ConfigurationData data) {
+        List dependencies = data.getEnvironment().getDependencies();
+        Collection children = data.getChildConfigurations().values();
+        for (Iterator it = children.iterator(); it.hasNext();) {
+            ConfigurationData child = (ConfigurationData) it.next();
+            dependencies.addAll(child.getEnvironment().getDependencies());
+        }
+        return (Dependency[]) children.toArray(new Dependency[children.size()]);
+    }
+
+    private static URL getURL(Artifact configId, URL repository) throws MalformedURLException {
+        return new URL(repository, configId.getGroupId().replace('.','/')+"/"+configId.getArtifactId()+"/"+configId.getVersion()+"/"+configId.getArtifactId()+"-"+configId.getVersion()+"."+configId.getType());
+    }
+
+    private static InputStream openStream(Artifact artifact, URL repo, URL[] backups, String username, String password) throws IOException, FailedLoginException, MissingDependencyException {
+        InputStream in;
+        LinkedList list = new LinkedList();
+        list.add(repo);
+        list.addAll(Arrays.asList(backups));
+        while (true) {
+            if(list.isEmpty()) {
+                throw new MissingDependencyException("Unable to download dependency "+artifact);
+            }
+            URL repository = (URL) list.removeFirst();
+            URL url = artifact == null ? repository : getURL(artifact, repository);
+            URLConnection con = url.openConnection();
+            if(con instanceof HttpURLConnection) {
+                HttpURLConnection http = (HttpURLConnection) url.openConnection();
+                http.connect();
+                if(http.getResponseCode() == 401) { // need to authenticate
+                    if(username == null || username.equals("")) {
+                        throw new FailedLoginException("Server returned 401 "+http.getResponseMessage());
+                    }
+                    http = (HttpURLConnection) url.openConnection();
+                    http.setRequestProperty("Authorization", "Basic " + new String(Base64.encode((username + ":" + password).getBytes())));
+                    http.connect();
+                    if(http.getResponseCode() == 401) {
+                        throw new FailedLoginException("Server returned 401 "+http.getResponseMessage());
+                    } else if(http.getResponseCode() == 404) {
+                        continue; // Not found at this repository
+                    }
+                    in = http.getInputStream();
+                } else if(http.getResponseCode() == 404) {
+                    continue; // Not found at this repository
+                } else {
+                    in = http.getInputStream();
+                }
+            } else {
+                if(username != null && !username.equals("")) {
+                    con.setRequestProperty("Authorization", "Basic " + new String(Base64.encode((username + ":" + password).getBytes())));
+                    try {
+                        in = con.getInputStream();
+                    } catch (FileNotFoundException e) {
+                        continue;
+                    }
+                } else {
+                    try {
+                        in = url.openStream();
+                    } catch (FileNotFoundException e) {
+                        continue;
+                    }
+                }
+            }
+            if(in != null) {
+                return in;
+            }
+        }
+    }
+
     public static final GBeanInfo GBEAN_INFO;
 
     static {
@@ -272,9 +354,10 @@
         infoFactory.addReference("ConfigManager", ConfigurationManager.class, "ConfigurationManager");
         infoFactory.addReference("Repository", WritableListableRepository.class, "Repository");
         infoFactory.addReference("ConfigStore", ConfigurationStore.class, "ConfigurationStore");
+        infoFactory.addReference("ServerInfo", ServerInfo.class, "GBean");
         infoFactory.addInterface(ConfigurationInstaller.class);
 
-        infoFactory.setConstructor(new String[]{"ConfigManager", "Repository", "ConfigStore"});
+        infoFactory.setConstructor(new String[]{"ConfigManager", "Repository", "ConfigStore", "ServerInfo"});
 
         GBEAN_INFO = infoFactory.getBeanInfo();
     }

Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationInstaller.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationInstaller.java?rev=394439&r1=394438&r2=394439&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationInstaller.java (original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationInstaller.java Sat Apr 15 23:35:09 2006
@@ -18,7 +18,9 @@
 
 import java.net.URL;
 import java.io.IOException;
+import javax.security.auth.login.FailedLoginException;
 import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.MissingDependencyException;
 
 /**
  * Knows how to import and export configurations
@@ -34,30 +36,17 @@
      * @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;
+    public ConfigurationList listConfigurations(URL mavenRepository, String username, String password) throws IOException, FailedLoginException;
 
     /**
      * 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.
+     *
+     * @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 configsToInstall The list of configurations to install
      */
-    public DownloadResults install(URL mavenRepository, String username, String password, Artifact configId) throws IOException;
+    public DownloadResults install(ConfigurationList configsToInstall, String username, String password) throws IOException, FailedLoginException, MissingDependencyException;
 }

Added: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationList.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationList.java?rev=394439&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationList.java (added)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationList.java Sat Apr 15 23:35:09 2006
@@ -0,0 +1,99 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.system.configuration;
+
+import java.io.Serializable;
+import java.net.URL;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Set;
+import java.util.HashSet;
+import org.apache.geronimo.kernel.repository.Artifact;
+
+/**
+ * ReplaceMe
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class ConfigurationList implements Serializable {
+    private final URL mainRepository;
+    private final URL[] backupRepositories;
+    private final ConfigurationMetadata[] configurations;
+
+    public ConfigurationList(URL mainRepository, URL[] backupRepositories, ConfigurationMetadata[] configurations) {
+        this.mainRepository = mainRepository;
+        this.backupRepositories = backupRepositories;
+        this.configurations = configurations;
+    }
+
+    public static ConfigurationList createInstallList(ConfigurationList all, Artifact[] selectedConfigIDs) {
+        URL mainRepository = all.mainRepository;
+        URL[] backupRepositories = all.backupRepositories;
+        List list = new ArrayList();
+        Set set = new HashSet();
+        for (int i = 0; i < selectedConfigIDs.length; i++) {
+            Artifact artifact = selectedConfigIDs[i];
+            set.add(artifact);
+        }
+        for (int i = 0; i < all.getConfigurations().length; i++) {
+            ConfigurationMetadata metadata = all.getConfigurations()[i];
+            if(set.contains(metadata.getConfigId())) {
+                if(metadata.isInstalled() || !metadata.isEligible()) {
+                    throw new IllegalArgumentException("Cannot install "+metadata.getConfigId());
+                }
+                list.add(metadata);
+            }
+        }
+        if(list.size() == 0) {
+            return null;
+        }
+        ConfigurationMetadata[] configurations = (ConfigurationMetadata[]) list.toArray(new ConfigurationMetadata[list.size()]);
+        return new ConfigurationList(mainRepository, backupRepositories, configurations);
+    }
+
+    public static ConfigurationList createInstallList(ConfigurationList all, Artifact selectedConfigID) {
+        URL mainRepository = all.mainRepository;
+        URL[] backupRepositories = all.backupRepositories;
+        ConfigurationMetadata target = null;
+        for (int i = 0; i < all.getConfigurations().length; i++) {
+            ConfigurationMetadata metadata = all.getConfigurations()[i];
+            if(selectedConfigID.equals(metadata.getConfigId())) {
+                if(metadata.isInstalled() || !metadata.isEligible()) {
+                    throw new IllegalArgumentException("Cannot install "+metadata.getConfigId());
+                }
+                target = metadata;
+                break;
+            }
+        }
+        if(target == null) {
+            return null;
+        }
+        return new ConfigurationList(mainRepository, backupRepositories, new ConfigurationMetadata[]{target});
+    }
+
+    public URL getMainRepository() {
+        return mainRepository;
+    }
+
+    public URL[] getBackupRepositories() {
+        return backupRepositories;
+    }
+
+    public ConfigurationMetadata[] getConfigurations() {
+        return configurations;
+    }
+}

Propchange: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationList.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationMetadata.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationMetadata.java?rev=394439&r1=394438&r2=394439&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationMetadata.java (original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationMetadata.java Sat Apr 15 23:35:09 2006
@@ -27,35 +27,49 @@
  * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
  */
 public class ConfigurationMetadata implements Serializable, Comparable {
-    private Artifact configId;
-    private String description;
-    private String category;
-    private boolean installed;
-    private Dependency[] dependencies;
-    private boolean eligible;
+    private final Artifact configId;
+    private final String name;
+    private final String category;
+    private final boolean installed;
+    private final boolean eligible;
+    private String[] dependencies;
+    private License[] licenses;
     private String[] geronimoVersions;
-    private String[] prerequisites;
+    private String[] jvmVersions;
+    private Prerequisite[] prerequisites;
 
-    public ConfigurationMetadata(Artifact configId, String description, String category, boolean installed, boolean eligible) {
+    public ConfigurationMetadata(Artifact configId, String name, String category, boolean installed, boolean eligible) {
         this.configId = configId;
-        this.description = description;
+        this.name = name;
         this.category = category;
         this.installed = installed;
         this.eligible = eligible;
     }
 
-    public void setDependencies(Dependency[] dependencies) {
+    public void setDependencies(String[] dependencies) {
         this.dependencies = dependencies;
     }
 
+    /**
+     * Gets the Config ID for this configuration, which is a globally unique
+     * identifier.
+     */
     public Artifact getConfigId() {
         return configId;
     }
 
-    public String getDescription() {
-        return description;
+    /**
+     * Gets a human-readable name for this configuration.
+     */
+    public String getName() {
+        return name;
     }
 
+    /**
+     * Gets a category name for this configuration.  In a list, configurations
+     * in the same category will be listed together.  There are no specific
+     * allowed values, though each repository may have standards for that.
+     */
     public String getCategory() {
         return category;
     }
@@ -65,17 +79,15 @@
     }
 
     public String getVersion() {
-        String[] parts = configId.toString().split("/");
-        if(parts.length == 4) {
-            return parts[2];
-        }
-        return "unknown version";
+        return configId.getVersion() == null ? "unknown version" : configId.getVersion().toString();
     }
 
     /**
-     * Note: if null, this information has not yet been loaded from the repository
+     * Gets the JAR or configuration dependencies for this configuration,  Each
+     * String in the result is an Artifact (or Config ID) in String form.  The
+     * dependency names may be partial artifact names
      */
-    public Dependency[] getDependencies() {
+    public String[] getDependencies() {
         return dependencies;
     }
 
@@ -87,11 +99,27 @@
         this.geronimoVersions = geronimoVersions;
     }
 
-    public String[] getPrerequisites() {
+    public License[] getLicenses() {
+        return licenses;
+    }
+
+    public void setLicenses(License[] licenses) {
+        this.licenses = licenses;
+    }
+
+    public String[] getJvmVersions() {
+        return jvmVersions;
+    }
+
+    public void setJvmVersions(String[] jdkVersions) {
+        this.jvmVersions = jdkVersions;
+    }
+
+    public Prerequisite[] getPrerequisites() {
         return prerequisites;
     }
 
-    public void setPrerequisites(String[] prerequisites) {
+    public void setPrerequisites(Prerequisite[] prerequisites) {
         this.prerequisites = prerequisites;
     }
 
@@ -104,8 +132,91 @@
         ConfigurationMetadata other = (ConfigurationMetadata) o;
         int test = category.compareTo(other.category);
         if(test != 0) return test;
-        test = description.compareTo(other.description);
+        test = name.compareTo(other.name);
 
         return test;
+    }
+
+    public static class License implements Serializable {
+        private final String name;
+        private final boolean osiApproved;
+
+        public License(String name, boolean osiApproved) {
+            this.name = name;
+            this.osiApproved = osiApproved;
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public boolean isOsiApproved() {
+            return osiApproved;
+        }
+    }
+
+    public static class Prerequisite implements Serializable {
+        private final Artifact configId;
+        private final String resourceType;
+        private final String description;
+        private final boolean present;
+
+        public Prerequisite(Artifact configId, boolean present) {
+            this.configId = configId;
+            this.present = present;
+            resourceType = null;
+            description = null;
+        }
+
+        public Prerequisite(Artifact configId, boolean present, String resourceType, String description) {
+            this.configId = configId;
+            this.present = present;
+            this.resourceType = resourceType;
+            this.description = description;
+        }
+
+        public Artifact getConfigId() {
+            return configId;
+        }
+
+        public String getResourceType() {
+            return resourceType;
+        }
+
+        public String getDescription() {
+            return description;
+        }
+
+        public boolean isPresent() {
+            return present;
+        }
+
+        public String getConfigIdWithStars() {
+            StringBuffer buf = new StringBuffer();
+            if(configId.getGroupId() == null) {
+                buf.append("*");
+            } else {
+                buf.append(configId.getGroupId());
+            }
+            buf.append("/");
+            if(configId.getArtifactId() == null) {
+                buf.append("*");
+            } else {
+                buf.append(configId.getArtifactId());
+            }
+            buf.append("/");
+            if(configId.getVersion() == null) {
+                buf.append("*");
+            } else {
+                buf.append(configId.getVersion());
+            }
+            buf.append("/");
+            if(configId.getType() == null) {
+                buf.append("*");
+            } else {
+                buf.append(configId.getType());
+            }
+            return buf.toString();
+        }
     }
 }

Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/Maven1Repository.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/Maven1Repository.java?rev=394439&r1=394438&r2=394439&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/Maven1Repository.java (original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/Maven1Repository.java Sat Apr 15 23:35:09 2006
@@ -23,6 +23,7 @@
 import java.util.List;
 import java.util.SortedSet;
 import java.util.TreeSet;
+import java.util.Iterator;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -30,6 +31,7 @@
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.WritableListableRepository;
+import org.apache.geronimo.kernel.repository.Version;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
 
 /**
@@ -52,20 +54,48 @@
         return path;
     }
 
-    public SortedSet list(String groupId, String artifactId, String type) {
+    public SortedSet list(Artifact query) {
         SortedSet artifacts = new TreeSet();
+        if(query.getGroupId() != null && query.getArtifactId() != null && query.getType() != null) {
 
-        File path = new File(rootFile, groupId);
-        path = new File(path, type + "s");
+            File path = new File(rootFile, query.getGroupId());
+            path = new File(path, query.getType() + "s");
 
-        File[] files = path.listFiles();
-        for (int i = 0; i < files.length; i++) {
-            File file = files[i];
-            String fileName = file.getName();
-            if (fileName.startsWith(artifactId + "-") && fileName.endsWith("." + type)) {
-                String version = fileName.substring(artifactId.length() + 1);
-                version = version.substring(0, version.length() - 1 - type.length());
-                artifacts.add(new Artifact(groupId, artifactId, version, type));
+            File[] files = path.listFiles();
+            for (int i = 0; i < files.length; i++) {
+                File file = files[i];
+                String fileName = file.getName();
+                if (fileName.startsWith(query.getArtifactId() + "-") && fileName.endsWith("." + query.getType())) {
+                    String version = fileName.substring(query.getArtifactId().length() + 1);
+                    version = version.substring(0, version.length() - 1 - query.getType().length());
+                    if(query.getVersion() != null && !query.getVersion().toString().equals(version)) {
+                        continue;
+                    }
+                    artifacts.add(new Artifact(query.getGroupId(), query.getArtifactId(), version, query.getType()));
+                }
+            }
+        } else {
+            // todo: not very efficient
+            SortedSet set = list();
+            String targetGroup = query.getGroupId();
+            String targetArtifact = query.getArtifactId();
+            Version targetVersion = query.getVersion();
+            String targetType = query.getType();
+            for (Iterator it = set.iterator(); it.hasNext();) {
+                Artifact candidate = (Artifact) it.next();
+                if(targetGroup != null && !targetGroup.equals(candidate.getGroupId())) {
+                    continue;
+                }
+                if(targetArtifact != null && !targetArtifact.equals(candidate.getArtifactId())) {
+                    continue;
+                }
+                if(targetType != null && !targetType.equals(candidate.getType())) {
+                    continue;
+                }
+                if(targetVersion != null && !targetVersion.equals(candidate.getVersion())) {
+                    continue;
+                }
+                artifacts.add(candidate);
             }
         }
         return artifacts;

Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/Maven2Repository.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/Maven2Repository.java?rev=394439&r1=394438&r2=394439&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/Maven2Repository.java (original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/Maven2Repository.java Sat Apr 15 23:35:09 2006
@@ -17,6 +17,7 @@
 package org.apache.geronimo.system.repository;
 
 import java.io.File;
+import java.io.FilenameFilter;
 import java.net.URI;
 import java.util.ArrayList;
 import java.util.List;
@@ -51,6 +52,10 @@
     }
 
     public SortedSet list() {
+        return listInternal(null, null, null);
+    }
+
+    private SortedSet listInternal(String artifactMatch, String typeMatch, String versionMatch) {
         SortedSet artifacts = new TreeSet();
         File[] groupIds = rootFile.listFiles();
         for (int i = 0; i < groupIds.length; i++) {
@@ -60,7 +65,7 @@
                 for (int j = 0; j < versionDirs.length; j++) {
                     File versionDir = versionDirs[j];
                     if (versionDir.canRead() && versionDir.isDirectory()) {
-                        artifacts.addAll(getArtifacts(null, versionDir));
+                        artifacts.addAll(getArtifacts(null, versionDir, artifactMatch, typeMatch, versionMatch));
                     }
                 }
             }
@@ -68,32 +73,50 @@
         return artifacts;
     }
 
-    public SortedSet list(String groupId, String artifactId, String type) {
-        File path = new File(rootFile, groupId.replace('.', File.separatorChar));
-        path = new File(path, artifactId);
+    public SortedSet list(Artifact query) {
+        if(query.getGroupId() != null) { // todo: see if more logic can be shared with the other case
+            File path = new File(rootFile, query.getGroupId().replace('.', File.separatorChar));
+            path = new File(path, query.getArtifactId());
+            if(!path.canRead() || !path.isDirectory()) {
+                return new TreeSet();
+            }
 
-        SortedSet artifacts = new TreeSet();
+            SortedSet artifacts = new TreeSet();
 
-        File[] versionDirs = path.listFiles();
-        for (int i = 0; i < versionDirs.length; i++) {
-            File versionDir = versionDirs[i];
-            if (versionDir.canRead() && versionDir.isDirectory()) {
-                String version = versionDir.getName();
-                String fileName = artifactId + "-" + version + "." + type;
-                File file = new File(versionDir, fileName);
-                if (file.canRead() && file.isFile()) {
-                    artifacts.add(new Artifact(groupId,
-                            artifactId,
-                            version,
-                            type
-                    ));
+            File[] versionDirs = path.listFiles();
+            for (int i = 0; i < versionDirs.length; i++) {
+                File versionDir = versionDirs[i];
+                if (versionDir.canRead() && versionDir.isDirectory()) {
+                    String version = versionDir.getName();
+                    if(query.getVersion() != null && !query.getVersion().toString().equals(version)) {
+                        continue;
+                    }
+                    // Assumes that artifactId is set
+                    final String filePrefix = query.getArtifactId() + "-" + version + ".";
+                    File[] list = versionDir.listFiles(new FilenameFilter() {
+                        public boolean accept(File dir, String name) {
+                            return name.startsWith(filePrefix);
+                        }
+                    });
+                    for (int j = 0; j < list.length; j++) {
+                        File file = list[j];
+                        String end = file.getName().substring(filePrefix.length());
+                        if(query.getType() != null && !query.getType().equals(end)) {
+                            continue;
+                        }
+                        if(end.indexOf('.') < 0) {
+                            artifacts.add(new Artifact(query.getGroupId(), query.getArtifactId(), version, end));
+                        }
+                    }
                 }
             }
+            return artifacts;
+        } else {
+            return listInternal(query.getArtifactId(), query.getType(), query.getVersion() == null ? null : query.getVersion().toString());
         }
-        return artifacts;
     }
 
-    private List getArtifacts(String groupId, File versionDir) {
+    private List getArtifacts(String groupId, File versionDir, String artifactMatch, String typeMatch, String versionMatch) {
         // org/apache/xbean/xbean-classpath/2.2-SNAPSHOT/xbean-classpath-2.2-SNAPSHOT.jar
         List artifacts = new ArrayList();
         String artifactId = versionDir.getParentFile().getName();
@@ -114,11 +137,19 @@
                             String type = fileName.substring(fileHeader.length());
 
                             if (!type.endsWith(".sha1") && !type.endsWith(".md5")) {
+                                if(artifactMatch != null && !artifactMatch.equals(artifactId)) {
+                                    continue;
+                                }
+                                if(typeMatch != null && !typeMatch.equals(type)) {
+                                    continue;
+                                }
+                                if(versionMatch != null && !versionMatch.equals(version)) {
+                                    continue;
+                                }
                                 artifacts.add(new Artifact(groupId,
                                         artifactId,
                                         version,
-                                        type
-                                ));
+                                        type));
                             }
                         }
                     } else { // this is just part of the path to the artifact
@@ -129,7 +160,7 @@
                             nextGroupId = groupId + "." + artifactId;
                         }
 
-                        artifacts.addAll(getArtifacts(nextGroupId, file));
+                        artifacts.addAll(getArtifacts(nextGroupId, file, artifactMatch, typeMatch, versionMatch));
                     }
                 } else if (groupId != null) {
                     String version = versionDir.getName();
@@ -141,6 +172,15 @@
                         String type = fileName.substring(fileHeader.length());
 
                         if (!type.endsWith(".sha1") && !type.endsWith(".md5")) {
+                            if(artifactMatch != null && !artifactMatch.equals(artifactId)) {
+                                continue;
+                            }
+                            if(typeMatch != null && !typeMatch.equals(type)) {
+                                continue;
+                            }
+                            if(versionMatch != null && !versionMatch.equals(version)) {
+                                continue;
+                            }
                             artifacts.add(new Artifact(groupId,
                                     artifactId,
                                     version,

Modified: geronimo/branches/1.1/modules/system/src/schema/config-list.xsd
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/schema/config-list.xsd?rev=394439&r1=394438&r2=394439&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/schema/config-list.xsd (original)
+++ geronimo/branches/1.1/modules/system/src/schema/config-list.xsd Sat Apr 15 23:35:09 2006
@@ -17,24 +17,72 @@
 -->
 
 <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"
-    >
+        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).
+            external site (namely, a Maven 2 repository).
         </xs:documentation>
     </xs:annotation>
 
-    <xs:element name="geronimo-config-list" type="list:config-listType"/>
+    <!--   Top-level elements   -->
+
+    <xs:element name="geronimo-plugin-list" type="list:config-listType">
+        <xs:annotation>
+            <xs:documentation>
+                The geronimo-plugin-list root element is used for the config file present
+                in the root directory of a Maven repository supporting Geronimo plugin
+                downloads. This will be scanned by Geronimo clients to determine what
+                plugins are available on that server.
+            </xs:documentation>
+        </xs:annotation>
+    </xs:element>
+    <xs:element name="geronimo-configuration" type="list:configurationType">
+        <xs:annotation>
+            <xs:documentation>
+                The geronimo-configuration root element is used as the config file
+                submitted with an individual Geronimo configuration to the plugin
+                repository. It will be merged into the plugin list for the repository
+                when the submitted plugin is accepted.
+            </xs:documentation>
+        </xs:annotation>
+    </xs:element>
+
+    <!--   Data types used in this schema   -->
 
     <xs:complexType name="config-listType">
         <xs:sequence>
-            <xs:element name="configuration" type="list:configurationType" minOccurs="0" maxOccurs="unbounded" />
+            <xs:element name="configuration" type="list:configurationType" minOccurs="0" maxOccurs="unbounded">
+                <xs:annotation>
+                    <xs:documentation>
+                        The list of configurations available in the current plugin repository.
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+            <xs:element name="backup-repository" type="xs:string" minOccurs="0" maxOccurs="unbounded">
+                <xs:annotation>
+                    <xs:documentation>
+                        Each backup-repository is a URL to check for any dependencies that
+                        were not found in the current repository. That can be used, for
+                        example, to host Geronimo configurations at one site and common
+                        third-party JARs at another.
+
+                        The repository where this file came from will be checked first for
+                        every artifact, and if an artifact is not found there, each of the
+                        repositories listed here will be checked in the order listed until
+                        the artifact is found.
+
+                        Note that while the primary repository may be protected by HTTP
+                        Basic authentication, the backup repositories must either use the
+                        same username and password as the primary or use no authentication.
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
         </xs:sequence>
     </xs:complexType>
 
@@ -43,7 +91,7 @@
             <xs:element name="name" type="xs:string">
                 <xs:annotation>
                     <xs:documentation>
-                        A human-readable name for this configuration.  This will be used to identify
+                        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>
@@ -60,12 +108,31 @@
             <xs:element name="category" type="xs:string">
                 <xs:annotation>
                     <xs:documentation>
-                        A category name for this configuration.  The user interface typically groups
+                        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="license" type="list:licenseType" minOccurs="0" maxOccurs="unbounded">
+                <xs:annotation>
+                    <xs:documentation>
+                        The name of the license that applies to this plugin, usually composed of a
+                        license class (if any) followed by the name and version of a license:
+                        BSD -- Apache Software License (ASL) 2.0
+                        GPL -- Lesser General Public License (LGPL) 2
+
+                        If there is more than one license listed then that means the user may choose
+                        among any of the available licenses.
+
+                        Contains a mandatory true/false attribute indicating whether this license
+                        is OSI-approved (e.g. whether the plugin is open source).
+
+                        Note that the license declared here applies only to the current component.
+                        Any dependencies may be licensed separately.
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
             <xs:element name="geronimo-version" type="xs:string" minOccurs="0" maxOccurs="unbounded">
                 <xs:annotation>
                     <xs:documentation>
@@ -74,39 +141,168 @@
                         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.
+
+                        This is applied as an exact match: 1.2 does not match 1.2.1 or 1.2-SNAPSHOT
                     </xs:documentation>
                 </xs:annotation>
             </xs:element>
-            <xs:element name="prerequisite" type="xs:string" minOccurs="0" maxOccurs="unbounded">
+            <xs:element name="jvm-version" 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.
+                        Indicates a version of the JVM that this component can run in. If no jvm-version
+                        is listed, that means the component can run in any version of the JVM supported
+                        by Geronimo so long as the prerequisites, parents, and dependencies are present.
+                        If one or more jvm-version elements are listed, then the JVM that Geronimo is
+                        currently running on must match one of them in order for this component to be
+                        installable. (It does not stop you from restarting Geronimo on a different JVM
+                        version once the components is already installed.)
 
-                        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).
+                        This is not normally used, but must be for components that use CORBA or
+                        serialized QNames, etc.
+
+                        This is applied as a prefix match: 1.4 matches 1.4.2 or 1.4.2_10
                     </xs:documentation>
                 </xs:annotation>
             </xs:element>
-            <xs:element name="parent" type="xs:string" minOccurs="0" maxOccurs="unbounded">
+            <xs:element name="prerequisite" type="list:prerequisiteType" 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.
+                        A dependency of this configuration that must be previously installed if this
+                        configuration is to be considered to be installable. This is generally the
+                        same as the dependency element (for example, it may refer to a configuration
+                        by configId or a JAR by repository ID) except that the dependency will not
+                        be downloaded on demand and must have been previously installed.
+
+                        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.
+
+                        It is also used by the public Geronimo plugin repository in cases where the
+                        dependencies cannot be redistributed (e.g. a dependency on a commercial JDBC
+                        driver JAR which must be manually acquired and installed).
+
+                        It is also used when a user must set something up (like a database pool or
+                        security realm) to point to a custom resource in their environment before the
+                        component can be installed.
+
+                        This is applied as an exact match, except that the version number may be
+                        omitted, in which case any matching version of the dependency will work.
+
+                        It has an optional resource-type attribute indicating to the user what type
+                        of prerequisite this is (for cases where they're expected to set something up
+                        as opposed to just downloading a JAR). e.g. it could be set to "JDBC Pool".
                     </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.
+                        The configId of another configuration or the repository ID of a 3rd party JAR
+                        that this configuration depends on. That means that the dependency must be
+                        downloaded and installed if this configuration is selected.
+
+                        Note: If the dependency referred to here is a configuration, it may have
+                        additional dependencies that will need to be downloaded and installed. If the
+                        dependency referred to here is just a JAR, it will not be consulted for
+                        transitive dependencies -- it's assumed that a configuration lists all the
+                        JARs it actually depends on.
+
+                        This is applied as an exact match, except that the version number may be
+                        omitted, in which case any matching version of the dependency will work.
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+        </xs:sequence>
+    </xs:complexType>
+
+    <xs:complexType name="licenseType">
+        <xs:annotation>
+            <xs:documentation>
+                See configurationType/license above
+            </xs:documentation>
+        </xs:annotation>
+
+        <xs:simpleContent>
+            <xs:extension base="xs:string">
+                <xs:attribute name="osi-approved" use="required" type="xs:boolean">
+                    <xs:annotation>
+                        <xs:documentation>
+                            Indicates whether this license is OSI-approved, which is to say, whether
+                            the plugin is open source. Typically this is true for all licenses
+                            you'd expect to be open source, and false for proprietary plugins.
+
+                            If there's some doubt, visit http://www.opensource.org/licenses/index.php
+                        </xs:documentation>
+                    </xs:annotation>
+                </xs:attribute>
+            </xs:extension>
+        </xs:simpleContent>
+    </xs:complexType>
+
+    <xs:complexType name="prerequisiteType">
+        <xs:sequence>
+            <xs:element name="id" type="xs:string">
+                <xs:annotation>
+                    <xs:documentation>
+                        The Config ID of the prerequisite.  This is used to check whether
+                        it's available on the server that you're downloading the plugin
+                        into.  It may omit some portions of the Config ID to be more
+                        accomodating (e.g. "*/MyDBPool/*/*" to identify a database pool
+                        instead of "console/MyDBPool/1.0/car").
+
+                        Note that the values here may take the non-standard syntax of
+                        * instead of the empty string for a missing value, which will
+                        hopefully make the wildcard format more user-friendly.
+                        (On the theory that "Please install */MyDBPool/*/*" should make
+                        more sense than "Please install /MyDBPool//" for an average user)
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+            <xs:element name="resource-type" type="xs:string">
+                <xs:annotation>
+                    <xs:documentation>
+                        Describes the type of resource that the prerequisite is. Examples
+                        include:
+
+                        JDBC Driver
+                        JDBC Pool
+                        JMS Resource Group
+                        JavaMail
+
+                        This is mainly used for prerequisites where the user needs to set
+                        something up and you want to indicate what. So for example, you
+                        could say "console/myapp-pool/*/jar" is a prerequisite with resource
+                        type "JDBC Pool" and then the user should understand that they can
+                        install your plugin if they create a JDBC pool called "myapp-pool"
+                        in the console, or manually deploy a pool with configId
+                        "console/myapp-pool/(something)/jar"
+
+                        Another option in that case would be to use a dependency on a JDBC
+                        pool configuration you provide, but then it would have to use the
+                        system database (and run a DDL script on the first connect) in order
+                        to be installable in an arbitrary Geronimo server. That would be a
+                        better approach for demonstration applications, whereas the
+                        prerequisite on a user-installed pool would be a better approach for
+                        production applications.
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+            <xs:element name="description" type="xs:string">
+                <xs:annotation>
+                    <xs:documentation>
+                        A description for the user about why this is a prerequisite and what
+                        they should do to set it up.  Here are a couple examples:
+
+                        This plugin of SomeApp is configured for the Jetty version of
+                        Geronimo.  It cannot be installed on the Tomcat version of Geronimo.
+                        There's a separate plugin for the Tomcat version of Geronimo.
+
+                        SomeApp requires a database connection pool.  Supported databases
+                        are PostgreSQL and MySQL.  Please configure a database connection
+                        pool with the name "SomeAppPool" and then run the associated create
+                        script from http://someapp.com/db-scripts/ before installing this
+                        plugin.
                     </xs:documentation>
                 </xs:annotation>
             </xs:element>

Added: geronimo/branches/1.1/modules/system/src/test-data/geronimo-plugins.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/test-data/geronimo-plugins.xml?rev=394439&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/system/src/test-data/geronimo-plugins.xml (added)
+++ geronimo/branches/1.1/modules/system/src/test-data/geronimo-plugins.xml Sat Apr 15 23:35:09 2006
@@ -0,0 +1,168 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<geronimo-plugin-list>
+
+<configuration>
+<name>DayTrader Performance Testing App (Jetty/Derby)</name>
+<config-id>geronimo/daytrader-derby-jetty/1.1-SNAPSHOT/car</config-id>
+<category>Examples</category>
+<geronimo-version>1.1-SNAPSHOT</geronimo-version>
+<prerequisite><id>geronimo/jetty/*/car</id><description>
+		This is a web application or web-related module, configured for the Jetty web container.  It will not run on Tomcat versions of Geronimo.  If you need a Tomcat version of this application, you'll need to get it from another Tomcat Geronimo installation.
+</description></prerequisite>
+<dependency>geronimo/j2ee-server/1.1-SNAPSHOT/car</dependency>
+<dependency>geronimo/geronimo-daytrader-derby-db/1.1-SNAPSHOT/jar</dependency>
+</configuration>
+
+<configuration>
+<name>DayTrader Client (Jetty/Derby)</name>
+<config-id>geronimo/daytrader-derby-jetty-streamer-client/1.1-SNAPSHOT/car</config-id>
+<category>Examples</category>
+<geronimo-version>1.1-SNAPSHOT</geronimo-version>
+<prerequisite><id>geronimo/jetty/*/car</id><description>
+		This is a web application or web-related module, configured for the Jetty web container.  It will not run on Tomcat versions of Geronimo.  If you need a Tomcat version of this application, you'll need to get it from another Tomcat Geronimo installation.
+</description></prerequisite>
+<dependency>geronimo/client/1.1-SNAPSHOT/car</dependency>
+</configuration>
+
+<configuration>
+<name>Jakarta JSP Examples (Jetty)</name>
+<config-id>geronimo/jsp-examples-jetty/1.1-SNAPSHOT/car</config-id>
+<category>Examples</category>
+<geronimo-version>1.1-SNAPSHOT</geronimo-version>
+<prerequisite><id>geronimo/jetty/*/car</id><description>
+		This is a web application or web-related module, configured for the Jetty web container.  It will not run on Tomcat versions of Geronimo.  If you need a Tomcat version of this application, you'll need to get it from another Tomcat Geronimo installation.
+</description></prerequisite>
+<dependency>commons-collections/commons-collections/3.1/jar</dependency>
+<dependency>geronimo/j2ee-server/1.1-SNAPSHOT/car</dependency>
+<dependency>geronimo/jetty/1.1-SNAPSHOT/car</dependency>
+</configuration>
+
+<configuration>
+<name>LDAP Demo Web App (Jetty)</name>
+<config-id>geronimo/ldap-demo-jetty/1.1-SNAPSHOT/car</config-id>
+<category>Examples</category>
+<geronimo-version>1.1-SNAPSHOT</geronimo-version>
+<prerequisite><id>geronimo/jetty/*/car</id><description>
+		This is a web application or web-related module, configured for the Jetty web container.  It will not run on Tomcat versions of Geronimo.  If you need a Tomcat version of this application, you'll need to get it from another Tomcat Geronimo installation.
+</description></prerequisite>
+<dependency>geronimo/ldap-realm/1.1-SNAPSHOT/car</dependency>
+<dependency>geronimo/j2ee-server/1.1-SNAPSHOT/car</dependency>
+<dependency>geronimo/jetty/1.1-SNAPSHOT/car</dependency>
+</configuration>
+
+<configuration>
+<name>LDAP Demo Security Realm</name>
+<config-id>geronimo/ldap-realm/1.1-SNAPSHOT/car</config-id>
+<category>Examples</category>
+<geronimo-version>1.1-SNAPSHOT</geronimo-version>
+<jvm-version>1.5</jvm-version>
+<dependency>geronimo/j2ee-security/1.1-SNAPSHOT/car</dependency>
+</configuration>
+
+<configuration>
+<name>Jakarta Servlet Examples (Jetty)</name>
+<config-id>geronimo/servlets-examples-jetty/1.1-SNAPSHOT/car</config-id>
+<category>Examples</category>
+<geronimo-version>1.1-SNAPSHOT</geronimo-version>
+<prerequisite><id>geronimo/jetty/*/car</id><description>
+		This is a web application or web-related module, configured for the Jetty web container.  It will not run on Tomcat versions of Geronimo.  If you need a Tomcat version of this application, you'll need to get it from another Tomcat Geronimo installation.
+</description></prerequisite>
+<dependency>geronimo/j2ee-server/1.1-SNAPSHOT/car</dependency>
+<dependency>geronimo/jetty/1.1-SNAPSHOT/car</dependency>
+</configuration>
+
+<configuration>
+<name>jUDDI Server 0.9rc4 for Geronimo</name>
+<config-id>geronimo/uddi-jetty/1.1-SNAPSHOT/car</config-id>
+<category>Integration</category>
+<geronimo-version>1.1-SNAPSHOT</geronimo-version>
+<prerequisite><id>geronimo/jetty/*/car</id><description>
+		This is a web application or web-related module, configured for the Jetty web container.  It will not run on Tomcat versions of Geronimo.  If you need a Tomcat version of this application, you'll need to get it from another Tomcat Geronimo installation.
+</description></prerequisite>
+<dependency>geronimo/system-database/1.1-SNAPSHOT/car</dependency>
+<dependency>juddi/juddi/0.9rc4/jar</dependency>
+<dependency>geronimo/geronimo-uddi-db/1.1-SNAPSHOT/jar</dependency>
+<dependency>geronimo/j2ee-server/1.1-SNAPSHOT/car</dependency>
+</configuration>
+
+<configuration>
+<name>Geronimo Admin Console (Jetty)</name>
+<config-id>geronimo/webconsole-jetty/1.1-SNAPSHOT/car</config-id>
+<category>Core Geronimo</category>
+<geronimo-version>1.1-SNAPSHOT</geronimo-version>
+<prerequisite><id>geronimo/jetty/*/car</id><description>
+		This is a web application or web-related module, configured for the Jetty web container.  It will not run on Tomcat versions of Geronimo.  If you need a Tomcat version of this application, you'll need to get it from another Tomcat Geronimo installation.
+</description></prerequisite>
+<dependency>geronimo/j2ee-server/1.1-SNAPSHOT/car</dependency>
+<dependency>geronimo/j2ee-security/1.1-SNAPSHOT/car</dependency>
+<dependency>portlet-api/portlet-api/1.0/jar</dependency>
+<dependency>org.apache.pluto/pluto/1.0.1/jar</dependency>
+<dependency>geronimo/geronimo-console-core/1.1-SNAPSHOT/jar</dependency>
+<dependency>geronimo/geronimo-management/1.1-SNAPSHOT/jar</dependency>
+<dependency>geronimo/geronimo-test-ddbean/1.1-SNAPSHOT/jar</dependency>
+<dependency>geronimo/geronimo-deploy-jsr88/1.1-SNAPSHOT/jar</dependency>
+<dependency>geronimo/geronimo-deploy-config/1.1-SNAPSHOT/jar</dependency>
+<dependency>geronimo/geronimo-service-builder/1.1-SNAPSHOT/jar</dependency>
+<dependency>geronimo/geronimo-connector-builder/1.1-SNAPSHOT/jar</dependency>
+<dependency>geronimo/geronimo-naming-builder/1.1-SNAPSHOT/jar</dependency>
+<dependency>geronimo/geronimo-security-builder/1.1-SNAPSHOT/jar</dependency>
+<dependency>geronimo/geronimo-j2ee-schema/1.1-SNAPSHOT/jar</dependency>
+<dependency>xmlbeans/xbean/2.0.0/jar</dependency>
+<dependency>stax/stax-api/1.0/jar</dependency>
+<dependency>activemq/activemq-gbean-management/3.2.4-SNAPSHOT/jar</dependency>
+<dependency>activemq/activemq-gbean/3.2.4-SNAPSHOT/jar</dependency>
+<dependency>activemq/activemq-core/3.2.4-SNAPSHOT/jar</dependency>
+<dependency>geronimo/geronimo-converter/1.1-SNAPSHOT/jar</dependency>
+<dependency>geronimo/geronimo-util/1.1-SNAPSHOT/jar</dependency>
+<dependency>geronimo/geronimo-jetty/1.1-SNAPSHOT/jar</dependency>
+</configuration>
+
+<configuration>
+<name>Geronimo Remote Deployment Support (Jetty)</name>
+<config-id>geronimo/remote-deploy-jetty/1.1-SNAPSHOT/car</config-id>
+<category>Core Geronimo</category>
+<geronimo-version>1.1-SNAPSHOT</geronimo-version>
+<prerequisite><id>geronimo/jetty/*/car</id><description>
+		This is a web application or web-related module, configured for the Jetty web container.  It will not run on Tomcat versions of Geronimo.  If you need a Tomcat version of this application, you'll need to get it from another Tomcat Geronimo installation.
+</description></prerequisite>
+<dependency>geronimo/geronimo-remote-deploy-lib/1.1-SNAPSHOT/jar</dependency>
+<dependency>xmlbeans/xbean/2.0.0/jar</dependency>
+<dependency>geronimo/j2ee-server/1.1-SNAPSHOT/car</dependency>
+<dependency>geronimo/jetty/1.1-SNAPSHOT/car</dependency>
+</configuration>
+
+<configuration>
+<name>Geronimo JMX Debug Tool (Jetty)</name>
+<config-id>geronimo/jmxdebug-jetty/1.1-SNAPSHOT/car</config-id>
+<category>Core Geronimo</category>
+<geronimo-version>1.1-SNAPSHOT</geronimo-version>
+<prerequisite><id>geronimo/jetty/*/car</id><description>
+		This is a web application or web-related module, configured for the Jetty web container.  It will not run on Tomcat versions of Geronimo.  If you need a Tomcat version of this application, you'll need to get it from another Tomcat Geronimo installation.
+</description></prerequisite>
+<dependency>commons-collections/commons-collections/3.1/jar</dependency>
+<dependency>geronimo/j2ee-server/1.1-SNAPSHOT/car</dependency>
+<dependency>geronimo/jetty/1.1-SNAPSHOT/car</dependency>
+</configuration>
+
+<configuration>
+<name>Geronimo Welcome App (Jetty)</name>
+<config-id>geronimo/welcome-jetty/1.1-SNAPSHOT/car</config-id>
+<category>Core Geronimo</category>
+<geronimo-version>1.1-SNAPSHOT</geronimo-version>
+<prerequisite><id>geronimo/jetty/*/car</id><description>
+		This is a web application or web-related module, configured for the Jetty web container.  It will not run on Tomcat versions of Geronimo.  If you need a Tomcat version of this application, you'll need to get it from another Tomcat Geronimo installation.
+</description></prerequisite>
+<dependency>geronimo/j2ee-server/1.1-SNAPSHOT/car</dependency>
+<dependency>geronimo/jetty/1.1-SNAPSHOT/car</dependency>
+</configuration>
+
+<configuration>
+<name>Apache Directory 0.92 for Geronimo</name>
+<config-id>geronimo/directory/1.1-SNAPSHOT/car</config-id>
+<category>Security</category>
+<geronimo-version>1.1-SNAPSHOT</geronimo-version>
+<dependency>geronimo/j2ee-server/1.1-SNAPSHOT/car</dependency>
+<dependency>geronimo/geronimo-directory/1.1-SNAPSHOT/jar</dependency>
+</configuration>
+
+</geronimo-plugin-list>
\ No newline at end of file

Propchange: geronimo/branches/1.1/modules/system/src/test-data/geronimo-plugins.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/branches/1.1/modules/system/src/test-repo/m1/junk/propertiess/junk-1.5.properties
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/test-repo/m1/junk/propertiess/junk-1.5.properties?rev=394439&view=auto
==============================================================================
    (empty)

Propchange: geronimo/branches/1.1/modules/system/src/test-repo/m1/junk/propertiess/junk-1.5.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/branches/1.1/modules/system/src/test-repo/m2/junk/junk/1.5/junk-1.5.properties
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/test-repo/m2/junk/junk/1.5/junk-1.5.properties?rev=394439&view=auto
==============================================================================
    (empty)

Propchange: geronimo/branches/1.1/modules/system/src/test-repo/m2/junk/junk/1.5/junk-1.5.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/ConfigInstallerTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/ConfigInstallerTest.java?rev=394439&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/ConfigInstallerTest.java (added)
+++ geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/ConfigInstallerTest.java Sat Apr 15 23:35:09 2006
@@ -0,0 +1,175 @@
+/**
+ *
+ * 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.system.configuration;
+
+import java.net.URL;
+import java.util.List;
+import java.util.Collections;
+import java.util.LinkedHashSet;
+import java.util.SortedSet;
+import java.util.TreeSet;
+import java.io.IOException;
+import java.io.File;
+import java.io.InputStream;
+import junit.framework.TestCase;
+import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.ConfigurationStore;
+import org.apache.geronimo.kernel.config.NoSuchStoreException;
+import org.apache.geronimo.kernel.config.Configuration;
+import org.apache.geronimo.kernel.config.NoSuchConfigException;
+import org.apache.geronimo.kernel.config.InvalidConfigException;
+import org.apache.geronimo.kernel.config.ConfigurationData;
+import org.apache.geronimo.kernel.config.NullConfigurationStore;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.WritableListableRepository;
+import org.apache.geronimo.kernel.repository.FileWriteMonitor;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.system.serverinfo.ServerInfo;
+import org.apache.geronimo.system.serverinfo.BasicServerInfo;
+
+/**
+ * Tests the config installer GBean
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class ConfigInstallerTest extends TestCase {
+    private URL testRepo;
+    private ConfigurationInstaller installer;
+
+    protected void setUp() throws Exception {
+        String url = getClass().getResource("/geronimo-plugins.xml").toString();
+        int pos = url.lastIndexOf("/");
+        testRepo = new URL(url.substring(0, pos));
+        installer = new ConfigInstallerGBean(new MockConfigManager(), new MockRepository(), new MockConfigStore(),
+                new BasicServerInfo("."));
+    }
+
+    public void testParsing() throws Exception {
+        ConfigurationList list = installer.listConfigurations(testRepo, null, null);
+        assertEquals(0, list.getBackupRepositories().length);
+        assertEquals(testRepo, list.getMainRepository());
+        assertTrue(list.getConfigurations().length > 0);
+        int prereqCount = 0;
+        for (int i = 0; i < list.getConfigurations().length; i++) {
+            ConfigurationMetadata metadata = list.getConfigurations()[i];
+            prereqCount += metadata.getPrerequisites().length;
+            for (int j = 0; j < metadata.getPrerequisites().length; j++) {
+                ConfigurationMetadata.Prerequisite prerequisite = metadata.getPrerequisites()[j];
+                assertFalse(prerequisite.isPresent());
+            }
+        }
+        assertTrue(prereqCount > 0);
+    }
+
+    private static class MockConfigStore extends NullConfigurationStore {
+
+    }
+
+    private static class MockRepository implements WritableListableRepository {
+        public void copyToRepository(File source, Artifact destination, FileWriteMonitor monitor) throws IOException {
+        }
+
+        public void copyToRepository(InputStream source, Artifact destination, FileWriteMonitor monitor) throws IOException {
+        }
+
+        public boolean contains(Artifact artifact) {
+            return false;
+        }
+
+        public File getLocation(Artifact artifact) {
+            return null;
+        }
+
+        public LinkedHashSet getDependencies(Artifact artifact) {
+            return new LinkedHashSet();
+        }
+
+        public SortedSet list() {
+            return new TreeSet();
+        }
+
+        public SortedSet list(Artifact query) {
+            return new TreeSet();
+        }
+    }
+
+    private static class MockConfigManager implements ConfigurationManager {
+        public boolean isLoaded(Artifact configID) {
+            return false;
+        }
+
+        public List listStores() {
+            return Collections.EMPTY_LIST;
+        }
+
+        public ConfigurationStore[] getStores() {
+            return new ConfigurationStore[0];
+        }
+
+        public ConfigurationStore getStoreForConfiguration(Artifact configuration) {
+            return null;
+        }
+
+        public List listConfigurations(AbstractName store) throws NoSuchStoreException {
+            return Collections.EMPTY_LIST;
+        }
+
+        public boolean isConfiguration(Artifact artifact) {
+            return false;
+        }
+
+        public Configuration getConfiguration(Artifact configId) {
+            return null;
+        }
+
+        public void loadConfiguration(Artifact configID) throws NoSuchConfigException, IOException, InvalidConfigException {
+        }
+
+        public Configuration loadConfiguration(ConfigurationData configurationData) throws NoSuchConfigException, IOException, InvalidConfigException {
+            return null;
+        }
+
+        public void unloadConfiguration(Artifact configID) throws NoSuchConfigException {
+        }
+
+        public void unloadConfiguration(Configuration configuration) throws NoSuchConfigException {
+        }
+
+        public void startConfiguration(Artifact configID) throws InvalidConfigException {
+        }
+
+        public void startConfiguration(Configuration configuration) throws InvalidConfigException {
+        }
+
+        public void stopConfiguration(Artifact configID) throws NoSuchConfigException {
+        }
+
+        public void stopConfiguration(Configuration configuration) throws NoSuchConfigException {
+        }
+
+        public boolean isRunning(Artifact configurationId) {
+            return false;
+        }
+
+        public List listConfigurations() {
+            return null;
+        }
+
+        public void uninstallConfiguration(Artifact configId) throws IOException, NoSuchConfigException {
+        }
+    }
+}

Propchange: geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/ConfigInstallerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message