Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 43799 invoked from network); 1 Apr 2006 16:23:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 1 Apr 2006 16:23:37 -0000 Received: (qmail 74185 invoked by uid 500); 1 Apr 2006 16:23:36 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 74162 invoked by uid 500); 1 Apr 2006 16:23:36 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 74151 invoked by uid 99); 1 Apr 2006 16:23:36 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 01 Apr 2006 08:23:36 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Sat, 01 Apr 2006 08:23:35 -0800 Received: (qmail 42389 invoked by uid 65534); 1 Apr 2006 16:23:15 -0000 Message-ID: <20060401162315.42377.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r390692 - in /geronimo/trunk: configs/j2ee-system/src/plan/plan.xml modules/system/src/java/org/apache/geronimo/system/configuration/ConfigInstallerGBean.java Date: Sat, 01 Apr 2006 16:23:14 -0000 To: scm@geronimo.apache.org From: ammulder@apache.org X-Mailer: svnmailer-1.0.7 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: ammulder Date: Sat Apr 1 08:23:13 2006 New Revision: 390692 URL: http://svn.apache.org/viewcvs?rev=390692&view=rev Log: Only count configurations as eligible for installation if there's a match on the Geronimo version Modified: geronimo/trunk/configs/j2ee-system/src/plan/plan.xml geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigInstallerGBean.java Modified: geronimo/trunk/configs/j2ee-system/src/plan/plan.xml URL: http://svn.apache.org/viewcvs/geronimo/trunk/configs/j2ee-system/src/plan/plan.xml?rev=390692&r1=390691&r2=390692&view=diff ============================================================================== --- geronimo/trunk/configs/j2ee-system/src/plan/plan.xml (original) +++ geronimo/trunk/configs/j2ee-system/src/plan/plan.xml Sat Apr 1 08:23:13 2006 @@ -87,6 +87,9 @@ *:j2eeType=ConfigurationStore,* + + ServerInfo + 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=390692&r1=390691&r2=390692&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 08:23:13 2006 @@ -26,6 +26,7 @@ import org.apache.geronimo.kernel.config.InvalidConfigException; import org.apache.geronimo.kernel.repository.WriteableRepository; 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; @@ -65,12 +66,14 @@ private Collection configStores; private WriteableRepository writeableRepo; private ConfigurationStore configStore; + private ServerInfo serverInfo; private Map configIdToFile = new HashMap(); - public ConfigInstallerGBean(Collection configStores, WriteableRepository writeableRepo, ConfigurationStore configStore) { + public ConfigInstallerGBean(Collection configStores, WriteableRepository writeableRepo, ConfigurationStore configStore, ServerInfo serverInfo) { this.configStores = configStores; this.writeableRepo = writeableRepo; this.configStore = configStore; + this.serverInfo = serverInfo; } public ConfigurationMetadata[] listConfigurations(URL mavenRepository, String username, String password) throws IOException { @@ -109,24 +112,39 @@ for (int i = 0; i < configs.getLength(); i++) { Element config = (Element) configs.item(i); String configId = getChildText(config, "config-id"); - boolean eligible = true; + String[] versions = getChildrenText(config, "geronimo-version"); 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; + boolean eligible = true; + // If the config has versions listed, make sure one of them matches + if(versions != null && versions.length > 0) { + eligible = false; + String mine = serverInfo.getVersion(); + for (int j = 0; j < versions.length; j++) { + String version = versions[j]; + if(version.equals(mine)) { + eligible = true; } } - if(!found) { - eligible = false; - break; + } + // If the config has prereqs listed, make sure we have them all + if(eligible) { + 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.setGeronimoVersions(versions); data.setPrerequisites(prereqs); results.add(data); } @@ -324,9 +342,10 @@ infoFactory.addReference("DependencyInstallTarget", WriteableRepository.class, "GBean"); infoFactory.addReference("ConfigurationInstallTarget", ConfigurationStore.class, "ConfigurationStore"); infoFactory.addReference("AllConfigStores", ConfigurationStore.class, "ConfigurationStore"); + infoFactory.addReference("ServerInfo", ServerInfo.class, "GBean"); infoFactory.addInterface(ConfigurationInstaller.class); - infoFactory.setConstructor(new String[]{"AllConfigStores", "DependencyInstallTarget", "ConfigurationInstallTarget"}); + infoFactory.setConstructor(new String[]{"AllConfigStores", "DependencyInstallTarget", "ConfigurationInstallTarget", "ServerInfo"}); GBEAN_INFO = infoFactory.getBeanInfo(); }