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 2004/12/04 06:06:05 UTC

svn commit: r109772 - in geronimo/trunk: modules/axis/src/java/org/apache/geronimo/axis modules/axis/src/test/org/apache/geronimo/axis/testUtils modules/deployment/src/java/org/apache/geronimo/deployment modules/kernel/src/java/org/apache/geronimo/gbean/jmx modules/kernel/src/java/org/apache/geronimo/kernel modules/kernel/src/java/org/apache/geronimo/kernel/config modules/kernel/src/test/org/apache/geronimo/kernel modules/kernel/src/test/org/apache/geronimo/kernel/config modules/system/src/java/org/apache/geronimo/system/configuration modules/system/src/test/org/apache/geronimo/system/configuration plugins/maven-geronimo-plugin/src/java/org/apache/geronimo/deployment/mavenplugin

Author: dain
Date: Fri Dec  3 21:06:02 2004
New Revision: 109772

URL: http://svn.apache.org/viewcvs?view=rev&rev=109772
Log:
Removed GBeanMBean usage from configuration clases.
Added more documentation and cleaned up Configuration.

Modified:
   geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/AxisGeronimoUtils.java
   geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/WSConfigBuilder.java
   geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/testUtils/TestingUtils.java
   geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java
   geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBean.java
   geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/Kernel.java
   geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java
   geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java
   geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java
   geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java
   geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Run.java
   geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java
   geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/config/RunTest.java
   geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/LocalConfigStore.java
   geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/configuration/LocalConfigStoreTest.java
   geronimo/trunk/plugins/maven-geronimo-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StartServer.java

Modified: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/AxisGeronimoUtils.java
Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/AxisGeronimoUtils.java?view=diff&rev=109772&p1=geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/AxisGeronimoUtils.java&r1=109771&p2=geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/AxisGeronimoUtils.java&r2=109772
==============================================================================
--- geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/AxisGeronimoUtils.java	(original)
+++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/AxisGeronimoUtils.java	Fri Dec  3 21:06:02 2004
@@ -39,9 +39,8 @@
 import java.util.zip.ZipException;
 import java.util.zip.ZipFile;
 import javax.ejb.EJBHome;
-import javax.management.AttributeNotFoundException;
+import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
-import javax.management.ReflectionException;
 
 import org.apache.axis.AxisFault;
 import org.apache.axis.client.AdminClient;
@@ -147,6 +146,18 @@
         }
     }
 
+    public static void startGBean(GBeanData gbean, Kernel kernel, ClassLoader classLoader)
+            throws DeploymentException {
+        try {
+            ObjectName objectName = gbean.getName();
+            startedGbeans.add(objectName);
+            kernel.loadGBean(gbean, classLoader);
+            kernel.startGBean(objectName);
+        } catch (Exception e) {
+            throw new DeploymentException(e);
+        }
+    }
+
     /**
      * @param objectName
      * @param gbean
@@ -308,7 +319,7 @@
      * @return
      * @throws Exception
      */
-    public static URI saveConfiguration(GBeanMBean config, ConfigurationStore store)throws Exception{
+    public static URI saveConfiguration(GBeanData config, ConfigurationStore store)throws Exception{
         File sourceFile = null;
         try {
             sourceFile = File.createTempFile("test", ".car");
@@ -316,11 +327,10 @@
             JarOutputStream jos = new JarOutputStream(new BufferedOutputStream(new FileOutputStream(sourceFile)));
             jos.putNextEntry(new ZipEntry("META-INF/config.ser"));
             ObjectOutputStream oos = new ObjectOutputStream(jos);
-            config.getGBeanData().writeExternal(oos);
+            config.writeExternal(oos);
             oos.flush();
             jos.closeEntry();
             jos.close();
-            ArrayList list = new ArrayList(1);
             return store.install(source);
         } finally {
             if (sourceFile != null) {
@@ -329,8 +339,8 @@
         }
     }
     
-    public static void createConfiguration(URI id,byte[] state,File unpackedDir) throws AttributeNotFoundException, ReflectionException, IOException{
-        GBeanMBean config = new GBeanMBean(Configuration.GBEAN_INFO);
+    public static void createConfiguration(URI id,byte[] state,File unpackedDir) throws MalformedObjectNameException, IOException{
+        GBeanData config = new GBeanData(Configuration.getConfigurationObjectName(id), Configuration.GBEAN_INFO);
         config.setAttribute("ID", id);
         config.setReferencePatterns("Parent", null);
         config.setAttribute("classPath", Collections.EMPTY_LIST);
@@ -343,7 +353,7 @@
             confSer.createNewFile();
             OutputStream fos = new FileOutputStream(confSer);
             ObjectOutputStream oos = new ObjectOutputStream(fos);
-            config.getGBeanData().writeExternal(oos);
+            config.writeExternal(oos);
             oos.flush();
             fos.close();
         } finally {
@@ -382,7 +392,7 @@
     public static URI saveAsConfiguration(byte[] state,URI id, ConfigurationStore store) throws Exception{
         //create a configuraton with Web Service GBean
         
-        GBeanMBean config = new GBeanMBean(Configuration.GBEAN_INFO);
+        GBeanData config = new GBeanData(Configuration.getConfigurationObjectName(id), Configuration.GBEAN_INFO);
         config.setAttribute("ID", id);
         config.setReferencePatterns("Parent", null);
         config.setAttribute("classPath", Collections.EMPTY_LIST);

Modified: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/WSConfigBuilder.java
Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/WSConfigBuilder.java?view=diff&rev=109772&p1=geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/WSConfigBuilder.java&r1=109771&p2=geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/WSConfigBuilder.java&r2=109772
==============================================================================
--- geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/WSConfigBuilder.java	(original)
+++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/WSConfigBuilder.java	Fri Dec  3 21:06:02 2004
@@ -21,20 +21,17 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 import java.util.jar.JarFile;
 import java.util.zip.ZipFile;
-
 import javax.management.ObjectName;
 
 import org.apache.geronimo.deployment.ConfigurationBuilder;
 import org.apache.geronimo.deployment.DeploymentException;
+import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.WaitingException;
-import org.apache.geronimo.gbean.jmx.GBeanMBean;
 import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.jmx.JMXUtil;
 
@@ -91,15 +88,13 @@
             }
             
             if(wsplan.isEJBbased()){
-                GBeanMBean wsGbean = new GBeanMBean(EJBWSGBean.getGBeanInfo());
+                GBeanData wsGbean = new GBeanData(wsplan.getWsName(), EJBWSGBean.getGBeanInfo());
                 ArrayList classList = AxisGeronimoUtils.getClassFileList(new ZipFile(wsplan.getModule()));
                 wsGbean.setAttribute("classList", classList);
                 wsGbean.setReferencePattern("EjbConfig", wsplan.getEjbConfName());
-                Map gbeans = new HashMap();
-                gbeans.put(wsplan.getWsName(), wsGbean);
-//      
-//                //create a configuraton with Web Service GBean
-                byte[] state = Configuration.storeGBeans(gbeans);
+
+                //create a configuraton with Web Service GBean
+                byte[] state = Configuration.storeGBeans(new GBeanData[] {wsGbean});
                 AxisGeronimoUtils.createConfiguration(wsplan.getConfigURI(),state,unpackedDir);
 
             }else{
@@ -108,15 +103,13 @@
                 copyTheFile(rawmodule, installedModule);
                 
                 
-                GBeanMBean gbean = new GBeanMBean(POJOWSGBean.getGBeanInfo());
+                GBeanData gbean = new GBeanData(wsplan.getWsName(), POJOWSGBean.getGBeanInfo());
                 //TODO fill up the POJOWSGBean info
                 ArrayList classList = AxisGeronimoUtils.getClassFileList(new ZipFile(installedModule));
                 gbean.setAttribute("classList", classList);
                 gbean.setAttribute("moduleURL", installedModule.toURL());
             
-                Map gbeans = new HashMap();
-                gbeans.put(wsplan.getWsName(), gbean);
-                byte[] state = Configuration.storeGBeans(gbeans);
+                byte[] state = Configuration.storeGBeans(new GBeanData[] {gbean});
                 AxisGeronimoUtils.createConfiguration(wsplan.getConfigURI(),state,unpackedDir);
             }
         } catch (IOException e) {

Modified: geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/testUtils/TestingUtils.java
Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/testUtils/TestingUtils.java?view=diff&rev=109772&p1=geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/testUtils/TestingUtils.java&r1=109771&p2=geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/testUtils/TestingUtils.java&r2=109772
==============================================================================
--- geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/testUtils/TestingUtils.java	(original)
+++ geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/testUtils/TestingUtils.java	Fri Dec  3 21:06:02 2004
@@ -27,12 +27,12 @@
 
 import org.apache.geronimo.axis.AxisGeronimoUtils;
 import org.apache.geronimo.axis.WSPlan;
-import org.apache.geronimo.deployment.DeploymentException;
 import org.apache.geronimo.gbean.GBeanData;
-import org.apache.geronimo.gbean.jmx.GBeanMBean;
+import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.j2ee.deployment.EARConfigBuilder;
 import org.apache.geronimo.j2ee.deployment.ResourceReferenceBuilder;
 import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.transaction.OnlineUserTransaction;
@@ -41,18 +41,18 @@
  * @version $Rev: $ $Date: $
  */
 public class TestingUtils {
-    
-    protected static J2EEManager j2eeManager  = new J2EEManager();
-    
 
-    public static void startJ2EEContinerAndAxisServlet(Kernel kernel) throws Exception{
-//        //This does the work need to be done by plan
+    protected static J2EEManager j2eeManager = new J2EEManager();
+
+
+    public static void startJ2EEContinerAndAxisServlet(Kernel kernel) throws Exception {
+        //This does the work need to be done by plan
         j2eeManager.startJ2EEContainer(kernel);
         //start the Axis Serverlet which would be started by the service plan
-        org.apache.geronimo.jetty.JettyWebAppContext c = null;
-        GBeanMBean app = new GBeanMBean("org.apache.geronimo.jetty.JettyWebAppContext");
-        URL url =
-                Thread.currentThread().getContextClassLoader().getResource("deployables/axis/");
+        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+        GBeanInfo gbeanInfo = GBeanInfo.getGBeanInfo("org.apache.geronimo.jetty.JettyWebAppContext", classLoader);
+        GBeanData app = new GBeanData(AxisGeronimoConstants.APPLICATION_NAME, gbeanInfo);
+        URL url = classLoader.getResource("deployables/axis/");
         System.out.print(url);
         app.setAttribute("uri", URI.create(url.toString()));
         app.setAttribute("contextPath", "/axis");
@@ -65,14 +65,14 @@
         app.setAttribute("configurationBaseUrl", Thread.currentThread().getContextClassLoader().getResource("deployables/"));
         app.setReferencePattern("TransactionContextManager", AxisGeronimoConstants.TRANSACTION_CONTEXT_MANAGER_NAME);
         app.setReferencePattern("TrackedConnectionAssociator", AxisGeronimoConstants.TRACKED_CONNECTION_ASSOCIATOR_NAME);
-        AxisGeronimoUtils.startGBean(AxisGeronimoConstants.APPLICATION_NAME, app, kernel);
+        AxisGeronimoUtils.startGBean(app, kernel, classLoader);
 
     }
-    
-    public static void stopJ2EEContinerAndAxisServlet(Kernel kernel) throws Exception{
+
+    public static void stopJ2EEContinerAndAxisServlet(Kernel kernel) throws Exception {
         j2eeManager.stopJ2EEContainer(kernel);
     }
-    
+
     public static ResourceReferenceBuilder RESOURCE_REFERANCE_BUILDER = new ResourceReferenceBuilder() {
 
         public Reference createResourceRef(String containerId, Class iface) {
@@ -91,79 +91,80 @@
             return AxisGeronimoConstants.ACTIVATION_SPEC_INFO;
         }
 
-        public GBeanData locateResourceAdapterGBeanData(ObjectName resourceAdapterModuleName) throws DeploymentException {
+        public GBeanData locateResourceAdapterGBeanData(ObjectName resourceAdapterModuleName) {
             return null;
         }
 
-        public GBeanData locateAdminObjectInfo(ObjectName resourceAdapterModuleName, String adminObjectInterfaceName) throws DeploymentException {
+        public GBeanData locateAdminObjectInfo(ObjectName resourceAdapterModuleName, String adminObjectInterfaceName) {
             return null;
         }
 
-        public GBeanData locateConnectionFactoryInfo(ObjectName resourceAdapterModuleName, String connectionFactoryInterfaceName) throws DeploymentException {
+        public GBeanData locateConnectionFactoryInfo(ObjectName resourceAdapterModuleName, String connectionFactoryInterfaceName) {
             return null;
         }
     };
-    
-    
+
+
     public static void buildConfiguration(File jarfile,
             ConfigurationStore store,
             EARConfigBuilder earConfigBuilder,
             Kernel kernel,
-            ObjectName wsConfgBuilderName)throws Exception{
-        URI ejbURI = null;
-        ObjectName wsconf = new ObjectName("geronimo.test:name=" + jarfile.getName()+",value=check");
+            ObjectName wsConfgBuilderName) throws Exception {
+
+        ObjectName wsconf = new ObjectName("geronimo.test:name=" + jarfile.getName() + ",value=check");
         URI wsURI = new URI("new");
 
         WSPlan plan = null;
-        
+
         Enumeration entires = new JarFile(jarfile).entries();
         while (entires.hasMoreElements()) {
             ZipEntry zipe = (ZipEntry) entires.nextElement();
             String name = zipe.getName();
             if (name.endsWith("/ejb-jar.xml")) {
-                ObjectName ejbConfName = TestingUtils.installAndStartEJB(jarfile,store,earConfigBuilder,kernel);
-                plan = WSPlan.createPlan(wsURI,wsconf,ejbConfName,jarfile);
+                ObjectName ejbConfName = TestingUtils.installAndStartEJB(jarfile, store, earConfigBuilder, kernel);
+                plan = WSPlan.createPlan(wsURI, wsconf, ejbConfName, jarfile);
                 break;
             }
         }
-        
-        if(plan == null){
-            plan = WSPlan.createPlan(wsURI,wsconf,jarfile);
+
+        if (plan == null) {
+            plan = WSPlan.createPlan(wsURI, wsconf, jarfile);
         }
         File wsinstallDir = store.createNewConfigurationDir();
-        
-        kernel.invoke(wsConfgBuilderName,"buildConfiguration",
-            new Object[]{plan, null, wsinstallDir},
-            new String[]{Object.class.getName(),
-                JarFile.class.getName(),
-                File.class.getName()});
+
+        kernel.invoke(wsConfgBuilderName, "buildConfiguration",
+                new Object[]{plan, null, wsinstallDir},
+                new String[]{Object.class.getName(),
+                             JarFile.class.getName(),
+                             File.class.getName()});
         //wsconfBuilder.buildConfiguration(plan, null, wsinstallDir);
         
         URI wsInstalledURI = store.install(wsinstallDir);
-        GBeanMBean config = store.getConfiguration(wsInstalledURI);
+        GBeanData config = store.getConfiguration(wsInstalledURI);
         ConfigurationManager configurationManager = kernel.getConfigurationManager();
-        ObjectName configName = configurationManager.load(config, null);
+        ObjectName configName = configurationManager.load(config, null, Configuration.class.getClassLoader());
         kernel.startRecursiveGBean(configName);
-    
+
     }
-    
+
     public static ObjectName installAndStartEJB(File jarfile,
             ConfigurationStore store,
             EARConfigBuilder earConfigBuilder,
-            Kernel kernel)throws Exception{
-            JarFile module = new JarFile(jarfile);
-            File unpackedDir = store.createNewConfigurationDir();
-            //Install the EJB
-            Object ejbplan = earConfigBuilder.getDeploymentPlan(null, module);
-            earConfigBuilder.buildConfiguration(ejbplan, module, unpackedDir);
-            URI ejbURI = store.install(unpackedDir);
+            Kernel kernel) throws Exception {
 
-        
-          GBeanMBean config = store.getConfiguration(ejbURI);
-          ConfigurationManager configurationManager = kernel.getConfigurationManager();
-          ObjectName configName = configurationManager.load(config, store.getBaseURL(ejbURI));
-          kernel.startRecursiveGBean(configName);
-          return configName;
+        JarFile module = new JarFile(jarfile);
+        File unpackedDir = store.createNewConfigurationDir();
+        //Install the EJB
+        Object ejbplan = earConfigBuilder.getDeploymentPlan(null, module);
+        earConfigBuilder.buildConfiguration(ejbplan, module, unpackedDir);
+        URI ejbURI = store.install(unpackedDir);
+
+
+        GBeanData config = store.getConfiguration(ejbURI);
+        ConfigurationManager configurationManager = kernel.getConfigurationManager();
+        ObjectName configName = configurationManager.load(config, store.getBaseURL(ejbURI), Configuration.class.getClassLoader());
+        kernel.startRecursiveGBean(configName);
+        return configName;
     }
 
 }

Modified: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java
Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java?view=diff&rev=109772&p1=geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java&r1=109771&p2=geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java&r2=109772
==============================================================================
--- geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java	(original)
+++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java	Fri Dec  3 21:06:02 2004
@@ -448,7 +448,19 @@
         // persist all the GBeans in this Configuration
         // save the dependencies and classpath
         try {
-            config.setAttribute("gBeanState", Configuration.storeGBeans(gbeans));
+            GBeanData[] gbeanArray = new GBeanData[gbeans.size()];
+            Iterator iterator = gbeans.entrySet().iterator();
+            for (int i = 0; i < gbeanArray.length; i++) {
+                Map.Entry entry = (Map.Entry) iterator.next();
+                Object gbean = entry.getValue();
+                if (gbean instanceof GBeanMBean) {
+                    gbeanArray[i] = ((GBeanMBean) gbean).getGBeanData();
+                    gbeanArray[i].setName((ObjectName) entry.getKey());
+                } else {
+                    gbeanArray[i] = (GBeanData) gbean;
+                }
+            }
+            config.setAttribute("gBeanState", Configuration.storeGBeans(gbeanArray));
             config.setReferencePatterns("Repositories", Collections.singleton(new ObjectName("*:role=Repository,*")));
             config.setAttribute("dependencies", new ArrayList(dependencies));
             config.setAttribute("classPath", new ArrayList(classPath));

Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBean.java
Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBean.java?view=diff&rev=109772&p1=geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBean.java&r1=109771&p2=geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBean.java&r2=109772
==============================================================================
--- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBean.java	(original)
+++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBean.java	Fri Dec  3 21:06:02 2004
@@ -194,6 +194,10 @@
         return mbeanInfo;
     }
 
+    public ClassLoader getClassLoader() {
+        return classLoader;
+    }
+
     public synchronized ObjectName preRegister(MBeanServer server, ObjectName objectName) throws Exception {
         if (gbeanInstance == null) {
             this.objectName = objectName;

Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/Kernel.java
Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/Kernel.java?view=diff&rev=109772&p1=geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/Kernel.java&r1=109771&p2=geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/Kernel.java&r2=109772
==============================================================================
--- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/Kernel.java	(original)
+++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/Kernel.java	Fri Dec  3 21:06:02 2004
@@ -410,13 +410,10 @@
      * @deprecated use loadGBean(GBeanData gbeanData, ClassLoader classLoader)
      */
     public void loadGBean(ObjectName name, GBeanMBean gbean) throws GBeanAlreadyExistsException, InternalKernelException {
-        try {
-            mbServer.registerMBean(gbean, name);
-        } catch (InstanceAlreadyExistsException e) {
-            throw new GBeanAlreadyExistsException(name.getCanonicalName());
-        } catch (Exception e) {
-            throw new InternalKernelException("Error loading GBean " + name.getCanonicalName(), unwrapJMException(e));
-        }
+        GBeanData gbeanData = gbean.getGBeanData();
+        gbeanData.setName(name);
+        ClassLoader classLoader = gbean.getClassLoader();
+        loadGBean(gbeanData, classLoader);
     }
 
     public void startGBean(ObjectName name) throws GBeanNotFoundException, InternalKernelException {

Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java
Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java?view=diff&rev=109772&p1=geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java&r1=109771&p2=geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java&r2=109772
==============================================================================
--- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java	(original)
+++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java	Fri Dec  3 21:06:02 2004
@@ -28,6 +28,7 @@
 import java.net.URI;
 import java.net.URL;
 import java.net.URLClassLoader;
+import java.net.MalformedURLException;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
@@ -47,7 +48,7 @@
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
-import org.apache.geronimo.gbean.jmx.GBeanMBean;
+import org.apache.geronimo.gbean.WaitingException;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.jmx.JMXUtil;
 import org.apache.geronimo.kernel.repository.MissingDependencyException;
@@ -89,26 +90,55 @@
         return new ObjectName("geronimo.config:name=" + ObjectName.quote(configID.toString()));
     }
 
+    /**
+     * The kernel in which this configuration is registered
+     */
     private final Kernel kernel;
+
+    /**
+     * The registered objectName for this configuraion
+     */
     private final String objectNameString;
     private final ObjectName objectName;
+
+    /**
+     * URI used to referr to this configuration in the configuration manager
+     */
     private final URI id;
+
     /**
      * Identifies the type of configuration (WAR, RAR et cetera)
      */
     private final ConfigurationModuleType moduleType;
+
+    /**
+     * The uri of the parent of this configuration.  May be null.
+     */
     private final URI parentID;
-    private final ConfigurationParent parent;
-    private final List classPath;
-    private final List dependencies;
-    private byte[] gbeanState;
-    private final Collection repositories;
+
+    /**
+     * The configuration store from which this configuration was loaded.  May be null if this configuration
+     * was not loaded from a store.  The store is notified when the configurations stopps so it can update
+     * the saved state of the configration.
+     */
     private final ConfigurationStore configurationStore;
 
-    private URL baseURL;
-    private Set objectNames;
+    /**
+     * The names of all GBeans contained in this configuration.
+     */
+    private final Set objectNames;
+
+    /**
+     * The classloadeder used to load the child GBeans contained in this configuration.
+     */
+    private final ClassLoader configurationClassLoader;
 
-    private ClassLoader configurationClassLoader;
+    /**
+     * The GBeanData for the GBeans contained in this configuration.  These must be persisted as a ByteArray, becuase
+     * the data can only be deserialized in the configurationClassLoader, which is not available until this Configuration
+     * is deserialized and started.
+     */
+    private byte[] gbeanState;
 
     /**
      * Constructor that can be used to create an offline Configuration, typically
@@ -122,53 +152,31 @@
      * @param repositories a Collection<Repository> of repositories used to resolve dependencies
      * @param dependencies a List<URI> of dependencies
      */
-    public Configuration(Kernel kernel, String objectName, URI id, ConfigurationModuleType moduleType, URI parentID, ConfigurationParent parent, List classPath, byte[] gbeanState, Collection repositories, List dependencies, ConfigurationStore configurationStore) {
+    public Configuration(Kernel kernel,
+            String objectName,
+            URI id,
+            ConfigurationModuleType moduleType,
+            URL baseURL,
+            URI parentID,
+            ConfigurationParent parent,
+            List classPath,
+            byte[] gbeanState,
+            Collection repositories,
+            List dependencies,
+            ConfigurationStore configurationStore) throws Exception {
+
         this.kernel = kernel;
         this.objectNameString = objectName;
         this.objectName = JMXUtil.getObjectName(objectName);
         this.id = id;
         this.moduleType = moduleType;
         this.parentID = parentID;
-        this.parent = parent;
         this.gbeanState = gbeanState;
-        if (classPath == null) {
-            this.classPath = Collections.EMPTY_LIST;
-        } else {
-            this.classPath = classPath;
-        }
-        if (dependencies == null) {
-            this.dependencies = Collections.EMPTY_LIST;
-        } else {
-            this.dependencies = dependencies;
-        }
-        this.repositories = repositories;
+
         this.configurationStore = configurationStore;
-    }
 
-    public void doStart() throws Exception {
-        // build classpath
-        URL[] urls = new URL[dependencies.size() + classPath.size()];
-        int idx = 0;
-        for (Iterator i = dependencies.iterator(); i.hasNext();) {
-            URI uri = (URI) i.next();
-            URL url = null;
-            for (Iterator j = repositories.iterator(); j.hasNext();) {
-                Repository repository = (Repository) j.next();
-                if (repository.hasURI(uri)) {
-                    url = repository.getURL(uri);
-                    break;
-                }
-            }
-            if (url == null) {
-                throw new MissingDependencyException("Unable to resolve dependency " + uri);
-            }
-            urls[idx++] = url;
-        }
-        for (Iterator i = classPath.iterator(); i.hasNext();) {
-            URI uri = (URI) i.next();
-            urls[idx++] = new URL(baseURL, uri.toString());
-        }
-        assert idx == urls.length;
+        // build configurationClassLoader
+        URL[] urls = resolveClassPath(classPath, baseURL, dependencies, repositories);
         log.debug("ClassPath for " + id + " resolved to " + Arrays.asList(urls));
 
         if (parent == null) {
@@ -203,7 +211,7 @@
                 log.trace("Registering GBean " + name);
                 kernel.loadGBean(gbeanData, configurationClassLoader);
                 objectNames.add(name);
-                kernel.getDependencyManager().addDependency(name, objectName);
+                kernel.getDependencyManager().addDependency(name, this.objectName);
             }
             this.objectNames = objectNames;
         } finally {
@@ -213,6 +221,39 @@
         log.info("Started configuration " + id);
     }
 
+    private static URL[] resolveClassPath(List classPath, URL baseURL, List dependencies, Collection repositories) throws MalformedURLException, MissingDependencyException {
+        if (classPath == null) {
+            classPath = Collections.EMPTY_LIST;
+        }
+        if (dependencies == null) {
+            dependencies = Collections.EMPTY_LIST;
+        }
+
+        URL[] urls = new URL[dependencies.size() + classPath.size()];
+        int idx = 0;
+        for (Iterator i = dependencies.iterator(); i.hasNext();) {
+            URI uri = (URI) i.next();
+            URL url = null;
+            for (Iterator j = repositories.iterator(); j.hasNext();) {
+                Repository repository = (Repository) j.next();
+                if (repository.hasURI(uri)) {
+                    url = repository.getURL(uri);
+                    break;
+                }
+            }
+            if (url == null) {
+                throw new MissingDependencyException("Unable to resolve dependency " + uri);
+            }
+            urls[idx++] = url;
+        }
+        for (Iterator i = classPath.iterator(); i.hasNext();) {
+            URI uri = (URI) i.next();
+            urls[idx++] = new URL(baseURL, uri.toString());
+        }
+        assert idx == urls.length;
+        return urls;
+    }
+
     public String getObjectName() {
         return objectNameString;
     }
@@ -229,15 +270,27 @@
         }
     }
 
+    public void doStart() throws WaitingException, Exception {
+    }
+
     public void doStop() throws Exception {
         log.info("Stopping configuration " + id);
-        if (objectNames == null) {
-            return;
+
+        // get the gbean data for all gbeans
+        GBeanData[] gbeans = new GBeanData[objectNames.size()];
+        Iterator iterator = objectNames.iterator();
+        for (int i = 0; i < gbeans.length; i++) {
+            ObjectName objectName = (ObjectName) iterator.next();
+            try {
+                gbeans[i] = kernel.getGBeanData(objectName);
+            } catch (Exception e) {
+                throw new InvalidConfigException("Unable to serialize GBeanData for " + objectName, e);
+            }
         }
 
         // save state
         try {
-            gbeanState = storeGBeans(kernel, objectNames);
+            gbeanState = storeGBeans(gbeans);
         } catch (InvalidConfigException e) {
             log.info("Unable to update persistent state during shutdown", e);
         }
@@ -258,8 +311,6 @@
         if (configurationStore != null) {
             configurationStore.updateConfiguration(this);
         }
-
-        objectNames = null;
     }
 
     public void doFail() {
@@ -292,25 +343,7 @@
         return moduleType;
     }
 
-    /**
-     * Return the URL that is used to resolve relative classpath locations
-     *
-     * @return the base URL for the classpath
-     */
-    public URL getBaseURL() {
-        return baseURL;
-    }
-
-    /**
-     * Set the URL that should be used to resolve relative class locations
-     *
-     * @param baseURL the base URL for the classpath
-     */
-    public void setBaseURL(URL baseURL) {
-        this.baseURL = baseURL;
-    }
-
-    public byte[] getGbeanState() {
+    public byte[] getGBeanState() {
         return gbeanState;
     }
 
@@ -370,57 +403,11 @@
     /**
      * Return a byte array containing the persisted form of the supplied GBeans
      *
-     * @param gbeans a Map<ObjectName, GBeanMBean> of GBeans to store
-     * @return the persisted GBeans
-     * @throws org.apache.geronimo.kernel.config.InvalidConfigException
-     *          if there is a problem serializing the state
-     */
-    public static byte[] storeGBeans(Map 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 i = gbeans.entrySet().iterator(); i.hasNext();) {
-            Map.Entry entry = (Map.Entry) i.next();
-            ObjectName objectName = (ObjectName) entry.getKey();
-
-            // value may be either a gbeanMBean or a gbeanData
-            GBeanData gbeanData;
-            if (entry.getValue() instanceof GBeanMBean) {
-                GBeanMBean gbeanMBean = (GBeanMBean) entry.getValue();
-                gbeanData = gbeanMBean.getGBeanData();
-            } else {
-                gbeanData = (GBeanData) entry.getValue();
-            }
-            try {
-                // todo we must explicitly set the bean name here from the gbean key because the gbean mbean may
-                // not have been brought online, so the object namve in the gbean mbean will be null
-                gbeanData.setName(objectName);
-                gbeanData.writeExternal(oos);
-            } catch (Exception e) {
-                throw new InvalidConfigException("Unable to serialize GBeanData for " + objectName, e);
-            }
-        }
-        try {
-            oos.flush();
-        } catch (IOException e) {
-            throw (AssertionError) new AssertionError("Unable to flush ObjectOutputStream").initCause(e);
-        }
-        return baos.toByteArray();
-    }
-
-    /**
-     * Return a byte array containing the persisted form of the supplied GBeans
-     *
-     * @param objectNames object names of gbeans to store
+     * @param gbeans the gbean data to persist
      * @return the persisted GBeans
-     * @throws org.apache.geronimo.kernel.config.InvalidConfigException
-     *          if there is a problem serializing the state
+     * @throws org.apache.geronimo.kernel.config.InvalidConfigException if there is a problem serializing the state
      */
-    private static byte[] storeGBeans(Kernel kernel, Set objectNames) throws InvalidConfigException {
+    public static byte[] storeGBeans(GBeanData[] gbeans) throws InvalidConfigException {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStream oos;
         try {
@@ -428,13 +415,12 @@
         } catch (IOException e) {
             throw (AssertionError) new AssertionError("Unable to initialize ObjectOutputStream").initCause(e);
         }
-        for (Iterator i = objectNames.iterator(); i.hasNext();) {
-            ObjectName objectName = (ObjectName) i.next();
+        for (int i = 0; i < gbeans.length; i++) {
+            GBeanData gbeanData = gbeans[i];
             try {
-                GBeanData gbeanData = kernel.getGBeanData(objectName);
                 gbeanData.writeExternal(oos);
             } catch (Exception e) {
-                throw new InvalidConfigException("Unable to serialize GBeanData for " + objectName, e);
+                throw new InvalidConfigException("Unable to serialize GBeanData for " + gbeanData.getName(), e);
             }
         }
         try {
@@ -469,6 +455,7 @@
             "objectName",
             "ID",
             "type",
+            "baseURL",
             "parentID",
             "Parent",
             "classPath",

Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java
Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java?view=diff&rev=109772&p1=geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java&r1=109771&p2=geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java&r2=109772
==============================================================================
--- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java	(original)
+++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java	Fri Dec  3 21:06:02 2004
@@ -50,11 +50,6 @@
     ObjectName load(URI configID) throws NoSuchConfigException, IOException, InvalidConfigException;
 
     /**
-     * @deprecated use load(GBeanData config, URL rootURL, ClassLoader classLoader)
-     */
-    ObjectName load(GBeanMBean config, URL rootURL) throws InvalidConfigException;
-
-    /**
      * Load the supplied Configuration into the Kernel and override the default JMX name.
      * This method should be used with discretion as it is possible to create
      * Configurations that cannot be located by management or monitoring tools.

Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java
Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java?view=diff&rev=109772&p1=geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java&r1=109771&p2=geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java&r2=109772
==============================================================================
--- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java	(original)
+++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java	Fri Dec  3 21:06:02 2004
@@ -35,7 +35,6 @@
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
-import org.apache.geronimo.gbean.jmx.GBeanMBean;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.InternalKernelException;
 import org.apache.geronimo.kernel.Kernel;
@@ -94,7 +93,7 @@
                     }
                     ConfigurationModuleType type = null;
                     try {
-                        GBeanMBean bean = store.getConfiguration(configID);
+                        GBeanData bean = store.getConfiguration(configID);
                         type = (ConfigurationModuleType) bean.getAttribute("type");
                     } catch (Exception e) {
                         log.error(store + " defines configID " + configID + " which can not be loaded.");
@@ -122,51 +121,12 @@
         for (int i = 0; i < storeSnapshot.size(); i++) {
             ConfigurationStore store = (ConfigurationStore) storeSnapshot.get(i);
             if (store.containsConfiguration(configID)) {
-                GBeanMBean config = store.getConfiguration(configID);
+                GBeanData config = store.getConfiguration(configID);
                 URL baseURL = store.getBaseURL(configID);
-                return load(config, baseURL);
+                return load(config, baseURL, Configuration.class.getClassLoader());
             }
         }
         throw new NoSuchConfigException("No configuration with id: " + configID);
-    }
-
-    /**
-     * @deprecated use load(GBeanData config, URL rootURL, ClassLoader classLoader)
-     */
-    public ObjectName load(GBeanMBean config, URL rootURL) throws InvalidConfigException {
-        URI configID;
-        try {
-            configID = (URI) config.getAttribute("ID");
-        } catch (Exception e) {
-            throw new InvalidConfigException("Cannot get config ID", e);
-        }
-
-        ObjectName configName;
-        try {
-            configName = Configuration.getConfigurationObjectName(configID);
-        } catch (MalformedObjectNameException e) {
-            throw new InvalidConfigException("Cannot convert ID to ObjectName: ", e);
-        }
-
-        try {
-            kernel.loadGBean(configName, config);
-        } catch (Exception e) {
-            throw new InvalidConfigException("Unable to register configuration", e);
-        }
-
-        try {
-            config.setAttribute("baseURL", rootURL);
-        } catch (Exception e) {
-            try {
-                kernel.unloadGBean(configName);
-            } catch (Exception ignored) {
-                // ignore
-            }
-            throw new InvalidConfigException("Cannot set baseURL", e);
-        }
-        log.info("Loaded Configuration " + configName);
-
-        return configName;
     }
 
     public ObjectName load(GBeanData config, URL rootURL, ClassLoader classLoader) throws InvalidConfigException {

Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java
Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java?view=diff&rev=109772&p1=geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java&r1=109771&p2=geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java&r2=109772
==============================================================================
--- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java	(original)
+++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java	Fri Dec  3 21:06:02 2004
@@ -17,13 +17,13 @@
 
 package org.apache.geronimo.kernel.config;
 
-import java.io.IOException;
 import java.io.File;
+import java.io.IOException;
 import java.net.URI;
 import java.net.URL;
 import java.util.List;
 
-import org.apache.geronimo.gbean.jmx.GBeanMBean;
+import org.apache.geronimo.gbean.GBeanData;
 
 /**
  * Interface to a store for Configurations.
@@ -63,12 +63,12 @@
      * Return the Configuration GBean for the specified ID
      *
      * @param id the unique ID of a Configuration
-     * @return the GBeanMBean for that configuration
+     * @return the GBeanData for that configuration
      * @throws NoSuchConfigException if the store does not contain a Configuration with that id
      * @throws IOException if there was a problem loading the Configuration from the store
      * @throws InvalidConfigException if the Configuration is invalid
      */
-    GBeanMBean getConfiguration(URI id) throws NoSuchConfigException, IOException, InvalidConfigException;
+    GBeanData getConfiguration(URI id) throws NoSuchConfigException, IOException, InvalidConfigException;
 
     /**
      * Updates the saved state of the configuration.

Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Run.java
Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Run.java?view=diff&rev=109772&p1=geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Run.java&r1=109771&p2=geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Run.java&r2=109772
==============================================================================
--- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Run.java	(original)
+++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Run.java	Fri Dec  3 21:06:02 2004
@@ -23,7 +23,6 @@
 import java.util.jar.Manifest;
 import javax.management.ObjectName;
 
-import org.apache.geronimo.gbean.jmx.GBeanMBean;
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.log.GeronimoLogging;
@@ -62,16 +61,15 @@
         try {
             kernel.boot();
 
-            GBeanMBean config;
+            GBeanData config = new GBeanData();
             ObjectInputStream ois = new ObjectInputStream(cl.getResourceAsStream("META-INF/config.ser"));
             try {
                 GBeanData gbeanData = new GBeanData();
                 gbeanData.readExternal(ois);
-                config = new GBeanMBean(gbeanData, cl);
             } finally {
                 ois.close();
             }
-            final ObjectName configName = kernel.getConfigurationManager().load(config, cl.getResource("/"));
+            final ObjectName configName = kernel.getConfigurationManager().load(config, cl.getResource("/"), cl);
 
             Runtime.getRuntime().addShutdownHook(new Thread("Shutdown Thread") {
                 public void run() {

Modified: geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java
Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java?view=diff&rev=109772&p1=geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java&r1=109771&p2=geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java&r2=109772
==============================================================================
--- geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java	(original)
+++ geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java	Fri Dec  3 21:06:02 2004
@@ -19,8 +19,6 @@
 
 import java.net.URI;
 import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
 import javax.management.ObjectName;
 
 import junit.framework.TestCase;
@@ -39,8 +37,9 @@
     private ObjectName gbeanName2;
 
     public void testOnlineConfig() throws Exception {
-        GBeanData config = new GBeanData(Configuration.GBEAN_INFO);
-        config.setAttribute("ID", new URI("test"));
+        URI id = new URI("test");
+        GBeanData config = new GBeanData(Configuration.getConfigurationObjectName(id), Configuration.GBEAN_INFO);
+        config.setAttribute("ID", id);
         config.setReferencePatterns("Parent", null);
         config.setAttribute("classPath", Collections.EMPTY_LIST);
         config.setAttribute("gBeanState", state);
@@ -105,10 +104,7 @@
         mockBean2.setReferencePatterns("MockEndpoint", Collections.singleton(gbeanName1));
         mockBean2.setReferencePatterns("EndpointCollection", Collections.singleton(gbeanName1));
 
-        Map gbeans = new HashMap();
-        gbeans.put(gbeanName1, mockBean1);
-        gbeans.put(gbeanName2, mockBean2);
-        state = Configuration.storeGBeans(gbeans);
+        state = Configuration.storeGBeans(new GBeanData[] {mockBean1, mockBean2});
     }
 
     protected void tearDown() throws Exception {

Modified: geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/config/RunTest.java
Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/config/RunTest.java?view=diff&rev=109772&p1=geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/config/RunTest.java&r1=109771&p2=geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/config/RunTest.java&r2=109772
==============================================================================
--- geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/config/RunTest.java	(original)
+++ geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/config/RunTest.java	Fri Dec  3 21:06:02 2004
@@ -23,8 +23,6 @@
 import java.io.ObjectOutputStream;
 import java.net.URI;
 import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
 import java.util.jar.Attributes;
 import java.util.jar.JarOutputStream;
 import java.util.jar.Manifest;
@@ -32,7 +30,7 @@
 import javax.management.ObjectName;
 
 import junit.framework.TestCase;
-import org.apache.geronimo.gbean.jmx.GBeanMBean;
+import org.apache.geronimo.gbean.GBeanData;
 
 /**
  * 
@@ -50,14 +48,15 @@
         super.setUp();
 
         try {
-            Map gbeans = new HashMap();
             ObjectName objectName = new ObjectName("test:name=MyGBean");
-            gbeans.put(objectName, new GBeanMBean(MyGBean.GBEAN_INFO));
-            GBeanMBean config = new GBeanMBean(Configuration.GBEAN_INFO);
-            config.setAttribute("ID", URI.create("org/apache/geronimo/run-test"));
+            GBeanData myGBeanData = new GBeanData(objectName, MyGBean.GBEAN_INFO);
+
+            URI id = URI.create("org/apache/geronimo/run-test");
+            GBeanData config = new GBeanData(Configuration.getConfigurationObjectName(id), Configuration.GBEAN_INFO);
+            config.setAttribute("ID", id);
             config.setReferencePatterns("Parent", null);
             config.setAttribute("classPath", Collections.EMPTY_LIST);
-            config.setAttribute("gBeanState", Configuration.storeGBeans(gbeans));
+            config.setAttribute("gBeanState", Configuration.storeGBeans(new GBeanData[] {myGBeanData}));
 
             carFile = File.createTempFile("run", ".car");
             Manifest manifest = new Manifest();
@@ -69,7 +68,7 @@
             JarOutputStream jos = new JarOutputStream(new FileOutputStream(carFile), manifest);
             jos.putNextEntry(new ZipEntry("META-INF/config.ser"));
             ObjectOutputStream oos = new ObjectOutputStream(jos);
-            config.getGBeanData().writeExternal(oos);
+            config.writeExternal(oos);
             oos.flush();
             jos.closeEntry();
             jos.putNextEntry(new ZipEntry("org/apache/geronimo/kernel/config/MyGBean.class"));

Modified: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/LocalConfigStore.java
Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/LocalConfigStore.java?view=diff&rev=109772&p1=geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/LocalConfigStore.java&r1=109771&p2=geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/LocalConfigStore.java&r2=109772
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/LocalConfigStore.java	(original)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/LocalConfigStore.java	Fri Dec  3 21:06:02 2004
@@ -47,7 +47,6 @@
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.gbean.WaitingException;
-import org.apache.geronimo.gbean.jmx.GBeanMBean;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
@@ -186,7 +185,7 @@
 
         URI configId;
         try {
-            GBeanMBean config = loadConfig(configurationDir);
+            GBeanData config = loadConfig(configurationDir);
             configId = (URI) config.getAttribute("ID");
             index.setProperty(configId.toString(), configurationDir.getName());
         } catch (Exception e) {
@@ -212,7 +211,7 @@
 
         URI configId;
         try {
-            GBeanMBean config = loadConfig(source);
+            GBeanData config = loadConfig(source);
             configId = (URI) config.getAttribute("ID");
             index.setProperty(configId.toString(), source.getName());
         } catch (Exception e) {
@@ -247,7 +246,7 @@
         delete(configDir);
     }
 
-    public synchronized GBeanMBean getConfiguration(URI configID) throws NoSuchConfigException, IOException, InvalidConfigException {
+    public synchronized GBeanData getConfiguration(URI configID) throws NoSuchConfigException, IOException, InvalidConfigException {
         return loadConfig(getRoot(configID));
     }
 
@@ -305,7 +304,7 @@
         return new File(rootDir, id);
     }
 
-    private GBeanMBean loadConfig(File configRoot) throws IOException, InvalidConfigException {
+    private GBeanData loadConfig(File configRoot) throws IOException, InvalidConfigException {
         File file = new File(configRoot, "META-INF/state.ser");
         if (!file.isFile()) {
             file = new File(configRoot, "META-INF/config.ser");
@@ -317,18 +316,15 @@
         FileInputStream fis = new FileInputStream(file);
         try {
             ObjectInputStream ois = new ObjectInputStream(new BufferedInputStream(fis));
-            GBeanMBean config;
+            GBeanData config = new GBeanData();
             try {
-                GBeanData gbeanData = new GBeanData();
-                gbeanData.readExternal(ois);
-                config = new GBeanMBean(gbeanData, Configuration.class.getClassLoader());
+                config.readExternal(ois);
             } catch (ClassNotFoundException e) {
                 //TODO more informative exceptions
                 throw new InvalidConfigException("Unable to read attribute ", e);
             } catch (Exception e) {
                 throw new InvalidConfigException("Unable to set attribute ", e);
             }
-
             config.setReferencePattern("ConfigurationStore", objectName);
             return config;
         } finally {

Modified: geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/configuration/LocalConfigStoreTest.java
Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/configuration/LocalConfigStoreTest.java?view=diff&rev=109772&p1=geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/configuration/LocalConfigStoreTest.java&r1=109771&p2=geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/configuration/LocalConfigStoreTest.java&r2=109772
==============================================================================
--- geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/configuration/LocalConfigStoreTest.java	(original)
+++ geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/configuration/LocalConfigStoreTest.java	Fri Dec  3 21:06:02 2004
@@ -23,15 +23,12 @@
 import java.io.ObjectOutputStream;
 import java.net.URI;
 import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
 import java.util.jar.JarOutputStream;
 import java.util.zip.ZipEntry;
 import javax.management.ObjectName;
 
 import junit.framework.TestCase;
 import org.apache.geronimo.gbean.GBeanData;
-import org.apache.geronimo.gbean.jmx.GBeanMBean;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
@@ -59,7 +56,7 @@
         assertEquals(new File(root, "1").toURL(),
             kernel.invoke(storeName, "getBaseURL", new Object[] {uri}, new String[] {"java.net.URI"}));
 
-        GBeanMBean config = (GBeanMBean) kernel.invoke(storeName, "getConfiguration", new Object[] {uri}, new String[] {"java.net.URI"});
+        GBeanData config = (GBeanData) kernel.invoke(storeName, "getConfiguration", new Object[] {uri}, new String[] {"java.net.URI"});
         assertEquals(uri, config.getAttribute("ID"));
     }
 
@@ -118,22 +115,19 @@
 
     protected void setUp() throws Exception {
         try {
-            kernel = new Kernel("test.kernel", "geronimo");
+            kernel = new Kernel("test.kernel");
             kernel.boot();
 
             gbeanName1 = new ObjectName("geronimo.test:name=MyMockGMBean1");
-            GBeanMBean mockBean1 = new GBeanMBean(MockGBean.getGBeanInfo());
+            GBeanData mockBean1 = new GBeanData(gbeanName1, MockGBean.getGBeanInfo());
             mockBean1.setAttribute("value", "1234");
 
             gbeanName2 = new ObjectName("geronimo.test:name=MyMockGMBean2");
-            GBeanMBean mockBean2 = new GBeanMBean(MockGBean.getGBeanInfo());
+            GBeanData mockBean2 = new GBeanData(gbeanName2, MockGBean.getGBeanInfo());
             mockBean2.setAttribute("gbeanEnabled", Boolean.FALSE);
             mockBean2.setAttribute("value", "1234");
 
-            Map gbeans = new HashMap();
-            gbeans.put(gbeanName1, mockBean1);
-            gbeans.put(gbeanName2, mockBean2);
-            state = Configuration.storeGBeans(gbeans);
+            state = Configuration.storeGBeans(new GBeanData[] {mockBean1, mockBean2});
 
             root = new File(System.getProperty("java.io.tmpdir") + "/config-store");
             recursiveDelete(root);
@@ -146,8 +140,8 @@
             kernel.loadGBean(store, getClass().getClassLoader());
             kernel.startGBean(storeName);
 
-            GBeanMBean gbean = new GBeanMBean(Configuration.GBEAN_INFO);
             uri = new URI("test");
+            GBeanData gbean = new GBeanData(Configuration.getConfigurationObjectName(uri), Configuration.GBEAN_INFO);
             gbean.setAttribute("ID", uri);
             gbean.setAttribute("gBeanState", state);
 
@@ -157,7 +151,7 @@
             JarOutputStream jos = new JarOutputStream(new BufferedOutputStream(new FileOutputStream(sourceFile)));
             jos.putNextEntry(new ZipEntry("META-INF/config.ser"));
             ObjectOutputStream oos = new ObjectOutputStream(jos);
-            gbean.getGBeanData().writeExternal(oos);
+            gbean.writeExternal(oos);
             oos.flush();
             jos.closeEntry();
             jos.close();

Modified: geronimo/trunk/plugins/maven-geronimo-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StartServer.java
Url: http://svn.apache.org/viewcvs/geronimo/trunk/plugins/maven-geronimo-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StartServer.java?view=diff&rev=109772&p1=geronimo/trunk/plugins/maven-geronimo-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StartServer.java&r1=109771&p2=geronimo/trunk/plugins/maven-geronimo-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StartServer.java&r2=109772
==============================================================================
--- geronimo/trunk/plugins/maven-geronimo-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StartServer.java	(original)
+++ geronimo/trunk/plugins/maven-geronimo-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StartServer.java	Fri Dec  3 21:06:02 2004
@@ -28,7 +28,6 @@
 import javax.management.ObjectName;
 
 import org.apache.geronimo.gbean.GBeanData;
-import org.apache.geronimo.gbean.jmx.GBeanMBean;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
 import org.apache.geronimo.kernel.log.GeronimoLogging;
@@ -97,12 +96,10 @@
         URL systemURL = new File(root, "bin/server.jar").toURL();
 //        System.out.println("systemURL = " + systemURL);
         URL configURL = new URL("jar:" + systemURL.toString() + "!/META-INF/config.ser");
-        GBeanMBean configuration;
+        GBeanData configuration = new GBeanData();
         ObjectInputStream ois = new ObjectInputStream(configURL.openStream());
         try {
-            GBeanData gbeanData = new GBeanData();
-            gbeanData.readExternal(ois);
-            configuration = new GBeanMBean(gbeanData, this.getClass().getClassLoader());
+            configuration.readExternal(ois);
         } finally {
             ois.close();
         }
@@ -112,7 +109,7 @@
         kernel.boot();
 
         ConfigurationManager configurationManager = kernel.getConfigurationManager();
-        ObjectName configName = configurationManager.load(configuration, systemURL);
+        ObjectName configName = configurationManager.load(configuration, systemURL, this.getClass().getClassLoader());
         kernel.startRecursiveGBean(configName);
 
         // load the rest of the configuration listed on the command line