Author: djencks
Date: Sat Feb 19 10:22:02 2005
New Revision: 154436

URL: http://svn.apache.org/viewcvs?view=rev&rev=154436
Log:
Attempt to simplify (?) and unify NameFactory and J2eeContext.  Add missing 
jsr-77 classes and correct jsr-77 errors

Added:
    
geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/JCAResourceImpl.java
    
geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/ResourceAdapterImpl.java
Modified:
    
geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/AbstractWebServiceTest.java
    
geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/AxisGBeanTest.java
    
geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
    
geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
    
geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
    
geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/ResourceAdapterModuleImpl.java
    
geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/JCAConnectionFactoryImpl.java
    
geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/AdminObjectWrapperTest.java
    
geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapperTest.java
    
geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARContext.java
    
geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/j2eeobjectnames/J2eeContext.java
    
geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/j2eeobjectnames/J2eeContextImpl.java
    
geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/j2eeobjectnames/NameFactory.java
    
geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/Util.java
    
geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
    
geronimo/trunk/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java
    
geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyServletHolder.java
    
geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java
    
geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/AbstractWebModuleTest.java
    
geronimo/trunk/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java
    
geronimo/trunk/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
    
geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
    
geronimo/trunk/modules/tomcat/src/test/org/apache/geronimo/tomcat/AbstractWebModuleTest.java

Modified: 
geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/AbstractWebServiceTest.java
URL: 
http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/AbstractWebServiceTest.java?view=diff&r1=154435&r2=154436
==============================================================================
--- 
geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/AbstractWebServiceTest.java
 (original)
+++ 
geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/AbstractWebServiceTest.java
 Sat Feb 19 10:22:02 2005
@@ -60,7 +60,7 @@
         kernel.boot();
         //start the J2EE server which would be started by the server plan
         //in the real case 
-        TestingUtils.startJ2EEContainerAndAxisServlet(kernel);
+//        TestingUtils.startJ2EEContainerAndAxisServlet(kernel);
         
         //Start axis gbean        
         GBeanData axisgbData = new 
GBeanData(axisname,AxisGbean.getGBeanInfo());
@@ -77,7 +77,7 @@
     }
 
     protected void tearDown() throws Exception {
-        TestingUtils.stopJ2EEContinerAndAxisServlet(kernel);
+//        TestingUtils.stopJ2EEContinerAndAxisServlet(kernel);
         kernel.shutdown();
         File file = new File(AxisGeronimoConstants.AXIS_CONFIG_STORE);
         AxisGeronimoUtils.delete(file);

Modified: 
geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/AxisGBeanTest.java
URL: 
http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/AxisGBeanTest.java?view=diff&r1=154435&r2=154436
==============================================================================
--- 
geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/AxisGBeanTest.java
 (original)
+++ 
geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/AxisGBeanTest.java
 Sat Feb 19 10:22:02 2005
@@ -80,11 +80,11 @@
         name = new ObjectName("test:name=AxisGBean");
         kernel = new Kernel("test.kernel");
         kernel.boot();
-        TestingUtils.startJ2EEContainerAndAxisServlet(kernel);
+//        TestingUtils.startJ2EEContainerAndAxisServlet(kernel);
     }
 
     protected void tearDown() throws Exception {
-        TestingUtils.stopJ2EEContinerAndAxisServlet(kernel);
+//        TestingUtils.stopJ2EEContinerAndAxisServlet(kernel);
         kernel.shutdown();
     }
 }

Modified: 
geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
URL: 
http://svn.apache.org/viewcvs/geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java?view=diff&r1=154435&r2=154436
==============================================================================
--- 
geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
 (original)
+++ 
geronimo/trunk/modules/client-builder/src/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
 Sat Feb 19 10:22:02 2005
@@ -298,7 +298,8 @@
         // generate the object name for the app client
         ObjectName appClientModuleName = null;
         try {
-            appClientModuleName = NameFactory.getModuleName(null, null, null, 
appClientModule.getName(), NameFactory.APP_CLIENT_MODULE, earJ2eeContext);
+            //TODO consider constructing a module context
+            appClientModuleName = NameFactory.getModuleName(null, null, null, 
NameFactory.APP_CLIENT_MODULE, appClientModule.getName(), earJ2eeContext);
         } catch (MalformedObjectNameException e) {
             throw new DeploymentException("Could not construct module name", 
e);
         }

Modified: 
geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
URL: 
http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java?view=diff&r1=154435&r2=154436
==============================================================================
--- 
geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
 (original)
+++ 
geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
 Sat Feb 19 10:22:02 2005
@@ -42,6 +42,8 @@
 import org.apache.geronimo.connector.AdminObjectWrapper;
 import org.apache.geronimo.connector.ResourceAdapterModuleImpl;
 import org.apache.geronimo.connector.ResourceAdapterWrapper;
+import org.apache.geronimo.connector.ResourceAdapterImpl;
+import org.apache.geronimo.connector.JCAResourceImpl;
 import org.apache.geronimo.connector.outbound.JCAConnectionFactoryImpl;
 import org.apache.geronimo.connector.outbound.ManagedConnectionFactoryWrapper;
 import 
org.apache.geronimo.connector.outbound.connectionmanagerconfig.LocalTransactions;
@@ -262,13 +264,14 @@
 
     public void initContext(EARContext earContext, Module module, ClassLoader 
cl) throws DeploymentException {
         J2eeContext earJ2eeContext = earContext.getJ2eeContext();
-        J2eeContext moduleJ2eeContext = new 
J2eeContextImpl(earJ2eeContext.getJ2eeDomainName(), 
earJ2eeContext.getJ2eeServerName(), earJ2eeContext.getJ2eeApplicationName(), 
module.getName(), null, null);
+        J2eeContext moduleJ2eeContext = 
J2eeContextImpl.newModuleContextFromApplication(earJ2eeContext, 
NameFactory.RESOURCE_ADAPTER_MODULE, module.getName());
+        J2eeContext resourceJ2eeContext = 
J2eeContextImpl.newModuleContextFromApplication(earJ2eeContext, 
NameFactory.JCA_RESOURCE, module.getName());
         XmlObject specDD = module.getSpecDD();
 
         //set up the metadata for the ResourceAdapterModule
         ObjectName resourceAdapterModuleName = null;
         try {
-            resourceAdapterModuleName = NameFactory.getModuleName(null, null, 
null, null, NameFactory.RESOURCE_ADAPTER_MODULE, moduleJ2eeContext);
+            resourceAdapterModuleName = NameFactory.getModuleName(null, null, 
null, null, null, moduleJ2eeContext);
         } catch (MalformedObjectNameException e) {
             throw new DeploymentException("Could not construct module name", 
e);
         }
@@ -280,11 +283,7 @@
             
resourceAdapterModuleData.setReferencePattern(NameFactory.J2EE_APPLICATION, 
earContext.getApplicationObjectName());
         }
 
-        try {
-            resourceAdapterModuleData.setAttribute("deploymentDescriptor", 
module.getOriginalSpecDD());
-        } catch (Exception e) {
-            throw new DeploymentException("Unable to initialize EJBModule 
GBean", e);
-        }
+        resourceAdapterModuleData.setAttribute("deploymentDescriptor", 
module.getOriginalSpecDD());
 
         ResourceadapterType resourceadapter = ((ConnectorType) 
specDD).getResourceadapter();
         // Create the resource adapter gbean
@@ -320,12 +319,12 @@
                 try {
                     if (resourceadapter.isSetInboundResourceadapter() && 
resourceadapter.getInboundResourceadapter().isSetMessageadapter()) {
                         String resourceAdapterName = 
geronimoResourceAdapter.getResourceadapterInstance().getResourceadapterName();
-                        ObjectName resourceAdapterObjectName = 
NameFactory.getResourceComponentName(null, null, null, null, 
resourceAdapterName, NameFactory.JCA_RESOURCE_ADAPTER, moduleJ2eeContext);
+                        ObjectName resourceAdapterObjectName = 
NameFactory.getComponentName(null, null, null, null, null, resourceAdapterName, 
NameFactory.JCA_RESOURCE_ADAPTER, resourceJ2eeContext);
                         String containerId = 
resourceAdapterObjectName.getCanonicalName();
                         
earContext.getRefContext().addResourceAdapterId(module.getModuleURI(), 
resourceAdapterName, containerId);
                     }
-                } catch (Exception e) {
-                    throw new DeploymentException("Could not set 
ResourceAdapterClass", e);
+                } catch (MalformedObjectNameException e) {
+                    throw new DeploymentException("Could not construct 
resource adapter instance", e);
                 }
             }
             if (geronimoResourceAdapter.isSetOutboundResourceadapter()) {
@@ -337,7 +336,7 @@
                         GerConnectiondefinitionInstanceType 
connectionDefinitionInstance = connectionDefinitionInstances[j];
                         String containerId = null;
                         try {
-                            containerId = 
NameFactory.getResourceComponentNameString(null, null, null, null, 
connectionDefinitionInstance.getName(), 
NameFactory.JCA_MANAGED_CONNECTION_FACTORY, moduleJ2eeContext);
+                            containerId = NameFactory.getComponentName(null, 
null, null, null, null, connectionDefinitionInstance.getName(), 
NameFactory.JCA_MANAGED_CONNECTION_FACTORY, 
resourceJ2eeContext).getCanonicalName();
                         } catch (MalformedObjectNameException e) {
                             throw new DeploymentException("Could not construct 
resource object name", e);
                         }
@@ -353,7 +352,7 @@
 
                 String adminObjectObjectName = null;
                 try {
-                    adminObjectObjectName = 
NameFactory.getResourceComponentNameString(null, null, null, null, 
gerAdminObjectInstance.getMessageDestinationName(), 
NameFactory.JCA_ADMIN_OBJECT, moduleJ2eeContext);
+                    adminObjectObjectName = NameFactory.getComponentName(null, 
null, null, null, gerAdminObjectInstance.getMessageDestinationName(), 
NameFactory.JCA_ADMIN_OBJECT, resourceJ2eeContext).getCanonicalName();
                 } catch (MalformedObjectNameException e) {
                     throw new DeploymentException("Could not construct 
resource object name", e);
                 }
@@ -365,28 +364,50 @@
 
     public String addGBeans(EARContext earContext, Module module, ClassLoader 
cl) throws DeploymentException {
         J2eeContext earJ2eeContext = earContext.getJ2eeContext();
-        J2eeContext moduleJ2eeContext = new 
J2eeContextImpl(earJ2eeContext.getJ2eeDomainName(), 
earJ2eeContext.getJ2eeServerName(), earJ2eeContext.getJ2eeApplicationName(), 
module.getName(), null, null);
+        J2eeContext moduleJ2eeContext = 
J2eeContextImpl.newModuleContextFromApplication(earJ2eeContext, 
NameFactory.RESOURCE_ADAPTER_MODULE, module.getName());
+        J2eeContext resourceJ2eeContext = 
J2eeContextImpl.newModuleContextFromApplication(earJ2eeContext, 
NameFactory.JCA_RESOURCE, module.getName());
 
         XmlObject specDD = module.getSpecDD();
 
         // build the objectName
         ObjectName resourceAdapterModuleName = null;
         try {
-            resourceAdapterModuleName = NameFactory.getModuleName(null, null, 
null, null, NameFactory.RESOURCE_ADAPTER_MODULE, moduleJ2eeContext);
+            resourceAdapterModuleName = NameFactory.getModuleName(null, null, 
null, null, null, moduleJ2eeContext);
         } catch (MalformedObjectNameException e) {
             throw new DeploymentException("Could not construct module name", 
e);
         }
         GBeanData resourceAdapterModuleData = 
earContext.getRefContext().getResourceAdapterModuleData(resourceAdapterModuleName);
+        ObjectName resourceAdapterjsr77Name = null;
+        try {
+            resourceAdapterjsr77Name = NameFactory.getComponentName(null, 
null, null, null, null, resourceJ2eeContext.getJ2eeModuleName(), 
NameFactory.RESOURCE_ADAPTER, moduleJ2eeContext);
+        } catch (MalformedObjectNameException e) {
+            throw new DeploymentException("Could not construct resource 
adapter placeholder name", e);
+        }
+        resourceAdapterModuleData.setAttribute("resourceAdapter", 
resourceAdapterjsr77Name.getCanonicalName());
 
         // add it
         earContext.addGBean(resourceAdapterModuleData);
 
+        //construct the bogus resource adapter and jca resource placeholders
+        GBeanData resourceAdapterData = new 
GBeanData(resourceAdapterjsr77Name, ResourceAdapterImpl.GBEAN_INFO);
+        ObjectName jcaResourcejsr77Name = null;
+        try {
+            jcaResourcejsr77Name = NameFactory.getComponentName(null, null, 
null, NameFactory.RESOURCE_ADAPTER, null, 
resourceJ2eeContext.getJ2eeModuleName(), NameFactory.JCA_RESOURCE, 
moduleJ2eeContext);
+        } catch (MalformedObjectNameException e) {
+            throw new DeploymentException("Could not construct jca resource 
placeholder name", e);
+        }
+        resourceAdapterData.setAttribute("JCAResource", 
jcaResourcejsr77Name.getCanonicalName());
+        earContext.addGBean(resourceAdapterData);
+
+        GBeanData jcaResourceData = new GBeanData(jcaResourcejsr77Name, 
JCAResourceImpl.GBEAN_INFO);
+        earContext.addGBean(jcaResourceData);
+
         GerConnectorType geronimoConnector = (GerConnectorType) 
module.getVendorDD();
 
         GbeanType[] gbeans = geronimoConnector.getGbeanArray();
         ServiceConfigBuilder.addGBeans(gbeans, cl, moduleJ2eeContext, 
earContext);
 
-        addConnectorGBeans(earContext, moduleJ2eeContext, 
resourceAdapterModuleName, (ConnectorType) specDD, geronimoConnector, cl);
+        addConnectorGBeans(earContext, resourceJ2eeContext, 
resourceAdapterModuleName, (ConnectorType) specDD, geronimoConnector, cl);
 
         return null;
     }
@@ -412,7 +433,7 @@
 
                 String resourceAdapterName = 
geronimoResourceAdapter.getResourceadapterInstance().getResourceadapterName();
                 try {
-                    resourceAdapterObjectName = 
NameFactory.getResourceComponentName(null, null, null, null, 
resourceAdapterName, NameFactory.JCA_RESOURCE_ADAPTER, moduleJ2eeContext);
+                    resourceAdapterObjectName = 
NameFactory.getComponentName(null, null, null, null, null, resourceAdapterName, 
NameFactory.JCA_RESOURCE_ADAPTER, moduleJ2eeContext);
                 } catch (MalformedObjectNameException e) {
                     throw new DeploymentException("Could not construct 
resource adapter object name", e);
                 }
@@ -467,7 +488,7 @@
                 // add it
                 ObjectName adminObjectObjectName = null;
                 try {
-                    adminObjectObjectName = 
NameFactory.getResourceComponentName(null, null, null, null, 
gerAdminObjectInstance.getMessageDestinationName(), 
NameFactory.JCA_ADMIN_OBJECT, moduleJ2eeContext);
+                    adminObjectObjectName = NameFactory.getComponentName(null, 
null, null, null, null, gerAdminObjectInstance.getMessageDestinationName(), 
NameFactory.JCA_ADMIN_OBJECT, moduleJ2eeContext);
                 } catch (MalformedObjectNameException e) {
                     throw new DeploymentException("Could not construct admin 
object object name", e);
                 }
@@ -634,7 +655,7 @@
         // create the object name for our connection manager
         ObjectName connectionManagerObjectName = null;
         try {
-            connectionManagerObjectName = 
NameFactory.getResourceComponentName(null, null, null, null, 
connectionfactoryInstance.getName(), NameFactory.JCA_CONNECTION_MANAGER, 
j2eeContext);
+            connectionManagerObjectName = NameFactory.getComponentName(null, 
null, null, null, null, connectionfactoryInstance.getName(), 
NameFactory.JCA_CONNECTION_MANAGER, j2eeContext);
         } catch (MalformedObjectNameException e) {
             throw new DeploymentException("Could not construct connection 
manager object name", e);
         }
@@ -760,7 +781,7 @@
 
         ObjectName managedConnectionFactoryObjectName = null;
         try {
-            managedConnectionFactoryObjectName = 
NameFactory.getResourceComponentName(null, null, null, null, 
connectiondefinitionInstance.getName(), 
NameFactory.JCA_MANAGED_CONNECTION_FACTORY, j2eeContext);
+            managedConnectionFactoryObjectName = 
NameFactory.getComponentName(null, null, null, null, null, 
connectiondefinitionInstance.getName(), 
NameFactory.JCA_MANAGED_CONNECTION_FACTORY, j2eeContext);
         } catch (MalformedObjectNameException e) {
             throw new DeploymentException("Could not construct managed 
connection factory object name", e);
         }
@@ -770,7 +791,7 @@
         // ConnectionFactory
         ObjectName connectionFactoryObjectName = null;
         try {
-            connectionFactoryObjectName = 
NameFactory.getResourceComponentName(null, null, null, null, 
connectiondefinitionInstance.getName(), NameFactory.JCA_CONNECTION_FACTORY, 
j2eeContext);
+            connectionFactoryObjectName = NameFactory.getComponentName(null, 
null, null, null, null, connectiondefinitionInstance.getName(), 
NameFactory.JCA_CONNECTION_FACTORY, j2eeContext);
         } catch (MalformedObjectNameException e) {
             throw new DeploymentException("Could not construct connection 
factory object name", e);
         }

Modified: 
geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
URL: 
http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java?view=diff&r1=154435&r2=154436
==============================================================================
--- 
geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
 (original)
+++ 
geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
 Sat Feb 19 10:22:02 2005
@@ -283,9 +283,10 @@
 
 
     private void executeTestBuildModule(InstallAction action, boolean is15) 
throws Exception {
-        J2eeContext j2eeContext = new J2eeContextImpl("test", "bar", "null", 
"org/apache/geronimo/j2ee/deployment/test", null, null);
+        J2eeContext j2eeContext = new J2eeContextImpl("test", "bar", "null", 
"JCAResource", "org/apache/geronimo/j2ee/deployment/test", null, null);
         String resourceAdapterName = "testRA";
-        ObjectName connectionTrackerName = NameFactory.getComponentName(null, 
null, null, null, "ConnectionTracker", 
ConnectionTrackingCoordinator.GBEAN_INFO.getJ2eeType(), j2eeContext); 
+        //N.B. short version of getComponentName
+        ObjectName connectionTrackerName = NameFactory.getComponentName(null, 
null, null, null, "ConnectionTracker", 
ConnectionTrackingCoordinator.GBEAN_INFO.getJ2eeType(), j2eeContext);
                 //new 
ObjectName("test:J2EEServer=bar,J2EEModule=org/apache/geronimo/j2ee/deployment/test,service=ConnectionTracker");
 
         Kernel kernel = new Kernel("foo", new BasicGBeanRegistry());
@@ -398,7 +399,7 @@
                 assertTrue("No application object should be registered for a 
standalone module", applications.isEmpty());
             }
 
-            ObjectName moduleName = NameFactory.getModuleName(null, null, 
null, null, NameFactory.RESOURCE_ADAPTER_MODULE, j2eeContext);
+            ObjectName moduleName = NameFactory.getModuleName(null, null, 
null, NameFactory.RESOURCE_ADAPTER_MODULE, null, j2eeContext);
             assertRunning(kernel, moduleName);
 
             //1.5 only
@@ -420,7 +421,7 @@
                 assertEquals(3, attributes2.size());
 
                 // ResourceAdapter
-                ObjectName resourceAdapterObjectName = 
NameFactory.getResourceComponentName(null, null, null, null, 
resourceAdapterName, NameFactory.JCA_RESOURCE_ADAPTER, j2eeContext);
+                ObjectName resourceAdapterObjectName = 
NameFactory.getComponentName(null, null, null, null, null, resourceAdapterName, 
NameFactory.JCA_RESOURCE_ADAPTER, j2eeContext);
 
                 assertRunning(kernel, resourceAdapterObjectName);
                 assertAttributeValue(kernel, resourceAdapterObjectName, 
"RAStringProperty", "NewStringValue");
@@ -437,42 +438,42 @@
 
 
             // FirstTestOutboundConnectionFactory
-            ObjectName firstConnectionManagerFactory = 
NameFactory.getResourceComponentName(null, null, null, null, 
"FirstTestOutboundConnectionFactory", NameFactory.JCA_CONNECTION_MANAGER, 
j2eeContext);
+            ObjectName firstConnectionManagerFactory = 
NameFactory.getComponentName(null, null, null, null, null, 
"FirstTestOutboundConnectionFactory", NameFactory.JCA_CONNECTION_MANAGER, 
j2eeContext);
             assertRunning(kernel, firstConnectionManagerFactory);
 
 
-            ObjectName firstOutCF = NameFactory.getResourceComponentName(null, 
null, null, null, "FirstTestOutboundConnectionFactory", 
NameFactory.JCA_CONNECTION_FACTORY, j2eeContext);
+            ObjectName firstOutCF = NameFactory.getComponentName(null, null, 
null, null, null, "FirstTestOutboundConnectionFactory", 
NameFactory.JCA_CONNECTION_FACTORY, j2eeContext);
             assertRunning(kernel, firstOutCF);
 
             ObjectName firstOutSecurity = new 
ObjectName("geronimo.security:service=Realm,type=PasswordCredential,name=FirstTestOutboundConnectionFactory");
             assertRunning(kernel, firstOutSecurity);
 
-            ObjectName firstOutMCF = 
NameFactory.getResourceComponentName(null, null, null, null, 
"FirstTestOutboundConnectionFactory", 
NameFactory.JCA_MANAGED_CONNECTION_FACTORY, j2eeContext);
+            ObjectName firstOutMCF = NameFactory.getComponentName(null, null, 
null, null, null, "FirstTestOutboundConnectionFactory", 
NameFactory.JCA_MANAGED_CONNECTION_FACTORY, j2eeContext);
             assertRunning(kernel, firstOutMCF);
             assertAttributeValue(kernel, firstOutMCF, 
"OutboundStringProperty1", "newvalue1");
             assertAttributeValue(kernel, firstOutMCF, 
"OutboundStringProperty2", "originalvalue2");
             assertAttributeValue(kernel, firstOutMCF, 
"OutboundStringProperty3", "newvalue2");
 
             // SecondTestOutboundConnectionFactory
-            ObjectName secondConnectionManagerFactory = 
NameFactory.getResourceComponentName(null, null, null, null, 
"SecondTestOutboundConnectionFactory", NameFactory.JCA_CONNECTION_MANAGER, 
j2eeContext);
+            ObjectName secondConnectionManagerFactory = 
NameFactory.getComponentName(null, null, null, null, null, 
"SecondTestOutboundConnectionFactory", NameFactory.JCA_CONNECTION_MANAGER, 
j2eeContext);
             assertRunning(kernel, secondConnectionManagerFactory);
 
 
-            ObjectName secondOutCF = 
NameFactory.getResourceComponentName(null, null, null, null, 
"SecondTestOutboundConnectionFactory", NameFactory.JCA_CONNECTION_FACTORY, 
j2eeContext);
+            ObjectName secondOutCF = NameFactory.getComponentName(null, null, 
null, null, null, "SecondTestOutboundConnectionFactory", 
NameFactory.JCA_CONNECTION_FACTORY, j2eeContext);
             assertRunning(kernel, secondOutCF);
 
-            ObjectName secondOutMCF = 
NameFactory.getResourceComponentName(null, null, null, null, 
"SecondTestOutboundConnectionFactory", 
NameFactory.JCA_MANAGED_CONNECTION_FACTORY, j2eeContext);
+            ObjectName secondOutMCF = NameFactory.getComponentName(null, null, 
null, null, null, "SecondTestOutboundConnectionFactory", 
NameFactory.JCA_MANAGED_CONNECTION_FACTORY, j2eeContext);
             assertRunning(kernel, secondOutMCF);
 
             // ThirdTestOutboundConnectionFactory
-            ObjectName thirdConnectionManagerFactory = 
NameFactory.getResourceComponentName(null, null, null, null, 
"ThirdTestOutboundConnectionFactory", NameFactory.JCA_CONNECTION_MANAGER, 
j2eeContext);
+            ObjectName thirdConnectionManagerFactory = 
NameFactory.getComponentName(null, null, null, null, null, 
"ThirdTestOutboundConnectionFactory", NameFactory.JCA_CONNECTION_MANAGER, 
j2eeContext);
             assertRunning(kernel, thirdConnectionManagerFactory);
 
 
-            ObjectName thirdOutCF = NameFactory.getResourceComponentName(null, 
null, null, null, "ThirdTestOutboundConnectionFactory", 
NameFactory.JCA_CONNECTION_FACTORY, j2eeContext);
+            ObjectName thirdOutCF = NameFactory.getComponentName(null, null, 
null, null, null, "ThirdTestOutboundConnectionFactory", 
NameFactory.JCA_CONNECTION_FACTORY, j2eeContext);
             assertRunning(kernel, thirdOutCF);
 
-            ObjectName thirdOutMCF = 
NameFactory.getResourceComponentName(null, null, null, null, 
"ThirdTestOutboundConnectionFactory", 
NameFactory.JCA_MANAGED_CONNECTION_FACTORY, j2eeContext);
+            ObjectName thirdOutMCF = NameFactory.getComponentName(null, null, 
null, null, null, "ThirdTestOutboundConnectionFactory", 
NameFactory.JCA_MANAGED_CONNECTION_FACTORY, j2eeContext);
             assertRunning(kernel, thirdOutMCF);
 
             // 1.5 only
@@ -480,10 +481,10 @@
             //
 
             if (is15) {
-                ObjectName tweedledeeAdminObject = 
NameFactory.getResourceComponentName(null, null, null, null, "tweedledee", 
NameFactory.JCA_ADMIN_OBJECT, j2eeContext);
+                ObjectName tweedledeeAdminObject = 
NameFactory.getComponentName(null, null, null, null, null, "tweedledee", 
NameFactory.JCA_ADMIN_OBJECT, j2eeContext);
                 assertRunning(kernel, tweedledeeAdminObject);
 
-                ObjectName tweedledumAdminObject = 
NameFactory.getResourceComponentName(null, null, null, null, "tweedledum", 
NameFactory.JCA_ADMIN_OBJECT, j2eeContext);
+                ObjectName tweedledumAdminObject = 
NameFactory.getComponentName(null, null, null, null, null, "tweedledum", 
NameFactory.JCA_ADMIN_OBJECT, j2eeContext);
                 assertRunning(kernel, tweedledumAdminObject);
             }
 

Added: 
geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/JCAResourceImpl.java
URL: 
http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/JCAResourceImpl.java?view=auto&rev=154436
==============================================================================
--- 
geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/JCAResourceImpl.java
 (added)
+++ 
geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/JCAResourceImpl.java
 Sat Feb 19 10:22:02 2005
@@ -0,0 +1,79 @@
+/**
+ *
+ * Copyright 2003-2004 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.connector;
+
+import javax.management.ObjectName;
+import javax.management.MalformedObjectNameException;
+
+import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContext;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContextImpl;
+import org.apache.geronimo.j2ee.management.impl.Util;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.jmx.JMXUtil;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+
+/**
+ * @version $Rev:  $ $Date:  $
+ */
+public class JCAResourceImpl {
+    private final Kernel kernel;
+    private final J2eeContext moduleContext;
+
+    private static final String[] CONNECTION_FACTORY_TYPES = 
{NameFactory.JCA_CONNECTION_FACTORY};
+    private static final String[] RESOURCE_ADAPTER_INSTANCE_TYPES = 
{NameFactory.JCA_RESOURCE_ADAPTER};
+
+    public JCAResourceImpl(String objectName, Kernel kernel) {
+        ObjectName myObjectName = JMXUtil.getObjectName(objectName);
+        moduleContext = J2eeContextImpl.newContext(myObjectName, 
NameFactory.JCA_RESOURCE);
+
+        this.kernel = kernel;
+    }
+
+    public String[] getConnectionFactories() throws 
MalformedObjectNameException {
+        return Util.getObjectNames(kernel, moduleContext, 
CONNECTION_FACTORY_TYPES);
+    }
+
+    public String[] getResourceAdapterInstances() throws 
MalformedObjectNameException {
+        return Util.getObjectNames(kernel, moduleContext, 
RESOURCE_ADAPTER_INSTANCE_TYPES);
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoBuilder = new 
GBeanInfoBuilder(JCAResourceImpl.class, NameFactory.JCA_RESOURCE);
+        infoBuilder.addAttribute("objectName", String.class, false);
+        infoBuilder.addAttribute("kernel", Kernel.class, false);
+
+        infoBuilder.addAttribute("connectionFactories", String[].class, false);
+        infoBuilder.addAttribute("resourceAdapterInstances", String[].class, 
false);
+
+        infoBuilder.setConstructor(new String[]{
+            "objectName",
+            "kernel"
+        });
+
+        GBEAN_INFO = infoBuilder.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+
+
+}

Added: 
geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/ResourceAdapterImpl.java
URL: 
http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/ResourceAdapterImpl.java?view=auto&rev=154436
==============================================================================
--- 
geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/ResourceAdapterImpl.java
 (added)
+++ 
geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/ResourceAdapterImpl.java
 Sat Feb 19 10:22:02 2005
@@ -0,0 +1,67 @@
+/**
+ *
+ * Copyright 2003-2004 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.connector;
+
+import java.util.Map;
+import javax.management.ObjectName;
+import javax.management.MalformedObjectNameException;
+
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.jmx.JMXUtil;
+import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContext;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContextImpl;
+import org.apache.geronimo.j2ee.management.J2EEServer;
+import org.apache.geronimo.j2ee.management.J2EEApplication;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.GBeanData;
+
+/**
+ * @version $Rev:  $ $Date:  $
+ */
+public class ResourceAdapterImpl {
+    private final String jcaResource;
+
+    public ResourceAdapterImpl(String objectName, String jcaResource) throws 
MalformedObjectNameException {
+        this.jcaResource = jcaResource;
+    }
+
+    public String getJCAResource() {
+        return jcaResource;
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoBuilder = new 
GBeanInfoBuilder(ResourceAdapterImpl.class, NameFactory.RESOURCE_ADAPTER);
+        infoBuilder.addAttribute("objectName", String.class, false);
+        infoBuilder.addAttribute("JCAResource", String.class, true);
+
+        infoBuilder.setConstructor(new String[]{
+            "objectName",
+            "JCAResource"
+        });
+
+        GBEAN_INFO = infoBuilder.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+
+}

Modified: 
geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/ResourceAdapterModuleImpl.java
URL: 
http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/ResourceAdapterModuleImpl.java?view=diff&r1=154435&r2=154436
==============================================================================
--- 
geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/ResourceAdapterModuleImpl.java
 (original)
+++ 
geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/ResourceAdapterModuleImpl.java
 Sat Feb 19 10:22:02 2005
@@ -29,6 +29,8 @@
 import org.apache.geronimo.j2ee.management.impl.InvalidObjectNameException;
 import org.apache.geronimo.j2ee.management.impl.Util;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContextImpl;
+import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContext;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.jmx.JMXUtil;
 
@@ -36,18 +38,17 @@
  * @version $Rev$ $Date$
  */
 public class ResourceAdapterModuleImpl {
-    private final Kernel kernel;
-    private final String baseName;
     private final J2EEServer server;
     private final J2EEApplication application;
     private final String deploymentDescriptor;
+    private final String[] resourceAdapters;
 
     private final GBeanData resourceAdapterGBeanData;
     private final Map activationSpecInfoMap;
     private final Map adminObjectInfoMap;
     private final Map managedConnectionFactoryInfoMap;
 
-    public ResourceAdapterModuleImpl(Kernel kernel,
+    public ResourceAdapterModuleImpl(String resourceAdapter,
                                      String objectName, 
                                      J2EEServer server, 
                                      J2EEApplication application, 
@@ -59,14 +60,8 @@
         ObjectName myObjectName = JMXUtil.getObjectName(objectName);
         verifyObjectName(myObjectName);
 
-        // build the base name used to query the server for child modules
-        Hashtable keyPropertyList = myObjectName.getKeyPropertyList();
-        String name = (String) keyPropertyList.get("name");
-        String j2eeServerName = (String) keyPropertyList.get("J2EEServer");
-        String j2eeApplicationName = (String) 
keyPropertyList.get("J2EEApplication");
-        baseName = myObjectName.getDomain() + ":J2EEServer=" + j2eeServerName 
+ ",J2EEApplication=" + j2eeApplicationName + ",ResouceAdapterModule=" + name + 
",";
+        this.resourceAdapters = new String[] {resourceAdapter};
 
-        this.kernel = kernel;
         this.server = server;
         this.application = application;
         this.deploymentDescriptor = deploymentDescriptor;
@@ -97,7 +92,7 @@
     }
 
     public String[] getResourceAdapters() throws MalformedObjectNameException {
-        return Util.getObjectNames(kernel, baseName, new 
String[]{"ResourceAdapter"});
+        return resourceAdapters;
     }
 
     public GBeanData getResourceAdapterGBeanData() {
@@ -152,7 +147,7 @@
 
         infoBuilder.addAttribute("deploymentDescriptor", String.class, true);
 
-        infoBuilder.addAttribute("kernel", Kernel.class, false);
+        infoBuilder.addAttribute("resourceAdapter", String.class, true);
         infoBuilder.addAttribute("objectName", String.class, false);
         infoBuilder.addAttribute("server", String.class, false);
         infoBuilder.addAttribute("application", String.class, false);
@@ -165,7 +160,7 @@
         infoBuilder.addAttribute("managedConnectionFactoryInfoMap", Map.class, 
true);
 
         infoBuilder.setConstructor(new String[]{
-            "kernel",
+            "resourceAdapter",
             "objectName",
             "J2EEServer",
             "J2EEApplication",

Modified: 
geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/JCAConnectionFactoryImpl.java
URL: 
http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/JCAConnectionFactoryImpl.java?view=diff&r1=154435&r2=154436
==============================================================================
--- 
geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/JCAConnectionFactoryImpl.java
 (original)
+++ 
geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/JCAConnectionFactoryImpl.java
 Sat Feb 19 10:22:02 2005
@@ -41,9 +41,9 @@
         this.managedConnectionFactory = managedConnectionFactory;
     }
 
-    public String getServer() {
-        return server.getObjectName();
-    }
+//    public String getServer() {
+//        return server.getObjectName();
+//    }
 
     public String getManagedConnectionFactory() {
         return managedConnectionFactory;
@@ -83,7 +83,7 @@
         infoFactory.addReference("J2EEServer", J2EEServer.class);
 
         infoFactory.addAttribute("objectName", String.class, false);
-        infoFactory.addAttribute("server", String.class, false);
+//        infoFactory.addAttribute("server", String.class, false);
         infoFactory.addAttribute("managedConnectionFactory", String.class, 
true);
 
         infoFactory.setConstructor(new String[]{"objectName", "J2EEServer", 
"managedConnectionFactory"});

Modified: 
geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/AdminObjectWrapperTest.java
URL: 
http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/AdminObjectWrapperTest.java?view=diff&r1=154435&r2=154436
==============================================================================
--- 
geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/AdminObjectWrapperTest.java
 (original)
+++ 
geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/AdminObjectWrapperTest.java
 Sat Feb 19 10:22:02 2005
@@ -26,11 +26,12 @@
 import junit.framework.TestCase;
 import org.apache.geronimo.connector.mock.MockAdminObject;
 import org.apache.geronimo.connector.mock.MockAdminObjectImpl;
-import org.apache.geronimo.gbean.jmx.GBeanMBean;
+import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContext;
 import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContextImpl;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.registry.BasicGBeanRegistry;
 
 /**
  * @version $Rev$ $Date$
@@ -101,15 +102,15 @@
 //    }
 
     protected void setUp() throws Exception {
-        J2eeContext j2eeContext = new J2eeContextImpl("test.domain", 
"geronimo.server", "testapp", "testmodule", TARGET_NAME, 
NameFactory.JMS_RESOURCE);
-        kernel = new Kernel(j2eeContext.getJ2eeServerName(), 
j2eeContext.getJ2eeDomainName());
+        J2eeContext j2eeContext = new J2eeContextImpl("test.domain", 
"geronimo.server", "testapp", NameFactory.RESOURCE_ADAPTER_MODULE, 
"testmodule", TARGET_NAME, NameFactory.JMS_RESOURCE);
+        kernel = new Kernel(j2eeContext.getJ2eeDomainName(), new 
BasicGBeanRegistry());
         kernel.boot();
         selfName = NameFactory.getResourceComponentName(null, null, null, 
null, null, null, j2eeContext);
 
-        GBeanMBean aow = new GBeanMBean(AdminObjectWrapper.getGBeanInfo());
+        GBeanData aow = new GBeanData(selfName, 
AdminObjectWrapper.getGBeanInfo());
         aow.setAttribute("adminObjectInterface", 
MockAdminObject.class.getName());
         aow.setAttribute("adminObjectClass", 
MockAdminObjectImpl.class.getName());
-        kernel.loadGBean(selfName, aow);
+        kernel.loadGBean(aow, this.getClass().getClassLoader());
 
         kernel.startGBean(selfName);
     }

Modified: 
geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapperTest.java
URL: 
http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapperTest.java?view=diff&r1=154435&r2=154436
==============================================================================
--- 
geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapperTest.java
 (original)
+++ 
geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapperTest.java
 Sat Feb 19 10:22:02 2005
@@ -155,7 +155,7 @@
         cmfName = ObjectName.getInstance("test:role=ConnectionManagerFactory");
         kernel.loadGBean(cmfName, cmf);
 
-        J2eeContext j2eeContext = new J2eeContextImpl("test.domain", 
"geronimo", "testapplication", "testmodule", TARGET_NAME, 
NameFactory.JCA_MANAGED_CONNECTION_FACTORY);
+        J2eeContext j2eeContext = new J2eeContextImpl("test.domain", 
"geronimo", "testapplication", "noModuleType", "testmodule", TARGET_NAME, 
NameFactory.JCA_MANAGED_CONNECTION_FACTORY);
         managedConnectionFactoryName = 
NameFactory.getResourceComponentName(null, null, null, null, null, null, 
j2eeContext);
 
         GBeanMBean mcfw = new 
GBeanMBean(ManagedConnectionFactoryWrapper.getGBeanInfo());

Modified: 
geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARContext.java
URL: 
http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARContext.java?view=diff&r1=154435&r2=154436
==============================================================================
--- 
geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARContext.java
 (original)
+++ 
geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARContext.java
 Sat Feb 19 10:22:02 2005
@@ -48,7 +48,7 @@
 
     public EARContext(File baseDir, URI id, ConfigurationModuleType 
moduleType, URI parentID, Kernel kernel, String j2eeApplicationName, ObjectName 
transactionContextManagerObjectName, ObjectName connectionTrackerObjectName, 
ObjectName transactedTimerName, ObjectName nonTransactedTimerName, RefContext 
refContext) throws MalformedObjectNameException, DeploymentException {
         super(baseDir, id, moduleType, parentID, kernel);
-        j2eeContext = new J2eeContextImpl(getDomain(), getServer(), 
j2eeApplicationName == null ? NameFactory.NULL : j2eeApplicationName, null, 
null, null);
+        j2eeContext = new J2eeContextImpl(getDomain(), getServer(), 
j2eeApplicationName == null ? NameFactory.NULL : j2eeApplicationName, null, 
null, null, null);
         domainObjectName = NameFactory.getDomainName(null, j2eeContext);
         serverObjectName = NameFactory.getServerName(null, null, j2eeContext);
 

Modified: 
geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/j2eeobjectnames/J2eeContext.java
URL: 
http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/j2eeobjectnames/J2eeContext.java?view=diff&r1=154435&r2=154436
==============================================================================
--- 
geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/j2eeobjectnames/J2eeContext.java
 (original)
+++ 
geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/j2eeobjectnames/J2eeContext.java
 Sat Feb 19 10:22:02 2005
@@ -48,4 +48,7 @@
 
     String getJ2eeType(String override);
 
+    String getJ2eeModuleType();
+
+    String getJ2eeModuleType(String override);
 }

Modified: 
geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/j2eeobjectnames/J2eeContextImpl.java
URL: 
http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/j2eeobjectnames/J2eeContextImpl.java?view=diff&r1=154435&r2=154436
==============================================================================
--- 
geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/j2eeobjectnames/J2eeContextImpl.java
 (original)
+++ 
geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/j2eeobjectnames/J2eeContextImpl.java
 Sat Feb 19 10:22:02 2005
@@ -26,29 +26,51 @@
     private final String domainName;
     private final String serverName;
     private final String applicationName;
+    private final String moduleType;
     private final String moduleName;
     private final String j2eeName;
     private final String j2eeType;
 
-    public J2eeContextImpl(String domainName, String serverName, String 
applicationName, String moduleName, String j2eeName, String j2eeType) {
+    public J2eeContextImpl(String domainName, String serverName, String 
applicationName, String moduleType, String moduleName, String j2eeName, String 
j2eeType) {
         this.domainName = domainName;
         this.serverName = serverName;
         this.applicationName = applicationName;
+        this.moduleType = moduleType;
         this.moduleName = moduleName;
         this.j2eeName = j2eeName;
         this.j2eeType = j2eeType;
     }
 
-    public J2eeContextImpl(ObjectName source, String moduleType) {
-        this.domainName = source.getDomain();
-        this.serverName = source.getKeyProperty(NameFactory.J2EE_SERVER);
-        this.applicationName = 
source.getKeyProperty(NameFactory.J2EE_APPLICATION);
-        this.moduleName = source.getKeyProperty(moduleType);
-        this.j2eeType = source.getKeyProperty(NameFactory.J2EE_TYPE);
-        this.j2eeName = source.getKeyProperty(NameFactory.J2EE_NAME);
+    public static J2eeContextImpl newContext(ObjectName source, String 
moduleType) {
+        return new J2eeContextImpl(source.getDomain(),
+                source.getKeyProperty(NameFactory.J2EE_SERVER),
+                source.getKeyProperty(NameFactory.J2EE_APPLICATION),
+                moduleType,
+                source.getKeyProperty(moduleType),
+                source.getKeyProperty(NameFactory.J2EE_TYPE),
+                source.getKeyProperty(NameFactory.J2EE_NAME));
+    }
+
+    public static J2eeContextImpl newModuleContextFromApplication(ObjectName 
source, String moduleType, String moduleName) {
+        return new J2eeContextImpl(source.getDomain(),
+                source.getKeyProperty(NameFactory.J2EE_SERVER),
+                source.getKeyProperty(NameFactory.J2EE_NAME), //application 
name in module is name key property in application's object name
+                moduleType,
+                moduleName,
+                null,
+                null);
+    }
+
+    public static J2eeContextImpl newModuleContextFromApplication(J2eeContext 
source, String moduleType, String moduleName) {
+        return new J2eeContextImpl(source.getJ2eeDomainName(),
+                source.getJ2eeServerName(),
+                source.getJ2eeApplicationName(),
+                moduleType,
+                moduleName,
+                null,
+                null);
     }
 
-
     public String getJ2eeDomainName() {
         return domainName;
     }
@@ -61,6 +83,10 @@
         return applicationName;
     }
 
+    public String getJ2eeModuleType() {
+        return moduleType;
+    }
+
     public String getJ2eeModuleName() {
         return moduleName;
     }
@@ -74,27 +100,31 @@
     }
 
     public String getJ2eeDomainName(String override) {
-        return override == null? domainName: override;
+        return override == null ? domainName : override;
     }
 
     public String getJ2eeServerName(String override) {
-        return override == null? serverName: override;
+        return override == null ? serverName : override;
     }
 
     public String getJ2eeApplicationName(String override) {
-        return override == null? applicationName: override;
+        return override == null ? applicationName : override;
+    }
+
+    public String getJ2eeModuleType(String override) {
+        return override == null ? moduleType : override;
     }
 
     public String getJ2eeModuleName(String override) {
-        return override == null? moduleName: override;
+        return override == null ? moduleName : override;
     }
 
     //most likely the last 2 don't make any sense.
     public String getJ2eeName(String override) {
-        return override == null? j2eeName: override;
+        return override == null ? j2eeName : override;
     }
 
     public String getJ2eeType(String override) {
-        return override == null? j2eeType: override;
+        return override == null ? j2eeType : override;
     }
 }

Modified: 
geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/j2eeobjectnames/NameFactory.java
URL: 
http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/j2eeobjectnames/NameFactory.java?view=diff&r1=154435&r2=154436
==============================================================================
--- 
geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/j2eeobjectnames/NameFactory.java
 (original)
+++ 
geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/j2eeobjectnames/NameFactory.java
 Sat Feb 19 10:22:02 2005
@@ -94,6 +94,7 @@
     public static final String CONFIGURATION_ENTRY = "ConfigurationEntry";
     public static final String PERSISTENT_CONFIGURATION_LIST = 
"PersistentConfigurationList"; //duplicated in FileConfigurationList
 //    public static final String URL_PATTERN = "URLPattern";
+    public static String DEFAULT_SERVLET = "DefaultServlet";
 
     public static ObjectName getDomainName(String j2eeDomainName, J2eeContext 
context) throws MalformedObjectNameException {
         Properties props = new Properties();
@@ -117,38 +118,36 @@
         return 
ObjectName.getInstance(context.getJ2eeDomainName(j2eeDomainName), props);
     }
 
-    public static ObjectName getModuleName(String j2eeDomainName, String 
j2eeServerName, String j2eeApplicationName, String j2eeModuleName, String 
j2eeType, J2eeContext context) throws MalformedObjectNameException {
+    public static ObjectName getModuleName(String j2eeDomainName, String 
j2eeServerName, String j2eeApplicationName, String j2eeModuleType, String 
j2eeModuleName, J2eeContext context) throws MalformedObjectNameException {
         Properties props = new Properties();
-        props.put(J2EE_TYPE, context.getJ2eeType(j2eeType));
+        //N.B.! module context will have the module's j2eeType as its module 
type attribute.
+        props.put(J2EE_TYPE, context.getJ2eeModuleType(j2eeModuleType));
         props.put(J2EE_SERVER, context.getJ2eeServerName(j2eeServerName));
         props.put(J2EE_APPLICATION, 
context.getJ2eeApplicationName(j2eeApplicationName));
         props.put(J2EE_NAME, context.getJ2eeModuleName(j2eeModuleName));
         return 
ObjectName.getInstance(context.getJ2eeDomainName(j2eeDomainName), props);
     }
 
-    public static ObjectName getEjbComponentName(String j2eeDomainName, String 
j2eeServerName, String j2eeApplicationName, String j2eeModuleName, String 
j2eeName, String j2eeType, J2eeContext context) throws 
MalformedObjectNameException {
+    public static ObjectName getComponentName(String j2eeDomainName, String 
j2eeServerName, String j2eeApplicationName, String j2eeModuleType, String 
j2eeModuleName, String j2eeName, String j2eeType, J2eeContext context) throws 
MalformedObjectNameException {
         Properties props = new Properties();
         props.put(J2EE_TYPE, context.getJ2eeType(j2eeType));
         props.put(J2EE_SERVER, context.getJ2eeServerName(j2eeServerName));
         props.put(J2EE_APPLICATION, 
context.getJ2eeApplicationName(j2eeApplicationName));
-        props.put(EJB_MODULE, context.getJ2eeModuleName(j2eeModuleName));
+        props.put(context.getJ2eeModuleType(j2eeModuleType), 
context.getJ2eeModuleName(j2eeModuleName));
         props.put(J2EE_NAME, context.getJ2eeName(j2eeName));
         return 
ObjectName.getInstance(context.getJ2eeDomainName(j2eeDomainName), props);
     }
 
+    public static ObjectName getEjbComponentName(String j2eeDomainName, String 
j2eeServerName, String j2eeApplicationName, String j2eeModuleName, String 
j2eeName, String j2eeType, J2eeContext context) throws 
MalformedObjectNameException {
+        return getComponentName(j2eeDomainName, j2eeServerName, 
j2eeApplicationName, EJB_MODULE, j2eeModuleName, j2eeName, j2eeType, context);
+    }
+
     public static String getEjbComponentNameString(String j2eeDomainName, 
String j2eeServerName, String j2eeApplicationName, String j2eeModuleName, 
String j2eeName, String j2eeType, J2eeContext context) throws 
MalformedObjectNameException {
         return getEjbComponentName(j2eeDomainName, j2eeServerName, 
j2eeApplicationName, j2eeModuleName, j2eeName, j2eeType, 
context).getCanonicalName();
     }
 
     public static ObjectName getResourceComponentName(String j2eeDomainName, 
String j2eeServerName, String j2eeApplicationName, String j2eeModuleName, 
String j2eeName, String j2eeType, J2eeContext context) throws 
MalformedObjectNameException {
-        Properties props = new Properties();
-        props.put(J2EE_TYPE, context.getJ2eeType(j2eeType));
-        props.put(J2EE_SERVER, context.getJ2eeServerName(j2eeServerName));
-        props.put(J2EE_APPLICATION, 
context.getJ2eeApplicationName(j2eeApplicationName));
-//        props.put(RESOURCE_ADAPTER_MODULE, 
context.getJ2eeModuleName(j2eeModuleName));
-        props.put(JCA_RESOURCE, context.getJ2eeModuleName(j2eeModuleName));
-        props.put(J2EE_NAME, context.getJ2eeName(j2eeName));
-        return 
ObjectName.getInstance(context.getJ2eeDomainName(j2eeDomainName), props);
+        return getComponentName(j2eeDomainName, j2eeServerName, 
j2eeApplicationName, RESOURCE_ADAPTER_MODULE, j2eeModuleName, j2eeName, 
j2eeType, context);
     }
 
     public static String getResourceComponentNameString(String j2eeDomainName, 
String j2eeServerName, String j2eeApplicationName, String j2eeModuleName, 
String j2eeName, String j2eeType, J2eeContext context) throws 
MalformedObjectNameException {
@@ -182,17 +181,21 @@
         return ObjectName.getInstance(buffer.toString());
     }
 
+    public static ObjectName getComponentInModuleQuery(String j2eeDomainName, 
String j2eeServerName, String applicationName, String j2eeModuleType, String 
j2eeModuleName, String j2eeType, J2eeContext context) throws 
MalformedObjectNameException {
+        StringBuffer buffer = new 
StringBuffer(context.getJ2eeDomainName(j2eeDomainName))
+                .append(":" + J2EE_TYPE + 
"=").append(context.getJ2eeType(j2eeType))
+                .append("," + J2EE_SERVER + 
"=").append(context.getJ2eeServerName(j2eeServerName))
+                .append("," + J2EE_APPLICATION + 
"=").append(context.getJ2eeApplicationName(applicationName))
+                
.append(",").append(context.getJ2eeModuleType(j2eeModuleType)).append("=").append(context.getJ2eeModuleName(j2eeModuleName))
+                .append(",*");
+        return ObjectName.getInstance(buffer.toString());
+    }
+
     public static ObjectName getWebComponentName(String j2eeDomainName, String 
j2eeServerName, String j2eeApplicationName, String j2eeModuleName, String 
j2eeName, String j2eeType, J2eeContext context) throws 
MalformedObjectNameException {
-        Properties props = new Properties();
-        props.put(J2EE_TYPE, context.getJ2eeType(j2eeType));
-        props.put(J2EE_SERVER, context.getJ2eeServerName(j2eeServerName));
-        props.put(J2EE_APPLICATION, 
context.getJ2eeApplicationName(j2eeApplicationName));
-        props.put(WEB_MODULE, context.getJ2eeModuleName(j2eeModuleName));
-        props.put(J2EE_NAME, context.getJ2eeName(j2eeName));
-        return 
ObjectName.getInstance(context.getJ2eeDomainName(j2eeDomainName), props);
+        return getComponentName(j2eeDomainName, j2eeServerName, 
j2eeApplicationName, WEB_MODULE, j2eeModuleName, j2eeName, j2eeType, context);
     }
 
-    //THIS IS KIND OF WEIRD. Is there a better way???
+    //TODO THIS IS KIND OF WEIRD. Is there a better way???
     public static ObjectName getWebFilterMappingName(String j2eeDomainName, 
String j2eeServerName, String j2eeApplicationName, String j2eeModuleName, 
String filterName, String servletName, String urlPattern, J2eeContext context) 
throws MalformedObjectNameException {
         Properties props = new Properties();
         props.put(J2EE_TYPE, WEB_FILTER_MAPPING);

Modified: 
geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/Util.java
URL: 
http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/Util.java?view=diff&r1=154435&r2=154436
==============================================================================
--- 
geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/Util.java
 (original)
+++ 
geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/Util.java
 Sat Feb 19 10:22:02 2005
@@ -24,11 +24,29 @@
 import javax.management.ObjectName;
 
 import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContext;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 
 /**
  * @version $Rev$ $Date$
  */
 public class Util {
+
+    public static String[] getObjectNames(Kernel kernel, J2eeContext context, 
String[] j2eeTypes) throws MalformedObjectNameException {
+        List objectNames = new LinkedList();
+        for (int i = 0; i < j2eeTypes.length; i++) {
+            String j2eeType = j2eeTypes[i];
+            ObjectName query = NameFactory.getComponentInModuleQuery(null, 
null, null, null, null, j2eeType,  context);
+            objectNames.addAll(kernel.listGBeans(query));
+        }
+        String[] names = new String[objectNames.size()];
+        Iterator iterator = objectNames.iterator();
+        for (int i = 0; iterator.hasNext(); i++) {
+            names[i] = iterator.next().toString();
+        }
+        return names;
+    }
+
     public static String[] getObjectNames(Kernel kernel, Object parentName, 
String[] j2eeTypes) throws MalformedObjectNameException {
         List objectNames = new LinkedList();
         for (int i = 0; i < j2eeTypes.length; i++) {

Modified: 
geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
URL: 
http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java?view=diff&r1=154435&r2=154436
==============================================================================
--- 
geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
 (original)
+++ 
geronimo/trunk/modules/jetty-builder/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
 Sat Feb 19 10:22:02 2005
@@ -323,7 +323,7 @@
 
     public String addGBeans(EARContext earContext, Module module, ClassLoader 
cl) throws DeploymentException {
         J2eeContext earJ2eeContext = earContext.getJ2eeContext();
-        J2eeContext moduleJ2eeContext = new 
J2eeContextImpl(earJ2eeContext.getJ2eeDomainName(), 
earJ2eeContext.getJ2eeServerName(), earJ2eeContext.getJ2eeApplicationName(), 
module.getName(), null, null);
+        J2eeContext moduleJ2eeContext = 
J2eeContextImpl.newModuleContextFromApplication(earJ2eeContext, 
NameFactory.WEB_MODULE, module.getName());
         WebModule webModule = (WebModule) module;
 
         WebAppType webApp = (WebAppType) webModule.getSpecDD();
@@ -343,7 +343,7 @@
 
         ObjectName webModuleName = null;
         try {
-            webModuleName = NameFactory.getModuleName(null, null, null, null, 
NameFactory.WEB_MODULE, moduleJ2eeContext);
+            webModuleName = NameFactory.getModuleName(null, null, null, null, 
null, moduleJ2eeContext);
         } catch (MalformedObjectNameException e) {
             throw new DeploymentException("Could not construct module name", 
e);
         }
@@ -354,6 +354,12 @@
 
         GBeanData webModuleData = new GBeanData(webModuleName, 
JettyWebAppContext.GBEAN_INFO);
         try {
+            webModuleData.setReferencePattern("J2EEServer", 
earContext.getServerObjectName());
+            if (!earContext.getJ2EEApplicationName().equals("null")) {
+                webModuleData.setReferencePattern("J2EEApplication", 
earContext.getApplicationObjectName());
+            }
+
+            webModuleData.setAttribute("deploymentDescriptor", 
module.getOriginalSpecDD());
             Set securityRoles = collectRoleNames(webApp);
             if (jettyWebApp.isSetSecurityRealmName()) {
                 String securityRealmName = 
jettyWebApp.getSecurityRealmName().trim();

Modified: 
geronimo/trunk/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java
URL: 
http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java?view=diff&r1=154435&r2=154436
==============================================================================
--- 
geronimo/trunk/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java
 (original)
+++ 
geronimo/trunk/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java
 Sat Feb 19 10:22:02 2005
@@ -50,6 +50,7 @@
 import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContext;
 import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContextImpl;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.j2ee.management.impl.J2EEServerImpl;
 import org.apache.geronimo.jetty.JettyContainerImpl;
 import org.apache.geronimo.jetty.connector.HTTPConnector;
 import org.apache.geronimo.kernel.Kernel;
@@ -83,7 +84,7 @@
     private ObjectName tcmName;
     private GBeanData tcm;
     private ClassLoader cl;
-    private J2eeContext moduleContext = new J2eeContextImpl("jetty.test", 
"test", "null", "jettyTest", null, null);
+    private J2eeContext moduleContext = new J2eeContextImpl("jetty.test", 
"test", "null", NameFactory.WEB_MODULE, "jettyTest", null, null);
     private JettyModuleBuilder builder;
     private File basedir = new File(System.getProperty("basedir", "."));
     private URI parentId = URI.create("org/apache/geronimo/Foo");
@@ -97,6 +98,9 @@
         Module module = builder.createModule(null, jarFile);
         URI id = new URI("war4");
         EARContext earContext = createEARContext(outputPath, id);
+        ObjectName serverName = earContext.getServerObjectName();
+        GBeanData server = new GBeanData(serverName, 
J2EEServerImpl.GBEAN_INFO);
+        start(server);
         builder.initContext(earContext, module, cl);
         builder.addGBeans(earContext, module, cl);
         earContext.close();
@@ -109,6 +113,7 @@
         if (((Integer) kernel.getAttribute(configData.getName(), 
"state")).intValue() != State.RUNNING_INDEX) {
             fail("gbean not started: " + configData.getName());
         }
+        assertEquals(new Integer(State.RUNNING_INDEX), 
kernel.getAttribute(ObjectName.getInstance("test:J2EEApplication=null,J2EEServer=bar,j2eeType=WebModule,name=war4"),
 "state"));
         Set names = 
kernel.listGBeans(ObjectName.getInstance("test:J2EEApplication=null,J2EEServer=bar,WebModule=war4,*"));
         System.out.println("Object names: " + names);
         for (Iterator iterator = names.iterator(); iterator.hasNext();) {
@@ -205,8 +210,8 @@
         connectorName = NameFactory.getWebComponentName(null, null, null, 
null, "jettyConnector", "WebResource", moduleContext);
 //        webModuleName = NameFactory.getWebComponentName(null, null, null, 
null, NameFactory.WEB_MODULE, "WebResource", moduleContext);
 
-        tmName = NameFactory.getComponentName(null, null, null, null, 
"TransactionManager", NameFactory.JTA_RESOURCE, moduleContext);
-        tcmName = NameFactory.getComponentName(null, null, null, null, 
"TransactionContextManager", NameFactory.JTA_RESOURCE, moduleContext);
+        tmName = NameFactory.getComponentName(null, null, null, null, null, 
"TransactionManager", NameFactory.JTA_RESOURCE, moduleContext);
+        tcmName = NameFactory.getComponentName(null, null, null, null, null, 
"TransactionContextManager", NameFactory.JTA_RESOURCE, moduleContext);
         ctcName = new 
ObjectName("geronimo.test:role=ConnectionTrackingCoordinator");
 
         kernel = new Kernel("foo", new BasicGBeanRegistry());
@@ -246,6 +251,8 @@
         start(tcm);
         ctc = new GBeanData(ctcName, ConnectionTrackingCoordinator.GBEAN_INFO);
         start(ctc);
+
+
     }
 
     protected void tearDown() throws Exception {

Modified: 
geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyServletHolder.java
URL: 
http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyServletHolder.java?view=diff&r1=154435&r2=154436
==============================================================================
--- 
geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyServletHolder.java
 (original)
+++ 
geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyServletHolder.java
 Sat Feb 19 10:22:02 2005
@@ -106,7 +106,7 @@
     public static final GBeanInfo GBEAN_INFO;
 
     static {
-        GBeanInfoBuilder infoBuilder = new 
GBeanInfoBuilder(JettyServletHolder.class, NameFactory.SERVLET);
+        GBeanInfoBuilder infoBuilder = new 
GBeanInfoBuilder(JettyServletHolder.class, NameFactory.DEFAULT_SERVLET);
         //todo replace with interface
         infoBuilder.addInterface(ServletHolder.class);
         

Modified: 
geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java
URL: 
http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java?view=diff&r1=154435&r2=154436
==============================================================================
--- 
geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java
 (original)
+++ 
geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java
 Sat Feb 19 10:22:02 2005
@@ -24,10 +24,13 @@
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
+import java.util.Hashtable;
 import java.security.PermissionCollection;
 import java.io.IOException;
 
 import javax.naming.Context;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -57,9 +60,17 @@
 import org.apache.geronimo.transaction.context.TransactionContextManager;
 import org.apache.geronimo.security.deploy.Security;
 import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.jmx.JMXUtil;
 import org.apache.geronimo.naming.reference.KernelAwareReference;
 import org.apache.geronimo.naming.reference.ClassLoaderAwareReference;
 import org.apache.geronimo.naming.java.SimpleReadOnlyContext;
+import org.apache.geronimo.j2ee.management.J2EEServer;
+import org.apache.geronimo.j2ee.management.J2EEApplication;
+import org.apache.geronimo.j2ee.management.impl.Util;
+import org.apache.geronimo.j2ee.management.impl.InvalidObjectNameException;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContext;
+import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContextImpl;
 
 /**
  * Wrapper for a WebApplicationContext that sets up its J2EE environment.
@@ -69,6 +80,13 @@
 public class JettyWebAppContext extends WebApplicationContext implements 
GBeanLifecycle, JettyServletRegistration {
     private static Log log = LogFactory.getLog(JettyWebAppContext.class);
 
+    private final Kernel kernel;
+    //jsr-77 stuff
+    private final J2eeContext moduleContext;
+    private final String originalSpecDD;
+    private final J2EEServer server;
+    private final J2EEApplication application;
+
     private final ClassLoader webClassLoader;
     private final JettyContainer jettyContainer;
 
@@ -80,11 +98,17 @@
     private final  BeforeAfter chain;
     private final  int contextLength;
     private final SecurityContextBeforeAfter securityInterceptor;
+    private static final String[] J2EE_TYPES = {NameFactory.SERVLET};
 
     /**
      * @deprecated never use this... this is only here because Jetty 
WebApplicationContext is externalizable
      */
     public JettyWebAppContext() {
+        kernel = null;
+        server = null;
+        application = null;
+        moduleContext = null;
+        originalSpecDD = null;
         webClassLoader = null;
         jettyContainer = null;
         webAppRoot = null;
@@ -96,42 +120,46 @@
 
     }
 
-    public JettyWebAppContext(URI uri,
-                                  Map componentContext,
-                                  OnlineUserTransaction userTransaction,
-                                  ClassLoader classLoader,
-                                  URI[] webClassPath,
-                                  boolean contextPriorityClassLoader,
-                                  URL configurationBaseUrl,
-                                  Set unshareableResources,
-                                  Set applicationManagedSecurityResources,
-
-                                  String displayName,
-                                  Map contextParamMap,
-                                  Collection listenerClassNames,
-                                  boolean distributable,
-                                  Map mimeMap,
-                                  String[] welcomeFiles,
-                                  Map localeEncodingMapping,
-                                  Map errorPages,
-                                  Authenticator authenticator,
-                                  String realmName,
-                                  Map tagLibMap,
-                                  int sessionTimeoutSeconds,
-
-                                  String policyContextID,
-                                  String securityRealmName,
-                                  Security securityConfig,
-                                  //from jettyxmlconfig
-                                  Set securityRoles,
-                                  PermissionCollection uncheckedPermissions,
-                                  PermissionCollection excludedPermissions,
-                                  Map rolePermissions,
-
-                                  TransactionContextManager 
transactionContextManager,
-                                  TrackedConnectionAssociator 
trackedConnectionAssociator,
-                                  JettyContainer jettyContainer,
-                                  Kernel kernel) throws Exception, 
IllegalAccessException, InstantiationException, ClassNotFoundException {
+    public JettyWebAppContext(String objectName,
+                              String originalSpecDD,
+                              URI uri,
+                              Map componentContext,
+                              OnlineUserTransaction userTransaction,
+                              ClassLoader classLoader,
+                              URI[] webClassPath,
+                              boolean contextPriorityClassLoader,
+                              URL configurationBaseUrl,
+                              Set unshareableResources,
+                              Set applicationManagedSecurityResources,
+
+                              String displayName,
+                              Map contextParamMap,
+                              Collection listenerClassNames,
+                              boolean distributable,
+                              Map mimeMap,
+                              String[] welcomeFiles,
+                              Map localeEncodingMapping,
+                              Map errorPages,
+                              Authenticator authenticator,
+                              String realmName,
+                              Map tagLibMap,
+                              int sessionTimeoutSeconds,
+
+                              String policyContextID,
+                              String securityRealmName,
+                              Security securityConfig,
+                              //from jettyxmlconfig
+                              Set securityRoles,
+                              PermissionCollection uncheckedPermissions,
+                              PermissionCollection excludedPermissions,
+                              Map rolePermissions,
+
+                              TransactionContextManager 
transactionContextManager,
+                              TrackedConnectionAssociator 
trackedConnectionAssociator,
+                              JettyContainer jettyContainer,
+                              J2EEServer server,
+                              J2EEApplication application,
+                              Kernel kernel) throws Exception, 
IllegalAccessException, InstantiationException, ClassNotFoundException {
 
         assert uri != null;
         assert componentContext != null;
@@ -143,8 +171,17 @@
         assert trackedConnectionAssociator != null;
         assert jettyContainer != null;
 
+        this.kernel = kernel;
+        this.server = server;
+        this.application = application;
+        ObjectName myObjectName = JMXUtil.getObjectName(objectName);
+        verifyObjectName(myObjectName);
+        moduleContext = J2eeContextImpl.newContext(myObjectName, 
NameFactory.WEB_MODULE);
+
         this.jettyContainer = jettyContainer;
 
+        this.originalSpecDD = originalSpecDD;
+
         setConfigurationClassNames(new String[]{});
 
         URI root = URI.create(configurationBaseUrl.toString());
@@ -356,7 +393,55 @@
         super.setDisplayName(displayName);
     }
 
+    public String getDeploymentDescriptor() {
+        return originalSpecDD;
+    }
+
+    public String getServer() {
+        return server.getObjectName();
+    }
+
+    public String getApplication() {
+        if (application == null) {
+            return null;
+        }
+        return application.getObjectName();
+    }
+
+    public String[] getJavaVMs() {
+        return server.getJavaVMs();
+    }
 
+    public String[] getServlets() throws MalformedObjectNameException {
+        return Util.getObjectNames(kernel, moduleContext, J2EE_TYPES);
+    }
+
+    /**
+     * ObjectName must match this pattern:
+     * <p/>
+     * 
domain:j2eeType=WebModule,name=MyName,J2EEServer=MyServer,J2EEApplication=MyApplication
+     */
+    private void verifyObjectName(ObjectName objectName) {
+        if (objectName.isPattern()) {
+            throw new InvalidObjectNameException("ObjectName can not be a 
pattern", objectName);
+        }
+        Hashtable keyPropertyList = objectName.getKeyPropertyList();
+        if (!NameFactory.WEB_MODULE.equals(keyPropertyList.get("j2eeType"))) {
+            throw new InvalidObjectNameException("WebModule object name 
j2eeType property must be 'WebModule'", objectName);
+        }
+        if (!keyPropertyList.containsKey(NameFactory.J2EE_NAME)) {
+            throw new InvalidObjectNameException("WebModule object must 
contain a name property", objectName);
+        }
+        if (!keyPropertyList.containsKey(NameFactory.J2EE_SERVER)) {
+            throw new InvalidObjectNameException("WebModule object name must 
contain a J2EEServer property", objectName);
+        }
+        if (!keyPropertyList.containsKey(NameFactory.J2EE_APPLICATION)) {
+            throw new InvalidObjectNameException("WebModule object name must 
contain a J2EEApplication property", objectName);
+        }
+        if (keyPropertyList.size() != 4) {
+            throw new InvalidObjectNameException("WebModule object name can 
only have j2eeType, name, J2EEApplication, and J2EEServer properties", 
objectName);
+        }
+    }
     public void registerServletHolder(ServletHolder servletHolder, String 
servletName, Set servletMappings, Map webRoleRefPermissions) throws Exception {
         //TODO filters
         handler.addServletHolder(servletHolder);
@@ -389,6 +474,7 @@
                                                               
     static {
         GBeanInfoBuilder infoBuilder = new GBeanInfoBuilder("Jetty 
WebApplication Context", JettyWebAppContext.class);
+        infoBuilder.addAttribute("deploymentDescriptor", String.class, true);
         //from jetty's webapp context
 
         infoBuilder.addAttribute("displayName", String.class, true);
@@ -433,9 +519,19 @@
         infoBuilder.addAttribute("excludedPermissions", 
PermissionCollection.class, true);
         infoBuilder.addAttribute("rolePermissions", Map.class, true);
 
+        infoBuilder.addReference("J2EEServer", J2EEServer.class);
+        infoBuilder.addReference("J2EEApplication", J2EEApplication.class);
+
         infoBuilder.addAttribute("kernel", Kernel.class, false);
+        infoBuilder.addAttribute("objectName", String.class, false);
+        infoBuilder.addAttribute("server", String.class, false);
+        infoBuilder.addAttribute("application", String.class, false);
+        infoBuilder.addAttribute("javaVMs", String[].class, false);
+        infoBuilder.addAttribute("servlets", String[].class, false);
 
         infoBuilder.setConstructor(new String[]{
+            "objectName",
+            "deploymentDescriptor",
             "uri",
             "componentContext",
             "userTransaction",
@@ -472,6 +568,8 @@
             "TrackedConnectionAssociator",
             "JettyContainer",
 
+            "J2EEServer",
+            "J2EEApplication",
             "kernel"
         });
 

Modified: 
geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/AbstractWebModuleTest.java
URL: 
http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/AbstractWebModuleTest.java?view=diff&r1=154435&r2=154436
==============================================================================
--- 
geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/AbstractWebModuleTest.java
 (original)
+++ 
geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/AbstractWebModuleTest.java
 Sat Feb 19 10:22:02 2005
@@ -67,7 +67,7 @@
     private ObjectName tcmName;
     private GBeanData tcm;
     private ClassLoader cl;
-    private J2eeContext moduleContext = new J2eeContextImpl("jetty.test", 
"test", "null", "jettyTest", null, null);
+    private J2eeContext moduleContext = new J2eeContextImpl("jetty.test", 
"test", "null", NameFactory.WEB_MODULE, "jettyTest", null, null);
     private GBeanData loginConfigurationGBean;
     protected ObjectName loginConfigurationName;
     private GBeanData securityServiceGBean;
@@ -239,10 +239,10 @@
         cl = this.getClass().getClassLoader();
         containerName = NameFactory.getWebComponentName(null, null, null, 
null, "jettyContainer", "WebResource", moduleContext);
         connectorName = NameFactory.getWebComponentName(null, null, null, 
null, "jettyConnector", "WebResource", moduleContext);
-        webModuleName = NameFactory.getWebComponentName(null, null, null, 
null, NameFactory.WEB_MODULE, "WebResource", moduleContext);
+        webModuleName = NameFactory.getModuleName(null, null, null, null, 
"testModule", moduleContext);
 
-        tmName = NameFactory.getComponentName(null, null, null, null, 
"TransactionManager", NameFactory.JTA_RESOURCE, moduleContext);
-        tcmName = NameFactory.getComponentName(null, null, null, null, 
"TransactionContextManager", NameFactory.JTA_RESOURCE, moduleContext);
+        tmName = NameFactory.getComponentName(null, null, null, null, null, 
"TransactionManager", NameFactory.JTA_RESOURCE, moduleContext);
+        tcmName = NameFactory.getComponentName(null, null, null, null, null, 
"TransactionContextManager", NameFactory.JTA_RESOURCE, moduleContext);
         ctcName = new 
ObjectName("geronimo.test:role=ConnectionTrackingCoordinator");
 
         kernel = new Kernel("test.kernel");

Modified: 
geronimo/trunk/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java
URL: 
http://svn.apache.org/viewcvs/geronimo/trunk/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java?view=diff&r1=154435&r2=154436
==============================================================================
--- 
geronimo/trunk/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java
 (original)
+++ 
geronimo/trunk/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java
 Sat Feb 19 10:22:02 2005
@@ -222,13 +222,14 @@
         } else {
             //construct name from components
             try {
-                containerId = 
NameFactory.getResourceComponentNameString(getStringValue(gerResourceRef.getDomain()),
+                containerId = 
NameFactory.getComponentName(getStringValue(gerResourceRef.getDomain()),
                         getStringValue(gerResourceRef.getServer()),
                         getStringValue(gerResourceRef.getApplication()),
+                        NameFactory.JCA_RESOURCE,
                         getStringValue(gerResourceRef.getModule()),
                         getStringValue(gerResourceRef.getName()),
                         gerResourceRef.getType() == null ? type : 
gerResourceRef.getType().trim(),
-                        j2eeContext);
+                        j2eeContext).getCanonicalName();
             } catch (MalformedObjectNameException e) {
                 throw new DeploymentException("could not construct object name 
for resource", e);
             }
@@ -278,14 +279,15 @@
         } else {
             //construct name from components
             try {
-                containerId = 
NameFactory.getResourceComponentNameString(getStringValue(gerResourceEnvRef.getDomain()),
+                containerId = 
NameFactory.getComponentName(getStringValue(gerResourceEnvRef.getDomain()),
                         getStringValue(gerResourceEnvRef.getServer()),
                         getStringValue(gerResourceEnvRef.getApplication()),
+                        NameFactory.JCA_RESOURCE,
                         getStringValue(gerResourceEnvRef.getModule()),
                         getStringValue(gerResourceEnvRef.getName()),
                         NameFactory.JMS_RESOURCE,
                         //gerResourceEnvRef.getType(),
-                        j2eeContext);
+                        j2eeContext).getCanonicalName();
             } catch (MalformedObjectNameException e) {
                 throw new DeploymentException("could not construct object name 
for jms resource", e);
             }

Modified: 
geronimo/trunk/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
URL: 
http://svn.apache.org/viewcvs/geronimo/trunk/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java?view=diff&r1=154435&r2=154436
==============================================================================
--- 
geronimo/trunk/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
 (original)
+++ 
geronimo/trunk/modules/service-builder/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
 Sat Feb 19 10:22:02 2005
@@ -141,7 +141,7 @@
             throw new DeploymentException(e);
         }
 
-        J2eeContext j2eeContext = new J2eeContextImpl(context.getDomain(), 
context.getServer(), NameFactory.NULL, configID.toString(), null, null);
+        J2eeContext j2eeContext = new J2eeContextImpl(context.getDomain(), 
context.getServer(), NameFactory.NULL, NameFactory.J2EE_MODULE, 
configID.toString(), null, null);
         DependencyType[] includes = configType.getIncludeArray();
         addIncludes(context, includes, repository);
         addDependencies(context, configType.getDependencyArray(), repository);
@@ -228,6 +228,7 @@
             String namePart = gbean.getNamePart();
             try {
                 String j2eeType = gBeanInfo.getJ2eeType();
+                //todo investigate using the module type from the j2eecontext.
                 objectName = NameFactory.getComponentName(null, null, null, 
null, namePart, j2eeType, j2eeContext);
             } catch (MalformedObjectNameException e) {
                 throw new DeploymentException("Invalid ObjectName: " + 
namePart, e);

Modified: 
geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
URL: 
http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java?view=diff&r1=154435&r2=154436
==============================================================================
--- 
geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
 (original)
+++ 
geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
 Sat Feb 19 10:22:02 2005
@@ -81,10 +81,7 @@
 
     public String addGBeans(EARContext earContext, Module module, ClassLoader 
cl) throws DeploymentException {
         J2eeContext earJ2eeContext = earContext.getJ2eeContext();
-        J2eeContext moduleJ2eeContext = new 
J2eeContextImpl(earJ2eeContext.getJ2eeDomainName(),
-                                                            
earJ2eeContext.getJ2eeServerName(),
-                                                            
earJ2eeContext.getJ2eeApplicationName(),
-                                                            module.getName(), 
null, null);
+        J2eeContext moduleJ2eeContext = 
J2eeContextImpl.newModuleContextFromApplication(earJ2eeContext, 
NameFactory.WEB_MODULE, module.getName());
         WebModule webModule = (WebModule) module;
 
         // construct the webClassLoader
@@ -102,7 +99,7 @@
 
         ObjectName webModuleName = null;
         try {
-            webModuleName = NameFactory.getModuleName(null, null, null, null, 
NameFactory.WEB_MODULE, moduleJ2eeContext);
+            webModuleName = NameFactory.getModuleName(null, null, null, null, 
null, moduleJ2eeContext);
         } catch (MalformedObjectNameException e) {
             throw new DeploymentException("Could not construct module name", 
e);
         }

Modified: 
geronimo/trunk/modules/tomcat/src/test/org/apache/geronimo/tomcat/AbstractWebModuleTest.java
URL: 
http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/test/org/apache/geronimo/tomcat/AbstractWebModuleTest.java?view=diff&r1=154435&r2=154436
==============================================================================
--- 
geronimo/trunk/modules/tomcat/src/test/org/apache/geronimo/tomcat/AbstractWebModuleTest.java
 (original)
+++ 
geronimo/trunk/modules/tomcat/src/test/org/apache/geronimo/tomcat/AbstractWebModuleTest.java
 Sat Feb 19 10:22:02 2005
@@ -69,7 +69,7 @@
     private ObjectName tcmName;
     private GBeanData tcm;
     private ClassLoader cl;
-    private J2eeContext moduleContext = new J2eeContextImpl("tomcat.test", 
"test", "null", "tomcatTest", null, null);
+    private J2eeContext moduleContext = new J2eeContextImpl("tomcat.test", 
"test", "null", NameFactory.WEB_MODULE, "tomcatTest", null, null);
     private GBeanData securityServiceGBean;
     protected ObjectName securityServiceName;
     private ObjectName loginServiceName;


Reply via email to