summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/contribution-jee/src
diff options
context:
space:
mode:
authorvamsic007 <vamsic007@13f79535-47bb-0310-9956-ffa450edef68>2008-09-18 18:09:55 +0000
committervamsic007 <vamsic007@13f79535-47bb-0310-9956-ffa450edef68>2008-09-18 18:09:55 +0000
commit6d4a8d251b9e87720bda9efd7bc1c83185ac3068 (patch)
tree6d4b0f96597972d5595a70bccd61d3f463e5877d /java/sca/modules/contribution-jee/src
parent76c424d8d41248ba25f5e14400723f826a6e5fd0 (diff)
Process ejb references only to EJB3 Session beans in computing the component type.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@696745 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/contribution-jee/src')
-rw-r--r--java/sca/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EJBModuleProcessor.java44
-rw-r--r--java/sca/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/WebModuleProcessor.java14
2 files changed, 56 insertions, 2 deletions
diff --git a/java/sca/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EJBModuleProcessor.java b/java/sca/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EJBModuleProcessor.java
index 34b54ed238..37ae53a38a 100644
--- a/java/sca/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EJBModuleProcessor.java
+++ b/java/sca/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EJBModuleProcessor.java
@@ -27,6 +27,7 @@ import java.util.Map;
import org.apache.openejb.config.EjbModule;
import org.apache.openejb.jee.EjbJar;
import org.apache.openejb.jee.EjbRef;
+import org.apache.openejb.jee.EjbRefType;
import org.apache.openejb.jee.EjbReference;
import org.apache.openejb.jee.EnterpriseBean;
import org.apache.openejb.jee.EnvEntry;
@@ -96,7 +97,10 @@ public class EJBModuleProcessor {
} else {
continue;
}
- ejbComponentTypes.put(bean.getEjbName(), ct);
+ if (ct != null) {
+ // Bean is an EJB3 bean
+ ejbComponentTypes.put(bean.getEjbName(), ct);
+ }
}
// Adjust the references to STATEFUL beans
@@ -216,6 +220,10 @@ public class EJBModuleProcessor {
}
private ComponentType getEjbComponentType(SessionBean bean, ClassLoader cl) throws ContributionException {
+ if(bean.getBusinessRemote().size() == 0 && bean.getBusinessLocal().size() == 0) {
+ // Not an EJB3 Session bean
+ return null;
+ }
ComponentType componentType = helper.createComponentType();
boolean conversational = bean.getSessionType().equals(SessionType.STATEFUL);
@@ -278,7 +286,20 @@ public class EJBModuleProcessor {
// Process Remote EJB References
for (Map.Entry<String, EjbRef> entry : bean.getEjbRefMap().entrySet()) {
EjbRef ejbRef = entry.getValue();
+ if(ejbRef.getHome() != null) {
+ // References to only EJB3 beans need to be considered.
+ // Skip the current on as it is not a reference to an EJB3 bean.
+ continue;
+ }
if (ejbRef.getRefType().compareTo(EjbReference.Type.REMOTE) != 0) {
+ // Only Remote EJB references need to be considered.
+ // Skip the current one as it is not a remote reference.
+ continue;
+ }
+ //FIXME: ejbRef.getEjbRefType() is null sometimes. Need a different way to figure the type.
+ if(ejbRef.getEjbRefType() != null && ejbRef.getEjbRefType().compareTo(EjbRefType.SESSION) != 0) {
+ // Only references to Session beans need to be considered.
+ // Skip the current one as it is not a Session bean.
continue;
}
String referenceName = entry.getKey();
@@ -318,12 +339,33 @@ public class EJBModuleProcessor {
}
private ComponentType getEjbComponentType(MessageDrivenBean bean, ClassLoader cl) throws ContributionException {
+ try {
+ if(javax.ejb.MessageDrivenBean.class.isAssignableFrom(cl.loadClass(bean.getEjbClass()))) {
+ // Not an EJB3 bean
+ return null;
+ }
+ } catch (ClassNotFoundException ignored) {
+ // Should not happen
+ }
ComponentType componentType = helper.createComponentType();
// Process Remote EJB References
for (Map.Entry<String, EjbRef> entry : bean.getEjbRefMap().entrySet()) {
EjbRef ejbRef = entry.getValue();
+ if(ejbRef.getHome() != null) {
+ // References to only EJB3 beans need to be considered.
+ // Skip the current on as it is not a reference to an EJB3 bean.
+ continue;
+ }
if (ejbRef.getRefType().compareTo(EjbReference.Type.REMOTE) != 0) {
+ // Only Remote EJB references need to be considered.
+ // Skip the current one as it is not a remote reference.
+ continue;
+ }
+ //FIXME: ejbRef.getEjbRefType() is null sometimes. Need a different way to figure the type.
+ if(ejbRef.getEjbRefType() != null && ejbRef.getEjbRefType().compareTo(EjbRefType.SESSION) != 0) {
+ // Only references to Session beans need to be considered.
+ // Skip the current one as it is not a Session bean.
continue;
}
String referenceName = entry.getKey();
diff --git a/java/sca/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/WebModuleProcessor.java b/java/sca/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/WebModuleProcessor.java
index 58821b767d..deb9d9e755 100644
--- a/java/sca/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/WebModuleProcessor.java
+++ b/java/sca/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/WebModuleProcessor.java
@@ -23,6 +23,7 @@ import java.util.Map;
import org.apache.openejb.config.WebModule;
import org.apache.openejb.jee.EjbRef;
+import org.apache.openejb.jee.EjbRefType;
import org.apache.openejb.jee.EjbReference;
import org.apache.openejb.jee.EnvEntry;
import org.apache.openejb.jee.WebApp;
@@ -69,9 +70,20 @@ public class WebModuleProcessor {
// Process Remote EJB References
for (Map.Entry<String, EjbRef> entry : webApp.getEjbRefMap().entrySet()) {
EjbRef ejbRef = entry.getValue();
+ if(ejbRef.getHome() != null) {
+ // References to only EJB3 beans need to be considered.
+ // Skip the current on as it is not a reference to an EJB3 bean.
+ continue;
+ }
if (ejbRef.getRefType().compareTo(EjbReference.Type.REMOTE) != 0) {
// Only Remote EJB references need to be considered.
- // Skip the current one as it is a remote reference.
+ // Skip the current one as it is not a remote reference.
+ continue;
+ }
+ //FIXME: ejbRef.getEjbRefType() is null sometimes. Need a different way to figure the type.
+ if(ejbRef.getEjbRefType() != null && ejbRef.getEjbRefType().compareTo(EjbRefType.SESSION) != 0) {
+ // Only references to Session beans need to be considered.
+ // Skip the current one as it is not a Session bean.
continue;
}
String referenceName = entry.getKey();