summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/interface-java/src/main
diff options
context:
space:
mode:
authorbdaniel <bdaniel@13f79535-47bb-0310-9956-ffa450edef68>2010-08-09 17:33:18 +0000
committerbdaniel <bdaniel@13f79535-47bb-0310-9956-ffa450edef68>2010-08-09 17:33:18 +0000
commit95b667cfdc431eb6eb27d06b79a66ea511a4d3a7 (patch)
tree4a284d527b2d3eef9059eadc03d79e94953c5238 /sca-java-2.x/trunk/modules/interface-java/src/main
parent7b81d7bea2f9be3f33ad33f1590e282c43bb3135 (diff)
JCA 11011 Add SOAP intent to the interface if any method in the interface is annotated with @WebResult
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@983744 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/interface-java/src/main')
-rw-r--r--sca-java-2.x/trunk/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/PolicyJavaInterfaceVisitor.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/sca-java-2.x/trunk/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/PolicyJavaInterfaceVisitor.java b/sca-java-2.x/trunk/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/PolicyJavaInterfaceVisitor.java
index 8f760e8593..f6daac64e4 100644
--- a/sca-java-2.x/trunk/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/PolicyJavaInterfaceVisitor.java
+++ b/sca-java-2.x/trunk/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/PolicyJavaInterfaceVisitor.java
@@ -25,6 +25,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import javax.jws.WebResult;
import javax.jws.soap.SOAPBinding;
import javax.xml.namespace.QName;
@@ -107,12 +108,14 @@ public class PolicyJavaInterfaceVisitor implements JavaInterfaceVisitor {
}
}
- if ( clazz.getAnnotation(SOAPBinding.class) != null ) {
+ if ( clazz.isAnnotationPresent(SOAPBinding.class) ) {
// add soap intent
Intent intent = policyFactory.createIntent();
intent.setName(Constants.SOAP_INTENT);
requiredIntents.add(intent);
}
+
+
}
private void readIntents(Requires intentAnnotation, List<Intent> requiredIntents) {
@@ -155,6 +158,17 @@ public class PolicyJavaInterfaceVisitor implements JavaInterfaceVisitor {
}
}
+ public void readWebResult(Method m, Class<?> clazz, List<Intent> requiredIntents) {
+ WebResult webResultAnnotation = m.getAnnotation(WebResult.class);
+ if (webResultAnnotation != null) {
+ if (webResultAnnotation.header()) {
+ // Add SOAP intent
+ Intent intent = policyFactory.createIntent();
+ intent.setName(Constants.SOAP_INTENT);
+ requiredIntents.add(intent);
+ }
+ }
+ }
public void visitInterface(JavaInterface javaInterface) throws InvalidInterfaceException {
if (javaInterface.getJavaClass() != null) {
@@ -169,6 +183,7 @@ public class PolicyJavaInterfaceVisitor implements JavaInterfaceVisitor {
readIntents(method.getAnnotation(Requires.class), op.getRequiredIntents());
readSpecificIntents(method.getAnnotations(), op.getRequiredIntents());
readPolicySets(method.getAnnotation(PolicySets.class), op.getPolicySets());
+ readWebResult(method, javaInterface.getJavaClass(), javaInterface.getRequiredIntents());
}
}
}