geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r394860 [1/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
Author: dain
Date: Mon Apr 17 23:44:17 2006
New Revision: 394860

URL: http://svn.apache.org/viewcvs?rev=394860&view=rev
Log:
Fixed stop and unload methods on ConfigurationManager
Abstracted ConfigurationModel out of ConfigurationManager
Added monitoring to ConfigurationManager
Added results return value to ConfigurationManger lifecycle methods
Added restart method to ConfigurationManager

Added ant style pattern matching to configuration classpath

Added:
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationModel.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStatus.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/IOUtil.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/LifecycleException.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/LifecycleMonitor.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/LifecycleResults.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/NullLifecycleMonitor.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/Os.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SelectorUtils.java
    geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/config/ConfigurationModelTest.java
Removed:
    geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/IOUtil.java
Modified:
    geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java
    geronimo/branches/1.1/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
    geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/PluginBootstrap.java
    geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/CopyResourceContext.java
    geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java
    geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/InPlaceResourceContext.java
    geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTest.java
    geronimo/branches/1.1/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationResolver.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/NullConfigurationStore.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
    geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java
    geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/SimpleGBeanTest.java
    geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/config/ConfigurationManagerTest.java
    geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/repository/ArtifactResolverTest.java
    geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java
    geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/repository/UnpackArtifactTypeHandler.java
    geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/ConfigInstallerTest.java
    geronimo/branches/1.1/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java
    geronimo/branches/1.1/modules/web-builder/src/java/org/apache/geronimo/web/deployment/AbstractWebModuleBuilder.java

Modified: geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java?rev=394860&r1=394859&r2=394860&view=diff
==============================================================================
--- geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java (original)
+++ geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java Mon Apr 17 23:44:17 2006
@@ -19,7 +19,6 @@
 
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.Iterator;
@@ -39,8 +38,8 @@
 import org.apache.geronimo.kernel.config.ConfigurationInfo;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
 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.LifecycleException;
 import org.apache.geronimo.kernel.repository.Artifact;
 
 public class ConfigManagerPortlet extends BasePortlet {
@@ -90,9 +89,10 @@
             // ignore this for now
             messageStatus = "Configuration not found<br /><br />";
             throw new PortletException("Configuration not found", e);
-        } catch (InvalidConfigException e) {
-            messageStatus = "Configuration not found<br /><br />";
-            throw new PortletException("Configuration not found", e);
+        } catch (LifecycleException e) {
+            // todo we have a much more detailed report now
+            messageStatus = "Lifecycle operation failed<br /><br />";
+            throw new PortletException("Exception", e);
         } catch (Exception e) {
             messageStatus = "Encountered an unhandled exception<br /><br />";
             throw new PortletException("Exception", e);

Modified: geronimo/branches/1.1/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java?rev=394860&r1=394859&r2=394860&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java (original)
+++ geronimo/branches/1.1/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java Mon Apr 17 23:44:17 2006
@@ -389,9 +389,12 @@
         DataSource ds = null;
         try {
 
+            Artifact configurationId = configurationData.getId();
+
             // load the configuration
-            Configuration configuration = configurationManager.loadConfiguration(configurationData);
-            configurationManager.startConfiguration(configuration);
+            configurationManager.loadConfiguration(configurationData);
+            Configuration configuration = configurationManager.getConfiguration(configurationId);
+            configurationManager.startConfiguration(configurationId);
             Set gb = configuration.getGBeans().keySet();
             for (Iterator iterator = gb.iterator(); iterator.hasNext();) {
                 AbstractName name = (AbstractName) iterator.next();
@@ -486,8 +489,8 @@
             }
 
 
-            configurationManager.stopConfiguration(configuration);
-            configurationManager.unloadConfiguration(configuration);
+            configurationManager.stopConfiguration(configurationId);
+            configurationManager.unloadConfiguration(configurationId);
         } finally {
             if (ds != null) {
                 Connection connection = null;
@@ -630,8 +633,8 @@
             }
         }
 
-        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/deploy-tool/src/java/org/apache/geronimo/deployment/PluginBootstrap.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/PluginBootstrap.java?rev=394860&r1=394859&r2=394860&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/PluginBootstrap.java (original)
+++ geronimo/branches/1.1/modules/deploy-tool/src/java/org/apache/geronimo/deployment/PluginBootstrap.java Mon Apr 17 23:44:17 2006
@@ -18,25 +18,20 @@
 
 import java.io.File;
 import java.io.FileOutputStream;
-import java.net.URI;
-import java.net.URL;
 import java.util.Collections;
-import java.util.List;
 import java.util.jar.JarOutputStream;
 
-import org.apache.geronimo.deployment.DeploymentContext;
 import org.apache.geronimo.deployment.service.ServiceConfigBuilder;
 import org.apache.geronimo.deployment.xbeans.ConfigurationDocument;
 import org.apache.geronimo.deployment.xbeans.ConfigurationType;
 import org.apache.geronimo.kernel.Jsr77Naming;
+import org.apache.geronimo.kernel.config.ConfigurationAlreadyExistsException;
 import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.kernel.config.NullConfigurationStore;
-import org.apache.geronimo.kernel.config.ConfigurationAlreadyExistsException;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.system.configuration.ExecutableConfigurationUtil;
 import org.apache.geronimo.system.repository.Maven1Repository;
-import org.apache.geronimo.gbean.AbstractName;
 
 /**
  * @version $Rev$ $Date$

Modified: geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/CopyResourceContext.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/CopyResourceContext.java?rev=394860&r1=394859&r2=394860&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/CopyResourceContext.java (original)
+++ geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/CopyResourceContext.java Mon Apr 17 23:44:17 2006
@@ -44,7 +44,7 @@
         
         if (baseDir.isFile()) {
             try {
-                configuration.addToClassPath(URI.create(""));
+                configuration.addToClassPath("");
             } catch (IOException e) {
                 throw new DeploymentException(e);
             }
@@ -67,7 +67,7 @@
         DeploymentUtil.copyToPackedJar(jarFile, targetFile);
 
         if (!targetFile.isFile()) throw new IllegalStateException("target file should be a file: " + targetFile);
-        configuration.addToClassPath(targetPath);
+        configuration.addToClassPath(targetPath.toString());
     }
 
     /**
@@ -87,7 +87,7 @@
         addFile(targetFile, zipFile, zipEntry);
 
 //        if (!targetFile.isDirectory()) throw new IllegalStateException("target file should be a directory: " + targetFile);
-        configuration.addToClassPath(targetPath);
+        configuration.addToClassPath(targetPath.toString());
     }
 
     /**
@@ -106,7 +106,7 @@
         addFile(targetFile, source);
 
         if (!targetFile.isFile()) throw new IllegalStateException("target file should be a file: " + targetFile);
-        configuration.addToClassPath(targetPath);
+        configuration.addToClassPath(targetPath.toString());
     }
 
     /**
@@ -125,7 +125,7 @@
         addFile(targetFile, source);
 
         if (!targetFile.isFile()) throw new IllegalStateException("target file should be a file: " + targetFile);
-        configuration.addToClassPath(targetPath);
+        configuration.addToClassPath(targetPath.toString());
     }
 
     public void addFile(URI targetPath, ZipFile zipFile, ZipEntry zipEntry) throws IOException {

Modified: geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java?rev=394860&r1=394859&r2=394860&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java (original)
+++ geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java Mon Apr 17 23:44:17 2006
@@ -161,7 +161,8 @@
 
     private static Configuration createTempConfiguration(Environment environment, ConfigurationModuleType moduleType, File baseDir, File inPlaceConfigurationDir, ConfigurationManager configurationManager, Naming naming) throws DeploymentException {
         try {
-            return configurationManager.loadConfiguration(new ConfigurationData(moduleType, null, null, null, environment, baseDir, inPlaceConfigurationDir, naming));
+            configurationManager.loadConfiguration(new ConfigurationData(moduleType, null, null, null, environment, baseDir, inPlaceConfigurationDir, naming));
+            return configurationManager.getConfiguration(environment.getConfigId());
         } catch (Exception e) {
             throw new DeploymentException("Unable to create configuration for deployment", e);
         }
@@ -335,7 +336,7 @@
             try {
                 URI targetUri = moduleBaseUri.resolve(pathUri);
                 if (targetUri.getPath().endsWith("/")) throw new IllegalStateException("target path must not end with a '/' character: " + targetUri);
-                configuration.addToClassPath(targetUri);
+                configuration.addToClassPath(targetUri.toString());
             } catch (IOException e) {
                 throw new DeploymentException(e);
             }
@@ -350,7 +351,7 @@
         File targetFile = getTargetFile(new URI(targetPath.toString() + classFileName));
         addFile(targetFile, new ByteArrayInputStream(bytes));
 
-        configuration.addToClassPath(targetPath);
+        configuration.addToClassPath(targetPath.toString());
     }
 
     public void addFile(URI targetPath, ZipFile zipFile, ZipEntry zipEntry) throws IOException {
@@ -398,7 +399,7 @@
     public void close() throws IOException, DeploymentException {
         if (configurationManager != null) {
             try {
-                configurationManager.unloadConfiguration(configuration);
+                configurationManager.unloadConfiguration(configuration.getId());
             } catch (NoSuchConfigException ignored) {
             }
         }

Modified: geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/InPlaceResourceContext.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/InPlaceResourceContext.java?rev=394860&r1=394859&r2=394860&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/InPlaceResourceContext.java (original)
+++ geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/InPlaceResourceContext.java Mon Apr 17 23:44:17 2006
@@ -37,7 +37,7 @@
 
         if (inPlaceBaseConfigurationDir.isFile()) {
             try {
-                configuration.addToClassPath(URI.create(""));
+                configuration.addToClassPath("");
             } catch (IOException e) {
                 throw new DeploymentException(e);
             }
@@ -45,19 +45,19 @@
     }
 
     public void addIncludeAsPackedJar(URI targetPath, JarFile jarFile) throws IOException {
-        configuration.addToClassPath(targetPath);
+        configuration.addToClassPath(targetPath.toString());
     }
 
     public void addInclude(URI targetPath, ZipFile zipFile, ZipEntry zipEntry) throws IOException {
-        configuration.addToClassPath(targetPath);
+        configuration.addToClassPath(targetPath.toString());
     }
 
     public void addInclude(URI targetPath, URL source) throws IOException {
-        configuration.addToClassPath(targetPath);
+        configuration.addToClassPath(targetPath.toString());
     }
 
     public void addInclude(URI targetPath, File source) throws IOException {
-        configuration.addToClassPath(targetPath);
+        configuration.addToClassPath(targetPath.toString());
     }
 
     public void addFile(URI targetPath, ZipFile zipFile, ZipEntry zipEntry) throws IOException {

Modified: geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTest.java?rev=394860&r1=394859&r2=394860&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTest.java (original)
+++ geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTest.java Mon Apr 17 23:44:17 2006
@@ -21,11 +21,11 @@
 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.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.jar.JarFile;
 
 import javax.xml.namespace.QName;
@@ -44,6 +44,7 @@
 import org.apache.geronimo.kernel.Jsr77Naming;
 import org.apache.geronimo.kernel.Naming;
 import org.apache.geronimo.kernel.config.ConfigurationData;
+import org.apache.geronimo.kernel.config.IOUtil;
 import org.apache.geronimo.kernel.config.InvalidConfigException;
 import org.apache.geronimo.kernel.config.NoSuchConfigException;
 import org.apache.geronimo.kernel.config.NullConfigurationStore;
@@ -576,12 +577,13 @@
             }
         }
 
-        public URL resolve(Artifact configId, String moduleName, URI uri) throws NoSuchConfigException, MalformedURLException {
+        public Set resolve(Artifact configId, String moduleName, String pattern) throws NoSuchConfigException, MalformedURLException {
             File file = (File) locations.get(configId);
             if (file == null) {
                 throw new NoSuchConfigException(configId);
             }
-            return new URL(file.toURL(), uri.toString());
+            Set matches = IOUtil.search(file, pattern);
+            return matches;
         }
     }
 }

Modified: geronimo/branches/1.1/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java?rev=394860&r1=394859&r2=394860&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java (original)
+++ geronimo/branches/1.1/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java Mon Apr 17 23:44:17 2006
@@ -119,8 +119,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));
@@ -130,8 +132,8 @@
             assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(objectName));
         }
 
-        configurationManager.stopConfiguration(configuration);
-        configurationManager.unloadConfiguration(configuration);
+        configurationManager.stopConfiguration(configurationId);
+        configurationManager.unloadConfiguration(configurationId);
 
     }
 
@@ -332,8 +334,8 @@
             }
         }
 
-        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/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java?rev=394860&r1=394859&r2=394860&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java Mon Apr 17 23:44:17 2006
@@ -662,7 +662,7 @@
             if (attribute.isPersistent()) {
                 return attribute.getPersistentValue();
             } else {
-                throw new IllegalStateException("Cannot retrieve the value for non-persistent attribute " + attributeName + " when GBeanInstance is DESTROYED");
+                throw new IllegalStateException("Cannot retrieve the value for non-persistent attribute " + attributeName + " when gbean has been destroyed: " + abstractName);
             }
         }
     }
@@ -906,7 +906,7 @@
                     parameters[i] = getReferenceByName(name).getProxy();
                 } else {
                     stateReason = "the service constructor definition contained the name '" + name + "' which is not a known attribute or reference of the service.";
-                    throw new InvalidConfigurationException("Unknown attribute or reference name in constructor: name=" + name);
+                    throw new InvalidConfigurationException("Unknown attribute or reference name in constructor: referenceName=" + name + ", gbean=" + abstractName);
                 }
             }
 

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java?rev=394860&r1=394859&r2=394860&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java Mon Apr 17 23:44:17 2006
@@ -20,7 +20,6 @@
 import java.io.File;
 import java.io.IOException;
 import java.net.MalformedURLException;
-import java.net.URI;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -215,7 +214,7 @@
         if (configurationResolver == null) throw new NullPointerException("configurationResolver is null");
 
         this.configurationData = configurationData;
-        this.environment = this.configurationData.getEnvironment();
+        this.environment = configurationData.getEnvironment();
         this.configurationResolver = configurationResolver;
         this.classPath = new LinkedHashSet(configurationData.getClassPath());
         this.naming = configurationData.getNaming();
@@ -256,40 +255,60 @@
             }
         }
 
-        //
-        // Build the configuration class loader
-        //
-        configurationClassLoader = createConfigurationClasssLoader(parents, environment, classPath);
-
-        //
-        // Get all service parents in depth first order
-        //
-        addDepthFirstServiceParents(this, allServiceParents);
-
-        //
-        // Deserialize the GBeans in the configurationData
-        //
-        Collection gbeans = configurationData.getGBeans(configurationClassLoader);
-        if (attributeStore != null) {
-            gbeans = attributeStore.applyOverrides(id, gbeans, configurationClassLoader);
-        }
-        for (Iterator iterator = gbeans.iterator(); iterator.hasNext();) {
-            GBeanData gbeanData = (GBeanData) iterator.next();
-            this.gbeans.put(gbeanData.getAbstractName(), gbeanData);
-        }
+        try {
+            //
+            // Build the configuration class loader
+            //
+            configurationClassLoader = createConfigurationClasssLoader(parents, environment, classPath);
+
+            //
+            // Get all service parents in depth first order
+            //
+            addDepthFirstServiceParents(this, allServiceParents);
+
+            //
+            // Deserialize the GBeans in the configurationData
+            //
+            Collection gbeans = configurationData.getGBeans(configurationClassLoader);
+            if (attributeStore != null) {
+                gbeans = attributeStore.applyOverrides(id, gbeans, configurationClassLoader);
+            }
+            for (Iterator iterator = gbeans.iterator(); iterator.hasNext();) {
+                GBeanData gbeanData = (GBeanData) iterator.next();
+                this.gbeans.put(gbeanData.getAbstractName(), gbeanData);
+            }
 
-        //
-        // Create child configurations
-        //
-        LinkedHashSet childParents = new LinkedHashSet(parents);
-        childParents.add(this);
-        for (Iterator iterator = configurationData.getChildConfigurations().entrySet().iterator(); iterator.hasNext();) {
-            Map.Entry entry = (Map.Entry) iterator.next();
-            String moduleName = (String) entry.getKey();
-            ConfigurationData childConfigurationData = (ConfigurationData) entry.getValue();
-            Configuration childConfiguration = new Configuration(childParents, childConfigurationData, configurationResolver.createChildResolver(moduleName), attributeStore);
-            childConfiguration.parent = this;
-            children.add(childConfiguration);
+            //
+            // Create child configurations
+            //
+            LinkedHashSet childParents = new LinkedHashSet(parents);
+            childParents.add(this);
+            for (Iterator iterator = configurationData.getChildConfigurations().entrySet().iterator(); iterator.hasNext();) {
+                Map.Entry entry = (Map.Entry) iterator.next();
+                String moduleName = (String) entry.getKey();
+                ConfigurationData childConfigurationData = (ConfigurationData) entry.getValue();
+                Configuration childConfiguration = new Configuration(childParents, childConfigurationData, configurationResolver.createChildResolver(moduleName), attributeStore);
+                childConfiguration.parent = this;
+                children.add(childConfiguration);
+            }
+        } catch (RuntimeException e) {
+            shutdown();
+            throw e;
+        } catch (Error e) {
+            shutdown();
+            throw e;
+        } catch (MissingDependencyException e) {
+            shutdown();
+            throw e;
+        } catch (MalformedURLException e) {
+            shutdown();
+            throw e;
+        } catch (NoSuchConfigException e) {
+            shutdown();
+            throw e;
+        } catch (InvalidConfigException e) {
+            shutdown();
+            throw e;
         }
     }
 
@@ -353,8 +372,12 @@
         }
         if (classPath != null) {
             for (Iterator i = classPath.iterator(); i.hasNext();) {
-                URI uri = (URI) i.next();
-                urls.add(configurationResolver.resolve(uri));
+                String pattern = (String) i.next();
+                Set matches = configurationResolver.resolve(pattern);
+                for (Iterator iterator = matches.iterator(); iterator.hasNext();) {
+                    URL url = (URL) iterator.next();
+                    urls.add(url);
+                }
             }
         }
         return (URL[]) urls.toArray(new URL[urls.size()]);
@@ -417,6 +440,15 @@
     }
 
     /**
+     * This is used by the configuration manager to restart an existing configuation.
+     * Do not modify the configuation data.
+     * @return the configuation data for this configuration; do not modify
+     */
+    ConfigurationData getConfigurationData() {
+        return configurationData;
+    }
+
+    /**
      * @deprecated this is only exposed temporarily for configuration manager
      */
     public ConfigurationResolver getConfigurationResolver() {
@@ -431,14 +463,17 @@
         return new ArrayList(classPath);
     }
 
-    public void addToClassPath(URI path) throws IOException {
-        if (!classPath.contains(path)) {
+    public void addToClassPath(String pattern) throws IOException {
+        if (!classPath.contains(pattern)) {
             try {
-                URL url = configurationResolver.resolve(path);
-                configurationClassLoader.addURL(url);
-                classPath.add(path);
+                Set matches = configurationResolver.resolve(pattern);
+                for (Iterator iterator = matches.iterator(); iterator.hasNext();) {
+                    URL url = (URL) iterator.next();
+                    configurationClassLoader.addURL(url);
+                }
+                classPath.add(pattern);
             } catch (Exception e) {
-                throw new IOException("Unable to extend classpath with " + path);
+                throw new IOException("Unable to extend classpath with " + pattern);
             }
         }
     }
@@ -587,7 +622,7 @@
                     GBeanData gBeanData = (GBeanData) iterator1.next();
                     names.add(gBeanData.getAbstractName());
                 }
-                throw new GBeanNotFoundException("More than one match to referencePatterns: " + names , patterns);
+                throw new GBeanNotFoundException("More than one match to referencePatterns: " + names.toString(), patterns);
             }
         }
 

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java?rev=394860&r1=394859&r2=394860&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java Mon Apr 17 23:44:17 2006
@@ -18,7 +18,6 @@
 
 import java.io.IOException;
 import java.util.List;
-import javax.management.ObjectName;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.gbean.AbstractName;
 
@@ -30,16 +29,27 @@
 public interface ConfigurationManager {
     /**
      * Is the specified configuration loaded into the kernel?
-     *
-     * @param configID the name of the configuration
-     *
+     * @param configurationId the configuration identifier
      * @return true if the configuration has been loaded; false otherwise
      */
-    boolean isLoaded(Artifact configID);
+    boolean isLoaded(Artifact configurationId);
+
+    /**
+     * Is the specified configuation running?
+     * @param configurationId the configuration identifier
+     * @return true if the configuration is running, false otherwise
+     */
+    boolean isRunning(Artifact configurationId);
+
+    /**
+     * Gets a List&gt;ConfigurationInfo&lt; of every of every available configuation.
+     * @return a List&gt;ConfigurationInfo&lt; of every of every available configuation
+     */
+    List listConfigurations();
 
     /**
      * Return a list of the stores this manager knows about.
-     * @return a List (with elements of type AbstractName) of the stores this manager controls
+     * @return a List&gt;AbstractName&lt; of the stores this manager controls
      */
     List listStores();
 
@@ -58,9 +68,7 @@
      * Return a list of the configurations in a specific store.
      *
      * @param store the store to list
-     *
-     * @return a List (with elements of type ConfigurationInfo) of all the configurations in the store
-     *
+     * @return a List&gt;ConfigurationInfo&lt; of all the configurations in the store
      * @throws NoSuchStoreException if the store could not be located
      */
     List listConfigurations(AbstractName store) throws NoSuchStoreException;
@@ -77,31 +85,157 @@
     /**
      * Gets a loaded Configuration (does not see unloaded configurations).
      *
-     * @param configId the configuration to get
+     * @param configurationId the configuration to get
      *
      * @return the specified configuration or null if the configuration has not been loaded
      */
-    Configuration getConfiguration(Artifact configId);
+    Configuration getConfiguration(Artifact configurationId);
 
-    void loadConfiguration(Artifact configID) throws NoSuchConfigException, IOException, InvalidConfigException;
+    /**
+     * Load the specified configuration (from a config store) and all configurations it depends on into the kernel.
+     * This causes the configuration gbean to be loaded and started, but does not load any of the gbean contained
+     * within the configuration.
+     *
+     * @param configurationId the configuration identifier
+     * @return the results of the operation
+     * @throws NoSuchConfigException if no configuration with the given id exists in the configuration stores
+     * @throws LifecycleException if there is a problem loading the configuration
+     */
+    LifecycleResults loadConfiguration(Artifact configurationId) throws NoSuchConfigException, LifecycleException;
 
-    Configuration loadConfiguration(ConfigurationData configurationData) throws NoSuchConfigException, IOException, InvalidConfigException;
+    /**
+     * Load the specified configurationData and all configurations it depends on (from a config store) into
+     * the kernel. This causes the configuration gbean to be loaded and started, but does not load any of the
+     * gbean contained within the configuration.
+     *
+     * @param configurationData the configuration to load
+     * @return the results of the operation
+     * @throws NoSuchConfigException if no configuration with the given id exists in the configuration stores
+     * @throws LifecycleException if there is a problem loading the configuration
+     */
+    LifecycleResults loadConfiguration(ConfigurationData configurationData) throws NoSuchConfigException, LifecycleException;
 
-    void unloadConfiguration(Artifact configID) throws NoSuchConfigException;
+    /**
+     * Load the specified configuration (from a config store) and all configurations it depends on into the kernel.
+     * This causes the configuration gbean to be loaded and started, but does not load any of the gbean contained
+     * within the configuration.
+     *
+     * @param configurationId the configuration identifier
+     * @param monitor the monitor that should receive events as the operation is carried out
+     * @return the results of the operation
+     * @throws NoSuchConfigException if no configuration with the given id exists in the configuration stores
+     * @throws LifecycleException if there is a problem loading the configuration
+     */
+    LifecycleResults loadConfiguration(Artifact configurationId, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException;
+
+    /**
+     * Load the specified configurationData and all configurations it depends on (from a config store) into
+     * the kernel. This causes the configuration gbean to be loaded and started, but does not load any of the
+     * gbean contained within the configuration.
+     *
+     * @param configurationData the configuration to load
+     * @param monitor the monitor that should receive events as the operation is carried out
+     * @return the results of the operation
+     * @throws NoSuchConfigException if no configuration with the given id exists in the configuration stores
+     * @throws LifecycleException if there is a problem loading the configuration
+     */
+    LifecycleResults loadConfiguration(ConfigurationData configurationData, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException;
+
+    /**
+     * Stops and unloads the configuration.  This causes all contained gbeans to be stopped and unloaded, and the
+     * configuration gbean is stopped and unloaded.  This operation causes all configurations that have a class
+     * or service dependency on the specified configuration to be stopped and unloaded.
+     *
+     * @param configurationId the configuration identifier
+     * @return the results of the operation
+     * @throws NoSuchConfigException if the configuration is not loaded
+     */
+    LifecycleResults unloadConfiguration(Artifact configurationId) throws NoSuchConfigException;
 
-    void unloadConfiguration(Configuration configuration) throws NoSuchConfigException;
+    /**
+     * Stops and unloads the configuration.  This causes all contained gbeans to be stopped and unloaded, and the
+     * configuration gbean is stopped and unloaded.  This operation causes all configurations that have a class
+     * or service dependency on the specified configuration to be stopped and unloaded.
+     *
+     * @param configurationId the configuration identifier
+     * @return the results of the operation
+     * @param monitor the monitor that should receive events as the operation is carried out
+     * @throws NoSuchConfigException if the configuration is not loaded
+     */
+    LifecycleResults unloadConfiguration(Artifact configurationId, LifecycleMonitor monitor) throws NoSuchConfigException;
 
-    void startConfiguration(Artifact configID) throws InvalidConfigException;
+    /**
+     * Loads and starts all of the gbeans contained within the configuration.  If any of the gbeans fails to fully
+     * start, all gbeans will be unloaded and an exception will be thrown.  This operation causes all configurations
+     * that the specified configuration has a service dependency on to be started.
+     *
+     * @param configurationId the configuration identifier
+     * @return the results of the operation
+     * @throws NoSuchConfigException if the configuration is not loaded
+     */
+    LifecycleResults startConfiguration(Artifact configurationId) throws NoSuchConfigException, LifecycleException;
 
-    void startConfiguration(Configuration configuration) throws InvalidConfigException;
+    /**
+     * Loads and starts all of the gbeans contained within the configuration.  If any of the gbeans fails to fully
+     * start, all gbeans will be unloaded and an exception will be thrown.  This operation causes all configurations
+     * that the specified configuration has a service dependency on to be started.
+     *
+     * @param configurationId the configuration identifier
+     * @param monitor the monitor that should receive events as the operation is carried out
+     * @return the results of the operation
+     * @throws NoSuchConfigException if the configuration is not loaded
+     */
+    LifecycleResults startConfiguration(Artifact configurationId, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException;
 
-    void stopConfiguration(Artifact configID) throws NoSuchConfigException;
+    /**
+     * Stop the gbeans contained within the configuration.  This operation causes all configurations that have a
+     * service dependency on the specified configuration to be stopped.
+     *
+     * @param configurationId the configuration identifier
+     * @return the results of the operation
+     * @throws NoSuchConfigException if the configuration is not loaded
+     */
+    LifecycleResults stopConfiguration(Artifact configurationId) throws NoSuchConfigException;
 
-    void stopConfiguration(Configuration configuration) throws NoSuchConfigException;
+    /**
+     * Stop the gbeans contained within the configuration.  This operation causes all configurations that have a
+     * service dependency on the specified configuration to be stopped.
+     *
+     * @param configurationId the configuration identifier
+     * @param monitor the monitor that should receive events as the operation is carried out
+     * @return the results of the operation
+     * @throws NoSuchConfigException if the configuration is not loaded
+     */
+    LifecycleResults stopConfiguration(Artifact configurationId, LifecycleMonitor monitor) throws NoSuchConfigException;
 
-    boolean isRunning(Artifact configurationId);
+    /**
+     * Restarts the specified configuration and all configurations that have a service dependency on the
+     * specified configuration
+     *
+     * @param configurationId the configuration identifier
+     * @return the results of the operation
+     * @throws NoSuchConfigException if the configuration is not loaded
+     * @throws LifecycleException if there is a problem loading the configuration
+     */
+    LifecycleResults restartConfiguration(Artifact configurationId) throws NoSuchConfigException, LifecycleException;
 
-    List listConfigurations();
+    /**
+     * Restarts the specified configuration and all configurations that have a service dependency on the
+     * specified configuration
+     *
+     * @param configurationId the configuration identifier
+     * @param monitor the monitor that should receive events as the operation is carried out
+     * @return the results of the operation
+     * @throws NoSuchConfigException if the configuration is not loaded
+     * @throws LifecycleException if there is a problem loading the configuration
+     */
+    LifecycleResults restartConfiguration(Artifact configurationId, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException;
 
-    void uninstallConfiguration(Artifact configId) throws IOException, NoSuchConfigException;
+    /**
+     * Unstalls the specified configuration from the server.   This operation can not be reversed.
+     * @param configurationId the configuration identifier
+     * @throws IOException if there was a problem removing the configuration
+     * @throws NoSuchConfigException if the configuration is not loaded
+     */
+    void uninstallConfiguration(Artifact configurationId) throws IOException, NoSuchConfigException;
 }

Added: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationModel.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationModel.java?rev=394860&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationModel.java (added)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationModel.java Mon Apr 17 23:44:17 2006
@@ -0,0 +1,174 @@
+/**
+ *
+ * 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.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+
+import org.apache.geronimo.kernel.repository.Artifact;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConfigurationModel {
+    private final Map configurations = new TreeMap();
+
+    public void addConfiguation(Artifact configurationId, Set loadParentIds, Set startParentIds) throws NoSuchConfigException {
+        Set startParents = getStatuses(startParentIds);
+
+        // load parents are both the class parents and the service parents
+        Set loadParents = new LinkedHashSet(startParents);
+        loadParents.addAll(getStatuses(loadParentIds));
+
+        ConfigurationStatus configurationStatus = new ConfigurationStatus(configurationId, loadParents, startParents);
+        configurations.put(configurationId, configurationStatus);
+    }
+
+    private Set getStatuses(Set configurationIds) throws NoSuchConfigException {
+        LinkedHashSet statuses = new LinkedHashSet(configurationIds.size());
+        for (Iterator iterator = configurationIds.iterator(); iterator.hasNext();) {
+            Artifact configurationId = (Artifact) iterator.next();
+            ConfigurationStatus configurationStatus = (ConfigurationStatus) configurations.get(configurationId);
+            if (configurationStatus == null) {
+                throw new NoSuchConfigException(configurationId);
+            }
+
+            statuses.add(configurationStatus);
+        }
+        return statuses;
+    }
+
+    public void removeConfiguration(Artifact configurationId) throws NoSuchConfigException {
+        ConfigurationStatus configurationStatus = (ConfigurationStatus) configurations.get(configurationId);
+        if (configurationStatus == null) {
+            throw new NoSuchConfigException(configurationId);
+        }
+        configurationStatus.destroy();
+        configurations.remove(configurationId);
+    }
+
+    public boolean containsConfiguration(Artifact configurationId) {
+        return configurations.containsKey(configurationId);
+    }
+
+    public boolean isLoaded(Artifact configurationId) {
+        ConfigurationStatus configurationStatus = (ConfigurationStatus) configurations.get(configurationId);
+        if (configurationStatus != null) {
+            return configurationStatus.isLoaded();
+        }
+        return false;
+    }
+
+    public boolean isStarted(Artifact configurationId) {
+        ConfigurationStatus configurationStatus = (ConfigurationStatus) configurations.get(configurationId);
+        if (configurationStatus != null) {
+            return configurationStatus.isStarted();
+        }
+        return false;
+    }
+
+    public LinkedHashSet load(Artifact configurationId) throws NoSuchConfigException {
+        ConfigurationStatus configurationStatus = (ConfigurationStatus) configurations.get(configurationId);
+        if (configurationStatus == null) {
+            throw new NoSuchConfigException(configurationId);
+        }
+        return configurationStatus.load();
+    }
+
+    public LinkedHashSet start(Artifact configurationId) throws NoSuchConfigException {
+        ConfigurationStatus configurationStatus = (ConfigurationStatus) configurations.get(configurationId);
+        if (configurationStatus == null) {
+            throw new NoSuchConfigException(configurationId);
+        }
+        return configurationStatus.start();
+    }
+
+    public LinkedHashSet stop(Artifact configurationId) throws NoSuchConfigException {
+        return stop(configurationId, true);
+    }
+
+    public LinkedHashSet stop(Artifact configurationId, boolean gc) throws NoSuchConfigException {
+        ConfigurationStatus configurationStatus = (ConfigurationStatus) configurations.get(configurationId);
+        if (configurationStatus == null) {
+            throw new NoSuchConfigException(configurationId);
+        }
+        return configurationStatus.stop(gc);
+    }
+
+    public LinkedHashSet restart(Artifact configurationId) throws NoSuchConfigException {
+        ConfigurationStatus configurationStatus = (ConfigurationStatus) configurations.get(configurationId);
+        if (configurationStatus == null) {
+            throw new NoSuchConfigException(configurationId);
+        }
+        return configurationStatus.restart();
+    }
+
+    public LinkedHashSet unload(Artifact configurationId) throws NoSuchConfigException {
+        ConfigurationStatus configurationStatus = (ConfigurationStatus) configurations.get(configurationId);
+        if (configurationStatus == null) {
+            throw new NoSuchConfigException(configurationId);
+        }
+        return configurationStatus.unload();
+    }
+
+    public Set getLoaded() {
+        Set result = new LinkedHashSet();
+        for (Iterator iterator = configurations.values().iterator(); iterator.hasNext();) {
+            ConfigurationStatus status = (ConfigurationStatus) iterator.next();
+            if (status.isLoaded()) {
+                result.add(status.getConfigurationId());
+            }
+        }
+        return result;
+    }
+
+    public Set getStarted() {
+        Set result = new LinkedHashSet();
+        for (Iterator iterator = configurations.values().iterator(); iterator.hasNext();) {
+            ConfigurationStatus status = (ConfigurationStatus) iterator.next();
+            if (status.isStarted()) {
+                result.add(status.getConfigurationId());
+            }
+        }
+        return result;
+    }
+
+    public Set getUserLoaded() {
+        Set result = new LinkedHashSet();
+        for (Iterator iterator = configurations.values().iterator(); iterator.hasNext();) {
+            ConfigurationStatus status = (ConfigurationStatus) iterator.next();
+            if (status.isUserLoaded()) {
+                result.add(status.getConfigurationId());
+            }
+        }
+        return result;
+    }
+
+    public Set getUserStarted() {
+        Set result = new LinkedHashSet();
+        for (Iterator iterator = configurations.values().iterator(); iterator.hasNext();) {
+            ConfigurationStatus status = (ConfigurationStatus) iterator.next();
+            if (status.isUserStarted()) {
+                result.add(status.getConfigurationId());
+            }
+        }
+        return result;
+    }
+}

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationResolver.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationResolver.java?rev=394860&r1=394859&r2=394860&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationResolver.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationResolver.java Mon Apr 17 23:44:17 2006
@@ -22,10 +22,9 @@
 import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.Collections;
+import java.util.Set;
 import java.io.File;
-import java.net.URI;
 import java.net.MalformedURLException;
-import java.net.URL;
 
 import org.apache.geronimo.kernel.repository.ArtifactResolver;
 import org.apache.geronimo.kernel.repository.MissingDependencyException;
@@ -113,11 +112,13 @@
         throw new MissingDependencyException("Unable to resolve dependency " + artifact);
     }
 
-    public URL resolve(URI uri) throws MalformedURLException, NoSuchConfigException {
+    public Set resolve(String pattern) throws MalformedURLException, NoSuchConfigException {
         if (configurationStore != null) {
-            return configurationStore.resolve(configurationId, moduleName, uri);
+            Set matches = configurationStore.resolve(configurationId, moduleName, pattern);
+            return matches;
         } else if (baseDir != null) {
-            return new File(baseDir, uri.toString()).toURL();
+            Set matches = IOUtil.search(baseDir, pattern);
+            return matches;
         } else {
             throw new IllegalStateException("No configurationStore or baseDir supplied so paths can not be resolved");
         }

Added: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStatus.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStatus.java?rev=394860&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStatus.java (added)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStatus.java Mon Apr 17 23:44:17 2006
@@ -0,0 +1,335 @@
+/**
+ *
+ * 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.LinkedHashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.apache.geronimo.kernel.repository.Artifact;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConfigurationStatus {
+    private final Artifact configurationId;
+    private final Set loadParents;
+    private final Set startParents;
+    private final LinkedHashSet loadChildren = new LinkedHashSet();
+    private final LinkedHashSet startChildren = new LinkedHashSet();
+    private boolean loaded = false;
+    private boolean started = false;
+    private boolean userLoaded = false;
+    private boolean userStarted = false;
+
+    public ConfigurationStatus(Artifact configId, Set loadParents, Set startParents) {
+        if (configId == null) throw new NullPointerException("configId is null");
+        if (loadParents == null) throw new NullPointerException("loadParents is null");
+        if (startParents == null) throw new NullPointerException("startParents is null");
+        if (!loadParents.containsAll(startParents)) {
+            throw new IllegalArgumentException("loadParents must contain all startParents");
+        }
+        this.configurationId = configId;
+        this.loadParents = loadParents;
+        this.startParents = startParents;
+
+        for (Iterator iterator = loadParents.iterator(); iterator.hasNext();) {
+            ConfigurationStatus loadParent = (ConfigurationStatus) iterator.next();
+            loadParent.loadChildren.add(this);
+        }
+
+        for (Iterator iterator = startParents.iterator(); iterator.hasNext();) {
+            ConfigurationStatus startParent = (ConfigurationStatus) iterator.next();
+            startParent.startChildren.add(this);
+        }
+    }
+
+    public void destroy() {
+        if (started) {
+            throw new IllegalStateException("Configuration " + configurationId + " is still running");
+        }
+        if (loaded) {
+            throw new IllegalStateException("Configuration " + configurationId + " is still loaded");
+        }
+        if (loadChildren.size() > 0 || startChildren.size() > 0) {
+            throw new IllegalStateException("Configuration " + configurationId + " still has children");
+        }
+
+        for (Iterator iterator = loadParents.iterator(); iterator.hasNext();) {
+            ConfigurationStatus loadParent = (ConfigurationStatus) iterator.next();
+            loadParent.loadChildren.remove(this);
+        }
+        loadParents.clear();
+
+        for (Iterator iterator = startParents.iterator(); iterator.hasNext();) {
+            ConfigurationStatus startParent = (ConfigurationStatus) iterator.next();
+            startParent.startChildren.remove(this);
+        }
+        startChildren.clear();
+    }
+
+    public Artifact getConfigurationId() {
+        return configurationId;
+    }
+
+    public boolean isLoaded() {
+        return loaded;
+    }
+
+    public boolean isStarted() {
+        return started;
+    }
+
+    public boolean isUserLoaded() {
+        return userLoaded;
+    }
+
+    public boolean isUserStarted() {
+        return userStarted;
+    }
+
+    public boolean hasLoadDependencyOn(Artifact parentId) {
+        for (Iterator iterator = loadParents.iterator(); iterator.hasNext();) {
+            ConfigurationStatus loadParent = (ConfigurationStatus) iterator.next();
+            if (loadParent.getConfigurationId().equals(parentId)) {
+                return true;
+            }
+            if (loadParent.hasLoadDependencyOn(parentId)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public boolean hasStartDependencyOn(Artifact parentId) {
+        for (Iterator iterator = startParents.iterator(); iterator.hasNext();) {
+            ConfigurationStatus startParent = (ConfigurationStatus) iterator.next();
+            if (startParent.getConfigurationId().equals(parentId)) {
+                return true;
+            }
+            if (startParent.hasStartDependencyOn(parentId)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public LinkedHashSet load() {
+        LinkedHashSet loadList = new LinkedHashSet();
+        loadInternal(loadList);
+        userLoaded = true;
+        return loadList;
+    }
+
+    private void loadInternal(LinkedHashSet loadList) {
+        // visit all unloaded parents
+        for (Iterator iterator = loadParents.iterator(); iterator.hasNext();) {
+            ConfigurationStatus parent = (ConfigurationStatus) iterator.next();
+            if (!parent.isLoaded()) {
+                parent.loadInternal(loadList);
+            }
+        }
+
+        if (!loaded) {
+            loadList.add(configurationId);
+            loaded = true;
+        }
+    }
+
+
+    public LinkedHashSet start() {
+        if (!loaded) {
+            throw new IllegalStateException(configurationId + " is not loaded");
+        }
+        LinkedHashSet startList = new LinkedHashSet();
+        startInternal(startList);
+        userLoaded = true;
+        userStarted = true;
+        return startList;
+    }
+
+    private void startInternal(LinkedHashSet startList) {
+        // visit all stopped parents
+        for (Iterator iterator = startParents.iterator(); iterator.hasNext();) {
+            ConfigurationStatus parent = (ConfigurationStatus) iterator.next();
+            if (!parent.isStarted()) {
+                parent.startInternal(startList);
+            }
+        }
+
+        if (!started) {
+            startList.add(configurationId);
+            started = true;
+        }
+    }
+
+    public LinkedHashSet stop(boolean gc) {
+        if (!started) {
+            throw new IllegalStateException(configurationId + " is not started");
+        }
+
+        LinkedHashSet stopStatuses = new LinkedHashSet();
+        stopInternal(stopStatuses, gc);
+
+        LinkedHashSet stopIds = new LinkedHashSet(stopStatuses.size());
+        for (Iterator iterator = stopStatuses.iterator(); iterator.hasNext();) {
+            ConfigurationStatus configurationStatus = (ConfigurationStatus) iterator.next();
+            stopIds.add(configurationStatus.configurationId);
+        }
+
+        return stopIds;
+    }
+
+    private void stopInternal(LinkedHashSet stopList, boolean gc) {
+        // if we aren't started, there is nothing to do
+        if (!started) {
+            return;
+        }
+
+        // visit all children
+        for (Iterator iterator = startChildren.iterator(); iterator.hasNext();) {
+            ConfigurationStatus child = (ConfigurationStatus) iterator.next();
+            if (child.isStarted()) {
+                child.stopInternal(stopList, gc);
+            }
+        }
+
+        // mark this node as stoped, and add this node to the stop list
+        if (started) {
+            started = false;
+            userStarted = false;
+            stopList.add(this);
+
+            // if we are garbage collecting, visit parents
+            if (gc) {
+                // visit all non-user started parents that haven't already been visited
+                for (Iterator iterator = startParents.iterator(); iterator.hasNext();) {
+                    ConfigurationStatus parent = (ConfigurationStatus) iterator.next();
+                    if (!parent.isUserStarted() && stopList.containsAll(parent.startChildren)) {
+                        parent.stopInternal(stopList, gc);
+                    }
+                }
+            }
+        }
+    }
+
+    public LinkedHashSet restart() {
+        if (!started) {
+            throw new IllegalStateException(configurationId + " is not started");
+        }
+
+        LinkedHashSet restartStatuses = new LinkedHashSet();
+        restartInternal(restartStatuses);
+
+        LinkedHashSet restartIds = new LinkedHashSet(restartStatuses.size());
+        for (Iterator iterator = restartStatuses.iterator(); iterator.hasNext();) {
+            ConfigurationStatus configurationStatus = (ConfigurationStatus) iterator.next();
+            restartIds.add(configurationStatus.configurationId);
+        }
+
+        userLoaded = true;
+        userStarted = true;
+        return restartIds;
+    }
+
+    private void restartInternal(LinkedHashSet restartList) {
+        // if we aren't started, there is nothing to do
+        if (!started) {
+            return;
+        }
+
+        // visit all children
+        for (Iterator iterator = startChildren.iterator(); iterator.hasNext();) {
+            ConfigurationStatus child = (ConfigurationStatus) iterator.next();
+            if (child.isStarted()) {
+                child.restartInternal(restartList);
+            }
+        }
+
+        // add this node to the restart list
+        restartList.add(this);
+    }
+
+    public LinkedHashSet unload() {
+        if (!loaded) {
+            throw new IllegalStateException(configurationId + " is not loaded");
+        }
+
+        LinkedHashSet unloadStatuses = new LinkedHashSet();
+        unloadInternal(unloadStatuses);
+
+        LinkedHashSet unloadIds = new LinkedHashSet(unloadStatuses.size());
+        for (Iterator iterator = unloadStatuses.iterator(); iterator.hasNext();) {
+            ConfigurationStatus configurationStatus = (ConfigurationStatus) iterator.next();
+            unloadIds.add(configurationStatus.configurationId);
+        }
+
+        return unloadIds;
+    }
+
+    private void unloadInternal(LinkedHashSet unloadList) {
+        // if we aren't loaded, there is nothing to do
+        if (!loaded) {
+            return;
+        }
+
+        // visit all loaded children
+        for (Iterator iterator = loadChildren.iterator(); iterator.hasNext();) {
+            ConfigurationStatus child = (ConfigurationStatus) iterator.next();
+            if (child.isLoaded()) {
+                child.unloadInternal(unloadList);
+            }
+        }
+
+        // mark this node as unloaded, and add this node to the unload list
+        if (loaded) {
+            started = false;
+            userStarted = false;
+            loaded = false;
+            userLoaded = false;
+            unloadList.add(this);
+
+            // visit all non-user loaded parents
+            for (Iterator iterator = loadParents.iterator(); iterator.hasNext();) {
+                ConfigurationStatus parent = (ConfigurationStatus) iterator.next();
+                if (!parent.isUserLoaded() && unloadList.containsAll(parent.loadChildren)) {
+                    parent.unloadInternal(unloadList);
+                }
+            }
+        }
+    }
+
+    public String toString() {
+        String load;
+        if (userLoaded) {
+            load = "user-loaded";
+        } else if (loaded) {
+            load = "loaded";
+        } else {
+            load = "not-loaded";
+        }
+        String start;
+        if (userLoaded) {
+            start = "user-started";
+        } else if (loaded) {
+            start = "started";
+        } else {
+            start = "not-started";
+        }
+        return "[" + configurationId + " " + load + " " + start + "]";
+    }
+}

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java?rev=394860&r1=394859&r2=394860&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java Mon Apr 17 23:44:17 2006
@@ -21,9 +21,8 @@
 import java.io.IOException;
 import java.io.OutputStream;
 import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
 import java.util.List;
+import java.util.Set;
 
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.gbean.AbstractName;
@@ -116,15 +115,14 @@
     File createNewConfigurationDir(Artifact configId) throws ConfigurationAlreadyExistsException;
 
     /**
-     * Locate the classpath component for the supplied uri in the given artifact
-     *
-     * @param configId    Identifies the configuration that the resource is in
-     * @param moduleName  The module within the configuration that contains the resource
-     * @param uri         The path to the resource within the module
-     *
-     * @return URL for the configuration component.
+     * Locate the physical locations which match the supplied path in the given artifact/module.  The path may be and
+     * ant style pattern.
+     * @param configId the artifact to search
+     * @param moduleName the module name or null
+     * @param path the pattern to search for with the artifact/module
+     * @return as Set&gt;URL&lt; of the matching locations
      */
-    URL resolve(Artifact configId, String moduleName, URI uri) throws NoSuchConfigException, MalformedURLException;
+    Set resolve(Artifact configId, String moduleName, String path) throws NoSuchConfigException, MalformedURLException;
 
     /**
      * Exports a configuration as a ZIP file

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java?rev=394860&r1=394859&r2=394860&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java Mon Apr 17 23:44:17 2006
@@ -20,7 +20,6 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.PrintWriter;
-import java.net.URI;
 import java.net.URL;
 import java.util.Collection;
 import java.util.HashSet;
@@ -303,7 +302,11 @@
         GAttributeInfo attribute = gbeanData.getGBeanInfo().getAttribute("configurationBaseUrl");
         if (attribute != null && attribute.getType().equals("java.net.URL")) {
             try {
-                URL baseURL = configuration.getConfigurationResolver().resolve(URI.create(""));
+                Set set = configuration.getConfigurationResolver().resolve("");
+                if (set.size() != 1) {
+                    throw new AssertionError("Expected one match for pattern \".\", but got " + set.size() + " matches");
+                }
+                URL baseURL = (URL) set.iterator().next();
                 gbeanData.setAttribute("configurationBaseUrl", baseURL);
             } catch (Exception e) {
                 throw new InvalidConfigException("Unable to set attribute named " + "configurationBaseUrl" + " in gbean " + gbeanData.getAbstractName(), e);

Added: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/IOUtil.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/IOUtil.java?rev=394860&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/IOUtil.java (added)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/IOUtil.java Mon Apr 17 23:44:17 2006
@@ -0,0 +1,268 @@
+/**
+ *
+ * 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.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.jar.JarFile;
+import java.util.zip.ZipEntry;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class IOUtil {
+    public static void recursiveCopy(File srcDir, File destDir) throws IOException {
+        if (srcDir == null)  throw new NullPointerException("sourceDir is null");
+        if (srcDir == null)  throw new NullPointerException("destDir is null");
+        if (!srcDir.isDirectory() || ! srcDir.canRead()) {
+            throw new IllegalArgumentException("Source directory must be a readable directory " + srcDir);
+        }
+        if (destDir.exists()) {
+            throw new IllegalArgumentException("Destination directory already exists " + destDir);
+        }
+        if (destDir.equals(destDir)) {
+            throw new IllegalArgumentException("Source and destination directory are the same " + srcDir);
+        }
+
+        destDir.mkdirs();
+        if (!destDir.exists()) {
+            throw new IOException("Could not create destination directory " + destDir);
+        }
+
+
+        File[] srcFiles = srcDir.listFiles();
+        if (srcFiles != null) {
+            for (int i = 0; i < srcFiles.length; i++) {
+                File srcFile = srcFiles[i];
+                File destFile = new File(destDir, srcFile.getName());
+                if (srcFile.isDirectory()) {
+                    recursiveCopy(srcFile, destFile);
+                } else {
+                    copyFile(srcFile, destFile);
+                }
+            }
+        }
+    }
+
+    public static void copyFile(File source, File destination) throws IOException {
+        File destinationDir = destination.getParentFile();
+        if (!destinationDir.exists() && !destinationDir.mkdirs()) {
+            throw new IOException("Cannot create directory : " + destinationDir);
+        }
+
+        InputStream in = null;
+        OutputStream out = null;
+        try {
+            in = new FileInputStream(source);
+            out = new FileOutputStream(destination);
+            writeAll(in, out);
+        } finally {
+            close(in);
+            close(out);
+        }
+    }
+
+    public static void writeAll(InputStream in, OutputStream out) throws IOException {
+        byte[] buffer = new byte[4096];
+        int count;
+        while ((count = in.read(buffer)) > 0) {
+            out.write(buffer, 0, count);
+        }
+        out.flush();
+    }
+
+    public static boolean recursiveDelete(File root) {
+        if (root == null) {
+            return true;
+        }
+
+        if (root.isDirectory()) {
+            File[] files = root.listFiles();
+            if (files != null) {
+                for (int i = 0; i < files.length; i++) {
+                    File file = files[i];
+                    if (file.isDirectory()) {
+                        recursiveDelete(file);
+                    } else {
+                        file.delete();
+                    }
+                }
+            }
+        }
+        return root.delete();
+    }
+
+    public static void flush(OutputStream thing) {
+        if (thing != null) {
+            try {
+                thing.flush();
+            } catch(Exception ignored) {
+            }
+        }
+    }
+
+    public static void flush(Writer thing) {
+        if (thing != null) {
+            try {
+                thing.flush();
+            } catch(Exception ignored) {
+            }
+        }
+    }
+
+    public static void close(JarFile thing) {
+        if (thing != null) {
+            try {
+                thing.close();
+            } catch(Exception ignored) {
+            }
+        }
+    }
+
+    public static void close(InputStream thing) {
+        if (thing != null) {
+            try {
+                thing.close();
+            } catch(Exception ignored) {
+            }
+        }
+    }
+
+    public static void close(OutputStream thing) {
+        if (thing != null) {
+            try {
+                thing.close();
+            } catch(Exception ignored) {
+            }
+        }
+    }
+
+    public static void close(Reader thing) {
+        if (thing != null) {
+            try {
+                thing.close();
+            } catch(Exception ignored) {
+            }
+        }
+    }
+
+    public static void close(Writer thing) {
+        if (thing != null) {
+            try {
+                thing.close();
+            } catch(Exception ignored) {
+            }
+        }
+    }
+
+    public static Set search(File root, String pattern) throws MalformedURLException {
+        if (root.isDirectory()) {
+            if (!SelectorUtils.hasWildcards(pattern)) {
+                File match = new File(root, pattern);
+                if (match.exists() && match.canRead()) {
+                    return Collections.singleton(match.toURL());
+                } else {
+                    return Collections.EMPTY_SET;
+                }
+            } else {
+                Set matches = new LinkedHashSet();
+                Map files = listAllFileNames(root);
+                for (Iterator iterator = files.entrySet().iterator(); iterator.hasNext();) {
+                    Map.Entry entry = (Map.Entry) iterator.next();
+                    String fileName = (String) entry.getKey();
+                    if (SelectorUtils.matchPath(pattern, fileName)) {
+                        File file = (File) entry.getValue();
+                        matches.add(file.toURL());
+                    }
+                }
+                return matches;
+            }
+        } else {
+            JarFile jarFile = null;
+            try {
+                jarFile = new JarFile(root);
+                URL baseURL = new URL("jar:" + root.toURL().toString() + "!/");
+                if (!SelectorUtils.hasWildcards(pattern)) {
+                    ZipEntry entry = jarFile.getEntry(pattern);
+                    if (entry != null) {
+                        URL match = new URL(baseURL, entry.getName());
+                        return Collections.singleton(match);
+                    } else {
+                        return Collections.EMPTY_SET;
+                    }
+                } else {
+                    Set matches = new LinkedHashSet();
+                    Enumeration entries = jarFile.entries();
+                    while (entries.hasMoreElements()) {
+                        ZipEntry entry = (ZipEntry) entries.nextElement();
+                        String fileName = entry.getName();
+                        if (SelectorUtils.matchPath(pattern, fileName)) {
+                            URL url = new URL(baseURL, fileName);
+                            matches.add(url);
+                        }
+                    }
+                    return matches;
+                }
+            } catch (MalformedURLException e) {
+                throw e;
+            } catch (IOException e) {
+                return Collections.EMPTY_SET;
+            } finally {
+                close(jarFile);
+            }
+        }
+    }
+
+    public static Map listAllFileNames(File base) {
+        return listAllFileNames(base, "");
+    }
+
+    private static Map listAllFileNames(File base, String prefix) {
+        if (!base.canRead() || !base.isDirectory()) {
+            throw new IllegalArgumentException(base.getAbsolutePath());
+        }
+        Map map = new LinkedHashMap();
+        File[] hits = base.listFiles();
+        for (int i = 0; i < hits.length; i++) {
+            File hit = hits[i];
+            if (hit.canRead()) {
+                if (hit.isDirectory()) {
+                    map.putAll(listAllFileNames(hit, prefix.equals("") ? hit.getName() : prefix + "/" + hit.getName()));
+                } else {
+                    map.put(prefix.equals("") ? hit.getName() : prefix + "/" + hit.getName(), hit);
+                }
+            }
+        }
+        map.put(prefix, base);
+        return map;
+    }
+}

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java?rev=394860&r1=394859&r2=394860&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java Mon Apr 17 23:44:17 2006
@@ -17,12 +17,11 @@
 
 package org.apache.geronimo.kernel.config;
 
-import java.io.IOException;
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.Set;
-import java.util.LinkedHashSet;
 
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
@@ -88,24 +87,28 @@
         return new DefaultArtifactResolver(artifactManager, repositories);
     }
 
-    public synchronized void loadConfiguration(Artifact configurationId) throws NoSuchConfigException, IOException, InvalidConfigException {
+    public synchronized LifecycleResults loadConfiguration(Artifact configurationId) throws NoSuchConfigException, LifecycleException {
         // todo hack for bootstrap deploy
-        ConfigurationStatus configurationStatus = (ConfigurationStatus) configurations.get(configurationId);
-        if (configurationStatus == null && kernel.isLoaded(Configuration.getConfigurationAbstractName(configurationId))) {
+        AbstractName abstractName = null;
+        try {
+            abstractName = Configuration.getConfigurationAbstractName(configurationId);
+        } catch (InvalidConfigException e) {
+            throw new RuntimeException(e);
+        }
+        if (getConfiguration(configurationId) == null && kernel.isLoaded(abstractName)) {
             try {
-                Configuration configuration = (Configuration) kernel.getGBean(Configuration.getConfigurationAbstractName(configurationId));
-                configurationStatus = createConfigurationStatus(configuration);
-                configurationStatus.load();
-                //even worse hack
-                configurationStatus.start();
-                configurations.put(configurationId, configurationStatus);
-                return;
+                Configuration configuration = (Configuration) kernel.getGBean(abstractName);
+                addNewConfigurationToModel(configuration);
+                configurationModel.load(configurationId);
+                configurationModel.start(configurationId);
+                configurations.put(configurationId, configuration);
+                return new LifecycleResults();
             } catch (GBeanNotFoundException e) {
                 // configuration was unloaded, just continue as normal
             }
         }
 
-        super.loadConfiguration(configurationId);
+        return super.loadConfiguration(configurationId);
     }
 
     protected Configuration load(ConfigurationData configurationData, LinkedHashSet resolvedParentIds, Map loadedConfigurations) throws InvalidConfigException {

Added: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/LifecycleException.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/LifecycleException.java?rev=394860&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/LifecycleException.java (added)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/LifecycleException.java Mon Apr 17 23:44:17 2006
@@ -0,0 +1,51 @@
+/**
+ *
+ * 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 org.apache.geronimo.kernel.repository.Artifact;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class LifecycleException extends Exception {
+    private final String command;
+    private final Artifact configurationId;
+    private final LifecycleResults lifecycleResults;
+
+    public LifecycleException(String command, Artifact configurationId, LifecycleResults lifecycleResults) {
+        this(command, configurationId, lifecycleResults, lifecycleResults.getFailedCause(configurationId));
+    }
+    
+    public LifecycleException(String command, Artifact configurationId, LifecycleResults lifecycleResults, Throwable cause) {
+        super(command + " of " + configurationId + " failed", cause);
+        this.command = command;
+        this.configurationId = configurationId;
+        this.lifecycleResults = lifecycleResults;
+    }
+
+    public String getCommand() {
+        return command;
+    }
+
+    public Artifact getConfigurationId() {
+        return configurationId;
+    }
+
+    public LifecycleResults getCommandResults() {
+        return lifecycleResults;
+    }
+}



Mime
View raw message