summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules
diff options
context:
space:
mode:
authorbdaniel <bdaniel@13f79535-47bb-0310-9956-ffa450edef68>2010-08-09 20:07:27 +0000
committerbdaniel <bdaniel@13f79535-47bb-0310-9956-ffa450edef68>2010-08-09 20:07:27 +0000
commit400454850c6a9fc060e75c6cd2b189b3273533b4 (patch)
tree6ea73f5c133e02942aa24c41e63f617967aff43c /sca-java-2.x/trunk/modules
parent18ec4c646f3f27aa33eb2be35432ec9f9b416dfc (diff)
JCA 11010 Add SOAP intent to the interface if any parameter on any method in the interface is annotated with @WebParam with header=true
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@983802 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules')
-rw-r--r--sca-java-2.x/trunk/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/PolicyJavaInterfaceVisitor.java24
1 files changed, 22 insertions, 2 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 f6daac64e4..34ea4db3e9 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.WebParam;
import javax.jws.WebResult;
import javax.jws.soap.SOAPBinding;
import javax.xml.namespace.QName;
@@ -158,7 +159,8 @@ public class PolicyJavaInterfaceVisitor implements JavaInterfaceVisitor {
}
}
- public void readWebResult(Method m, Class<?> clazz, List<Intent> requiredIntents) {
+ public void readWebServicesAnnotations(Method m, Class<?> clazz, List<Intent> requiredIntents) {
+
WebResult webResultAnnotation = m.getAnnotation(WebResult.class);
if (webResultAnnotation != null) {
if (webResultAnnotation.header()) {
@@ -166,8 +168,26 @@ public class PolicyJavaInterfaceVisitor implements JavaInterfaceVisitor {
Intent intent = policyFactory.createIntent();
intent.setName(Constants.SOAP_INTENT);
requiredIntents.add(intent);
+ return;
}
}
+
+ Annotation[][] parameterAnnotations = m.getParameterAnnotations();
+ for ( int i=0; i < parameterAnnotations.length; i++ ) {
+ for ( int j=0; j < parameterAnnotations[i].length; j++) {
+ if ( parameterAnnotations[i][j] instanceof WebParam ) {
+ WebParam webParam = (WebParam)parameterAnnotations[i][j];
+ if ( webParam.header() ) {
+ // Add SOAP intent
+ Intent intent = policyFactory.createIntent();
+ intent.setName(Constants.SOAP_INTENT);
+ requiredIntents.add(intent);
+ return;
+ }
+ }
+ }
+ }
+
}
public void visitInterface(JavaInterface javaInterface) throws InvalidInterfaceException {
@@ -183,7 +203,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());
+ readWebServicesAnnotations(method, javaInterface.getJavaClass(), javaInterface.getRequiredIntents());
}
}
}