summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-10-15 20:14:13 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-10-15 20:14:13 +0000
commit5ab991154d264f110dd9d74fd7ebc0a7801a9bf9 (patch)
tree4462690937f8347274053841fce96bd0e2ba2f86 /java
parent7a647f04ea75592a23e6b4bf1d7eec61878948e0 (diff)
Fix SCAJ CAA JCA_10048 - an implementation class must implement all methods on all its service interfaces
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@825629 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
-rw-r--r--java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java b/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java
index ec7507f97e..e74fa8c537 100644
--- a/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java
+++ b/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java
@@ -20,6 +20,7 @@ package org.apache.tuscany.sca.implementation.java.introspect.impl;
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 @@ public class ServiceProcessor extends BaseJavaClassVisitor {
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 @@ public class ServiceProcessor extends BaseJavaClassVisitor {
}
}
+ 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 {