You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2008/02/12 10:20:02 UTC

svn commit: r620729 - in /geronimo/server/trunk/framework/modules: geronimo-deployment/src/test/java/org/apache/geronimo/deployment/ geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ geronimo-plugin/src/test/java/org/apache/geronimo/syst...

Author: djencks
Date: Tue Feb 12 01:19:46 2008
New Revision: 620729

URL: http://svn.apache.org/viewvc?rev=620729&view=rev
Log:
GERONIMO-3840 sort the modules before trying to load them

Modified:
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/DeploymentContextTest.java
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/SingleFileHotDeployerTest.java
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationManager.java
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
    geronimo/server/trunk/framework/modules/geronimo-plugin/src/test/java/org/apache/geronimo/system/plugin/CopyFileTest.java
    geronimo/server/trunk/framework/modules/geronimo-plugin/src/test/java/org/apache/geronimo/system/plugin/PluginInstallerTest.java
    geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java

Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/DeploymentContextTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/DeploymentContextTest.java?rev=620729&r1=620728&r2=620729&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/DeploymentContextTest.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/DeploymentContextTest.java Tue Feb 12 01:19:46 2008
@@ -27,6 +27,7 @@
 import java.util.List;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.LinkedHashSet;
 import java.util.jar.JarFile;
 
 import javax.sql.DataSource;
@@ -47,6 +48,7 @@
 import org.apache.geronimo.kernel.config.LifecycleException;
 import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.config.LifecycleMonitor;
+import org.apache.geronimo.kernel.config.InvalidConfigException;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.kernel.repository.ArtifactManager;
@@ -55,6 +57,7 @@
 import org.apache.geronimo.kernel.repository.DefaultArtifactResolver;
 import org.apache.geronimo.kernel.repository.Version;
 import org.apache.geronimo.kernel.repository.Repository;
+import org.apache.geronimo.kernel.repository.MissingDependencyException;
 import org.apache.geronimo.deployment.util.DeploymentUtil;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.common.DeploymentException;
@@ -407,6 +410,10 @@
         }
 
         public Collection<? extends Repository> getRepositories() {
+            return null;
+        }
+
+        public LinkedHashSet<Artifact> sort(List<Artifact> ids, LifecycleMonitor monitor) throws InvalidConfigException, IOException, NoSuchConfigException, MissingDependencyException {
             return null;
         }
     }

Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/SingleFileHotDeployerTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/SingleFileHotDeployerTest.java?rev=620729&r1=620728&r2=620729&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/SingleFileHotDeployerTest.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/SingleFileHotDeployerTest.java Tue Feb 12 01:19:46 2008
@@ -25,6 +25,7 @@
 import java.util.Collections;
 import java.util.List;
 import java.util.Set;
+import java.util.LinkedHashSet;
 import java.util.jar.JarFile;
 
 import junit.framework.TestCase;
@@ -52,6 +53,7 @@
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.kernel.repository.Version;
 import org.apache.geronimo.kernel.repository.Repository;
+import org.apache.geronimo.kernel.repository.MissingDependencyException;
 
 
 /**
@@ -473,6 +475,10 @@
         }
 
         public Collection<? extends Repository> getRepositories() {
+            return null;
+        }
+
+        public LinkedHashSet<Artifact> sort(List<Artifact> ids, LifecycleMonitor monitor) throws InvalidConfigException, IOException, NoSuchConfigException, MissingDependencyException {
             return null;
         }
     }

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationManager.java?rev=620729&r1=620728&r2=620729&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationManager.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationManager.java Tue Feb 12 01:19:46 2008
@@ -19,11 +19,13 @@
 import java.io.IOException;
 import java.util.List;
 import java.util.Collection;
+import java.util.LinkedHashSet;
 
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.ArtifactResolver;
 import org.apache.geronimo.kernel.repository.Version;
 import org.apache.geronimo.kernel.repository.Repository;
+import org.apache.geronimo.kernel.repository.MissingDependencyException;
 import org.apache.geronimo.gbean.AbstractName;
 
 /**
@@ -500,4 +502,6 @@
     void setOnline(boolean online);
 
     Collection<? extends Repository> getRepositories();
+
+    LinkedHashSet<Artifact> sort(List<Artifact> ids, LifecycleMonitor monitor) throws InvalidConfigException, IOException, NoSuchConfigException, MissingDependencyException;
 }

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java?rev=620729&r1=620728&r2=620729&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java Tue Feb 12 01:19:46 2008
@@ -68,11 +68,11 @@
     public SimpleConfigurationManager(Collection stores, ArtifactResolver artifactResolver, Collection<? extends Repository> repositories) {
         this(stores, artifactResolver, repositories, Collections.EMPTY_SET);
     }
-    
+
     public SimpleConfigurationManager(Collection stores,
-            ArtifactResolver artifactResolver,
-            Collection<? extends Repository> repositories,
-            Collection watchers) {
+                                      ArtifactResolver artifactResolver,
+                                      Collection<? extends Repository> repositories,
+                                      Collection watchers) {
         if (stores == null) stores = Collections.EMPTY_SET;
         if (repositories == null) repositories = Collections.emptySet();
         if (watchers == null) watchers = Collections.EMPTY_SET;
@@ -84,13 +84,13 @@
     }
 
     public synchronized boolean isInstalled(Artifact configId) {
-        if(!configId.isResolved()) {
-            throw new IllegalArgumentException("Artifact "+configId+" is not fully resolved");
+        if (!configId.isResolved()) {
+            throw new IllegalArgumentException("Artifact " + configId + " is not fully resolved");
         }
         List storeSnapshot = getStoreList();
         for (int i = 0; i < storeSnapshot.size(); i++) {
             ConfigurationStore store = (ConfigurationStore) storeSnapshot.get(i);
-            if(store.containsConfiguration(configId)) {
+            if (store.containsConfiguration(configId)) {
                 return true;
             }
         }
@@ -98,18 +98,18 @@
     }
 
     public synchronized boolean isLoaded(Artifact configId) {
-        if(!configId.isResolved()) {
-            throw new IllegalArgumentException("Artifact "+configId+" is not fully resolved");
+        if (!configId.isResolved()) {
+            throw new IllegalArgumentException("Artifact " + configId + " is not fully resolved");
         }
-        if(reloadingConfiguration != null && reloadingConfiguration.getId().equals(configId)) {
+        if (reloadingConfiguration != null && reloadingConfiguration.getId().equals(configId)) {
             return true;
         }
         return configurationModel.isLoaded(configId);
     }
 
     public synchronized boolean isRunning(Artifact configId) {
-        if(!configId.isResolved()) {
-            throw new IllegalArgumentException("Artifact "+configId+" is not fully resolved");
+        if (!configId.isResolved()) {
+            throw new IllegalArgumentException("Artifact " + configId + " is not fully resolved");
         }
         return configurationModel.isStarted(configId);
     }
@@ -119,11 +119,11 @@
         List configs = new ArrayList();
         for (int i = 0; i < all.length; i++) {
             Artifact artifact = all[i];
-            if(isConfiguration(artifact)) {
+            if (isConfiguration(artifact)) {
                 configs.add(artifact);
             }
         }
-        if(configs.size() == all.length) {
+        if (configs.size() == all.length) {
             return all;
         }
         return (Artifact[]) configs.toArray(new Artifact[configs.size()]);
@@ -168,13 +168,13 @@
     }
 
     public ConfigurationStore getStoreForConfiguration(Artifact configId) {
-        if(!configId.isResolved()) {
-            throw new IllegalArgumentException("Artifact "+configId+" is not fully resolved");
+        if (!configId.isResolved()) {
+            throw new IllegalArgumentException("Artifact " + configId + " is not fully resolved");
         }
         List storeSnapshot = getStoreList();
         for (int i = 0; i < storeSnapshot.size(); i++) {
             ConfigurationStore store = (ConfigurationStore) storeSnapshot.get(i);
-            if(store.containsConfiguration(configId)) {
+            if (store.containsConfiguration(configId)) {
                 return store;
             }
         }
@@ -220,8 +220,8 @@
     }
 
     public boolean isConfiguration(Artifact artifact) {
-        if(!artifact.isResolved()) {
-            throw new IllegalArgumentException("Artifact "+artifact+" is not fully resolved");
+        if (!artifact.isResolved()) {
+            throw new IllegalArgumentException("Artifact " + artifact + " is not fully resolved");
         }
         synchronized (this) {
             // if it is loaded, it is definitely a configuration
@@ -242,10 +242,10 @@
     }
 
     public synchronized Configuration getConfiguration(Artifact configurationId) {
-        if(!configurationId.isResolved()) {
-            throw new IllegalArgumentException("Artifact "+configurationId+" is not fully resolved");
+        if (!configurationId.isResolved()) {
+            throw new IllegalArgumentException("Artifact " + configurationId + " is not fully resolved");
         }
-        if(reloadingConfiguration != null && reloadingConfiguration.getId().equals(configurationId)) {
+        if (reloadingConfiguration != null && reloadingConfiguration.getId().equals(configurationId)) {
             return reloadingConfiguration;
         }
         return (Configuration) configurations.get(configurationId);
@@ -256,8 +256,8 @@
     }
 
     public synchronized LifecycleResults loadConfiguration(Artifact configurationId, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException {
-        if(!configurationId.isResolved()) {
-            throw new IllegalArgumentException("Artifact "+configurationId+" is not fully resolved");
+        if (!configurationId.isResolved()) {
+            throw new IllegalArgumentException("Artifact " + configurationId + " is not fully resolved");
         }
         if (isLoaded(configurationId)) {
             // already loaded, so just mark the configuration as user loaded
@@ -414,25 +414,23 @@
         return startParent;
     }
 
-    private static LinkedHashSet getConfigurationIds(Collection configurations) {
-        LinkedHashSet configurationIds = new LinkedHashSet(configurations.size());
-        for (Iterator iterator = configurations.iterator(); iterator.hasNext();) {
-            Configuration configuration = (Configuration) iterator.next();
+    private static LinkedHashSet<Artifact> getConfigurationIds(Collection<Configuration> configurations) {
+        LinkedHashSet<Artifact> configurationIds = new LinkedHashSet<Artifact>(configurations.size());
+        for (Configuration configuration : configurations) {
             configurationIds.add(configuration.getId());
         }
         return configurationIds;
     }
 
-    private synchronized void loadDepthFirst(ConfigurationData configurationData, LinkedHashMap configurationsToLoad, LifecycleMonitor monitor) throws NoSuchConfigException, IOException, InvalidConfigException, MissingDependencyException {
+    private synchronized void loadDepthFirst(ConfigurationData configurationData, LinkedHashMap<Artifact, UnloadedConfiguration> configurationsToLoad, LifecycleMonitor monitor) throws NoSuchConfigException, IOException, InvalidConfigException, MissingDependencyException {
         // if this parent hasn't already been processed, iterate into the parent
         Artifact configurationId = configurationData.getId();
         if (!configurationsToLoad.containsKey(configurationId)) {
             monitor.resolving(configurationId);
-            LinkedHashSet resolvedParentIds = resolveParentIds(configurationData);
+            LinkedHashSet<Artifact> resolvedParentIds = resolveParentIds(configurationData);
             monitor.succeeded(configurationId);
-            
-            for (Iterator iterator = resolvedParentIds.iterator(); iterator.hasNext();) {
-                Artifact parentId = (Artifact) iterator.next();
+
+            for (Artifact parentId : resolvedParentIds) {
                 // if this parent id hasn't already been loaded and is actually a configuration
                 if (!isLoaded(parentId) && isConfiguration(parentId)) {
                     ConfigurationData parentConfigurationData = loadConfigurationData(parentId, monitor);
@@ -445,13 +443,30 @@
         }
     }
 
+    public LinkedHashSet<Artifact> sort(List<Artifact> ids, LifecycleMonitor monitor) throws InvalidConfigException, IOException, NoSuchConfigException, MissingDependencyException {
+        LinkedHashSet<Artifact> sorted = new LinkedHashSet<Artifact>();
+        sort(ids, sorted, monitor);
+        sorted.retainAll(ids);
+        return sorted;
+    }
+
+    private void sort(Collection<Artifact> ids, LinkedHashSet<Artifact> sorted, LifecycleMonitor monitor) throws InvalidConfigException, IOException, NoSuchConfigException, MissingDependencyException {
+        for (Artifact id : ids) {
+            if (!sorted.contains(id)) {
+                ConfigurationData data = loadConfigurationData(id, monitor);
+                LinkedHashSet<Artifact> parents = resolveParentIds(data);
+                sort(parents, sorted, monitor);
+                sorted.add(id);
+            }
+        }
+    }
+
     private ConfigurationData loadConfigurationData(Artifact configurationId, LifecycleMonitor monitor) throws NoSuchConfigException, IOException, InvalidConfigException {
-        List storeSnapshot = getStoreList();
+        List<ConfigurationStore> storeSnapshot = getStoreList();
 
         monitor.addConfiguration(configurationId);
         monitor.reading(configurationId);
-        for (int i = 0; i < storeSnapshot.size(); i++) {
-            ConfigurationStore store = (ConfigurationStore) storeSnapshot.get(i);
+        for (ConfigurationStore store : storeSnapshot) {
             if (store.containsConfiguration(configurationId)) {
                 ConfigurationData configurationData = store.loadConfiguration(configurationId);
                 monitor.succeeded(configurationId);
@@ -515,9 +530,9 @@
         return startConfiguration(id, NullLifecycleMonitor.INSTANCE);
     }
 
-    public synchronized LifecycleResults startConfiguration(Artifact id, LifecycleMonitor monitor) throws  NoSuchConfigException, LifecycleException {
-        if(!id.isResolved()) {
-            throw new IllegalArgumentException("Artifact "+id+" is not fully resolved");
+    public synchronized LifecycleResults startConfiguration(Artifact id, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException {
+        if (!id.isResolved()) {
+            throw new IllegalArgumentException("Artifact " + id + " is not fully resolved");
         }
         LinkedHashSet unstartedConfigurations = configurationModel.start(id);
 
@@ -563,8 +578,8 @@
     }
 
     public synchronized LifecycleResults stopConfiguration(Artifact id, LifecycleMonitor monitor) throws NoSuchConfigException {
-        if(!id.isResolved()) {
-            throw new IllegalArgumentException("Artifact "+id+" is not fully resolved");
+        if (!id.isResolved()) {
+            throw new IllegalArgumentException("Artifact " + id + " is not fully resolved");
         }
         LinkedHashSet stopList = configurationModel.stop(id);
 
@@ -596,8 +611,8 @@
     }
 
     public synchronized LifecycleResults restartConfiguration(Artifact id, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException {
-        if(!id.isResolved()) {
-            throw new IllegalArgumentException("Artifact "+id+" is not fully resolved");
+        if (!id.isResolved()) {
+            throw new IllegalArgumentException("Artifact " + id + " is not fully resolved");
         }
         // get a sorted list of configurations to restart
         LinkedHashSet restartList = configurationModel.restart(id);
@@ -676,8 +691,8 @@
     }
 
     public synchronized LifecycleResults unloadConfiguration(Artifact id, LifecycleMonitor monitor) throws NoSuchConfigException {
-        if(!id.isResolved()) {
-            throw new IllegalArgumentException("Artifact "+id+" is not fully resolved");
+        if (!id.isResolved()) {
+            throw new IllegalArgumentException("Artifact " + id + " is not fully resolved");
         }
         Set started = configurationModel.getStarted();
         LinkedHashSet unloadList = configurationModel.unload(id);
@@ -714,7 +729,7 @@
     }
 
     protected void removeConfigurationFromModel(Artifact configurationId) throws NoSuchConfigException {
-        if(configurationModel.containsConfiguration(configurationId)) {
+        if (configurationModel.containsConfiguration(configurationId)) {
             configurationModel.removeConfiguration(configurationId);
         }
         configurations.remove(configurationId);
@@ -741,8 +756,8 @@
     }
 
     public synchronized LifecycleResults reloadConfiguration(Artifact id, Version version, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException {
-        if(!id.isResolved()) {
-            throw new IllegalArgumentException("Artifact "+id+" is not fully resolved");
+        if (!id.isResolved()) {
+            throw new IllegalArgumentException("Artifact " + id + " is not fully resolved");
         }
         Configuration configuration = getConfiguration(id);
         if (configuration == null) { // The configuration to reload is not currently loaded
@@ -754,11 +769,11 @@
                     try {
                         data = store.loadConfiguration(id);
                     } catch (Exception e) {
-                        log.warn("Unable to load existing configuration "+id+" from config store", e);
+                        log.warn("Unable to load existing configuration " + id + " from config store", e);
                     }
                 }
             }
-            if(data == null) {
+            if (data == null) {
                 throw new NoSuchConfigException(id);
             }
             UnloadedConfiguration existingUnloadedConfiguration = new UnloadedConfiguration(data, new LinkedHashSet());
@@ -929,11 +944,11 @@
             stop(existingConfiguration);
             monitor.succeeded(existingConfigurationId);
             results.addStopped(existingConfigurationId);
-        } else if(existingConfiguration != null) {
+        } else if (existingConfiguration != null) {
             // call stop just to be sure the beans aren't running
             stop(existingConfiguration);
         }
-        if(existingConfiguration != null) {
+        if (existingConfiguration != null) {
             monitor.unloading(existingConfigurationId);
             unload(existingConfiguration);
             monitor.succeeded(existingConfigurationId);
@@ -944,7 +959,8 @@
         // load the new configurations
         //
         boolean reinstatedExisting = false;
-        /* reduce variable scope */ {
+        /* reduce variable scope */
+        {
             Map loadedParents = new LinkedHashMap();
             Map startedParents = new LinkedHashMap();
             Configuration newConfiguration = null;
@@ -1024,7 +1040,7 @@
                 addNewConfigurationsToModel(loadedParents);
 
                 // now ugrade the existing node in the model
-                if(configurationModel.containsConfiguration(existingConfigurationId)) {
+                if (configurationModel.containsConfiguration(existingConfigurationId)) {
                     configurationModel.upgradeConfiguration(existingConfigurationId,
                             newConfigurationId,
                             getConfigurationIds(getLoadParents(newConfiguration)),
@@ -1141,7 +1157,6 @@
                     reloadingConfiguration = configuration;
                     monitor.succeeded(configurationId);
 
-
                     // if the configuration was started before restart it
                     if (started.contains(configurationId)) {
                         monitor.starting(configurationId);
@@ -1197,11 +1212,11 @@
         //
         // If nothing failed, delete all the unloaded modules that weren't reloaded
         //
-        if(!results.wasLoaded(existingConfigurationId) && !results.wasFailed(existingConfigurationId)) {
+        if (!results.wasLoaded(existingConfigurationId) && !results.wasFailed(existingConfigurationId)) {
             try {
                 uninstallConfiguration(existingConfigurationId);
             } catch (IOException e) {
-                log.error("Unable to uninstall configuration "+existingConfigurationId, e);
+                log.error("Unable to uninstall configuration " + existingConfigurationId, e);
             }
         }
 
@@ -1234,14 +1249,14 @@
     }
 
     public synchronized void uninstallConfiguration(Artifact configurationId) throws IOException, NoSuchConfigException {
-        if(!configurationId.isResolved()) {
-            throw new IllegalArgumentException("Artifact "+configurationId+" is not fully resolved");
+        if (!configurationId.isResolved()) {
+            throw new IllegalArgumentException("Artifact " + configurationId + " is not fully resolved");
         }
         if (configurations.containsKey(configurationId)) {
-            if(isRunning(configurationId)) {
+            if (isRunning(configurationId)) {
                 stopConfiguration(configurationId);
             }
-            if(isLoaded((configurationId))) {
+            if (isLoaded((configurationId))) {
                 unloadConfiguration(configurationId);
             }
         }
@@ -1250,7 +1265,7 @@
         List storeSnapshot = getStoreList();
         for (int i = 0; i < storeSnapshot.size(); i++) {
             ConfigurationStore store = (ConfigurationStore) storeSnapshot.get(i);
-            if(store.containsConfiguration(configurationId)) {
+            if (store.containsConfiguration(configurationId)) {
                 store.uninstall(configurationId);
             }
         }
@@ -1276,6 +1291,7 @@
 
     /**
      * this configuration manager never starts configurations.
+     *
      * @return false
      */
     public boolean isOnline() {

Modified: geronimo/server/trunk/framework/modules/geronimo-plugin/src/test/java/org/apache/geronimo/system/plugin/CopyFileTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-plugin/src/test/java/org/apache/geronimo/system/plugin/CopyFileTest.java?rev=620729&r1=620728&r2=620729&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-plugin/src/test/java/org/apache/geronimo/system/plugin/CopyFileTest.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-plugin/src/test/java/org/apache/geronimo/system/plugin/CopyFileTest.java Tue Feb 12 01:19:46 2008
@@ -23,25 +23,10 @@
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Collection;
 import java.util.concurrent.TimeUnit;
 
-import org.apache.geronimo.gbean.AbstractName;
-import org.apache.geronimo.kernel.config.Configuration;
-import org.apache.geronimo.kernel.config.ConfigurationData;
-import org.apache.geronimo.kernel.config.ConfigurationManager;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
-import org.apache.geronimo.kernel.config.LifecycleException;
-import org.apache.geronimo.kernel.config.LifecycleMonitor;
-import org.apache.geronimo.kernel.config.LifecycleResults;
-import org.apache.geronimo.kernel.config.NoSuchConfigException;
-import org.apache.geronimo.kernel.config.NoSuchStoreException;
 import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.kernel.repository.ArtifactResolver;
-import org.apache.geronimo.kernel.repository.Version;
-import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.system.configuration.RepositoryConfigurationStore;
 import org.apache.geronimo.system.plugin.model.CopyFileType;
 import org.apache.geronimo.system.repository.Maven2Repository;
@@ -83,7 +68,7 @@
         }
         Maven2Repository repo = new Maven2Repository(repoBase.toURI(), serverInfo, true);
         configStore = new RepositoryConfigurationStore(repo);
-        installer = new PluginInstallerGBean(new MockConfigManager(),
+        installer = new PluginInstallerGBean(new PluginInstallerTest.MockConfigManager(),
                 repo,
                 configStore,
                 serverInfo,
@@ -170,149 +155,4 @@
         return target;
     }
 
-    private static class MockConfigManager implements ConfigurationManager {
-
-        public boolean isInstalled(Artifact configurationId) {
-            return false;
-        }
-
-        public Artifact[] getInstalled(Artifact query) {
-            return new Artifact[0];
-        }
-
-        public Artifact[] getLoaded(Artifact query) {
-            return new Artifact[0];
-        }
-
-        public Artifact[] getRunning(Artifact query) {
-            return new Artifact[0];
-        }
-
-        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 isRunning(Artifact configurationId) {
-            return false;
-        }
-
-        public List listConfigurations() {
-            return null;
-        }
-
-        public boolean isConfiguration(Artifact artifact) {
-            return false;
-        }
-
-        public Configuration getConfiguration(Artifact configurationId) {
-            return null;
-        }
-
-        public LifecycleResults loadConfiguration(Artifact configurationId) throws NoSuchConfigException, LifecycleException {
-            return null;
-        }
-
-        public LifecycleResults loadConfiguration(ConfigurationData configurationData) throws NoSuchConfigException, LifecycleException {
-            return null;
-        }
-
-        public LifecycleResults loadConfiguration(Artifact configurationId, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException {
-            return null;
-        }
-
-        public LifecycleResults loadConfiguration(ConfigurationData configurationData, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException {
-            return null;
-        }
-
-        public LifecycleResults unloadConfiguration(Artifact configurationId) throws NoSuchConfigException {
-            return null;
-        }
-
-        public LifecycleResults unloadConfiguration(Artifact configurationId, LifecycleMonitor monitor) throws NoSuchConfigException {
-            return null;
-        }
-
-        public LifecycleResults startConfiguration(Artifact configurationId) throws NoSuchConfigException, LifecycleException {
-            return null;
-        }
-
-        public LifecycleResults startConfiguration(Artifact configurationId, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException {
-            return null;
-        }
-
-        public LifecycleResults stopConfiguration(Artifact configurationId) throws NoSuchConfigException {
-            return null;
-        }
-
-        public LifecycleResults stopConfiguration(Artifact configurationId, LifecycleMonitor monitor) throws NoSuchConfigException {
-            return null;
-        }
-
-        public LifecycleResults restartConfiguration(Artifact configurationId) throws NoSuchConfigException, LifecycleException {
-            return null;
-        }
-
-        public LifecycleResults restartConfiguration(Artifact configurationId, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException {
-            return null;
-        }
-
-        public LifecycleResults reloadConfiguration(Artifact configurationId) throws NoSuchConfigException, LifecycleException {
-            return null;
-        }
-
-        public LifecycleResults reloadConfiguration(Artifact configurationId, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException {
-            return null;
-        }
-
-        public LifecycleResults reloadConfiguration(Artifact configurationId, Version version) throws NoSuchConfigException, LifecycleException {
-            return null;
-        }
-
-        public LifecycleResults reloadConfiguration(Artifact configurationId, Version version, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException {
-            return null;
-        }
-
-        public LifecycleResults reloadConfiguration(ConfigurationData configurationData) throws NoSuchConfigException, LifecycleException {
-            return null;
-        }
-
-        public LifecycleResults reloadConfiguration(ConfigurationData configurationData, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException {
-            return null;
-        }
-
-        public void uninstallConfiguration(Artifact configurationId) throws IOException, NoSuchConfigException {
-
-        }
-
-        public ArtifactResolver getArtifactResolver() {
-            return null;
-        }
-
-        public boolean isOnline() {
-            return true;
-        }
-
-        public void setOnline(boolean online) {
-        }
-
-        public Collection<? extends Repository> getRepositories() {
-            return null;
-        }
-    }
 }

Modified: geronimo/server/trunk/framework/modules/geronimo-plugin/src/test/java/org/apache/geronimo/system/plugin/PluginInstallerTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-plugin/src/test/java/org/apache/geronimo/system/plugin/PluginInstallerTest.java?rev=620729&r1=620728&r2=620729&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-plugin/src/test/java/org/apache/geronimo/system/plugin/PluginInstallerTest.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-plugin/src/test/java/org/apache/geronimo/system/plugin/PluginInstallerTest.java Tue Feb 12 01:19:46 2008
@@ -22,6 +22,7 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
+import java.util.LinkedHashSet;
 import java.util.concurrent.TimeUnit;
 
 import junit.framework.TestCase;
@@ -35,12 +36,14 @@
 import org.apache.geronimo.kernel.config.LifecycleResults;
 import org.apache.geronimo.kernel.config.NoSuchConfigException;
 import org.apache.geronimo.kernel.config.NoSuchStoreException;
+import org.apache.geronimo.kernel.config.InvalidConfigException;
 import org.apache.geronimo.kernel.mock.MockConfigStore;
 import org.apache.geronimo.kernel.mock.MockWritableListableRepository;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.ArtifactResolver;
 import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.kernel.repository.Version;
+import org.apache.geronimo.kernel.repository.MissingDependencyException;
 import org.apache.geronimo.system.plugin.model.PluginArtifactType;
 import org.apache.geronimo.system.plugin.model.PluginListType;
 import org.apache.geronimo.system.plugin.model.PluginType;
@@ -104,7 +107,7 @@
         assertTrue(prereqCount > 0);
     }
 
-    private static class MockConfigManager implements ConfigurationManager {
+    static class MockConfigManager implements ConfigurationManager {
 
         public boolean isInstalled(Artifact configurationId) {
             return false;
@@ -246,6 +249,10 @@
         }
 
         public Collection<? extends Repository> getRepositories() {
+            return null;
+        }
+
+        public LinkedHashSet<Artifact> sort(List<Artifact> ids, LifecycleMonitor monitor) throws InvalidConfigException, IOException, NoSuchConfigException, MissingDependencyException {
             return null;
         }
     }

Modified: geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java?rev=620729&r1=620728&r2=620729&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java Tue Feb 12 01:19:46 2008
@@ -23,6 +23,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
+import java.util.LinkedHashSet;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -148,7 +149,8 @@
             try {
                 ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
                 try {
-                    for (Artifact configID : configs) {
+                    LinkedHashSet<Artifact> sorted = configurationManager.sort(configs, lifecycleMonitor);
+                    for (Artifact configID : sorted) {
                         monitor.moduleLoading(configID);
                         configurationManager.loadConfiguration(configID, lifecycleMonitor);
                         monitor.moduleLoaded(configID);