You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by am...@apache.org on 2006/05/16 03:06:31 UTC

svn commit: r406789 - /geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java

Author: ammulder
Date: Mon May 15 18:06:30 2006
New Revision: 406789

URL: http://svn.apache.org/viewcvs?rev=406789&view=rev
Log:
Improve plugin obsoletes
 - obsoletes can be versionless
 - plugins can obsolete themselves (well, not yet the exact version)

Modified:
    geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java

Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java?rev=406789&r1=406788&r2=406789&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java (original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java Mon May 15 18:06:30 2006
@@ -340,12 +340,16 @@
                 for (int j = 0; j < metadata.getObsoletes().length; j++) {
                     String name = metadata.getObsoletes()[j];
                     Artifact obsolete = Artifact.create(name);
-                    if(configManager.isLoaded(obsolete)) {
-                        if(configManager.isRunning(obsolete)) {
-                            configManager.stopConfiguration(obsolete);
+                    Artifact[] list = configManager.getArtifactResolver().queryArtifacts(obsolete);
+                    for (int k = 0; k < list.length; k++) {
+                        Artifact artifact = list[k];
+                        if(configManager.isLoaded(artifact)) {
+                            if(configManager.isRunning(artifact)) {
+                                configManager.stopConfiguration(artifact);
+                            }
+                            configManager.unloadConfiguration(artifact);
+                            obsoletes.add(artifact);
                         }
-                        configManager.unloadConfiguration(obsolete);
-                        obsoletes.add(obsolete);
                     }
                 }
                 // 3. Download the artifact if necessary, and its dependencies
@@ -526,7 +530,18 @@
         // 1. Check that it's not already running
         if(metadata.getModuleId() != null) { // that is, it's a real configuration not a plugin list
             if(configManager.isRunning(metadata.getModuleId())) {
-                throw new IllegalArgumentException("Configuration "+metadata.getModuleId()+" is already running!");
+                boolean upgrade = false;
+                for (int i = 0; i < metadata.getObsoletes().length; i++) {
+                    String obsolete = metadata.getObsoletes()[i];
+                    Artifact test = Artifact.create(obsolete);
+                    if(test.matches(metadata.getModuleId())) {
+                        upgrade = true;
+                        break;
+                    }
+                }
+                if(!upgrade) {
+                    throw new IllegalArgumentException("Configuration "+metadata.getModuleId()+" is already running!");
+                }
             }
         }
         // 2. Check that we meet the prerequisites