Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 97132 invoked from network); 25 Jun 2004 21:33:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 25 Jun 2004 21:33:34 -0000 Received: (qmail 74407 invoked by uid 500); 25 Jun 2004 21:33:50 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 74365 invoked by uid 500); 25 Jun 2004 21:33:49 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: dev@geronimo.apache.org Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 74310 invoked by uid 500); 25 Jun 2004 21:33:47 -0000 Delivered-To: apmail-incubator-geronimo-cvs@apache.org Received: (qmail 74266 invoked by uid 99); 25 Jun 2004 21:33:46 -0000 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.27.1) with SMTP; Fri, 25 Jun 2004 14:33:45 -0700 Received: (qmail 97116 invoked by uid 1712); 25 Jun 2004 21:33:27 -0000 Date: 25 Jun 2004 21:33:27 -0000 Message-ID: <20040625213327.97115.qmail@minotaur.apache.org> From: djencks@apache.org To: incubator-geronimo-cvs@apache.org Subject: cvs commit: incubator-geronimo/modules/naming/src/java/org/apache/geronimo/naming/jmx JMXReferenceFactory.java X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N djencks 2004/06/25 14:33:27 Modified: modules/connector/src/java/org/apache/geronimo/connector ResourceAdapterWrapper.java modules/connector/src/java/org/apache/geronimo/connector/deployment ConnectorModuleBuilder.java modules/connector/src/java/org/apache/geronimo/connector/deployment/dconfigbean AdminObjectInstance.java modules/connector/src/java/org/apache/geronimo/connector/outbound ManagedConnectionFactoryWrapper.java modules/connector/src/schema geronimo-connector_1_5.xsd 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/naming/src/java/org/apache/geronimo/naming/deployment ENCConfigBuilder.java modules/naming/src/java/org/apache/geronimo/naming/java ComponentContextBuilder.java modules/naming/src/java/org/apache/geronimo/naming/jmx JMXReferenceFactory.java Added: modules/connector/src/java/org/apache/geronimo/connector ActivationSpecInfo.java ActivationSpecWrapper.java Log: Call admin object name message-destination-name. Make gbeanInfo for activation spec wrappers availaible from ResourceAdapter gbean while loaded but stopped, so mdb deployment can access them. Make ActivationSpec instances into separate gbeans Revision Changes Path 1.13 +21 -8 incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/ResourceAdapterWrapper.java Index: ResourceAdapterWrapper.java =================================================================== RCS file: /home/cvs/incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/ResourceAdapterWrapper.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- ResourceAdapterWrapper.java 12 Jun 2004 18:43:31 -0000 1.12 +++ ResourceAdapterWrapper.java 25 Jun 2004 21:33:26 -0000 1.13 @@ -17,6 +17,8 @@ package org.apache.geronimo.connector; +import java.util.Map; + import javax.resource.ResourceException; import javax.resource.spi.ActivationSpec; import javax.resource.spi.ResourceAdapter; @@ -51,6 +53,8 @@ private final DynamicGBeanDelegate delegate; + private final Map activationSpecInfoMap; + /** * default constructor for enhancement proxy endpoint */ @@ -59,11 +63,15 @@ this.bootstrapContext = null; this.resourceAdapter = null; this.delegate = null; + this.activationSpecInfoMap = null; } - public ResourceAdapterWrapper(final Class resourceAdapterClass, final BootstrapContext bootstrapContext) throws InstantiationException, IllegalAccessException { + public ResourceAdapterWrapper(final Class resourceAdapterClass, + final Map activationSpecInfoMap, + final BootstrapContext bootstrapContext) throws InstantiationException, IllegalAccessException { this.resourceAdapterClass = resourceAdapterClass; this.bootstrapContext = bootstrapContext; + this.activationSpecInfoMap = activationSpecInfoMap; resourceAdapter = (ResourceAdapter) resourceAdapterClass.newInstance(); delegate = new DynamicGBeanDelegate(); delegate.addAll(resourceAdapter); @@ -73,8 +81,12 @@ return resourceAdapterClass; } - public void registerManagedConnectionFactory(final ResourceAdapterAssociation managedConnectionFactory) throws ResourceException { - managedConnectionFactory.setResourceAdapter(resourceAdapter); + public Map getActivationSpecInfoMap() { + return activationSpecInfoMap; + } + + public void registerResourceAdapterAssociation(final ResourceAdapterAssociation resourceAdapterAssociation) throws ResourceException { + resourceAdapterAssociation.setResourceAdapter(resourceAdapter); } public void start(BootstrapContext ctx) throws ResourceAdapterInternalException { @@ -125,15 +137,16 @@ static { GBeanInfoFactory infoFactory = new GBeanInfoFactory(ResourceAdapterWrapper.class); - infoFactory.addAttribute("ResourceAdapterClass", Class.class, true); + infoFactory.addAttribute("resourceAdapterClass", Class.class, true); + infoFactory.addAttribute("activationSpecInfoMap", Map.class, true); - infoFactory.addReference("BootstrapContext", BootstrapContext.class); + infoFactory.addReference("bootstrapContext", BootstrapContext.class); - infoFactory.addOperation("registerManagedConnectionFactory", new Class[]{ResourceAdapterAssociation.class}); + infoFactory.addOperation("registerResourceAdapterAssociation", new Class[]{ResourceAdapterAssociation.class}); infoFactory.addInterface(ResourceAdapter.class); - infoFactory.setConstructor(new String[]{"ResourceAdapterClass", "BootstrapContext"}); + infoFactory.setConstructor(new String[]{"resourceAdapterClass", "activationSpecInfoMap", "bootstrapContext"}); GBEAN_INFO = infoFactory.getBeanInfo(); } 1.1 incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/ActivationSpecInfo.java Index: ActivationSpecInfo.java =================================================================== /** * * Copyright 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.io.Serializable; import org.apache.geronimo.gbean.GBeanInfo; /** * Holds info needed to create an ActivationSpecWrapper gbean for an mdb. * This can be extended to include values from the ResourceAdapter configuration for * duplicated properties. * * @version $Revision: 1.1 $ $Date: 2004/06/25 21:33:26 $ * * */ public class ActivationSpecInfo implements Serializable { private final Class activationSpecClass; private final GBeanInfo activationSpecGBeanInfo; public ActivationSpecInfo(Class activationSpecClass, GBeanInfo activationSpecGBeanInfo) { this.activationSpecClass = activationSpecClass; this.activationSpecGBeanInfo = activationSpecGBeanInfo; } public Class getActivationSpecClass() { return activationSpecClass; } public GBeanInfo getActivationSpecGBeanInfo() { return activationSpecGBeanInfo; } } 1.1 incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/ActivationSpecWrapper.java Index: ActivationSpecWrapper.java =================================================================== /** * * Copyright 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.resource.ResourceException; import javax.resource.spi.ActivationSpec; import javax.resource.spi.ResourceAdapter; import javax.resource.spi.endpoint.MessageEndpointFactory; import javax.transaction.SystemException; import javax.transaction.xa.XAResource; import org.apache.geronimo.gbean.DynamicGBean; import org.apache.geronimo.gbean.DynamicGBeanDelegate; import org.apache.geronimo.gbean.GBeanInfo; import org.apache.geronimo.gbean.GBeanInfoFactory; import org.apache.geronimo.transaction.manager.NamedXAResource; import org.apache.geronimo.transaction.manager.ResourceManager; import org.apache.geronimo.transaction.manager.WrapperNamedXAResource; /** * Wrapper for ActivationSpec instances. * The framework assumes all RequiredConfigProperties are of type String, although it * is unclear if this is required by the spec. * * @version $Revision: 1.1 $ $Date: 2004/06/25 21:33:26 $ * * */ public class ActivationSpecWrapper implements ResourceManager, DynamicGBean { private final Class activationSpecClass; private final DynamicGBeanDelegate delegate; private final ActivationSpec activationSpec; private final ResourceAdapterWrapper resourceAdapterWrapper; private final String containerId; /** * Default constructor required when a class is used as a GBean Endpoint. */ public ActivationSpecWrapper() { activationSpecClass = null; activationSpec = null; delegate = null; containerId = null; resourceAdapterWrapper = null; } /** * Normal managed constructor. * * @param activationSpecClass Class of admin object to be wrapped. * @throws IllegalAccessException * @throws InstantiationException */ public ActivationSpecWrapper(final Class activationSpecClass, final String containerId, final ResourceAdapterWrapper resourceAdapterWrapper) throws IllegalAccessException, InstantiationException { this.activationSpecClass = activationSpecClass; activationSpec = (ActivationSpec) activationSpecClass.newInstance(); delegate = new DynamicGBeanDelegate(); delegate.addAll(activationSpec); this.containerId = containerId; this.resourceAdapterWrapper = resourceAdapterWrapper; } /** * Returns class of wrapped ActivationSpec. * @return class of wrapped ActivationSpec */ public Class getActivationSpecClass() { return activationSpecClass; } public String getContainerId() { return containerId; } public ResourceAdapterWrapper getResourceAdapterWrapper() { return resourceAdapterWrapper; } //DynamicGBean implementation /** * Delegating DynamicGBean getAttribute method. * @param name of attribute. * @return attribute value. * @throws Exception */ public Object getAttribute(final String name) throws Exception { return delegate.getAttribute(name); } /** * Delegating DynamicGBean setAttribute method. * @param name of attribute. * @param value of attribute to be set. * @throws Exception */ public void setAttribute(final String name, final Object value) throws Exception { delegate.setAttribute(name, value); } /** * no-op DynamicGBean method * @param name * @param arguments * @param types * @return nothing, there are no operations. * @throws Exception */ public Object invoke(final String name, final Object[] arguments, final String[] types) throws Exception { //we have no dynamic operations. return null; } //GBeanLifecycle implementation public void activate(final MessageEndpointFactory messageEndpointFactory) throws ResourceException { ResourceAdapter resourceAdapter = activationSpec.getResourceAdapter(); if (resourceAdapter == null) { resourceAdapterWrapper.registerResourceAdapterAssociation(activationSpec); } resourceAdapterWrapper.endpointActivation(messageEndpointFactory, activationSpec); } public void deactivate(final MessageEndpointFactory messageEndpointFactory) { ResourceAdapter resourceAdapter = activationSpec.getResourceAdapter(); if (resourceAdapter != null) { resourceAdapterWrapper.endpointDeactivation(messageEndpointFactory, activationSpec); } else { //this should never happen, activation spec should have been registered with r.a. throw new IllegalStateException("ActivationSpec was never registered with ResourceAdapter"); } } //Operations. public NamedXAResource getRecoveryXAResources() throws SystemException { if (resourceAdapterWrapper == null) { throw new IllegalStateException("Attempting to use activation spec when it is not activated"); } try { XAResource[] xaResources = resourceAdapterWrapper.getXAResources(new ActivationSpec[]{activationSpec}); if (xaResources.length == 0) { return null; } return new WrapperNamedXAResource(xaResources[0], containerId); } catch (ResourceException e) { throw (SystemException) new SystemException("Could not get XAResource for recovery for mdb: " + containerId).initCause(e); } } public void returnResource(NamedXAResource xaResource) { //do nothing, no way to return anything. } public static final GBeanInfo GBEAN_INFO; static { GBeanInfoFactory infoFactory = new GBeanInfoFactory(ActivationSpecWrapper.class); infoFactory.addAttribute("activationSpecClass", Class.class, true); infoFactory.addAttribute("containerId", String.class, true); infoFactory.addReference("resourceAdapterWrapper", ResourceAdapterWrapper.class); infoFactory.addOperation("activate", new Class[] {MessageEndpointFactory.class}); infoFactory.addOperation("deactivate", new Class[] {MessageEndpointFactory.class}); infoFactory.addInterface(ResourceManager.class); infoFactory.setConstructor(new String[]{ "activationSpecClass", "containerId", "resourceAdapterWrapper"}); GBEAN_INFO = infoFactory.getBeanInfo(); } public static GBeanInfo getGBeanInfo() { return GBEAN_INFO; } } 1.3 +39 -5 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.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ConnectorModuleBuilder.java 15 Jun 2004 23:33:00 -0000 1.2 +++ ConnectorModuleBuilder.java 25 Jun 2004 21:33:26 -0000 1.3 @@ -46,6 +46,8 @@ import org.apache.geronimo.common.xml.XmlBeansUtil; import org.apache.geronimo.connector.AdminObjectWrapper; import org.apache.geronimo.connector.ResourceAdapterWrapper; +import org.apache.geronimo.connector.ActivationSpecWrapper; +import org.apache.geronimo.connector.ActivationSpecInfo; import org.apache.geronimo.connector.outbound.GenericConnectionManager; import org.apache.geronimo.connector.outbound.ManagedConnectionFactoryWrapper; import org.apache.geronimo.connector.outbound.connectionmanagerconfig.LocalTransactions; @@ -86,6 +88,9 @@ import org.apache.geronimo.xbeans.j2ee.ConnectorDocument; import org.apache.geronimo.xbeans.j2ee.ConnectorType; import org.apache.geronimo.xbeans.j2ee.ResourceadapterType; +import org.apache.geronimo.xbeans.j2ee.MessagelistenerType; +import org.apache.geronimo.xbeans.j2ee.ActivationspecType; +import org.apache.geronimo.xbeans.j2ee.RequiredConfigPropertyType; import org.apache.geronimo.xbeans.j2ee.connector_1_0.ConfigPropertyType10; import org.apache.geronimo.xbeans.j2ee.connector_1_0.ConnectorDocument10; import org.apache.geronimo.xbeans.j2ee.connector_1_0.ConnectorType10; @@ -332,16 +337,20 @@ ConfigProperty[] configProperties = getConfigProperties(resourceadapter.getConfigPropertyArray(), geronimoResourceAdapter.getResourceadapterInstance().getConfigPropertySettingArray()); GBeanMBean resourceAdapterGBean = setUpDynamicGBean(resourceAdapterInfoFactory, configProperties, cl); - // set the resoruce adapter class + //get the ActivationSpec metadata as GBeanInfos + Map activationSpecInfoMap = getActivationSpecInfoMap(resourceadapter.getInboundResourceadapter().getMessageadapter().getMessagelistenerArray(), cl); + + // set the resource adapter class and activationSpec info map try { - resourceAdapterGBean.setAttribute("ResourceAdapterClass", cl.loadClass(resourceadapter.getResourceadapterClass().getStringValue())); + resourceAdapterGBean.setAttribute("resourceAdapterClass", cl.loadClass(resourceadapter.getResourceadapterClass().getStringValue())); + resourceAdapterGBean.setAttribute("activationSpecInfoMap", activationSpecInfoMap); } catch (Exception e) { throw new DeploymentException("Could not set ResourceAdapterClass", e); } // set the bootstrap context name try { - resourceAdapterGBean.setReferencePattern("BootstrapContext", + resourceAdapterGBean.setReferencePattern("bootstrapContext", ObjectName.getInstance(geronimoResourceAdapter.getResourceadapterInstance().getBootstrapcontextName().getStringValue())); } catch (MalformedObjectNameException e) { throw new DeploymentException("Could not create object name for bootstrap context", e); @@ -439,7 +448,7 @@ try { Properties nameProps = new Properties(); nameProps.put("j2eeType", "JCAAdminObject"); - nameProps.put("name", gerAdminObjectInstance.getAdminobjectName()); + nameProps.put("name", gerAdminObjectInstance.getMessageDestinationName()); nameProps.put("J2EEServer", earContext.getJ2EEServerName()); ObjectName adminObjectObjectName = new ObjectName(earContext.getJ2EEDomainName(), nameProps); @@ -449,6 +458,31 @@ } } } + } + + private Map getActivationSpecInfoMap(MessagelistenerType[] messagelistenerArray, ClassLoader cl) throws DeploymentException { + Map activationSpecInfos = new HashMap(); + for (int i = 0; i < messagelistenerArray.length; i++) { + MessagelistenerType messagelistenerType = messagelistenerArray[i]; + ActivationspecType activationspec = messagelistenerType.getActivationspec(); + String activationSpecClassName = activationspec.getActivationspecClass().getStringValue(); + GBeanInfoFactory infoFactory = new GBeanInfoFactory(ActivationSpecWrapper.class, ActivationSpecWrapper.getGBeanInfo()); + for (int j = 0; j < activationspec.getRequiredConfigPropertyArray().length; j++) { + RequiredConfigPropertyType requiredConfigPropertyType = activationspec.getRequiredConfigPropertyArray()[j]; + String propertyName = requiredConfigPropertyType.getConfigPropertyName().getStringValue(); + infoFactory.addAttribute(new DynamicGAttributeInfo(propertyName, true)); + } + GBeanInfo gbeanInfo = infoFactory.getBeanInfo(); + Class activationSpecClass = null; + try { + activationSpecClass = cl.loadClass(activationSpecClassName); + } catch (ClassNotFoundException e) { + throw new DeploymentException("Could not load ActivationSpec class", e); + } + ActivationSpecInfo activationSpecInfo = new ActivationSpecInfo(activationSpecClass, gbeanInfo); + activationSpecInfos.put(activationSpecClassName, activationSpecInfo); + } + return activationSpecInfos; } private GBeanMBean setUpDynamicGBean(GBeanInfoFactory infoFactory, ConfigProperty[] configProperties, ClassLoader cl) throws DeploymentException { 1.7 +5 -5 incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/deployment/dconfigbean/AdminObjectInstance.java Index: AdminObjectInstance.java =================================================================== RCS file: /home/cvs/incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/deployment/dconfigbean/AdminObjectInstance.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- AdminObjectInstance.java 10 Mar 2004 09:58:31 -0000 1.6 +++ AdminObjectInstance.java 25 Jun 2004 21:33:26 -0000 1.7 @@ -103,12 +103,12 @@ pcs.firePropertyChange("configProperty", old, configs); } - public String getAdminObjectName() { - return getAdminobjectInstance().getAdminobjectName(); + public String getMessageDestinationName() { + return getAdminobjectInstance().getMessageDestinationName(); } - public void setAdminObjectName(String adminObjectName) { - getAdminobjectInstance().setAdminobjectName(adminObjectName); + public void setMessageDestinationName(String messageDestinationName) { + getAdminobjectInstance().setMessageDestinationName(messageDestinationName); } } 1.17 +2 -2 incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java Index: ManagedConnectionFactoryWrapper.java =================================================================== RCS file: /home/cvs/incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- ManagedConnectionFactoryWrapper.java 12 Jun 2004 18:43:31 -0000 1.16 +++ ManagedConnectionFactoryWrapper.java 25 Jun 2004 21:33:26 -0000 1.17 @@ -164,7 +164,7 @@ if (resourceAdapterWrapper == null) { throw new IllegalStateException("Managed connection factory expects to be registered with a ResourceAdapter, but there is no ResourceAdapter"); } - resourceAdapterWrapper.registerManagedConnectionFactory((ResourceAdapterAssociation) managedConnectionFactory); + resourceAdapterWrapper.registerResourceAdapterAssociation((ResourceAdapterAssociation) managedConnectionFactory); registered = true; log.debug("Registered managedConnectionFactory with ResourceAdapter " + resourceAdapterWrapper.toString()); } 1.14 +2 -2 incubator-geronimo/modules/connector/src/schema/geronimo-connector_1_5.xsd Index: geronimo-connector_1_5.xsd =================================================================== RCS file: /home/cvs/incubator-geronimo/modules/connector/src/schema/geronimo-connector_1_5.xsd,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- geronimo-connector_1_5.xsd 6 May 2004 03:58:23 -0000 1.13 +++ geronimo-connector_1_5.xsd 25 Jun 2004 21:33:26 -0000 1.14 @@ -90,10 +90,10 @@ - - unique name for admin object instance. Used in object name of mbean for it. + unique name for admin object instance. Used in object name of gbean for it. Matches message-destination-name in ejb-jar.xml assembly descriptor. 1.12 +25 -8 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.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- RAR_1_5ConfigBuilderTest.java 15 Jun 2004 23:33:00 -0000 1.11 +++ RAR_1_5ConfigBuilderTest.java 25 Jun 2004 21:33:27 -0000 1.12 @@ -31,13 +31,16 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Map; import java.util.Set; import java.util.jar.JarFile; import java.util.jar.JarOutputStream; + import javax.management.ObjectName; import javax.sql.DataSource; import junit.framework.TestCase; +import org.apache.geronimo.connector.ActivationSpecInfo; import org.apache.geronimo.gbean.GBeanInfo; import org.apache.geronimo.gbean.jmx.GBeanMBean; import org.apache.geronimo.j2ee.deployment.EARContext; @@ -161,7 +164,27 @@ kernel.loadGBean(objectName, config); config.setAttribute("BaseURL", unpackedDir.toURL()); - // start the configuration + //start configuration to load but not start gbeans. + kernel.startGBean(objectName); + //verify that activationSpecInfoMap is accessible and correct while ResourceAdapterGBean is stopped. + ObjectName resourceAdapter = new ObjectName(j2eeDomainName + + ":j2eeType=ResourceAdapter" + + ",name=testRA" + + ",J2EEServer=" + j2eeServerName + + ",J2EEApplication=" + j2eeApplicationName + + ",ResourceAdapterModule=" + j2eeModuleName); + Map activationSpecInfoMap = (Map) kernel.getAttribute(resourceAdapter, "activationSpecInfoMap"); + assertEquals(1, activationSpecInfoMap.size()); + ActivationSpecInfo activationSpecInfo = (ActivationSpecInfo) activationSpecInfoMap.get("org.apache.geronimo.connector.mock.MockActivationSpec"); + assertNotNull(activationSpecInfo); + GBeanInfo activationSpecGBeanInfo = activationSpecInfo.getActivationSpecGBeanInfo(); + List attributes = activationSpecGBeanInfo.getPersistentAttributes(); + assertEquals(3, attributes.size()); + + //startRecursive can only be invoked if GBean is stopped. + kernel.stopGBean(objectName); + + // start the configuration to also start gbeans. kernel.startRecursiveGBean(objectName); assertRunning(kernel, objectName); @@ -177,12 +200,6 @@ assertRunning(kernel, moduleName); // ResourceAdapter - ObjectName resourceAdapter = new ObjectName(j2eeDomainName + - ":j2eeType=ResourceAdapter" + - ",name=testRA" + - ",J2EEServer=" + j2eeServerName + - ",J2EEApplication=" + j2eeApplicationName + - ",ResourceAdapterModule=" + j2eeModuleName); assertRunning(kernel, resourceAdapter); // FirstTestOutboundConnectionFactory 1.18 +2 -2 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.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- geronimo-ra.xml 15 Jun 2004 21:37:39 -0000 1.17 +++ geronimo-ra.xml 25 Jun 2004 21:33:27 -0000 1.18 @@ -90,11 +90,11 @@ org.apache.geronimo.connector.mock.MockAdminObject org.apache.geronimo.connector.mock.MockAdminObjectImpl - tweedledee + tweedledee Dee-value - tweedledum + tweedledum Dum-value 1.3 +24 -1 incubator-geronimo/modules/naming/src/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java Index: ENCConfigBuilder.java =================================================================== RCS file: /home/cvs/incubator-geronimo/modules/naming/src/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ENCConfigBuilder.java 9 Mar 2004 22:49:07 -0000 1.2 +++ ENCConfigBuilder.java 25 Jun 2004 21:33:27 -0000 1.3 @@ -24,6 +24,7 @@ import org.apache.geronimo.xbeans.j2ee.EnvEntryType; import org.apache.geronimo.xbeans.j2ee.ResourceRefType; import org.apache.geronimo.xbeans.j2ee.ResourceEnvRefType; +import org.apache.geronimo.xbeans.j2ee.MessageDestinationRefType; import org.apache.geronimo.deployment.DeploymentException; import org.apache.geronimo.naming.java.ComponentContextBuilder; @@ -91,5 +92,27 @@ throw new DeploymentException("Invalid env-entry definition for name: " + name, e); } } + } + + public static void addMessageDestinationRefs(MessageDestinationRefType[] messageDestinationRefs, ClassLoader cl, ComponentContextBuilder builder) throws DeploymentException { + for (int i = 0; i < messageDestinationRefs.length; i++) { + MessageDestinationRefType messageDestinationRef = messageDestinationRefs[i]; + String name = messageDestinationRef.getMessageDestinationRefName().getStringValue(); + String linkName = messageDestinationRef.getMessageDestinationLink().getStringValue(); + String type = messageDestinationRef.getMessageDestinationType().getStringValue(); + Class iface = null; + try { + iface = cl.loadClass(type); + } catch (ClassNotFoundException e) { + throw new DeploymentException("could not load class " + type, e); + } + try { + builder.addMessageDestinationRef(name, linkName, iface); + } catch (NamingException e) { + throw new DeploymentException("Invalid env-entry definition for name: " + name, e); + } + + } + } } 1.9 +12 -1 incubator-geronimo/modules/naming/src/java/org/apache/geronimo/naming/java/ComponentContextBuilder.java Index: ComponentContextBuilder.java =================================================================== RCS file: /home/cvs/incubator-geronimo/modules/naming/src/java/org/apache/geronimo/naming/java/ComponentContextBuilder.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- ComponentContextBuilder.java 13 Apr 2004 19:57:18 -0000 1.8 +++ ComponentContextBuilder.java 25 Jun 2004 21:33:27 -0000 1.9 @@ -123,5 +123,16 @@ context.internalBind(ENV + name, ref); } + //TODO this works only if there is only one kernel running. + public void addMessageDestinationRef(String name, String linkName, Class iface) throws NamingException { + Reference ref = null; + try { + ref = referenceFactory.buildMessageDestinationReference(linkName, iface); + } catch (MalformedObjectNameException e) { + throw (NamingException) new NamingException("invalid object name").initCause(e); + } + context.internalBind(ENV + name, ref); + } + // todo methods for other references } 1.3 +10 -3 incubator-geronimo/modules/naming/src/java/org/apache/geronimo/naming/jmx/JMXReferenceFactory.java Index: JMXReferenceFactory.java =================================================================== RCS file: /home/cvs/incubator-geronimo/modules/naming/src/java/org/apache/geronimo/naming/jmx/JMXReferenceFactory.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- JMXReferenceFactory.java 15 Jun 2004 03:00:38 -0000 1.2 +++ JMXReferenceFactory.java 25 Jun 2004 21:33:27 -0000 1.3 @@ -31,9 +31,9 @@ * */ public class JMXReferenceFactory { + //TODO these names are constructed in a more generic fashion in ConnectorModuleBuilder. public static final String BASE_MANAGED_CONNECTION_FACTORY_NAME = "geronimo.server:J2EEServer=geronimo,j2eeType=JCAManagedConnectionFactory,name="; - // todo this name is wrong see ConnectionModuleBuilder - public static final String BASE_ADMIN_OBJECT_NAME = "geronimo.server:J2EEServer=geronimo,j2eeType=AdminObject,name="; + public static final String BASE_ADMIN_OBJECT_NAME = "geronimo.server:J2EEServer=geronimo,j2eeType=JCAAdminObject,name="; public JMXReferenceFactory() { } @@ -47,6 +47,13 @@ public Reference buildAdminObjectReference(RefAdapter refAdapter, Class iface) throws MalformedObjectNameException { Reference ref = new Reference(null, JMXObjectFactory.class.getName(), null); ref.add(new JMXRefAddr(refAdapter.getServerName(), refAdapter.getKernelName(), ObjectName.getInstance(BASE_ADMIN_OBJECT_NAME + refAdapter.getTargetName()), iface)); + return ref; + } + + //TODO warning: this only works if there is only one kernel! + public Reference buildMessageDestinationReference(String linkName, Class iface) throws MalformedObjectNameException { + Reference ref = new Reference(null, JMXObjectFactory.class.getName(), null); + ref.add(new JMXRefAddr(null, null, ObjectName.getInstance(BASE_ADMIN_OBJECT_NAME + linkName), iface)); return ref; }