There seem to be many property files with properties in openejb. Is
there any convention on which property file to use and the property
keys.

Regards
Manu

On 6/18/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Author: manugeorge
Date: Sun Jun 17 13:40:55 2007
New Revision: 548107

URL: http://svn.apache.org/viewvc?view=rev&rev=548107
Log:
OPENEJB-454 OPENEJB-455
Validation for @Remote and @local

Modified:
    
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
    
openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/util/resources/Messages.properties

Modified: 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java?view=diff&rev=548107&r1=548106&r2=548107
==============================================================================
--- 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
 (original)
+++ 
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
 Sun Jun 17 13:40:55 2007
@@ -63,6 +63,7 @@
 import org.apache.openejb.jee.TimerConsumer;
 import org.apache.openejb.jee.SessionType;
 import org.apache.openejb.util.Logger;
+import org.apache.openejb.util.SafeToolkit;
 import org.apache.xbean.finder.ClassFinder;

 import javax.annotation.PostConstruct;
@@ -77,6 +78,8 @@
 import javax.ejb.EJB;
 import javax.ejb.EJBHome;
 import javax.ejb.EJBLocalHome;
+import javax.ejb.EJBLocalObject;
+import javax.ejb.EJBObject;
 import javax.ejb.EJBs;
 import javax.ejb.Init;
 import javax.ejb.Local;
@@ -594,10 +597,12 @@
                                 if 
(interfaces.get(0).getAnnotation(Local.class) != null)
                                     throw new IllegalStateException("When 
annotating a bean class as @Remote with no annotation attributes, the business interface 
itself must not be annotated as @Local.");

+                                validateInterface(interfaces.get(0));
                                 remotes.add(interfaces.get(0));
                                 interfaces.remove(0);
                             }
                             for (Class interfce : remote.value()) {
+                                validateInterface(interfce);
                                 remotes.add(interfce);
                                 interfaces.remove(interfce);
                             }
@@ -614,10 +619,12 @@
                                 if 
(interfaces.get(0).getAnnotation(Remote.class) != null)
                                     throw new IllegalStateException("When 
annotating a bean class as @Local with no annotation attributes, the business interface 
itself must not be annotated as @Remote.");

+                                validateInterface(interfaces.get(0));
                                 locals.add(interfaces.get(0));
                                 interfaces.remove(0);
                             }
                             for (Class interfce : local.value()) {
+                                validateInterface(interfce);
                                 locals.add(interfce);
                                 interfaces.remove(interfce);
                             }
@@ -645,9 +652,11 @@

                         for (Class interfce : copy(interfaces)) {
                             if (interfce.isAnnotationPresent(Remote.class)) {
+                                validateInterface(interfce);
                                 remotes.add(interfce);
                                 interfaces.remove(interfce);
                             } else {
+                                validateInterface(interfce);
                                 locals.add(interfce);
                                 interfaces.remove(interfce);
                             }
@@ -1414,6 +1423,15 @@
                 return list.get(0);
             }
             return null;
+        }
+
+        private void validateInterface(Class interfce) {
+            if (EJBHome.class.isAssignableFrom(interfce) || 
EJBObject.class.isAssignableFrom(interfce)){
+                throw new 
IllegalStateException(SafeToolkit.messages.format("conf.3901", 
interfce.getName() ));
+            }
+            if (EJBLocalHome.class.isAssignableFrom(interfce) || 
EJBLocalObject.class.isAssignableFrom(interfce)){
+                throw new 
IllegalStateException(SafeToolkit.messages.format("conf.3902", 
interfce.getName() ));
+            }
         }
     }


Modified: 
openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/util/resources/Messages.properties
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/util/resources/Messages.properties?view=diff&rev=548107&r1=548106&r2=548107
==============================================================================
--- 
openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/util/resources/Messages.properties
 (original)
+++ 
openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/util/resources/Messages.properties
 Sun Jun 17 13:40:55 2007
@@ -200,6 +200,8 @@
 conf.3130=Cannot validate ejb-jar.xml file. Received message: {1}
 conf.3140=Cannot parse the XML of the ejb-jar.xml file. Received message: {1}
 conf.3900=Cannot find the ejb-jar.xml.
+conf.3901="The remote business interface {0} must not extend either the 
javax.ejb.EJBHome or javax.ejb.EJBObject interface."
+conf.3902="The local business interface {0} must not extend either the 
javax.ejb.EJBLocalHome or javax.ejb.EJBLocalObject interface."

 #xml.cannotValidate  = Cannot validate the {0} data. Received message: {2}
 xml.cannotMarshal   = Cannot marshal the {0} data to file {1}. Received 
message: {2}



Reply via email to