You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2006/12/28 08:58:33 UTC
svn commit: r490674 -
/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/AnnotationDeployer.java
Author: dblevins
Date: Wed Dec 27 23:58:30 2006
New Revision: 490674
URL: http://svn.apache.org/viewvc?view=rev&rev=490674
Log:
Fixed to allow for @Remote or @Local without arguments on bean class. Affects OPENEJB-240 and OPENEJB-235
Modified:
incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/AnnotationDeployer.java
Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/AnnotationDeployer.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/AnnotationDeployer.java?view=diff&rev=490674&r1=490673&r2=490674
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/AnnotationDeployer.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/config/AnnotationDeployer.java Wed Dec 27 23:58:30 2006
@@ -384,6 +384,14 @@
List<Class> remotes = new ArrayList<Class>();
Remote remote = (Remote) clazz.getAnnotation(Remote.class);
if (remote != null) {
+ if (remote.value().length == 0){
+ if (interfaces.size() != 1) throw new IllegalStateException("When annotating a bean class as @Remote with no annotation attributes, the bean must implement exactly one business interface, no more and no less.");
+ if (clazz.getAnnotation(Local.class) != null) throw new IllegalStateException("When annotating a bean class as @Remote with no annotation attributes you must not also annotate it with @Local.");
+ 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.");
+
+ remotes.add(interfaces.get(0));
+ interfaces.remove(0);
+ }
for (Class interfce : remote.value()) {
remotes.add(interfce);
interfaces.remove(interfce);
@@ -393,6 +401,14 @@
List<Class> locals = new ArrayList<Class>();
Local local = (Local) clazz.getAnnotation(Local.class);
if (local != null) {
+ if (local.value().length == 0){
+ if (interfaces.size() != 1) throw new IllegalStateException("When annotating a bean class as @Local with no annotation attributes, the bean must implement exactly one business interface, no more and no less.");
+ if (clazz.getAnnotation(Remote.class) != null) throw new IllegalStateException("When annotating a bean class as @Local with no annotation attributes you must not also annotate it with @Remote.");
+ 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.");
+
+ locals.add(interfaces.get(0));
+ interfaces.remove(0);
+ }
for (Class interfce : local.value()) {
locals.add(interfce);
interfaces.remove(interfce);