You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2004/11/17 00:00:53 UTC
svn commit: rev 76049 - in geronimo/trunk/modules: connector-builder/src/java/org/apache/geronimo/connector/deployment connector-builder/src/test-data/connector_1_0 connector-builder/src/test-data/data connector-builder/src/test/org/apache/geronimo/connector/deployment connector/src/java/org/apache/geronimo/connector connector/src/java/org/apache/geronimo/connector/outbound connector/src/test/org/apache/geronimo/connector connector/src/test/org/apache/geronimo/connector/outbound j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment j2ee-schema/src/conf j2ee-schema/src/java/org/apache/geronimo/schema j2ee-schema/src/test-data/j2ee_1_3dtd j2ee-schema/src/test/org/apache/geronimo/schema j2ee/src/java/org/apache/geronimo/j2ee/j2eeobjectnames
Author: djencks
Date: Tue Nov 16 15:00:50 2004
New Revision: 76049
Added:
geronimo/trunk/modules/j2ee-schema/src/test-data/j2ee_1_3dtd/ra-10.xml
geronimo/trunk/modules/j2ee-schema/src/test-data/j2ee_1_3dtd/ra-15.xml
Removed:
geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/ActivationSpecInfo.java
Modified:
geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
geronimo/trunk/modules/connector-builder/src/test-data/connector_1_0/geronimo-ra.xml
geronimo/trunk/modules/connector-builder/src/test-data/data/external-application-plan.xml
geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/RAR_1_0ConfigBuilderTest.java
geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/RAR_1_5ConfigBuilderTest.java
geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/ActivationSpecWrapper.java
geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/AdminObjectWrapper.java
geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/ResourceAdapterModuleImpl.java
geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/ResourceAdapterWrapper.java
geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java
geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/AdminObjectWrapperTest.java
geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapperTest.java
geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/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-schema/src/conf/xmlconfig.xml
geronimo/trunk/modules/j2ee-schema/src/java/org/apache/geronimo/schema/SchemaConversionUtils.java
geronimo/trunk/modules/j2ee-schema/src/test/org/apache/geronimo/schema/SchemaConversionUtilsTest.java
geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/j2eeobjectnames/NameFactory.java
Log:
GERONIMO-485 GERONIMO-486 Process j2ca 1.0 dds by converting them to 1.5 dds. Move activation spec metadata to resource module gbean
Modified: geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
==============================================================================
--- 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 Nov 16 15:00:50 2004
@@ -32,16 +32,16 @@
import java.util.Set;
import java.util.jar.JarFile;
import java.util.zip.ZipEntry;
-import javax.management.AttributeNotFoundException;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
-import javax.management.ReflectionException;
import javax.naming.Reference;
import org.apache.geronimo.common.propertyeditor.PropertyEditors;
-import org.apache.geronimo.connector.ActivationSpecInfo;
import org.apache.geronimo.connector.ResourceAdapterModuleImpl;
+import org.apache.geronimo.connector.AdminObjectWrapper;
+import org.apache.geronimo.connector.ActivationSpecWrapper;
import org.apache.geronimo.connector.outbound.JCAConnectionFactoryImpl;
+import org.apache.geronimo.connector.outbound.ManagedConnectionFactoryWrapper;
import org.apache.geronimo.connector.outbound.connectionmanagerconfig.LocalTransactions;
import org.apache.geronimo.connector.outbound.connectionmanagerconfig.NoPool;
import org.apache.geronimo.connector.outbound.connectionmanagerconfig.NoTransactions;
@@ -56,6 +56,8 @@
import org.apache.geronimo.deployment.service.GBeanHelper;
import org.apache.geronimo.deployment.util.DeploymentUtil;
import org.apache.geronimo.gbean.DynamicGAttributeInfo;
+import org.apache.geronimo.gbean.GAttributeInfo;
+import org.apache.geronimo.gbean.GBeanData;
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoBuilder;
import org.apache.geronimo.gbean.InvalidConfigurationException;
@@ -94,10 +96,6 @@
import org.apache.geronimo.xbeans.j2ee.FullyQualifiedClassType;
import org.apache.geronimo.xbeans.j2ee.MessagelistenerType;
import org.apache.geronimo.xbeans.j2ee.ResourceadapterType;
-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;
-import org.apache.geronimo.xbeans.j2ee.connector_1_0.ResourceadapterType10;
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlObject;
@@ -153,17 +151,20 @@
specDD = DeploymentUtil.readAll(specDDUrl);
// parse it
- try {
- // try 1.0
- ConnectorDocument10 connectorDoc = ConnectorDocument10.Factory.parse(specDD);
- SchemaConversionUtils.validateDD(connectorDoc);
- connector = connectorDoc.getConnector();
- } catch (Exception ignore) {
- // that didn't work try 1.5
- ConnectorDocument connectorDoc = ConnectorDocument.Factory.parse(specDD);
- SchemaConversionUtils.validateDD(connectorDoc);
- connector = connectorDoc.getConnector();
- }
+ XmlObject xmlObject = SchemaConversionUtils.parse(specDD);
+ ConnectorDocument connectorDoc = SchemaConversionUtils.convertToConnectorSchema(xmlObject);
+ connector = connectorDoc.getConnector();
+// try {
+// // try 1.0
+// ConnectorDocument10 connectorDoc = ConnectorDocument10.Factory.parse(specDD);
+// SchemaConversionUtils.validateDD(connectorDoc);
+// connector = connectorDoc.getConnector();
+// } catch (Exception ignore) {
+// // that didn't work try 1.5
+// ConnectorDocument connectorDoc = ConnectorDocument.Factory.parse(specDD);
+// SchemaConversionUtils.validateDD(connectorDoc);
+// connector = connectorDoc.getConnector();
+// }
} catch (Exception e) {
return null;
}
@@ -257,29 +258,68 @@
J2eeContext earJ2eeContext = earContext.getJ2eeContext();
J2eeContext moduleJ2eeContext = new J2eeContextImpl(earJ2eeContext.getJ2eeDomainName(), earJ2eeContext.getJ2eeServerName(), earJ2eeContext.getJ2eeApplicationName(), module.getName(), null, null);
XmlObject specDD = module.getSpecDD();
+
+ //set up the metadata for the ResourceAdapterModule
+ ObjectName resourceAdapterModuleName = null;
+ try {
+ resourceAdapterModuleName = NameFactory.getModuleName(null, null, null, null, NameFactory.RESOURCE_ADAPTER_MODULE, moduleJ2eeContext);
+ } catch (MalformedObjectNameException e) {
+ throw new DeploymentException("Could not construct module name", e);
+ }
+ GBeanData resourceAdapterModuleData = new GBeanData(resourceAdapterModuleName, ResourceAdapterModuleImpl.GBEAN_INFO);
+
+ // initalize the GBean
+ resourceAdapterModuleData.setReferencePattern(NameFactory.J2EE_SERVER, earContext.getServerObjectName());
+ if (!earContext.getJ2EEApplicationName().equals(NameFactory.NULL)) {
+ resourceAdapterModuleData.setReferencePattern(NameFactory.J2EE_APPLICATION, earContext.getApplicationObjectName());
+ }
+
+ try {
+ resourceAdapterModuleData.setAttribute("deploymentDescriptor", module.getOriginalSpecDD());
+ } catch (Exception e) {
+ throw new DeploymentException("Unable to initialize EJBModule GBean", e);
+ }
+
+ ResourceadapterType resourceadapter = ((ConnectorType) specDD).getResourceadapter();
+ // Create the resource adapter gbean
+ if (resourceadapter.isSetResourceadapterClass()) {
+ GBeanInfoBuilder resourceAdapterInfoBuilder = new GBeanInfoBuilder("org.apache.geronimo.connector.ResourceAdapterWrapper", cl);
+ GBeanData resourceAdapterGBeanData = setUpDynamicGBean(resourceAdapterInfoBuilder, resourceadapter.getConfigPropertyArray(), cl);
+
+ resourceAdapterGBeanData.setAttribute("resourceAdapterClass", resourceadapter.getResourceadapterClass().getStringValue().trim());
+ resourceAdapterModuleData.setAttribute("resourceAdapterGBeanData", resourceAdapterGBeanData);
+ }
+
+ if (resourceadapter.isSetInboundResourceadapter() && resourceadapter.getInboundResourceadapter().isSetMessageadapter()) {
+ Map activationSpecInfoMap = getActivationSpecInfoMap(resourceadapter.getInboundResourceadapter().getMessageadapter().getMessagelistenerArray(), cl);
+ resourceAdapterModuleData.setAttribute("activationSpecInfoMap", activationSpecInfoMap);
+ }
+ Map adminObjectInfoMap = getAdminObjectInfoMap(resourceadapter.getAdminobjectArray(), cl);
+ resourceAdapterModuleData.setAttribute("adminObjectInfoMap", adminObjectInfoMap);
+ if (resourceadapter.isSetOutboundResourceadapter()) {
+ Map managedConnectionFactoryInfoMap = getManagedConnectionFactoryInfoMap(resourceadapter.getOutboundResourceadapter().getConnectionDefinitionArray(), cl);
+ resourceAdapterModuleData.setAttribute("managedConnectionFactoryInfoMap", managedConnectionFactoryInfoMap);
+ }
+
+ earContext.getRefContext().addResourceAdapterModuleInfo(resourceAdapterModuleName, resourceAdapterModuleData);
+
+ //register the instances we will create later
GerConnectorType geronimoConnector = (GerConnectorType) module.getVendorDD();
GerResourceadapterType[] geronimoResourceAdapters = geronimoConnector.getResourceadapterArray();
for (int k = 0; k < geronimoResourceAdapters.length; k++) {
GerResourceadapterType geronimoResourceAdapter = geronimoResourceAdapters[k];
- if (specDD instanceof ConnectorType) {
- ResourceadapterType resourceadapter = ((ConnectorType) specDD).getResourceadapter();
- if (resourceadapter.isSetResourceadapterClass()) {
- // set the resource adapter class and activationSpec info map
- try {
- if (resourceadapter.isSetInboundResourceadapter() && resourceadapter.getInboundResourceadapter().isSetMessageadapter()) {
- String resourceAdapterName = geronimoResourceAdapter.getResourceadapterInstance().getResourceadapterName();
- ObjectName resourceAdapterObjectName = NameFactory.getResourceComponentName(null, null, null, null, resourceAdapterName, NameFactory.JCA_RESOURCE_ADAPTER, moduleJ2eeContext);
- //get the ActivationSpec metadata as GBeanInfos
- Map activationSpecInfoMap = getActivationSpecInfoMap(resourceadapter.getInboundResourceadapter().getMessageadapter().getMessagelistenerArray(), cl);
-
- String containerId = resourceAdapterObjectName.getCanonicalName();
- earContext.getRefContext().addResourceAdapterId(module.getModuleURI(), resourceAdapterName, containerId);
- earContext.getRefContext().addActivationSpecInfos(resourceAdapterObjectName, activationSpecInfoMap);
- }
- } catch (Exception e) {
- throw new DeploymentException("Could not set ResourceAdapterClass", e);
+ if (resourceadapter.isSetResourceadapterClass()) {
+ // set the resource adapter class and activationSpec info map
+ try {
+ if (resourceadapter.isSetInboundResourceadapter() && resourceadapter.getInboundResourceadapter().isSetMessageadapter()) {
+ String resourceAdapterName = geronimoResourceAdapter.getResourceadapterInstance().getResourceadapterName();
+ ObjectName resourceAdapterObjectName = NameFactory.getResourceComponentName(null, null, null, null, resourceAdapterName, NameFactory.JCA_RESOURCE_ADAPTER, moduleJ2eeContext);
+ String containerId = resourceAdapterObjectName.getCanonicalName();
+ earContext.getRefContext().addResourceAdapterId(module.getModuleURI(), resourceAdapterName, containerId);
}
+ } catch (Exception e) {
+ throw new DeploymentException("Could not set ResourceAdapterClass", e);
}
}
if (geronimoResourceAdapter.isSetOutboundResourceadapter()) {
@@ -321,26 +361,8 @@
J2eeContext earJ2eeContext = earContext.getJ2eeContext();
J2eeContext moduleJ2eeContext = new J2eeContextImpl(earJ2eeContext.getJ2eeDomainName(), earJ2eeContext.getJ2eeServerName(), earJ2eeContext.getJ2eeApplicationName(), module.getName(), null, null);
- addResourceAdapterModuleGBean(earContext, moduleJ2eeContext, module.getOriginalSpecDD(), cl);
-
- GerConnectorType geronimoConnector = (GerConnectorType) module.getVendorDD();
-
- GerGbeanType[] gbeans = geronimoConnector.getGbeanArray();
- for (int i = 0; i < gbeans.length; i++) {
- GBeanHelper.addGbean(new RARGBeanAdapter(gbeans[i]), cl, earContext);
- }
-
XmlObject specDD = module.getSpecDD();
- if (specDD instanceof ConnectorType10) {
- addConnectorGBeans(earContext, moduleJ2eeContext, (ConnectorType10) specDD, geronimoConnector, cl);
- } else {
- addConnectorGBeans(earContext, moduleJ2eeContext, (ConnectorType) specDD, geronimoConnector, cl);
- }
- return null;
- }
-
- private ObjectName addResourceAdapterModuleGBean(EARContext earContext, J2eeContext moduleJ2eeContext, String originalSpecDD, ClassLoader cl) throws DeploymentException {
// build the objectName
ObjectName resourceAdapterModuleName = null;
try {
@@ -348,83 +370,37 @@
} catch (MalformedObjectNameException e) {
throw new DeploymentException("Could not construct module name", e);
}
-
- // initalize the GBean
- GBeanMBean resourceAdapterModule = new GBeanMBean(ResourceAdapterModuleImpl.GBEAN_INFO, cl);
- resourceAdapterModule.setReferencePattern(NameFactory.J2EE_SERVER, earContext.getServerObjectName());
- if (!earContext.getJ2EEApplicationName().equals(NameFactory.NULL)) {
- resourceAdapterModule.setReferencePattern(NameFactory.J2EE_APPLICATION, earContext.getApplicationObjectName());
- }
-
- try {
- resourceAdapterModule.setAttribute("deploymentDescriptor", originalSpecDD);
- } catch (Exception e) {
- throw new DeploymentException("Unable to initialize EJBModule GBean", e);
- }
+ GBeanData resourceAdapterModuleData = earContext.getRefContext().getResourceAdapterModuleData(resourceAdapterModuleName);
// add it
- earContext.addGBean(resourceAdapterModuleName, resourceAdapterModule);
-
- return resourceAdapterModuleName;
- }
+ earContext.addGBean(resourceAdapterModuleData, cl);
- private void addConnectorGBeans(EARContext earContext, J2eeContext j2eeContext, ConnectorType10 connector, GerConnectorType geronimoConnector, ClassLoader cl) throws DeploymentException {
- ResourceadapterType10 resourceAdapter = connector.getResourceadapter();
- String managedConnectionFactoryClass = resourceAdapter.getManagedconnectionfactoryClass().getStringValue().trim();
- String connectionFactoryInterface = resourceAdapter.getConnectionfactoryInterface().getStringValue().trim();
- String connectionFactoryImplClass = resourceAdapter.getConnectionfactoryImplClass().getStringValue().trim();
- String connectionInterface = resourceAdapter.getConnectionInterface().getStringValue().trim();
- String connectionImplClass = resourceAdapter.getConnectionImplClass().getStringValue().trim();
- String transactionSupport = resourceAdapter.getTransactionSupport().getStringValue().trim();
- GerResourceadapterType[] geronimoResourceAdapters = geronimoConnector.getResourceadapterArray();
- for (int k = 0; k < geronimoResourceAdapters.length; k++) {
- GerResourceadapterType geronimoResourceAdapter = geronimoResourceAdapters[k];
+ GerConnectorType geronimoConnector = (GerConnectorType) module.getVendorDD();
- for (int i = 0; i < geronimoResourceAdapter.getOutboundResourceadapter().getConnectionDefinitionArray().length; i++) {
- GerConnectionDefinitionType geronimoConnectionDefinition = geronimoResourceAdapter.getOutboundResourceadapter().getConnectionDefinitionArray(i);
- assert geronimoConnectionDefinition != null: "Null GeronimoConnectionDefinition";
+ GerGbeanType[] gbeans = geronimoConnector.getGbeanArray();
+ for (int i = 0; i < gbeans.length; i++) {
+ GBeanHelper.addGbean(new RARGBeanAdapter(gbeans[i]), cl, earContext);
+ }
- for (int j = 0; j < geronimoConnectionDefinition.getConnectiondefinitionInstanceArray().length; j++) {
- GerConnectiondefinitionInstanceType connectionfactoryInstance = geronimoConnectionDefinition.getConnectiondefinitionInstanceArray()[j];
- ConfigProperty[] configProperties = getConfigProperties(resourceAdapter.getConfigPropertyArray(), connectionfactoryInstance.getConfigPropertySettingArray());
+ addConnectorGBeans(earContext, moduleJ2eeContext, resourceAdapterModuleName, (ConnectorType) specDD, geronimoConnector, cl);
- addOutboundGBeans(earContext, j2eeContext, null, connectionfactoryInstance, configProperties, managedConnectionFactoryClass, connectionFactoryInterface, connectionFactoryImplClass, connectionInterface, connectionImplClass, transactionSupport, cl);
- }
- }
- }
+ return null;
}
- private void addConnectorGBeans(EARContext earContext, J2eeContext moduleJ2eeContext, ConnectorType connector, GerConnectorType geronimoConnector, ClassLoader cl) throws DeploymentException {
+ private void addConnectorGBeans(EARContext earContext, J2eeContext moduleJ2eeContext, ObjectName resourceAdapterModuleObjectName, ConnectorType connector, GerConnectorType geronimoConnector, ClassLoader cl) throws DeploymentException {
ResourceadapterType resourceadapter = connector.getResourceadapter();
String transactionSupport = resourceadapter.getOutboundResourceadapter().getTransactionSupport().getStringValue().trim();
GerResourceadapterType[] geronimoResourceAdapters = geronimoConnector.getResourceadapterArray();
for (int k = 0; k < geronimoResourceAdapters.length; k++) {
GerResourceadapterType geronimoResourceAdapter = geronimoResourceAdapters[k];
- //
// Resource Adapter
- //
-
ObjectName resourceAdapterObjectName = null;
if (resourceadapter.isSetResourceadapterClass()) {
- String resourceAdapterName = geronimoResourceAdapter.getResourceadapterInstance().getResourceadapterName();
-
- // Create the resource adapter gbean
- GBeanInfoBuilder resourceAdapterInfoFactory = new GBeanInfoBuilder("org.apache.geronimo.connector.ResourceAdapterWrapper", cl);
- ConfigProperty[] configProperties = getConfigProperties(resourceadapter.getConfigPropertyArray(), geronimoResourceAdapter.getResourceadapterInstance().getConfigPropertySettingArray());
- GBeanMBean resourceAdapterGBean = setUpDynamicGBean(resourceAdapterInfoFactory, configProperties, cl);
+ GBeanData resourceAdapterGBeanData = earContext.getRefContext().getResourceAdapterGBeanData(resourceAdapterModuleObjectName);
+ GBeanData resourceAdapterInstanceGBeanData = new GBeanData(resourceAdapterGBeanData);
- // set the resource adapter class and activationSpec info map
- try {
- resourceAdapterGBean.setAttribute("resourceAdapterClass", cl.loadClass(resourceadapter.getResourceadapterClass().getStringValue()));
- if (resourceadapter.isSetInboundResourceadapter() && resourceadapter.getInboundResourceadapter().isSetMessageadapter()) {
- //get the ActivationSpec metadata as GBeanInfos
- Map activationSpecInfoMap = getActivationSpecInfoMap(resourceadapter.getInboundResourceadapter().getMessageadapter().getMessagelistenerArray(), cl);
- resourceAdapterGBean.setAttribute("activationSpecInfoMap", activationSpecInfoMap);
- }
- } catch (Exception e) {
- throw new DeploymentException("Could not set ResourceAdapterClass", e);
- }
+ setDynamicGBeanDataAttributes(resourceAdapterInstanceGBeanData, geronimoResourceAdapter.getResourceadapterInstance().getConfigPropertySettingArray(), cl);
// set the work manager name
ObjectName workManagerName = null;
@@ -433,94 +409,58 @@
} catch (MalformedObjectNameException e) {
throw new DeploymentException("Could not construct work manager object name", e);
}
- resourceAdapterGBean.setReferencePattern("WorkManager", workManagerName);
+ resourceAdapterInstanceGBeanData.setReferencePattern("WorkManager", workManagerName);
- // add it
+ String resourceAdapterName = geronimoResourceAdapter.getResourceadapterInstance().getResourceadapterName();
try {
resourceAdapterObjectName = NameFactory.getResourceComponentName(null, null, null, null, resourceAdapterName, NameFactory.JCA_RESOURCE_ADAPTER, moduleJ2eeContext);
} catch (MalformedObjectNameException e) {
throw new DeploymentException("Could not construct resource adapter object name", e);
}
- earContext.addGBean(resourceAdapterObjectName, resourceAdapterGBean);
+ resourceAdapterInstanceGBeanData.setName(resourceAdapterObjectName);
+ earContext.addGBean(resourceAdapterInstanceGBeanData, cl);
}
- //
- // Outbound Managed Connectopn Factories (think JDBC data source or JMS connection factory)
- //
-
- // first we need a map of the published outbound adaptors by connection factory interface type
- Map connectionDefinitions = new HashMap();
- if (resourceadapter.isSetOutboundResourceadapter()) {
- for (int j = 0; j < resourceadapter.getOutboundResourceadapter().getConnectionDefinitionArray().length; j++) {
- ConnectionDefinitionType connectionDefinition = resourceadapter.getOutboundResourceadapter().getConnectionDefinitionArray(j);
- connectionDefinitions.put(connectionDefinition.getConnectionfactoryInterface().getStringValue(), connectionDefinition);
- }
-
- // ManagedConnectionFactory setup
- if (geronimoResourceAdapter.isSetOutboundResourceadapter()) {
- for (int i = 0; i < geronimoResourceAdapter.getOutboundResourceadapter().getConnectionDefinitionArray().length; i++) {
- GerConnectionDefinitionType geronimoConnectionDefinition = geronimoResourceAdapter.getOutboundResourceadapter().getConnectionDefinitionArray(i);
- assert geronimoConnectionDefinition != null: "Null GeronimoConnectionDefinition";
-
- String connectionFactoryInterfaceName = geronimoConnectionDefinition.getConnectionfactoryInterface().getStringValue();
- ConnectionDefinitionType connectionDefinition = (ConnectionDefinitionType) connectionDefinitions.get(connectionFactoryInterfaceName);
- if (connectionDefinition == null) {
- throw new DeploymentException("No connection definition for ConnectionFactory class: " + connectionFactoryInterfaceName);
- }
- String managedConnectionFactoryClass = connectionDefinition.getManagedconnectionfactoryClass().getStringValue().trim();
- String connectionFactoryInterface = connectionDefinition.getConnectionfactoryInterface().getStringValue().trim();
- String connectionFactoryImplClass = connectionDefinition.getConnectionfactoryImplClass().getStringValue().trim();
- String connectionInterface = connectionDefinition.getConnectionInterface().getStringValue().trim();
- String connectionImplClass = connectionDefinition.getConnectionImplClass().getStringValue().trim();
-
- for (int j = 0; j < geronimoConnectionDefinition.getConnectiondefinitionInstanceArray().length; j++) {
- GerConnectiondefinitionInstanceType connectionfactoryInstance = geronimoConnectionDefinition.getConnectiondefinitionInstanceArray()[j];
- ConfigProperty[] configProperties = getConfigProperties(connectionDefinition.getConfigPropertyArray(), connectionfactoryInstance.getConfigPropertySettingArray());
+ // Outbound Managed Connection Factories (think JDBC data source or JMS connection factory)
- addOutboundGBeans(earContext, moduleJ2eeContext, resourceAdapterObjectName, connectionfactoryInstance, configProperties, managedConnectionFactoryClass, connectionFactoryInterface, connectionFactoryImplClass, connectionInterface, connectionImplClass, transactionSupport, cl);
- }
+ // ManagedConnectionFactory setup
+ if (geronimoResourceAdapter.isSetOutboundResourceadapter()) {
+ for (int i = 0; i < geronimoResourceAdapter.getOutboundResourceadapter().getConnectionDefinitionArray().length; i++) {
+ GerConnectionDefinitionType geronimoConnectionDefinition = geronimoResourceAdapter.getOutboundResourceadapter().getConnectionDefinitionArray(i);
+ assert geronimoConnectionDefinition != null: "Null GeronimoConnectionDefinition";
+
+ String connectionFactoryInterfaceName = geronimoConnectionDefinition.getConnectionfactoryInterface().getStringValue().trim();
+ GBeanData connectionFactoryGBeanData = (GBeanData) earContext.getRefContext().getConnectionFactoryInfo(resourceAdapterModuleObjectName, connectionFactoryInterfaceName);
+
+ if (connectionFactoryGBeanData == null) {
+ throw new DeploymentException("No connection definition for ConnectionFactory class: " + connectionFactoryInterfaceName);
}
- }
- }
+ for (int j = 0; j < geronimoConnectionDefinition.getConnectiondefinitionInstanceArray().length; j++) {
+ GerConnectiondefinitionInstanceType connectionfactoryInstance = geronimoConnectionDefinition.getConnectiondefinitionInstanceArray()[j];
+ addOutboundGBeans(earContext, moduleJ2eeContext, resourceAdapterObjectName, connectionFactoryGBeanData, connectionfactoryInstance, transactionSupport, cl);
+ }
+ }
+ }
}
- //
// admin objects (think message queuse and topics)
- //
- // first we need a map of the published admin objects by interface type
- Map adminObjectInterfaceMap = new HashMap();
- for (int i = 0; i < resourceadapter.getAdminobjectArray().length; i++) {
- AdminobjectType adminobject = resourceadapter.getAdminobjectArray()[i];
- adminObjectInterfaceMap.put(adminobject.getAdminobjectInterface().getStringValue(), adminobject);
- }
// add configured admin objects
for (int i = 0; i < geronimoConnector.getAdminobjectArray().length; i++) {
GerAdminobjectType gerAdminObject = geronimoConnector.getAdminobjectArray()[i];
String adminObjectInterface = gerAdminObject.getAdminobjectInterface().getStringValue();
- AdminobjectType adminObject = (AdminobjectType) adminObjectInterfaceMap.get(adminObjectInterface);
- if (adminObject == null) {
+ GBeanData adminObjectGBeanData = (GBeanData) earContext.getRefContext().getAdminObjectInfo(resourceAdapterModuleObjectName, adminObjectInterface);
+
+ if (adminObjectGBeanData == null) {
throw new DeploymentException("No admin object declared for interface: " + adminObjectInterface);
}
for (int j = 0; j < gerAdminObject.getAdminobjectInstanceArray().length; j++) {
+ GBeanData adminObjectInstanceGBeanData = new GBeanData(adminObjectGBeanData);
GerAdminobjectInstanceType gerAdminObjectInstance = gerAdminObject.getAdminobjectInstanceArray()[j];
-
- // create the adminObjectGBean
- GBeanInfoBuilder adminObjectInfoFactory = new GBeanInfoBuilder("org.apache.geronimo.connector.AdminObjectWrapper", cl);
- ConfigProperty[] configProperties = getConfigProperties(adminObject.getConfigPropertyArray(), gerAdminObjectInstance.getConfigPropertySettingArray());
- GBeanMBean adminObjectGBean = setUpDynamicGBean(adminObjectInfoFactory, configProperties, cl);
-
- // set the standard properties
- try {
- adminObjectGBean.setAttribute("adminObjectInterface", cl.loadClass(adminObjectInterface));
- adminObjectGBean.setAttribute("adminObjectClass", cl.loadClass(adminObject.getAdminobjectClass().getStringValue()));
- } catch (Exception e) {
- throw new DeploymentException("Could not initialize AdminObject", e);
- }
-
+ setDynamicGBeanDataAttributes(adminObjectInstanceGBeanData, gerAdminObjectInstance.getConfigPropertySettingArray(), cl);
// add it
ObjectName adminObjectObjectName = null;
try {
@@ -528,7 +468,8 @@
} catch (MalformedObjectNameException e) {
throw new DeploymentException("Could not construct admin object object name", e);
}
- earContext.addGBean(adminObjectObjectName, adminObjectGBean);
+ adminObjectInstanceGBeanData.setName(adminObjectObjectName);
+ earContext.addGBean(adminObjectInstanceGBeanData, cl);
}
}
}
@@ -540,7 +481,7 @@
String messageListenerInterface = messagelistenerType.getMessagelistenerType().getStringValue().trim();
ActivationspecType activationspec = messagelistenerType.getActivationspec();
String activationSpecClassName = activationspec.getActivationspecClass().getStringValue();
- GBeanInfoBuilder infoBuilder = new GBeanInfoBuilder("org.apache.geronimo.connector.ActivationSpecWrapper", cl);
+ GBeanInfoBuilder infoBuilder = new GBeanInfoBuilder(ActivationSpecWrapper.class.getName(), cl);
//add all javabean properties that have both getter and setter. Ignore the "required" flag from the dd.
Map getters = new HashMap();
@@ -566,7 +507,7 @@
getters.remove("resourceAdapter");
for (Iterator iterator = getters.entrySet().iterator(); iterator.hasNext();) {
- Map.Entry entry = (Map.Entry) iterator.next();
+ Map.Entry entry = (Map.Entry) iterator.next();
infoBuilder.addAttribute(new DynamicGAttributeInfo((String) entry.getKey(), (String) entry.getValue(), true, true, true));
}
@@ -577,113 +518,104 @@
} catch (ClassNotFoundException e) {
throw new DeploymentException("Could not load ActivationSpec class", e);
}
- ActivationSpecInfo activationSpecInfo = new ActivationSpecInfo(activationSpecClassName, gbeanInfo);
+ GBeanData activationSpecInfo = new GBeanData(gbeanInfo);
+ activationSpecInfo.setAttribute("activationSpecClass", activationSpecClassName);
activationSpecInfos.put(messageListenerInterface, activationSpecInfo);
}
return activationSpecInfos;
}
- private GBeanMBean setUpDynamicGBean(GBeanInfoBuilder infoFactory, ConfigProperty[] configProperties, ClassLoader cl) throws DeploymentException {
- for (int i = 0; i < configProperties.length; i++) {
- infoFactory.addAttribute(new DynamicGAttributeInfo(configProperties[i].getName(), configProperties[i].getType(),true, true, true));
- }
+ private Map getManagedConnectionFactoryInfoMap(ConnectionDefinitionType[] connectionDefinitionArray, ClassLoader cl) throws DeploymentException {
+ Map managedConnectionFactoryInfos = new HashMap();
+ for (int i = 0; i < connectionDefinitionArray.length; i++) {
+ ConnectionDefinitionType connectionDefinition = connectionDefinitionArray[i];
- GBeanInfo gbeanInfo = infoFactory.getBeanInfo();
- GBeanMBean gbean;
- try {
- gbean = new GBeanMBean(gbeanInfo, cl);
- } catch (InvalidConfigurationException e) {
- throw new DeploymentException("Unable to create GMBean", e);
- }
+ GBeanInfoBuilder adminObjectInfoFactory = new GBeanInfoBuilder(ManagedConnectionFactoryWrapper.class.getName(), cl);
+ GBeanData managedConnectionFactoryGBeanData = setUpDynamicGBean(adminObjectInfoFactory, connectionDefinition.getConfigPropertyArray(), cl);
- try {
- for (int i = 0; i < configProperties.length; i++) {
- ConfigProperty configProperty = configProperties[i];
-
- setAttributeValue(gbean,
- configProperty.getName(),
- configProperty.getType(),
- configProperty.getExplicitValue(),
- configProperty.getDefaultValue());
- }
- } catch (DeploymentException e) {
- throw e;
- } catch (Exception e) {
- throw new DeploymentException(e);
+ // set the standard properties
+ String connectionfactoryInterface = connectionDefinition.getConnectionfactoryInterface().getStringValue().trim();
+ managedConnectionFactoryGBeanData.setAttribute("managedConnectionFactoryClass", connectionDefinition.getManagedconnectionfactoryClass().getStringValue().trim());
+ managedConnectionFactoryGBeanData.setAttribute("connectionFactoryInterface", connectionfactoryInterface);
+ managedConnectionFactoryGBeanData.setAttribute("connectionFactoryImplClass", connectionDefinition.getConnectionfactoryImplClass().getStringValue().trim());
+ managedConnectionFactoryGBeanData.setAttribute("connectionInterface", connectionDefinition.getConnectionInterface().getStringValue().trim());
+ managedConnectionFactoryGBeanData.setAttribute("connectionImplClass", connectionDefinition.getConnectionImplClass().getStringValue().trim());
+ managedConnectionFactoryInfos.put(connectionfactoryInterface, managedConnectionFactoryGBeanData);
}
- return gbean;
+ return managedConnectionFactoryInfos;
}
- private ConfigProperty[] getConfigProperties(ConfigPropertyType10[] configPropertyTypes, GerConfigPropertySettingType[] configPropertySettings) {
- Map explicitValues = getExplicitValuesMap(configPropertySettings);
+ private Map getAdminObjectInfoMap(AdminobjectType[] adminobjectArray, ClassLoader cl) throws DeploymentException {
+ Map adminObjectInfos = new HashMap();
+ for (int i = 0; i < adminobjectArray.length; i++) {
+ AdminobjectType adminObject = adminobjectArray[i];
- ConfigProperty[] configProperties = new ConfigProperty[configPropertyTypes.length];
- for (int i = 0; i < configPropertyTypes.length; i++) {
- ConfigPropertyType10 configPropertyType = configPropertyTypes[i];
- String name = configPropertyType.getConfigPropertyName().getStringValue();
- String type = configPropertyType.getConfigPropertyType().getStringValue();
- String explicitValue = (String) explicitValues.get(name);
- String defaultValue;
- if (configPropertyType.getConfigPropertyValue() != null) {
- defaultValue = configPropertyType.getConfigPropertyValue().getStringValue();
- } else {
- defaultValue = null;
- }
- configProperties[i] = new ConfigProperty(name, type, explicitValue, defaultValue);
+ GBeanInfoBuilder adminObjectInfoFactory = new GBeanInfoBuilder(AdminObjectWrapper.class.getName(), cl);
+ GBeanData adminObjectGBeanData = setUpDynamicGBean(adminObjectInfoFactory, adminObject.getConfigPropertyArray(), cl);
+
+ // set the standard properties
+ String adminObjectInterface = adminObject.getAdminobjectInterface().getStringValue().trim();
+ adminObjectGBeanData.setAttribute("adminObjectInterface", adminObjectInterface);
+ adminObjectGBeanData.setAttribute("adminObjectClass", adminObject.getAdminobjectClass().getStringValue().trim());
+ adminObjectInfos.put(adminObjectInterface, adminObjectGBeanData);
}
- return configProperties;
+ return adminObjectInfos;
}
- private ConfigProperty[] getConfigProperties(ConfigPropertyType[] configPropertyTypes, GerConfigPropertySettingType[] configPropertySettings) {
- Map explicitValues = getExplicitValuesMap(configPropertySettings);
- ConfigProperty[] configProperties = new ConfigProperty[configPropertyTypes.length];
- for (int i = 0; i < configPropertyTypes.length; i++) {
- ConfigPropertyType configPropertyType = configPropertyTypes[i];
- String name = configPropertyType.getConfigPropertyName().getStringValue();
- String type = configPropertyType.getConfigPropertyType().getStringValue();
- String explicitValue = (String) explicitValues.get(name);
- String defaultValue = null;
- if (configPropertyType.isSetConfigPropertyValue()) {
- defaultValue = configPropertyType.getConfigPropertyValue().getStringValue();
+ private GBeanData setUpDynamicGBean(GBeanInfoBuilder infoBuilder, ConfigPropertyType[] configProperties, ClassLoader cl) throws DeploymentException {
+ for (int i = 0; i < configProperties.length; i++) {
+ infoBuilder.addAttribute(new DynamicGAttributeInfo(configProperties[i].getConfigPropertyName().getStringValue().trim(), configProperties[i].getConfigPropertyType().getStringValue().trim(), true, true, true));
+ }
+
+ GBeanInfo gbeanInfo = infoBuilder.getBeanInfo();
+ GBeanData gbeanData = new GBeanData(gbeanInfo);
+ for (int i = 0; i < configProperties.length; i++) {
+ if (configProperties[i].isSetConfigPropertyValue()) {
+ gbeanData.setAttribute(configProperties[i].getConfigPropertyName().getStringValue(),
+ getValue(configProperties[i].getConfigPropertyType().getStringValue(),
+ configProperties[i].getConfigPropertyValue().getStringValue(),
+ cl));
}
- configProperties[i] = new ConfigProperty(name, type, explicitValue, defaultValue);
}
- return configProperties;
+ return gbeanData;
}
- private Map getExplicitValuesMap(GerConfigPropertySettingType[] configPropertySettings) {
- Map explicitValues = new HashMap();
- for (int j = 0; j < configPropertySettings.length; j++) {
- GerConfigPropertySettingType configPropertySetting = configPropertySettings[j];
- String name = configPropertySetting.getName();
- String value = configPropertySetting.getStringValue();
- explicitValues.put(name, value);
+ private void setDynamicGBeanDataAttributes(GBeanData gbeanData, GerConfigPropertySettingType[] configProperties, ClassLoader cl) throws DeploymentException {
+
+ try {
+ for (int i = 0; i < configProperties.length; i++) {
+ String name = configProperties[i].getName();
+ GAttributeInfo attributeInfo = gbeanData.getGBeanInfo().getAttribute(name);
+ if (attributeInfo == null) {
+ throw new DeploymentException("The plan is trying to set attribute: " + name + " which does not exist. Known attributs are: " + gbeanData.getGBeanInfo().getAttributes());
+ }
+ String type = attributeInfo.getType();
+ gbeanData.setAttribute(name,
+ getValue(type, configProperties[i].getStringValue(), cl));
+ }
+ } catch (DeploymentException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new DeploymentException(e);
}
- return explicitValues;
}
- private static void setAttributeValue(GBeanMBean gbean, String name, String type, String explicitValue, String defaultValue) throws DeploymentException, ReflectionException, AttributeNotFoundException {
- if (explicitValue == null && defaultValue == null) {
- return;
+ private Object getValue(String type, String value, ClassLoader cl) throws DeploymentException {
+ if (value == null) {
+ return null;
}
Class clazz;
try {
- clazz = gbean.getClassLoader().loadClass(type);
+ clazz = cl.loadClass(type);
} catch (ClassNotFoundException e) {
- throw new DeploymentException("Could not load attribute class: attribute: " + name + ", type: " + type, e);
+ throw new DeploymentException("Could not load attribute class: type: " + type, e);
}
PropertyEditor editor = PropertyEditors.getEditor(clazz);
- if (explicitValue != null) {
- editor.setAsText(explicitValue);
- } else {
- editor.setAsText(defaultValue);
- }
- Object value = editor.getValue();
-
- gbean.setAttribute(name, value);
+ editor.setAsText(value);
+ return editor.getValue();
}
private ObjectName configureConnectionManager(EARContext earContext, J2eeContext j2eeContext, String ddTransactionSupport, GerConnectiondefinitionInstanceType connectionfactoryInstance, ClassLoader cl) throws DeploymentException {
@@ -775,39 +707,42 @@
return connectionManagerObjectName;
}
- private void addOutboundGBeans(EARContext earContext, J2eeContext j2eeContext, ObjectName resourceAdapterObjectName, GerConnectiondefinitionInstanceType connectiondefinitionInstance, ConfigProperty[] configProperties, String managedConnectionFactoryClass, String connectionFactoryInterface, String connectionFactoryImplClass, String connectionInterface, String connectionImplClass, String transactionSupport, ClassLoader cl) throws DeploymentException {
+ private void addOutboundGBeans(EARContext earContext,
+ J2eeContext j2eeContext,
+ ObjectName resourceAdapterObjectName,
+ GBeanData managedConnectionFactoryPrototypeGBeanData,
+ GerConnectiondefinitionInstanceType connectiondefinitionInstance,
+ String transactionSupport,
+ ClassLoader cl) throws DeploymentException {
+ GBeanData managedConnectionFactoryInstanceGBeanData = new GBeanData(managedConnectionFactoryPrototypeGBeanData);
// ConnectionManager
ObjectName connectionManagerObjectName = configureConnectionManager(earContext, j2eeContext, transactionSupport, connectiondefinitionInstance, cl);
// ManagedConnectionFactory
- GBeanInfoBuilder managedConnectionFactoryInfoFactory = new GBeanInfoBuilder("org.apache.geronimo.connector.outbound.ManagedConnectionFactoryWrapper", cl);
- GBeanMBean managedConnectionFactoryGBean = setUpDynamicGBean(managedConnectionFactoryInfoFactory, configProperties, cl);
+ setDynamicGBeanDataAttributes(managedConnectionFactoryInstanceGBeanData, connectiondefinitionInstance.getConfigPropertySettingArray(), cl);
try {
- managedConnectionFactoryGBean.setAttribute("managedConnectionFactoryClass", cl.loadClass(managedConnectionFactoryClass));
- managedConnectionFactoryGBean.setAttribute("connectionFactoryInterface", cl.loadClass(connectionFactoryInterface));
- managedConnectionFactoryGBean.setAttribute("connectionFactoryImplClass", cl.loadClass(connectionFactoryImplClass));
- managedConnectionFactoryGBean.setAttribute("connectionInterface", cl.loadClass(connectionInterface));
- managedConnectionFactoryGBean.setAttribute("connectionImplClass", cl.loadClass(connectionImplClass));
- managedConnectionFactoryGBean.setAttribute("globalJNDIName", connectiondefinitionInstance.getGlobalJndiName());
+ if (connectiondefinitionInstance.isSetGlobalJndiName()) {
+ managedConnectionFactoryInstanceGBeanData.setAttribute("globalJNDIName", connectiondefinitionInstance.getGlobalJndiName().trim());
+ }
if (resourceAdapterObjectName != null) {
- managedConnectionFactoryGBean.setReferencePattern("ResourceAdapterWrapper", resourceAdapterObjectName);
+ managedConnectionFactoryInstanceGBeanData.setReferencePattern("ResourceAdapterWrapper", resourceAdapterObjectName);
}
- managedConnectionFactoryGBean.setReferencePattern("ConnectionManagerFactory", connectionManagerObjectName);
+ managedConnectionFactoryInstanceGBeanData.setReferencePattern("ConnectionManagerFactory", connectionManagerObjectName);
if (connectiondefinitionInstance.getCredentialInterface() != null && "javax.resource.spi.security.PasswordCredential".equals(connectiondefinitionInstance.getCredentialInterface().getStringValue())) {
GBeanMBean realmGBean = new GBeanMBean(PasswordCredentialRealm.getGBeanInfo(), cl);
realmGBean.setAttribute("realmName", BASE_PASSWORD_CREDENTIAL_LOGIN_MODULE_NAME + connectiondefinitionInstance.getName());
ObjectName realmObjectNam = ObjectName.getInstance(BASE_PASSWORD_CREDENTIAL_LOGIN_MODULE_NAME + connectiondefinitionInstance.getName());
earContext.addGBean(realmObjectNam, realmGBean);
- managedConnectionFactoryGBean.setReferencePattern("ManagedConnectionFactoryListener", realmObjectNam);
+ managedConnectionFactoryInstanceGBeanData.setReferencePattern("ManagedConnectionFactoryListener", realmObjectNam);
}
//additional interfaces implemented by connection factory
FullyQualifiedClassType[] implementedInterfaceElements = connectiondefinitionInstance.getImplementedInterfaceArray();
- Class[] implementedInterfaces = new Class[implementedInterfaceElements == null ? 0 : implementedInterfaceElements.length];
+ String[] implementedInterfaces = new String[implementedInterfaceElements == null ? 0 : implementedInterfaceElements.length];
for (int i = 0; i < implementedInterfaceElements.length; i++) {
FullyQualifiedClassType additionalInterfaceType = implementedInterfaceElements[i];
- implementedInterfaces[i] = cl.loadClass(additionalInterfaceType.getStringValue());
+ implementedInterfaces[i] = additionalInterfaceType.getStringValue().trim();
}
- managedConnectionFactoryGBean.setAttribute("implementedInterfaces", implementedInterfaces);
+ managedConnectionFactoryInstanceGBeanData.setAttribute("implementedInterfaces", implementedInterfaces);
} catch (Exception e) {
throw new DeploymentException(e);
@@ -819,24 +754,21 @@
} catch (MalformedObjectNameException e) {
throw new DeploymentException("Could not construct managed connection factory object name", e);
}
- earContext.addGBean(managedConnectionFactoryObjectName, managedConnectionFactoryGBean);
+ managedConnectionFactoryInstanceGBeanData.setName(managedConnectionFactoryObjectName);
+ earContext.addGBean(managedConnectionFactoryInstanceGBeanData, cl);
// ConnectionFactory
- GBeanMBean connectionFactory = new GBeanMBean(JCAConnectionFactoryImpl.GBEAN_INFO, cl);
- connectionFactory.setReferencePattern("J2EEServer", earContext.getServerObjectName());
- try {
- connectionFactory.setAttribute("managedConnectionFactory", managedConnectionFactoryObjectName.getCanonicalName());
- } catch (Exception e) {
- throw new DeploymentException("Could not initialize JCAConnectionFactory", e);
- }
-
ObjectName connectionFactoryObjectName = null;
try {
connectionFactoryObjectName = NameFactory.getResourceComponentName(null, null, null, null, connectiondefinitionInstance.getName(), NameFactory.JCA_CONNECTION_FACTORY, j2eeContext);
} catch (MalformedObjectNameException e) {
throw new DeploymentException("Could not construct connection factory object name", e);
}
- earContext.addGBean(connectionFactoryObjectName, connectionFactory);
+ GBeanData connectionFactoryGBeanData = new GBeanData(connectionFactoryObjectName, JCAConnectionFactoryImpl.GBEAN_INFO);
+ connectionFactoryGBeanData.setReferencePattern("J2EEServer", earContext.getServerObjectName());
+ connectionFactoryGBeanData.setAttribute("managedConnectionFactory", managedConnectionFactoryObjectName.getCanonicalName());
+
+ earContext.addGBean(connectionFactoryGBeanData, cl);
}
private static URI getDependencyURI(GerDependencyType dependency) throws DeploymentException {
@@ -877,44 +809,42 @@
return (ObjectName) names.iterator().next();
}
- public Object locateActivationSpecInfo(ObjectName resourceAdapterName, String messageListenerInterface) throws DeploymentException {
+ public GBeanData locateActivationSpecInfo(ObjectName resourceAdapterModuleName, String messageListenerInterface) throws DeploymentException {
Map activationSpecInfos = null;
try {
- activationSpecInfos = (Map) kernel.getAttribute(resourceAdapterName, "activationSpecInfoMap");
+ activationSpecInfos = (Map) kernel.getAttribute(resourceAdapterModuleName, "activationSpecInfoMap");
} catch (Exception e) {
- throw new DeploymentException("Could not get activation spec infos for resource adapter named: " + resourceAdapterName, e);
+ throw new DeploymentException("Could not get activation spec infos for resource adapter named: " + resourceAdapterModuleName, e);
}
- return activationSpecInfos.get(messageListenerInterface);
+ return (GBeanData) activationSpecInfos.get(messageListenerInterface);
}
- private final static class ConfigProperty {
- private final String name;
- private final String type;
- private final String explicitValue;
- private final String defaultValue;
-
- public ConfigProperty(String name, String type, String explicitValue, String defaultValue) {
- this.name = name;
- this.type = type;
- this.explicitValue = explicitValue;
- this.defaultValue = defaultValue;
- }
-
- public String getName() {
- return name;
- }
-
- public String getType() {
- return type;
+ 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 String getExplicitValue() {
- return explicitValue;
+ 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);
}
+ return (GBeanData) activationSpecInfos.get(adminObjectInterfaceName);
+ }
- public String getDefaultValue() {
- return defaultValue;
+ 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);
}
+ return (GBeanData) activationSpecInfos.get(connectionFactoryInterfaceName);
}
public static final GBeanInfo GBEAN_INFO;
@@ -939,7 +869,8 @@
GBEAN_INFO = infoBuilder.getBeanInfo();
}
- public static GBeanInfo getGBeanInfo() {
+ public static GBeanInfo getGBeanInfo
+ () {
return GBEAN_INFO;
}
}
Modified: geronimo/trunk/modules/connector-builder/src/test-data/connector_1_0/geronimo-ra.xml
==============================================================================
--- geronimo/trunk/modules/connector-builder/src/test-data/connector_1_0/geronimo-ra.xml (original)
+++ geronimo/trunk/modules/connector-builder/src/test-data/connector_1_0/geronimo-ra.xml Tue Nov 16 15:00:50 2004
@@ -60,7 +60,7 @@
</connectiondefinition-instance>
<connectiondefinition-instance>
<name>ThirdTestOutboundConnectionFactory</name>
- <config-property-setting name="OutboundStringProperty">StringValue3</config-property-setting>
+ <config-property-setting name="OutboundStringProperty1">StringValue3</config-property-setting>
<connectionmanager>
<realm-bridge>TargetRealm</realm-bridge>
<xa-transaction>
Modified: geronimo/trunk/modules/connector-builder/src/test-data/data/external-application-plan.xml
==============================================================================
--- geronimo/trunk/modules/connector-builder/src/test-data/data/external-application-plan.xml (original)
+++ geronimo/trunk/modules/connector-builder/src/test-data/data/external-application-plan.xml Tue Nov 16 15:00:50 2004
@@ -68,7 +68,7 @@
<!--test defaults for pool and tx-->
<connectiondefinition-instance>
<name>ThirdTestOutboundConnectionFactory</name>
- <config-property-setting name="OutboundStringProperty">StringValue3</config-property-setting>
+ <config-property-setting name="OutboundStringProperty1">StringValue3</config-property-setting>
<connectionmanager>
<realm-bridge>TargetRealm</realm-bridge>
<partitioned-pool>
Modified: geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/RAR_1_0ConfigBuilderTest.java
==============================================================================
--- geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/RAR_1_0ConfigBuilderTest.java (original)
+++ geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/RAR_1_0ConfigBuilderTest.java Tue Nov 16 15:00:50 2004
@@ -54,7 +54,6 @@
import org.apache.geronimo.kernel.management.State;
import org.apache.geronimo.system.serverinfo.ServerInfo;
import org.apache.geronimo.xbeans.geronimo.GerConnectorDocument;
-import org.apache.geronimo.xbeans.j2ee.connector_1_0.ConnectorDocument10;
import org.apache.xmlbeans.XmlOptions;
import org.tranql.sql.jdbc.JDBCUtil;
@@ -76,15 +75,6 @@
private URI defaultParentId;
- public void testLoadJ2eeDeploymentDescriptor() throws Exception {
- InputStream j2eeInputStream = j2eeDD.openStream();
- ConnectorDocument10 connectorDocument = ConnectorDocument10.Factory.parse(j2eeInputStream);
- assertNotNull(connectorDocument.getConnector().getResourceadapter());
- if (!connectorDocument.validate(xmlOptions)) {
- fail(errors.toString());
- }
- }
-
public void testLoadGeronimoDeploymentDescriptor() throws Exception {
InputStream geronimoInputStream = geronimoDD.openStream();
GerConnectorDocument connectorDocument = GerConnectorDocument.Factory.parse(geronimoInputStream);
@@ -175,10 +165,6 @@
}
private void executeTestBuildModule(InstallAction action) throws Exception {
-// String j2eeDomainName = "geronimo.server";
-// String j2eeServerName = "TestGeronimoServer";
-// String j2eeModuleName = "org/apache/geronimo/j2ee/deployment/test";
-// String j2eeApplicationName = "null";
J2eeContext j2eeContext = new J2eeContextImpl("test.domain", "testServer", "null", "org/apache/geronimo/j2ee/deployment/test", null, null);
ObjectName connectionTrackerName = new ObjectName("geronimo.connector:service=ConnectionTracker");
Modified: geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/RAR_1_5ConfigBuilderTest.java
==============================================================================
--- geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/RAR_1_5ConfigBuilderTest.java (original)
+++ geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/RAR_1_5ConfigBuilderTest.java Tue Nov 16 15:00:50 2004
@@ -22,9 +22,9 @@
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.ObjectInputStream;
+import java.net.URI;
import java.net.URL;
import java.net.URLClassLoader;
-import java.net.URI;
import java.sql.Connection;
import java.sql.Statement;
import java.util.ArrayList;
@@ -36,7 +36,6 @@
import javax.sql.DataSource;
import junit.framework.TestCase;
-import org.apache.geronimo.connector.ActivationSpecInfo;
import org.apache.geronimo.deployment.util.DeploymentUtil;
import org.apache.geronimo.gbean.GBeanData;
import org.apache.geronimo.gbean.GBeanInfo;
@@ -49,9 +48,6 @@
import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContextImpl;
import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
import org.apache.geronimo.j2ee.management.impl.J2EEServerImpl;
-import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContext;
-import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContextImpl;
-import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
import org.apache.geronimo.kernel.Kernel;
import org.apache.geronimo.kernel.management.State;
import org.apache.geronimo.system.serverinfo.ServerInfo;
@@ -192,7 +188,6 @@
GBeanMBean j2eeServerGBean = new GBeanMBean(J2EEServerImpl.GBEAN_INFO);
j2eeServerGBean.setReferencePatterns("ServerInfo", Collections.singleton(serverInfoObjectName));
ObjectName j2eeServerObjectName = NameFactory.getServerName(null, null, j2eeContext);
-// ObjectName.getInstance(j2eeDomainName + ":j2eeType=J2EEServer,name=" + j2eeServerName);
kernel.loadGBean(j2eeServerObjectName, j2eeServerGBean);
kernel.startGBean(j2eeServerObjectName);
assertRunning(kernel, j2eeServerObjectName);
@@ -206,19 +201,6 @@
kernel.startGBean(objectName);
//verify that activationSpecInfoMap is accessible and correct while ResourceAdapterGBean is stopped.
ObjectName resourceAdapterObjectName = NameFactory.getResourceComponentName(null, null, null, null, resourceAdapterName, NameFactory.JCA_RESOURCE_ADAPTER, j2eeContext);
-// new ObjectName(j2eeDomainName +
-// ":j2eeType=ResourceAdapter" +
-// ",name=testRA" +
-// ",J2EEServer=" + j2eeServerName +
-// ",J2EEApplication=" + j2eeApplicationName +
-// ",ResourceAdapterModule=" + j2eeModuleName);
- Map activationSpecInfoMap = (Map) kernel.getAttribute(resourceAdapterObjectName, "activationSpecInfoMap");
- assertEquals(1, activationSpecInfoMap.size());
- ActivationSpecInfo activationSpecInfo = (ActivationSpecInfo) activationSpecInfoMap.get("javax.jms.MessageListener");
- assertNotNull(activationSpecInfo);
- GBeanInfo activationSpecGBeanInfo = activationSpecInfo.getActivationSpecGBeanInfo();
- List attributes = activationSpecGBeanInfo.getPersistentAttributes();
- assertEquals(2, attributes.size());
//startRecursive can only be invoked if GBean is stopped.
kernel.stopGBean(objectName);
@@ -228,7 +210,6 @@
assertRunning(kernel, objectName);
ObjectName applicationObjectName = NameFactory.getApplicationName(null, null, null, j2eeContext);
-// ObjectName.getInstance(j2eeDomainName + ":j2eeType=J2EEApplication,name=" + j2eeApplicationName + ",J2EEServer=" + j2eeServerName);
if (!j2eeContext.getJ2eeApplicationName().equals("null")) {
assertRunning(kernel, applicationObjectName);
} else {
@@ -237,38 +218,47 @@
}
ObjectName moduleName = NameFactory.getModuleName(null, null, null, null, NameFactory.RESOURCE_ADAPTER_MODULE, j2eeContext);
-// ObjectName.getInstance(j2eeDomainName + ":j2eeType=ResourceAdapterModule,J2EEServer=" + j2eeServerName + ",J2EEApplication=" + j2eeApplicationName + ",name=" + j2eeModuleName);
assertRunning(kernel, moduleName);
+ Map activationSpecInfoMap = (Map) kernel.getAttribute(moduleName, "activationSpecInfoMap");
+ assertEquals(1, activationSpecInfoMap.size());
+ GBeanData activationSpecInfo = (GBeanData) activationSpecInfoMap.get("javax.jms.MessageListener");
+ assertNotNull(activationSpecInfo);
+ GBeanInfo activationSpecGBeanInfo = activationSpecInfo.getGBeanInfo();
+ List attributes1 = activationSpecGBeanInfo.getPersistentAttributes();
+ assertEquals(2, attributes1.size());
+
+ Map adminObjectInfoMap = (Map) kernel.getAttribute(moduleName, "adminObjectInfoMap");
+ assertEquals(1, adminObjectInfoMap.size());
+ GBeanData adminObjectInfo = (GBeanData) adminObjectInfoMap.get("org.apache.geronimo.connector.mock.MockAdminObject");
+ assertNotNull(adminObjectInfo);
+ GBeanInfo adminObjectGBeanInfo = adminObjectInfo.getGBeanInfo();
+ List attributes2 = adminObjectGBeanInfo.getPersistentAttributes();
+ assertEquals(3, attributes2.size());
+
+ Map managedConnectionFactoryInfoMap = (Map) kernel.getAttribute(moduleName, "managedConnectionFactoryInfoMap");
+ assertEquals(2, managedConnectionFactoryInfoMap.size());
+ GBeanData managedConnectionFactoryInfo = (GBeanData) managedConnectionFactoryInfoMap.get("javax.resource.cci.ConnectionFactory");
+ assertNotNull(managedConnectionFactoryInfo);
+ GBeanInfo managedConnectionFactoryGBeanInfo = managedConnectionFactoryInfo.getGBeanInfo();
+ List attributes3 = managedConnectionFactoryGBeanInfo.getPersistentAttributes();
+ assertEquals(11, attributes3.size());
- // ResourceAdapter
+ // ResourceAdapter
assertRunning(kernel, resourceAdapterObjectName);
assertAttributeValue(kernel, resourceAdapterObjectName, "RAStringProperty", "NewStringValue");
// FirstTestOutboundConnectionFactory
ObjectName firstConnectionManagerFactory = NameFactory.getResourceComponentName(null, null, null, null, "FirstTestOutboundConnectionFactory", NameFactory.JCA_CONNECTION_MANAGER, j2eeContext);
-// new ObjectName(j2eeDomainName +
-// ":j2eeType=ConnectionManager" +
-// ",J2EEServer=" + j2eeServerName +
-// ",name=FirstTestOutboundConnectionFactory");
assertRunning(kernel, firstConnectionManagerFactory);
ObjectName firstOutCF = NameFactory.getResourceComponentName(null, null, null, null, "FirstTestOutboundConnectionFactory", NameFactory.JCA_CONNECTION_FACTORY, j2eeContext);
-// new ObjectName(j2eeDomainName +
-// ":j2eeType=JCAConnectionFactory" +
-// ",J2EEServer=" + j2eeServerName +
-// ",JCAResource=" + resourceAdapterName +
-// ",name=FirstTestOutboundConnectionFactory");
assertRunning(kernel, firstOutCF);
ObjectName firstOutSecurity = new ObjectName("geronimo.security:service=Realm,type=PasswordCredential,name=FirstTestOutboundConnectionFactory");
assertRunning(kernel, firstOutSecurity);
ObjectName firstOutMCF = NameFactory.getResourceComponentName(null, null, null, null, "FirstTestOutboundConnectionFactory", NameFactory.JCA_MANAGED_CONNECTION_FACTORY, j2eeContext);
-// new ObjectName(j2eeDomainName +
-// ":j2eeType=JCAManagedConnectionFactory" +
-// ",J2EEServer=" + j2eeServerName +
-// ",name=FirstTestOutboundConnectionFactory");
assertRunning(kernel, firstOutMCF);
assertAttributeValue(kernel, firstOutMCF, "OutboundStringProperty1", "newvalue1");
assertAttributeValue(kernel, firstOutMCF, "OutboundStringProperty2", "originalvalue2");
@@ -276,50 +266,24 @@
// SecondTestOutboundConnectionFactory
ObjectName secondConnectionManagerFactory = NameFactory.getResourceComponentName(null, null, null, null, "SecondTestOutboundConnectionFactory", NameFactory.JCA_CONNECTION_MANAGER, j2eeContext);
-//new ObjectName(j2eeDomainName +
-// ":j2eeType=ConnectionManager" +
-// ",J2EEServer=" + j2eeServerName +
-// ",name=SecondTestOutboundConnectionFactory");
assertRunning(kernel, secondConnectionManagerFactory);
ObjectName secondOutCF = NameFactory.getResourceComponentName(null, null, null, null, "SecondTestOutboundConnectionFactory", NameFactory.JCA_CONNECTION_FACTORY, j2eeContext);
-// new ObjectName(j2eeDomainName +
-// ":j2eeType=JCAConnectionFactory" +
-// ",J2EEServer=" + j2eeServerName +
-// ",JCAResource=" + resourceAdapterName +
-// ",name=SecondTestOutboundConnectionFactory");
assertRunning(kernel, secondOutCF);
ObjectName secondOutMCF = NameFactory.getResourceComponentName(null, null, null, null, "SecondTestOutboundConnectionFactory", NameFactory.JCA_MANAGED_CONNECTION_FACTORY, j2eeContext);
-// new ObjectName(j2eeDomainName +
-// ":j2eeType=JCAManagedConnectionFactory" +
-// ",J2EEServer=" + j2eeServerName +
-// ",name=SecondTestOutboundConnectionFactory");
assertRunning(kernel, secondOutMCF);
// ThirdTestOutboundConnectionFactory
ObjectName thirdConnectionManagerFactory = NameFactory.getResourceComponentName(null, null, null, null, "ThirdTestOutboundConnectionFactory", NameFactory.JCA_CONNECTION_MANAGER, j2eeContext);
-// new ObjectName(j2eeDomainName +
-// ":j2eeType=ConnectionManager" +
-// ",J2EEServer=" + j2eeServerName +
-// ",name=ThirdTestOutboundConnectionFactory");
assertRunning(kernel, thirdConnectionManagerFactory);
ObjectName thirdOutCF = NameFactory.getResourceComponentName(null, null, null, null, "ThirdTestOutboundConnectionFactory", NameFactory.JCA_CONNECTION_FACTORY, j2eeContext);
-// new ObjectName(j2eeDomainName +
-// ":j2eeType=JCAConnectionFactory" +
-// ",J2EEServer=" + j2eeServerName +
-// ",JCAResource=" + resourceAdapterName +
-// ",name=ThirdTestOutboundConnectionFactory");
assertRunning(kernel, thirdOutCF);
ObjectName thirdOutMCF = NameFactory.getResourceComponentName(null, null, null, null, "ThirdTestOutboundConnectionFactory", NameFactory.JCA_MANAGED_CONNECTION_FACTORY, j2eeContext);
-// new ObjectName(j2eeDomainName +
-// ":j2eeType=JCAManagedConnectionFactory" +
-// ",J2EEServer=" + j2eeServerName +
-// ",name=ThirdTestOutboundConnectionFactory");
assertRunning(kernel, thirdOutMCF);
//
@@ -327,17 +291,9 @@
//
ObjectName tweedledeeAdminObject = NameFactory.getResourceComponentName(null, null, null, null, "tweedledee", NameFactory.JCA_ADMIN_OBJECT, j2eeContext);
-// new ObjectName(j2eeDomainName +
-// ":j2eeType=JCAAdminObject" +
-// ",J2EEServer=" + j2eeServerName +
-// ",name=tweedledee");
assertRunning(kernel, tweedledeeAdminObject);
ObjectName tweedledumAdminObject = NameFactory.getResourceComponentName(null, null, null, null, "tweedledum", NameFactory.JCA_ADMIN_OBJECT, j2eeContext);
-// new ObjectName(j2eeDomainName +
-// ":j2eeType=JCAAdminObject" +
-// ",J2EEServer=" + j2eeServerName +
-// ",name=tweedledum");
assertRunning(kernel, tweedledumAdminObject);
Modified: geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/ActivationSpecWrapper.java
==============================================================================
--- geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/ActivationSpecWrapper.java (original)
+++ geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/ActivationSpecWrapper.java Tue Nov 16 15:00:50 2004
@@ -38,12 +38,9 @@
* is unclear if this is required by the spec.
*
* @version $Rev$ $Date$
- *
- * */
+ */
public class ActivationSpecWrapper implements ResourceManager, DynamicGBean {
- private final Class activationSpecClass;
-
private final DynamicGBeanDelegate delegate;
private final ActivationSpec activationSpec;
@@ -54,7 +51,6 @@
* Default constructor required when a class is used as a GBean Endpoint.
*/
public ActivationSpecWrapper() {
- activationSpecClass = null;
activationSpec = null;
delegate = null;
containerId = null;
@@ -68,11 +64,12 @@
* @throws IllegalAccessException
* @throws InstantiationException
*/
- public ActivationSpecWrapper(final Class activationSpecClass,
+ public ActivationSpecWrapper(final String activationSpecClass,
final String containerId,
- final ResourceAdapterWrapper resourceAdapterWrapper) throws IllegalAccessException, InstantiationException {
- this.activationSpecClass = activationSpecClass;
- activationSpec = (ActivationSpec) activationSpecClass.newInstance();
+ final ResourceAdapterWrapper resourceAdapterWrapper,
+ final ClassLoader cl) throws IllegalAccessException, InstantiationException, ClassNotFoundException {
+ Class clazz = cl.loadClass(activationSpecClass);
+ activationSpec = (ActivationSpec) clazz.newInstance();
delegate = new DynamicGBeanDelegate();
delegate.addAll(activationSpec);
this.containerId = containerId;
@@ -81,11 +78,12 @@
/**
* Returns class of wrapped ActivationSpec.
+ *
* @return class of wrapped ActivationSpec
*/
- public Class getActivationSpecClass() {
- return activationSpecClass;
- }
+// public String getActivationSpecClass() {
+// return activationSpecClass;
+// }
public String getContainerId() {
return containerId;
@@ -99,6 +97,7 @@
/**
* Delegating DynamicGBean getAttribute method.
+ *
* @param name of attribute.
* @return attribute value.
* @throws Exception
@@ -109,7 +108,8 @@
/**
* Delegating DynamicGBean setAttribute method.
- * @param name of attribute.
+ *
+ * @param name of attribute.
* @param value of attribute to be set.
* @throws Exception
*/
@@ -119,6 +119,7 @@
/**
* no-op DynamicGBean method
+ *
* @param name
* @param arguments
* @param types
@@ -173,23 +174,25 @@
public static final GBeanInfo GBEAN_INFO;
static {
- GBeanInfoBuilder infoFactory = new GBeanInfoBuilder(ActivationSpecWrapper.class);
- infoFactory.addAttribute("activationSpecClass", Class.class, true);
- infoFactory.addAttribute("containerId", String.class, true);
+ GBeanInfoBuilder infoBuilder = new GBeanInfoBuilder(ActivationSpecWrapper.class);
+ infoBuilder.addAttribute("activationSpecClass", String.class, true);
+ infoBuilder.addAttribute("containerId", String.class, true);
+ infoBuilder.addAttribute("classLoader", ClassLoader.class, false);
- infoFactory.addReference("ResourceAdapterWrapper", ResourceAdapterWrapper.class);
+ infoBuilder.addReference("ResourceAdapterWrapper", ResourceAdapterWrapper.class);
- infoFactory.addOperation("activate", new Class[] {MessageEndpointFactory.class});
- infoFactory.addOperation("deactivate", new Class[] {MessageEndpointFactory.class});
+ infoBuilder.addOperation("activate", new Class[]{MessageEndpointFactory.class});
+ infoBuilder.addOperation("deactivate", new Class[]{MessageEndpointFactory.class});
- infoFactory.addInterface(ResourceManager.class);
+ infoBuilder.addInterface(ResourceManager.class);
- infoFactory.setConstructor(new String[]{
+ infoBuilder.setConstructor(new String[]{
"activationSpecClass",
"containerId",
- "ResourceAdapterWrapper"});
+ "ResourceAdapterWrapper",
+ "classLoader"});
- GBEAN_INFO = infoFactory.getBeanInfo();
+ GBEAN_INFO = infoBuilder.getBeanInfo();
}
public static GBeanInfo getGBeanInfo() {
Modified: geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/AdminObjectWrapper.java
==============================================================================
--- geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/AdminObjectWrapper.java (original)
+++ geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/AdminObjectWrapper.java Tue Nov 16 15:00:50 2004
@@ -30,8 +30,8 @@
*/
public class AdminObjectWrapper implements DynamicGBean {
- private final Class adminObjectInterface;
- private final Class adminObjectClass;
+ private final String adminObjectInterface;
+ private final String adminObjectClass;
private final DynamicGBeanDelegate delegate;
private final Object adminObject;
@@ -54,16 +54,18 @@
* @throws IllegalAccessException
* @throws InstantiationException
*/
- public AdminObjectWrapper(final Class adminObjectInterface,
- final Class adminObjectClass) throws IllegalAccessException, InstantiationException {
+ public AdminObjectWrapper(final String adminObjectInterface,
+ final String adminObjectClass,
+ final ClassLoader cl) throws IllegalAccessException, InstantiationException, ClassNotFoundException {
this.adminObjectInterface = adminObjectInterface;
this.adminObjectClass = adminObjectClass;
- adminObject = adminObjectClass.newInstance();
+ Class clazz = cl.loadClass(adminObjectClass);
+ adminObject = clazz.newInstance();
delegate = new DynamicGBeanDelegate();
delegate.addAll(adminObject);
}
- public Class getAdminObjectInterface() {
+ public String getAdminObjectInterface() {
return adminObjectInterface;
}
@@ -71,7 +73,7 @@
* Returns class of wrapped AdminObject.
* @return class of wrapped AdminObject
*/
- public Class getAdminObjectClass() {
+ public String getAdminObjectClass() {
return adminObjectClass;
}
@@ -122,18 +124,20 @@
public static final GBeanInfo GBEAN_INFO;
static {
- GBeanInfoBuilder infoFactory = new GBeanInfoBuilder(AdminObjectWrapper.class);
- infoFactory.addAttribute("adminObjectInterface", Class.class, true);
- infoFactory.addAttribute("adminObjectClass", Class.class, true);
+ GBeanInfoBuilder infoBuilder = new GBeanInfoBuilder(AdminObjectWrapper.class);
+ infoBuilder.addAttribute("adminObjectInterface", String.class, true);
+ infoBuilder.addAttribute("adminObjectClass", String.class, true);
+ infoBuilder.addAttribute("classLoader", ClassLoader.class, false);
- infoFactory.addOperation("$getResource");
+ infoBuilder.addOperation("$getResource");
- infoFactory.setConstructor(new String[]{
+ infoBuilder.setConstructor(new String[]{
"adminObjectInterface",
"adminObjectClass",
+ "classLoader"
});
- GBEAN_INFO = infoFactory.getBeanInfo();
+ GBEAN_INFO = infoBuilder.getBeanInfo();
}
public static GBeanInfo getGBeanInfo() {
Modified: geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/ResourceAdapterModuleImpl.java
==============================================================================
--- geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/ResourceAdapterModuleImpl.java (original)
+++ geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/ResourceAdapterModuleImpl.java Tue Nov 16 15:00:50 2004
@@ -17,11 +17,13 @@
package org.apache.geronimo.connector;
import java.util.Hashtable;
+import java.util.Map;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.GBeanData;
import org.apache.geronimo.j2ee.management.J2EEApplication;
import org.apache.geronimo.j2ee.management.J2EEServer;
import org.apache.geronimo.j2ee.management.impl.InvalidObjectNameException;
@@ -39,7 +41,20 @@
private final J2EEApplication application;
private final String deploymentDescriptor;
- public ResourceAdapterModuleImpl(Kernel kernel, String objectName, J2EEServer server, J2EEApplication application, String deploymentDescriptor) {
+ private final GBeanData resourceAdapterGBeanData;
+ private final Map activationSpecInfoMap;
+ private final Map adminObjectInfoMap;
+ private final Map managedConnectionFactoryInfoMap;
+
+ public ResourceAdapterModuleImpl(Kernel kernel,
+ String objectName,
+ J2EEServer server,
+ J2EEApplication application,
+ String deploymentDescriptor,
+ GBeanData resourceAdapterGBeanData,
+ Map activationSpecInfoMap,
+ Map adminObjectInfoMap,
+ Map managedConnectionFactoryInfoMap) {
ObjectName myObjectName = JMXUtil.getObjectName(objectName);
verifyObjectName(myObjectName);
@@ -54,6 +69,11 @@
this.server = server;
this.application = application;
this.deploymentDescriptor = deploymentDescriptor;
+
+ this.resourceAdapterGBeanData = resourceAdapterGBeanData;
+ this.activationSpecInfoMap = activationSpecInfoMap;
+ this.adminObjectInfoMap = adminObjectInfoMap;
+ this.managedConnectionFactoryInfoMap = managedConnectionFactoryInfoMap;
}
public String getDeploymentDescriptor() {
@@ -79,6 +99,22 @@
return Util.getObjectNames(kernel, baseName, new String[]{"ResourceAdapter"});
}
+ public GBeanData getResourceAdapterGBeanData() {
+ return resourceAdapterGBeanData;
+ }
+
+ public Map getActivationSpecInfoMap() {
+ return activationSpecInfoMap;
+ }
+
+ public Map getAdminObjectInfoMap() {
+ return adminObjectInfoMap;
+ }
+
+ public Map getManagedConnectionFactoryInfoMap() {
+ return managedConnectionFactoryInfoMap;
+ }
+
/**
* ObjectName must match this pattern:
* <p/>
@@ -109,27 +145,37 @@
public static final GBeanInfo GBEAN_INFO;
static {
- GBeanInfoBuilder infoFactory = new GBeanInfoBuilder(ResourceAdapterModuleImpl.class);
- infoFactory.addReference("J2EEServer", J2EEServer.class);
- infoFactory.addReference("J2EEApplication", J2EEApplication.class);
-
- infoFactory.addAttribute("deploymentDescriptor", String.class, true);
-
- infoFactory.addAttribute("kernel", Kernel.class, false);
- infoFactory.addAttribute("objectName", String.class, false);
- infoFactory.addAttribute("server", String.class, false);
- infoFactory.addAttribute("application", String.class, false);
- infoFactory.addAttribute("javaVMs", String[].class, false);
- infoFactory.addAttribute("resourceAdapters", String[].class, false);
+ GBeanInfoBuilder infoBuilder = new GBeanInfoBuilder(ResourceAdapterModuleImpl.class);
+ infoBuilder.addReference("J2EEServer", J2EEServer.class);
+ infoBuilder.addReference("J2EEApplication", J2EEApplication.class);
+
+ infoBuilder.addAttribute("deploymentDescriptor", String.class, true);
+
+ infoBuilder.addAttribute("kernel", Kernel.class, false);
+ infoBuilder.addAttribute("objectName", String.class, false);
+ infoBuilder.addAttribute("server", String.class, false);
+ infoBuilder.addAttribute("application", String.class, false);
+ infoBuilder.addAttribute("javaVMs", String[].class, false);
+ infoBuilder.addAttribute("resourceAdapters", String[].class, false);
+
+ infoBuilder.addAttribute("resourceAdapterGBeanData", GBeanData.class, true);
+ infoBuilder.addAttribute("activationSpecInfoMap", Map.class, true);
+ infoBuilder.addAttribute("adminObjectInfoMap", Map.class, true);
+ infoBuilder.addAttribute("managedConnectionFactoryInfoMap", Map.class, true);
- infoFactory.setConstructor(new String[]{
+ infoBuilder.setConstructor(new String[]{
"kernel",
"objectName",
"J2EEServer",
"J2EEApplication",
- "deploymentDescriptor"});
+ "deploymentDescriptor",
+ "resourceAdapterGBeanData",
+ "activationSpecInfoMap",
+ "adminObjectInfoMap",
+ "managedConnectionFactoryInfoMap"
+ });
- GBEAN_INFO = infoFactory.getBeanInfo();
+ GBEAN_INFO = infoBuilder.getBeanInfo();
}
public static GBeanInfo getGBeanInfo() {
Modified: geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/ResourceAdapterWrapper.java
==============================================================================
--- geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/ResourceAdapterWrapper.java (original)
+++ geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/ResourceAdapterWrapper.java Tue Nov 16 15:00:50 2004
@@ -46,7 +46,7 @@
public static final GBeanInfo GBEAN_INFO;
- private final Class resourceAdapterClass;
+ private final String resourceAdapterClass;
private final BootstrapContext bootstrapContext;
@@ -54,8 +54,6 @@
private final DynamicGBeanDelegate delegate;
- private final Map activationSpecInfoMap;
-
/**
* default constructor for enhancement proxy endpoint
*/
@@ -64,28 +62,23 @@
this.bootstrapContext = null;
this.resourceAdapter = null;
this.delegate = null;
- this.activationSpecInfoMap = null;
}
- public ResourceAdapterWrapper(final Class resourceAdapterClass,
- final Map activationSpecInfoMap,
- final GeronimoWorkManager workManager) throws InstantiationException, IllegalAccessException {
+ public ResourceAdapterWrapper(final String resourceAdapterClass,
+ final GeronimoWorkManager workManager,
+ ClassLoader cl) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
this.resourceAdapterClass = resourceAdapterClass;
this.bootstrapContext = new BootstrapContextImpl(workManager);
- this.activationSpecInfoMap = activationSpecInfoMap;
- resourceAdapter = (ResourceAdapter) resourceAdapterClass.newInstance();
+ Class clazz = cl.loadClass(resourceAdapterClass);
+ resourceAdapter = (ResourceAdapter) clazz.newInstance();
delegate = new DynamicGBeanDelegate();
delegate.addAll(resourceAdapter);
}
- public Class getResourceAdapterClass() {
+ public String getResourceAdapterClass() {
return resourceAdapterClass;
}
- public Map getActivationSpecInfoMap() {
- return activationSpecInfoMap;
- }
-
public void registerResourceAdapterAssociation(final ResourceAdapterAssociation resourceAdapterAssociation) throws ResourceException {
resourceAdapterAssociation.setResourceAdapter(resourceAdapter);
}
@@ -137,19 +130,19 @@
}
static {
- GBeanInfoBuilder infoFactory = new GBeanInfoBuilder(ResourceAdapterWrapper.class);
- infoFactory.addAttribute("resourceAdapterClass", Class.class, true);
- infoFactory.addAttribute("activationSpecInfoMap", Map.class, true);
+ GBeanInfoBuilder infoBuilder = new GBeanInfoBuilder(ResourceAdapterWrapper.class);
+ infoBuilder.addAttribute("resourceAdapterClass", String.class, true);
+ infoBuilder.addAttribute("classLoader", ClassLoader.class, false);
- infoFactory.addReference("WorkManager", GeronimoWorkManager.class);
+ infoBuilder.addReference("WorkManager", GeronimoWorkManager.class);
- infoFactory.addOperation("registerResourceAdapterAssociation", new Class[]{ResourceAdapterAssociation.class});
+ infoBuilder.addOperation("registerResourceAdapterAssociation", new Class[]{ResourceAdapterAssociation.class});
- infoFactory.addInterface(ResourceAdapter.class);
+ infoBuilder.addInterface(ResourceAdapter.class);
- infoFactory.setConstructor(new String[]{"resourceAdapterClass", "activationSpecInfoMap", "WorkManager"});
+ infoBuilder.setConstructor(new String[]{"resourceAdapterClass", "WorkManager", "classLoader"});
- GBEAN_INFO = infoFactory.getBeanInfo();
+ GBEAN_INFO = infoBuilder.getBeanInfo();
}
public static GBeanInfo getGBeanInfo() {
Modified: geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java
==============================================================================
--- geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java (original)
+++ geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java Tue Nov 16 15:00:50 2004
@@ -50,12 +50,12 @@
private static final GBeanInfo GBEAN_INFO;
private static final Log log = LogFactory.getLog(ManagedConnectionFactoryWrapper.class);
- private final Class managedConnectionFactoryClass;
- private final Class connectionFactoryInterface;
- private final Class[] implementedInterfaces;
- private final Class connectionFactoryImplClass;
- private final Class connectionInterface;
- private final Class connectionImplClass;
+ private final String managedConnectionFactoryClass;
+ private final String connectionFactoryInterface;
+ private final String[] implementedInterfaces;
+ private final String connectionFactoryImplClass;
+ private final String connectionInterface;
+ private final String connectionImplClass;
private final Class[] allImplementedInterfaces;
@@ -93,18 +93,19 @@
isProxyable = false;
}
- public ManagedConnectionFactoryWrapper(Class managedConnectionFactoryClass,
- Class connectionFactoryInterface,
- Class[] implementedInterfaces,
- Class connectionFactoryImplClass,
- Class connectionInterface,
- Class connectionImplClass,
- String globalJNDIName,
- ResourceAdapterWrapper resourceAdapterWrapper,
- ConnectionManagerFactory connectionManagerFactory,
- ManagedConnectionFactoryListener managedConnectionFactoryListener,
- Kernel kernel,
- String objectName) throws InstantiationException, IllegalAccessException {
+ public ManagedConnectionFactoryWrapper(String managedConnectionFactoryClass,
+ String connectionFactoryInterface,
+ String[] implementedInterfaces,
+ String connectionFactoryImplClass,
+ String connectionInterface,
+ String connectionImplClass,
+ String globalJNDIName,
+ ResourceAdapterWrapper resourceAdapterWrapper,
+ ConnectionManagerFactory connectionManagerFactory,
+ ManagedConnectionFactoryListener managedConnectionFactoryListener,
+ Kernel kernel,
+ String objectName,
+ ClassLoader cl) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
this.managedConnectionFactoryClass = managedConnectionFactoryClass;
this.connectionFactoryInterface = connectionFactoryInterface;
this.implementedInterfaces = implementedInterfaces;
@@ -113,11 +114,14 @@
this.connectionImplClass = connectionImplClass;
allImplementedInterfaces = new Class[1 + implementedInterfaces.length];
- allImplementedInterfaces[0]= connectionFactoryInterface;
- System.arraycopy(implementedInterfaces, 0, allImplementedInterfaces, 1, implementedInterfaces.length);
- boolean mightBeProxyable = true;
+ allImplementedInterfaces[0] = cl.loadClass(connectionFactoryInterface);
for (int i = 0; i < implementedInterfaces.length; i++) {
- Class implementedInterface = implementedInterfaces[i];
+ allImplementedInterfaces[i + 1] = cl.loadClass(implementedInterfaces[i]);
+
+ }
+ boolean mightBeProxyable = true;
+ for (int i = 0; i < allImplementedInterfaces.length; i++) {
+ Class implementedInterface = allImplementedInterfaces[i];
if (!implementedInterface.isInterface()) {
mightBeProxyable = false;
break;
@@ -130,7 +134,8 @@
this.connectionManagerFactory = connectionManagerFactory;
//set up that must be done before start
- managedConnectionFactory = (ManagedConnectionFactory) managedConnectionFactoryClass.newInstance();
+ Class clazz = cl.loadClass(managedConnectionFactoryClass);
+ managedConnectionFactory = (ManagedConnectionFactory) clazz.newInstance();
delegate = new DynamicGBeanDelegate();
delegate.addAll(managedConnectionFactory);
this.managedConnectionFactoryListener = managedConnectionFactoryListener;
@@ -139,27 +144,27 @@
}
- public Class getManagedConnectionFactoryClass() {
+ public String getManagedConnectionFactoryClass() {
return managedConnectionFactoryClass;
}
- public Class getConnectionFactoryInterface() {
+ public String getConnectionFactoryInterface() {
return connectionFactoryInterface;
}
- public Class[] getImplementedInterfaces() {
+ public String[] getImplementedInterfaces() {
return implementedInterfaces;
}
- public Class getConnectionFactoryImplClass() {
+ public String getConnectionFactoryImplClass() {
return connectionFactoryImplClass;
}
- public Class getConnectionInterface() {
+ public String getConnectionInterface() {
return connectionInterface;
}
- public Class getConnectionImplClass() {
+ public String getConnectionImplClass() {
return connectionImplClass;
}
@@ -275,27 +280,28 @@
try {
return connectionManagerFactory.getRecoveryXAResource(managedConnectionFactory);
} catch (ResourceException e) {
- throw (SystemException)new SystemException("Could not obtain recovery XAResource for managedConnectionFactory " + objectName).initCause(e);
+ throw (SystemException) new SystemException("Could not obtain recovery XAResource for managedConnectionFactory " + objectName).initCause(e);
}
}
public void returnResource(NamedXAResource xaResource) {
- ((ConnectionManagerFactory.ReturnableXAResource)xaResource).returnConnection();
+ ((ConnectionManagerFactory.ReturnableXAResource) xaResource).returnConnection();
}
static {
GBeanInfoBuilder infoFactory = new GBeanInfoBuilder(ManagedConnectionFactoryWrapper.class);
- infoFactory.addAttribute("managedConnectionFactoryClass", Class.class, true);
- infoFactory.addAttribute("connectionFactoryInterface", Class.class, true);
- infoFactory.addAttribute("implementedInterfaces", Class[].class, true);
- infoFactory.addAttribute("connectionFactoryImplClass", Class.class, true);
- infoFactory.addAttribute("connectionInterface", Class.class, true);
- infoFactory.addAttribute("connectionImplClass", Class.class, true);
+ infoFactory.addAttribute("managedConnectionFactoryClass", String.class, true);
+ infoFactory.addAttribute("connectionFactoryInterface", String.class, true);
+ infoFactory.addAttribute("implementedInterfaces", String[].class, true);
+ infoFactory.addAttribute("connectionFactoryImplClass", String.class, true);
+ infoFactory.addAttribute("connectionInterface", String.class, true);
+ infoFactory.addAttribute("connectionImplClass", String.class, true);
infoFactory.addAttribute("globalJNDIName", String.class, true);
infoFactory.addAttribute("kernel", Kernel.class, false);
infoFactory.addAttribute("objectName", String.class, false);
+ infoFactory.addAttribute("classLoader", ClassLoader.class, false);
infoFactory.addOperation("$getResource");
infoFactory.addOperation("$getConnectionFactory");
@@ -318,7 +324,8 @@
"ConnectionManagerFactory",
"ManagedConnectionFactoryListener",
"kernel",
- "objectName"});
+ "objectName",
+ "classLoader"});
GBEAN_INFO = infoFactory.getBeanInfo();
}
Modified: geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/AdminObjectWrapperTest.java
==============================================================================
--- geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/AdminObjectWrapperTest.java (original)
+++ geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/AdminObjectWrapperTest.java Tue Nov 16 15:00:50 2004
@@ -109,8 +109,8 @@
selfName = NameFactory.getResourceComponentName(null, null, null, null, null, null, j2eeContext);
GBeanMBean aow = new GBeanMBean(AdminObjectWrapper.getGBeanInfo());
- aow.setAttribute("adminObjectInterface", MockAdminObject.class);
- aow.setAttribute("adminObjectClass", MockAdminObjectImpl.class);
+ aow.setAttribute("adminObjectInterface", MockAdminObject.class.getName());
+ aow.setAttribute("adminObjectClass", MockAdminObjectImpl.class.getName());
kernel.loadGBean(selfName, aow);
kernel.startGBean(selfName);
Modified: geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapperTest.java
==============================================================================
--- geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapperTest.java (original)
+++ geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapperTest.java Tue Nov 16 15:00:50 2004
@@ -159,12 +159,12 @@
managedConnectionFactoryName = NameFactory.getResourceComponentName(null, null, null, null, null, null, j2eeContext);
GBeanMBean mcfw = new GBeanMBean(ManagedConnectionFactoryWrapper.getGBeanInfo());
- mcfw.setAttribute("managedConnectionFactoryClass", MockManagedConnectionFactory.class);
- mcfw.setAttribute("connectionFactoryInterface", ConnectionFactory.class);
- mcfw.setAttribute("implementedInterfaces", new Class[] {Serializable.class, ConnectionFactoryExtension.class});
- mcfw.setAttribute("connectionFactoryImplClass", MockConnectionFactory.class);
- mcfw.setAttribute("connectionInterface", Connection.class);
- mcfw.setAttribute("connectionImplClass", MockConnection.class);
+ mcfw.setAttribute("managedConnectionFactoryClass", MockManagedConnectionFactory.class.getName());
+ mcfw.setAttribute("connectionFactoryInterface", ConnectionFactory.class.getName());
+ mcfw.setAttribute("implementedInterfaces", new String[] {Serializable.class.getName(), ConnectionFactoryExtension.class.getName()});
+ mcfw.setAttribute("connectionFactoryImplClass", MockConnectionFactory.class.getName());
+ mcfw.setAttribute("connectionInterface", Connection.class.getName());
+ mcfw.setAttribute("connectionImplClass", MockConnection.class.getName());
mcfw.setAttribute("globalJNDIName", GLOBAL_NAME);
//"ResourceAdapterWrapper",
mcfw.setReferencePatterns("ConnectionManagerFactory", Collections.singleton(cmfName));
Modified: 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/RefContext.java (original)
+++ geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/RefContext.java Tue Nov 16 15:00:50 2004
@@ -28,6 +28,7 @@
import org.apache.geronimo.deployment.DeploymentException;
import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContext;
import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.gbean.GBeanData;
/**
* @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $
@@ -45,7 +46,8 @@
private final Map connectionFactoryIndex;
private final Map adminObjectIndex;
- private final Map activationSpecInfos;
+ private final Map resourceModuleDataMap;
+
public RefContext(EJBReferenceBuilder ejbReferenceBuilder, ResourceReferenceBuilder resourceReferenceBuilder) {
assert ejbReferenceBuilder != null: "ejbReferenceBuilder is null";
@@ -57,7 +59,7 @@
resourceAdapterIndex = new HashMap();
connectionFactoryIndex = new HashMap();
adminObjectIndex = new HashMap();
- activationSpecInfos = new HashMap();
+ resourceModuleDataMap = new HashMap();
this.ejbReferenceBuilder = ejbReferenceBuilder;
this.resourceReferenceBuilder = resourceReferenceBuilder;
}
@@ -79,7 +81,7 @@
resourceAdapterIndex = new HashMap();
this.connectionFactoryIndex = new HashMap();
this.adminObjectIndex = new HashMap();
- this.activationSpecInfos = new HashMap();
+ this.resourceModuleDataMap = new HashMap();
}
public EJBReferenceBuilder getEjbReferenceBuilder() {
@@ -348,19 +350,49 @@
//Resource adapter/activationspec support
- public void addActivationSpecInfos(ObjectName resourceAdapterName, Map activationSpecInfoMap) throws DeploymentException {
- Object old = activationSpecInfos.put(resourceAdapterName, activationSpecInfoMap);
+ public void addResourceAdapterModuleInfo(ObjectName resourceModuleName, GBeanData resourceModuleData) throws DeploymentException {
+ Object old = resourceModuleDataMap.put(resourceModuleName, resourceModuleData);
if (old != null) {
- throw new DeploymentException("Duplicate resource adapter name: " + resourceAdapterName);
+ throw new DeploymentException("Duplicate resource adapter module name: " + resourceModuleName);
+ }
+ }
+
+ 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) 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 Object getActivationSpecInfo(ObjectName resourceAdapterName, String messageListenerInterfaceName) throws DeploymentException {
- Map activationSpecInfoMap = (Map) activationSpecInfos.get(resourceAdapterName);
- if (activationSpecInfoMap != null) {
- return activationSpecInfoMap.get(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.locateActivationSpecInfo(resourceAdapterName, messageListenerInterfaceName);
+ 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);
+ }
+
+ public GBeanData getResourceAdapterModuleData(ObjectName resourceAdapterModuleName) {
+ return (GBeanData) resourceModuleDataMap.get(resourceAdapterModuleName);
+ }
}
Modified: geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/ResourceReferenceBuilder.java
==============================================================================
--- 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 Nov 16 15:00:50 2004
@@ -19,6 +19,7 @@
import javax.management.ObjectName;
import org.apache.geronimo.deployment.DeploymentException;
+import org.apache.geronimo.gbean.GBeanData;
/**
* @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $
@@ -31,6 +32,11 @@
ObjectName locateResourceName(ObjectName query) throws DeploymentException;
- Object locateActivationSpecInfo(ObjectName resourceAdapterName, String messageListenerInterface) throws DeploymentException;
+ GBeanData locateActivationSpecInfo(ObjectName resourceAdapterName, String messageListenerInterface) throws DeploymentException;
+ GBeanData locateResourceAdapterGBeanData(ObjectName resourceAdapterModuleName) throws DeploymentException;
+
+ GBeanData locateAdminObjectInfo(ObjectName resourceAdapterModuleName, String adminObjectInterfaceName) throws DeploymentException;
+
+ GBeanData locateConnectionFactoryInfo(ObjectName resourceAdapterModuleName, String connectionFactoryInterfaceName) throws DeploymentException;
}
Modified: 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/EJBRefContextTest.java (original)
+++ geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EJBRefContextTest.java Tue Nov 16 15:00:50 2004
@@ -22,6 +22,7 @@
import junit.framework.TestCase;
import org.apache.geronimo.deployment.DeploymentException;
+import org.apache.geronimo.gbean.GBeanData;
/**
* @version $Rev$ $Date$
@@ -175,7 +176,19 @@
return null;
}
- public Object locateActivationSpecInfo(ObjectName resourceAdapterName, String messageListenerInterface) throws DeploymentException {
+ public GBeanData locateActivationSpecInfo(ObjectName resourceAdapterName, String messageListenerInterface) throws DeploymentException {
+ return null;
+ }
+
+ public GBeanData locateResourceAdapterGBeanData(ObjectName resourceAdapterModuleName) throws DeploymentException {
+ return null;
+ }
+
+ public GBeanData locateAdminObjectInfo(ObjectName resourceAdapterModuleName, String adminObjectInterfaceName) throws DeploymentException {
+ return null;
+ }
+
+ public GBeanData locateConnectionFactoryInfo(ObjectName resourceAdapterModuleName, String connectionFactoryInterfaceName) throws DeploymentException {
return null;
}
});
Modified: geronimo/trunk/modules/j2ee-schema/src/conf/xmlconfig.xml
==============================================================================
--- geronimo/trunk/modules/j2ee-schema/src/conf/xmlconfig.xml (original)
+++ geronimo/trunk/modules/j2ee-schema/src/conf/xmlconfig.xml Tue Nov 16 15:00:50 2004
@@ -5,9 +5,9 @@
<xb:package>org.apache.geronimo.xbeans.j2ee</xb:package>
</xb:namespace>
- <xb:namespace uri="##local">
+ <!--xb:namespace uri="##local">
<xb:package>org.apache.geronimo.xbeans.j2ee.connector_1_0</xb:package>
<xb:suffix>10</xb:suffix>
- </xb:namespace>
+ </xb:namespace-->
</xb:config>
Modified: geronimo/trunk/modules/j2ee-schema/src/java/org/apache/geronimo/schema/SchemaConversionUtils.java
==============================================================================
--- geronimo/trunk/modules/j2ee-schema/src/java/org/apache/geronimo/schema/SchemaConversionUtils.java (original)
+++ geronimo/trunk/modules/j2ee-schema/src/java/org/apache/geronimo/schema/SchemaConversionUtils.java Tue Nov 16 15:00:50 2004
@@ -28,11 +28,13 @@
import org.apache.geronimo.xbeans.j2ee.EjbJarDocument;
import org.apache.geronimo.xbeans.j2ee.WebAppDocument;
import org.apache.geronimo.xbeans.j2ee.ApplicationClientDocument;
+import org.apache.geronimo.xbeans.j2ee.ConnectorDocument;
import org.apache.xmlbeans.XmlCursor;
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlOptions;
import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlDocumentProperties;
/**
* @version $Rev$ $Date$
@@ -41,10 +43,12 @@
static final String J2EE_NAMESPACE = "http://java.sun.com/xml/ns/j2ee";
static final String GERONIMO_NAMING_NAMESPACE = "http://geronimo.apache.org/xml/ns/naming";
-// static final String GERONIMO_NAMING_NAMESPACE_L0CATION = "http://geronimo.apache.org/xml/ns/naming_1_4.xsd";
- private static final QName TAGLIB = new QName(J2EE_NAMESPACE, "taglib");
private static final String GERONIMO_SECURITY_NAMESPACE = "http://geronimo.apache.org/xml/ns/security";
+ private static final QName RESOURCE_ADAPTER_VERSION = new QName(J2EE_NAMESPACE, "resourceadapter-version");
+ private static final QName OUTBOUND_RESOURCEADAPTER = new QName(J2EE_NAMESPACE, "outbound-resourceadapter");
+ private static final QName TAGLIB = new QName(J2EE_NAMESPACE, "taglib");
+
private SchemaConversionUtils() {
}
@@ -140,6 +144,77 @@
}
+ public static ConnectorDocument convertToConnectorSchema(XmlObject xmlObject) throws XmlException {
+ if (ConnectorDocument.type.equals(xmlObject.schemaType())) {
+ validateDD(xmlObject);
+ return (ConnectorDocument) xmlObject;
+ }
+ XmlCursor cursor = xmlObject.newCursor();
+ XmlDocumentProperties xmlDocumentProperties = cursor.documentProperties();
+ String publicId = xmlDocumentProperties.getDoctypePublicId();
+ try {
+ if ("-//Sun Microsystems, Inc.//DTD Connector 1.0//EN".equals(publicId)) {
+ XmlCursor moveable = xmlObject.newCursor();
+ try {
+ String schemaLocationURL = "http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd";
+ String version = "1.5";
+ convertToSchema(cursor, J2EE_NAMESPACE, schemaLocationURL, version);
+ cursor.toStartDoc();
+ cursor.toChild(J2EE_NAMESPACE, "connector");
+ cursor.toFirstChild();
+ convertToDescriptionGroup(cursor, moveable);
+ cursor.toNextSibling(J2EE_NAMESPACE, "spec-version");
+ cursor.removeXml();
+ cursor.toNextSibling(J2EE_NAMESPACE, "version");
+ cursor.setName(RESOURCE_ADAPTER_VERSION);
+ cursor.toNextSibling(J2EE_NAMESPACE, "resourceadapter");
+ moveable.toCursor(cursor);
+ cursor.toFirstChild();
+ cursor.beginElement("outbound-resourceadapter", J2EE_NAMESPACE);
+ cursor.beginElement("connection-definition", J2EE_NAMESPACE);
+ moveable.toChild(J2EE_NAMESPACE, "managedconnectionfactory-class");
+ moveable.push();
+ //from moveable to cursor
+ moveable.moveXml(cursor);
+ while (moveable.toNextSibling(J2EE_NAMESPACE, "config-property")) {
+ moveable.moveXml(cursor);
+ }
+ moveable.pop();
+ moveable.toNextSibling(J2EE_NAMESPACE, "connectionfactory-interface");
+ moveable.moveXml(cursor);
+ moveable.toNextSibling(J2EE_NAMESPACE, "connectionfactory-impl-class");
+ moveable.moveXml(cursor);
+ moveable.toNextSibling(J2EE_NAMESPACE, "connection-interface");
+ moveable.moveXml(cursor);
+ moveable.toNextSibling(J2EE_NAMESPACE, "connection-impl-class");
+ moveable.moveXml(cursor);
+ //get out of connection-definition element
+ cursor.toNextToken();
+ moveable.toNextSibling(J2EE_NAMESPACE, "transaction-support");
+ moveable.moveXml(cursor);
+ while (moveable.toNextSibling(J2EE_NAMESPACE, "authentication-mechanism")) {
+ moveable.moveXml(cursor);
+ }
+ moveable.toNextSibling(J2EE_NAMESPACE, "reauthentication-support");
+ moveable.moveXml(cursor);
+ } finally {
+ moveable.dispose();
+ }
+
+ }
+ } finally {
+ cursor.dispose();
+ }
+ XmlObject result = xmlObject.changeType(ConnectorDocument.type);
+ if (result != null) {
+ validateDD(result);
+ return (ConnectorDocument) result;
+ }
+ validateDD(xmlObject);
+ return (ConnectorDocument) xmlObject;
+
+ }
+
public static EjbJarDocument convertToEJBSchema(XmlObject xmlObject) throws XmlException {
if (EjbJarDocument.type.equals(xmlObject.schemaType())) {
validateDD(xmlObject);
@@ -228,53 +303,53 @@
}
public static XmlObject convertToGeronimoNamingSchema(XmlObject xmlObject) {
- XmlCursor cursor = xmlObject.newCursor();
- XmlCursor end = xmlObject.newCursor();
- String version = "1.0";
- try {
- while (cursor.hasNextToken()) {
- if (cursor.isStart()) {
- String localName = cursor.getName().getLocalPart();
- if (localName.equals("ejb-ref")
- || localName.equals("ejb-local-ref")
- || localName.equals("resource-ref")
- || localName.equals("resource-env-ref")
- || localName.equals("cmp-connection-factory")
- || localName.equals("resource-adapter")) {
- convertElementToSchema(cursor, end, GERONIMO_NAMING_NAMESPACE);
- }
- }
- cursor.toNextToken();
- }
- } finally {
- cursor.dispose();
- end.dispose();
- }
- return xmlObject;
- }
+ XmlCursor cursor = xmlObject.newCursor();
+ XmlCursor end = xmlObject.newCursor();
+ String version = "1.0";
+ try {
+ while (cursor.hasNextToken()) {
+ if (cursor.isStart()) {
+ String localName = cursor.getName().getLocalPart();
+ if (localName.equals("ejb-ref")
+ || localName.equals("ejb-local-ref")
+ || localName.equals("resource-ref")
+ || localName.equals("resource-env-ref")
+ || localName.equals("cmp-connection-factory")
+ || localName.equals("resource-adapter")) {
+ convertElementToSchema(cursor, end, GERONIMO_NAMING_NAMESPACE);
+ }
+ }
+ cursor.toNextToken();
+ }
+ } finally {
+ cursor.dispose();
+ end.dispose();
+ }
+ return xmlObject;
+ }
public static XmlObject convertToGeronimoSecuritySchema(XmlObject xmlObject) {
- XmlCursor cursor = xmlObject.newCursor();
- XmlCursor end = xmlObject.newCursor();
- String version = "1.0";
- try {
- while (cursor.hasNextToken()) {
- if (cursor.isStart()) {
- String localName = cursor.getName().getLocalPart();
- if (localName.equals("security")) {
- convertElementToSchema(cursor, end, GERONIMO_SECURITY_NAMESPACE);
- }
- }
- cursor.toNextToken();
- }
- } finally {
- cursor.dispose();
- end.dispose();
- }
- return xmlObject;
- }
+ XmlCursor cursor = xmlObject.newCursor();
+ XmlCursor end = xmlObject.newCursor();
+ String version = "1.0";
+ try {
+ while (cursor.hasNextToken()) {
+ if (cursor.isStart()) {
+ String localName = cursor.getName().getLocalPart();
+ if (localName.equals("security")) {
+ convertElementToSchema(cursor, end, GERONIMO_SECURITY_NAMESPACE);
+ }
+ }
+ cursor.toNextToken();
+ }
+ } finally {
+ cursor.dispose();
+ end.dispose();
+ }
+ return xmlObject;
+ }
- public static XmlObject getNestedObjectAsType(XmlObject xmlObject, String desiredElement, SchemaType type) {
+ public static XmlObject getNestedObjectAsType(XmlObject xmlObject, String desiredElement, SchemaType type) {
XmlCursor cursor = xmlObject.newCursor();
try {
while (cursor.hasNextToken()) {
@@ -298,6 +373,11 @@
public static boolean convertToSchema(XmlCursor cursor, String namespace, String schemaLocationURL, String version) {
+ //remove dtd
+ XmlDocumentProperties xmlDocumentProperties = cursor.documentProperties();
+ xmlDocumentProperties.remove(XmlDocumentProperties.DOCTYPE_NAME);
+ xmlDocumentProperties.remove(XmlDocumentProperties.DOCTYPE_PUBLIC_ID);
+ xmlDocumentProperties.remove(XmlDocumentProperties.DOCTYPE_SYSTEM_ID);
//convert namespace
boolean isFirstStart = true;
while (cursor.hasNextToken()) {
Added: geronimo/trunk/modules/j2ee-schema/src/test-data/j2ee_1_3dtd/ra-10.xml
==============================================================================
--- (empty file)
+++ geronimo/trunk/modules/j2ee-schema/src/test-data/j2ee_1_3dtd/ra-10.xml Tue Nov 16 15:00:50 2004
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+-->
+
+<!DOCTYPE connector PUBLIC "-//Sun Microsystems, Inc.//DTD Connector 1.0//EN"
+ "http://java.sun.com/dtd/connector_1_0.dtd">
+
+<connector>
+ <display-name>test 1.0 adapter spec</display-name>
+ <description>test ra.xml for jca 1.0</description>
+
+ <vendor-name>apache-geronimo</vendor-name>
+ <spec-version>1.0</spec-version>
+ <eis-type>test</eis-type>
+ <version>0.0</version>
+ <resourceadapter>
+ <managedconnectionfactory-class>org.apache.geronimo.connector.mock.MockManagedConnectionFactory</managedconnectionfactory-class>
+ <connectionfactory-interface>javax.resource.cci.ConnectionFactory</connectionfactory-interface>
+ <connectionfactory-impl-class>org.apache.geronimo.connector.mock.MockConnectionFactory</connectionfactory-impl-class>
+ <connection-interface>javax.resource.cci.Connection</connection-interface>
+ <connection-impl-class>org.apache.geronimo.connector.mock.MockConnection</connection-impl-class>
+ <transaction-support>XATransaction</transaction-support>
+ <config-property>
+ <config-property-name>OutboundStringProperty1</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ <config-property-value>originalvalue1</config-property-value>
+ </config-property>
+ <config-property>
+ <config-property-name>OutboundStringProperty2</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ <config-property-value>originalvalue2</config-property-value>
+ </config-property>
+ <config-property>
+ <config-property-name>OutboundStringProperty3</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ </config-property>
+ <config-property>
+ <config-property-name>OutboundStringProperty4</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ </config-property>
+
+ <authentication-mechanism>
+ <description>description</description>
+ <authentication-mechanism-type>BasicPassword</authentication-mechanism-type>
+ <credential-interface>javax.resource.spi.security.PasswordCredential</credential-interface>
+ </authentication-mechanism>
+ <authentication-mechanism>
+ <description>description</description>
+ <authentication-mechanism-type>Kerbv5</authentication-mechanism-type>
+ <credential-interface>javax.resource.spi.security.GenericCredential</credential-interface>
+ </authentication-mechanism>
+ <reauthentication-support>false</reauthentication-support>
+ <security-permission>
+ <description>test security permission</description>
+ <security-permission-spec>org.apache.geronimo.TestSecurityPermission</security-permission-spec>
+ </security-permission>
+ </resourceadapter>
+</connector>
Added: geronimo/trunk/modules/j2ee-schema/src/test-data/j2ee_1_3dtd/ra-15.xml
==============================================================================
--- (empty file)
+++ geronimo/trunk/modules/j2ee-schema/src/test-data/j2ee_1_3dtd/ra-15.xml Tue Nov 16 15:00:50 2004
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+-->
+<connector xsi:schemaLocation="http://java.sun.com/xml/ns/j2eehttp://java.sun.com/xml/ns/j2ee/connector_1_5.xsd" version="1.5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/j2ee">
+ <description>test ra.xml for jca 1.0</description>
+ <display-name>test 1.0 adapter spec</display-name>
+ <vendor-name>apache-geronimo</vendor-name>
+ <eis-type>test</eis-type>
+ <resourceadapter-version>0.0</resourceadapter-version>
+ <resourceadapter>
+ <outbound-resourceadapter>
+ <connection-definition>
+ <managedconnectionfactory-class>org.apache.geronimo.connector.mock.MockManagedConnectionFactory</managedconnectionfactory-class>
+ <config-property>
+ <config-property-name>OutboundStringProperty1</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ <config-property-value>originalvalue1</config-property-value>
+ </config-property>
+ <config-property>
+ <config-property-name>OutboundStringProperty2</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ <config-property-value>originalvalue2</config-property-value>
+ </config-property>
+ <config-property>
+ <config-property-name>OutboundStringProperty3</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ </config-property>
+ <config-property>
+ <config-property-name>OutboundStringProperty4</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ </config-property>
+ <connectionfactory-interface>javax.resource.cci.ConnectionFactory</connectionfactory-interface>
+ <connectionfactory-impl-class>org.apache.geronimo.connector.mock.MockConnectionFactory</connectionfactory-impl-class>
+ <connection-interface>javax.resource.cci.Connection</connection-interface>
+ <connection-impl-class>org.apache.geronimo.connector.mock.MockConnection</connection-impl-class>
+ </connection-definition>
+ <transaction-support>XATransaction</transaction-support>
+ <authentication-mechanism>
+ <description>description</description>
+ <authentication-mechanism-type>BasicPassword</authentication-mechanism-type>
+ <credential-interface>javax.resource.spi.security.PasswordCredential</credential-interface>
+ </authentication-mechanism>
+ <authentication-mechanism>
+ <description>description</description>
+ <authentication-mechanism-type>Kerbv5</authentication-mechanism-type>
+ <credential-interface>javax.resource.spi.security.GenericCredential</credential-interface>
+ </authentication-mechanism>
+ <reauthentication-support>false</reauthentication-support>
+ </outbound-resourceadapter>
+ <security-permission>
+ <description>test security permission</description>
+ <security-permission-spec>org.apache.geronimo.TestSecurityPermission</security-permission-spec>
+ </security-permission>
+ </resourceadapter>
+</connector>
Modified: geronimo/trunk/modules/j2ee-schema/src/test/org/apache/geronimo/schema/SchemaConversionUtilsTest.java
==============================================================================
--- geronimo/trunk/modules/j2ee-schema/src/test/org/apache/geronimo/schema/SchemaConversionUtilsTest.java (original)
+++ geronimo/trunk/modules/j2ee-schema/src/test/org/apache/geronimo/schema/SchemaConversionUtilsTest.java Tue Nov 16 15:00:50 2004
@@ -55,6 +55,8 @@
//I've taken option (1) and fixed the schemas
+ //The schemas have been fixed by sun, we can use the official schemas.
+
public void testApplicationClient13ToApplicationClient14Transform() throws Exception {
File srcXml = new File(basedir, "src/test-data/j2ee_1_3dtd/application-client-13.xml");
File expectedOutputXml = new File(basedir, "src/test-data/j2ee_1_3dtd/application-client-14.xml");
@@ -109,6 +111,35 @@
assertTrue("Differences after reconverting to schema: " + problems, ok2);
//do the whole transform twice...
xmlObject = SchemaConversionUtils.convertToApplicationSchema(xmlObject);
+ boolean ok3 = compareXmlObjects(xmlObject, expected, problems);
+ assertTrue("Differences after reconverting to application schema: " + problems, ok3);
+ }
+
+ public void testConnector10ToConnector15Transform() throws Exception {
+ File srcXml = new File(basedir, "src/test-data/j2ee_1_3dtd/ra-10.xml");
+ File expectedOutputXml = new File(basedir, "src/test-data/j2ee_1_3dtd/ra-15.xml");
+ XmlObject xmlObject = XmlObject.Factory.parse(srcXml);
+ XmlObject expected = XmlObject.Factory.parse(expectedOutputXml);
+ SchemaConversionUtils.validateDD(expected);
+ xmlObject = SchemaConversionUtils.convertToConnectorSchema(xmlObject);
+// System.out.println(xmlObject.toString());
+// System.out.println(expected.toString());
+ List problems = new ArrayList();
+ boolean ok = compareXmlObjects(xmlObject, expected, problems);
+ assertTrue("Differences: " + problems, ok);
+ //make sure trying to convert twice has no bad effects
+ XmlCursor cursor2 = xmlObject.newCursor();
+ try {
+ String schemaLocationURL = "http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd";
+ String version = "1.4";
+ assertFalse(SchemaConversionUtils.convertToSchema(cursor2, SchemaConversionUtils.J2EE_NAMESPACE, schemaLocationURL, version));
+ } finally {
+ cursor2.dispose();
+ }
+ boolean ok2 = compareXmlObjects(xmlObject, expected, problems);
+ assertTrue("Differences after reconverting to schema: " + problems, ok2);
+ //do the whole transform twice...
+ xmlObject = SchemaConversionUtils.convertToConnectorSchema(xmlObject);
boolean ok3 = compareXmlObjects(xmlObject, expected, problems);
assertTrue("Differences after reconverting to application schema: " + problems, ok3);
}
Modified: geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/j2eeobjectnames/NameFactory.java
==============================================================================
--- geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/j2eeobjectnames/NameFactory.java (original)
+++ geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/j2eeobjectnames/NameFactory.java Tue Nov 16 15:00:50 2004
@@ -98,7 +98,7 @@
public static ObjectName getModuleName(String j2eeDomainName, String j2eeServerName, String j2eeApplicationName, String j2eeModuleName, String j2eeType, J2eeContext context) throws MalformedObjectNameException {
Properties props = new Properties();
- props.put(J2EE_TYPE, j2eeType);
+ props.put(J2EE_TYPE, context.getJ2eeType(j2eeType));
props.put(J2EE_SERVER, context.getJ2eeServerName(j2eeServerName));
props.put(J2EE_APPLICATION, context.getJ2eeApplicationName(j2eeApplicationName));
props.put(J2EE_NAME, context.getJ2eeModuleName(j2eeModuleName));