djencks 2004/07/06 10:19:14
Modified: modules/connector/src/java/org/apache/geronimo/connector/deployment ConnectorModuleBuilder.java modules/connector/src/test/org/apache/geronimo/connector/deployment RAR_1_5ConfigBuilderTest.java modules/connector/src/test-data/connector_1_5 geronimo-ra.xml modules/deployment/src/java/org/apache/geronimo/deployment DeploymentContext.java modules/j2ee/src/java/org/apache/geronimo/j2ee/deployment EARConfigBuilder.java EARContext.java Log: Make mdb deployment work Revision Changes Path 1.5 +2 -1 incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java Index: ConnectorModuleBuilder.java =================================================================== RCS file: /home/cvs/incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- ConnectorModuleBuilder.java 29 Jun 2004 21:46:32 -0000 1.4 +++ ConnectorModuleBuilder.java 6 Jul 2004 17:19:13 -0000 1.5 @@ -344,6 +344,7 @@ //get the ActivationSpec metadata as GBeanInfos Map activationSpecInfoMap = getActivationSpecInfoMap(resourceadapter.getInboundResourceadapter().getMessageadapter().getMessagelistenerArray(), cl); resourceAdapterGBean.setAttribute("activationSpecInfoMap", activationSpecInfoMap); + earContext.addResourceAdapter(resourceAdapterName, module.getName(), activationSpecInfoMap); } } catch (Exception e) { throw new DeploymentException("Could not set ResourceAdapterClass", e); 1.13 +10 -1 incubator-geronimo/modules/connector/src/test/org/apache/geronimo/connector/deployment/RAR_1_5ConfigBuilderTest.java Index: RAR_1_5ConfigBuilderTest.java =================================================================== RCS file: /home/cvs/incubator-geronimo/modules/connector/src/test/org/apache/geronimo/connector/deployment/RAR_1_5ConfigBuilderTest.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- RAR_1_5ConfigBuilderTest.java 25 Jun 2004 21:33:27 -0000 1.12 +++ RAR_1_5ConfigBuilderTest.java 6 Jul 2004 17:19:14 -0000 1.13 @@ -201,6 +201,7 @@ // ResourceAdapter assertRunning(kernel, resourceAdapter); + assertAttributeValue(kernel, resourceAdapter, "RAStringProperty", "NewStringValue"); // FirstTestOutboundConnectionFactory ObjectName firstConnectionManagerFactory = new ObjectName(j2eeDomainName + @@ -225,6 +226,9 @@ ",J2EEServer=" + j2eeServerName + ",name=FirstTestOutboundConnectionFactory"); assertRunning(kernel, firstOutMCF); + assertAttributeValue(kernel, firstOutMCF, "OutboundStringProperty1", "newvalue1"); + assertAttributeValue(kernel, firstOutMCF, "OutboundStringProperty2", "originalvalue2"); + assertAttributeValue(kernel, firstOutMCF, "OutboundStringProperty3", "newvalue2"); // SecondTestOutboundConnectionFactory ObjectName secondConnectionManagerFactory = new ObjectName(j2eeDomainName + @@ -305,6 +309,11 @@ } Thread.currentThread().setContextClassLoader(cl); } + } + + private void assertAttributeValue(Kernel kernel, ObjectName objectName, String attributeName, String attributeValue) throws Exception { + Object value = kernel.getAttribute(objectName, attributeName); + assertEquals(attributeValue, value); } private void assertRunning(Kernel kernel, ObjectName objectName) throws Exception { 1.19 +0 -3 incubator-geronimo/modules/connector/src/test-data/connector_1_5/geronimo-ra.xml Index: geronimo-ra.xml =================================================================== RCS file: /home/cvs/incubator-geronimo/modules/connector/src/test-data/connector_1_5/geronimo-ra.xml,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- geronimo-ra.xml 25 Jun 2004 21:33:27 -0000 1.18 +++ geronimo-ra.xml 6 Jul 2004 17:19:14 -0000 1.19 @@ -105,11 +105,8 @@ </gbean> <gbean name="geronimo.connector:service=WorkManager" class="org.apache.geronimo.connector.work.GeronimoWorkManager"> - <attribute name="SyncMinimumPoolSize" type="int">0</attribute> <attribute name="SyncMaximumPoolSize" type="int">10</attribute> - <attribute name="StartMinimumPoolSize" type="int">0</attribute> <attribute name="StartMaximumPoolSize" type="int">10</attribute> - <attribute name="ScheduledMinimumPoolSize" type="int">0</attribute> <attribute name="ScheduledMaximumPoolSize" type="int">10</attribute> <reference name="XAWork">geronimo.server:type=TransactionManager</reference> </gbean> 1.12 +4 -2 incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java Index: DeploymentContext.java =================================================================== RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- DeploymentContext.java 1 Jun 2004 16:06:50 -0000 1.11 +++ DeploymentContext.java 6 Jul 2004 17:19:14 -0000 1.12 @@ -38,6 +38,7 @@ import java.util.jar.JarOutputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; + import javax.management.MalformedObjectNameException; import javax.management.ObjectName; @@ -228,8 +229,9 @@ public void close() throws IOException, DeploymentException { if (outputStreams.size() != 1) { - throw new IllegalStateException("Conext must be unnested before being closed"); + throw new IllegalStateException("Context must be unnested before being closed"); } + JarOutputStream jos = getJos(); saveConfiguration(); try { 1.12 +14 -7 incubator-geronimo/modules/j2ee/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java Index: EARConfigBuilder.java =================================================================== RCS file: /home/cvs/incubator-geronimo/modules/j2ee/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- EARConfigBuilder.java 23 Jun 2004 21:58:22 -0000 1.11 +++ EARConfigBuilder.java 6 Jul 2004 17:19:14 -0000 1.12 @@ -30,6 +30,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Set; +import java.util.LinkedHashSet; import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.jar.JarOutputStream; @@ -205,9 +206,8 @@ // get the modules either the application plan or for a stand alone module from the specific deployer Set moduleLocations = new HashSet(); - Set modules = new HashSet(); + Set modules = new LinkedHashSet(); ApplicationType application = addModules(configId, plan, earFile, moduleLocations, modules); - // if this is an ear, the application name is the configId; otherwise application name is "null" String applicationName; if (application != null) { @@ -319,8 +319,12 @@ throw new DeploymentException("Unable to parse application.xml"); } - // get a set contianing all of the files in the ear that are actually modules + // get a set containing all of the files in the ear that are actually modules ModuleType[] moduleTypes = application.getModuleArray(); + Set ejbModules = new HashSet(); + Set connectorModules = new HashSet(); + Set webModules = new HashSet(); + for (int i = 0; i < moduleTypes.length; i++) { ModuleType module = moduleTypes[i]; if (module.isSetEjb()) { @@ -330,7 +334,7 @@ throw new DeploymentException("Can not deploy ejb application; No ejb deployer defined: " + ejbModule.getURI()); } moduleLocations.add(uri.toString()); - modules.add(ejbModule); + ejbModules.add(ejbModule); } else if (module.isSetWeb()) { org.apache.geronimo.xbeans.j2ee.WebType web = module.getWeb(); URI uri = URI.create(web.getWebUri().getStringValue()); @@ -340,7 +344,7 @@ throw new DeploymentException("Can not deploy web application; No war deployer defined: " + webModule.getURI()); } moduleLocations.add(uri.toString()); - modules.add(webModule); + webModules.add(webModule); } else if (module.isSetConnector()) { URI uri = URI.create(module.getConnector().getStringValue()); ConnectorModule connectorModule = new ConnectorModule(uri.toString(), uri); @@ -348,9 +352,12 @@ throw new DeploymentException("Can not deploy resource adapter; No rar deployer defined: " + connectorModule.getURI()); } moduleLocations.add(uri.toString()); - modules.add(connectorModule); + connectorModules.add(connectorModule); } } + modules.addAll(connectorModules); + modules.addAll(ejbModules); + modules.addAll(webModules); } else if (webConfigBuilder != null && webConfigBuilder.canHandlePlan(plan)) { modules.add(webConfigBuilder.createModule(configId.toString(), plan)); application = null; 1.5 +19 -1 incubator-geronimo/modules/j2ee/src/java/org/apache/geronimo/j2ee/deployment/EARContext.java Index: EARContext.java =================================================================== RCS file: /home/cvs/incubator-geronimo/modules/j2ee/src/java/org/apache/geronimo/j2ee/deployment/EARContext.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- EARContext.java 11 Jun 2004 19:18:21 -0000 1.4 +++ EARContext.java 6 Jul 2004 17:19:14 -0000 1.5 @@ -22,6 +22,7 @@ import java.util.Map; import java.util.Properties; import java.util.jar.JarOutputStream; + import javax.management.MalformedObjectNameException; import javax.management.ObjectName; @@ -35,6 +36,8 @@ public class EARContext extends DeploymentContext { private final Map ejbRefs = new HashMap(); private final Map ejbLocalRefs = new HashMap(); + private final Map resourceAdapterModules = new HashMap(); + private final Map activationSpecInfos = new HashMap(); private final String j2eeDomainName; private final String j2eeServerName; private final String j2eeApplicationName; @@ -188,5 +191,20 @@ } return ejbRef; } + } + + public void addResourceAdapter(String resourceAdapterName, String resourceAdapterModule, Map activationSpecInfoMap) { + resourceAdapterModules.put(resourceAdapterName, resourceAdapterModule); + activationSpecInfos.put(resourceAdapterName, activationSpecInfoMap); + } + + public Object getActivationSpecInfo(String resourceAdapterName, String activationSpecClassName) { + Map activationSpecInfoMap = (Map) activationSpecInfos.get(resourceAdapterName); + Object activationSpecInfo = activationSpecInfoMap.get(activationSpecClassName); + return activationSpecInfo; + } + + public String getResourceAdapterModule(String resourceAdapterName) { + return (String) resourceAdapterModules.get(resourceAdapterName); } }