geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r394860 [3/3] - in /geronimo/branches/1.1: applications/console-standard/src/java/org/apache/geronimo/console/configmanager/ modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ modules/deploy-tool/src/java/org/apach...
Date Tue, 18 Apr 2006 06:44:21 GMT
Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java?rev=394860&r1=394859&r2=394860&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java Mon Apr 17 23:44:17 2006
@@ -23,15 +23,14 @@
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.ListIterator;
 import java.util.Map;
+import java.util.Set;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.gbean.AbstractName;
-import org.apache.geronimo.gbean.InvalidConfigurationException;
 import org.apache.geronimo.kernel.management.State;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.ArtifactResolver;
@@ -48,6 +47,7 @@
     protected final Collection stores;
     protected final ArtifactResolver artifactResolver;
     protected final Map configurations = new LinkedHashMap();
+    protected final ConfigurationModel configurationModel = new ConfigurationModel();
     protected final Collection repositories;
 
     public SimpleConfigurationManager(Collection stores, ArtifactResolver artifactResolver, Collection repositories) {
@@ -131,10 +131,14 @@
     }
 
     public boolean isConfiguration(Artifact artifact) {
-        if (configurations.containsKey(artifact)) {
-            return true;
+        synchronized (this) {
+            // if it is loaded, it is definitely a configuration
+            if (configurations.containsKey(artifact)) {
+                return true;
+            }
         }
 
+        // see if any stores think it is a configuration
         List storeSnapshot = getStoreList();
         for (int i = 0; i < storeSnapshot.size(); i++) {
             ConfigurationStore store = (ConfigurationStore) storeSnapshot.get(i);
@@ -146,82 +150,102 @@
     }
 
     public synchronized Configuration getConfiguration(Artifact configurationId) {
-        ConfigurationStatus configurationStatus = (ConfigurationStatus) configurations.get(configurationId);
-        return configurationStatus == null ? null : configurationStatus.getConfiguration();
+        Configuration configuration = (Configuration) configurations.get(configurationId);
+        return configuration;
     }
 
     public synchronized boolean isLoaded(Artifact configurationId) {
-        return configurations.containsKey(configurationId);
+        return configurationModel.isLoaded(configurationId);
     }
 
     public synchronized boolean isRunning(Artifact configurationId) {
-        ConfigurationStatus configurationStatus = (ConfigurationStatus) configurations.get(configurationId);
-        if (configurationStatus != null) {
-            return configurationStatus.getStartCount() > 0;
-        }
-        return false;
+        return configurationModel.isStarted(configurationId);
     }
 
-    public synchronized void loadConfiguration(Artifact configurationId) throws NoSuchConfigException, IOException, InvalidConfigException {
-        ConfigurationStatus configurationStatus = (ConfigurationStatus) configurations.get(configurationId);
-        if (configurationStatus != null) {
-            // already loaded, so just update the load count
-            configurationStatus.load();
-            configurationStatus.getConfiguration();
-            return;
+    public synchronized LifecycleResults loadConfiguration(Artifact configurationId) throws NoSuchConfigException, LifecycleException {
+        return loadConfiguration(configurationId, NullLifecycleMonitor.INSTANCE);
+    }
+
+    public synchronized LifecycleResults loadConfiguration(Artifact configurationId, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException {
+        if (configurationModel.isLoaded(configurationId)) {
+            // already loaded, so just mark the configuration as user loaded
+            configurationModel.load(configurationId);
+
+            monitor.finished();
+            return new LifecycleResults();
         }
 
         // load the ConfigurationData for the new configuration
-        ConfigurationData configurationData = loadConfigurationGBeanData(configurationId);
+        ConfigurationData configurationData = null;
+        try {
+            configurationData = loadConfigurationData(configurationId, monitor);
+        } catch (Exception e) {
+            LifecycleResults results = new LifecycleResults();
+            results.addFailed(configurationId, e);
+            monitor.finished();
+            throw new LifecycleException("load", configurationId, results);
+        }
 
         // load the configuration
-        loadConfiguration(configurationData);
+        LifecycleResults results = loadConfiguration(configurationData, monitor);
+
+        return results;
+    }
+
+    public synchronized LifecycleResults loadConfiguration(ConfigurationData configurationData) throws NoSuchConfigException, LifecycleException {
+        return loadConfiguration(configurationData, NullLifecycleMonitor.INSTANCE);
     }
 
-    public synchronized Configuration loadConfiguration(ConfigurationData configurationData) throws NoSuchConfigException, IOException, InvalidConfigException {
+    public synchronized LifecycleResults loadConfiguration(ConfigurationData configurationData, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException {
         Artifact id = configurationData.getId();
-        if (configurations.containsKey(id)) {
-            // already loaded, so just update the load count
-            ConfigurationStatus configurationStatus = (ConfigurationStatus) configurations.get(id);
-            configurationStatus.load();
-            return configurationStatus.getConfiguration();
-        }
+        LifecycleResults results = new LifecycleResults();
+        if (!configurationModel.isLoaded(id)) {
+            // recursively load configurations from the new child to the parents
+            LinkedHashMap unloadedConfigurations = new LinkedHashMap();
+            try {
+                loadDepthFirst(configurationData, unloadedConfigurations, monitor);
+            } catch (Exception e) {
+                results.addFailed(id, e);
+                monitor.finished();
+                throw new LifecycleException("load", id, results);
+            }
+
+            // load and start the unloaded the gbean for each configuration (depth first)
+            Map actuallyLoaded = new LinkedHashMap(unloadedConfigurations.size());
+            Artifact configurationId = null;
+            try {
+                for (Iterator iterator = unloadedConfigurations.entrySet().iterator(); iterator.hasNext();) {
+                    Map.Entry entry = (Map.Entry) iterator.next();
+                    configurationId = (Artifact) entry.getKey();
+                    UnloadedConfiguration unloadedConfiguration = (UnloadedConfiguration) entry.getValue();
+
+                    monitor.loading(configurationId);
+                    Configuration configuration = load(unloadedConfiguration.getConfigurationData(), unloadedConfiguration.getResolvedParentIds(), actuallyLoaded);
+                    monitor.succeeded(configurationId);
 
-        // load configurations from the new child to the parents
-        LinkedHashMap unloadedConfigurations = new LinkedHashMap();
-        loadDepthFirst(configurationData, unloadedConfigurations);
+                    actuallyLoaded.put(configurationId, configuration);
+                }
+            } catch (Exception e) {
+                monitor.failed(configurationId, e);
 
-        // load and start the unloaded configurations depth first
-        Map loadedConfigurations = new LinkedHashMap(unloadedConfigurations.size());
-        try {
-            for (Iterator iterator = unloadedConfigurations.entrySet().iterator(); iterator.hasNext();) {
-                Map.Entry entry = (Map.Entry) iterator.next();
-                Artifact configurationId = (Artifact) entry.getKey();
-                UnloadedContiguration unloadedConfiguration = (UnloadedContiguration) entry.getValue();
-                Configuration configuration = load(unloadedConfiguration.getConfigurationData(), unloadedConfiguration.getResolvedParentIds(), loadedConfigurations);
-                loadedConfigurations.put(configurationId, configuration);
-            }
-        } catch (Exception e) {
-            for (Iterator iterator = loadedConfigurations.values().iterator(); iterator.hasNext();) {
-                Configuration configuration = (Configuration) iterator.next();
-                unload(configuration);
-            }
-            if (e instanceof InvalidConfigException) {
-                throw (InvalidConfigException) e;
-            }
-            throw new InvalidConfigException("Unable to start configuration gbean " + id, e);
-        }
+                // there was a problem, so we need to unload all configurations that were actually loaded
+                for (Iterator iterator = actuallyLoaded.values().iterator(); iterator.hasNext();) {
+                    Configuration configuration = (Configuration) iterator.next();
+                    unload(configuration);
+                }
 
-        // update the status of the loaded configurations
-        for (Iterator iterator = loadedConfigurations.values().iterator(); iterator.hasNext();) {
-            Configuration configuration = (Configuration) iterator.next();
-            ConfigurationStatus configurationStatus = createConfigurationStatus(configuration);
-            configurations.put(configuration.getId(), configurationStatus);
-        }
+                results.addFailed(id, e);
+                monitor.finished();
+                throw new LifecycleException("load", id, results);
+            }
 
-        ConfigurationStatus configurationStatus = (ConfigurationStatus) configurations.get(id);
-        configurationStatus.load();
-        return configurationStatus.getConfiguration();
+            // update the status of the loaded configurations
+            addNewConfigurationsToModel(actuallyLoaded);
+            results.setLoaded(actuallyLoaded.keySet());
+        }
+        configurationModel.load(id);
+        monitor.finished();
+        return results;
     }
 
     protected Configuration load(ConfigurationData configurationData, LinkedHashSet resolvedParentIds, Map loadedConfigurations) throws InvalidConfigException {
@@ -256,72 +280,93 @@
         return parents.values();
     }
 
+    private void addNewConfigurationsToModel(Map loadedConfigurations) throws NoSuchConfigException {
+        for (Iterator iterator = loadedConfigurations.values().iterator(); iterator.hasNext();) {
+            Configuration configuration = (Configuration) iterator.next();
+            addNewConfigurationToModel(configuration);
+        }
+    }
+
+    protected void addNewConfigurationToModel(Configuration configuration) throws NoSuchConfigException {
+        configurationModel.addConfiguation(configuration.getId(),
+                getLoadParentIds(configuration),
+                getStartParentIds(configuration));
+        configurations.put(configuration.getId(), configuration);
+    }
 
-    protected synchronized ConfigurationStatus createConfigurationStatus(Configuration configuration) {
-        // start parents are just the service parents of the configuration... we want the services to be running so we can use them
-        List startParents = getParentStatuses(configuration.getServiceParents());
+    private Set getLoadParentIds(Configuration configuration) {
+        Set loadParentIds = getConfigurationIds(configuration.getClassParents());
+        for (Iterator iterator = configuration.getChildren().iterator(); iterator.hasNext();) {
+            Configuration childConfiguration = (Configuration) iterator.next();
+            Set childLoadParentIds = getLoadParentIds(childConfiguration);
 
-        // load parents are both the class parents and the service parents
-        LinkedHashSet loadParents = new LinkedHashSet(startParents);
-        loadParents.addAll(getParentStatuses(configuration.getClassParents()));
+            // remove this configuration's id from the parent Ids since it will cause an infinite loop
+            childLoadParentIds.remove(configuration.getId());
 
-        return new ConfigurationStatus(configuration, new ArrayList(loadParents), startParents);
+            loadParentIds.addAll(childLoadParentIds);
+        }
+        return loadParentIds;
     }
 
-    private synchronized List getParentStatuses(List parents) {
-        List parentStatuses = new ArrayList(parents.size());
-        for (Iterator iterator = parents.iterator(); iterator.hasNext();) {
-            Configuration parent = (Configuration) iterator.next();
-            ConfigurationStatus parentStatus = (ConfigurationStatus) configurations.get(parent.getId());
-            if (parentStatus == null) {
-                throw new IllegalStateException("Parent status not found " + parent.getId());
-            }
+    private Set getStartParentIds(Configuration configuration) {
+        Set startParentIds = getConfigurationIds(configuration.getServiceParents());
+        for (Iterator iterator = configuration.getChildren().iterator(); iterator.hasNext();) {
+            Configuration childConfiguration = (Configuration) iterator.next();
+            Set childStartParentIds = getStartParentIds(childConfiguration);
 
-            parentStatuses.add(parentStatus);
+            // remove this configuration's id from the parent Ids since it will cause an infinite loop
+            childStartParentIds.remove(configuration.getId());
+
+            startParentIds.addAll(childStartParentIds);
         }
-        return parentStatuses;
+        return startParentIds;
     }
 
-    private synchronized void loadDepthFirst(ConfigurationData configurationData, LinkedHashMap unloadedConfigurations) throws NoSuchConfigException, IOException, InvalidConfigException {
-        try {
-            // if this parent hasn't already been processed, iterate into the parent
-            Artifact configurationId = configurationData.getId();
-            if (!unloadedConfigurations.containsKey(configurationId)) {
-                LinkedHashSet resolvedParentIds = resolveParentIds(configurationData);
-
-                for (Iterator iterator = resolvedParentIds.iterator(); iterator.hasNext();) {
-                    Artifact parentId = (Artifact) iterator.next();
-                    if (!configurations.containsKey(parentId) && isConfiguration(parentId)) {
-                        ConfigurationData parentConfigurationData = loadConfigurationGBeanData(parentId);
-                        loadDepthFirst(parentConfigurationData, unloadedConfigurations);
-                    }
-                }
+    private static Set getConfigurationIds(List configurations) {
+        LinkedHashSet configurationIds = new LinkedHashSet(configurations.size());
+        for (Iterator iterator = configurations.iterator(); iterator.hasNext();) {
+            Configuration configuration = (Configuration) iterator.next();
+            configurationIds.add(configuration.getId());
+        }
+        return configurationIds;
+    }
 
-                // depth first - all unloaded parents have been added, now add this configuration
-                unloadedConfigurations.put(configurationId, new UnloadedContiguration(configurationData, resolvedParentIds));
+    private synchronized void loadDepthFirst(ConfigurationData configurationData, LinkedHashMap unloadedConfigurations, LifecycleMonitor monitor) throws NoSuchConfigException, IOException, InvalidConfigException, MissingDependencyException {
+        // if this parent hasn't already been processed, iterate into the parent
+        Artifact configurationId = configurationData.getId();
+        if (!unloadedConfigurations.containsKey(configurationId)) {
+            LinkedHashSet resolvedParentIds = resolveParentIds(configurationData);
+
+            for (Iterator iterator = resolvedParentIds.iterator(); iterator.hasNext();) {
+                Artifact parentId = (Artifact) iterator.next();
+                // if this parent id hasn't already been loaded and is actually a configuration
+                if (!configurations.containsKey(parentId) && isConfiguration(parentId)) {
+                    ConfigurationData parentConfigurationData = loadConfigurationData(parentId, monitor);
+                    loadDepthFirst(parentConfigurationData, unloadedConfigurations, monitor);
+                }
             }
-        } catch (NoSuchConfigException e) {
-            throw e;
-        } catch (IOException e) {
-            throw e;
-        } catch (InvalidConfigException e) {
-            throw e;
-        } catch (Exception e) {
-            throw new InvalidConfigException(e);
+
+            // depth first - all unloaded parents have been added, now add this configuration
+            unloadedConfigurations.put(configurationId, new UnloadedConfiguration(configurationData, resolvedParentIds));
         }
     }
 
-    private ConfigurationData loadConfigurationGBeanData(Artifact configId) throws NoSuchConfigException, IOException, InvalidConfigException {
+    private ConfigurationData loadConfigurationData(Artifact configurationId, LifecycleMonitor monitor) throws NoSuchConfigException, IOException, InvalidConfigException {
         List storeSnapshot = getStoreList();
 
+        monitor.addConfiguration(configurationId);
+        monitor.reading(configurationId);
         for (int i = 0; i < storeSnapshot.size(); i++) {
             ConfigurationStore store = (ConfigurationStore) storeSnapshot.get(i);
-            if (store.containsConfiguration(configId)) {
-                ConfigurationData configurationData = store.loadConfiguration(configId);
+            if (store.containsConfiguration(configurationId)) {
+                ConfigurationData configurationData = store.loadConfiguration(configurationId);
+                monitor.succeeded(configurationId);
                 return configurationData;
             }
         }
-        throw new NoSuchConfigException(configId);
+        NoSuchConfigException exception = new NoSuchConfigException(configurationId);
+        monitor.failed(configurationId, exception);
+        throw exception;
     }
 
     private LinkedHashSet resolveParentIds(ConfigurationData configurationData) throws MissingDependencyException, InvalidConfigException {
@@ -354,11 +399,11 @@
         return parentIds;
     }
 
-    private static class UnloadedContiguration {
+    private static class UnloadedConfiguration {
         private final ConfigurationData configurationData;
         private final LinkedHashSet resolvedParentIds;
 
-        public UnloadedContiguration(ConfigurationData configurationData, LinkedHashSet resolvedParentIds) {
+        public UnloadedConfiguration(ConfigurationData configurationData, LinkedHashSet resolvedParentIds) {
             this.configurationData = configurationData;
             this.resolvedParentIds = resolvedParentIds;
         }
@@ -372,192 +417,237 @@
         }
     }
 
-    public void startConfiguration(Configuration configuration) throws InvalidConfigException {
-        startConfiguration(configuration.getId());
+    public synchronized LifecycleResults startConfiguration(Artifact id) throws NoSuchConfigException, LifecycleException {
+        return startConfiguration(id, NullLifecycleMonitor.INSTANCE);
     }
 
-    public synchronized void startConfiguration(Artifact id) throws InvalidConfigException {
-        ConfigurationStatus configurationStatus = (ConfigurationStatus) configurations.get(id);
-        if (configurationStatus == null) {
-            throw new InvalidConfigurationException("Configuration is not loaded " + id);
-        }
+    public synchronized LifecycleResults startConfiguration(Artifact id, LifecycleMonitor monitor) throws  NoSuchConfigException, LifecycleException {
+        LinkedHashSet unstartedConfigurations = configurationModel.start(id);
 
-        List unstartedConfigurations = configurationStatus.start();
-        List startedConfigurations = new ArrayList(unstartedConfigurations.size());
+        addConfigurationsToMonitor(monitor, unstartedConfigurations);
+
+        LifecycleResults results = new LifecycleResults();
+        Artifact configurationId = null;
         try {
             for (Iterator iterator = unstartedConfigurations.iterator(); iterator.hasNext();) {
-                Configuration configuration = (Configuration) iterator.next();
+                configurationId = (Artifact) iterator.next();
+                Configuration configuration = getConfiguration(configurationId);
+
+                monitor.starting(configurationId);
                 start(configuration);
-                startedConfigurations.add(configuration);
+                monitor.succeeded(configurationId);
+
+                results.addStarted(configurationId);
             }
         } catch (Exception e) {
-            configurationStatus.stop();
-            for (Iterator iterator = startedConfigurations.iterator(); iterator.hasNext();) {
-                Configuration configuration = (Configuration) iterator.next();
+            monitor.failed(configurationId, e);
+            results.addFailed(configurationId, e);
+            results.setStarted(Collections.EMPTY_SET);
+            configurationModel.stop(id);
+
+            for (Iterator iterator = results.getStarted().iterator(); iterator.hasNext();) {
+                configurationId = (Artifact) iterator.next();
+                Configuration configuration = getConfiguration(configurationId);
+                monitor.stopping(configurationId);
                 stop(configuration);
+                monitor.succeeded(configurationId);
             }
-            if (e instanceof InvalidConfigException) {
-                throw (InvalidConfigException) e;
-            }
-            throw new InvalidConfigException("Unable to start configuration gbean " + id, e);
+            monitor.finished();
+            throw new LifecycleException("start", id, results);
         }
+        monitor.finished();
+        return results;
     }
 
-    protected void start(Configuration configuration) throws InvalidConfigException {
+    protected void start(Configuration configuration) throws Exception {
         throw new UnsupportedOperationException();
     }
 
-    public void stopConfiguration(Configuration configuration) throws NoSuchConfigException {
-        stopConfiguration(configuration.getId());
+    public synchronized LifecycleResults stopConfiguration(Artifact id) throws NoSuchConfigException {
+        return stopConfiguration(id, NullLifecycleMonitor.INSTANCE);
     }
 
-    public synchronized void stopConfiguration(Artifact id) throws NoSuchConfigException {
-        ConfigurationStatus configurationStatus = (ConfigurationStatus) configurations.get(id);
-        if (configurationStatus == null) {
-            throw new NoSuchConfigException(id);
-        }
+    public synchronized LifecycleResults stopConfiguration(Artifact id, LifecycleMonitor monitor) throws NoSuchConfigException {
+        LinkedHashSet stopList = configurationModel.stop(id);
 
-        stopConfiguration(configurationStatus);
-    }
+        addConfigurationsToMonitor(monitor, stopList);
 
-    private void stopConfiguration(ConfigurationStatus configurationStatus) {
-        List stopList = configurationStatus.stop();
+        LifecycleResults results = new LifecycleResults();
         for (Iterator iterator = stopList.iterator(); iterator.hasNext();) {
-            Configuration configuration = (Configuration) iterator.next();
+            Artifact configurationId = (Artifact) iterator.next();
+            Configuration configuration = getConfiguration(configurationId);
+
+            monitor.stopping(configurationId);
             stop(configuration);
+            monitor.succeeded(configurationId);
+
+            results.addStopped(configurationId);
         }
+
+        monitor.finished();
+        return results;
     }
 
     protected void stop(Configuration configuration) {
-        throw new UnsupportedOperationException();
+        // Don't throw an exception because we call this from unload to be sure that all
+        // unloaded configurations are stopped first
     }
 
-    public void unloadConfiguration(Configuration configuration) throws NoSuchConfigException {
-        unloadConfiguration(configuration.getId());
+    public synchronized LifecycleResults restartConfiguration(Artifact id) throws NoSuchConfigException, LifecycleException {
+        return restartConfiguration(id, NullLifecycleMonitor.INSTANCE);
     }
 
-    public synchronized void unloadConfiguration(Artifact id) throws NoSuchConfigException {
-        ConfigurationStatus configurationStatus = (ConfigurationStatus) configurations.get(id);
-        unloadConfiguration(configurationStatus);
-    }
+    public synchronized LifecycleResults restartConfiguration(Artifact id, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException {
+        // get a sorted list of configurations to restart
+        LinkedHashSet restartList = configurationModel.restart(id);
 
-    private void unloadConfiguration(ConfigurationStatus configurationStatus) {
-        List unloadList = configurationStatus.unload();
-        for (Iterator iterator = unloadList.iterator(); iterator.hasNext();) {
-            Configuration configuration = (Configuration) iterator.next();
-            unload(configuration);
-            configurations.remove(configuration.getId());
+        addConfigurationsToMonitor(monitor, restartList);
+
+        // stop the configuations
+        for (Iterator iterator = restartList.iterator(); iterator.hasNext();) {
+            Artifact configurationId = (Artifact) iterator.next();
+            Configuration configuration = getConfiguration(configurationId);
+            monitor.stopping(configurationId);
+            stop(configuration);
+            monitor.succeeded(configurationId);
         }
-    }
 
-    protected void unload(Configuration configuration) {
-        try {
-            configuration.doStop();
-        } catch (Exception e) {
-            log.debug("Problem unloading config: " + configuration.getId(), e);
+        // reverse the list
+        restartList = reverse(restartList);
+
+        // restart the configurations
+        LifecycleResults results = new LifecycleResults();
+        for (Iterator iterator = restartList.iterator(); iterator.hasNext();) {
+            Artifact configurationId = (Artifact) iterator.next();
+
+            // skip the configurations that have alredy failed or were stopped
+            if (results.wasFailed(configurationId) || results.wasStopped(configurationId)) {
+                continue;
+            }
+
+            // try to start the configuation
+            try {
+                Configuration configuration = getConfiguration(configurationId);
+                monitor.starting(configurationId);
+                start(configuration);
+                monitor.succeeded(configurationId);
+                results.addRestarted(configurationId);
+            } catch (Exception e) {
+                // the configuraiton failed to restart
+                results.addFailed(configurationId, e);
+                monitor.failed(configurationId, e);
+
+                // officially stop the configuration in the model (without gc)
+                LinkedHashSet stopList = configurationModel.stop(configurationId, false);
+
+                // all of the configurations to be stopped must be in our restart list, or the model is corrupt
+                if (!restartList.containsAll(stopList)) {
+                    throw new AssertionError("Configuration data model is corrupt.   You must restart your server.");
+                }
+
+                // add the children of the failed configuration to the results as stopped
+                for (Iterator iterator1 = stopList.iterator(); iterator1.hasNext();) {
+                    Artifact failedId = (Artifact) iterator1.next();
+
+                    // if any of the failed configuration is in the restarted set, the model is
+                    // corrupt because we started a child before a parent
+                    if (results.wasRestarted(failedId)) {
+                        throw new AssertionError("Configuration data model is corrupt.   You must restart your server.");
+                    }
+
+                    if (!results.wasFailed(failedId)) {
+                        results.addStopped(failedId);
+                    }
+                }
+            }
         }
-    }
 
-    public synchronized void uninstallConfiguration(Artifact configId) throws IOException, NoSuchConfigException {
-        ConfigurationStatus configurationStatus = (ConfigurationStatus) configurations.get(configId);
-        if (configurationStatus != null) {
-            stopConfiguration(configurationStatus);
-            unloadConfiguration(configurationStatus);
+        monitor.finished();
+        if (!results.wasRestarted(id)) {
+            throw new LifecycleException("restart", id, results);
         }
+        return results;
+    }
 
-        List storeSnapshot = getStoreList();
-        for (int i = 0; i < storeSnapshot.size(); i++) {
-            ConfigurationStore store = (ConfigurationStore) storeSnapshot.get(i);
-            if(store.containsConfiguration(configId)) {
-                store.uninstall(configId);
-            }
+    private static void addConfigurationsToMonitor(LifecycleMonitor monitor, LinkedHashSet configurations) {
+        for (Iterator iterator = configurations.iterator(); iterator.hasNext();) {
+            Artifact configurationId = (Artifact) iterator.next();
+            monitor.addConfiguration(configurationId);
         }
+    }
 
+    private static LinkedHashSet reverse(LinkedHashSet restartList) {
+        ArrayList reverseRestartList = new ArrayList(restartList);
+        Collections.reverse(reverseRestartList);
+        restartList = new LinkedHashSet(reverseRestartList);
+        return restartList;
     }
 
-    private List getStoreList() {
-        return new ArrayList(stores);
+    public synchronized LifecycleResults unloadConfiguration(Artifact id) throws NoSuchConfigException {
+        return unloadConfiguration(id, NullLifecycleMonitor.INSTANCE);
     }
 
-    protected static class ConfigurationStatus {
-        private final Configuration configuration;
-        private final List loadParents;
-        private final List startParents;
-        private int loadCount = 0;
-        private int startCount = 0;
-
-        public ConfigurationStatus(Configuration configuration, List loadParents, List startParents) {
-            if (!loadParents.containsAll(startParents)) {
-                throw new IllegalArgumentException("loadParents must contain all startParents");
-            }
-            this.configuration = configuration;
-            this.loadParents = loadParents;
-            this.startParents = startParents;
-        }
+    public synchronized LifecycleResults unloadConfiguration(Artifact id, LifecycleMonitor monitor) throws NoSuchConfigException {
+        Set started = configurationModel.getStarted();
+        LinkedHashSet unloadList = configurationModel.unload(id);
 
-        public Configuration getConfiguration() {
-            return configuration;
-        }
+        addConfigurationsToMonitor(monitor, unloadList);
 
-        public int getLoadCount() {
-            return loadCount;
-        }
+        LifecycleResults results = new LifecycleResults();
+        for (Iterator iterator = unloadList.iterator(); iterator.hasNext();) {
+            Artifact configurationId = (Artifact) iterator.next();
+            Configuration configuration = getConfiguration(configurationId);
 
-        public void load() {
-            for (Iterator iterator = loadParents.iterator(); iterator.hasNext();) {
-                ConfigurationStatus parent = (ConfigurationStatus) iterator.next();
-                parent.load();
+            // first make sure it is stopped
+            if (started.contains(configurationId)) {
+                monitor.stopping(configurationId);
+                stop(configuration);
+                monitor.succeeded(configurationId);
+                results.addStopped(configurationId);
+            } else {
+                // call stop just to be sure the beans aren't running
+                stop(configuration);
             }
-            loadCount++;
-        }
 
-        public List unload() {
-            if (loadCount == 1 && startCount > 0) {
-                // todo this will most likely need to be removed
-                throw new IllegalStateException(configuration.getId() + " is RUNNING: startCount=" + startCount);
-            }
+            // now unload it
+            monitor.unloading(configurationId);
+            unload(configuration);
+            monitor.succeeded(configurationId);
+            results.addUnloaded(configurationId);
 
-            LinkedList unloadList = new LinkedList();
-            for (Iterator iterator = loadParents.iterator(); iterator.hasNext();) {
-                ConfigurationStatus parent = (ConfigurationStatus) iterator.next();
-                unloadList.addAll(parent.unload());
-            }
-            loadCount--;
-            if (loadCount == 0) {
-                assert(startCount == 0);
-                unloadList.addFirst(configuration);
-            }
-            return unloadList;
+            // clean up the model
+            configurationModel.removeConfiguration(configurationId);
+            configurations.remove(configurationId);
         }
+        monitor.finished();
+        return results;
+    }
 
-        public int getStartCount() {
-            return startCount;
+    protected void unload(Configuration configuration) {
+        try {
+            configuration.doStop();
+        } catch (Exception e) {
+            log.debug("Problem unloading config: " + configuration.getId(), e);
         }
+    }
 
-        public List start() {
-            List startList = new LinkedList();
-            for (Iterator iterator = startParents.iterator(); iterator.hasNext();) {
-                ConfigurationStatus parent = (ConfigurationStatus) iterator.next();
-                startList.addAll(parent.start());
-            }
-            startCount++;
-            if (startCount == 1) {
-                startList.add(configuration);
-            }
-            return startList;
+    public synchronized void uninstallConfiguration(Artifact configurationId) throws IOException, NoSuchConfigException {
+        if (configurations.containsKey(configurationId)) {
+            stopConfiguration(configurationId);
+            unloadConfiguration(configurationId);
         }
 
-        public List stop() {
-            LinkedList stopList = new LinkedList();
-            for (Iterator iterator = startParents.iterator(); iterator.hasNext();) {
-                ConfigurationStatus parent = (ConfigurationStatus) iterator.next();
-                stopList.addAll(parent.stop());
-            }
-            startCount--;
-            if (startCount == 0) {
-                stopList.addFirst(configuration);
+        List storeSnapshot = getStoreList();
+        for (int i = 0; i < storeSnapshot.size(); i++) {
+            ConfigurationStore store = (ConfigurationStore) storeSnapshot.get(i);
+            if(store.containsConfiguration(configurationId)) {
+                store.uninstall(configurationId);
             }
-            return stopList;
         }
+
+    }
+
+    private List getStoreList() {
+        return new ArrayList(stores);
     }
 }

Modified: geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java?rev=394860&r1=394859&r2=394860&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java Mon Apr 17 23:44:17 2006
@@ -32,7 +32,7 @@
 import org.apache.geronimo.kernel.repository.DefaultArtifactResolver;
 
 /**
- * @version $Rev$ $Date$
+ * @version $Rev: 386505 $ $Date$
  */
 public class ConfigTest extends TestCase {
     private Kernel kernel;
@@ -43,10 +43,12 @@
 //    private final String BASE_NAME = "test:J2EEServer=geronimo";
 
     public void testConfigLifecycle() throws Exception {
+        Artifact configurationId = configurationData.getId();
 
         // load -- config should be running and gbean registered but not started
-        Configuration configuration = configurationManager.loadConfiguration(configurationData);
-        AbstractName configurationName = Configuration.getConfigurationAbstractName(configuration.getId());
+        configurationManager.loadConfiguration(configurationData);
+        Configuration configuration = configurationManager.getConfiguration(configurationId);
+        AbstractName configurationName = Configuration.getConfigurationAbstractName(configurationId);
 
         assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(configurationName));
         assertNotNull(configuration.getConfigurationClassLoader());
@@ -55,7 +57,7 @@
         assertFalse(kernel.isLoaded(gbeanName2));
 
         // start -- gbeans should now be started
-        configurationManager.startConfiguration(configuration);
+        configurationManager.startConfiguration(configurationId);
 
         assertTrue(kernel.isLoaded(gbeanName1));
         assertTrue(kernel.isLoaded(gbeanName2));
@@ -85,14 +87,14 @@
 
 
         // stop -- gbeans should now be started, but still registered
-        configurationManager.stopConfiguration(configuration);
+        configurationManager.stopConfiguration(configurationId);
 
         assertFalse(kernel.isLoaded(gbeanName1));
         assertFalse(kernel.isLoaded(gbeanName2));
 
 
         // unload -- configuration and gbeans should be unloaded
-        configurationManager.unloadConfiguration(configuration);
+        configurationManager.unloadConfiguration(configurationId);
 
         assertFalse(kernel.isLoaded(configurationName));
         assertFalse(kernel.isLoaded(gbeanName1));
@@ -101,9 +103,12 @@
     }
 
     public void testConfigStartStopRestart() throws Exception {
+        Artifact configurationId = configurationData.getId();
+
         // load -- config should be running and gbean registered but not started
-        Configuration configuration = configurationManager.loadConfiguration(configurationData);
-        AbstractName configurationName = Configuration.getConfigurationAbstractName(configuration.getId());
+        configurationManager.loadConfiguration(configurationData);
+        Configuration configuration = configurationManager.getConfiguration(configurationId);
+        AbstractName configurationName = Configuration.getConfigurationAbstractName(configurationId);
 
         assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(configurationName));
         assertNotNull(configuration.getConfigurationClassLoader());
@@ -113,7 +118,7 @@
 
 
         // start -- gbeans should now be started
-        configurationManager.startConfiguration(configuration);
+        configurationManager.startConfiguration(configurationId);
 
         assertTrue(kernel.isLoaded(gbeanName1));
         assertTrue(kernel.isLoaded(gbeanName2));
@@ -122,14 +127,14 @@
 
 
         // stop -- gbeans should now be started, but still registered
-        configurationManager.stopConfiguration(configuration);
+        configurationManager.stopConfiguration(configurationId);
 
         assertFalse(kernel.isLoaded(gbeanName1));
         assertFalse(kernel.isLoaded(gbeanName2));
 
 
         // restart -- gbeans should now be started
-        configurationManager.startConfiguration(configuration);
+        configurationManager.startConfiguration(configurationId);
 
         assertTrue(kernel.isLoaded(gbeanName1));
         assertTrue(kernel.isLoaded(gbeanName2));
@@ -137,8 +142,8 @@
         assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(gbeanName2));
 
         // unload -- configuration and gbeans should be unloaded
-        configurationManager.stopConfiguration(configuration);
-        configurationManager.unloadConfiguration(configuration);
+        configurationManager.stopConfiguration(configurationId);
+        configurationManager.unloadConfiguration(configurationId);
 
         assertFalse(kernel.isLoaded(configurationName));
         assertFalse(kernel.isLoaded(gbeanName1));
@@ -147,8 +152,11 @@
     }
 
     public void testAddToConfig() throws Exception {
+        Artifact configurationId = configurationData.getId();
+
         // load and start the config
-        Configuration configuration = configurationManager.loadConfiguration(configurationData);
+        configurationManager.loadConfiguration(configurationData);
+        Configuration configuration = configurationManager.getConfiguration(configurationId);
         assertNotNull(configuration.getConfigurationClassLoader());
 
         GBeanData mockBean3 = new GBeanData(MockGBean.getGBeanInfo());
@@ -160,7 +168,7 @@
         mockBean3.setAttribute("value", "1234");
         mockBean3.setAttribute("name", "child");
         mockBean3.setAttribute("finalInt", new Integer(1));
-        configurationManager.addGBeanToConfiguration(configuration.getId(), "MyMockGMBean3", mockBean3, true);
+        configurationManager.addGBeanToConfiguration(configurationId, "MyMockGMBean3", mockBean3, true);
 
         assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(mockBean3.getAbstractName()));
         assertEquals(new Integer(1), kernel.getAttribute(mockBean3.getAbstractName(), "finalInt"));

Modified: geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/SimpleGBeanTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/SimpleGBeanTest.java?rev=394860&r1=394859&r2=394860&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/SimpleGBeanTest.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/SimpleGBeanTest.java Mon Apr 17 23:44:17 2006
@@ -20,7 +20,6 @@
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
-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.ConfigurationUtil;
@@ -43,13 +42,14 @@
         ConfigurationManager configurationManager = (ConfigurationManager) kernel.getGBean(ConfigurationManager.class);
 
         // create a configuration for our test bean
-        ConfigurationData configurationData = new ConfigurationData(new Artifact("test", "test", "", "car"), kernel.getNaming());
+        Artifact configurationId = new Artifact("test", "test", "", "car");
+        ConfigurationData configurationData = new ConfigurationData(configurationId, kernel.getNaming());
         GBeanData mockBean1 = configurationData.addGBean("MyBean", TestGBean.getGBeanInfo());
         mockBean1.setAttribute("value", "1234");
 
         // load and start the configuration
-        Configuration configuration = configurationManager.loadConfiguration(configurationData);
-        configurationManager.startConfiguration(configuration);
+        configurationManager.loadConfiguration(configurationData);
+        configurationManager.startConfiguration(configurationId);
 
         // invoke GBean directly
         TestGBean testGBean = (TestGBean) kernel.getGBean("MyBean");
@@ -69,8 +69,8 @@
         assertEquals("1234", kernel.invoke("MyBean", TestGBean.class, "fetchValue"));
 
         // stop and unload configuration
-        configurationManager.stopConfiguration(configuration);
-        configurationManager.unloadConfiguration(configuration);
+        configurationManager.stopConfiguration(configurationId);
+        configurationManager.unloadConfiguration(configurationId);
 
         // stop the kernel
         kernel.shutdown();

Modified: geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/config/ConfigurationManagerTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/config/ConfigurationManagerTest.java?rev=394860&r1=394859&r2=394860&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/config/ConfigurationManagerTest.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/config/ConfigurationManagerTest.java Mon Apr 17 23:44:17 2006
@@ -19,14 +19,14 @@
 import java.io.File;
 import java.io.IOException;
 import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.SortedSet;
 import java.util.TreeSet;
 
@@ -34,6 +34,7 @@
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.KernelFactory;
 import org.apache.geronimo.kernel.management.State;
@@ -50,14 +51,17 @@
  * @version $Rev$ $Date$
  */
 public class ConfigurationManagerTest extends TestCase {
-    private Kernel kernel;
+    private static Kernel kernel;
     private Artifact artifact1;
     private Artifact artifact2;
     private Artifact artifact3;
     private Map configurations = new HashMap();
     private ConfigurationManager configurationManager;
+    private AbstractName gbean1;
+    private AbstractName gbean2;
+    private AbstractName gbean3;
 
-    public void test() throws Exception {
+    public void testLoad() throws Exception {
         configurationManager.loadConfiguration(artifact3);
         assertTrue(configurationManager.isLoaded(artifact3));
         assertTrue(configurationManager.isLoaded(artifact2));
@@ -68,6 +72,169 @@
         assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(Configuration.getConfigurationAbstractName(artifact3))) ;
         assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(Configuration.getConfigurationAbstractName(artifact2))) ;
         assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(Configuration.getConfigurationAbstractName(artifact1))) ;
+        assertFalse(kernel.isLoaded(gbean1));
+        assertFalse(kernel.isLoaded(gbean2));
+        assertFalse(kernel.isLoaded(gbean3));
+
+
+        configurationManager.unloadConfiguration(artifact3);
+        assertFalse(configurationManager.isLoaded(artifact3));
+        assertFalse(configurationManager.isLoaded(artifact2));
+        assertFalse(configurationManager.isLoaded(artifact1));
+        assertFalse(kernel.isLoaded(Configuration.getConfigurationAbstractName(artifact3))) ;
+        assertFalse(kernel.isLoaded(Configuration.getConfigurationAbstractName(artifact2))) ;
+        assertFalse(kernel.isLoaded(Configuration.getConfigurationAbstractName(artifact1))) ;
+    }
+
+    public void testStart() throws Exception {
+        configurationManager.loadConfiguration(artifact3);
+        assertTrue(configurationManager.isLoaded(artifact3));
+        assertTrue(configurationManager.isLoaded(artifact2));
+        assertTrue(configurationManager.isLoaded(artifact1));
+        assertTrue(kernel.isLoaded(Configuration.getConfigurationAbstractName(artifact3))) ;
+        assertTrue(kernel.isLoaded(Configuration.getConfigurationAbstractName(artifact2))) ;
+        assertTrue(kernel.isLoaded(Configuration.getConfigurationAbstractName(artifact1))) ;
+        assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(Configuration.getConfigurationAbstractName(artifact3))) ;
+        assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(Configuration.getConfigurationAbstractName(artifact2))) ;
+        assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(Configuration.getConfigurationAbstractName(artifact1))) ;
+        assertFalse(kernel.isLoaded(gbean1));
+        assertFalse(kernel.isLoaded(gbean2));
+        assertFalse(kernel.isLoaded(gbean3));
+
+        configurationManager.startConfiguration(artifact3);
+        assertTrue(kernel.isLoaded(gbean1));
+        assertTrue(kernel.isLoaded(gbean2));
+        assertTrue(kernel.isLoaded(gbean3));
+        assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(gbean1)) ;
+        assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(gbean2)) ;
+        assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(gbean3)) ;
+
+
+        configurationManager.stopConfiguration(artifact3);
+        assertFalse(kernel.isLoaded(gbean1));
+        assertFalse(kernel.isLoaded(gbean2));
+        assertFalse(kernel.isLoaded(gbean3));
+
+        configurationManager.unloadConfiguration(artifact3);
+        assertFalse(configurationManager.isLoaded(artifact3));
+        assertFalse(configurationManager.isLoaded(artifact2));
+        assertFalse(configurationManager.isLoaded(artifact1));
+        assertFalse(kernel.isLoaded(Configuration.getConfigurationAbstractName(artifact3))) ;
+        assertFalse(kernel.isLoaded(Configuration.getConfigurationAbstractName(artifact2))) ;
+        assertFalse(kernel.isLoaded(Configuration.getConfigurationAbstractName(artifact1))) ;
+    }
+
+    public void testRestart() throws Exception {
+        configurationManager.loadConfiguration(artifact3);
+        configurationManager.startConfiguration(artifact3);
+        Object g1 = kernel.getGBean(gbean1);
+        Object g2 = kernel.getGBean(gbean2);
+        Object g3 = kernel.getGBean(gbean3);
+        assertSame(g1, kernel.getGBean(gbean1));
+        assertSame(g2, kernel.getGBean(gbean2));
+        assertSame(g3, kernel.getGBean(gbean3));
+
+        LifecycleResults results = configurationManager.restartConfiguration(artifact1);
+
+        // check the results
+        assertTrue(results.wasRestarted(artifact1));
+        assertTrue(results.wasRestarted(artifact2));
+        assertTrue(results.wasRestarted(artifact3));
+
+        // check the state of the kernel
+        assertTrue(kernel.isLoaded(Configuration.getConfigurationAbstractName(artifact3))) ;
+        assertTrue(kernel.isLoaded(Configuration.getConfigurationAbstractName(artifact2))) ;
+        assertTrue(kernel.isLoaded(Configuration.getConfigurationAbstractName(artifact1))) ;
+        assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(Configuration.getConfigurationAbstractName(artifact3))) ;
+        assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(Configuration.getConfigurationAbstractName(artifact2))) ;
+        assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(Configuration.getConfigurationAbstractName(artifact1))) ;
+        assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(gbean1)) ;
+        assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(gbean2)) ;
+        assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(gbean3)) ;
+        assertNotSame(g1, kernel.getGBean(gbean1));
+        assertNotSame(g2, kernel.getGBean(gbean2));
+        assertNotSame(g3, kernel.getGBean(gbean3));
+
+        configurationManager.stopConfiguration(artifact3);
+        assertFalse(kernel.isLoaded(gbean2));
+        assertFalse(kernel.isLoaded(gbean3));
+
+        // bean3 should still be running because it is now user started due to the restart above
+        assertTrue(kernel.isLoaded(gbean1));
+        assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(gbean1)) ;
+
+        configurationManager.unloadConfiguration(artifact3);
+        assertFalse(configurationManager.isLoaded(artifact3));
+        assertFalse(configurationManager.isLoaded(artifact2));
+        assertFalse(kernel.isLoaded(Configuration.getConfigurationAbstractName(artifact3))) ;
+        assertFalse(kernel.isLoaded(Configuration.getConfigurationAbstractName(artifact2))) ;
+
+        // artifact 1 should still be loaded and running since it was user started above
+        assertTrue(configurationManager.isLoaded(artifact1));
+        assertTrue(kernel.isLoaded(Configuration.getConfigurationAbstractName(artifact1))) ;
+        assertTrue(kernel.isLoaded(gbean1));
+        assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(gbean1));
+
+        configurationManager.unloadConfiguration(artifact1);
+        assertFalse(configurationManager.isLoaded(artifact1));
+        assertFalse(kernel.isLoaded(Configuration.getConfigurationAbstractName(artifact1))) ;
+        assertFalse(kernel.isLoaded(gbean1));
+
+    }
+
+    public void testRestartException() throws Exception {
+        configurationManager.loadConfiguration(artifact3);
+        configurationManager.startConfiguration(artifact3);
+        Object g1 = kernel.getGBean(gbean1);
+        Object g2 = kernel.getGBean(gbean2);
+        kernel.getGBean(gbean3);
+
+        // make gbean3 fail and restart all configs
+        shouldFail.add(gbean3.getObjectName().getCanonicalName());
+        LifecycleResults results = configurationManager.restartConfiguration(artifact1);
+
+        // check the results
+        assertTrue(results.wasRestarted(artifact1));
+        assertTrue(results.wasRestarted(artifact2));
+        assertTrue(results.wasFailed(artifact3));
+
+        // all configuration should be loaded
+        assertTrue(configurationManager.isLoaded(artifact3));
+        assertTrue(configurationManager.isLoaded(artifact2));
+        assertTrue(configurationManager.isLoaded(artifact1));
+        assertTrue(kernel.isLoaded(Configuration.getConfigurationAbstractName(artifact3))) ;
+        assertTrue(kernel.isLoaded(Configuration.getConfigurationAbstractName(artifact2))) ;
+        assertTrue(kernel.isLoaded(Configuration.getConfigurationAbstractName(artifact1))) ;
+        assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(Configuration.getConfigurationAbstractName(artifact3))) ;
+        assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(Configuration.getConfigurationAbstractName(artifact2))) ;
+        assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(Configuration.getConfigurationAbstractName(artifact1))) ;
+
+        // but configuration 3 should not be running
+        assertTrue(configurationManager.isRunning(artifact1));
+        assertTrue(configurationManager.isRunning(artifact2));
+        assertFalse(configurationManager.isRunning(artifact3));
+        assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(gbean1)) ;
+        assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(gbean2)) ;
+        assertFalse(kernel.isLoaded(gbean3));
+
+        // make sure that gbean 1 and 2 were recreated
+        assertNotSame(g1, kernel.getGBean(gbean1));
+        assertNotSame(g2, kernel.getGBean(gbean2));
+
+        configurationManager.unloadConfiguration(artifact1);
+        assertFalse(configurationManager.isLoaded(artifact3));
+        assertFalse(configurationManager.isLoaded(artifact2));
+        assertFalse(configurationManager.isLoaded(artifact1));
+        assertFalse(kernel.isLoaded(Configuration.getConfigurationAbstractName(artifact3))) ;
+        assertFalse(kernel.isLoaded(Configuration.getConfigurationAbstractName(artifact2))) ;
+        assertFalse(kernel.isLoaded(Configuration.getConfigurationAbstractName(artifact1))) ;
+    }
+
+    private static final Set shouldFail = new HashSet();
+    private static void checkFail(String objectName) {
+        if (shouldFail.contains(objectName)) {
+            throw new RuntimeException("FAILING");
+        }
     }
 
     protected void setUp() throws Exception {
@@ -94,12 +261,14 @@
         e1.setConfigId(artifact1);
         ConfigurationData configurationData1 = new ConfigurationData(e1, kernel.getNaming());
         configurationData1.setConfigurationStore(configStore);
+        gbean1 = configurationData1.addGBean("gbean1", TestBean.getGBeanInfo()).getAbstractName();
         configurations.put(artifact1, configurationData1);
 
         Environment e2 = new Environment();
         e2.setConfigId(artifact2);
         e2.addDependency(new Artifact("test", "1", (Version) null, "bar"), ImportType.ALL);
         ConfigurationData configurationData2 = new ConfigurationData(e2, kernel.getNaming());
+        gbean2 = configurationData2.addGBean("gbean2", TestBean.getGBeanInfo()).getAbstractName();
         configurationData2.setConfigurationStore(configStore);
         configurations.put(artifact2, configurationData2);
 
@@ -107,6 +276,7 @@
         e3.setConfigId(artifact3);
         e3.addDependency(new Artifact("test", "2", (Version) null, "bar"), ImportType.ALL);
         ConfigurationData configurationData3 = new ConfigurationData(e3, kernel.getNaming());
+        gbean3 = configurationData3.addGBean("gbean3", TestBean.getGBeanInfo()).getAbstractName();
         configurationData3.setConfigurationStore(configStore);
         configurations.put(artifact3, configurationData3);
 
@@ -121,6 +291,11 @@
                 KernelConfigurationManager.class.getClassLoader());
     }
 
+    protected void tearDown() throws Exception {
+        kernel.shutdown();
+        super.tearDown();
+    }
+
     private class TestConfigStore extends NullConfigurationStore {
         public ConfigurationData loadConfiguration(Artifact configId) throws IOException, InvalidConfigException, NoSuchConfigException {
             return (ConfigurationData) configurations.get(configId);
@@ -129,6 +304,26 @@
         public boolean containsConfiguration(Artifact configId) {
             return configurations.containsKey(configId);
         }
+
+        public String getObjectName() {
+            throw new UnsupportedOperationException();
+        }
+
+        public AbstractName getAbstractName() {
+            throw new UnsupportedOperationException();
+        }
+
+        public List listConfigurations() {
+            throw new UnsupportedOperationException();
+        }
+
+        public File createNewConfigurationDir(Artifact configId) throws ConfigurationAlreadyExistsException {
+            throw new UnsupportedOperationException();
+        }
+
+        public Set resolve(Artifact configId, String moduleName, String pattern) throws NoSuchConfigException, MalformedURLException {
+            throw new UnsupportedOperationException();
+        }
     }
 
     private GBeanData buildGBeanData(String key, String value, GBeanInfo info) {
@@ -162,6 +357,24 @@
 
         public LinkedHashSet getDependencies(Artifact artifact) {
             return new LinkedHashSet();
+        }
+    }
+
+    public static class TestBean {
+        public TestBean(String objectName) {
+            checkFail(objectName);
+        }
+
+        private static final GBeanInfo GBEAN_INFO;
+        static {
+            GBeanInfoBuilder builder = GBeanInfoBuilder.createStatic(TestBean.class);
+            builder.addAttribute("objectName", String.class, false);
+            builder.setConstructor(new String[] {"objectName"});
+            GBEAN_INFO = builder.getBeanInfo();
+        }
+
+        public static GBeanInfo getGBeanInfo() {
+            return GBEAN_INFO;
         }
     }
 }

Added: geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/config/ConfigurationModelTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/config/ConfigurationModelTest.java?rev=394860&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/config/ConfigurationModelTest.java (added)
+++ geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/config/ConfigurationModelTest.java Mon Apr 17 23:44:17 2006
@@ -0,0 +1,218 @@
+/**
+ *
+ * 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.kernel.config;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+import junit.framework.TestCase;
+import org.apache.geronimo.kernel.repository.Artifact;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConfigurationModelTest extends TestCase {
+    private static final Artifact rootId = new Artifact("root", "", "", "");
+    private static final Artifact midId = new Artifact("mid", "", "", "");
+    private static final Artifact leftId = new Artifact("left", "", "", "");
+    private static final Artifact rightId = new Artifact("right", "", "", "");
+    private static final Artifact childId = new Artifact("child", "", "", "");
+    private static final Set all = asSet(rootId, midId, leftId, rightId, childId);
+
+
+    /**
+     * The model below, with root and child user loaded and started
+     *
+     *        root
+     *         |
+     *        mid
+     *        / \
+     *     left right
+     *        \ /
+     *       child
+     *
+     */
+    private final ConfigurationModel diamondModel = new ConfigurationModel();
+
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        diamondModel.addConfiguation(rootId, Collections.EMPTY_SET, Collections.EMPTY_SET);
+        diamondModel.addConfiguation(midId, Collections.singleton(rootId), Collections.singleton(rootId));
+        diamondModel.addConfiguation(leftId, Collections.singleton(midId), Collections.singleton(midId));
+        diamondModel.addConfiguation(rightId, Collections.singleton(midId), Collections.singleton(midId));
+
+        Set leftAndRight = asSet(leftId, rightId);
+        diamondModel.addConfiguation(childId, leftAndRight, leftAndRight);
+
+        // Load and start the root and child
+        diamondModel.load(rootId);
+        diamondModel.start(rootId);
+        diamondModel.load(childId);
+        diamondModel.start(childId);
+
+        // all  nodes should be loaded  and started
+        assertEquals(all, diamondModel.getLoaded());
+        assertEquals(all, diamondModel.getStarted());
+
+        // only root and child should be user loaded and started
+        assertEquals(asSet(rootId, childId), diamondModel.getUserLoaded());
+        assertEquals(asSet(rootId, childId), diamondModel.getUserStarted());
+    }
+
+    public void testStopChild() throws NoSuchConfigException {
+        LinkedHashSet stopList = diamondModel.stop(childId);
+
+        // the only thing left running should be the root node
+        assertEquals(asSet(rootId), diamondModel.getStarted());
+        assertEquals(asSet(rootId), diamondModel.getUserStarted());
+
+        // everything should still be loaded
+        assertEquals(all, diamondModel.getLoaded());
+        assertEquals(asSet(rootId, childId), diamondModel.getUserLoaded());
+
+        // checke the order of the list
+        assertEquals(4, stopList.size());
+        assertFalse(stopList.contains(rootId));
+        assertBefore(childId, leftId, stopList);
+        assertBefore(childId, rightId, stopList);
+        assertBefore(leftId, midId, stopList);
+        assertBefore(rightId, midId, stopList);
+    }
+
+    public void testStopLeft() throws NoSuchConfigException {
+        LinkedHashSet stopList = diamondModel.stop(leftId);
+
+        // the only thing left running should be the root node
+        assertEquals(asSet(rootId), diamondModel.getStarted());
+        assertEquals(asSet(rootId), diamondModel.getUserStarted());
+
+        // everything should still be loaded
+        assertEquals(all, diamondModel.getLoaded());
+        assertEquals(asSet(rootId, childId), diamondModel.getUserLoaded());
+
+        // checke the order of the list
+        assertEquals(4, stopList.size());
+        assertFalse(stopList.contains(rootId));
+        assertBefore(childId, leftId, stopList);
+        assertBefore(childId, rightId, stopList);
+        assertBefore(leftId, midId, stopList);
+        assertBefore(rightId, midId, stopList);
+    }
+
+    public void testPinRightStopLeft() throws NoSuchConfigException {
+        LinkedHashSet startList = diamondModel.start(rightId);
+        assertTrue(startList.isEmpty());
+
+        LinkedHashSet stopList = diamondModel.stop(leftId);
+
+        // the right, mid and root nodes should be started
+        assertEquals(asSet(rootId, midId, rightId), diamondModel.getStarted());
+        assertEquals(asSet(rootId, rightId), diamondModel.getUserStarted());
+
+        // everything should still be loaded
+        assertEquals(all, diamondModel.getLoaded());
+        assertEquals(asSet(rootId, rightId, childId), diamondModel.getUserLoaded());
+
+        // checke the order of the list
+        assertContainsNone(stopList, asSet(rootId, midId, rightId));
+        assertEquals(2, stopList.size());
+        assertBefore(childId, leftId, stopList);
+    }
+
+    public void testAddRightChildStopLeft() throws NoSuchConfigException {
+        Artifact rightChildId = new Artifact("rightChild", "", "", "");
+        diamondModel.addConfiguation(rightChildId, Collections.singleton(rightId), Collections.singleton(rightId));
+
+        LinkedHashSet loadList = diamondModel.load(rightChildId);
+        assertEquals(asSet(rightChildId), asSet(loadList));
+        LinkedHashSet startList = diamondModel.start(rightChildId);
+        assertEquals(asSet(rightChildId), asSet(startList));
+
+        LinkedHashSet stopList = diamondModel.stop(leftId);
+
+        // the right, mid, root, and new right child nodes should be started
+        assertEquals(asSet(rootId, midId, rightId, rightChildId), diamondModel.getStarted());
+        assertEquals(asSet(rootId, rightChildId), diamondModel.getUserStarted());
+
+        // everything should still be loaded
+        assertEquals(asSet(all, rightChildId), diamondModel.getLoaded());
+        assertEquals(asSet(rootId, childId, rightChildId), diamondModel.getUserLoaded());
+
+        // checke the order of the list
+        assertContainsNone(stopList, asSet(rootId, midId, rightId));
+        assertEquals(2, stopList.size());
+        assertBefore(childId, leftId, stopList);
+    }
+
+
+    public static void assertContainsNone(Collection collection, Collection unexpected) {
+        for (Iterator iterator = unexpected.iterator(); iterator.hasNext();) {
+            Object item = iterator.next();
+            assertFalse("Did not expecte " + item + " in the collection " + collection,
+                    collection.contains(item));
+        }
+    }
+
+    public static void assertBefore(Object before, Object after, LinkedHashSet set) {
+        List list = new ArrayList(set);
+        int beforeIndex = list.indexOf(before);
+        assertTrue("Expected " + before + " to be contained in the list " + list,
+                beforeIndex >= 0);
+
+        int afterIndex = list.indexOf(after);
+        assertTrue("Expected " + after + " to be contained in the list " + list,
+                afterIndex >= 0);
+
+        assertTrue("Expected " + before + " to be before " + after + " in the list " + list,
+                beforeIndex < afterIndex);
+    }
+
+    public static LinkedHashSet asSet(Object a) {
+        return asSet(new Object[] {a});
+    }
+
+    public static LinkedHashSet asSet(Object a, Object b) {
+        return asSet(new Object[] {a, b});
+    }
+    public static LinkedHashSet asSet(Object a, Object b, Object c) {
+        return asSet(new Object[] {a, b, c});
+    }
+    public static LinkedHashSet asSet(Object a, Object b, Object c, Object d) {
+        return asSet(new Object[] {a, b, c, d});
+    }
+    public static LinkedHashSet asSet(Object a, Object b, Object c, Object d, Object e) {
+        return asSet(new Object[] {a, b, c, d, e});
+    }
+    public static LinkedHashSet asSet(Object[] list) {
+        LinkedHashSet set = new LinkedHashSet();
+        for (int i = 0; i < list.length; i++) {
+            Object o = list[i];
+            if (o instanceof Collection) {
+                set.addAll((Collection)o);
+            } else {
+                set.add(o);
+            }
+        }
+        return set;
+    }
+}

Modified: geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/repository/ArtifactResolverTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/repository/ArtifactResolverTest.java?rev=394860&r1=394859&r2=394860&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/repository/ArtifactResolverTest.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/repository/ArtifactResolverTest.java Mon Apr 17 23:44:17 2006
@@ -19,7 +19,6 @@
 import java.io.File;
 import java.io.IOException;
 import java.net.MalformedURLException;
-import java.net.URI;
 import java.net.URL;
 import java.util.Collections;
 import java.util.HashSet;
@@ -167,8 +166,8 @@
             return true;
         }
 
-        public URL resolve(Artifact configId, String moduleName, URI uri) throws NoSuchConfigException, MalformedURLException {
-            return baseURL;
+        public Set resolve(Artifact configId, String moduleName, String pattern) throws NoSuchConfigException, MalformedURLException {
+            return Collections.singleton(baseURL);
         }
 
         public final static GBeanInfo GBEAN_INFO;

Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java?rev=394860&r1=394859&r2=394860&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java (original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java Mon Apr 17 23:44:17 2006
@@ -22,12 +22,11 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import java.util.SortedSet;
+import java.util.Set;
 import java.util.jar.JarFile;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipOutputStream;
@@ -44,11 +43,11 @@
 import org.apache.geronimo.kernel.config.ConfigurationUtil;
 import org.apache.geronimo.kernel.config.InvalidConfigException;
 import org.apache.geronimo.kernel.config.NoSuchConfigException;
+import org.apache.geronimo.kernel.config.IOUtil;
 import org.apache.geronimo.kernel.jmx.JMXUtil;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.FileWriteMonitor;
 import org.apache.geronimo.kernel.repository.WritableListableRepository;
-import org.apache.geronimo.system.repository.IOUtil;
 
 /**
  * Implementation of ConfigurationStore that loads Configurations from a repository.
@@ -167,7 +166,7 @@
         return location;
     }
 
-    public URL resolve(Artifact configId, String moduleName, URI uri) throws NoSuchConfigException, MalformedURLException {
+    public Set resolve(Artifact configId, String moduleName, String path) throws NoSuchConfigException, MalformedURLException {
         File location = repository.getLocation(configId);
         if (location.isDirectory()) {
             File inPlaceLocation = null;
@@ -184,18 +183,15 @@
             }
 
             if (location.isDirectory()) {
-                URL locationUrl = location.toURL();
-                URL resolvedUrl = new URL(locationUrl, uri.toString());
-                return resolvedUrl;
+                Set matches = IOUtil.search(location, path);
+                return matches;
+            } else {
+                Set matches = IOUtil.search(location, path);
+                return matches;
             }
-            URL baseURL = new URL("jar:" + repository.getLocation(configId).toURL().toString() + "!/");
-            return new URL(baseURL, uri.toString());
         } else {
-            URL baseURL = new URL("jar:" + repository.getLocation(configId).toURL().toString() + "!/");
-            if (moduleName != null) {
-                baseURL = new URL(baseURL, moduleName + "/");
-            }
-            return new URL(baseURL, uri.toString());
+            Set matches = IOUtil.search(location, moduleName + "/" +path);
+            return matches;
         }
     }
 

Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/UnpackArtifactTypeHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/UnpackArtifactTypeHandler.java?rev=394860&r1=394859&r2=394860&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/UnpackArtifactTypeHandler.java (original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/UnpackArtifactTypeHandler.java Mon Apr 17 23:44:17 2006
@@ -27,6 +27,7 @@
 import org.apache.geronimo.kernel.repository.ArtifactTypeHandler;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.FileWriteMonitor;
+import org.apache.geronimo.kernel.config.IOUtil;
 
 /**
  * @version $Rev$ $Date$

Modified: 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=394860&r1=394859&r2=394860&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/ConfigInstallerTest.java (original)
+++ geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/ConfigInstallerTest.java Mon Apr 17 23:44:17 2006
@@ -31,10 +31,12 @@
 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.InvalidConfigException;
 import org.apache.geronimo.kernel.config.NoSuchConfigException;
 import org.apache.geronimo.kernel.config.NoSuchStoreException;
 import org.apache.geronimo.kernel.config.NullConfigurationStore;
+import org.apache.geronimo.kernel.config.LifecycleResults;
+import org.apache.geronimo.kernel.config.LifecycleException;
+import org.apache.geronimo.kernel.config.LifecycleMonitor;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.FileWriteMonitor;
 import org.apache.geronimo.kernel.repository.WritableListableRepository;
@@ -51,6 +53,7 @@
     private ConfigurationInstaller installer;
 
     protected void setUp() throws Exception {
+        super.setUp();
         String url = getClass().getResource("/geronimo-plugins.xml").toString();
         int pos = url.lastIndexOf("/");
         testRepo = new URL(url.substring(0, pos));
@@ -136,48 +139,72 @@
             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 configId) {
+        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 void loadConfiguration(Artifact configID) throws NoSuchConfigException, IOException, InvalidConfigException {
+        public LifecycleResults loadConfiguration(Artifact configurationId, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException {
+            return null;
         }
 
-        public Configuration loadConfiguration(ConfigurationData configurationData) throws NoSuchConfigException, IOException, InvalidConfigException {
+        public LifecycleResults loadConfiguration(ConfigurationData configurationData, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException {
             return null;
         }
 
-        public void unloadConfiguration(Artifact configID) throws NoSuchConfigException {
+        public LifecycleResults unloadConfiguration(Artifact configurationId) throws NoSuchConfigException {
+            return null;
         }
 
-        public void unloadConfiguration(Configuration configuration) throws NoSuchConfigException {
+        public LifecycleResults unloadConfiguration(Artifact configurationId, LifecycleMonitor monitor) throws NoSuchConfigException {
+            return null;
         }
 
-        public void startConfiguration(Artifact configID) throws InvalidConfigException {
+        public LifecycleResults startConfiguration(Artifact configurationId) throws NoSuchConfigException, LifecycleException {
+            return null;
         }
 
-        public void startConfiguration(Configuration configuration) throws InvalidConfigException {
+        public LifecycleResults startConfiguration(Artifact configurationId, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException {
+            return null;
         }
 
-        public void stopConfiguration(Artifact configID) throws NoSuchConfigException {
+        public LifecycleResults stopConfiguration(Artifact configurationId) throws NoSuchConfigException {
+            return null;
         }
 
-        public void stopConfiguration(Configuration configuration) throws NoSuchConfigException {
+        public LifecycleResults stopConfiguration(Artifact configurationId, LifecycleMonitor monitor) throws NoSuchConfigException {
+            return null;
         }
 
-        public boolean isRunning(Artifact configurationId) {
-            return false;
+        public LifecycleResults restartConfiguration(Artifact configurationId) throws NoSuchConfigException, LifecycleException {
+            return null;
         }
 
-        public List listConfigurations() {
+        public LifecycleResults restartConfiguration(Artifact configurationId, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException {
             return null;
         }
 
-        public void uninstallConfiguration(Artifact configId) throws IOException, NoSuchConfigException {
+        public void uninstallConfiguration(Artifact configurationId) throws IOException, NoSuchConfigException {
+
         }
     }
 }

Modified: geronimo/branches/1.1/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java?rev=394860&r1=394859&r2=394860&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java (original)
+++ geronimo/branches/1.1/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java Mon Apr 17 23:44:17 2006
@@ -149,8 +149,10 @@
         earContext.close();
         module.close();
 
-        Configuration configuration = configurationManager.loadConfiguration(configurationData);
-        configurationManager.startConfiguration(configuration);
+        Artifact configurationId = configurationData.getId();
+        configurationManager.loadConfiguration(configurationData);
+        Configuration configuration = configurationManager.getConfiguration(configurationId);
+        configurationManager.startConfiguration(configurationId);
 
         assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(moduleName));
         Set names = configuration.findGBeans(new AbstractNameQuery(moduleName.getArtifact(), Collections.EMPTY_MAP));
@@ -160,8 +162,8 @@
             assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(objectName));
         }
 
-        configurationManager.stopConfiguration(configuration);
-        configurationManager.unloadConfiguration(configuration);
+        configurationManager.stopConfiguration(configurationId);
+        configurationManager.unloadConfiguration(configurationId);
     }
 
     private EARContext createEARContext(File outputPath, Environment environment, Repository repository, ConfigurationStore configStore, AbstractName moduleName) throws DeploymentException {
@@ -400,8 +402,8 @@
             return true;
         }
 
-        public URL resolve(Artifact configId, String moduleName, URI uri) throws NoSuchConfigException, MalformedURLException {
-            return baseURL;
+        public Set resolve(Artifact configId, String moduleName, String pattern) throws NoSuchConfigException, MalformedURLException {
+            return Collections.singleton(baseURL);
         }
 
         public final static GBeanInfo GBEAN_INFO;

Modified: geronimo/branches/1.1/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java?rev=394860&r1=394859&r2=394860&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java (original)
+++ geronimo/branches/1.1/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java Mon Apr 17 23:44:17 2006
@@ -212,7 +212,7 @@
                     moduleContext.addFile(targetPath, warFile, entry);
                     if (!addedClasses && entry.getName().startsWith("WEB-INF/classes/")) {
                         addedClasses = true;
-                        moduleContext.getConfiguration().addToClassPath(new URI(null, "WEB-INF/classes/", null));
+                        moduleContext.getConfiguration().addToClassPath("WEB-INF/classes/");
                     }
                 }
             }



Mime
View raw message