You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by ga...@apache.org on 2010/09/28 17:54:14 UTC

svn commit: r1002230 - /openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java

Author: gawor
Date: Tue Sep 28 15:54:14 2010
New Revision: 1002230

URL: http://svn.apache.org/viewvc?rev=1002230&view=rev
Log:
since we treat managed beans almost as ejbs look for classes with @ManagedBean annotations when scanning for potential ejb modules

Modified:
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java?rev=1002230&r1=1002229&r2=1002230&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java Tue Sep 28 15:54:14 2010
@@ -81,17 +81,24 @@ public class DeploymentLoader {
     public static final Logger logger = Logger.getInstance(LogCategory.OPENEJB_STARTUP_CONFIG, "org.apache.openejb.util.resources");
     private static final String OPENEJB_ALTDD_PREFIX = "openejb.altdd.prefix";
     private final String ddDir;
-    private final boolean preferEjb;
+    private boolean scanManagedBeans = true;
 
     public DeploymentLoader() {
-        this("META-INF/", false);
+        this("META-INF/");
     }
 
-    public DeploymentLoader(String ddDir, boolean preferEjb) {
+    public DeploymentLoader(String ddDir) {
         this.ddDir = ddDir;
-        this.preferEjb = preferEjb;
     }
 
+    public void setScanManagedBeans(boolean scan) {
+        scanManagedBeans = scan;
+    }
+    
+    public boolean getScanManagedBeans() {
+        return scanManagedBeans;
+    }
+    
     public AppModule load(File jarFile) throws OpenEJBException {
         // verify we have a valid file
         String jarPath;
@@ -1212,12 +1219,16 @@ public class DeploymentLoader {
             AnnotationFinder.Filter filter = new AnnotationFinder.Filter() {
                 final String packageName = LocalClient.class.getName().replace("LocalClient", "");
                 public boolean accept(String annotationName) {
-                    if (scanPotentialEjbModules && annotationName.startsWith("javax.ejb.")) {
-                        if ("javax.ejb.Stateful".equals(annotationName)) return true;
-                        if ("javax.ejb.Stateless".equals(annotationName)) return true;
-                        if ("javax.ejb.Singleton".equals(annotationName)) return true;
-                        if ("javax.ejb.MessageDriven".equals(annotationName)) return true;
-                    } else if (scanPotentialClientModules && annotationName.startsWith(packageName)){
+                    if (scanPotentialEjbModules) {
+                        if (annotationName.startsWith("javax.ejb.")) {
+                            if ("javax.ejb.Stateful".equals(annotationName)) return true;
+                            if ("javax.ejb.Stateless".equals(annotationName)) return true;
+                            if ("javax.ejb.Singleton".equals(annotationName)) return true;
+                            if ("javax.ejb.MessageDriven".equals(annotationName)) return true;
+                        } else if (scanManagedBeans && "javax.annotation.ManagedBean".equals(annotationName)) {
+                            return true;
+                        }
+                    } else if (scanPotentialClientModules && annotationName.startsWith(packageName)) {
                         if (LocalClient.class.getName().equals(annotationName)) otherTypes.add(ClientModule.class);
                         if (RemoteClient.class.getName().equals(annotationName)) otherTypes.add(ClientModule.class);
                     }