geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r390312 [1/2] - in /geronimo/branches/1.1: modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ modules/deploy-tool/src/java/org/apache/geronimo/deployment/ modules/deployment/src/java/org/apache/geronimo/deployment/...
Date Fri, 31 Mar 2006 03:48:28 GMT
Author: dain
Date: Thu Mar 30 19:48:25 2006
New Revision: 390312

URL: http://svn.apache.org/viewcvs?rev=390312&view=rev
Log:
Configurations now only use ConfigurationData for construction, and configuration stores produce ConfigurationData insted of GBeanData.
The serialized format of a configuration is now simply a serialized ConfigurationData.

Modified:
    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/DeploymentContext.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/GBeanData.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/ConfigurationData.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/ConfigurationModuleType.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/SimpleConfigurationManager.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/naming-builder/src/test/org/apache/geronimo/naming/deployment/MessageDestinationTest.java
    geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ConfigurationDump.java
    geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/ExecutableConfigurationUtil.java
    geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java
    geronimo/branches/1.1/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java
    geronimo/branches/1.1/plugins/geronimo-assembly-plugin/src/java/org/apache/geronimo/plugin/assembly/BaseConfigInstaller.java
    geronimo/branches/1.1/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java

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=390312&r1=390311&r2=390312&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 Thu Mar 30 19:48:25 2006
@@ -17,6 +17,26 @@
 
 package org.apache.geronimo.connector.deployment;
 
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.sql.Connection;
+import java.sql.Statement;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.jar.JarFile;
+import javax.naming.Reference;
+import javax.sql.DataSource;
+import javax.xml.namespace.QName;
+
 import junit.framework.TestCase;
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.DeploymentContext;
@@ -48,40 +68,16 @@
 import org.apache.geronimo.kernel.config.EditableKernelConfigurationManager;
 import org.apache.geronimo.kernel.config.InvalidConfigException;
 import org.apache.geronimo.kernel.config.NoSuchConfigException;
-import org.apache.geronimo.kernel.config.ConfigurationResolver;
-import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.management.State;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.DefaultArtifactManager;
 import org.apache.geronimo.kernel.repository.DefaultArtifactResolver;
 import org.apache.geronimo.kernel.repository.Environment;
-import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.kernel.repository.ImportType;
+import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.system.serverinfo.BasicServerInfo;
 import org.tranql.sql.jdbc.JDBCUtil;
 
-import javax.naming.Reference;
-import javax.sql.DataSource;
-import javax.xml.namespace.QName;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.sql.Connection;
-import java.sql.Statement;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.HashMap;
-import java.util.jar.JarFile;
-
 /**
  * @version $Rev:385232 $ $Date$
  */
@@ -569,28 +565,16 @@
             configs.remove(configID);
         }
 
-        public GBeanData loadConfiguration(Artifact configId) throws NoSuchConfigException, IOException, InvalidConfigException {
-            AbstractName configurationObjectName = Configuration.getConfigurationAbstractName(configId);
-            GBeanData configData = new GBeanData(configurationObjectName, Configuration.GBEAN_INFO);
+        public ConfigurationData loadConfiguration(Artifact configId) throws NoSuchConfigException, IOException, InvalidConfigException {
             if (configs.containsKey(configId)) {
                 ConfigurationData configurationData = (ConfigurationData) configs.get(configId);
-                configData.setAttribute("moduleType", configurationData.getModuleType());
-                Environment environment = configurationData.getEnvironment();
-                configData.setAttribute("environment", environment);
-                configData.setAttribute("gBeanState", Configuration.storeGBeans(configurationData.getGBeans()));
-                configData.setAttribute("classPath", configurationData.getClassPath());
-
-                ConfigurationResolver configurationResolver = new ConfigurationResolver(configurationData.getEnvironment().getConfigId(), this, Collections.EMPTY_SET, new DefaultArtifactResolver(null, Collections.EMPTY_SET));
-                configData.setAttribute("configurationResolver", configurationResolver);
-
+                configurationData.setConfigurationStore(this);
+                return configurationData;
             } else {
-                Environment environment = new Environment();
-                environment.setConfigId(configId);
-                configData.setAttribute("environment", environment);
-                configData.setAttribute("moduleType", ConfigurationModuleType.WAR);
-                configData.setAttribute("gBeanState", NO_OBJECTS_OS);
+                ConfigurationData configurationData = new ConfigurationData(configId, naming);
+                configurationData.setConfigurationStore(this);
+                return configurationData;
             }
-            return configData;
         }
 
         public boolean containsConfiguration(Artifact configID) {
@@ -619,21 +603,10 @@
 
         public final static GBeanInfo GBEAN_INFO;
 
-        private static final byte[] NO_OBJECTS_OS;
-
         static {
             GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(MockConfigStore.class, NameFactory.CONFIGURATION_STORE);
             infoBuilder.addInterface(ConfigurationStore.class);
             GBEAN_INFO = infoBuilder.getBeanInfo();
-
-            ByteArrayOutputStream baos = new ByteArrayOutputStream();
-            try {
-                ObjectOutputStream oos = new ObjectOutputStream(baos);
-                oos.flush();
-                NO_OBJECTS_OS = baos.toByteArray();
-            } catch (IOException e) {
-                throw new RuntimeException(e);
-            }
         }
     }
 }

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=390312&r1=390311&r2=390312&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 Thu Mar 30 19:48:25 2006
@@ -20,18 +20,17 @@
 import java.io.FileOutputStream;
 import java.net.URI;
 import java.net.URL;
-import java.util.List;
 import java.util.Collections;
+import java.util.List;
 import java.util.jar.JarOutputStream;
 
 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.gbean.GBeanData;
+import org.apache.geronimo.kernel.Jsr77Naming;
 import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.kernel.Jsr77Naming;
 import org.apache.geronimo.system.configuration.ExecutableConfigurationUtil;
 import org.apache.geronimo.system.repository.Maven1Repository;
 
@@ -76,7 +75,7 @@
             public void uninstall(Artifact configID) {
             }
 
-            public GBeanData loadConfiguration(Artifact configId) {
+            public ConfigurationData loadConfiguration(Artifact configId) {
                 return null;
             }
 

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=390312&r1=390311&r2=390312&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 Thu Mar 30 19:48:25 2006
@@ -79,7 +79,6 @@
     private final List childConfigurationDatas = new ArrayList();
     private final ConfigurationManager configurationManager;
     private final Configuration configuration;
-    private final Environment environment;
     private final Naming naming;
 
     public DeploymentContext(File baseDir, Environment environment, ConfigurationModuleType moduleType, Naming naming) throws DeploymentException {
@@ -121,7 +120,7 @@
     }
 
     public DeploymentContext(File baseDir, Environment environment, ConfigurationModuleType moduleType, Naming naming, Collection repositories, Collection stores) throws DeploymentException {
-        this(baseDir, environment,  moduleType, naming, createConfigurationManager(repositories, stores, naming));
+        this(baseDir, environment,  moduleType, naming, createConfigurationManager(repositories, stores));
     }
 
     public DeploymentContext(File baseDir, Environment environment, ConfigurationModuleType moduleType, Naming naming, ConfigurationManager configurationManager) throws DeploymentException {
@@ -139,25 +138,21 @@
         this.baseDir = baseDir;
         this.baseUri = baseDir.toURI();
 
-        this.environment = environment;
         this.naming = naming;
 
         this.configuration = createTempConfiguration(environment, moduleType, baseDir, configurationManager, naming);
     }
 
-    private static ConfigurationManager createConfigurationManager(Collection repositories, Collection stores, Naming naming) {
+    private static ConfigurationManager createConfigurationManager(Collection repositories, Collection stores) {
         ArtifactManager artifactManager = new DefaultArtifactManager();
         ArtifactResolver artifactResolver = new DefaultArtifactResolver(artifactManager, repositories);
-        ConfigurationManager configurationManager = new SimpleConfigurationManager(stores, artifactResolver, naming, repositories);
+        ConfigurationManager configurationManager = new SimpleConfigurationManager(stores, artifactResolver, repositories);
         return configurationManager;
     }
 
     private static Configuration createTempConfiguration(Environment environment, ConfigurationModuleType moduleType, File baseDir, ConfigurationManager configurationManager, Naming naming) throws DeploymentException {
         try {
-            // NOTE: the configuration class will resolve all dependencies and set them
-            // back into the environment object, so don't use this environment for the
-            // final configuration data
-            return configurationManager.loadConfiguration(new ConfigurationData(moduleType, null, null, null, new Environment(environment), baseDir, naming));
+            return configurationManager.loadConfiguration(new ConfigurationData(moduleType, null, null, null, environment, baseDir, naming));
         } catch (Exception e) {
             throw new DeploymentException("Unable to create configuration for deployment", e);
         }
@@ -461,14 +456,11 @@
     }
 
     public ConfigurationData getConfigurationData() {
-        //
-        // DO NOT use the environment in the configuration, it is modifed by the configuration
-        //
         ConfigurationData configurationData = new ConfigurationData(configuration.getModuleType(),
                 new LinkedHashSet(configuration.getClassPath()),
                 new ArrayList(configuration.getGBeans().values()),
                 childConfigurationDatas,
-                environment,
+                configuration.getEnvironment(),
                 baseDir,
                 naming);
         return configurationData;

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=390312&r1=390311&r2=390312&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 Thu Mar 30 19:48:25 2006
@@ -22,10 +22,10 @@
 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.Collections;
 import java.util.jar.JarFile;
 import javax.xml.namespace.QName;
 
@@ -38,19 +38,16 @@
 import org.apache.geronimo.deployment.util.DeploymentUtil;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
-import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.apache.geronimo.kernel.config.Configuration;
+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.ConfigurationModuleType;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.kernel.config.InvalidConfigException;
 import org.apache.geronimo.kernel.config.NoSuchConfigException;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.kernel.repository.ImportType;
-import org.apache.geronimo.kernel.Naming;
-import org.apache.geronimo.kernel.Jsr77Naming;
 
 /**
  * @version $Rev:386276 $ $Date$
@@ -523,15 +520,10 @@
         public void uninstall(Artifact configID) throws NoSuchConfigException, IOException {
         }
 
-        public GBeanData loadConfiguration(Artifact configId) throws NoSuchConfigException, IOException, InvalidConfigException {
-            AbstractName configurationName = Configuration.getConfigurationAbstractName(configId);
-            GBeanData configData = new GBeanData(configurationName, Configuration.GBEAN_INFO);
-            Environment environment = new Environment();
-            environment.setConfigId(configId);
-            configData.setAttribute("environment", environment);
-            configData.setAttribute("moduleType", ConfigurationModuleType.CAR);
-
-            return configData;
+        public ConfigurationData loadConfiguration(Artifact configId) throws NoSuchConfigException, IOException, InvalidConfigException {
+            ConfigurationData configurationData = new ConfigurationData(configId, naming);
+            configurationData.setConfigurationStore(this);
+            return configurationData;
         }
 
         public boolean containsConfiguration(Artifact configID) {

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=390312&r1=390311&r2=390312&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 Thu Mar 30 19:48:25 2006
@@ -16,12 +16,29 @@
  */
 package org.apache.geronimo.jetty.deployment;
 
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.management.ObjectName;
+import javax.naming.Reference;
+import javax.xml.namespace.QName;
+
 import junit.framework.TestCase;
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinatorGBean;
 import org.apache.geronimo.deployment.DeploymentContext;
-import org.apache.geronimo.deployment.util.UnpackedJarFile;
 import org.apache.geronimo.deployment.util.DeploymentUtil;
+import org.apache.geronimo.deployment.util.UnpackedJarFile;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.GBeanData;
@@ -52,43 +69,22 @@
 import org.apache.geronimo.kernel.config.EditableKernelConfigurationManager;
 import org.apache.geronimo.kernel.config.InvalidConfigException;
 import org.apache.geronimo.kernel.config.NoSuchConfigException;
-import org.apache.geronimo.kernel.config.ConfigurationResolver;
 import org.apache.geronimo.kernel.management.State;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.DefaultArtifactManager;
 import org.apache.geronimo.kernel.repository.DefaultArtifactResolver;
 import org.apache.geronimo.kernel.repository.Environment;
-import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.kernel.repository.ImportType;
+import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.system.serverinfo.BasicServerInfo;
 import org.apache.geronimo.transaction.context.TransactionContextManagerGBean;
 import org.apache.geronimo.transaction.manager.TransactionManagerImplGBean;
 
-import javax.management.ObjectName;
-import javax.naming.Reference;
-import javax.xml.namespace.QName;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
 /**
  * @version $Rev:385232 $ $Date$
  */
 public class JettyModuleBuilderTest extends TestCase {
-    private Naming naming = new Jsr77Naming();
+    private static Naming naming = new Jsr77Naming();
     private Artifact baseId = new Artifact("test", "base", "1", "car");
     private final AbstractName serverName = naming.createRootName(baseId, "Server", "J2EEServer");
 
@@ -310,28 +306,16 @@
             configs.remove(configID);
         }
 
-        public GBeanData loadConfiguration(Artifact configId) throws NoSuchConfigException, IOException, InvalidConfigException {
-            AbstractName configurationObjectName = Configuration.getConfigurationAbstractName(configId);
-            GBeanData configData = new GBeanData(configurationObjectName, Configuration.GBEAN_INFO);
+        public ConfigurationData loadConfiguration(Artifact configId) throws NoSuchConfigException, IOException, InvalidConfigException {
             if (configs.containsKey(configId)) {
                 ConfigurationData configurationData = (ConfigurationData) configs.get(configId);
-                configData.setAttribute("moduleType", configurationData.getModuleType());
-                Environment environment = configurationData.getEnvironment();
-                configData.setAttribute("environment", environment);
-                configData.setAttribute("gBeanState", Configuration.storeGBeans(configurationData.getGBeans()));
-                configData.setAttribute("classPath", configurationData.getClassPath());
-
-                ConfigurationResolver configurationResolver = new ConfigurationResolver(configurationData.getEnvironment().getConfigId(), this, Collections.EMPTY_SET, new DefaultArtifactResolver(null, Collections.EMPTY_SET));
-                configData.setAttribute("configurationResolver", configurationResolver);
-
+                configurationData.setConfigurationStore(this);
+                return configurationData;
             } else {
-                Environment environment = new Environment();
-                environment.setConfigId(configId);
-                configData.setAttribute("environment", environment);
-                configData.setAttribute("moduleType", ConfigurationModuleType.WAR);
-                configData.setAttribute("gBeanState", NO_OBJECTS_OS);
+                ConfigurationData configurationData = new ConfigurationData(configId, naming);
+                configurationData.setConfigurationStore(this);
+                return configurationData;
             }
-            return configData;
         }
 
         public boolean containsConfiguration(Artifact configID) {
@@ -360,21 +344,10 @@
 
         public final static GBeanInfo GBEAN_INFO;
 
-        private static final byte[] NO_OBJECTS_OS;
-
         static {
             GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(MockConfigStore.class, NameFactory.CONFIGURATION_STORE);
             infoBuilder.addInterface(ConfigurationStore.class);
             GBEAN_INFO = infoBuilder.getBeanInfo();
-
-            ByteArrayOutputStream baos = new ByteArrayOutputStream();
-            try {
-                ObjectOutputStream oos = new ObjectOutputStream(baos);
-                oos.flush();
-                NO_OBJECTS_OS = baos.toByteArray();
-            } catch (IOException e) {
-                throw new RuntimeException(e);
-            }
         }
     }
 }

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanData.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanData.java?rev=390312&r1=390311&r2=390312&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanData.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/GBeanData.java Thu Mar 30 19:48:25 2006
@@ -222,20 +222,24 @@
             // read the attributes
             int attributeCount = in.readInt();
             for (int i = 0; i < attributeCount; i++) {
-                setAttribute((String) in.readObject(), in.readObject());
+                String attributeName = (String) in.readObject();
+                Object attributeValue = in.readObject();
+                setAttribute(attributeName, attributeValue);
             }
 
             // read the references
             int endpointCount = in.readInt();
             for (int i = 0; i < endpointCount; i++) {
-                setReferencePatterns((String) in.readObject(), (ReferencePatterns) in.readObject());
+                String referenceName = (String) in.readObject();
+                ReferencePatterns referencePattern = (ReferencePatterns) in.readObject();
+                setReferencePatterns(referenceName, referencePattern);
             }
 
             //read the dependencies
             int dependencyCount = in.readInt();
             for (int i = 0; i < dependencyCount; i++) {
-                ReferencePatterns referencePatterns = (ReferencePatterns) in.readObject();
-                dependencies.add(referencePatterns);
+                ReferencePatterns depdendencyPattern = (ReferencePatterns) in.readObject();
+                dependencies.add(depdendencyPattern);
             }
         } catch (IOException e) {
             throw (IOException) new IOException("Unable to deserialize GBeanData " + abstractName).initCause(e);

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=390312&r1=390311&r2=390312&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 Thu Mar 30 19:48:25 2006
@@ -17,13 +17,8 @@
 
 package org.apache.geronimo.kernel.config;
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.EOFException;
 import java.io.File;
 import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
 import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URL;
@@ -52,7 +47,6 @@
 import org.apache.geronimo.gbean.ReferencePatterns;
 import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
-import org.apache.geronimo.kernel.ObjectInputStreamExt;
 import org.apache.geronimo.kernel.Naming;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.Dependency;
@@ -133,9 +127,8 @@
     private final Environment environment;
 
     /**
-     * Identifies the type of configuration (WAR, RAR et cetera)
+     * Used to resolve dependecies and paths
      */
-    private final ConfigurationModuleType moduleType;
     private final ConfigurationResolver configurationResolver;
 
     /**
@@ -178,13 +171,14 @@
      */
     private final Naming naming;
 
+    private ConfigurationData configurationData;
+
     /**
      * Only used to allow declaration as a reference.
      */
     public Configuration() {
         id = null;
         abstractName = null;
-        moduleType = null;
         environment = null;
         classPath = null;
         configurationResolver = null;
@@ -195,30 +189,21 @@
     /**
      * Creates a configuration.
      * @param parents parents of this configuation (not ordered)
-     * @param moduleType   the module type identifier
-     * @param environment
-     * @param classPath    a List<URI> of locations that define the codebase for this Configuration
-     * @param gbeanState   a byte array contain the Java Serialized form of the GBeans in this Configuration
+     * @param configurationData the module type, environment and classpath of the configuration
+     * @param configurationResolver used to resolve dependecies and paths
      */
     public Configuration(Collection parents,
-            ConfigurationModuleType moduleType,
-            Environment environment,
-            List classPath,
-            byte[] gbeanState,
-            ConfigurationResolver configurationResolver,
-            Naming naming) throws MissingDependencyException, MalformedURLException, NoSuchConfigException, InvalidConfigException {
+            ConfigurationData configurationData,
+            ConfigurationResolver configurationResolver) throws MissingDependencyException, MalformedURLException, NoSuchConfigException, InvalidConfigException {
         if (parents == null) parents = Collections.EMPTY_SET;
-        if (moduleType == null) throw new NullPointerException("moduleType is null");
-        if (environment == null) throw new NullPointerException("environment is null");
-        if (classPath == null) classPath = Collections.EMPTY_LIST;
+        if (configurationData == null) throw new NullPointerException("configurationData is null");
         if (configurationResolver == null) throw new NullPointerException("configurationResolver is null");
-        if (naming == null) throw new NullPointerException("naming is null");
 
-        this.environment = environment;
-        this.moduleType = moduleType;
+        this.configurationData = configurationData;
+        this.environment = this.configurationData.getEnvironment();
         this.configurationResolver = configurationResolver;
-        this.classPath = new LinkedHashSet(classPath);
-        this.naming = naming;
+        this.classPath = new LinkedHashSet(configurationData.getClassPath());
+        this.naming = configurationData.getNaming();
 
         this.id = environment.getConfigId();
         abstractName = getConfigurationAbstractName(id);
@@ -227,7 +212,6 @@
         // Transitively resolve all the dependencies in the environment
         //
         List transtiveDependencies = configurationResolver.resolveTransitiveDependencies(parents, environment.getDependencies());
-        environment.setDependencies(transtiveDependencies);
 
         //
         // Process transtive dependencies splitting it into classParents, serviceParents and artifactDependencies
@@ -268,35 +252,16 @@
         addDepthFirstServiceParents(this, allServiceParents);
 
         //
-        // Deserialize the GBeans
+        // Deserialize the GBeans in the configurationData
         //
-        if (gbeanState != null && gbeanState.length > 0) {
-            // Set the thread context classloader so deserializing classes can grab the cl from the thread
-            ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
-            try {
-                Thread.currentThread().setContextClassLoader(configurationClassLoader);
-
-                ObjectInputStream ois = new ObjectInputStreamExt(new ByteArrayInputStream(gbeanState), configurationClassLoader);
-                try {
-                    while (true) {
-                        GBeanData gbeanData = new GBeanData();
-                        gbeanData.readExternal(ois);
-                        gbeans.put(gbeanData.getAbstractName(), gbeanData);
-                    }
-                } catch (EOFException e) {
-                    // ok
-                } finally {
-                    ois.close();
-                }
-            } catch (Exception e) {
-                throw new InvalidConfigException("Unable to deserialize GBeanState", e);
-            } finally {
-                Thread.currentThread().setContextClassLoader(oldCl);
-            }
+        List gbeans = configurationData.getGBeans(configurationClassLoader);
+        for (Iterator iterator = gbeans.iterator(); iterator.hasNext();) {
+            GBeanData gbeanData = (GBeanData) iterator.next();
+            this.gbeans.put(gbeanData.getAbstractName(), gbeanData);
         }
     }
 
-    private MultiParentClassLoader createConfigurationClasssLoader(Collection parents, Environment environment, List classPath) throws MalformedURLException, MissingDependencyException, NoSuchConfigException {
+    private MultiParentClassLoader createConfigurationClasssLoader(Collection parents, Environment environment, LinkedHashSet classPath) throws MalformedURLException, MissingDependencyException, NoSuchConfigException {
         // create the URL list
         URL[] urls = buildClassPath(classPath);
 
@@ -347,7 +312,7 @@
         }
     }
 
-    private URL[] buildClassPath(List classPath) throws MalformedURLException, MissingDependencyException, NoSuchConfigException {
+    private URL[] buildClassPath(LinkedHashSet classPath) throws MalformedURLException, MissingDependencyException, NoSuchConfigException {
         List urls = new ArrayList();
         for (Iterator i = dependencies.iterator(); i.hasNext();) {
             Artifact artifact = (Artifact) i.next();
@@ -452,7 +417,7 @@
      * @return Type of the configuration.
      */
     public ConfigurationModuleType getModuleType() {
-        return moduleType;
+        return configurationData.getModuleType();
     }
 
     /**
@@ -659,70 +624,20 @@
         }
     }
 
-    /**
-     * Return a byte array containing the persisted form of the supplied GBeans
-     *
-     * @param gbeans the gbean data to persist
-     * @return the persisted GBeans
-     * @throws InvalidConfigException if there is a problem serializing the state
-     */
-    public static byte[] storeGBeans(GBeanData[] gbeans) throws InvalidConfigException {
-        return storeGBeans(Arrays.asList(gbeans));
-    }
-
-    /**
-     * Return a byte array containing the persisted form of the supplied GBeans
-     *
-     * @param gbeans the gbean data to persist
-     * @return the persisted GBeans
-     * @throws InvalidConfigException if there is a problem serializing the state
-     */
-    public static byte[] storeGBeans(List gbeans) throws InvalidConfigException {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        ObjectOutputStream oos;
-        try {
-            oos = new ObjectOutputStream(baos);
-        } catch (IOException e) {
-            throw (AssertionError) new AssertionError("Unable to initialize ObjectOutputStream").initCause(e);
-        }
-        for (Iterator iterator = gbeans.iterator(); iterator.hasNext();) {
-            GBeanData gbeanData = (GBeanData) iterator.next();
-            try {
-                gbeanData.writeExternal(oos);
-            } catch (Exception e) {
-                throw new InvalidConfigException("Unable to serialize GBeanData for " + gbeanData.getAbstractName(), e);
-            }
-        }
-        try {
-            oos.flush();
-        } catch (IOException e) {
-            throw (AssertionError) new AssertionError("Unable to flush ObjectOutputStream").initCause(e);
-        }
-        return baos.toByteArray();
-    }
-
     public static final GBeanInfo GBEAN_INFO;
 
     static {
         GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(Configuration.class);//does not use jsr-77 naming
         infoFactory.addReference("Parents", Configuration.class);
-        infoFactory.addAttribute("moduleType", ConfigurationModuleType.class, true, false);
-        infoFactory.addAttribute("environment", Environment.class, true, false);
-        infoFactory.addAttribute("classPath", List.class, true, false);
-        infoFactory.addAttribute("gBeanState", byte[].class, true, false);
+        infoFactory.addAttribute("configurationData", ConfigurationData.class, true, false);
         infoFactory.addAttribute("configurationResolver", ConfigurationResolver.class, true);
-        infoFactory.addAttribute("naming", Naming.class, true);
 
         infoFactory.addInterface(Configuration.class);
 
         infoFactory.setConstructor(new String[]{
                 "Parents",
-                "moduleType",
-                "environment",
-                "classPath",
-                "gBeanState",
-                "configurationResolver",
-                "naming",
+                "configurationData",
+                "configurationResolver"
         });
 
         GBEAN_INFO = infoFactory.getBeanInfo();

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationData.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationData.java?rev=390312&r1=390311&r2=390312&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationData.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationData.java Thu Mar 30 19:48:25 2006
@@ -17,29 +17,43 @@
 
 package org.apache.geronimo.kernel.config;
 
-import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.kernel.repository.Environment;
-import org.apache.geronimo.kernel.Naming;
-import org.apache.geronimo.gbean.GBeanData;
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.AbstractName;
-
+import java.io.File;
+import java.io.Serializable;
+import java.io.IOException;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.EOFException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.LinkedHashSet;
 import java.util.List;
-import java.io.File;
+import java.util.Iterator;
+
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.kernel.Naming;
+import org.apache.geronimo.kernel.ObjectInputStreamExt;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.Environment;
 
 /**
  * @version $Rev: 382645 $ $Date$
  */
-public class ConfigurationData {
+public class ConfigurationData implements Serializable {
+    private static final long serialVersionUID = 4324193220056650732L;
 
     /**
      * Identifies the type of configuration (WAR, RAR et cetera)
      */
     private final ConfigurationModuleType moduleType;
 
+    /**
+     * Defines the configuration id, parent configurations, and classpath
+     */
+    private final Environment environment;
 
     /**
      * List of URIs in this configuration's classpath.  These are for the classes directly included in the configuration
@@ -52,20 +66,40 @@
     private final List gbeans = new ArrayList();
 
     /**
+     * The serialized form of the gbeans.  Once this is set on more gbeans can be added.
+     */
+    private byte[] gbeanState;
+
+    /**
      * Child configurations of this configuration
      */
     private final List childConfigurations = new ArrayList();
 
-    private final Environment environment;
+    /**
+     * The base file of the configuation
+     */
+    private transient File configurationDir;
 
-    private final File configurationDir;
-    private final Naming naming;
+    /**
+     * The naming system
+     */
+    private transient Naming naming;
+
+    /**
+     * The configuration store from which this configuration was loaded, or null if it was not loaded from a configuration store.
+     */
+    private transient ConfigurationStore configurationStore;
 
     public ConfigurationData(Artifact configId, Naming naming) {
-        this(null, null, null, null, new Environment(configId), null, naming);
+        this(new Environment(configId), naming);
+    }
+
+    public ConfigurationData(Environment environment, Naming naming) {
+        this(null, null, null, null, environment, null, naming);
     }
 
     public ConfigurationData(ConfigurationModuleType moduleType, LinkedHashSet classPath, List gbeans, List childConfigurations, Environment environment, File configurationDir, Naming naming) {
+        if (naming == null) throw new NullPointerException("naming is null");
         this.naming = naming;
         if (moduleType != null) {
             this.moduleType = moduleType;
@@ -100,15 +134,27 @@
         return Collections.unmodifiableList(new ArrayList(classPath));
     }
 
-    public List getGBeans() {
+    public List getGBeans(ClassLoader classLoader) throws InvalidConfigException {
+        if (gbeanState == null) {
+            return Collections.unmodifiableList(gbeans);
+        }
+        gbeans.addAll(loadGBeans(gbeanState, classLoader));
         return Collections.unmodifiableList(gbeans);
     }
 
     public void addGBean(GBeanData gbeanData) {
+        if (gbeanState != null) {
+            throw new IllegalStateException("GBeans have been serialized, so no more GBeans can be added");
+        }
+
         gbeans.add(gbeanData);
     }
 
     public GBeanData addGBean(String name, GBeanInfo gbeanInfo) {
+        if (gbeanState != null) {
+            throw new IllegalStateException("GBeans have been serialized, so no more GBeans can be added");
+        }
+
         String j2eeType = gbeanInfo.getJ2eeType();
         if (j2eeType == null) j2eeType = "GBean";
         AbstractName abstractName = naming.createRootName(environment.getConfigId(), name, j2eeType);
@@ -127,6 +173,88 @@
 
     public File getConfigurationDir() {
         return configurationDir;
+    }
+
+    public void setConfigurationDir(File configurationDir) {
+        this.configurationDir = configurationDir;
+    }
+
+    public Naming getNaming() {
+        return naming;
+    }
+
+    public void setNaming(Naming naming) {
+        this.naming = naming;
+    }
+
+    public ConfigurationStore getConfigurationStore() {
+        return configurationStore;
+    }
+
+    public void setConfigurationStore(ConfigurationStore configurationStore) {
+        this.configurationStore = configurationStore;
+    }
+
+    private void writeObject(java.io.ObjectOutputStream stream) throws IOException {
+        if (gbeanState == null) {
+            gbeanState = storeGBeans(gbeans);
+            gbeans.clear();
+        }
+
+        stream.defaultWriteObject();
+    }
+
+    private static List loadGBeans(byte[] gbeanState, ClassLoader classLoader) throws InvalidConfigException {
+        List gbeans = new ArrayList();
+        if (gbeanState != null && gbeanState.length > 0) {
+            // Set the thread context classloader so deserializing classes can grab the cl from the thread
+            ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
+            try {
+                Thread.currentThread().setContextClassLoader(classLoader);
+
+                ObjectInputStream ois = new ObjectInputStreamExt(new ByteArrayInputStream(gbeanState), classLoader);
+                try {
+                    while (true) {
+                        GBeanData gbeanData = new GBeanData();
+                        gbeanData.readExternal(ois);
+                        gbeans.add(gbeanData);
+                    }
+                } catch (EOFException e) {
+                    // ok
+                } finally {
+                    ois.close();
+                }
+            } catch (Exception e) {
+                throw new InvalidConfigException("Unable to deserialize GBeanState", e);
+            } finally {
+                Thread.currentThread().setContextClassLoader(oldCl);
+            }
+        }
+        return gbeans;
+    }
+
+    private static byte[] storeGBeans(List gbeans) throws IOException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        ObjectOutputStream oos;
+        try {
+            oos = new ObjectOutputStream(baos);
+        } catch (IOException e) {
+            throw (AssertionError) new AssertionError("Unable to initialize ObjectOutputStream").initCause(e);
+        }
+        for (Iterator iterator = gbeans.iterator(); iterator.hasNext();) {
+            GBeanData gbeanData = (GBeanData) iterator.next();
+            try {
+                gbeanData.writeExternal(oos);
+            } catch (Exception e) {
+                throw (IOException) new IOException("Unable to serialize GBeanData for " + gbeanData.getAbstractName()).initCause(e);
+            }
+        }
+        try {
+            oos.flush();
+        } catch (IOException e) {
+            throw (AssertionError) new AssertionError("Unable to flush ObjectOutputStream").initCause(e);
+        }
+        return baos.toByteArray();
     }
 
 }

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=390312&r1=390311&r2=390312&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 Thu Mar 30 19:48:25 2006
@@ -79,8 +79,6 @@
 
     Configuration loadConfiguration(ConfigurationData configurationData) throws NoSuchConfigException, IOException, InvalidConfigException;
 
-    Configuration loadConfiguration(ConfigurationData configurationData, ConfigurationStore configurationStore) throws NoSuchConfigException, IOException, InvalidConfigException;
-
     /**
      * Unloads the gbeans of the specified configuration, stops the configuration gbean, and unloads the
      * configuration gbean from the kernel.  Stop should always be called first.

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationModuleType.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationModuleType.java?rev=390312&r1=390311&r2=390312&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationModuleType.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationModuleType.java Thu Mar 30 19:48:25 2006
@@ -18,6 +18,8 @@
 package org.apache.geronimo.kernel.config;
 
 import java.io.Serializable;
+import java.util.Map;
+import java.util.LinkedHashMap;
 
 /**
  * Configuration types.
@@ -25,11 +27,10 @@
  * @version $Rev$ $Date$
  */
 public class ConfigurationModuleType implements Serializable {
-    /**
-     * 
-     */
     private static final long serialVersionUID = -4121586344416418391L;
 
+    private static final Map typesByName = new LinkedHashMap();
+
     public static final ConfigurationModuleType EAR = new ConfigurationModuleType("EAR", 0);
 
     public static final ConfigurationModuleType EJB = new ConfigurationModuleType("EJB", 1);
@@ -47,7 +48,7 @@
     private static final ConfigurationModuleType[] fromInt = {EAR, EJB, CAR, RAR, WAR, SERVICE, SPR};
 
     private final String name;
-    
+
     private final int value;
 
     public static ConfigurationModuleType getFromValue(int index) {
@@ -61,6 +62,11 @@
         return getFromValue(index.intValue());
     }
 
+    public static ConfigurationModuleType getByName(String name) {
+        return (ConfigurationModuleType) typesByName.get(name);
+    }
+
+
     /**
      * This constructor is intentionally public: this class is not a type-safe
      * enumeration.
@@ -68,27 +74,28 @@
     public ConfigurationModuleType(String name, int value) {
         this.name = name;
         this.value = value;
+        typesByName.put(name, this);
     }
 
     public String getName() {
         return name;
     }
-    
+
     /**
      * Gets the identifier of this type. For a configuration associated to
      * a J2EE ModuleType, this value MUST be equal to ModuleType.getValue().
      * 
-     * @return
+     * @return the index
      */
     public int getValue() {
         return value;
     }
-    
+
     public String toString() {
         return name;
     }
 
-    private Object readResolve() {
+    protected Object readResolve() {
         return fromInt[value];
     }
 

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=390312&r1=390311&r2=390312&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 Thu Mar 30 19:48:25 2006
@@ -33,7 +33,6 @@
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.kernel.repository.ImportType;
-import org.apache.geronimo.kernel.repository.DefaultArtifactResolver;
 
 /**
  * @version $Rev$ $Date$
@@ -58,42 +57,15 @@
         configurationStore = null;
     }
 
-    public ConfigurationResolver(Artifact configurationId, File baseDir, Collection repositories) {
-        if (configurationId == null)  throw new NullPointerException("configurationId is null");
+    public ConfigurationResolver(ConfigurationData configurationData, Collection repositories, ArtifactResolver artifactResolver) {
+        if (configurationData == null)  throw new NullPointerException("configurationData is null");
         if (repositories == null) repositories = Collections.EMPTY_SET;
 
-        this.configurationId = configurationId;
-        if (!repositories.isEmpty()) {
-            this.artifactResolver = new DefaultArtifactResolver(null, repositories);
-        } else {
-            this.artifactResolver = null;
-        }
-        this.repositories = repositories;
-        this.baseDir = baseDir;
-        configurationStore = null;
-    }
-
-    public ConfigurationResolver(Artifact configurationId, File baseDir, Collection repositories, ArtifactResolver artifactResolver) {
-        if (configurationId == null)  throw new NullPointerException("configurationId is null");
-        if (repositories == null) repositories = Collections.EMPTY_SET;
-
-        this.configurationId = configurationId;
-        this.artifactResolver = artifactResolver;
-        this.repositories = repositories;
-        this.baseDir = baseDir;
-        configurationStore = null;
-    }
-
-    public ConfigurationResolver(Artifact configurationId, ConfigurationStore configurationStore, Collection repositories, ArtifactResolver artifactResolver) {
-        if (configurationId == null)  throw new NullPointerException("configurationId is null");
-        if (repositories == null) repositories = Collections.EMPTY_SET;
-        if (configurationStore == null)  throw new NullPointerException("configurationStore is null");
-
-        this.configurationId = configurationId;
+        configurationId = configurationData.getId();
         this.artifactResolver = artifactResolver;
         this.repositories = repositories;
-        this.configurationStore = configurationStore;
-        baseDir = null;
+        configurationStore = configurationData.getConfigurationStore();
+        baseDir = configurationData.getConfigurationDir();
     }
 
     public File resolve(Artifact artifact) throws MissingDependencyException {

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=390312&r1=390311&r2=390312&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 Thu Mar 30 19:48:25 2006
@@ -24,7 +24,6 @@
 import java.net.URL;
 import java.util.List;
 
-import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.kernel.repository.Artifact;
 
 /**
@@ -58,7 +57,7 @@
      * @throws IOException if a problem occurs loading the configuration from the store
      * @throws InvalidConfigException if the configuration is corrupt
      */
-    GBeanData loadConfiguration(Artifact configId) throws IOException, InvalidConfigException, NoSuchConfigException;
+    ConfigurationData loadConfiguration(Artifact configId) throws NoSuchConfigException, IOException, InvalidConfigException;
 
     /**
      * Determines if the store contains a configuration with the spedified ID.

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=390312&r1=390311&r2=390312&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 Thu Mar 30 19:48:25 2006
@@ -16,21 +16,6 @@
  */
 package org.apache.geronimo.kernel.config;
 
-import org.apache.geronimo.gbean.AbstractName;
-import org.apache.geronimo.gbean.GAttributeInfo;
-import org.apache.geronimo.gbean.GBeanData;
-import org.apache.geronimo.gbean.GReferenceInfo;
-import org.apache.geronimo.gbean.InvalidConfigurationException;
-import org.apache.geronimo.gbean.ReferencePatterns;
-import org.apache.geronimo.gbean.AbstractNameQuery;
-import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
-import org.apache.geronimo.kernel.GBeanNotFoundException;
-import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.kernel.management.State;
-import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.kernel.repository.ArtifactResolver;
-import org.apache.geronimo.kernel.repository.Environment;
-
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.ObjectInputStream;
@@ -39,10 +24,24 @@
 import java.net.URI;
 import java.net.URL;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
+import java.util.List;
+import java.util.Collections;
+
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.gbean.GAttributeInfo;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GReferenceInfo;
+import org.apache.geronimo.gbean.InvalidConfigurationException;
+import org.apache.geronimo.gbean.ReferencePatterns;
+import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
+import org.apache.geronimo.kernel.GBeanNotFoundException;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.management.State;
+import org.apache.geronimo.kernel.repository.Artifact;
 
 /**
  * @version $Rev:386276 $ $Date$
@@ -52,42 +51,34 @@
     }
 
     public static AbstractName loadBootstrapConfiguration(Kernel kernel, InputStream in, ClassLoader classLoader) throws Exception {
-        // load and start the configuration in this jar
-        GBeanData configuration = new GBeanData();
-        ObjectInputStream ois = new ObjectInputStream(in);
-        try {
-            configuration.readExternal(ois);
-        } finally {
-            ois.close();
-        }
-        ConfigurationResolver configurationResolver = new ConfigurationResolver(configuration.getAbstractName().getArtifact(), null);
-        configuration.setAttribute("configurationResolver", configurationResolver);
-
-        return loadBootstrapConfiguration(kernel, configuration, classLoader);
+        ConfigurationData configurationData = readConfigurationData(in);
+        return loadBootstrapConfiguration(kernel, configurationData, classLoader);
     }
 
     public static AbstractName loadBootstrapConfiguration(Kernel kernel, ConfigurationData configurationData, ClassLoader classLoader) throws Exception {
-        GBeanData configuration = toConfigurationGBeanData(configurationData, null, null, null);
-        return loadBootstrapConfiguration(kernel, configuration, classLoader);
-    }
+        if (kernel == null) throw new NullPointerException("kernel is null");
+        if (configurationData == null) throw new NullPointerException("configurationData is null");
+        if (classLoader == null) throw new NullPointerException("classLoader is null");
+
+        // a bootstrap configuration can not have any dependencies
+        List dependencies = configurationData.getEnvironment().getDependencies();
+        if (!dependencies.isEmpty()) {
+            configurationData.getEnvironment().setDependencies(Collections.EMPTY_SET);
+//            throw new InvalidConfigurationException("Booststrap configuration can not have dependendencies: " + dependencies);
+        }
 
-    private static AbstractName loadBootstrapConfiguration(Kernel kernel, GBeanData configurationGBeanData, ClassLoader classLoader) throws Exception {
-        Environment environment = (Environment) configurationGBeanData.getAttribute("environment");
-        Artifact configId = environment.getConfigId();
-        AbstractName configurationName = Configuration.getConfigurationAbstractName(configId);
-        configurationGBeanData.setAbstractName(configurationName);
-        configurationGBeanData.setAttribute("naming", kernel.getNaming());
-
-        // for a bootstrap we should have an empty kernel, so clear the references and dependencies
-        configurationGBeanData.setAttribute("artifactManager", null);
-        configurationGBeanData.setAttribute("artifactResolver", null);
-        environment.setDependencies(Collections.EMPTY_LIST);
+        // build the gbean data
+        Artifact configId = configurationData.getId();
+        AbstractName abstractName = Configuration.getConfigurationAbstractName(configId);
+        GBeanData gbeanData = new GBeanData(abstractName, Configuration.GBEAN_INFO);
+        gbeanData.setAttribute("configurationData", configurationData);
+        gbeanData.setAttribute("configurationResolver", new ConfigurationResolver(configurationData, null, null));
 
         // load and start the gbean
-        kernel.loadGBean(configurationGBeanData, classLoader);
-        kernel.startGBean(configurationName);
+        kernel.loadGBean(gbeanData, classLoader);
+        kernel.startGBean(gbeanData.getAbstractName());
 
-        Configuration configuration = (Configuration) kernel.getGBean(configurationName);
+        Configuration configuration = (Configuration) kernel.getGBean(gbeanData.getAbstractName());
 
         // get the gbeans and classloader
         Collection gbeans = configuration.getGBeans().values();
@@ -96,56 +87,30 @@
 
         ConfigurationManager configurationManager = getConfigurationManager(kernel);
         configurationManager.loadConfiguration(configId);
-        return configurationName;
+        return gbeanData.getAbstractName();
     }
 
-    public static void storeBootstrapConfiguration(ConfigurationData configurationData, OutputStream out) throws InvalidConfigException, IOException {
-        ObjectOutputStream objectOutputStream = null;
+    public static void writeConfigurationData(ConfigurationData configurationData, OutputStream out) throws IOException {
+        ObjectOutputStream oout = new ObjectOutputStream(out);
         try {
-            GBeanData configurationGBeanData = toConfigurationGBeanData(configurationData, null, null, null);
-            //TODO configid DAIN please review!!
-            //configurationResolver is not serializable in principle, but is useful for local manipulation of
-            //ConfigurationData/ configuration as a GBeanData.
-            configurationGBeanData.setAttribute("configurationResolver", null);
-            objectOutputStream = new ObjectOutputStream(out);
-            configurationGBeanData.writeExternal(objectOutputStream);
-        } catch (IOException e) {
-            throw e;
-        } catch (Exception e) {
-            throw new InvalidConfigException("Unable to save configuration state", e);
+            oout.writeObject(configurationData);
         } finally {
-            if (objectOutputStream != null) {
+            if (oout != null) {
                 try {
-                    objectOutputStream.flush();
+                    oout.flush();
                 } catch (IOException ignored) {
-                    //TODO really?
                 }
             }
         }
-
     }
 
-    // This method is package protected in an attempt to hide how we turn ConfigurationData into a GBeanData
-    // user should be using ConfigurationManager to do this work
-    static GBeanData toConfigurationGBeanData(ConfigurationData configurationData, ConfigurationStore configurationStore, Collection repositories, ArtifactResolver artifactResolver) throws InvalidConfigException {
-        Artifact id = configurationData.getId();
-        AbstractName abstractName = Configuration.getConfigurationAbstractName(id);
-        GBeanData gbeanData = new GBeanData(abstractName, Configuration.GBEAN_INFO);
-        gbeanData.setAttribute("moduleType", configurationData.getModuleType());
-        Environment environment = configurationData.getEnvironment();
-        gbeanData.setAttribute("environment", environment);
-        gbeanData.setAttribute("gBeanState", Configuration.storeGBeans(configurationData.getGBeans()));
-        gbeanData.setAttribute("classPath", configurationData.getClassPath());
-
-        ConfigurationResolver configurationResolver;
-        if (configurationStore != null) {
-            configurationResolver = new ConfigurationResolver(configurationData.getEnvironment().getConfigId(), configurationStore, repositories, artifactResolver);
-        } else {
-            configurationResolver = new ConfigurationResolver(configurationData.getEnvironment().getConfigId(), configurationData.getConfigurationDir(), repositories, artifactResolver);
+    public static ConfigurationData readConfigurationData(InputStream in) throws IOException, ClassNotFoundException {
+        ObjectInputStream oin = new ObjectInputStream(in);
+        try {
+            return (ConfigurationData) oin.readObject();
+        } finally {
+            oin.close();
         }
-        gbeanData.setAttribute("configurationResolver", configurationResolver);
-
-        return gbeanData;
     }
 
     /**

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=390312&r1=390311&r2=390312&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 Thu Mar 30 19:48:25 2006
@@ -17,35 +17,31 @@
 
 package org.apache.geronimo.kernel.config;
 
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.LinkedHashSet;
+
 import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.gbean.InvalidConfigurationException;
-import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.InternalKernelException;
 import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.kernel.jmx.JMXUtil;
 import org.apache.geronimo.kernel.management.State;
 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.DefaultArtifactResolver;
-import org.apache.geronimo.kernel.repository.Environment;
-import org.apache.geronimo.kernel.repository.MissingDependencyException;
 import org.apache.geronimo.kernel.repository.Repository;
 
-import javax.management.ObjectName;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-
 /**
  * The standard non-editable ConfigurationManager implementation.  That is,
  * you can save a lost configurations and stuff, but not change the set of
@@ -74,7 +70,6 @@
 
         super(stores,
                 createArtifactResolver(artifactResolver, artifactManager, repositories),
-                kernel == null? null: kernel.getNaming(),
                 repositories);
 
         this.kernel = kernel;
@@ -113,12 +108,26 @@
         return super.loadConfiguration(configurationId);
     }
 
-    protected Configuration load(GBeanData configurationData, Map loadedConfigurations) throws InvalidConfigException {
-        Artifact configurationId = getConfigurationId(configurationData);
+    protected Configuration load(ConfigurationData configurationData, LinkedHashSet resolvedParentIds, Map loadedConfigurations) throws InvalidConfigException {
+        Artifact configurationId = configurationData.getId();
         AbstractName configurationName = Configuration.getConfigurationAbstractName(configurationId);
+        GBeanData gbeanData = new GBeanData(configurationName, Configuration.GBEAN_INFO);
+        gbeanData.setAttribute("configurationData", configurationData);
+        gbeanData.setAttribute("configurationResolver", new ConfigurationResolver(configurationData, repositories, artifactResolver));
+
+        // add parents to the parents reference collection
+        LinkedHashSet parentNames = new LinkedHashSet();
+        for (Iterator iterator = resolvedParentIds.iterator(); iterator.hasNext();) {
+            Artifact resolvedParentId = (Artifact) iterator.next();
+            AbstractName parentName = Configuration.getConfigurationAbstractName(resolvedParentId);
+            parentNames.add(parentName);
+        }
+        gbeanData.addDependencies(parentNames);
+        gbeanData.setReferencePatterns("Parents", parentNames);
+
         // load the configuration
         try {
-            kernel.loadGBean(configurationData, classLoader);
+            kernel.loadGBean(gbeanData, classLoader);
         } catch (GBeanAlreadyExistsException e) {
             throw new InvalidConfigException("Unable to load configuration gbean " + configurationId, e);
         }
@@ -154,13 +163,13 @@
         // load the attribute overrides from the attribute store
         Collection gbeans = configuration.getGBeans().values();
         if (attributeStore != null) {
-            gbeans = attributeStore.applyOverrides(getConfigurationId(configuration), gbeans, configuration.getConfigurationClassLoader());
+            gbeans = attributeStore.applyOverrides(configuration.getId(), gbeans, configuration.getConfigurationClassLoader());
         }
 
         ConfigurationUtil.startConfigurationGBeans(gbeans, configuration, kernel);
 
         if (configurationList != null) {
-            configurationList.addConfiguration(getConfigurationId(configuration).toString());
+            configurationList.addConfiguration(configuration.getId().toString());
         }
     }
 
@@ -184,12 +193,12 @@
             throw new InvalidConfigException("Could not stop gbeans in configuration", e);
         }
         if (configurationList != null) {
-            configurationList.removeConfiguration(getConfigurationId(configuration).toString());
+            configurationList.removeConfiguration(configuration.getId().toString());
         }
     }
 
     protected void unload(Configuration configuration) {
-        Artifact configurationId = getConfigurationId(configuration);
+        Artifact configurationId = configuration.getId();
         unload(configurationId);
     }
 
@@ -232,7 +241,6 @@
     }
 
     private static class ShutdownHook implements Runnable {
-        private static final ObjectName CONFIG_QUERY = JMXUtil.getObjectName("geronimo.config:*");
         private final Kernel kernel;
 
         public ShutdownHook(Kernel kernel) {



Mime
View raw message