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

svn commit: r399130 - in /geronimo/branches/1.1/modules: axis-builder/src/test/org/apache/geronimo/axis/builder/ connector-builder/src/test/org/apache/geronimo/connector/deployment/ deployment/src/java/org/apache/geronimo/deployment/ deployment/src/tes...

Author: dain
Date: Tue May  2 21:35:17 2006
New Revision: 399130

URL: http://svn.apache.org/viewcvs?rev=399130&view=rev
Log:
Fixed GERONIMO-1931 Deployers and the deploying classes are in separate class loader hierarchies
Created a new DeploymentConfigurationManager which delegates to the main KernelConfigurationManager for already loaded configurations, but still loads new configurations into a private space for the deployment.

Added:
    geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentConfigurationManager.java
Modified:
    geronimo/branches/1.1/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java
    geronimo/branches/1.1/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
    geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java
    geronimo/branches/1.1/modules/deployment/src/test/org/apache/geronimo/deployment/DeploymentContextTest.java
    geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
    geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARContext.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/kernel/config/SimpleConfigurationManager.java
    geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
    geronimo/branches/1.1/modules/service-builder/src/test/org/apache/geronimo/deployment/service/ServiceConfigBuilderTest.java
    geronimo/branches/1.1/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java

Modified: geronimo/branches/1.1/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java?rev=399130&r1=399129&r2=399130&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java (original)
+++ geronimo/branches/1.1/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java Tue May  2 21:35:17 2006
@@ -67,6 +67,8 @@
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.Jsr77Naming;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
+import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.SimpleConfigurationManager;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.kernel.repository.ArtifactManager;
@@ -109,7 +111,8 @@
         Jsr77Naming naming = new Jsr77Naming();
         ArtifactManager artifactManager = new DefaultArtifactManager();
         ArtifactResolver artifactResolver = new DefaultArtifactResolver(artifactManager, Collections.EMPTY_SET, null);
-        context = new DeploymentContext(tmpbasedir, null, environment, ConfigurationModuleType.CAR, naming, Collections.EMPTY_SET, Collections.EMPTY_SET, artifactResolver);
+        ConfigurationManager configurationManager = new SimpleConfigurationManager(Collections.EMPTY_SET, artifactResolver, Collections.EMPTY_SET);        
+        context = new DeploymentContext(tmpbasedir, null, environment, ConfigurationModuleType.CAR, naming, configurationManager, Collections.EMPTY_SET);
 
         File moduleLocation = new File(tmpbasedir, "ejb");
         moduleLocation.mkdirs();

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=399130&r1=399129&r2=399130&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 Tue May  2 21:35:17 2006
@@ -359,9 +359,8 @@
                         module.getEnvironment(),
                         module.getType(),
                         naming,
+                        configurationManager,
                         Collections.EMPTY_SET,
-                        Collections.singleton(configurationStore),
-                        artifactResolver,
                         new AbstractNameQuery(serverName, J2EEServerImpl.GBEAN_INFO.getInterfaces()),
                         module.getModuleName(), //hardcode standalone here.
                         transactionContextManagerName,

Added: geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentConfigurationManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentConfigurationManager.java?rev=399130&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentConfigurationManager.java (added)
+++ geronimo/branches/1.1/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentConfigurationManager.java Tue May  2 21:35:17 2006
@@ -0,0 +1,253 @@
+/**
+ *
+ * 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.deployment;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Iterator;
+import java.util.Collections;
+import java.util.Arrays;
+import java.io.IOException;
+
+import org.apache.geronimo.kernel.config.SimpleConfigurationManager;
+import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.ConfigurationStore;
+import org.apache.geronimo.kernel.config.NoSuchStoreException;
+import org.apache.geronimo.kernel.config.Configuration;
+import org.apache.geronimo.kernel.config.LifecycleResults;
+import org.apache.geronimo.kernel.config.NoSuchConfigException;
+import org.apache.geronimo.kernel.config.LifecycleException;
+import org.apache.geronimo.kernel.config.LifecycleMonitor;
+import org.apache.geronimo.kernel.config.ConfigurationData;
+import org.apache.geronimo.kernel.config.InvalidConfigException;
+import org.apache.geronimo.kernel.repository.ArtifactResolver;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.Version;
+import org.apache.geronimo.gbean.AbstractName;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DeploymentConfigurationManager extends SimpleConfigurationManager {
+    private final ConfigurationManager configurationManager;
+
+    public DeploymentConfigurationManager(ConfigurationManager configurationManager, Collection repositories) {
+        super(Arrays.asList(configurationManager.getStores()), configurationManager.getArtifactResolver(), repositories);
+        this.configurationManager = configurationManager;
+    }
+
+    //
+    // GENERAL DATA
+    //
+
+    public synchronized boolean isInstalled(Artifact configId) {
+        return super.isInstalled(configId);
+    }
+
+    public synchronized boolean isLoaded(Artifact configId) {
+        return configurationManager.isLoaded(configId) || super.isLoaded(configId);
+    }
+
+    public synchronized boolean isRunning(Artifact configId) {
+        return configurationManager.isRunning(configId) || super.isRunning(configId);
+    }
+
+    public boolean isConfiguration(Artifact artifact) {
+        return configurationManager.isConfiguration(artifact) || super.isConfiguration(artifact);
+    }
+
+    public synchronized Configuration getConfiguration(Artifact configurationId) {
+        Configuration configuration = configurationManager.getConfiguration(configurationId);
+        if (configuration == null) {
+            configuration = super.getConfiguration(configurationId);
+        }
+        return configuration;
+    }
+
+    public ArtifactResolver getArtifactResolver() {
+        return super.getArtifactResolver();
+    }
+
+
+    //
+    // LOAD
+    //
+
+    public synchronized LifecycleResults loadConfiguration(Artifact configurationId) throws NoSuchConfigException, LifecycleException {
+        return super.loadConfiguration(configurationId);
+    }
+
+    public synchronized LifecycleResults loadConfiguration(Artifact configurationId, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException {
+        return super.loadConfiguration(configurationId, monitor);
+    }
+
+    public synchronized LifecycleResults loadConfiguration(ConfigurationData configurationData) throws NoSuchConfigException, LifecycleException {
+        return super.loadConfiguration(configurationData);
+    }
+
+    public synchronized LifecycleResults loadConfiguration(ConfigurationData configurationData, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException {
+        return super.loadConfiguration(configurationData, monitor);
+    }
+
+    protected Configuration load(ConfigurationData configurationData, LinkedHashSet resolvedParentIds, Map loadedConfigurations) throws InvalidConfigException {
+        return super.load(configurationData, resolvedParentIds, loadedConfigurations);
+    }
+
+    protected void load(Artifact configurationId) throws NoSuchConfigException {
+        if (configurationModel.containsConfiguration(configurationId)) {
+            super.load(configurationId);
+        }
+    }
+
+    protected void addNewConfigurationToModel(Configuration configuration) throws NoSuchConfigException {
+        LinkedHashSet loadParents = getLoadParents(configuration);
+        for (Iterator iterator = loadParents.iterator(); iterator.hasNext();) {
+            Configuration loadParent= (Configuration) iterator.next();
+            if (!configurationModel.containsConfiguration(loadParent.getId())) {
+                configurationModel.addConfiguation(loadParent.getId(), Collections.EMPTY_SET, Collections.EMPTY_SET);
+                configurationModel.load(loadParent.getId());
+            }
+        }
+        LinkedHashSet startParents = getStartParents(configuration);
+        for (Iterator iterator = startParents.iterator(); iterator.hasNext();) {
+            Configuration startParent = (Configuration) iterator.next();
+            if (!configurationModel.containsConfiguration(startParent.getId())) {
+                configurationModel.addConfiguation(startParent.getId(), Collections.EMPTY_SET, Collections.EMPTY_SET);
+                configurationModel.load(startParent.getId());
+            }
+        }
+        super.addNewConfigurationToModel(configuration);
+    }
+
+    //
+    // UNLOAD
+    //
+
+    public synchronized LifecycleResults unloadConfiguration(Artifact id) throws NoSuchConfigException {
+        return super.unloadConfiguration(id);
+    }
+
+    public synchronized LifecycleResults unloadConfiguration(Artifact id, LifecycleMonitor monitor) throws NoSuchConfigException {
+        return super.unloadConfiguration(id, monitor);
+    }
+
+    protected void unload(Configuration configuration) {
+        super.unload(configuration);
+    }
+
+    //
+    // STOP.. used by unload
+    //
+    protected void stop(Configuration configuration) {
+        super.stop(configuration);
+    }
+
+
+    //
+    // UNSUPPORTED
+    //
+
+    public Artifact[] getInstalled(Artifact query) {
+        throw new UnsupportedOperationException();
+    }
+
+    public Artifact[] getLoaded(Artifact query) {
+        throw new UnsupportedOperationException();
+    }
+
+    public Artifact[] getRunning(Artifact query) {
+        throw new UnsupportedOperationException();
+    }
+
+    public List listStores() {
+        throw new UnsupportedOperationException();
+    }
+
+    public ConfigurationStore[] getStores() {
+        throw new UnsupportedOperationException();
+    }
+
+    public List listConfigurations() {
+        throw new UnsupportedOperationException();
+    }
+
+    public ConfigurationStore getStoreForConfiguration(Artifact configId) {
+        throw new UnsupportedOperationException();
+    }
+
+    public List listConfigurations(AbstractName storeName) throws NoSuchStoreException {
+        throw new UnsupportedOperationException();
+    }
+
+    public synchronized LifecycleResults startConfiguration(Artifact id) throws NoSuchConfigException, LifecycleException {
+        throw new UnsupportedOperationException();
+    }
+
+    public synchronized LifecycleResults startConfiguration(Artifact id, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException {
+        throw new UnsupportedOperationException();
+    }
+
+    protected void start(Configuration configuration) throws Exception {
+        throw new UnsupportedOperationException();
+    }
+
+    public synchronized LifecycleResults stopConfiguration(Artifact id) throws NoSuchConfigException {
+        throw new UnsupportedOperationException();
+    }
+
+    public synchronized LifecycleResults stopConfiguration(Artifact id, LifecycleMonitor monitor) throws NoSuchConfigException {
+        throw new UnsupportedOperationException();
+    }
+
+    public synchronized LifecycleResults restartConfiguration(Artifact id) throws NoSuchConfigException, LifecycleException {
+        throw new UnsupportedOperationException();
+    }
+
+    public synchronized LifecycleResults restartConfiguration(Artifact id, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException {
+        throw new UnsupportedOperationException();
+    }
+
+    public synchronized LifecycleResults reloadConfiguration(Artifact id) throws NoSuchConfigException, LifecycleException {
+        throw new UnsupportedOperationException();
+    }
+
+    public synchronized LifecycleResults reloadConfiguration(Artifact id, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException {
+        throw new UnsupportedOperationException();
+    }
+
+    public synchronized LifecycleResults reloadConfiguration(Artifact id, Version version) throws NoSuchConfigException, LifecycleException {
+        throw new UnsupportedOperationException();
+    }
+
+    public synchronized LifecycleResults reloadConfiguration(Artifact id, Version version, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException {
+        throw new UnsupportedOperationException();
+    }
+
+    public LifecycleResults reloadConfiguration(ConfigurationData configurationData) throws LifecycleException, NoSuchConfigException {
+        throw new UnsupportedOperationException();
+    }
+
+    public LifecycleResults reloadConfiguration(ConfigurationData configurationData, LifecycleMonitor monitor) throws LifecycleException, NoSuchConfigException {
+        throw new UnsupportedOperationException();
+    }
+
+    public synchronized void uninstallConfiguration(Artifact configurationId) throws IOException, NoSuchConfigException {
+        throw new UnsupportedOperationException();
+    }
+}

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=399130&r1=399129&r2=399130&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 Tue May  2 21:35:17 2006
@@ -56,12 +56,8 @@
 import org.apache.geronimo.kernel.config.ConfigurationManager;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.config.NoSuchConfigException;
-import org.apache.geronimo.kernel.config.SimpleConfigurationManager;
 import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.kernel.repository.ArtifactManager;
 import org.apache.geronimo.kernel.repository.ArtifactResolver;
-import org.apache.geronimo.kernel.repository.DefaultArtifactManager;
-import org.apache.geronimo.kernel.repository.DefaultArtifactResolver;
 import org.apache.geronimo.kernel.repository.Environment;
 
 /**
@@ -78,8 +74,8 @@
     private final Naming naming;
     private final List additionalDeployment = new ArrayList();
 
-    public DeploymentContext(File baseDir, File inPlaceConfigurationDir, Environment environment, ConfigurationModuleType moduleType, Naming naming, Collection repositories, Collection stores, ArtifactResolver artifactResolver) throws DeploymentException {
-        this(baseDir, inPlaceConfigurationDir, environment,  moduleType, naming, createConfigurationManager(repositories, stores, artifactResolver));
+    public DeploymentContext(File baseDir, File inPlaceConfigurationDir, Environment environment, ConfigurationModuleType moduleType, Naming naming, ConfigurationManager configurationManager, Collection repositories) throws DeploymentException {
+        this(baseDir, inPlaceConfigurationDir, environment,  moduleType, naming, createConfigurationManager(configurationManager, repositories));
     }
 
     public DeploymentContext(File baseDir, File inPlaceConfigurationDir, Environment environment, ConfigurationModuleType moduleType, Naming naming, ConfigurationManager configurationManager) throws DeploymentException {
@@ -108,10 +104,8 @@
         }
     }
 
-    private static ConfigurationManager createConfigurationManager(Collection repositories, Collection stores, ArtifactResolver artifactResolver) {
-//        ArtifactManager artifactManager = new DefaultArtifactManager();
-//        ArtifactResolver artifactResolver = new DefaultArtifactResolver(artifactManager, repositories, null);
-        return new SimpleConfigurationManager(stores, artifactResolver, repositories);
+    private static ConfigurationManager createConfigurationManager(ConfigurationManager configurationManager, Collection repositories) {
+        return new DeploymentConfigurationManager(configurationManager, repositories);
     }
 
     private static Configuration createTempConfiguration(Environment environment, ConfigurationModuleType moduleType, File baseDir, File inPlaceConfigurationDir, ConfigurationManager configurationManager, Naming naming) throws DeploymentException {

Modified: geronimo/branches/1.1/modules/deployment/src/test/org/apache/geronimo/deployment/DeploymentContextTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deployment/src/test/org/apache/geronimo/deployment/DeploymentContextTest.java?rev=399130&r1=399129&r2=399130&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/deployment/src/test/org/apache/geronimo/deployment/DeploymentContextTest.java (original)
+++ geronimo/branches/1.1/modules/deployment/src/test/org/apache/geronimo/deployment/DeploymentContextTest.java Tue May  2 21:35:17 2006
@@ -30,6 +30,7 @@
 import net.sf.cglib.proxy.MethodInterceptor;
 import org.apache.geronimo.kernel.Jsr77Naming;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
+import org.apache.geronimo.kernel.config.SimpleConfigurationManager;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.kernel.repository.ArtifactManager;
@@ -54,7 +55,8 @@
             environment.setConfigId(configId);
             ArtifactManager artifactManager = new DefaultArtifactManager();
             ArtifactResolver artifactResolver = new DefaultArtifactResolver(artifactManager, Collections.EMPTY_SET, null);
-            DeploymentContext context = new DeploymentContext(basedir, null, environment, ConfigurationModuleType.CAR, new Jsr77Naming(), Collections.EMPTY_SET, Collections.EMPTY_SET, artifactResolver);
+            SimpleConfigurationManager configurationManager = new SimpleConfigurationManager(Collections.EMPTY_SET, artifactResolver, Collections.EMPTY_SET);
+            DeploymentContext context = new DeploymentContext(basedir, null, environment, ConfigurationModuleType.CAR, new Jsr77Naming(), configurationManager, Collections.EMPTY_SET);
             Enhancer enhancer = new Enhancer();
             enhancer.setInterfaces(new Class[]{DataSource.class});
             enhancer.setCallbackType(MethodInterceptor.class);

Modified: geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java?rev=399130&r1=399129&r2=399130&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java (original)
+++ geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java Tue May  2 21:35:17 2006
@@ -63,6 +63,9 @@
 import org.apache.geronimo.kernel.config.ConfigurationAlreadyExistsException;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
+import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.SimpleConfigurationManager;
+import org.apache.geronimo.kernel.config.ConfigurationUtil;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.ArtifactResolver;
 import org.apache.geronimo.kernel.repository.Environment;
@@ -88,6 +91,7 @@
 
     private final static QName APPLICATION_QNAME = GerApplicationDocument.type.getDocumentElementName();
 
+    private final ConfigurationManager configurationManager;
     private final Collection repositories;
     private final SingleElementCollection ejbConfigBuilder;
     private final SingleElementCollection webConfigBuilder;
@@ -130,6 +134,7 @@
                 nonTransactionalTimerAbstractName,
                 corbaGBeanAbstractName,
                 serverName,
+                ConfigurationUtil.getConfigurationManager(kernel),
                 repositories,
                 new SingleElementCollection(ejbConfigBuilder),
                 new SingleElementCollection(ejbReferenceBuilder),
@@ -163,6 +168,7 @@
                 nonTransactionalTimerAbstractName,
                 corbaGBeanAbstractName,
                 serverName,
+                null,
                 repositories,
                 new SingleElementCollection(ejbConfigBuilder),
                 new SingleElementCollection(ejbReferenceBuilder),
@@ -181,6 +187,7 @@
             AbstractNameQuery nonTransactionalTimerAbstractName,
             AbstractNameQuery corbaGBeanAbstractName,
             AbstractNameQuery serverName,
+            ConfigurationManager configurationManager,
             Collection repositories,
             SingleElementCollection ejbConfigBuilder,
             SingleElementCollection ejbReferenceBuilder,
@@ -190,6 +197,7 @@
             SingleElementCollection appClientConfigBuilder,
             SingleElementCollection serviceReferenceBuilder,
             Naming naming) {
+        this.configurationManager = configurationManager;
         this.repositories = repositories;
         this.defaultEnvironment = defaultEnvironment;
 
@@ -421,6 +429,10 @@
             throw new DeploymentException(e);
         }
 
+        ConfigurationManager configurationManager = this.configurationManager;
+        if (configurationManager == null) {
+            configurationManager = new SimpleConfigurationManager(configurationStores, artifactResolver, repositories);
+        }
         try {
             // Create the output ear context
             earContext = new EARContext(configurationDir,
@@ -428,9 +440,8 @@
                     applicationInfo.getEnvironment(),
                     applicationType,
                     naming,
+                    configurationManager,
                     repositories,
-                    configurationStores,
-                    artifactResolver,
                     serverName,
                     applicationInfo.getBaseName(),
                     transactionContextManagerObjectName,

Modified: geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARContext.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARContext.java?rev=399130&r1=399129&r2=399130&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARContext.java (original)
+++ geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARContext.java Tue May  2 21:35:17 2006
@@ -58,9 +58,8 @@
             Environment environment,
             ConfigurationModuleType moduleType,
             Naming naming,
-            Collection repositories,
-            Collection configurationStores,
-            ArtifactResolver artifactResolver, AbstractNameQuery serverName,
+            ConfigurationManager configurationManager, Collection repositories,
+            AbstractNameQuery serverName,
             AbstractName baseName,
             AbstractNameQuery transactionContextManagerObjectName,
             AbstractNameQuery connectionTrackerObjectName,
@@ -68,7 +67,7 @@
             AbstractNameQuery nonTransactedTimerName,
             AbstractNameQuery corbaGBeanObjectName,
             RefContext refContext) throws DeploymentException {
-        super(baseDir, inPlaceConfigurationDir, environment, moduleType, naming, repositories, configurationStores, artifactResolver);
+        super(baseDir, inPlaceConfigurationDir, environment, moduleType, naming, configurationManager, repositories);
         
         moduleName = baseName;
         this.serverName = serverName;
@@ -80,6 +79,7 @@
         this.corbaGBeanObjectName = corbaGBeanObjectName;
         this.refContext = refContext;
     }
+
     public EARContext(File baseDir,
             File inPlaceConfigurationDir,
             Environment environment,

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=399130&r1=399129&r2=399130&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 Tue May  2 21:35:17 2006
@@ -149,9 +149,8 @@
                 environment,
                 ConfigurationModuleType.WAR,
                 naming,
+                configurationManager,
                 repositories,
-                Collections.singleton(configStore),
-                artifactResolver,
                 new AbstractNameQuery(serverName),
                 moduleName,
                 new AbstractNameQuery(tcmName),

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=399130&r1=399129&r2=399130&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 Tue May  2 21:35:17 2006
@@ -128,6 +128,9 @@
         return (ConfigurationStore[]) storeSnapshot.toArray(new ConfigurationStore[storeSnapshot.size()]);
     }
 
+    public Collection getRepositories() {
+        return repositories;
+    }
 
     public List listConfigurations() {
         List storeSnapshot = getStoreList();
@@ -229,9 +232,9 @@
         if(!configurationId.isResolved()) {
             throw new IllegalArgumentException("Artifact "+configurationId+" is not fully resolved");
         }
-        if (configurationModel.isLoaded(configurationId)) {
+        if (isLoaded(configurationId)) {
             // already loaded, so just mark the configuration as user loaded
-            configurationModel.load(configurationId);
+            load(configurationId);
 
             monitor.finished();
             return new LifecycleResults();
@@ -259,7 +262,7 @@
     public synchronized LifecycleResults loadConfiguration(ConfigurationData configurationData, LifecycleMonitor monitor) throws NoSuchConfigException, LifecycleException {
         Artifact id = configurationData.getId();
         LifecycleResults results = new LifecycleResults();
-        if (!configurationModel.isLoaded(id)) {
+        if (!isLoaded(id)) {
             // recursively load configurations from the new child to the parents
             LinkedHashMap configurationsToLoad = new LinkedHashMap();
             try {
@@ -301,11 +304,15 @@
             addNewConfigurationsToModel(actuallyLoaded);
             results.setLoaded(actuallyLoaded.keySet());
         }
-        configurationModel.load(id);
+        load(id);
         monitor.finished();
         return results;
     }
 
+    protected void load(Artifact configurationId) throws NoSuchConfigException {
+        configurationModel.load(configurationId);
+    }
+
     protected Configuration load(ConfigurationData configurationData, LinkedHashSet resolvedParentIds, Map loadedConfigurations) throws InvalidConfigException {
         Artifact configurationId = configurationData.getId();
         try {
@@ -327,7 +334,7 @@
             Configuration parent = null;
             if (loadedConfigurations.containsKey(resolvedArtifact)) {
                 parent = (Configuration) loadedConfigurations.get(resolvedArtifact);
-            } else if (configurations.containsKey(resolvedArtifact)) {
+            } else if (isLoaded(resolvedArtifact)) {
                 parent = getConfiguration(resolvedArtifact);
             } else {
                 throw new InvalidConfigException("Cound not find parent configuration: " + resolvedArtifact);
@@ -352,7 +359,7 @@
         configurations.put(configuration.getId(), configuration);
     }
 
-    private LinkedHashSet getLoadParents(Configuration configuration) {
+    protected LinkedHashSet getLoadParents(Configuration configuration) {
         LinkedHashSet loadParent = new LinkedHashSet(configuration.getClassParents());
         for (Iterator iterator = configuration.getChildren().iterator(); iterator.hasNext();) {
             Configuration childConfiguration = (Configuration) iterator.next();
@@ -366,7 +373,7 @@
         return loadParent;
     }
 
-    private LinkedHashSet getStartParents(Configuration configuration) {
+    protected LinkedHashSet getStartParents(Configuration configuration) {
         LinkedHashSet startParent = new LinkedHashSet(configuration.getServiceParents());
         for (Iterator iterator = configuration.getChildren().iterator(); iterator.hasNext();) {
             Configuration childConfiguration = (Configuration) iterator.next();
@@ -398,7 +405,7 @@
             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)) {
+                if (!isLoaded(parentId) && isConfiguration(parentId)) {
                     ConfigurationData parentConfigurationData = loadConfigurationData(parentId, monitor);
                     loadDepthFirst(parentConfigurationData, configurationsToLoad, monitor);
                 }
@@ -671,13 +678,17 @@
             results.addUnloaded(configurationId);
 
             // clean up the model
-            configurationModel.removeConfiguration(configurationId);
-            configurations.remove(configurationId);
+            removeConfigurationFromModel(configurationId);
         }
         monitor.finished();
         return results;
     }
 
+    protected void removeConfigurationFromModel(Artifact configurationId) throws NoSuchConfigException {
+        configurationModel.removeConfiguration(configurationId);
+        configurations.remove(configurationId);
+    }
+
     protected void unload(Configuration configuration) {
         try {
             configuration.doStop();
@@ -1018,8 +1029,7 @@
                     for (Iterator iterator = results.getUnloaded().iterator(); iterator.hasNext();) {
                         Artifact childId = (Artifact) iterator.next();
                         configurationModel.unload(childId);
-                        configurationModel.removeConfiguration(childId);
-                        configurations.remove(childId);
+                        removeConfigurationFromModel(childId);
                     }
 
                     throw new LifecycleException("reload", newConfigurationId, results);
@@ -1072,8 +1082,7 @@
 
                     configurations.put(configurationId, configuration);
                 } else {
-                    configurationModel.removeConfiguration(configurationId);
-                    configurations.remove(configurationId);
+                    removeConfigurationFromModel(configurationId);
                 }
             } catch (Exception e) {
                 // the configuraiton failed to restart

Modified: geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java?rev=399130&r1=399129&r2=399130&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java (original)
+++ geronimo/branches/1.1/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java Tue May  2 21:35:17 2006
@@ -59,6 +59,9 @@
 import org.apache.geronimo.kernel.config.ConfigurationAlreadyExistsException;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
+import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.ConfigurationUtil;
+import org.apache.geronimo.kernel.config.SimpleConfigurationManager;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.kernel.repository.Repository;
@@ -81,18 +84,23 @@
     private Map refRefMap;
     private static final QName SERVICE_QNAME = ConfigurationDocument.type.getDocumentElementName();
     private final Naming naming;
-
+    private final ConfigurationManager configurationManager;
 
     public ServiceConfigBuilder(Environment defaultEnvironment, Collection repositories, Naming naming) {
-        this(defaultEnvironment, repositories, null, null, naming);
+        this(defaultEnvironment, repositories, null, null, naming, null);
     }
 
     public ServiceConfigBuilder(Environment defaultEnvironment, Collection repositories, Collection xmlAttributeBuilders, Collection xmlReferenceBuilders, Kernel kernel) {
-        this(defaultEnvironment, repositories, xmlAttributeBuilders, xmlReferenceBuilders, kernel.getNaming());
+        this(defaultEnvironment, repositories, xmlAttributeBuilders, xmlReferenceBuilders, kernel.getNaming(), ConfigurationUtil.getConfigurationManager(kernel));
     }
 
     public ServiceConfigBuilder(Environment defaultEnvironment, Collection repositories, Collection xmlAttributeBuilders, Collection xmlReferenceBuilders, Naming naming) {
+        this(defaultEnvironment, repositories, xmlAttributeBuilders, xmlReferenceBuilders, naming, null);
+    }
+    private ServiceConfigBuilder(Environment defaultEnvironment, Collection repositories, Collection xmlAttributeBuilders, Collection xmlReferenceBuilders, Naming naming, ConfigurationManager configurationManager) {
         this.naming = naming;
+        this.configurationManager = configurationManager;
+
         EnvironmentBuilder environmentBuilder = new EnvironmentBuilder();
         xmlAttributeBuilderMap.put(environmentBuilder.getNamespace(), environmentBuilder);
         //cf registering EnvironmentBuilder as a property editor in the static gbeaninfo block.
@@ -220,14 +228,18 @@
             throw new DeploymentException(e);
         }
 
-        DeploymentContext context = new DeploymentContext(outfile, 
+        ConfigurationManager configurationManager = this.configurationManager;
+        if (configurationManager == null) {
+            configurationManager = new SimpleConfigurationManager(configurationStores, artifactResolver, repositories);
+        }
+        DeploymentContext context = new DeploymentContext(outfile,
                 inPlaceDeployment && null != jar ? DeploymentUtil.toFile(jar) : null,
                 environment, 
                 ConfigurationModuleType.SERVICE, 
-                naming, 
-                repositories, 
-                configurationStores,
-                artifactResolver);
+                naming,
+                configurationManager,
+                repositories
+        );
         if(jar != null) {
             File file = new File(jar.getName());
             context.addIncludeAsPackedJar(URI.create(file.getName()), jar);

Modified: geronimo/branches/1.1/modules/service-builder/src/test/org/apache/geronimo/deployment/service/ServiceConfigBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/service-builder/src/test/org/apache/geronimo/deployment/service/ServiceConfigBuilderTest.java?rev=399130&r1=399129&r2=399130&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/service-builder/src/test/org/apache/geronimo/deployment/service/ServiceConfigBuilderTest.java (original)
+++ geronimo/branches/1.1/modules/service-builder/src/test/org/apache/geronimo/deployment/service/ServiceConfigBuilderTest.java Tue May  2 21:35:17 2006
@@ -28,6 +28,8 @@
 import org.apache.geronimo.gbean.ReferenceCollection;
 import org.apache.geronimo.gbean.ReferenceCollectionListener;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
+import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.SimpleConfigurationManager;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.ListableRepository;
@@ -61,7 +63,7 @@
         File file = new File(url.getPath());
         JarFile jar = new JarFile(file);
         assertTrue(file.exists());
-        ServiceConfigBuilder builder = new ServiceConfigBuilder(parentEnvironment, null, null, null, new Jsr77Naming());
+        ServiceConfigBuilder builder = new ServiceConfigBuilder(parentEnvironment, null, new Jsr77Naming());
         assertNull(builder.getDeploymentPlan(null, jar, new ModuleIDBuilder()));
         jar.close();
     }
@@ -88,7 +90,8 @@
             MockRepository mockRepository = new MockRepository();
             ArtifactManager artifactManager = new DefaultArtifactManager();
             ArtifactResolver artifactResolver = new DefaultArtifactResolver(artifactManager, Collections.singleton(mockRepository), null);
-            DeploymentContext context = new DeploymentContext(outFile, null, environment, ConfigurationModuleType.CAR, naming, Collections.singleton(mockRepository), Collections.EMPTY_SET, artifactResolver);
+            ConfigurationManager configurationManager = new SimpleConfigurationManager(Collections.EMPTY_SET, artifactResolver, Collections.EMPTY_SET);
+            DeploymentContext context = new DeploymentContext(outFile, null, environment, ConfigurationModuleType.CAR, naming, configurationManager, Collections.singleton(mockRepository));
             AbstractName j2eeContext = naming.createRootName(environment.getConfigId(), environment.getConfigId().toString(), "Configuration");
 
             GbeanType[] gbeans = plan.getGbeanArray();

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=399130&r1=399129&r2=399130&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 Tue May  2 21:35:17 2006
@@ -178,9 +178,8 @@
                 environment,
                 ConfigurationModuleType.WAR,
                 naming,
+                configurationManager,
                 repositories,
-                Collections.singleton(configStore),
-                artifactResolver,
                 new AbstractNameQuery(serverName),
                 moduleName,
                 new AbstractNameQuery(tcmName),