You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ed...@apache.org on 2011/01/07 13:48:28 UTC

svn commit: r1056294 - /tuscany/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java

Author: edwardsmj
Date: Fri Jan  7 12:48:28 2011
New Revision: 1056294

URL: http://svn.apache.org/viewvc?rev=1056294&view=rev
Log:
Fix to the processing of @Callback annotation on Field or Method, to enable Tuscany to comply with OASIS Java CAA testcase 10035, as described in TUSCANY-3813.

Modified:
    tuscany/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java

Modified: tuscany/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java?rev=1056294&r1=1056293&r2=1056294&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java Fri Jan  7 12:48:28 2011
@@ -37,6 +37,7 @@ import org.apache.tuscany.sca.core.Exten
 import org.apache.tuscany.sca.implementation.java.IntrospectionException;
 import org.apache.tuscany.sca.implementation.java.JavaElementImpl;
 import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaScopeImpl;
 import org.apache.tuscany.sca.implementation.java.introspect.BaseJavaClassVisitor;
 import org.apache.tuscany.sca.implementation.java.introspect.JavaIntrospectionHelper;
 import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
@@ -52,6 +53,9 @@ import org.oasisopen.sca.annotation.Remo
  * the component type with corresponding {@link Service}s. Also processes
  * related {@link org.oasisopen.sca.annotation.Callback} annotations.
  * 
+ * This Visitor MUST follow the ScopeProcessor in the sequence of visitors, since processing of
+ * the Callback annotations depends on knowing the Scope of the implementation
+ * 
  * @version $Rev$ $Date$
  */
 public class ServiceProcessor extends BaseJavaClassVisitor {
@@ -149,6 +153,9 @@ public class ServiceProcessor extends Ba
         if (annotation == null) {
             return;
         }
+        if( type.getJavaScope() == JavaScopeImpl.COMPOSITE ) {
+        	throw new IllegalCallbackReferenceException("[JCA90057] @Callback on field or method cannot be used for a class with @Scope(COMPOSITE): " + type.getName() + "." + method.getName());
+        }
         
         if (!(annotation.value() == null || annotation.value() == Void.class)) {
             throw new IllegalCallbackReferenceException("[JCA90046] @Callback on field of method must not have any parameters: " + type.getName() + "." + method.getName());
@@ -171,6 +178,9 @@ public class ServiceProcessor extends Ba
         if (annotation == null) {
             return;
         }
+        if( type.getJavaScope() == JavaScopeImpl.COMPOSITE ) {
+        	throw new IllegalCallbackReferenceException("[JCA90057] @Callback on field or method cannot be used for a class with @Scope(COMPOSITE): " + type.getName() + "." + field.getName());
+        }
         if (!(annotation.value() == null || annotation.value() == Void.class)) {
             throw new IllegalCallbackReferenceException("[JCA90046] @Callback on field of method must not have any parameters: " + type.getName() + "." + field.getName());
         }