djencks 2003/11/18 16:33:59
Modified:
modules/core/src/java/org/apache/geronimo/deployment/model/geronimo/ejb
MessageDriven.java
modules/core/src/java/org/apache/geronimo/xml/deployment
EjbJarLoader.java GeronimoEjbJarLoader.java
GeronimoEjbJarStorer.java
modules/core/src/schema geronimo-ejb-jar.xsd
modules/core/src/test/org/apache/geronimo/xml/deployment
GeronimoEjbJarLoaderTest.java
modules/core/src/test-data/xml/deployment
simple-geronimo-ejb-jar.xml
Added:
modules/core/src/java/org/apache/geronimo/deployment/model/geronimo/ejb
ActivationConfig.java
Log:
Add some geronimo specific mdb deployment info, with tests
Revision Changes Path
1.4 +8 -1
incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/model/geronimo/ejb/MessageDriven.java
Index: MessageDriven.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/model/geronimo/ejb/MessageDriven.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- MessageDriven.java 29 Sep 2003 14:17:22 -0000 1.3
+++ MessageDriven.java 19 Nov 2003 00:33:59 -0000 1.4
@@ -69,6 +69,7 @@
* @version $Revision$ $Date$
*/
public class MessageDriven extends
org.apache.geronimo.deployment.model.ejb.MessageDriven implements
JNDIEnvironmentRefs {
+
public MessageDriven() {
super.setEJBRef(new EjbRef[0]);
super.setEJBLocalRef(new EjbLocalRef[0]);
@@ -233,4 +234,10 @@
public void setGeronimoServiceRef(int i, ServiceRef ref) {
super.setServiceRef(i, ref);
}
+
+ //no setter needed.
+ public ActivationConfig getGeronimoActivationConfig() {
+ return (ActivationConfig) super.getActivationConfig();
+ }
+
}
1.1
incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/model/geronimo/ejb/ActivationConfig.java
Index: ActivationConfig.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Geronimo" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Geronimo", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
package org.apache.geronimo.deployment.model.geronimo.ejb;
/**
*
*
* @version $Revision: 1.1 $ $Date: 2003/11/19 00:33:59 $
*
* */
public class ActivationConfig extends
org.apache.geronimo.deployment.model.ejb.ActivationConfig {
private String activationSpecClass;
private String resourceAdapterName;
public ActivationConfig() {
}
public String getActivationSpecClass() {
return activationSpecClass;
}
public void setActivationSpecClass(String activationSpecClass) {
this.activationSpecClass = activationSpecClass;
}
public String getResourceAdapterName() {
return resourceAdapterName;
}
public void setResourceAdapterName(String resourceAdapterName) {
this.resourceAdapterName = resourceAdapterName;
}
}
1.12 +7 -8
incubator-geronimo/modules/core/src/java/org/apache/geronimo/xml/deployment/EjbJarLoader.java
Index: EjbJarLoader.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/xml/deployment/EjbJarLoader.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- EjbJarLoader.java 18 Nov 2003 02:14:19 -0000 1.11
+++ EjbJarLoader.java 19 Nov 2003 00:33:59 -0000 1.12
@@ -248,17 +248,16 @@
mdbs[i].setMessageDestinationType(LoaderUtil.getChildContent(root,
"message-destination-type"));
mdbs[i].setMessagingType(LoaderUtil.getChildContent(root,
"messaging-type"));
mdbs[i].setTransactionType(LoaderUtil.getChildContent(root,
"transaction-type"));
- mdbs[i].setActivationConfig(loadActivationConfig(root));
+
mdbs[i].setActivationConfig(loadActivationConfig(LoaderUtil.getChild(root,
"activation-config"), new ActivationConfig()));
}
return mdbs;
}
- static ActivationConfig loadActivationConfig(Element parent) {
+ static ActivationConfig loadActivationConfig(Element parent,
ActivationConfig activationConfig) {
if(parent == null) {
- return null;
+ return null;//???
}
- ActivationConfig config = new ActivationConfig();
- J2EELoader.loadDescribable(parent, config);
+ J2EELoader.loadDescribable(parent, activationConfig);
Element[] roots = LoaderUtil.getChildren(parent,
"activation-config-property");
ActivationConfigProperty[] props = new
ActivationConfigProperty[roots.length];
for(int i = 0; i < roots.length; i++) {
@@ -267,8 +266,8 @@
props[i].setActivationConfigPropertyName(LoaderUtil.getChildContent(root,
"activation-config-property-name"));
props[i].setActivationConfigPropertyValue(LoaderUtil.getChildContent(root,
"activation-config-property-value"));
}
- config.setActivationConfigProperty(props);
- return config;
+ activationConfig.setActivationConfigProperty(props);
+ return activationConfig;
}
private static Session[] loadSessions(Element ebe) {
1.12 +11 -2
incubator-geronimo/modules/core/src/java/org/apache/geronimo/xml/deployment/GeronimoEjbJarLoader.java
Index: GeronimoEjbJarLoader.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/xml/deployment/GeronimoEjbJarLoader.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- GeronimoEjbJarLoader.java 18 Nov 2003 22:22:28 -0000 1.11
+++ GeronimoEjbJarLoader.java 19 Nov 2003 00:33:59 -0000 1.12
@@ -65,6 +65,7 @@
import org.apache.geronimo.deployment.model.geronimo.ejb.Session;
import org.apache.geronimo.deployment.model.geronimo.ejb.Query;
import org.apache.geronimo.deployment.model.geronimo.ejb.Binding;
+import org.apache.geronimo.deployment.model.geronimo.ejb.ActivationConfig;
import org.apache.geronimo.deployment.model.ejb.Ejb;
import org.apache.geronimo.deployment.model.ejb.Relationships;
import org.apache.geronimo.deployment.model.ejb.AssemblyDescriptor;
@@ -129,9 +130,17 @@
mdbs[i].setMessageDestinationType(LoaderUtil.getChildContent(root,
"message-destination-type"));
mdbs[i].setMessagingType(LoaderUtil.getChildContent(root,
"messaging-type"));
mdbs[i].setTransactionType(LoaderUtil.getChildContent(root,
"transaction-type"));
-
mdbs[i].setActivationConfig(EjbJarLoader.loadActivationConfig(root));
+
mdbs[i].setActivationConfig(loadActivationConfig(LoaderUtil.getChild(root,
"activation-config")));
}
return mdbs;
+ }
+
+ private static ActivationConfig loadActivationConfig(Element root) {
+ ActivationConfig activationConfig = new ActivationConfig();
+ EjbJarLoader.loadActivationConfig(root, activationConfig);
+
activationConfig.setActivationSpecClass(LoaderUtil.getChildContent(root,
"activation-spec-class"));
+
activationConfig.setResourceAdapterName(LoaderUtil.getChildContent(root,
"resource-adapter-name"));
+ return activationConfig;
}
private static Session[] loadSessions(Element ebe) {
1.5 +26 -17
incubator-geronimo/modules/core/src/java/org/apache/geronimo/xml/deployment/GeronimoEjbJarStorer.java
Index: GeronimoEjbJarStorer.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/xml/deployment/GeronimoEjbJarStorer.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- GeronimoEjbJarStorer.java 18 Nov 2003 22:22:28 -0000 1.4
+++ GeronimoEjbJarStorer.java 19 Nov 2003 00:33:59 -0000 1.5
@@ -57,8 +57,10 @@
import java.io.Writer;
import java.io.IOException;
+
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
+
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.apache.geronimo.deployment.model.geronimo.ejb.MessageDriven;
@@ -69,6 +71,7 @@
import
org.apache.geronimo.deployment.model.geronimo.ejb.GeronimoEjbJarDocument;
import org.apache.geronimo.deployment.model.geronimo.ejb.Query;
import org.apache.geronimo.deployment.model.geronimo.ejb.Binding;
+import org.apache.geronimo.deployment.model.geronimo.ejb.ActivationConfig;
/**
* Knows how to store geronimo-ejb-jar.xml POJOs to a DOM
@@ -97,31 +100,31 @@
if (jar.getDatasourceName() != null) {
StorerUtil.createChildText(root, "datasource-name",
jar.getDatasourceName());
}
- if(jar.getEnterpriseBeans() != null &&
jar.getEnterpriseBeans().hasBeans()) {
+ if (jar.getEnterpriseBeans() != null &&
jar.getEnterpriseBeans().hasBeans()) {
storeEjbs(StorerUtil.createChild(root, "enterprise-beans"),
jar.getGeronimoEnterpriseBeans());
}
//todo: there will probably be Geronimo-specific content for
relationships, assembly descriptor
StorerUtil.writeXML(doc, out);
- } catch(ParserConfigurationException e) {
- throw new IOException("Unable to generate DOM document: "+e);
- } catch(TransformerException e) {
- throw new IOException("Unable to write document: "+e);
+ } catch (ParserConfigurationException e) {
+ throw new IOException("Unable to generate DOM document: " + e);
+ } catch (TransformerException e) {
+ throw new IOException("Unable to write document: " + e);
}
}
static void storeEjbs(Element root, EnterpriseBeans beans) {
Session[] session = beans.getGeronimoSession();
- for(int i = 0; i < session.length; i++) {
+ for (int i = 0; i < session.length; i++) {
Element se = StorerUtil.createChild(root, "session");
storeSessionBean(se, session[i]);
}
Entity[] entity = beans.getGeronimoEntity();
- for(int i = 0; i < entity.length; i++) {
+ for (int i = 0; i < entity.length; i++) {
Element ee = StorerUtil.createChild(root, "entity");
storeEntityBean(ee, entity[i]);
}
MessageDriven[] mdb = beans.getGeronimoMessageDriven();
- for(int i = 0; i < mdb.length; i++) {
+ for (int i = 0; i < mdb.length; i++) {
Element me = StorerUtil.createChild(root, "message-driven");
storeMessageDrivenBean(me, mdb[i]);
}
@@ -140,7 +143,7 @@
StorerUtil.createOptionalChildText(root, "transaction-type",
bean.getTransactionType());
GeronimoJ2EEStorer.storeJNDIEnvironmentRefs(root, bean);
J2EEStorer.storeSecurityRoleRefs(root, bean.getSecurityRoleRef());
- if(bean.getSecurityIdentity() != null) {
+ if (bean.getSecurityIdentity() != null) {
EjbJarStorer.storeSecurityIdentity(StorerUtil.createChild(root,
"security-identity"), bean.getSecurityIdentity());
}
}
@@ -158,19 +161,19 @@
StorerUtil.createChildText(root, "reentrant", bean.getReentrant());
StorerUtil.createOptionalChildText(root, "cmp-version",
bean.getCmpVersion());
StorerUtil.createOptionalChildText(root, "abstract-schema-name",
bean.getAbstractSchemaName());
- for(int i = 0; i < bean.getCmpField().length; i++) {
+ for (int i = 0; i < bean.getCmpField().length; i++) {
EjbJarStorer.storeCmpField(StorerUtil.createChild(root,
"cmp-field"), bean.getCmpField(i));
}
StorerUtil.createOptionalChildText(root, "primkey-field",
bean.getPrimkeyField());
GeronimoJ2EEStorer.storeJNDIEnvironmentRefs(root, bean);
J2EEStorer.storeSecurityRoleRefs(root, bean.getSecurityRoleRef());
- if(bean.getSecurityIdentity() != null) {
+ if (bean.getSecurityIdentity() != null) {
EjbJarStorer.storeSecurityIdentity(StorerUtil.createChild(root,
"security-identity"), bean.getSecurityIdentity());
}
- for(int i = 0; i < bean.getQuery().length; i++) {
+ for (int i = 0; i < bean.getQuery().length; i++) {
storeQuery(StorerUtil.createChild(root, "query"),
bean.getGeronimoQuery(i));
}
- for(int i = 0; i < bean.getUpdate().length; i++) {
+ for (int i = 0; i < bean.getUpdate().length; i++) {
storeQuery(StorerUtil.createChild(root, "update"),
bean.getUpdate(i));
}
}
@@ -202,12 +205,18 @@
StorerUtil.createChildText(root, "transaction-type",
bean.getTransactionType());
StorerUtil.createOptionalChildText(root, "message-destination-type",
bean.getMessageDestinationType());
StorerUtil.createOptionalChildText(root, "message-destination-link",
bean.getMessageDestinationLink());
- if(bean.getActivationConfig() != null) {
- EjbJarStorer.storeActivationConfig(StorerUtil.createChild(root,
"activation-config"), bean.getActivationConfig());
+ if (bean.getActivationConfig() != null) {
+ storeActivationConfig(StorerUtil.createChild(root,
"activation-config"), bean.getGeronimoActivationConfig());
}
GeronimoJ2EEStorer.storeJNDIEnvironmentRefs(root, bean);
- if(bean.getSecurityIdentity() != null) {
+ if (bean.getSecurityIdentity() != null) {
EjbJarStorer.storeSecurityIdentity(StorerUtil.createChild(root,
"security-identity"), bean.getSecurityIdentity());
}
+ }
+
+ static void storeActivationConfig(Element root, ActivationConfig
activationConfig) {
+ StorerUtil.createChildText(root, "resource-adapter-name",
activationConfig.getResourceAdapterName());
+ StorerUtil.createChildText(root, "activation-spec-class",
activationConfig.getActivationSpecClass());
+ EjbJarStorer.storeActivationConfig(root, activationConfig);
}
}
1.11 +3 -1
incubator-geronimo/modules/core/src/schema/geronimo-ejb-jar.xsd
Index: geronimo-ejb-jar.xsd
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/core/src/schema/geronimo-ejb-jar.xsd,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- geronimo-ejb-jar.xsd 18 Nov 2003 22:22:28 -0000 1.10
+++ geronimo-ejb-jar.xsd 19 Nov 2003 00:33:59 -0000 1.11
@@ -29,6 +29,8 @@
<xsd:complexType name="activation-configType">
<xsd:sequence>
<xsd:element name="description" type="j2ee:descriptionType"
minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="resource-adapter-name"
type="j2ee:xdsStringType"/>
+ <xsd:element name="activation-spec-class"
type="j2ee:fully-qualified-classType"/>
<xsd:element name="activation-config-property"
type="j2ee:activation-config-propertyType" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:ID"/>
@@ -262,7 +264,7 @@
<xsd:element name="transaction-type"
type="j2ee:transaction-typeType"/>
<xsd:element name="message-destination-type"
type="j2ee:message-destination-typeType" minOccurs="0"/>
<xsd:element name="message-destination-link"
type="j2ee:message-destination-linkType" minOccurs="0"/>
- <xsd:element name="activation-config"
type="j2ee:activation-configType" minOccurs="0"/>
+ <xsd:element name="activation-config"
type="activation-configType" minOccurs="0"/>
<xsd:group ref="j2ee:jndiEnvironmentRefsGroup"/>
<xsd:element name="security-identity"
type="j2ee:security-identityType" minOccurs="0"/>
</xsd:sequence>
1.6 +15 -1
incubator-geronimo/modules/core/src/test/org/apache/geronimo/xml/deployment/GeronimoEjbJarLoaderTest.java
Index: GeronimoEjbJarLoaderTest.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/core/src/test/org/apache/geronimo/xml/deployment/GeronimoEjbJarLoaderTest.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- GeronimoEjbJarLoaderTest.java 18 Nov 2003 22:22:29 -0000 1.5
+++ GeronimoEjbJarLoaderTest.java 19 Nov 2003 00:33:59 -0000 1.6
@@ -67,6 +67,8 @@
import org.apache.geronimo.deployment.model.geronimo.ejb.Entity;
import org.apache.geronimo.deployment.model.geronimo.ejb.Query;
import org.apache.geronimo.deployment.model.geronimo.ejb.Binding;
+import org.apache.geronimo.deployment.model.geronimo.ejb.MessageDriven;
+import org.apache.geronimo.deployment.model.geronimo.ejb.ActivationConfig;
import org.apache.geronimo.deployment.model.geronimo.j2ee.ResourceEnvRef;
import org.apache.geronimo.deployment.model.geronimo.j2ee.EjbRef;
import org.apache.geronimo.deployment.model.geronimo.j2ee.ClassSpace;
@@ -106,6 +108,18 @@
assertEquals(1, entity.length);
assertEquals("Container", entity[0].getPersistenceType());
assertEquals("java.lang.Integer", entity[0].getPrimKeyClass());
+ MessageDriven[] messageDriven = beans.getGeronimoMessageDriven();
+ assertEquals(1, messageDriven.length);
+ assertEquals("Container", messageDriven[0].getTransactionType());
+
assertEquals("org.apache.geronimo.enterprise.deploy.test.MessageBeanIntf",
messageDriven[0].getMessagingType());
+ assertEquals("javax.jms.Queue",
messageDriven[0].getMessageDestinationType());
+ ActivationConfig activationConfig =
messageDriven[0].getGeronimoActivationConfig();
+ assertEquals("TestInboundAdapter",
activationConfig.getResourceAdapterName());
+ assertEquals("org.apache.geronimo.connector.TestActivationSpec",
activationConfig.getActivationSpecClass());
+ assertEquals(1,
activationConfig.getActivationConfigProperty().length);
+ assertEquals("StringProp",
activationConfig.getActivationConfigProperty()[0].getActivationConfigPropertyName());
+ assertEquals("some value",
activationConfig.getActivationConfigProperty()[0].getActivationConfigPropertyValue());
+
checkStateless(session[0]);
checkStateful(session[1]);
1.5 +32 -2
incubator-geronimo/modules/core/src/test-data/xml/deployment/simple-geronimo-ejb-jar.xml
Index: simple-geronimo-ejb-jar.xml
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/core/src/test-data/xml/deployment/simple-geronimo-ejb-jar.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- simple-geronimo-ejb-jar.xml 18 Nov 2003 22:22:29 -0000 1.4
+++ simple-geronimo-ejb-jar.xml 19 Nov 2003 00:33:59 -0000 1.5
@@ -31,7 +31,6 @@
<resource-env-ref-type>javax.sql.DataSource</resource-env-ref-type>
<ger:jndi-name>java:jdbc/MyDatabase</ger:jndi-name>
</resource-env-ref>
- <jndi-name>StatelessTestJNDI</jndi-name>
</session>
<session>
<description>This is a sample stateful session bean</description>
@@ -54,8 +53,39 @@
<resource-env-ref-type>javax.sql.DataSource</resource-env-ref-type>
<ger:jndi-name></ger:jndi-name>
</resource-env-ref>
- <jndi-name>StatefulTestJNDI</jndi-name>
</session>
+ <message-driven>
+ <description>This is a sample message-driven bean</description>
+ <display-name>Message Driven Bean</display-name>
+ <ejb-name>MessageDrivenTest</ejb-name>
+
<ejb-class>org.apache.geronimo.enterprise.deploy.test.MessageBean</ejb-class>
+
<messaging-type>org.apache.geronimo.enterprise.deploy.test.MessageBeanIntf</messaging-type>
+ <transaction-type>Container</transaction-type>
+ <message-destination-type>
+ javax.jms.Queue
+ </message-destination-type>
+ <!--message-destination-link></message-destination-link-->
+ <activation-config>
+
<resource-adapter-name>TestInboundAdapter</resource-adapter-name>
+
<activation-spec-class>org.apache.geronimo.connector.TestActivationSpec</activation-spec-class>
+ <activation-config-property>
+
<activation-config-property-name>StringProp</activation-config-property-name>
+ <activation-config-property-value>some
value</activation-config-property-value>
+ </activation-config-property>
+ </activation-config>
+ <ejb-ref>
+ <ejb-ref-name>ejb/MyStateless</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+
<home>org.apache.geronimo.enterprise.deploy.test.StatelessHome</home>
+
<remote>org.apache.geronimo.enterprise.deploy.test.Stateless</remote>
+ <ejb-link>Stateless</ejb-link>
+ </ejb-ref>
+ <resource-env-ref>
+
<resource-env-ref-name>jdbc/StatefulDatabase</resource-env-ref-name>
+
<resource-env-ref-type>javax.sql.DataSource</resource-env-ref-type>
+ <ger:jndi-name></ger:jndi-name>
+ </resource-env-ref>
+ </message-driven>
<entity>
<description>Sample CMP entity</description>
<display-name>CMP Entity Bean</display-name>