geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
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 GMT
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 @@
             <gbean-name>*:j2eeType=ConfigurationStore,*</gbean-name>
           </pattern>
         </references>
+        <reference name="ServerInfo">
+            <name>ServerInfo</name>
+        </reference>
     </gbean>
 
     <!-- Logging service -->

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();
     }



Mime
View raw message