From f608a1a1a45191102c60533ad42983ac11ffc454 Mon Sep 17 00:00:00 2001 From: bdaniel Date: Mon, 18 Oct 2010 15:30:34 +0000 Subject: POJO_8037 Add an intent based on @BindingType annotation git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1023851 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/introspect/impl/JAXWSProcessor.java | 44 ++++++++++++++++++---- 1 file changed, 36 insertions(+), 8 deletions(-) (limited to 'sca-java-2.x/trunk/modules') diff --git a/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JAXWSProcessor.java b/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JAXWSProcessor.java index d97d375a0d..50bb5f86d3 100644 --- a/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JAXWSProcessor.java +++ b/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JAXWSProcessor.java @@ -20,12 +20,12 @@ package org.apache.tuscany.sca.implementation.java.introspect.impl; import java.lang.annotation.Annotation; import java.lang.reflect.Method; -import java.util.Iterator; import javax.jws.WebParam; import javax.jws.WebResult; import javax.jws.WebService; import javax.jws.soap.SOAPBinding; +import javax.xml.ws.BindingType; import javax.xml.ws.ServiceMode; import javax.xml.ws.WebServiceProvider; @@ -41,12 +41,9 @@ import org.apache.tuscany.sca.implementation.java.IntrospectionException; import org.apache.tuscany.sca.implementation.java.JavaImplementation; import org.apache.tuscany.sca.implementation.java.introspect.BaseJavaClassVisitor; import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException; -import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.interfacedef.java.JavaInterface; import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract; import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; -import org.apache.tuscany.sca.interfacedef.java.JavaOperation; -import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper; import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory; import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface; import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract; @@ -194,20 +191,51 @@ public class JAXWSProcessor extends BaseJavaClassVisitor { addSOAPIntent(service); } hasJaxwsAnnotation = true; - } + } - if (hasJaxwsAnnotation == true){ + + // Process @BindingType annotation - POJO_8037 + BindingType bindingType = clazz.getAnnotation(BindingType.class); + + if ( bindingType != null ) { + String bindingTypeValue = bindingType.value(); + for ( Service service : type.getServices() ) { + addBindingTypeIntent(service, bindingTypeValue); + } + hasJaxwsAnnotation = true; + } + + if (hasJaxwsAnnotation == true){ // Note that services are based on JAXWS annotations in case // we need to know later. Add a ws binding and a JAXWS annotation // implies a WS binding for ( Service service : type.getServices() ) { service.setJAXWSService(true); - createWSBinding(type, service); + createWSBinding(type, service); } } + + + } - /** + private void addBindingTypeIntent(PolicySubject subject, + String bindingTypeValue) { + + Intent soapIntent = policyFactory.createIntent(); + if ( javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING.equals(bindingTypeValue)) { + soapIntent.setName(Constants.SOAP11_INTENT); + } else if ( javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING.equals(bindingTypeValue)) { + soapIntent.setName(Constants.SOAP12_INTENT); + } else { + soapIntent.setName(Constants.SOAP11_INTENT); + } + + subject.getRequiredIntents().add(soapIntent); + + } + + /** * Utility methods */ -- cgit v1.2.3