You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2009/10/15 22:14:13 UTC

svn commit: r825629 - /tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java

Author: antelder
Date: Thu Oct 15 20:14:13 2009
New Revision: 825629

URL: http://svn.apache.org/viewvc?rev=825629&view=rev
Log:
Fix SCAJ CAA JCA_10048 - an implementation class must implement all methods on all its service interfaces

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

Modified: tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java?rev=825629&r1=825628&r2=825629&view=diff
==============================================================================
--- tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java (original)
+++ tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java Thu Oct 15 20:14:13 2009
@@ -20,6 +20,7 @@
 
 import static org.apache.tuscany.sca.implementation.java.introspect.JavaIntrospectionHelper.getAllInterfaces;
 
+import java.lang.annotation.Annotation;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
@@ -100,6 +101,16 @@
                 throw new IntrospectionException("JCA90060 The value of each element in the @Service names array MUST be unique amongst all the other element values in the array");
             }
         }
+
+        //validate service methods implemented
+        Method[] ms = clazz.getMethods();
+        for (Class<?> iface : interfaces) {
+            for (Method m : iface.getMethods()) {
+                if (!hasMethod(m, ms)) {
+                    throw new IntrospectionException("JCA???? Implementation missing service method " + m.getName() + " service interface " + iface.getName());
+                }
+            }
+        }
         
         for (int i=0; i < interfaces.length; i++) {
             try {
@@ -114,6 +125,15 @@
         }
     }
 
+    protected boolean hasMethod(Method m1, Method[] ms) {
+        for (Method m2 : ms) {
+            if (JavaIntrospectionHelper.exactMethodMatch(m1, m2)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
     @Override
     public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {