geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r386276 [2/4] - in /geronimo/branches/1.1: applications/console-core/src/java/org/apache/geronimo/console/util/ applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/handlers/ configs/client-system/src/plan/ configs/...
Date Thu, 16 Mar 2006 06:49:41 GMT
Modified: geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EJBRefContextTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EJBRefContextTest.java?rev=386276&r1=386275&r2=386276&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EJBRefContextTest.java (original)
+++ geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EJBRefContextTest.java Wed Mar 15 22:49:33 2006
@@ -34,8 +34,8 @@
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.config.Configuration;
-import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.Naming;
+import org.apache.geronimo.kernel.Jsr77Naming;
 
 /**
  * @version $Rev:385692 $ $Date$
@@ -168,23 +168,23 @@
 
         refContext = new RefContext(new MockEjbReferenceBuilder(), new MockResourceReferenceBuilder(), new MockServiceReferenceBuilder());
 
-        AbstractName applicationName = Naming.createRootName(new Artifact("test", "stuff", "", "ear"), "app", NameFactory.J2EE_APPLICATION) ;
-        ConfigurationData bootstrap = new ConfigurationData(new Artifact("test", "test", "", "car"));
+        Naming naming = new Jsr77Naming();
+        AbstractName applicationName = naming.createRootName(new Artifact("test", "stuff", "", "ear"), "app", NameFactory.J2EE_APPLICATION) ;
 
-        configuration = null;
 
-        AbstractName coffeeName = Naming.createChildName(applicationName, NameFactory.EJB_MODULE, coffee);
-        coffee_peaberry = Naming.createChildName(coffeeName, NameFactory.STATELESS_SESSION_BEAN, "peaberry");
-        coffee_java = Naming.createChildName(coffeeName, NameFactory.STATELESS_SESSION_BEAN, "java");
-
-        AbstractName languageName = Naming.createChildName(applicationName, NameFactory.EJB_MODULE, language);
-        language_lisp = Naming.createChildName(languageName, NameFactory.STATELESS_SESSION_BEAN, "lisp");
-        language_java = Naming.createChildName(languageName, NameFactory.STATELESS_SESSION_BEAN, "java");
-
-        AbstractName carName = Naming.createChildName(applicationName, NameFactory.EJB_MODULE, car);
-        AbstractName car_gt = Naming.createChildName(carName, NameFactory.STATELESS_SESSION_BEAN, "gt");
-        car_enzo = Naming.createChildName(carName, NameFactory.STATELESS_SESSION_BEAN, "enzo");
+        AbstractName coffeeName = naming.createChildName(applicationName, coffee, NameFactory.EJB_MODULE);
+        coffee_peaberry = naming.createChildName(coffeeName, "peaberry", NameFactory.STATELESS_SESSION_BEAN);
+        coffee_java = naming.createChildName(coffeeName, "java", NameFactory.STATELESS_SESSION_BEAN);
 
+        AbstractName languageName = naming.createChildName(applicationName, language, NameFactory.EJB_MODULE);
+        language_lisp = naming.createChildName(languageName, "lisp", NameFactory.STATELESS_SESSION_BEAN);
+        language_java = naming.createChildName(languageName, "java", NameFactory.STATELESS_SESSION_BEAN);
+
+        AbstractName carName = naming.createChildName(applicationName, car, NameFactory.EJB_MODULE);
+        AbstractName car_gt = naming.createChildName(carName, "gt", NameFactory.STATELESS_SESSION_BEAN);
+        car_enzo = naming.createChildName(carName, "enzo", NameFactory.STATELESS_SESSION_BEAN);
+
+//        configuration = null;        
 //        configuration.addGBean(new GBeanData(coffee_peaberry, null));
 //        configuration.addGBean(new GBeanData(coffee_java, null));
 //

Modified: geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockConnectorConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockConnectorConfigBuilder.java?rev=386276&r1=386275&r2=386276&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockConnectorConfigBuilder.java (original)
+++ geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockConnectorConfigBuilder.java Wed Mar 15 22:49:33 2006
@@ -39,18 +39,18 @@
  * @version $Rev:385692 $ $Date$
  */
 public class MockConnectorConfigBuilder extends Assert implements ModuleBuilder, ResourceReferenceBuilder{
-    public EARContext earContext;
+    private EARContext earContext;
+    private ClassLoader cl;
     public Module connectorModule;
-    public ClassLoader cl;
 
-    public Module createModule(File plan, JarFile moduleFile) throws DeploymentException {
-        AbstractName earName = Naming.createRootName(new Artifact("test", "test-war", "", "rar"), NameFactory.NULL, NameFactory.J2EE_APPLICATION) ;
-        AbstractName moduleName = Naming.createChildName(earName, NameFactory.RESOURCE_ADAPTER_MODULE, "rar");
+    public Module createModule(File plan, JarFile moduleFile, Naming naming) throws DeploymentException {
+        AbstractName earName = naming.createRootName(new Artifact("test", "test-war", "", "rar"), NameFactory.NULL, NameFactory.J2EE_APPLICATION) ;
+        AbstractName moduleName = naming.createChildName(earName, "rar", NameFactory.RESOURCE_ADAPTER_MODULE);
         return new ConnectorModule(true, moduleName, null, moduleFile, "connector", null, null, null);
     }
 
-    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName) throws DeploymentException {
-        AbstractName moduleName = Naming.createChildName(earName, NameFactory.RESOURCE_ADAPTER_MODULE, "rar");
+    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming) throws DeploymentException {
+        AbstractName moduleName = naming.createChildName(earName, "rar", NameFactory.RESOURCE_ADAPTER_MODULE);
         return new ConnectorModule(false, moduleName, null, moduleFile, targetPath, null, null, null);
     }
 

Modified: geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockEJBConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockEJBConfigBuilder.java?rev=386276&r1=386275&r2=386276&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockEJBConfigBuilder.java (original)
+++ geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockEJBConfigBuilder.java Wed Mar 15 22:49:33 2006
@@ -21,12 +21,12 @@
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.apache.geronimo.kernel.Naming;
 import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.kernel.repository.Repository;
+import org.apache.geronimo.kernel.Naming;
 
 import javax.naming.Reference;
 import java.io.File;
@@ -39,18 +39,18 @@
  * @version $Rev:385692 $ $Date$
  */
 public class MockEJBConfigBuilder extends Assert implements ModuleBuilder, EJBReferenceBuilder {
-    public EARContext earContext;
+    private EARContext earContext;
+    private ClassLoader cl;
     public EJBModule ejbModule;
-    public ClassLoader cl;
 
-    public Module createModule(File plan, JarFile moduleFile) throws DeploymentException {
-        AbstractName earName = Naming.createRootName(new Artifact("test", "test-ejb-jar", "", "jar"), NameFactory.NULL, NameFactory.J2EE_APPLICATION) ;
-        AbstractName moduleName = Naming.createChildName(earName, NameFactory.EJB_MODULE, "ejb-jar");
+    public Module createModule(File plan, JarFile moduleFile, Naming naming) throws DeploymentException {
+        AbstractName earName = naming.createRootName(new Artifact("test", "test-ejb-jar", "", "jar"), NameFactory.NULL, NameFactory.J2EE_APPLICATION) ;
+        AbstractName moduleName = naming.createChildName(earName, "ejb-jar", NameFactory.EJB_MODULE);
         return new EJBModule(true, moduleName, null, moduleFile, "ejb.jar", null, null, null);
     }
 
-    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName) throws DeploymentException {
-        AbstractName moduleName = Naming.createChildName(earName, NameFactory.EJB_MODULE, "ejb-jar");
+    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming) throws DeploymentException {
+        AbstractName moduleName = naming.createChildName(earName, "ejb-jar", NameFactory.EJB_MODULE);
         return new EJBModule(false, moduleName, null, moduleFile, targetPath, null, null, null);
     }
 

Modified: geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockWARConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockWARConfigBuilder.java?rev=386276&r1=386275&r2=386276&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockWARConfigBuilder.java (original)
+++ geronimo/branches/1.1/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockWARConfigBuilder.java Wed Mar 15 22:49:33 2006
@@ -35,21 +35,21 @@
  * @version $Rev: 385487 $ $Date$
  */
 public class MockWARConfigBuilder extends Assert implements ModuleBuilder {
-    public EARContext earContext;
-    public WebModule webModule;
-    public ClassLoader cl;
-    public String contextRoot;
+    private EARContext earContext;
+    private ClassLoader cl;
     private Map portMap = null;
     private String namespace = "foo";
+    public WebModule webModule;
+    public String contextRoot;
 
-    public Module createModule(File plan, JarFile moduleFile) throws DeploymentException {
-        AbstractName earName = Naming.createRootName(new Artifact("test", "test-war", "", "war"), NameFactory.NULL, NameFactory.J2EE_APPLICATION) ;
-        AbstractName moduleName = Naming.createChildName(earName, NameFactory.WEB_MODULE, "war");
+    public Module createModule(File plan, JarFile moduleFile, Naming naming) throws DeploymentException {
+        AbstractName earName = naming.createRootName(new Artifact("test", "test-war", "", "war"), NameFactory.NULL, NameFactory.J2EE_APPLICATION) ;
+        AbstractName moduleName = naming.createChildName(earName, "war", NameFactory.WEB_MODULE);
         return new WebModule(true, moduleName, null, moduleFile, "war", null, null, null, contextRoot, portMap, namespace);
     }
 
-    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName) throws DeploymentException {
-        AbstractName moduleName = Naming.createChildName(earName, NameFactory.EJB_MODULE, "war");
+    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming) throws DeploymentException {
+        AbstractName moduleName = naming.createChildName(earName, "war", NameFactory.EJB_MODULE);
         return new WebModule(false, moduleName, null, moduleFile, targetPath, null, null, null, contextRoot, portMap, namespace);
     }
 

Modified: geronimo/branches/1.1/modules/j2ee/src/java/org/apache/geronimo/j2ee/j2eeobjectnames/NameFactory.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee/src/java/org/apache/geronimo/j2ee/j2eeobjectnames/NameFactory.java?rev=386276&r1=386275&r2=386276&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/j2ee/src/java/org/apache/geronimo/j2ee/j2eeobjectnames/NameFactory.java (original)
+++ geronimo/branches/1.1/modules/j2ee/src/java/org/apache/geronimo/j2ee/j2eeobjectnames/NameFactory.java Wed Mar 15 22:49:33 2006
@@ -20,7 +20,6 @@
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
-import org.apache.geronimo.kernel.Naming;
 
 import java.util.Properties;
 import java.util.Map;

Modified: geronimo/branches/1.1/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java?rev=386276&r1=386275&r2=386276&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java (original)
+++ geronimo/branches/1.1/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java Wed Mar 15 22:49:33 2006
@@ -171,7 +171,7 @@
         return kernel.getGBeanData(templateName);
     }
 
-    protected Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, boolean standAlone, String contextRoot, AbstractName earName) throws DeploymentException {
+    protected Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, boolean standAlone, String contextRoot, AbstractName earName, Naming naming) throws DeploymentException {
         assert moduleFile != null: "moduleFile is null";
         assert targetPath != null: "targetPath is null";
         assert !targetPath.endsWith("/"): "targetPath must not end with a '/'";
@@ -243,7 +243,7 @@
                 throw new DeploymentException("Could not construct standalone web module name", e);
             }
         } else {
-            moduleName = Naming.createChildName(earName, NameFactory.WEB_MODULE, targetPath);
+            moduleName = naming.createChildName(earName, targetPath, NameFactory.WEB_MODULE);
         }
 
         return new WebModule(standAlone, moduleName, environment, moduleFile, targetPath, webApp, jettyWebApp, specDD, contextRoot, portMap, JETTY_NAMESPACE);
@@ -541,7 +541,7 @@
                     Object defaultFilter = iterator.next();
                     GBeanData filterGBeanData = getGBeanData(kernel, defaultFilter);
                     String filterName = (String) filterGBeanData.getAttribute("filterName");
-                    AbstractName defaultFilterAbstractName = Naming.createChildName(moduleName, NameFactory.WEB_FILTER, filterName);
+                    AbstractName defaultFilterAbstractName = earContext.getNaming().createChildName(moduleName, filterName, NameFactory.WEB_FILTER);
                     filterGBeanData.setAbstractName(defaultFilterAbstractName);
                     filterGBeanData.setReferencePattern("JettyServletRegistration", moduleName);
                     moduleContext.addGBean(filterGBeanData);
@@ -552,7 +552,7 @@
                     filterMappingGBeanData.setReferencePattern("JettyServletRegistration", moduleName);
                     String urlPattern = "/*";
                     filterMappingGBeanData.setAttribute("urlPattern", urlPattern);
-                    AbstractName filterMappingName = Naming.createChildName(defaultFilterAbstractName, NameFactory.URL_WEB_FILTER_MAPPING, urlPattern);
+                    AbstractName filterMappingName = earContext.getNaming().createChildName(defaultFilterAbstractName, urlPattern, NameFactory.URL_WEB_FILTER_MAPPING);
                     filterMappingGBeanData.setAbstractName(filterMappingName);
                     previous = filterMappingName;
 
@@ -598,19 +598,19 @@
                 GBeanData filterMappingData = new GBeanData(JettyFilterMapping.GBEAN_INFO);
                 filterMappingData.setReferencePattern("Previous", previous);
                 filterMappingData.setReferencePattern("JettyServletRegistration", moduleName);
-                AbstractName filterAbstractName = Naming.createChildName(moduleName, NameFactory.WEB_FILTER, filterName);
+                AbstractName filterAbstractName = earContext.getNaming().createChildName(moduleName, filterName, NameFactory.WEB_FILTER);
 
                 AbstractName filterMappingName = null;
                 if (filterMappingType.isSetUrlPattern()) {
                     String urlPattern = filterMappingType.getUrlPattern().getStringValue().trim();
                     filterMappingData.setAttribute("urlPattern", urlPattern);
-                    filterMappingName = Naming.createChildName(filterAbstractName, NameFactory.URL_WEB_FILTER_MAPPING, urlPattern);
+                    filterMappingName = earContext.getNaming().createChildName(filterAbstractName, urlPattern, NameFactory.URL_WEB_FILTER_MAPPING);
                 }
                 if (filterMappingType.isSetServletName()) {
                     String servletName = filterMappingType.getServletName().getStringValue().trim();
-                    AbstractName servletAbstractName = Naming.createChildName(moduleName, NameFactory.SERVLET, servletName);
+                    AbstractName servletAbstractName = earContext.getNaming().createChildName(moduleName, servletName, NameFactory.SERVLET);
                     filterMappingData.setReferencePattern("Servlet", servletAbstractName);
-                    filterMappingName = Naming.createChildName(filterAbstractName, NameFactory.SERVLET_WEB_FILTER_MAPPING, servletName);
+                    filterMappingName = earContext.getNaming().createChildName(filterAbstractName, servletName, NameFactory.SERVLET_WEB_FILTER_MAPPING);
                 }
                 filterMappingData.setAbstractName(filterMappingName);
                 previous = filterMappingName;
@@ -643,7 +643,7 @@
             for (int i = 0; i < filterArray.length; i++) {
                 FilterType filterType = filterArray[i];
                 String filterName = filterType.getFilterName().getStringValue().trim();
-                AbstractName filterAbstractName = Naming.createChildName(moduleName, NameFactory.WEB_FILTER, filterName);
+                AbstractName filterAbstractName = earContext.getNaming().createChildName(moduleName, filterName, NameFactory.WEB_FILTER);
                 GBeanData filterData = new GBeanData(filterAbstractName, JettyFilterHolder.GBEAN_INFO);
                 filterData.setAttribute("filterName", filterName);
                 filterData.setAttribute("filterClass", filterType.getFilterClass().getStringValue().trim());
@@ -663,7 +663,7 @@
                 for (Iterator iterator = defaultServlets.iterator(); iterator.hasNext();) {
                     Object defaultServlet = iterator.next();
                     GBeanData servletGBeanData = getGBeanData(kernel, defaultServlet);
-                    AbstractName defaultServletObjectName = Naming.createChildName(moduleName, NameFactory.SERVLET, (String) servletGBeanData.getAttribute("servletName"));
+                    AbstractName defaultServletObjectName = earContext.getNaming().createChildName(moduleName, (String) servletGBeanData.getAttribute("servletName"), NameFactory.SERVLET);
                     servletGBeanData.setAbstractName(defaultServletObjectName);
                     servletGBeanData.setReferencePattern("JettyServletRegistration", moduleName);
                     Set defaultServletMappings = new HashSet((Collection) servletGBeanData.getAttribute("servletMappings"));
@@ -787,7 +787,7 @@
                             ClassLoader webClassLoader,
                             EARContext earContext) throws DeploymentException {
         String servletName = servletType.getServletName().getStringValue().trim();
-        AbstractName servletObjectName = Naming.createChildName(webModuleName, NameFactory.SERVLET, servletName);
+        AbstractName servletObjectName = earContext.getNaming().createChildName(webModuleName, servletName, NameFactory.SERVLET);
         GBeanData servletData;
         if (servletType.isSetServletClass()) {
             String servletClassName = servletType.getServletClass().getStringValue().trim();
@@ -830,7 +830,7 @@
         // http://issues.apache.org/jira/browse/GERONIMO-645
         if (null != previousServlet) {
             String name = previousServlet.getServletName().getStringValue().trim();
-            AbstractName oName = Naming.createChildName(webModuleName, NameFactory.SERVLET, name);
+            AbstractName oName = earContext.getNaming().createChildName(webModuleName, name, NameFactory.SERVLET);
             servletData.setReferencePattern("Previous", oName);
         }
 

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=386276&r1=386275&r2=386276&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 Wed Mar 15 22:49:33 2006
@@ -44,7 +44,7 @@
 import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
-import org.apache.geronimo.kernel.config.ConfigurationManagerImpl;
+import org.apache.geronimo.kernel.config.KernelConfigurationManager;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.kernel.config.InvalidConfigException;
@@ -120,7 +120,7 @@
         new File(outputPath, "war").mkdir();
         File path = new File(basedir, "src/test-resources/deployables/war4");
         UnpackedJarFile jarFile = new UnpackedJarFile(path);
-        Module module = builder.createModule(null, jarFile);
+        Module module = builder.createModule(null, jarFile, kernel.getNaming());
         EARContext earContext = createEARContext(outputPath, defaultEnvironment);
         module.setEarContext(earContext);
         ObjectName serverName = earContext.getServerName();
@@ -159,7 +159,6 @@
         EARContext earContext = new EARContext(outputPath,
                 environment,
                 ConfigurationModuleType.WAR,
-                kernel,
                 serverName, moduleContext.getJ2eeApplicationName(),
                 tcmName,
                 ctcName,
@@ -265,7 +264,7 @@
         kernel.startGBean(artifactResolver.getName());
 
         ObjectName configurationManagerName = new ObjectName(":j2eeType=ConfigurationManager,name=Basic");
-        GBeanData configurationManagerData = new GBeanData(configurationManagerName, ConfigurationManagerImpl.GBEAN_INFO);
+        GBeanData configurationManagerData = new GBeanData(configurationManagerName, KernelConfigurationManager.GBEAN_INFO);
         configurationManagerData.setReferencePattern("Stores", store.getName());
         configurationManagerData.setReferencePattern("ArtifactManager", artifactManager.getName());
         configurationManagerData.setReferencePattern("ArtifactResolver", artifactResolver.getName());

Modified: geronimo/branches/1.1/modules/jetty/src/java/org/apache/geronimo/jetty/JettyManagerImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/jetty/src/java/org/apache/geronimo/jetty/JettyManagerImpl.java?rev=386276&r1=386275&r2=386276&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/jetty/src/java/org/apache/geronimo/jetty/JettyManagerImpl.java (original)
+++ geronimo/branches/1.1/modules/jetty/src/java/org/apache/geronimo/jetty/JettyManagerImpl.java Wed Mar 15 22:49:33 2006
@@ -32,7 +32,6 @@
 import org.apache.geronimo.jetty.requestlog.JettyLogManager;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.kernel.Naming;
 import org.apache.geronimo.kernel.config.ConfigurationUtil;
 import org.apache.geronimo.kernel.config.EditableConfigurationManager;
 import org.apache.geronimo.kernel.config.InvalidConfigException;
@@ -68,7 +67,7 @@
      * functional (e.g. SSL settings for an HTTPS connector).
      */
     public AbstractName addConnector(AbstractName containerName, String uniqueName, String protocol, String host, int port) {
-        AbstractName name = Naming.createChildName(containerName, NameFactory.GERONIMO_SERVICE, "JettyWebConnector-" + protocol + "-" + uniqueName);
+        AbstractName name = kernel.getNaming().createChildName(containerName, "JettyWebConnector-" + protocol + "-" + uniqueName, NameFactory.GERONIMO_SERVICE);
         GBeanData connector;
         if (protocol.equals(PROTOCOL_HTTP)) {
             connector = new GBeanData(name, HTTPConnector.GBEAN_INFO);

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractName.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractName.java?rev=386276&r1=386275&r2=386276&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractName.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractName.java Wed Mar 15 22:49:33 2006
@@ -30,6 +30,7 @@
  * @version $Rev:$ $Date:$
  */
 public class AbstractName implements Serializable {
+    private static final long serialVersionUID = 3584199042821734754L;
 
     private final Artifact artifact;
     private final Map name;

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=386276&r1=386275&r2=386276&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 Wed Mar 15 22:49:33 2006
@@ -28,9 +28,6 @@
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.kernel.Naming;
-
 /**
  * @version $Rev: 384686 $ $Date$
  */
@@ -49,14 +46,6 @@
 
     public GBeanData(GBeanInfo gbeanInfo) {
         this();
-        this.gbeanInfo = gbeanInfo;
-    }
-
-    public GBeanData(Artifact artifact, String name, GBeanInfo gbeanInfo) {
-        this();
-        String j2eeType = gbeanInfo.getJ2eeType();
-        if (j2eeType == null) j2eeType = "GBean";
-        this.abstractName = Naming.createRootName(artifact, name, j2eeType);
         this.gbeanInfo = gbeanInfo;
     }
 

Copied: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/Jsr77Naming.java (from r386128, geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/Naming.java)
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/Jsr77Naming.java?p2=geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/Jsr77Naming.java&p1=geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/Naming.java&r1=386128&r2=386276&rev=386276&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/Naming.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/Jsr77Naming.java Wed Mar 15 22:49:33 2006
@@ -28,13 +28,16 @@
 /**
  * @version $Rev$ $Date$
  */
-public class Naming {
+public class Jsr77Naming extends Naming {
     private static final String DEFAULT_DOMAIN_NAME = "geronimo";
     private static final String DEFAULT_SERVER_NAME = "geronimo";
-    public static final String J2EE_TYPE = "j2eeType";
-    public static final String J2EE_NAME = "name";
+    private static final String J2EE_TYPE = "j2eeType";
+    private static final String J2EE_NAME = "name";
 
-    public static AbstractName createRootName(Artifact artifact, String name, String type) {
+    public Jsr77Naming() {
+    }
+
+    public AbstractName createRootName(Artifact artifact, String name, String type) {
         Map nameMap = new HashMap();
         nameMap.put(J2EE_TYPE, type);
         nameMap.put(J2EE_NAME, name);
@@ -44,11 +47,11 @@
                 createObjectName(nameMap));
     }
 
-    public static AbstractName createChildName(AbstractName parentAbstractName, String type, String name) {
-        return createChildName(parentAbstractName, parentAbstractName.getArtifact(), type, name);
+    public AbstractName createChildName(AbstractName parentAbstractName, String name, String type) {
+        return createChildName(parentAbstractName, parentAbstractName.getArtifact(), name, type);
     }
 
-    public static AbstractName createChildName(AbstractName parentAbstractName, Artifact artifact, String type, String name) {
+    public AbstractName createChildName(AbstractName parentAbstractName, Artifact artifact, String name, String type) {
         Map nameMap = new HashMap(parentAbstractName.getName());
 
         String parentType = (String) nameMap.remove(J2EE_TYPE);

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/Kernel.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/Kernel.java?rev=386276&r1=386275&r2=386276&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/Kernel.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/Kernel.java Wed Mar 15 22:49:33 2006
@@ -32,7 +32,7 @@
 import org.apache.geronimo.kernel.repository.Artifact;
 
 /**
- * @version $Rev$ $Date$
+ * @version $Rev: 385487 $ $Date$
  */
 public interface Kernel {
     /**
@@ -47,6 +47,12 @@
      * @return the name of this kernel
      */
     String getKernelName();
+
+    /**
+     * Gets the naming system used by this kernel.
+     * @return the naming system used by this kernel
+     */
+    Naming getNaming();
 
     /**
      * Gets the dependency manager kernel service

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/KernelGBean.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/KernelGBean.java?rev=386276&r1=386275&r2=386276&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/KernelGBean.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/KernelGBean.java Wed Mar 15 22:49:33 2006
@@ -30,7 +30,7 @@
 import org.apache.geronimo.kernel.proxy.ProxyManager;
 
 /**
- * @version $Rev$ $Date$
+ * @version $Rev: 385487 $ $Date$
  */
 public class KernelGBean implements Kernel{
     private final Kernel kernel;
@@ -52,6 +52,10 @@
     }
 
     public void boot() throws Exception {
+        throw new UnsupportedOperationException();
+    }
+
+    public Naming getNaming() {
         throw new UnsupportedOperationException();
     }
 

Added: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/Naming.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/Naming.java?rev=386276&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/Naming.java (added)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/Naming.java Wed Mar 15 22:49:33 2006
@@ -0,0 +1,31 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.kernel;
+
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.kernel.repository.Artifact;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class Naming {
+    public abstract AbstractName createRootName(Artifact artifact, String name, String type);
+
+    public abstract AbstractName createChildName(AbstractName parentAbstractName, String name, String type);
+
+    public abstract AbstractName createChildName(AbstractName parentAbstractName, Artifact artifact, String name, String type);
+}

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/BasicKernel.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/BasicKernel.java?rev=386276&r1=386275&r2=386276&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/BasicKernel.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/basic/BasicKernel.java Wed Mar 15 22:49:33 2006
@@ -43,6 +43,8 @@
 import org.apache.geronimo.kernel.KernelRegistry;
 import org.apache.geronimo.kernel.NoSuchAttributeException;
 import org.apache.geronimo.kernel.NoSuchOperationException;
+import org.apache.geronimo.kernel.Jsr77Naming;
+import org.apache.geronimo.kernel.Naming;
 import org.apache.geronimo.kernel.lifecycle.LifecycleMonitor;
 import org.apache.geronimo.kernel.proxy.ProxyManager;
 
@@ -66,7 +68,7 @@
  * 
  * TODO: Describe the order of method invocation (e.g. if loadGbean may be before boot)
  *
- * @version $Rev$ $Date$
+ * @version $Rev: 385487 $ $Date$
  */
 public class BasicKernel implements Kernel {
     /**
@@ -121,6 +123,8 @@
      */
     private ProxyManager proxyManager;
 
+    private static final Naming INSTANCE = new Jsr77Naming();
+
     /**
      * Construct a Kernel with the specified name.
      *
@@ -136,6 +140,10 @@
 
     public String getKernelName() {
         return kernelName;
+    }
+
+    public Naming getNaming() {
+        return INSTANCE;
     }
 
     /**

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=386276&r1=386275&r2=386276&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 Wed Mar 15 22:49:33 2006
@@ -53,6 +53,7 @@
 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.jmx.JMXUtil;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.Dependency;
@@ -181,6 +182,11 @@
     private final LinkedHashSet classPath;
 
     /**
+     * Naming system used when generating a name for a new gbean
+     */
+    private final Naming naming;
+
+    /**
      * Only used to allow declaration as a reference.
      */
     public Configuration() {
@@ -191,6 +197,7 @@
         classPath = null;
         configurationResolver = null;
         configurationClassLoader = null;
+        naming = null;
     }
 
     /**
@@ -201,17 +208,25 @@
      * @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
      */
-    public Configuration(Collection parents, /*String objectName, */ConfigurationModuleType moduleType, Environment environment, List classPath, byte[] gbeanState, ConfigurationResolver configurationResolver/*, Collection repositories, ConfigurationStore configurationStore, ArtifactManager artifactManager, ArtifactResolver artifactResolver*/) throws MissingDependencyException, MalformedURLException, NoSuchConfigException, InvalidConfigException {
+    public Configuration(Collection parents,
+            ConfigurationModuleType moduleType,
+            Environment environment,
+            List classPath,
+            byte[] gbeanState,
+            ConfigurationResolver configurationResolver,
+            Naming naming) 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 (configurationResolver == null) throw new NullPointerException("configurationResolver is null");
+        if (naming == null) throw new NullPointerException("naming is null");
 
         this.environment = environment;
         this.moduleType = moduleType;
         this.configurationResolver = configurationResolver;
         this.classPath = new LinkedHashSet(classPath);
+        this.naming = naming;
 
         this.id = environment.getConfigId();
         abstractName = getConfigurationAbstractName(id);
@@ -461,6 +476,24 @@
         return gbeans.containsKey(gbean);
     }
 
+    public synchronized AbstractName addGBean(String name, GBeanData gbean) throws GBeanAlreadyExistsException {
+        AbstractName abstractName = gbean.getAbstractName();
+        if (abstractName != null) {
+            throw new IllegalArgumentException("gbean already has an abstract name: " + abstractName);
+        }
+
+        String j2eeType = gbean.getGBeanInfo().getJ2eeType();
+        if (j2eeType == null) j2eeType = "GBean";
+        abstractName = naming.createRootName(id, name, j2eeType);
+        gbean.setAbstractName(abstractName);
+
+        if (gbeans.containsKey(abstractName)) {
+            throw new GBeanAlreadyExistsException(gbean.getName().getCanonicalName());
+        }
+        gbeans.put(abstractName, gbean);
+        return abstractName;
+    }
+
     public synchronized void addGBean(GBeanData gbean) throws GBeanAlreadyExistsException {
         if (gbeans.containsKey(gbean.getAbstractName())) {
             throw new GBeanAlreadyExistsException(gbean.getName().getCanonicalName());
@@ -476,14 +509,17 @@
     }
 
     public AbstractName findGBean(AbstractNameQuery pattern) throws GBeanNotFoundException {
+        if (pattern == null) throw new NullPointerException("pattern is null");
         return findGBean(Collections.singleton(pattern));
     }
 
     public GBeanData findGBeanData(AbstractNameQuery pattern) throws GBeanNotFoundException {
+        if (pattern == null) throw new NullPointerException("pattern is null");
         return findGBeanData(Collections.singleton(pattern));
     }
 
     public AbstractName findGBean(ReferencePatterns referencePatterns) throws GBeanNotFoundException {
+        if (referencePatterns == null) throw new NullPointerException("referencePatterns is null");
         if (referencePatterns.getAbstractName() != null) {
             // this pattern is already resolved
             return referencePatterns.getAbstractName();
@@ -495,10 +531,12 @@
     }
 
     public AbstractName findGBean(Set patterns) throws GBeanNotFoundException {
+        if (patterns == null) throw new NullPointerException("patterns is null");
         return findGBeanData(patterns).getAbstractName();
     }
 
     public GBeanData findGBeanData(Set patterns) throws GBeanNotFoundException {
+        if (patterns == null) throw new NullPointerException("patterns is null");
         Set result = findGBeanDatas(this, patterns);
         if (result.size() > 1) {
             throw new GBeanNotFoundException("More than one match to referencePatterns", patterns);
@@ -530,6 +568,7 @@
     }
 
     public LinkedHashSet findGBeans(ReferencePatterns referencePatterns) {
+        if (referencePatterns == null) throw new NullPointerException("referencePatterns is null");
         if (referencePatterns.getAbstractName() != null) {
             // this pattern is already resolved
             LinkedHashSet result = new LinkedHashSet();
@@ -543,6 +582,7 @@
     }
 
     public LinkedHashSet findGBeans(Set patterns) {
+        if (patterns == null) throw new NullPointerException("patterns is null");
         LinkedHashSet datas = findGBeanDatas(patterns);
         LinkedHashSet result = new LinkedHashSet(datas.size());
         for (Iterator iterator = datas.iterator(); iterator.hasNext();) {
@@ -554,6 +594,7 @@
     }
 
     public LinkedHashSet findGBeanDatas(Set patterns) {
+        if (patterns == null) throw new NullPointerException("patterns is null");
         LinkedHashSet datas = findGBeanDatas(this, patterns);
 
         // search all parents
@@ -666,6 +707,7 @@
         infoFactory.addAttribute("classPath", List.class, true, false);
         infoFactory.addAttribute("gBeanState", byte[].class, true, false);
         infoFactory.addAttribute("configurationResolver", ConfigurationResolver.class, true);
+        infoFactory.addAttribute("naming", Naming.class, true);
 
         infoFactory.addInterface(Configuration.class);
 
@@ -676,6 +718,7 @@
                 "classPath",
                 "gBeanState",
                 "configurationResolver",
+                "naming",
         });
 
         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=386276&r1=386275&r2=386276&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 Wed Mar 15 22:49:33 2006
@@ -19,7 +19,10 @@
 
 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.util.ArrayList;
 import java.util.Collections;
@@ -56,16 +59,14 @@
     private final Environment environment;
 
     private final File configurationDir;
+    private final Naming naming;
 
-    public ConfigurationData(Artifact configId) {
-        this(null, null, null, null, new Environment(configId), null);
+    public ConfigurationData(Artifact configId, Naming naming) {
+        this(null, null, null, null, new Environment(configId), null, naming);
     }
 
-    public ConfigurationData(Environment environment) {
-        this(null, null, null, null, environment, null);
-    }
-
-    public ConfigurationData(ConfigurationModuleType moduleType, LinkedHashSet classPath, List gbeans, List childConfigurations, Environment environment, File configurationDir) {
+    public ConfigurationData(ConfigurationModuleType moduleType, LinkedHashSet classPath, List gbeans, List childConfigurations, Environment environment, File configurationDir, Naming naming) {
+        this.naming = naming;
         if (moduleType != null) {
             this.moduleType = moduleType;
         } else {
@@ -105,6 +106,15 @@
 
     public void addGBean(GBeanData gbeanData) {
         gbeans.add(gbeanData);
+    }
+
+    public GBeanData addGBean(String name, GBeanInfo gbeanInfo) {
+        String j2eeType = gbeanInfo.getJ2eeType();
+        if (j2eeType == null) j2eeType = "GBean";
+        AbstractName abstractName = naming.createRootName(environment.getConfigId(), name, j2eeType);
+        GBeanData gBeanData = new GBeanData(abstractName, gbeanInfo);
+        addGBean(gBeanData);
+        return gBeanData;
     }
 
     public List getChildConfigurations() {

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=386276&r1=386275&r2=386276&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 Wed Mar 15 22:49:33 2006
@@ -68,6 +68,7 @@
         Artifact configId = environment.getConfigId();
         AbstractName configurationName = Configuration.getConfigurationAbstractName(configId);
         configuration.setAbstractName(configurationName);
+        configuration.setAttribute("naming", kernel.getNaming());
 
         // for a bootstrap we should have an empty kernel, so clear the references and dependencies
         configuration.setAttribute("artifactManager", null);

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/EditableConfigurationManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/EditableConfigurationManager.java?rev=386276&r1=386275&r2=386276&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/EditableConfigurationManager.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/EditableConfigurationManager.java Wed Mar 15 22:49:33 2006
@@ -25,7 +25,7 @@
  * A specialized ConfigurationManager that can change the set of GBeans
  * included in the configuration at runtime.
  *
- * @version $Rev$ $Date$
+ * @version $Rev: 384351 $ $Date$
  */
 public interface EditableConfigurationManager extends ConfigurationManager {
     /**
@@ -35,6 +35,15 @@
      * @param start     If true, the GBean should be started as part of this call.
      */
     void addGBeanToConfiguration(Artifact configID, GBeanData gbean, boolean start) throws InvalidConfigException;
+
+    /**
+     * Adds a new GBean to an existing Configuration.
+     * @param configID  The configuration to add the GBean to.
+     * @param name      The short name for the new GBean.
+     * @param gbean     The data representing the GBean to add. This must not have an abstract name set.
+     * @param start     If true, the GBean should be started as part of this call.
+     */
+    void addGBeanToConfiguration(Artifact configID, String name, GBeanData gbean, boolean start) throws InvalidConfigException;
 
     /**
      * Removes a GBean from a configuration.  Note: this may simply mark it to

Copied: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/EditableKernelConfigurationManager.java (from r385892, geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/EditableConfigurationManagerImpl.java)
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/EditableKernelConfigurationManager.java?p2=geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/EditableKernelConfigurationManager.java&p1=geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/EditableConfigurationManagerImpl.java&r1=385892&r2=386276&rev=386276&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/EditableConfigurationManagerImpl.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/EditableKernelConfigurationManager.java Wed Mar 15 22:49:33 2006
@@ -20,6 +20,7 @@
 
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
+import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.ArtifactResolver;
 import org.apache.geronimo.kernel.repository.ArtifactManager;
@@ -34,8 +35,8 @@
  *
  * @version $Rev: 384686 $ $Date$
  */
-public class EditableConfigurationManagerImpl extends ConfigurationManagerImpl implements EditableConfigurationManager {
-    public EditableConfigurationManagerImpl(Kernel kernel,
+public class EditableKernelConfigurationManager extends KernelConfigurationManager implements EditableConfigurationManager {
+    public EditableKernelConfigurationManager(Kernel kernel,
             Collection stores,
             ManageableAttributeStore attributeStore,
             PersistentConfigurationList configurationList,
@@ -48,14 +49,39 @@
 
     public void addGBeanToConfiguration(Artifact configurationId, GBeanData gbean, boolean start) throws InvalidConfigException {
         Configuration configuration = getConfiguration(configurationId);
-        ClassLoader configurationClassLoader = configuration.getConfigurationClassLoader();
 
+        try {
+            // add the gbean to the configuration
+            configuration.addGBean(gbean);
+        } catch (GBeanAlreadyExistsException e) {
+            throw new InvalidConfigException("Cound not add GBean " + gbean.getName() + " to configuration " + configurationId, e);
+        }
+
+        addGBeanToConfiguration(configuration, gbean, start);
+    }
+
+    public void addGBeanToConfiguration(Artifact configurationId, String name, GBeanData gbean, boolean start) throws InvalidConfigException {
+        Configuration configuration = getConfiguration(configurationId);
+
+        try {
+            // add the gbean to the configuration
+            configuration.addGBean(name, gbean);
+        } catch (GBeanAlreadyExistsException e) {
+            throw new InvalidConfigException("Cound not add GBean " + gbean.getName() + " to configuration " + configurationId, e);
+        }
+
+        addGBeanToConfiguration(configuration, gbean, start);
+    }
+
+    private void addGBeanToConfiguration(Configuration configuration, GBeanData gbean, boolean start) throws InvalidConfigException {
+        ClassLoader configurationClassLoader = configuration.getConfigurationClassLoader();
         ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
         try {
             Thread.currentThread().setContextClassLoader(configurationClassLoader);
 
             log.trace("Registering GBean " + gbean.getName());
 
+
             // preprocess the gbean data before loading it into the kernel
             preprocessGBeanData(configuration, gbean);
 
@@ -71,17 +97,34 @@
                 }
             }
 
-            configuration.addGBean(gbean);
-        } catch(InvalidConfigException e) {
-            throw e;
         } catch(Exception e) {
-            throw new InvalidConfigException("Cound not add GBean " + gbean.getName() + " to configuration " + configurationId, e);
+            // clean up failed gbean
+            try {
+                configuration.removeGBean(gbean.getAbstractName());
+            } catch (GBeanNotFoundException e1) {
+                // this is good
+            }
+            try {
+                kernel.stopGBean(gbean.getAbstractName());
+            } catch (GBeanNotFoundException e1) {
+                // this is good
+            }
+            try {
+                kernel.unloadGBean(gbean.getAbstractName());
+            } catch (GBeanNotFoundException e1) {
+                // this is good
+            }
+
+            if (e instanceof InvalidConfigException) {
+                throw (InvalidConfigException) e;
+            }
+            throw new InvalidConfigException("Cound not add GBean " + gbean.getName() + " to configuration " + configuration.getId(), e);
         } finally {
             Thread.currentThread().setContextClassLoader(oldCl);
         }
 
         if (attributeStore != null) {
-            attributeStore.addGBean(configurationId.toString(), gbean);
+            attributeStore.addGBean(configuration.getId().toString(), gbean);
         }
     }
 
@@ -112,7 +155,7 @@
     public static final GBeanInfo GBEAN_INFO;
 
     static {
-        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(EditableConfigurationManagerImpl.class, ConfigurationManagerImpl.GBEAN_INFO, "ConfigurationManager");
+        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(EditableKernelConfigurationManager.class, KernelConfigurationManager.GBEAN_INFO, "ConfigurationManager");
         infoFactory.addInterface(EditableConfigurationManager.class);
         infoFactory.setConstructor(new String[]{"kernel", "Stores", "AttributeStore", "PersistentConfigurationList", "ArtifactManager", "ArtifactResolver", "Repositories", "classLoader"});
         GBEAN_INFO = infoFactory.getBeanInfo();

Propchange: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/EditableKernelConfigurationManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/EditableKernelConfigurationManager.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/EditableKernelConfigurationManager.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message