diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2010-02-19 23:38:00 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2010-02-19 23:38:00 +0000 |
commit | 45608ba818d35c57fdd0b00a4b1904a680fbf55f (patch) | |
tree | a493afce1740cd63b1cabb8fb2e025adf0f1f353 /sca-java-2.x/trunk/modules/interface-wsdl | |
parent | fbc0426ecc97bb64a0db5b2565395a800679ff0b (diff) |
Align the interfaceContractMapper to the spec
Remove the conversation related legacy code
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@912034 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/interface-wsdl')
4 files changed, 7 insertions, 70 deletions
diff --git a/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceIntrospectorImpl.java b/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceIntrospectorImpl.java index 76d42f2f44..dd19407abe 100644 --- a/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceIntrospectorImpl.java +++ b/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceIntrospectorImpl.java @@ -29,7 +29,6 @@ import javax.xml.namespace.QName; import org.apache.tuscany.sca.contribution.resolver.ModelResolver; import org.apache.tuscany.sca.core.FactoryExtensionPoint; -import org.apache.tuscany.sca.interfacedef.ConversationSequence; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition; import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory; @@ -47,8 +46,6 @@ import org.apache.tuscany.sca.xsd.XSDFactory; */ public class WSDLInterfaceIntrospectorImpl { private static final QName POLICY_REQUIRES = new QName("http://docs.oasis-open.org/ns/opencsa/sca/200912", "requires"); - private static final QName POLICY_CONVERSATIONAL = new QName("http://docs.oasis-open.org/ns/opencsa/sca/200912", "conversational"); - public static final QName POLICY_END_CONVERSATION = new QName("http://docs.oasis-open.org/ns/opencsa/sca/200912", "endsConversation"); private static final QName CALLBACK_ATTRIBUTE = new QName("http://docs.oasis-open.org/ns/opencsa/sca/200912", "callback" ); @@ -68,9 +65,6 @@ public class WSDLInterfaceIntrospectorImpl { for (Object o : portType.getOperations()) { javax.wsdl.Operation wsdlOp = (javax.wsdl.Operation)o; Operation operation = getOperation(wsdlOp, wsdlDefinition, resolver, xsdFactory, monitor); - if(isEndConversation(wsdlOp)) { - operation.setConversationSequence(ConversationSequence.CONVERSATION_END); - } operations.add(operation); } return operations; @@ -82,7 +76,6 @@ public class WSDLInterfaceIntrospectorImpl { wsdlInterface.setPortType(portType); wsdlInterface.setCallbackInterface(callback); wsdlInterface.getOperations().addAll(introspectOperations(portType, wsdlDefinition, resolver, monitor)); - wsdlInterface.setConversational(isConversational(portType)); } public static Operation getOperation(javax.wsdl.Operation wsdlOp, @@ -126,62 +119,17 @@ public class WSDLInterfaceIntrospectorImpl { Vector<QName> policyAttributes = (Vector<QName>) o; Enumeration<QName> policyItents = policyAttributes.elements(); - while(policyItents.hasMoreElements()) { + while (policyItents.hasMoreElements()) { QName intentName = policyItents.nextElement(); - - //ignores conversational, as it will have it's own - //attribute in the wsdl interface model - if(! intentName.equals(POLICY_CONVERSATIONAL)) { - // Add each intent to the list - Intent intent = policyFactory.createIntent(); - intent.setName(intentName); - - wsdlInterface.getRequiredIntents().add(intent); - } - } - - } - } - - private boolean isConversational(PortType portType) { - boolean conversational = false; - - Object o; - try { - o = portType.getExtensionAttribute(POLICY_REQUIRES); - } catch (NoSuchMethodError e) { - // That method does not exist on older WSDL4J levels - o =null; - } - if(o != null && o instanceof Vector) { - Vector<QName> policyAttributes = (Vector<QName>) o; - - if(policyAttributes.contains(POLICY_CONVERSATIONAL)) { - return true; + // Add each intent to the list + Intent intent = policyFactory.createIntent(); + intent.setName(intentName); + + wsdlInterface.getRequiredIntents().add(intent); } } - - return conversational; - } - - private boolean isEndConversation(javax.wsdl.Operation operation) { - boolean endConversation = false; - - Object o; - try { - o = operation.getExtensionAttribute(POLICY_END_CONVERSATION); - } catch (NoSuchMethodError e) { - // That method does not exist on older WSDL4J levels - o = null; - } - if(o != null && o instanceof String) { - endConversation = Boolean.valueOf((String)o); - } - - return endConversation; - } } diff --git a/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java b/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java index a223b5cbd7..3fd476c46f 100644 --- a/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java +++ b/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java @@ -36,7 +36,6 @@ import javax.xml.namespace.QName; import org.apache.tuscany.sca.contribution.processor.ProcessorContext; import org.apache.tuscany.sca.contribution.resolver.ModelResolver; -import org.apache.tuscany.sca.interfacedef.ConversationSequence; import org.apache.tuscany.sca.interfacedef.DataType; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl; @@ -220,7 +219,6 @@ public class WSDLOperationIntrospectorImpl { operationModel.setName(operation.getName()); operationModel.setFaultTypes(getFaultTypes()); operationModel.setNonBlocking(oneway); - operationModel.setConversationSequence(ConversationSequence.CONVERSATION_NONE); operationModel.setInputType(getInputType()); operationModel.setOutputType(getOutputType()); diff --git a/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java b/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java index b9f724c82a..a04b3136d7 100644 --- a/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java +++ b/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java @@ -373,7 +373,7 @@ public class WSDLInterfaceProcessor implements StAXArtifactProcessor<WSDLInterfa if( wsdlCallbackInterface != null ) { // If there is both a callback interface declared on the forward interface and also one declared on the // interface.wsdl element, then the two interfaces must match [ASM80011] - if( !interfaceContractMapper.isEqual(intrinsicWSDLCallbackInterface, wsdlCallbackInterface) ) { + if( !interfaceContractMapper.isMutuallyCompatible(intrinsicWSDLCallbackInterface, wsdlCallbackInterface) ) { Monitor.error(context.getMonitor(), WSDLInterfaceProcessor.class.getName(), "interface-wsdlxml-validation-messages", "IncompatibleCallbacks", intrinsicWSDLCallbackInterface.getName().toString(), diff --git a/sca-java-2.x/trunk/modules/interface-wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLPolicyAnnotatedInterfaceIntrospectorTestCase.java b/sca-java-2.x/trunk/modules/interface-wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLPolicyAnnotatedInterfaceIntrospectorTestCase.java index 4172eb2955..45f4fa78f9 100644 --- a/sca-java-2.x/trunk/modules/interface-wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLPolicyAnnotatedInterfaceIntrospectorTestCase.java +++ b/sca-java-2.x/trunk/modules/interface-wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLPolicyAnnotatedInterfaceIntrospectorTestCase.java @@ -26,9 +26,7 @@ import javax.wsdl.PortType; import javax.xml.namespace.QName; import org.apache.tuscany.sca.contribution.processor.ProcessorContext; -import org.apache.tuscany.sca.interfacedef.ConversationSequence; import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException; -import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition; import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface; import org.apache.tuscany.sca.interfacedef.wsdl.xml.AbstractWSDLTestCase; @@ -67,7 +65,6 @@ public class WSDLPolicyAnnotatedInterfaceIntrospectorTestCase extends AbstractWS public final void testIntrospectPortType() throws InvalidInterfaceException { WSDLInterface contract = wsdlFactory.createWSDLInterface(portType, definition, resolver, context.getMonitor()); Assert.assertEquals(contract.getName().getLocalPart(), "StockQuotePortType"); - Assert.assertTrue(contract.isConversational()); boolean foundIntent = false; @@ -79,11 +76,5 @@ public class WSDLPolicyAnnotatedInterfaceIntrospectorTestCase extends AbstractWS Assert.assertTrue(foundIntent); - for(Operation operation : contract.getOperations()) { - if(operation.getName().equals("cancel")) { - Assert.assertEquals(operation.getConversationSequence(), ConversationSequence.CONVERSATION_END); - } - } - } } |