geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r219818 - in /geronimo/trunk/modules: connector-builder/src/java/org/apache/geronimo/connector/deployment/ connector-builder/src/test/org/apache/geronimo/connector/deployment/ deployment/src/java/org/apache/geronimo/deployment/ j2ee-builder...
Date Tue, 19 Jul 2005 23:56:52 GMT
Author: djencks
Date: Tue Jul 19 16:56:51 2005
New Revision: 219818

URL: http://svn.apache.org/viewcvs?rev=219818&view=rev
Log:
GERONIMO-552 use gbeans in the deployment context, not special lists in RefContext.  This eliminates the special lists in RefContext for all resource related gbeans

Modified:
    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/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java
    geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/RefContext.java
    geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/ResourceReferenceBuilder.java
    geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EJBRefContextTest.java
    geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockConnectorConfigBuilder.java
    geronimo/trunk/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java
    geronimo/trunk/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java
    geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java

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?rev=219818&r1=219817&r2=219818&view=diff
==============================================================================
--- 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 Tue Jul 19 16:56:51 2005
@@ -75,6 +75,7 @@
 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.GBeanNotFoundException;
 import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.naming.deployment.ENCConfigBuilder;
 import org.apache.geronimo.naming.reference.ResourceReference;
@@ -201,7 +202,8 @@
 
             // if we got one extract the validate it otherwise create a default one
             if (gerConnector == null) {
-                throw new DeploymentException("A connector module must be deployed using a Geronimo deployment plan (either META-INF/geronimo-ra.xml in the RAR file or a standalone deployment plan passed to the deployer).");
+                throw new DeploymentException("A connector module must be deployed using a Geronimo deployment plan" +
+                        " (either META-INF/geronimo-ra.xml in the RAR file or a standalone deployment plan passed to the deployer).");
             }
             gerConnector = (GerConnectorType) SchemaConversionUtils.convertToGeronimoServiceSchema(gerConnector);
             //for workmanager
@@ -306,7 +308,7 @@
             resourceAdapterModuleData.setAttribute("managedConnectionFactoryInfoMap", managedConnectionFactoryInfoMap);
         }
 
-        earContext.getRefContext().addResourceAdapterModuleInfo(resourceAdapterModuleName, resourceAdapterModuleData);
+        earContext.addGBean(resourceAdapterModuleData);
 
         //register the instances we will create later
         GerConnectorType geronimoConnector = (GerConnectorType) module.getVendorDD();
@@ -320,8 +322,8 @@
                     if (resourceadapter.isSetInboundResourceadapter() && resourceadapter.getInboundResourceadapter().isSetMessageadapter()) {
                         String resourceAdapterName = geronimoResourceAdapter.getResourceadapterInstance().getResourceadapterName();
                         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);
+                        GBeanData resourceAdapterData = new GBeanData(resourceAdapterObjectName, null);
+                        earContext.addGBean(resourceAdapterData);
                     }
                 } catch (MalformedObjectNameException e) {
                     throw new DeploymentException("Could not construct resource adapter instance", e);
@@ -334,13 +336,14 @@
                     GerConnectiondefinitionInstanceType[] connectionDefinitionInstances = connectionDefinition.getConnectiondefinitionInstanceArray();
                     for (int j = 0; j < connectionDefinitionInstances.length; j++) {
                         GerConnectiondefinitionInstanceType connectionDefinitionInstance = connectionDefinitionInstances[j];
-                        String containerId = null;
+                        ObjectName connectionFactoryObjectName = null;
                         try {
-                            containerId = NameFactory.getComponentName(null, null, null, null, null, connectionDefinitionInstance.getName(), NameFactory.JCA_MANAGED_CONNECTION_FACTORY, resourceJ2eeContext).getCanonicalName();
+                            connectionFactoryObjectName = NameFactory.getComponentName(null, null, null, null, null, connectionDefinitionInstance.getName(), NameFactory.JCA_MANAGED_CONNECTION_FACTORY, resourceJ2eeContext);
                         } catch (MalformedObjectNameException e) {
                             throw new DeploymentException("Could not construct resource object name", e);
                         }
-                        earContext.getRefContext().addConnectionFactoryId(module.getModuleURI(), connectionDefinitionInstance.getName(), containerId);
+                        GBeanData connectionFactoryData = new GBeanData(connectionFactoryObjectName, null);
+                        earContext.addGBean(connectionFactoryData);
                     }
                 }
             }
@@ -350,13 +353,14 @@
             for (int j = 0; j < gerAdminObject.getAdminobjectInstanceArray().length; j++) {
                 GerAdminobjectInstanceType gerAdminObjectInstance = gerAdminObject.getAdminobjectInstanceArray()[j];
 
-                String adminObjectObjectName = null;
+                ObjectName adminObjectObjectName = null;
                 try {
-                    adminObjectObjectName = NameFactory.getComponentName(null, null, null, null, null, gerAdminObjectInstance.getMessageDestinationName(), NameFactory.JCA_ADMIN_OBJECT, resourceJ2eeContext).getCanonicalName();
+                    adminObjectObjectName = NameFactory.getComponentName(null, null, null, null, null, gerAdminObjectInstance.getMessageDestinationName(), NameFactory.JCA_ADMIN_OBJECT, resourceJ2eeContext);
                 } catch (MalformedObjectNameException e) {
                     throw new DeploymentException("Could not construct resource object name", e);
                 }
-                earContext.getRefContext().addAdminObjectId(module.getModuleURI(), gerAdminObjectInstance.getMessageDestinationName(), adminObjectObjectName);
+                GBeanData adminObjectData = new GBeanData(adminObjectObjectName, null);
+                earContext.addGBean(adminObjectData);
             }
         }
 
@@ -376,7 +380,15 @@
         } catch (MalformedObjectNameException e) {
             throw new DeploymentException("Could not construct module name", e);
         }
-        GBeanData resourceAdapterModuleData = earContext.getRefContext().getResourceAdapterModuleData(resourceAdapterModuleName);
+        GBeanData resourceAdapterModuleData = null;
+        try {
+            resourceAdapterModuleData = earContext.getGBeanInstance(resourceAdapterModuleName);
+        } catch (GBeanNotFoundException e) {
+            throw new DeploymentException("Internal consistency bug: Could not retrieve gbean data for module: " + resourceAdapterModuleName);
+        }
+        if (resourceAdapterModuleData == null) {
+            throw new DeploymentException("Internal consistency bug: gbean data for module is missing: " + resourceAdapterModuleName);
+        }
         ObjectName resourceAdapterjsr77Name = null;
         try {
             resourceAdapterjsr77Name = NameFactory.getComponentName(null, null, null, null, null, resourceJ2eeContext.getJ2eeModuleName(), NameFactory.RESOURCE_ADAPTER, moduleJ2eeContext);
@@ -408,10 +420,10 @@
         GbeanType[] gbeans = geronimoConnector.getGbeanArray();
         ServiceConfigBuilder.addGBeans(gbeans, cl, moduleJ2eeContext, earContext);
 
-        addConnectorGBeans(earContext, resourceJ2eeContext, resourceAdapterModuleName, (ConnectorType) specDD, geronimoConnector, cl);
+        addConnectorGBeans(earContext, resourceJ2eeContext, resourceAdapterModuleData, (ConnectorType) specDD, geronimoConnector, cl);
     }
 
-    private void addConnectorGBeans(EARContext earContext, J2eeContext moduleJ2eeContext, ObjectName resourceAdapterModuleObjectName, ConnectorType connector, GerConnectorType geronimoConnector, ClassLoader cl) throws DeploymentException {
+    private void addConnectorGBeans(EARContext earContext, J2eeContext moduleJ2eeContext, GBeanData resourceAdapterModuleData, ConnectorType connector, GerConnectorType geronimoConnector, ClassLoader cl) throws DeploymentException {
         ResourceadapterType resourceadapter = connector.getResourceadapter();
 
         GerResourceadapterType[] geronimoResourceAdapters = geronimoConnector.getResourceadapterArray();
@@ -421,7 +433,7 @@
             // Resource Adapter
             ObjectName resourceAdapterObjectName = null;
             if (resourceadapter.isSetResourceadapterClass()) {
-                GBeanData resourceAdapterGBeanData = earContext.getRefContext().getResourceAdapterGBeanData(resourceAdapterModuleObjectName);
+                GBeanData resourceAdapterGBeanData = locateResourceAdapterGBeanData(resourceAdapterModuleData);
                 GBeanData resourceAdapterInstanceGBeanData = new GBeanData(resourceAdapterGBeanData);
 
                 setDynamicGBeanDataAttributes(resourceAdapterInstanceGBeanData, geronimoResourceAdapter.getResourceadapterInstance().getConfigPropertySettingArray(), cl);
@@ -453,7 +465,7 @@
                     assert geronimoConnectionDefinition != null: "Null GeronimoConnectionDefinition";
 
                     String connectionFactoryInterfaceName = geronimoConnectionDefinition.getConnectionfactoryInterface().trim();
-                    GBeanData connectionFactoryGBeanData = earContext.getRefContext().getConnectionFactoryInfo(resourceAdapterModuleObjectName, connectionFactoryInterfaceName);
+                    GBeanData connectionFactoryGBeanData = locateConnectionFactoryInfo(resourceAdapterModuleData, connectionFactoryInterfaceName);
 
                     if (connectionFactoryGBeanData == null) {
                         throw new DeploymentException("No connection definition for ConnectionFactory class: " + connectionFactoryInterfaceName);
@@ -467,14 +479,14 @@
                 }
             }
         }
-        // admin objects (think message queuse and topics)
+        // admin objects (think message queues and topics)
 
         // add configured admin objects
         for (int i = 0; i < geronimoConnector.getAdminobjectArray().length; i++) {
             GerAdminobjectType gerAdminObject = geronimoConnector.getAdminobjectArray()[i];
 
             String adminObjectInterface = gerAdminObject.getAdminobjectInterface().trim();
-            GBeanData adminObjectGBeanData = earContext.getRefContext().getAdminObjectInfo(resourceAdapterModuleObjectName, adminObjectInterface);
+            GBeanData adminObjectGBeanData = locateAdminObjectInfo(resourceAdapterModuleData, adminObjectInterface);
 
             if (adminObjectGBeanData == null) {
                 throw new DeploymentException("No admin object declared for interface: " + adminObjectInterface);
@@ -718,7 +730,6 @@
             throw new DeploymentException("Unexpected pooling support element");
         }
         try {
-//            connectionManagerGBean.setAttribute("name", connectionfactoryInstance.getName());
             connectionManagerGBean.setAttribute("transactionSupport", transactionSupport);
             connectionManagerGBean.setAttribute("pooling", pooling);
             connectionManagerGBean.setReferencePattern("ConnectionTracker", earContext.getConnectionTrackerObjectName());
@@ -811,42 +822,36 @@
         return new ResourceReference(containerId, iface);
     }
 
-    public GBeanData locateActivationSpecInfo(ObjectName resourceAdapterModuleName, String messageListenerInterface) throws DeploymentException {
-        Map activationSpecInfos = null;
-        try {
-            activationSpecInfos = (Map) kernel.getAttribute(resourceAdapterModuleName, "activationSpecInfoMap");
-        } catch (Exception e) {
-            throw new DeploymentException("Could not get activation spec infos for resource adapter named: " + resourceAdapterModuleName, e);
+    public GBeanData locateActivationSpecInfo(GBeanData resourceAdapterModuleData, String messageListenerInterface) throws DeploymentException {
+        Map activationSpecInfos = (Map) resourceAdapterModuleData.getAttribute("activationSpecInfoMap");
+        if (activationSpecInfos == null) {
+            throw new DeploymentException("No activation spec info map found in resource adapter module: " + resourceAdapterModuleData.getName());
         }
         return (GBeanData) activationSpecInfos.get(messageListenerInterface);
     }
 
-    public GBeanData locateResourceAdapterGBeanData(ObjectName resourceAdapterModuleName) throws DeploymentException {
-        try {
-            return (GBeanData) kernel.getAttribute(resourceAdapterModuleName, "resourceAdapterInfo");
-        } catch (Exception e) {
-            throw new DeploymentException("Could not get resource adapter info for resource adapter named: " + resourceAdapterModuleName, e);
+    public GBeanData locateResourceAdapterGBeanData(GBeanData resourceAdapterModuleData) throws DeploymentException {
+        GBeanData data = (GBeanData) resourceAdapterModuleData.getAttribute("resourceAdapterGBeanData");
+        if (data == null) {
+            throw new DeploymentException("No resource adapter info found for resource adapter module: " + resourceAdapterModuleData.getName());
         }
+        return data;
     }
 
-    public GBeanData locateAdminObjectInfo(ObjectName resourceAdapterModuleName, String adminObjectInterfaceName) throws DeploymentException {
-        Map activationSpecInfos = null;
-        try {
-            activationSpecInfos = (Map) kernel.getAttribute(resourceAdapterModuleName, "adminObjectInfoMap");
-        } catch (Exception e) {
-            throw new DeploymentException("Could not get admin object infos for resource adapter named: " + resourceAdapterModuleName, e);
+    public GBeanData locateAdminObjectInfo(GBeanData resourceAdapterModuleData, String adminObjectInterfaceName) throws DeploymentException {
+        Map adminObjectInfos = (Map) resourceAdapterModuleData.getAttribute("adminObjectInfoMap");
+        if (adminObjectInfos == null) {
+            throw new DeploymentException("No admin object infos found for resource adapter module: " + resourceAdapterModuleData.getName());
         }
-        return (GBeanData) activationSpecInfos.get(adminObjectInterfaceName);
+        return (GBeanData) adminObjectInfos.get(adminObjectInterfaceName);
     }
 
-    public GBeanData locateConnectionFactoryInfo(ObjectName resourceAdapterModuleName, String connectionFactoryInterfaceName) throws DeploymentException {
-        Map activationSpecInfos = null;
-        try {
-            activationSpecInfos = (Map) kernel.getAttribute(resourceAdapterModuleName, "managedConnectionFactoryInfoMap");
-        } catch (Exception e) {
-            throw new DeploymentException("Could not get connection factory infos for resource adapter named: " + resourceAdapterModuleName, e);
+    public GBeanData locateConnectionFactoryInfo(GBeanData resourceAdapterModuleData, String connectionFactoryInterfaceName) throws DeploymentException {
+        Map managedConnectionFactoryInfos = (Map) resourceAdapterModuleData.getAttribute("managedConnectionFactoryInfoMap");
+        if (managedConnectionFactoryInfos == null) {
+            throw new DeploymentException("No managed connection factory infos found for resource adapter module: " + resourceAdapterModuleData.getName());
         }
-        return (GBeanData) activationSpecInfos.get(connectionFactoryInterfaceName);
+        return (GBeanData) managedConnectionFactoryInfos.get(connectionFactoryInterfaceName);
     }
 
     public static final GBeanInfo GBEAN_INFO;

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?rev=219818&r1=219817&r2=219818&view=diff
==============================================================================
--- 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 Tue Jul 19 16:56:51 2005
@@ -131,19 +131,19 @@
             return null;
         }
 
-        public GBeanData locateActivationSpecInfo(ObjectName resourceAdapterName, String messageListenerInterface)  {
+        public GBeanData locateActivationSpecInfo(GBeanData resourceAdapterModuleData, String messageListenerInterface)  {
             return null;
         }
 
-        public GBeanData locateResourceAdapterGBeanData(ObjectName resourceAdapterModuleName)  {
+        public GBeanData locateResourceAdapterGBeanData(GBeanData resourceAdapterModuleData)  {
             return null;
         }
 
-        public GBeanData locateAdminObjectInfo(ObjectName resourceAdapterModuleName, String adminObjectInterfaceName)  {
+        public GBeanData locateAdminObjectInfo(GBeanData resourceAdapterModuleData, String adminObjectInterfaceName)  {
             return null;
         }
 
-        public GBeanData locateConnectionFactoryInfo(ObjectName resourceAdapterModuleName, String connectionFactoryInterfaceName) {
+        public GBeanData locateConnectionFactoryInfo(GBeanData resourceAdapterModuleData, String connectionFactoryInterfaceName) {
             return null;
         }
     };

Modified: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java?rev=219818&r1=219817&r2=219818&view=diff
==============================================================================
--- geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java (original)
+++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java Tue Jul 19 16:56:51 2005
@@ -199,6 +199,10 @@
         return gbeans.listGBeans(pattern);
     }
 
+    public GBeanData getGBeanInstance(ObjectName name) throws GBeanNotFoundException {
+        return gbeans.getGBeanInstance(name);
+    }
+
     public void addDependency(URI uri) {
         configurationData.addDependency(uri);
     }

Modified: geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/RefContext.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/RefContext.java?rev=219818&r1=219817&r2=219818&view=diff
==============================================================================
--- geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/RefContext.java (original)
+++ geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/RefContext.java Tue Jul 19 16:56:51 2005
@@ -36,6 +36,7 @@
 import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContext;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.GBeanNotFoundException;
 
 
 /**
@@ -52,12 +53,6 @@
     private final Map ejbLocalIndex;
     private final Map ejbInterfaceIndex;
 
-    private final Map resourceAdapterIndex;
-    private final Map connectionFactoryIndex;
-    private final Map adminObjectIndex;
-
-    private final Map resourceModuleDataMap;
-
 
     public RefContext(EJBReferenceBuilder ejbReferenceBuilder, ResourceReferenceBuilder resourceReferenceBuilder, ServiceReferenceBuilder serviceReferenceBuilder, Kernel kernel) {
         assert ejbReferenceBuilder != null: "ejbReferenceBuilder is null";
@@ -67,10 +62,6 @@
         ejbRemoteIndex = new HashMap();
         ejbLocalIndex = new HashMap();
         ejbInterfaceIndex = new HashMap();
-        resourceAdapterIndex = new HashMap();
-        connectionFactoryIndex = new HashMap();
-        adminObjectIndex = new HashMap();
-        resourceModuleDataMap = new HashMap();
         this.ejbReferenceBuilder = ejbReferenceBuilder;
         this.resourceReferenceBuilder = resourceReferenceBuilder;
         this.serviceReferenceBuilder = serviceReferenceBuilder;
@@ -93,30 +84,6 @@
         this.ejbRemoteIndex = refContext.ejbRemoteIndex;
         this.ejbLocalIndex = new HashMap();//no local ejb refs
         this.ejbInterfaceIndex = refContext.ejbInterfaceIndex;
-        resourceAdapterIndex = new HashMap();
-        this.connectionFactoryIndex = new HashMap();
-        this.adminObjectIndex = new HashMap();
-        this.resourceModuleDataMap = new HashMap();
-    }
-
-    public EJBReferenceBuilder getEjbReferenceBuilder() {
-        return ejbReferenceBuilder;
-    }
-
-    public Map getEJBRemoteIndex() {
-        return ejbRemoteIndex;
-    }
-
-    public Map getEJBLocalIndex() {
-        return ejbLocalIndex;
-    }
-
-    public Map getConnectionFactoryIndex() {
-        return connectionFactoryIndex;
-    }
-
-    public Map getAdminObjectIndex() {
-        return adminObjectIndex;
     }
 
     public void addEJBRemoteId(URI modulePath, String name, String containerId, boolean isSession, String home, String remote) throws DeploymentException {
@@ -164,54 +131,6 @@
         }
     }
 
-    public void addResourceAdapterId(URI modulePath, String name, String containerId) throws DeploymentException {
-        Map references = (Map) resourceAdapterIndex.get(name);
-        if (references == null || references.isEmpty()) {
-            references = new HashMap();
-            resourceAdapterIndex.put(name, references);
-        }
-
-        try {
-            URI cfURI = new URI(null, null, modulePath.getPath(), name);
-            references.put(cfURI, containerId);
-        } catch (URISyntaxException e) {
-            throw new DeploymentException(e);
-        }
-    }
-
-    public void addConnectionFactoryId(URI modulePath, String name, String containerId) throws DeploymentException {
-        Map references = (Map) connectionFactoryIndex.get(name);
-        if (references == null || references.isEmpty()) {
-            references = new HashMap();
-            connectionFactoryIndex.put(name, references);
-        }
-
-        try {
-            URI cfURI = new URI(null, null, modulePath.getPath(), name);
-            references.put(cfURI, containerId);
-        } catch (URISyntaxException e) {
-            throw new DeploymentException(e);
-        }
-    }
-
-
-    public void addAdminObjectId(URI modulePath, String name, String containerId) throws DeploymentException {
-        Map references = (Map) adminObjectIndex.get(name);
-        if (references == null || references.isEmpty()) {
-            references = new HashMap();
-            adminObjectIndex.put(name, references);
-        }
-
-        try {
-            URI cfURI = new URI(null, null, modulePath.getPath(), name);
-            references.put(cfURI, containerId);
-        } catch (URISyntaxException e) {
-            throw new DeploymentException(e);
-        }
-    }
-
-
-
     //lookup methods
 
     public Reference getEJBRemoteRef(String objectName, boolean isSession, String home, String remote) throws DeploymentException {
@@ -246,33 +165,59 @@
         return resourceReferenceBuilder.createResourceRef(containerId, iface);
     }
 
-    public String getResourceAdapterContainerId(URI module, String resourceLink, J2eeContext j2eeContext) throws DeploymentException, UnknownEJBRefException {
+    public Reference getAdminObjectRef(String containerId, Class iface) throws DeploymentException {
+        return resourceReferenceBuilder.createAdminObjectRef(containerId, iface);
+    }
+
+    public Object getServiceReference(Class serviceInterface, URI wsdlURI, URI jaxrpcMappingURI, QName serviceQName, Map portComponentRefMap, List handlerInfos, Object serviceRefType, DeploymentContext deploymentContext, Module module, ClassLoader classLoader) throws DeploymentException {
+        return serviceReferenceBuilder.createService(serviceInterface, wsdlURI, jaxrpcMappingURI, serviceQName, portComponentRefMap, handlerInfos, serviceRefType, deploymentContext, module, classLoader);
+    }
+
+    public String getResourceAdapterContainerId(URI module, String resourceLink, EARContext context) throws DeploymentException, UnknownEJBRefException {
         String name = resourceLink.substring(resourceLink.lastIndexOf('#') + 1);
-        try {
-            return getContainerId(module, resourceLink, (Map) resourceAdapterIndex.get(name));
-        } catch (UnknownEJBRefException e) {
-            ObjectName query = null;
-            try {
-                query = NameFactory.getComponentRestrictedQueryName(null, null, name, NameFactory.JCA_RESOURCE_ADAPTER, j2eeContext);
-            } catch (MalformedObjectNameException e1) {
-                throw new DeploymentException("Could not construct resource adapter object name query", e);
-            }
-            ObjectName containerName = locateUniqueName(query, "resource");
-            return containerName.getCanonicalName();
-        }
+        J2eeContext j2eeContext = context.getJ2eeContext();
+        ObjectName containerName = locateComponent(name, NameFactory.JCA_RESOURCE_ADAPTER, j2eeContext, context, "resource adapter");
+        return containerName.getCanonicalName();
+    }
+
+    public String getConnectionFactoryContainerId(URI module, String resourceLink, String type, EARContext context) throws DeploymentException, UnknownEJBRefException {
+        String name = resourceLink.substring(resourceLink.lastIndexOf('#') + 1);
+        ObjectName containerName = locateComponent(name, type, context.getJ2eeContext(), context, "connection factory");
+        return containerName.getCanonicalName();
     }
 
-    public String getConnectionFactoryContainerId(URI module, String resourceLink, String type, J2eeContext j2eeContext, DeploymentContext context) throws DeploymentException, UnknownEJBRefException {
+
+    public String getAdminObjectContainerId(URI module, String resourceLink, EARContext context) throws DeploymentException, UnknownEJBRefException {
         String name = resourceLink.substring(resourceLink.lastIndexOf('#') + 1);
+
+        J2eeContext j2eeContext = context.getJ2eeContext();
+        ObjectName containerName = locateComponent(name, NameFactory.JCA_ADMIN_OBJECT, j2eeContext, context, "admin object");
+        return containerName.getCanonicalName();
+    }
+
+    public ObjectName locateComponent(String name, String type, J2eeContext j2eeContext, DeploymentContext context, String queryType) throws DeploymentException {
+        ObjectName match = locateNameInContext(name, type, j2eeContext, queryType, context);
+        if (match == null) {
+            //no matches in current context, look in other modules with J2EEApplication=null
+            return locateNameInKernel(name, type, j2eeContext, queryType);
+        }
+        return match;
+    }
+
+    public GBeanData locateComponentData(ObjectName name, DeploymentContext context) throws DeploymentException {
+        try {
+            return context.getGBeanInstance(name);
+        } catch (GBeanNotFoundException e) {
+        }
         try {
-            return getContainerId(module, resourceLink, (Map) connectionFactoryIndex.get(name));
-        } catch (UnknownEJBRefException e) {
-            ObjectName containerName = locateComponent(name, type, j2eeContext, context, "connection factory");
-            return containerName.getCanonicalName();
+            return kernel.getGBeanData(name);
+        } catch (GBeanNotFoundException e) {
+            throw new DeploymentException("GBean name: " + name + " not found in DeploymentContext: " + context.getConfigID() + " or in kernel");
         }
     }
 
-    public ObjectName locateComponent(String name, String type, J2eeContext j2eeContext, DeploymentContext context, String queryType) throws DeploymentException {
+    private ObjectName locateNameInContext(String name, String type, J2eeContext j2eeContext, String queryType, DeploymentContext context) throws DeploymentException {
+        ObjectName match = null;
         ObjectName query = null;
         try {
             query = NameFactory.getComponentNameQuery(null, null, null, name, type, j2eeContext);
@@ -284,9 +229,13 @@
             throw new DeploymentException("More than one match for query " + matches);
         }
         if (matches.size() == 1) {
-            return (ObjectName) matches.iterator().next();
+            match = (ObjectName) matches.iterator().next();
         }
-        //no matches in current context, look in other modules with J2EEApplication=null
+        return match;
+    }
+
+    private ObjectName locateNameInKernel(String name, String type, J2eeContext j2eeContext, String queryType) throws DeploymentException {
+        ObjectName query;
         try {
             query = NameFactory.getComponentRestrictedQueryName(null, null, name, type, j2eeContext);
         } catch (MalformedObjectNameException e1) {
@@ -295,30 +244,6 @@
         return locateUniqueName(query, queryType);
     }
 
-    public Reference getAdminObjectRef(String containerId, Class iface) throws DeploymentException {
-        return resourceReferenceBuilder.createAdminObjectRef(containerId, iface);
-    }
-
-    public String getAdminObjectContainerId(URI module, String resourceLink, J2eeContext j2eeContext) throws DeploymentException, UnknownEJBRefException {
-        String name = resourceLink.substring(resourceLink.lastIndexOf('#') + 1);
-        try {
-            return getContainerId(module, resourceLink, (Map) adminObjectIndex.get(name));
-        } catch (UnknownEJBRefException e) {
-            ObjectName query = null;
-            try {
-                query = NameFactory.getComponentRestrictedQueryName(null, null, name, NameFactory.JCA_ADMIN_OBJECT, j2eeContext);
-            } catch (MalformedObjectNameException e1) {
-                throw new DeploymentException("Could not construct admin object object name query", e);
-            }
-            ObjectName containerName = locateUniqueName(query, "resource");
-            return containerName.getCanonicalName();
-        }
-    }
-
-    public Object getServiceReference(Class serviceInterface, URI wsdlURI, URI jaxrpcMappingURI, QName serviceQName, Map portComponentRefMap, List handlerInfos, Object serviceRefType, DeploymentContext deploymentContext, Module module, ClassLoader classLoader) throws DeploymentException {
-        return serviceReferenceBuilder.createService(serviceInterface, wsdlURI, jaxrpcMappingURI, serviceQName, portComponentRefMap, handlerInfos, serviceRefType, deploymentContext, module, classLoader);
-    }
-
     private String getContainerId(URI module, String ejbLink, Map references) throws AmbiguousEJBRefException, UnknownEJBRefException {
         if (references == null || references.isEmpty()) {
             throw new UnknownEJBRefException(ejbLink);
@@ -394,50 +319,25 @@
 
     //Resource adapter/activationspec support
 
-    public void addResourceAdapterModuleInfo(ObjectName resourceModuleName, GBeanData resourceModuleData) throws DeploymentException {
-        Object old = resourceModuleDataMap.put(resourceModuleName, resourceModuleData);
-        if (old != null) {
-            throw new DeploymentException("Duplicate resource adapter module name: " + resourceModuleName);
-        }
+    public GBeanData getResourceAdapterGBeanData(ObjectName resourceAdapterModuleName, DeploymentContext context) throws DeploymentException {
+        GBeanData resourceModuleData = locateComponentData(resourceAdapterModuleName, context);
+        return resourceReferenceBuilder.locateResourceAdapterGBeanData(resourceModuleData);
     }
 
-    public GBeanData getResourceAdapterGBeanData(ObjectName resourceAdapterModuleName) throws DeploymentException {
-        GBeanData resourceModuleData = (GBeanData) resourceModuleDataMap.get(resourceAdapterModuleName);
-        if (resourceModuleData != null) {
-            return (GBeanData) resourceModuleData.getAttribute("resourceAdapterGBeanData");
-        }
-        return resourceReferenceBuilder.locateResourceAdapterGBeanData(resourceAdapterModuleName);
+    public GBeanData getActivationSpecInfo(ObjectName resourceAdapterModuleName, String messageListenerInterfaceName, DeploymentContext context) throws DeploymentException {
+        GBeanData resourceModuleData = locateComponentData(resourceAdapterModuleName, context);
+        return resourceReferenceBuilder.locateActivationSpecInfo(resourceModuleData, messageListenerInterfaceName);
     }
 
-    public GBeanData getActivationSpecInfo(ObjectName resourceAdapterModuleName, String messageListenerInterfaceName) throws DeploymentException {
-        GBeanData resourceModuleData = (GBeanData) resourceModuleDataMap.get(resourceAdapterModuleName);
-        if (resourceModuleData != null) {
-            Map activationSpecInfoMap = (Map) resourceModuleData.getAttribute("activationSpecInfoMap");
-            return (GBeanData) activationSpecInfoMap.get(messageListenerInterfaceName);
-        }
-        return resourceReferenceBuilder.locateActivationSpecInfo(resourceAdapterModuleName, messageListenerInterfaceName);
-    }
-
-    public GBeanData getAdminObjectInfo(ObjectName resourceAdapterModuleName, String adminObjectInterfaceName) throws DeploymentException {
-        GBeanData resourceModuleData = (GBeanData) resourceModuleDataMap.get(resourceAdapterModuleName);
-        if (resourceModuleData != null) {
-            Map adminObjectInfoMap = (Map) resourceModuleData.getAttribute("adminObjectInfoMap");
-            return (GBeanData) adminObjectInfoMap.get(adminObjectInterfaceName);
-        }
-        return resourceReferenceBuilder.locateAdminObjectInfo(resourceAdapterModuleName, adminObjectInterfaceName);
-    }
-
-    public GBeanData getConnectionFactoryInfo(ObjectName resourceAdapterModuleName, String connectionFactoryInterfaceName) throws DeploymentException {
-        GBeanData resourceModuleData = (GBeanData) resourceModuleDataMap.get(resourceAdapterModuleName);
-        if (resourceModuleData != null) {
-            Map managedConnectionFactoryInfoMap = (Map) resourceModuleData.getAttribute("managedConnectionFactoryInfoMap");
-            return (GBeanData) managedConnectionFactoryInfoMap.get(connectionFactoryInterfaceName);
-        }
-        return resourceReferenceBuilder.locateConnectionFactoryInfo(resourceAdapterModuleName, connectionFactoryInterfaceName);
+    //this relies on finding the resource adapter, not the admin object.
+    public GBeanData getAdminObjectInfo(ObjectName resourceAdapterModuleName, String adminObjectInterfaceName, DeploymentContext context) throws DeploymentException {
+        GBeanData resourceModuleData = locateComponentData(resourceAdapterModuleName, context);
+        return resourceReferenceBuilder.locateAdminObjectInfo(resourceModuleData, adminObjectInterfaceName);
     }
 
-    public GBeanData getResourceAdapterModuleData(ObjectName resourceAdapterModuleName) {
-        return (GBeanData) resourceModuleDataMap.get(resourceAdapterModuleName);
+    public GBeanData getConnectionFactoryInfo(ObjectName resourceAdapterModuleName, String connectionFactoryInterfaceName, DeploymentContext context) throws DeploymentException {
+        GBeanData resourceModuleData = locateComponentData(resourceAdapterModuleName, context);
+        return resourceReferenceBuilder.locateConnectionFactoryInfo(resourceModuleData, connectionFactoryInterfaceName);
     }
 
     public String getMEJBName() throws DeploymentException {

Modified: geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/ResourceReferenceBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/ResourceReferenceBuilder.java?rev=219818&r1=219817&r2=219818&view=diff
==============================================================================
--- geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/ResourceReferenceBuilder.java (original)
+++ geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/ResourceReferenceBuilder.java Tue Jul 19 16:56:51 2005
@@ -30,11 +30,11 @@
 
     Reference createAdminObjectRef(String containerId, Class iface) throws DeploymentException;
 
-    GBeanData locateActivationSpecInfo(ObjectName resourceAdapterName, String messageListenerInterface) throws DeploymentException;
+    GBeanData locateActivationSpecInfo(GBeanData resourceAdapterModuleData, String messageListenerInterface) throws DeploymentException;
 
-    GBeanData locateResourceAdapterGBeanData(ObjectName resourceAdapterModuleName) throws DeploymentException;
+    GBeanData locateResourceAdapterGBeanData(GBeanData resourceAdapterModuleData) throws DeploymentException;
 
-    GBeanData locateAdminObjectInfo(ObjectName resourceAdapterModuleName, String adminObjectInterfaceName) throws DeploymentException;
+    GBeanData locateAdminObjectInfo(GBeanData resourceAdapterModuleData, String adminObjectInterfaceName) throws DeploymentException;
 
-    GBeanData locateConnectionFactoryInfo(ObjectName resourceAdapterModuleName, String connectionFactoryInterfaceName) throws DeploymentException;
+    GBeanData locateConnectionFactoryInfo(GBeanData resourceAdapterModuleData, String connectionFactoryInterfaceName) throws DeploymentException;
 }

Modified: geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EJBRefContextTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EJBRefContextTest.java?rev=219818&r1=219817&r2=219818&view=diff
==============================================================================
--- geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EJBRefContextTest.java (original)
+++ geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EJBRefContextTest.java Tue Jul 19 16:56:51 2005
@@ -193,19 +193,19 @@
                 return null;
             }
 
-            public GBeanData locateActivationSpecInfo(ObjectName resourceAdapterName, String messageListenerInterface) throws DeploymentException {
+            public GBeanData locateActivationSpecInfo(GBeanData resourceAdapterModuleData, String messageListenerInterface) throws DeploymentException {
                 return null;
             }
 
-            public GBeanData locateResourceAdapterGBeanData(ObjectName resourceAdapterModuleName) throws DeploymentException {
+            public GBeanData locateResourceAdapterGBeanData(GBeanData resourceAdapterModuleData) throws DeploymentException {
                 return null;
             }
 
-            public GBeanData locateAdminObjectInfo(ObjectName resourceAdapterModuleName, String adminObjectInterfaceName) throws DeploymentException {
+            public GBeanData locateAdminObjectInfo(GBeanData resourceAdapterModuleData, String adminObjectInterfaceName) throws DeploymentException {
                 return null;
             }
 
-            public GBeanData locateConnectionFactoryInfo(ObjectName resourceAdapterModuleName, String connectionFactoryInterfaceName) throws DeploymentException {
+            public GBeanData locateConnectionFactoryInfo(GBeanData resourceAdapterModuleData, String connectionFactoryInterfaceName) throws DeploymentException {
                 return null;
             }
         }, new ServiceReferenceBuilder() {

Modified: geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockConnectorConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockConnectorConfigBuilder.java?rev=219818&r1=219817&r2=219818&view=diff
==============================================================================
--- geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockConnectorConfigBuilder.java (original)
+++ geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/MockConnectorConfigBuilder.java Tue Jul 19 16:56:51 2005
@@ -82,19 +82,19 @@
         return null;
     }
 
-    public GBeanData locateActivationSpecInfo(ObjectName resourceAdapterName, String messageListenerInterface) throws DeploymentException {
+    public GBeanData locateActivationSpecInfo(GBeanData resourceAdapterModuleData, String messageListenerInterface) throws DeploymentException {
         return null;
     }
 
-    public GBeanData locateResourceAdapterGBeanData(ObjectName resourceAdapterModuleName) throws DeploymentException {
+    public GBeanData locateResourceAdapterGBeanData(GBeanData resourceAdapterModuleData) throws DeploymentException {
         return null;
     }
 
-    public GBeanData locateAdminObjectInfo(ObjectName resourceAdapterModuleName, String adminObjectInterfaceName) throws DeploymentException {
+    public GBeanData locateAdminObjectInfo(GBeanData resourceAdapterModuleData, String adminObjectInterfaceName) throws DeploymentException {
         return null;
     }
 
-    public GBeanData locateConnectionFactoryInfo(ObjectName resourceAdapterModuleName, String connectionFactoryInterfaceName) throws DeploymentException {
+    public GBeanData locateConnectionFactoryInfo(GBeanData resourceAdapterModuleData, String connectionFactoryInterfaceName) throws DeploymentException {
         return null;
     }
 }

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?rev=219818&r1=219817&r2=219818&view=diff
==============================================================================
--- 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 Tue Jul 19 16:56:51 2005
@@ -184,19 +184,19 @@
                         return null;
                     }
 
-                    public GBeanData locateActivationSpecInfo(ObjectName resourceAdapterName, String messageListenerInterface) throws DeploymentException {
+                    public GBeanData locateActivationSpecInfo(GBeanData resourceAdapterModuleData, String messageListenerInterface) throws DeploymentException {
                         return null;
                     }
 
-                    public GBeanData locateResourceAdapterGBeanData(ObjectName resourceAdapterModuleName) throws DeploymentException {
+                    public GBeanData locateResourceAdapterGBeanData(GBeanData resourceAdapterModuleData) throws DeploymentException {
                         return null;
                     }
 
-                    public GBeanData locateAdminObjectInfo(ObjectName resourceAdapterModuleName, String adminObjectInterfaceName) throws DeploymentException {
+                    public GBeanData locateAdminObjectInfo(GBeanData resourceAdapterModuleData, String adminObjectInterfaceName) throws DeploymentException {
                         return null;
                     }
 
-                    public GBeanData locateConnectionFactoryInfo(ObjectName resourceAdapterModuleName, String connectionFactoryInterfaceName) throws DeploymentException {
+                    public GBeanData locateConnectionFactoryInfo(GBeanData resourceAdapterModuleData, String connectionFactoryInterfaceName) throws DeploymentException {
                         return null;
                     }
                 },

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?rev=219818&r1=219817&r2=219818&view=diff
==============================================================================
--- 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 Tue Jul 19 16:56:51 2005
@@ -160,7 +160,6 @@
             refMap = Collections.EMPTY_MAP;
         }
         RefContext refContext = earContext.getRefContext();
-        J2eeContext j2eeContext = earContext.getJ2eeContext();
 
         for (int i = 0; i < resourceRefs.length; i++) {
             ResourceRefType resourceRef = resourceRefs[i];
@@ -196,7 +195,7 @@
                 } else {
                     j2eeType = NameFactory.JCA_MANAGED_CONNECTION_FACTORY;
                 }
-                String containerId = getResourceContainerId(name, j2eeType, uri, gerResourceRef, refContext, j2eeContext, earContext);
+                String containerId = getResourceContainerId(name, j2eeType, uri, gerResourceRef, earContext);
 
                 ref = refContext.getConnectionFactoryRef(containerId, iface);
                 builder.bind(name, ref);
@@ -205,14 +204,15 @@
 
     }
 
-    private static String getResourceContainerId(String name, String type, URI uri, GerResourceRefType gerResourceRef, RefContext refContext, J2eeContext j2eeContext, DeploymentContext context) throws DeploymentException {
+    private static String getResourceContainerId(String name, String type, URI uri, GerResourceRefType gerResourceRef, EARContext context) throws DeploymentException {
         String containerId = null;
+        RefContext refContext = context.getRefContext();
         if (gerResourceRef == null) {
             //try to resolve ref based only matching resource-ref-name
             //throws exception if it can't locate ref.
-            containerId = refContext.getConnectionFactoryContainerId(uri, name, type, j2eeContext, context);
+            containerId = refContext.getConnectionFactoryContainerId(uri, name, type, context);
         } else if (gerResourceRef.isSetResourceLink()) {
-            containerId = refContext.getConnectionFactoryContainerId(uri, gerResourceRef.getResourceLink().trim(), type, j2eeContext, context);
+            containerId = refContext.getConnectionFactoryContainerId(uri, gerResourceRef.getResourceLink().trim(), type, context);
         } else if (gerResourceRef.isSetTargetName()) {
             containerId = gerResourceRef.getTargetName().trim();
         } else {
@@ -225,7 +225,7 @@
                         getStringValue(gerResourceRef.getModule()),
                         getStringValue(gerResourceRef.getName()),
                         gerResourceRef.getType() == null ? type : gerResourceRef.getType().trim(),
-                        j2eeContext).getCanonicalName();
+                        context.getJ2eeContext()).getCanonicalName();
             } catch (MalformedObjectNameException e) {
                 throw new DeploymentException("could not construct object name for resource", e);
             }
@@ -237,8 +237,6 @@
         if (refMap == null) {
             refMap = Collections.EMPTY_MAP;
         }
-        RefContext refContext = earContext.getRefContext();
-        J2eeContext j2eeContext = earContext.getJ2eeContext();
 
         for (int i = 0; i < resourceEnvRefArray.length; i++) {
             ResourceEnvRefType resourceEnvRef = resourceEnvRefArray[i];
@@ -251,21 +249,22 @@
                 throw new DeploymentException("could not load class " + type, e);
             }
             GerResourceEnvRefType gerResourceEnvRef = (GerResourceEnvRefType) refMap.get(name);
-            String containerId = getAdminObjectContainerId(name, uri, gerResourceEnvRef, refContext, j2eeContext);
-            Reference ref = refContext.getAdminObjectRef(containerId, iface);
+            String containerId = getAdminObjectContainerId(name, uri, gerResourceEnvRef, earContext);
+            Reference ref = earContext.getRefContext().getAdminObjectRef(containerId, iface);
 
             builder.bind(name, ref);
         }
     }
 
-    private static String getAdminObjectContainerId(String name, URI uri, GerResourceEnvRefType gerResourceEnvRef, RefContext refContext, J2eeContext j2eeContext) throws DeploymentException {
+    private static String getAdminObjectContainerId(String name, URI uri, GerResourceEnvRefType gerResourceEnvRef, EARContext context) throws DeploymentException {
         String containerId = null;
+        RefContext refContext = context.getRefContext();
         if (gerResourceEnvRef == null) {
             //try to resolve ref based only matching resource-ref-name
             //throws exception if it can't locate ref.
-            containerId = refContext.getAdminObjectContainerId(uri, name, j2eeContext);
+            containerId = refContext.getAdminObjectContainerId(uri, name, context);
         } else if (gerResourceEnvRef.isSetMessageDestinationLink()) {
-            containerId = refContext.getAdminObjectContainerId(uri, getStringValue(gerResourceEnvRef.getMessageDestinationLink()), j2eeContext);
+            containerId = refContext.getAdminObjectContainerId(uri, getStringValue(gerResourceEnvRef.getMessageDestinationLink()), context);
         } else if (gerResourceEnvRef.isSetTargetName()) {
             containerId = getStringValue(gerResourceEnvRef.getTargetName());
         } else {
@@ -279,7 +278,7 @@
                         getStringValue(gerResourceEnvRef.getName()),
                         NameFactory.JMS_RESOURCE,
                         //gerResourceEnvRef.getType(),
-                        j2eeContext).getCanonicalName();
+                        context.getJ2eeContext()).getCanonicalName();
             } catch (MalformedObjectNameException e) {
                 throw new DeploymentException("could not construct object name for jms resource", e);
             }
@@ -302,7 +301,7 @@
             }
             //try to resolve ref based only matching resource-ref-name
             //throws exception if it can't locate ref.
-            String containerId = refContext.getAdminObjectContainerId(uri, linkName, earContext.getJ2eeContext());
+            String containerId = refContext.getAdminObjectContainerId(uri, linkName, earContext);
             Reference ref = refContext.getAdminObjectRef(containerId, iface);
             builder.bind(name, ref);
 
@@ -616,8 +615,6 @@
 
 
     public static void setResourceEnvironment(EARContext earContext, URI uri, ResourceEnvironmentBuilder builder, ResourceRefType[] resourceRefs, GerResourceRefType[] gerResourceRefs) throws DeploymentException {
-        RefContext refContext = earContext.getRefContext();
-        J2eeContext j2eeContext = earContext.getJ2eeContext();
         Map refMap = mapResourceRefs(gerResourceRefs);
         Set unshareableResources = new HashSet();
         Set applicationManagedSecurityResources = new HashSet();
@@ -631,7 +628,7 @@
                     && !JAXR_CONNECTION_FACTORY_CLASS.equals(type)) {
 
                 GerResourceRefType gerResourceRef = (GerResourceRefType) refMap.get(resourceRefType.getResRefName().getStringValue());
-                String containerId = getResourceContainerId(getStringValue(resourceRefType.getResRefName()), NameFactory.JCA_MANAGED_CONNECTION_FACTORY, uri, gerResourceRef, refContext, j2eeContext, earContext);
+                String containerId = getResourceContainerId(getStringValue(resourceRefType.getResRefName()), NameFactory.JCA_MANAGED_CONNECTION_FACTORY, uri, gerResourceRef, earContext);
 
                 if ("Unshareable".equals(getStringValue(resourceRefType.getResSharingScope()))) {
                     unshareableResources.add(containerId);

Modified: geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java?rev=219818&r1=219817&r2=219818&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java (original)
+++ geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java Tue Jul 19 16:56:51 2005
@@ -145,13 +145,13 @@
     public void testDeployWar4() throws Exception {
         deployWar("war4", "org/apache/geronimo/test");
     }
-    
+
     public void testDeployWar5() throws Exception {
         deployWar("war5", "hello");
     }
 
     public void deployWar(String warName, String name) throws Exception {
-        
+
         File outputPath = new File(basedir,
                 "target/test-resources/deployables/" + warName);
         recursiveDelete(outputPath);
@@ -162,7 +162,7 @@
         UnpackedJarFile jarFile = new UnpackedJarFile(path);
         Module module = builder.createModule(null, jarFile);
         URI id = new URI(warName);
-        
+
         ObjectName jaccBeanName = NameFactory.getComponentName(null, null, null, null, "foo", NameFactory.JACC_MANAGER, moduleContext);
         GBeanData jaccBeanData = new GBeanData(jaccBeanName, ApplicationPolicyConfigurationManager.GBEAN_INFO);
         PermissionCollection excludedPermissions= new Permissions();
@@ -173,8 +173,8 @@
         jaccBeanData.setAttribute("contextIdToPermissionsMap", contextIDToPermissionsMap);
         jaccBeanData.setAttribute("principalRoleMap", new HashMap());
         jaccBeanData.setAttribute("roleDesignates", new HashMap());
-        start(jaccBeanData);        
-        
+        start(jaccBeanData);
+
         EARContext earContext = createEARContext(outputPath, id);
         earContext.setJaccManagerName(jaccBeanName);
         ObjectName serverName = earContext.getServerObjectName();
@@ -204,7 +204,7 @@
         }
 
         //If we got here with no errors, then Tomcat deployed the war and loaded the classes
-        
+
         kernel.stopGBean(configData.getName());
         kernel.unloadGBean(configData.getName());
 
@@ -260,27 +260,27 @@
                     }
 
                     public GBeanData locateActivationSpecInfo(
-                            ObjectName resourceAdapterName,
+                            GBeanData resourceAdapterModuleData,
                             String messageListenerInterface)
                             throws DeploymentException {
                         return null;
                     }
 
                     public GBeanData locateResourceAdapterGBeanData(
-                            ObjectName resourceAdapterModuleName)
+                            GBeanData resourceAdapterModuleData)
                             throws DeploymentException {
                         return null;
                     }
 
                     public GBeanData locateAdminObjectInfo(
-                            ObjectName resourceAdapterModuleName,
+                            GBeanData resourceAdapterModuleData,
                             String adminObjectInterfaceName)
                             throws DeploymentException {
                         return null;
                     }
 
                     public GBeanData locateConnectionFactoryInfo(
-                            ObjectName resourceAdapterModuleName,
+                            GBeanData resourceAdapterModuleData,
                             String connectionFactoryInterfaceName)
                             throws DeploymentException {
                         return null;
@@ -306,11 +306,11 @@
         }
     }
 
-    public void recursiveCopy(File src, File dest) throws IOException {       
+    public void recursiveCopy(File src, File dest) throws IOException {
         Collection files = FileUtils.listFiles(src,null,true);
         Iterator iterator = files.iterator();
         while(iterator.hasNext()){
-            File file = (File) iterator.next(); 
+            File file = (File) iterator.next();
             if (file.getAbsolutePath().indexOf(".svn") < 0){
                 String pathToFile = file.getPath();
                 String relativePath = pathToFile.substring(src.getPath().length(), pathToFile.length() - (file.getName().length()));
@@ -377,7 +377,7 @@
         start(securityServiceGBean);
 
         WebServiceBuilder webServiceBuilder = new AxisBuilder();
-        
+
         builder = new TomcatModuleBuilder(new URI("null"), containerName, webServiceBuilder, null, kernel);
 
         // Default Realm



Mime
View raw message