Hi,

I see an issue here to mix the code that handle the JEE archive as a SCA contribution and the code that process the ComponentType for implementation.jee, implementation.ejb and implementation.web. They are different functions. I suggest that we have a few modules like this:

1) contribution-jee: It adds the PackageProcessor and URLArtifactProcessor to process the packaging scheme for JEE archives and some JEE deployment descriptors. It produces a list of artifacts inside the archive.

2) implementation-ejb, implementation-web and implementation-jee: They would contain the model for these implementation types and StAXArtifactProcessors that read/write/resolve the models. Introspection of the component types is part of this work.

Thanks,
Raymond
--------------------------------------------------
From: <[EMAIL PROTECTED]>
Sent: Thursday, September 18, 2008 11:09 AM
To: <[EMAIL PROTECTED]>
Subject: svn commit: r696745 - in /tuscany/java/sca/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee: EJBModuleProcessor.java WebModuleProcessor.java

Author: vamsic007
Date: Thu Sep 18 11:09:55 2008
New Revision: 696745

URL: http://svn.apache.org/viewvc?rev=696745&view=rev
Log:
Process ejb references only to EJB3 Session beans in computing the component type.

Modified:

tuscany/java/sca/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EJBModuleProcessor.java

tuscany/java/sca/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/WebModuleProcessor.java

Modified: tuscany/java/sca/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EJBModuleProcessor.java URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EJBModuleProcessor.java?rev=696745&r1=696744&r2=696745&view=diff
==============================================================================
--- tuscany/java/sca/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EJBModuleProcessor.java (original) +++ tuscany/java/sca/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EJBModuleProcessor.java Thu Sep 18 11:09:55 2008
@@ -27,6 +27,7 @@
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 @@
            } 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 @@
    }

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 @@
        // 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 @@
    }

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();

Modified: tuscany/java/sca/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/WebModuleProcessor.java URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/WebModuleProcessor.java?rev=696745&r1=696744&r2=696745&view=diff
==============================================================================
--- tuscany/java/sca/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/WebModuleProcessor.java (original) +++ tuscany/java/sca/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/WebModuleProcessor.java Thu Sep 18 11:09:55 2008
@@ -23,6 +23,7 @@

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 @@
        // 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();


Reply via email to