You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2010/08/18 17:28:57 UTC

svn commit: r986740 - in /tuscany/sca-java-2.x/trunk: itest/scdl/src/test/java/org/apache/tuscany/sca/itest/scdl/ modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/ modules/binding-ws-wsdlgen/src/tes...

Author: slaws
Date: Wed Aug 18 15:28:56 2010
New Revision: 986740

URL: http://svn.apache.org/viewvc?rev=986740&view=rev
Log:
TUSCANY-3653 - Read JAXWS annotations in Java interfaces (JAXWSJavaIntefaceProcessor) and, in the JavaIntefaceProcessor, post process these to reconfigure the Java interface based on what is found. The case where WSDL is referenced is tricky and still has holes. The WSDL is read and is attached to the Java interface as a normalized interface and is used during interface matching. Binding implementations that care about WSDL should really check the normalized interface rather than the service interface itself. This is still a TODO. 

Added:
    tuscany/sca-java-2.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSUtils.java
Modified:
    tuscany/sca-java-2.x/trunk/itest/scdl/src/test/java/org/apache/tuscany/sca/itest/scdl/ValidateDependenciesTestCase.java
    tuscany/sca-java-2.x/trunk/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestInterface.java
    tuscany/sca-java-2.x/trunk/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java
    tuscany/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/BindingWSDLGeneratorTestCase.java
    tuscany/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGeneratorTestCase.java
    tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassLoaderModelResolver.java
    tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java
    tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java
    tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java
    tuscany/sca-java-2.x/trunk/modules/domain-node/pom.xml
    tuscany/sca-java-2.x/trunk/modules/implementation-java/pom.xml
    tuscany/sca-java-2.x/trunk/modules/interface-java-jaxws/META-INF/MANIFEST.MF
    tuscany/sca-java-2.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java
    tuscany/sca-java-2.x/trunk/modules/interface-java/META-INF/MANIFEST.MF
    tuscany/sca-java-2.x/trunk/modules/interface-java/pom.xml
    tuscany/sca-java-2.x/trunk/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java
    tuscany/sca-java-2.x/trunk/modules/interface-wsdl/pom.xml
    tuscany/sca-java-2.x/trunk/modules/node-impl/pom.xml

Modified: tuscany/sca-java-2.x/trunk/itest/scdl/src/test/java/org/apache/tuscany/sca/itest/scdl/ValidateDependenciesTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/itest/scdl/src/test/java/org/apache/tuscany/sca/itest/scdl/ValidateDependenciesTestCase.java?rev=986740&r1=986739&r2=986740&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/itest/scdl/src/test/java/org/apache/tuscany/sca/itest/scdl/ValidateDependenciesTestCase.java (original)
+++ tuscany/sca-java-2.x/trunk/itest/scdl/src/test/java/org/apache/tuscany/sca/itest/scdl/ValidateDependenciesTestCase.java Wed Aug 18 15:28:56 2010
@@ -33,10 +33,13 @@ import org.junit.Test;
  * Current required jars are:
  * 
  * activation-1.1.jar
+ * asm-3.1.jar
  * geronimo-stax-api_1.0_spec-1.0.1.jar
  * jaxb-api-2.1.jar
  * jaxb-impl-2.1.12.jar
+ * jaxws-api-2.1.jar
  * jsr181-api-1.0-MR1.jar
+ * jsr250-api-1.0.jar
  * junit-4.8.1.jar
  * tuscany-assembly-2.0-SNAPSHOT.jar
  * tuscany-assembly-xml-2.0-SNAPSHOT.jar
@@ -56,6 +59,7 @@ import org.junit.Test;
  * tuscany-extensibility-2.0-SNAPSHOT.jar
  * tuscany-implementation-java-2.0-SNAPSHOT.jar
  * tuscany-interface-java-2.0-SNAPSHOT.jar
+ * tuscany-interface-java-jaxws-2.0-SNAPSHOT.jar
  * tuscany-interface-wsdl-2.0-SNAPSHOT.jar
  * tuscany-monitor-2.0-SNAPSHOT.jar
  * tuscany-sca-api-2.0-SNAPSHOT.jar
@@ -75,6 +79,6 @@ public class ValidateDependenciesTestCas
         Assert.assertTrue(dependenciesDir.exists());
         
         File[] dependencyFiles = dependenciesDir.listFiles();
-        Assert.assertEquals(31, dependencyFiles.length);
+        Assert.assertEquals(35, dependencyFiles.length);
     }
 }

Modified: tuscany/sca-java-2.x/trunk/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestInterface.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestInterface.java?rev=986740&r1=986739&r2=986740&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestInterface.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestInterface.java Wed Aug 18 15:28:56 2010
@@ -24,6 +24,7 @@ import java.util.Map;
 
 import javax.xml.namespace.QName;
 
+import org.apache.tuscany.sca.contribution.Contribution;
 import org.apache.tuscany.sca.interfacedef.Interface;
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
@@ -159,5 +160,35 @@ public class TestInterface implements Ja
         // TODO Auto-generated method stub
         
     }
-
+    
+    public String getJAXWSJavaInterfaceName() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+    
+    public void setJAXWSJavaInterfaceName(String javaInterfaceName) {
+        // TODO Auto-generated method stub
+        
+    }
+    
+    public String getJAXWSWSDLLocation() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+    
+    public void setJAXWSWSDLLocation(String wsdlLocation) {
+        // TODO Auto-generated method stub
+        
+    }
+    
+    public Contribution getContributionContainingClass() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+    
+    public void setContributionContainingClass(
+            Contribution contributionContainingClass) {
+        // TODO Auto-generated method stub
+        
+    }
 }

Modified: tuscany/sca-java-2.x/trunk/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java?rev=986740&r1=986739&r2=986740&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java Wed Aug 18 15:28:56 2010
@@ -301,5 +301,11 @@ public class TestRuntimeWire implements 
         // TODO Auto-generated method stub
         
     }
+    
+    public InterfaceContract getGeneratedWSDLContract(
+            InterfaceContract interfaceContract) {
+        // TODO Auto-generated method stub
+        return null;
+    }
 
 }

Modified: tuscany/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/BindingWSDLGeneratorTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/BindingWSDLGeneratorTestCase.java?rev=986740&r1=986739&r2=986740&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/BindingWSDLGeneratorTestCase.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/BindingWSDLGeneratorTestCase.java Wed Aug 18 15:28:56 2010
@@ -58,7 +58,7 @@ public class BindingWSDLGeneratorTestCas
         JavaInterface iface = factory.createJavaInterface(HelloWorld.class);
         DefaultDataBindingExtensionPoint dataBindings = new DefaultDataBindingExtensionPoint(registry);
         JAXWSFaultExceptionMapper faultExceptionMapper = new JAXWSFaultExceptionMapper(dataBindings, null);
-        new JAXWSJavaInterfaceProcessor(dataBindings, faultExceptionMapper, null).visitInterface(iface);
+        new JAXWSJavaInterfaceProcessor(registry).visitInterface(iface);
         new DataBindingJavaInterfaceProcessor(registry).visitInterface(iface);
         javaIC.setInterface(iface);
         WSDLInterfaceContract wsdlIC = BindingWSDLGenerator.createWSDLInterfaceContract(javaIC, false, new XSDModelResolver(null, null), dataBindings, wsdlFactory, xsdFactory, documentBuilderFactory, null);
@@ -71,7 +71,7 @@ public class BindingWSDLGeneratorTestCas
  
         JavaInterfaceContract javaIC2 = factory.createJavaInterfaceContract();
         JavaInterface iface2 = factory.createJavaInterface(TestJavaInterface.class);
-        new JAXWSJavaInterfaceProcessor(dataBindings, faultExceptionMapper, null).visitInterface(iface2);
+        new JAXWSJavaInterfaceProcessor(registry).visitInterface(iface2);
         new DataBindingJavaInterfaceProcessor(registry).visitInterface(iface2);
         javaIC2.setInterface(iface2);
         WSDLInterfaceContract wsdlIC2 = BindingWSDLGenerator.createWSDLInterfaceContract(javaIC2, false, new XSDModelResolver(null, null), dataBindings, wsdlFactory, xsdFactory, documentBuilderFactory, null);

Modified: tuscany/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGeneratorTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGeneratorTestCase.java?rev=986740&r1=986739&r2=986740&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGeneratorTestCase.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGeneratorTestCase.java Wed Aug 18 15:28:56 2010
@@ -55,7 +55,7 @@ public class Interface2WSDLGeneratorTest
         JavaInterface iface = iFactory.createJavaInterface(TestJavaInterface.class);
         DefaultDataBindingExtensionPoint dataBindings = new DefaultDataBindingExtensionPoint(new DefaultExtensionPointRegistry());
         JAXWSFaultExceptionMapper faultExceptionMapper = new JAXWSFaultExceptionMapper(dataBindings, null);
-        new JAXWSJavaInterfaceProcessor(dataBindings, faultExceptionMapper, null).visitInterface(iface);
+        new JAXWSJavaInterfaceProcessor(registry).visitInterface(iface);
         new DataBindingJavaInterfaceProcessor(registry).visitInterface(iface);
         DefaultFactoryExtensionPoint modelFactories = new DefaultFactoryExtensionPoint(registry);
         WSDLFactory wFactory = new DefaultWSDLFactory(registry);

Modified: tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassLoaderModelResolver.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassLoaderModelResolver.java?rev=986740&r1=986739&r2=986740&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassLoaderModelResolver.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassLoaderModelResolver.java Wed Aug 18 15:28:56 2010
@@ -49,6 +49,10 @@ public class ClassLoaderModelResolver ex
     private WeakReference<Contribution> contribution;
     private ProcessorContext context;
     private Map<String, ModelResolver> importResolvers = new HashMap<String, ModelResolver>();
+    
+    // a space to pass back the contribution that was used to resolve
+    // a class via an import
+    private Contribution contributionContainingClass;
 
     private static ClassLoader parentClassLoader(Contribution contribution) {
         if (contribution.getClassLoader() != null) {
@@ -107,10 +111,15 @@ public class ClassLoaderModelResolver ex
 
         try {
             this.context = context;
+            contributionContainingClass = contribution.get();
+            
             // Load the class and return a class reference for it
             String className = ((ClassReference)unresolved).getClassName();
             Class<?> clazz = Class.forName(className, false, this);
-            return modelClass.cast(new ClassReference(clazz));
+            ClassReference classReference = new ClassReference(clazz);
+            classReference.setContributionContainingClass(contributionContainingClass);
+            contributionContainingClass = null;
+            return modelClass.cast(classReference);
 
         } catch (ClassNotFoundException e) {
             return unresolved;
@@ -160,6 +169,7 @@ public class ClassLoaderModelResolver ex
         if (importResolver != null) {
             ClassReference classReference = importResolver.resolveModel(ClassReference.class, new ClassReference(name), context);
             if (!classReference.isUnresolved()) {
+                contributionContainingClass = classReference.getContributionContainingClass();
                 return classReference.getJavaClass();
             }
         }

Modified: tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java?rev=986740&r1=986739&r2=986740&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java Wed Aug 18 15:28:56 2010
@@ -494,27 +494,39 @@ public class RuntimeEndpointImpl extends
         
         InterfaceContract serviceContract = getComponentServiceInterfaceContract();
         InterfaceContract bindingContract = getBindingInterfaceContract();
-
+                
         if ((serviceContract != null) &&
             (bindingContract != null)){
            
             boolean bindingHasCallback = bindingContract.getCallbackInterface() != null;
             
             try {
-                if ((serviceContract.getClass() != bindingContract.getClass()) &&
-                    (serviceContract instanceof JavaInterfaceContract)) {
-                        interfaceContractMapper.checkCompatibility(getGeneratedWSDLContract(serviceContract), 
-                                                                   bindingContract, 
-                                                                   Compatibility.SUBSET, 
-                                                                   !bindingHasCallback, // ignore callbacks if binding doesn't have one 
-                                                                   false);
-                    } else {
-                        interfaceContractMapper.checkCompatibility(serviceContract, 
-                                                                   bindingContract, 
-                                                                   Compatibility.SUBSET, 
-                                                                   !bindingHasCallback, // ignore callbacks if binding doesn't have one 
-                                                                   false);                   
-                    }                 
+/*                
+                interfaceContractMapper.checkCompatibility(getGeneratedWSDLContract(serviceContract), 
+                                                           getGeneratedWSDLContract(bindingContract), 
+                                                           Compatibility.SUBSET, 
+                                                           !bindingHasCallback, // ignore callbacks if binding doesn't have one 
+                                                           false);
+*/                                                           
+               
+                // Use the normalized contract if the interface types are different or if 
+                // a normalized contract has been previously generate, for example, by virtue
+                // of finding a JAXWS annotation on a Java class that references a WSDL file
+                if (serviceContract.getClass() != bindingContract.getClass() ||
+                    serviceContract.getNormalizedWSDLContract() != null ||
+                    bindingContract.getNormalizedWSDLContract() != null) {
+                    interfaceContractMapper.checkCompatibility(getGeneratedWSDLContract(serviceContract), 
+                                                               getGeneratedWSDLContract(bindingContract), 
+                                                               Compatibility.SUBSET, 
+                                                               !bindingHasCallback, // ignore callbacks if binding doesn't have one 
+                                                               false);
+                } else {
+                    interfaceContractMapper.checkCompatibility(serviceContract, 
+                                                               bindingContract, 
+                                                               Compatibility.SUBSET, 
+                                                               !bindingHasCallback, // ignore callbacks if binding doesn't have one 
+                                                               false);                   
+                }  
             } catch (Exception ex){
                 throw new ServiceRuntimeException("Component " +
                                                   this.getComponent().getName() +
@@ -817,7 +829,7 @@ public class RuntimeEndpointImpl extends
                 if (contractBuilder == null){
                     throw new ServiceRuntimeException("Contract builder not found while calculating WSDL contract for " + this.toString());
                 }
-                contractBuilder.build(getComponentServiceInterfaceContract(), null);
+                contractBuilder.build(interfaceContract, null);
             }
         }
         

Modified: tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java?rev=986740&r1=986739&r2=986740&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java Wed Aug 18 15:28:56 2010
@@ -325,15 +325,25 @@ public class RuntimeEndpointReferenceImp
         
        if ((referenceContract != null) &&
            (bindingContract != null)){
-           
+                      
            boolean bindingHasCallback = bindingContract.getCallbackInterface() != null;
 
            try {
-               
-               if ((referenceContract.getClass() != bindingContract.getClass()) &&
-                   (referenceContract instanceof JavaInterfaceContract)) {
+/*               
+               interfaceContractMapper.checkCompatibility(getGeneratedWSDLContract(referenceContract), 
+                                                          getGeneratedWSDLContract(bindingContract), 
+                                                          Compatibility.SUBSET, 
+                                                          !bindingHasCallback, // ignore callbacks if binding doesn't have one 
+                                                          false);               
+*/
+               // Use the normalized contract if the interface types are different or if 
+               // a normalized contract has been previously generate, for example, by virtue
+               // of finding a JAXWS annotation on a Java class that references a WSDL file
+               if (referenceContract.getClass() != bindingContract.getClass() ||
+                   referenceContract.getNormalizedWSDLContract() != null ||
+                   bindingContract.getNormalizedWSDLContract() != null) {
                    interfaceContractMapper.checkCompatibility(getGeneratedWSDLContract(referenceContract), 
-                                                              bindingContract, 
+                                                              getGeneratedWSDLContract(bindingContract), 
                                                               Compatibility.SUBSET, 
                                                               !bindingHasCallback, // ignore callbacks if binding doesn't have one 
                                                               false);
@@ -344,7 +354,6 @@ public class RuntimeEndpointReferenceImp
                                                               !bindingHasCallback, // ignore callbacks if binding doesn't have one 
                                                               false);                   
                }  
-
            } catch (Exception ex){
                throw new ServiceRuntimeException("Component " +
                                                  this.getComponent().getName() +
@@ -608,7 +617,7 @@ public class RuntimeEndpointReferenceImp
                 if (contractBuilder == null){
                     throw new ServiceRuntimeException("Contract builder not found while calculating WSDL contract for " + this.toString());
                 }
-                contractBuilder.build(getComponentReferenceInterfaceContract(), null);
+                contractBuilder.build(interfaceContract, null);
             }
         }
         

Modified: tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java?rev=986740&r1=986739&r2=986740&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java Wed Aug 18 15:28:56 2010
@@ -44,7 +44,10 @@ import org.apache.tuscany.sca.core.Facto
 import org.apache.tuscany.sca.core.UtilityExtensionPoint;
 import org.apache.tuscany.sca.core.assembly.impl.RuntimeEndpointReferenceImpl;
 import org.apache.tuscany.sca.definitions.Definitions;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
 import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
 import org.apache.tuscany.sca.interfacedef.util.Audit;
 import org.apache.tuscany.sca.monitor.Monitor;
 import org.apache.tuscany.sca.monitor.MonitorFactory;
@@ -776,7 +779,10 @@ public class EndpointReferenceBinderImpl
     private boolean haveMatchingInterfaceContracts(EndpointReference endpointReference, Endpoint endpoint, Audit matchAudit){
         matchAudit.append("Match interface of " + endpointReference.toString() + " to " + endpoint.toString() + " ");
         
-        if (endpointReference.getReference().getInterfaceContract() == null){
+        InterfaceContract endpointReferenceContract = endpointReference.getReference().getInterfaceContract();
+        InterfaceContract endpointContract = endpoint.getComponentServiceInterfaceContract();
+        
+        if (endpointReferenceContract == null){
             matchAudit.append("Match because there is no interface contract on the reference ");
             matchAudit.appendSeperator();
             return true;
@@ -784,7 +790,8 @@ public class EndpointReferenceBinderImpl
         
         // TODO - is there a better test for this. Would have to cast to the
         //        correct iface type to get to the resolved flag
-        if (endpoint.getComponentServiceInterfaceContract().getInterface().getOperations().size() == 0){
+        //        We need to rely on normailzed interfaces in this case!!
+        if (endpointContract.getInterface().getOperations().size() == 0){
             // the interface contract is likely remote but unresolved
             // we discussed this on the ML and decided that we could
             // live with this for the case where there is no central matching of references
@@ -793,13 +800,23 @@ public class EndpointReferenceBinderImpl
             matchAudit.appendSeperator();
             return true;
         }
+        
+        // If the contracts are not of the same type or normalized interfaces are available
+        // use them
+        if (endpointReferenceContract.getClass() != endpointContract.getClass() ||
+            endpointReferenceContract.getNormalizedWSDLContract() != null ||
+             endpointContract.getNormalizedWSDLContract() != null) {
+            endpointReferenceContract = ((RuntimeEndpointReference)endpointReference).getGeneratedWSDLContract(endpointReferenceContract);
+            endpointContract = ((RuntimeEndpoint)endpoint).getGeneratedWSDLContract(endpointContract);
+        }        
              
         boolean match = false;
-        match = interfaceContractMapper.isCompatibleSubset(endpointReference.getReference().getInterfaceContract(), 
-                                                     endpoint.getComponentServiceInterfaceContract(), matchAudit);
+        match = interfaceContractMapper.isCompatibleSubset(endpointReferenceContract, 
+                                                           endpointContract, 
+                                                           matchAudit);
         
         if (!match){
-            matchAudit.append("Match failed because the linterface contract mapper failed ");
+            matchAudit.append("Match failed because the interface contract mapper failed ");
         } else {
             matchAudit.append("Match because the interface contract mapper succeeded ");
         }

Modified: tuscany/sca-java-2.x/trunk/modules/domain-node/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/pom.xml?rev=986740&r1=986739&r2=986740&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain-node/pom.xml (original)
+++ tuscany/sca-java-2.x/trunk/modules/domain-node/pom.xml Wed Aug 18 15:28:56 2010
@@ -62,6 +62,13 @@
             <version>2.0-SNAPSHOT</version>
             <scope>test</scope>
         </dependency>  
+        
+         <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-binding-ws-wsdlgen</artifactId>
+            <version>2.0-SNAPSHOT</version>
+            <scope>test</scope>
+        </dependency>         
 
     </dependencies>
 

Modified: tuscany/sca-java-2.x/trunk/modules/implementation-java/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-java/pom.xml?rev=986740&r1=986739&r2=986740&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-java/pom.xml (original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-java/pom.xml Wed Aug 18 15:28:56 2010
@@ -43,6 +43,12 @@
         
         <dependency>
             <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-interface-java-jaxws</artifactId>
+            <version>2.0-SNAPSHOT</version>
+        </dependency>        
+        
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
             <artifactId>tuscany-interface-wsdl</artifactId>
             <version>2.0-SNAPSHOT</version>
         </dependency>        

Modified: tuscany/sca-java-2.x/trunk/modules/interface-java-jaxws/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/interface-java-jaxws/META-INF/MANIFEST.MF?rev=986740&r1=986739&r2=986740&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/interface-java-jaxws/META-INF/MANIFEST.MF (original)
+++ tuscany/sca-java-2.x/trunk/modules/interface-java-jaxws/META-INF/MANIFEST.MF Wed Aug 18 15:28:56 2010
@@ -38,6 +38,7 @@ Import-Package: javax.jws,
  org.apache.tuscany.sca.interfacedef.java.introspect;version="2.0.0",
  org.apache.tuscany.sca.interfacedef.java.jaxws;version="2.0.0",
  org.apache.tuscany.sca.interfacedef.util;version="2.0.0",
+ org.apache.tuscany.sca.interfacedef.wsdl;version="2.0.0",
  org.apache.tuscany.sca.policy;version="2.0.0",
  org.oasisopen.sca;version="2.0.0",
  org.oasisopen.sca.annotation;version="2.0.0";resolution:=optional,

Modified: tuscany/sca-java-2.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java?rev=986740&r1=986739&r2=986740&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java Wed Aug 18 15:28:56 2010
@@ -41,6 +41,7 @@ import javax.xml.ws.ResponseWrapper;
 import javax.xml.ws.WebServiceProvider;
 
 import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.FactoryExtensionPoint;
 import org.apache.tuscany.sca.core.UtilityExtensionPoint;
 import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
 import org.apache.tuscany.sca.databinding.javabeans.JavaExceptionDataBinding;
@@ -52,6 +53,8 @@ import org.apache.tuscany.sca.interfaced
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
 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.java.introspect.JavaInterfaceVisitor;
 import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
@@ -59,6 +62,7 @@ import org.apache.tuscany.sca.interfaced
 import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
 import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
 import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
 
 /**
  * Introspect the java class/interface with JSR-181 and JAXWS annotations
@@ -71,22 +75,18 @@ public class JAXWSJavaInterfaceProcessor
     private DataBindingExtensionPoint dataBindingExtensionPoint;
     private FaultExceptionMapper faultExceptionMapper;
     private XMLAdapterExtensionPoint xmlAdapterExtensionPoint;
+    protected JavaInterfaceFactory javaInterfaceFactory;
+    private WSDLFactory wsdlFactory;
 
 
     public JAXWSJavaInterfaceProcessor(ExtensionPointRegistry registry) {
         dataBindingExtensionPoint = registry.getExtensionPoint(DataBindingExtensionPoint.class);
         faultExceptionMapper = registry.getExtensionPoint(UtilityExtensionPoint.class).getUtility(FaultExceptionMapper.class);
         xmlAdapterExtensionPoint = registry.getExtensionPoint(XMLAdapterExtensionPoint.class);
-    }
-    
-    
-    public JAXWSJavaInterfaceProcessor(DataBindingExtensionPoint dataBindingExtensionPoint,
-                                       FaultExceptionMapper faultExceptionMapper,
-                                       XMLAdapterExtensionPoint xmlAdapters) {
-        super();
-        this.dataBindingExtensionPoint = dataBindingExtensionPoint;
-        this.faultExceptionMapper = faultExceptionMapper;
-        this.xmlAdapterExtensionPoint = xmlAdapters;
+        
+        FactoryExtensionPoint factories = registry.getExtensionPoint(FactoryExtensionPoint.class);
+        this.javaInterfaceFactory = factories.getFactory(JavaInterfaceFactory.class);
+        this.wsdlFactory = factories.getFactory(WSDLFactory.class);
     }
 
     public JAXWSJavaInterfaceProcessor() {
@@ -104,8 +104,17 @@ public class JAXWSJavaInterfaceProcessor
     public void visitInterface(JavaInterface contract) throws InvalidInterfaceException {
 
         final Class<?> clazz = contract.getJavaClass();
-        WebService webService = clazz.getAnnotation(WebService.class);
         
+        contract = JAXWSUtils.configureJavaInterface(contract, clazz);
+        String tns = contract.getQName().getNamespaceURI();
+       
+        // TODO - the following code repeats the name determination code in the
+        // utils class. Do name determination separately from interface config.
+        // - determine service name
+        // - determine interface class name
+        // - determine wsdl file name
+/*       
+        WebService webService = clazz.getAnnotation(WebService.class);
         String tns = JavaXMLMapper.getNamespace(clazz);
         String localName = clazz.getSimpleName();
         if (webService != null) {
@@ -123,7 +132,8 @@ public class JAXWSJavaInterfaceProcessor
             contract.setQName(new QName(tns, localName));
             // Mark SEI as Remotable
             contract.setRemotable(true);
-        }
+        }    
+*/        
         
         if (!contract.isRemotable()) {
             return;

Added: tuscany/sca-java-2.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSUtils.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSUtils.java?rev=986740&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSUtils.java (added)
+++ tuscany/sca-java-2.x/trunk/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSUtils.java Wed Aug 18 15:28:56 2010
@@ -0,0 +1,310 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.interfacedef.java.jaxws;
+
+import javax.jws.WebService;
+import javax.xml.namespace.QName;
+import javax.xml.ws.WebServiceProvider;
+
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper;
+
+
+/**
+ * A set of utility methods for processing JAXWS annotations that are 
+ * shared between Java inteface and implementation processing
+ */
+public class JAXWSUtils {
+    
+    /**
+     * JAXWS annotations may identify a service interface via either
+     *   - an interface class name, e.g. @WebService(endpointInterface="my.service.ServiceImpl") 
+     *   - a wsdl file name, e.g. @WebService(wsdlLocation="some.wsdl")
+     *   - a Java class/interface, e.g. @WebService
+     * This operation configures the Java interface based on these separate pieces
+     * of information. The resulting interface contract must be subsequently resolved in order that
+     * the named endpoint interface class or wsdl file is found
+     *   
+     * @param javaInterface the Tuscany representation of the Java interface
+     * @param clazz the Java class that the interface refers to (may have JAXWS annotations)
+     * @return
+     */
+    public static JavaInterface configureJavaInterface(JavaInterface javaInterface,
+                                                       Class<?> clazz){
+        
+        String servineNamespace = JavaXMLMapper.getNamespace(clazz);
+        String serviceName = clazz.getSimpleName();
+        QName serviceQName = null;
+        String serviceInterfaceClassName = null;
+        String wsdlFileName = null;
+        
+        WebService webServiceAnnotation = clazz.getAnnotation(WebService.class);
+        if (webServiceAnnotation != null) {
+            servineNamespace = getValue(webServiceAnnotation.targetNamespace(), servineNamespace);
+            serviceName = getValue(webServiceAnnotation.name(), serviceName);
+            serviceInterfaceClassName = webServiceAnnotation.endpointInterface();
+            wsdlFileName = webServiceAnnotation.wsdlLocation();
+            javaInterface.setRemotable(true);
+        }
+        
+        WebServiceProvider webServiceProviderAnnotation = clazz.getAnnotation(WebServiceProvider.class);
+        if (webServiceProviderAnnotation != null) {
+            servineNamespace = getValue(webServiceProviderAnnotation.targetNamespace(), servineNamespace);
+            serviceName = getValue(webServiceProviderAnnotation.serviceName(), serviceName);
+            wsdlFileName = webServiceAnnotation.wsdlLocation();
+            javaInterface.setRemotable(true);
+        }  
+        
+        serviceQName = new QName(servineNamespace, serviceName);
+        javaInterface.setQName(serviceQName);
+        
+        // use the provided Java interface name to overwrite
+        // any Java interface created from an implemented interfaces
+        if (serviceInterfaceClassName != null &&
+                serviceInterfaceClassName.length() > 0){
+            javaInterface.setName(serviceInterfaceClassName);
+            javaInterface.setJAXWSJavaInterfaceName(serviceInterfaceClassName);
+            javaInterface.setUnresolved(true);
+        } 
+        
+        // Store the WSDL location if it's specified in 
+        // the @WebService annotation. Later this is resolved and is attached 
+        // to the Java interface contract in the normalized space so that effectively the contract
+        // has both Java and WSDL interfaces. This allows databinding to 
+        // operate correctly as it still expects a Java interface for a Java implementation
+        if (wsdlFileName != null &&
+            wsdlFileName.length() > 0){         
+            javaInterface.setJAXWSWSDLLocation(wsdlFileName);
+        }  
+        
+        return javaInterface;
+    }      
+    
+    /**
+     * Given a class that may have @WebService or @WebServiceProvider 
+     * annotations this determines what the service QName should be. 
+     * 
+     * @param clazz
+     * @return
+     */
+/*    
+    public static QName calculateServiceQName(JavaInterface javaInterface, Class<?> clazz){
+        WebService webServiceAnnotation = clazz.getAnnotation(WebService.class);
+        String servineNamespace = JavaXMLMapper.getNamespace(clazz);
+        String serviceName = clazz.getSimpleName();
+        if (webServiceAnnotation != null) {
+            servineNamespace = getValue(webServiceAnnotation.targetNamespace(), servineNamespace);
+            serviceName = getValue(webServiceAnnotation.name(), serviceName);
+            javaInterface.setRemotable(true);
+        }
+        
+        WebServiceProvider webServiceProviderAnnotation = clazz.getAnnotation(WebServiceProvider.class);
+        if (webServiceProviderAnnotation != null) {
+            servineNamespace = getValue(webServiceProviderAnnotation.targetNamespace(), servineNamespace);
+            serviceName = getValue(webServiceProviderAnnotation.serviceName(), serviceName);
+            javaInterface.setRemotable(true);
+        }  
+        
+        QName serviceQName = new QName(servineNamespace, serviceName);
+        javaInterface.setQName(serviceQName);
+        
+        return serviceQName;
+    }
+*/
+    
+    /**
+     * Given a class that may have @WebService or @WebServiceProvider 
+     * annotations this determines what the name of the Java class 
+     * that defines the service interface should be 
+     * 
+     * @param clazz
+     * @return
+     */
+/*    
+    public static String calculateServiceInterfaceJavaClassName(JavaInterface javaInterface, Class<?> clazz){
+        String serviceInterfaceClassName = null;
+        
+        WebService webServiceAnnotation = clazz.getAnnotation(WebService.class);        
+        if (webServiceAnnotation != null) {
+            serviceInterfaceClassName = webServiceAnnotation.endpointInterface();
+            javaInterface.setRemotable(true);
+        } 
+        
+        return serviceInterfaceClassName;
+    } 
+*/ 
+    
+    /**
+     * Given a class that may have @WebService or @WebServiceProvider 
+     * annotations this determines what the name of the WSDL file is  
+     * that defines the service interface should be 
+     * 
+     * @param clazz
+     * @return
+     */
+/*    
+    public static String calculateServiceInterfaceWSDLLocation(JavaInterface javaInterface, Class<?> clazz){
+        WebService webServiceAnnotation = clazz.getAnnotation(WebService.class);
+        String wsdlLocation = null;
+        
+        if (webServiceAnnotation != null) {
+            wsdlLocation = webServiceAnnotation.wsdlLocation();
+            javaInterface.setRemotable(true);
+        } 
+        
+        WebServiceProvider webServiceProviderAnnotation = clazz.getAnnotation(WebServiceProvider.class);
+        
+        if (webServiceProviderAnnotation != null) {
+            wsdlLocation = webServiceProviderAnnotation.wsdlLocation();
+            javaInterface.setRemotable(true);
+        } 
+        
+        return wsdlLocation;
+    }     
+*/    
+    
+    /**
+     * JAXWS annotations may identify a service interface via either
+     *   - an interface class name, e.g. @WebService(endpointInterface="my.service.ServiceImpl") 
+     *   - a wsdl file name, e.g. @WebService(wsdlLocation="some.wsdl")
+     *   - a Java class/interface, e.g. @WebService
+     * This operation configures the Java interface based on these separate pieces
+     * of information. The resulting interface contract must be subsequently resolved in order that
+     * the named endpoint interface class or wsdl file is found
+     *   
+     * @param javaInterface
+     * @param servicceQName
+     * @param javaInterfaceName
+     * @param wsdlFileName
+     * @return
+     */
+/*    
+    public static JavaInterface configureJavaInterface(JavaInterface javaInterface,
+                                                       QName serviceQName,
+                                                       String javaInterfaceName, 
+                                                       String wsdlFileName)  throws InvalidInterfaceException {
+        
+        // use the provided Java interface name to overwrite
+        // any Java contract created from an implemented interfaces
+        if (javaInterfaceName != null &&
+            javaInterfaceName.length() > 0){
+            javaInterface.setName(javaInterfaceName);
+            javaInterface.setJAXWSJavaInterfaceName(javaInterfaceName);
+            javaInterface.setQName(serviceQName);
+            javaInterface.setUnresolved(true);
+        } else {
+            // we use the bean class as the service interface if no interface
+            // has already been set. This should have already been resolved
+            javaInterface.setQName(serviceQName);
+        }
+        
+        // Store the WSDL location if it's specified in 
+        // the @WebService annotation. Later this is resolved and is attached 
+        // to the Java interface contract in the normalized space so that effectively the contract
+        // has both Java and WSDL interfaces. This allows databinding to 
+        // operate correctly as it still expects a Java interface for a Java implementation
+        if (wsdlFileName != null &&
+            wsdlFileName.length() > 0){         
+            javaInterface.setJAXWSWSDLLocation(wsdlFileName);
+        }  
+        
+        return javaInterface;
+    }  
+*/
+    
+    
+    /**
+     * JAXWS annotations may identify a service interface via either
+     *   - an interface class name, e.g. @WebService(endpointInterface="my.service.ServiceImpl") 
+     *   - a wsdl file name, e.g. @WebService(wsdlLocation="some.wsdl")
+     *   - a Java class/interface, e.g. @WebService
+     * This operation creates the right sort of interface contract based on these separate pieces
+     * of information. The resulting interface contract must be subsequently resolved in order that
+     * the named endpoint interface class or wsdl file is found
+     *   
+     * @param javaInterfaceFactory
+     * @param wsdlInterfaceFactory
+     * @param clazz
+     * @param javaInterfaceName
+     * @param wsdlFileName
+     * @return
+     * @throws InvalidInterfaceException
+     */
+/*    
+    public static JavaInterfaceContract configureJavaInterface(JavaInterfaceFactory javaInterfaceFactory, 
+                                                               WSDLFactory wsdlFactory,
+                                                               JavaInterfaceContract javaInterfaceContract,
+                                                               Class<?> clazz, 
+                                                               QName serviceQName,
+                                                               String javaInterfaceName, 
+                                                               String wsdlFileName)  throws InvalidInterfaceException {
+        
+        // use the provided Java interface name to overwrite
+        // any Java contract created from an implemented interfaces
+        if (javaInterfaceName != null &&
+            javaInterfaceName.length() > 0){
+            JavaInterface callInterface = javaInterfaceFactory.createJavaInterface();
+            callInterface.setName(javaInterfaceName);
+            callInterface.setQName(serviceQName);
+            callInterface.setRemotable(true);
+            callInterface.setUnresolved(true);
+            javaInterfaceContract.setInterface(callInterface);
+        } else {
+            // we use the bean class as the service interface if no interface
+            // has already been set
+            if (javaInterfaceContract.getInterface() == null){
+                JavaInterface callInterface = javaInterfaceFactory.createJavaInterface(clazz);
+                callInterface.setQName(serviceQName);
+                callInterface.setRemotable(true);
+                callInterface.setUnresolved(false); // this will already be false but this makes it easy to follow the logic
+                javaInterfaceContract.setInterface(callInterface);
+            } else {
+                JavaInterface callInterface = (JavaInterface)javaInterfaceContract.getInterface();
+                callInterface.setRemotable(true);
+                callInterface.setQName(serviceQName);
+            }
+        }
+        
+        // create the logical WSDL interface if it's specified in 
+        // the @WebService annotation. This is attached to the Java interface
+        // contract in the normalized space so that effectively the contract
+        // has both Java and WSDL interfaces. This allows databinding to 
+        // operate correctly as it expects a Java interface for a Java implementation
+        if (wsdlFileName != null &&
+            wsdlFileName.length() > 0){         
+            WSDLInterface callInterface = wsdlFactory.createWSDLInterface();
+            callInterface.setUnresolved(true);
+            callInterface.setRemotable(true);
+            
+            WSDLInterfaceContract wsdlInterfaceContract = wsdlFactory.createWSDLInterfaceContract();
+            wsdlInterfaceContract.setInterface(callInterface);
+            wsdlInterfaceContract.setLocation(wsdlFileName);
+            javaInterfaceContract.setNormailizedWSDLContract(wsdlInterfaceContract);
+        }  
+        
+        return javaInterfaceContract;
+    }
+*/
+    
+    private static String getValue(String value, String defaultValue) {
+        return "".equals(value) ? defaultValue : value;
+    }    
+}

Modified: tuscany/sca-java-2.x/trunk/modules/interface-java/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/interface-java/META-INF/MANIFEST.MF?rev=986740&r1=986739&r2=986740&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/interface-java/META-INF/MANIFEST.MF (original)
+++ tuscany/sca-java-2.x/trunk/modules/interface-java/META-INF/MANIFEST.MF Wed Aug 18 15:28:56 2010
@@ -23,6 +23,7 @@ Import-Package: javax.xml.namespace,
  javax.xml.stream,
  org.apache.tuscany.sca.assembly;version="2.0.0",
  org.apache.tuscany.sca.assembly.xml;version="2.0.0",
+ org.apache.tuscany.sca.contribution;version="2.0.0",
  org.apache.tuscany.sca.contribution.processor;version="2.0.0",
  org.apache.tuscany.sca.contribution.resolver;version="2.0.0",
  org.apache.tuscany.sca.core;version="2.0.0",
@@ -34,6 +35,7 @@ Import-Package: javax.xml.namespace,
  org.apache.tuscany.sca.interfacedef.java.impl;version="2.0.0",
  org.apache.tuscany.sca.interfacedef.java.introspect;version="2.0.0",
  org.apache.tuscany.sca.interfacedef.util;version="2.0.0",
+ org.apache.tuscany.sca.interfacedef.wsdl;version="2.0.0",
  org.apache.tuscany.sca.monitor;version="2.0.0",
  org.apache.tuscany.sca.policy;version="2.0.0",
  org.oasisopen.sca;version="2.0.0",

Modified: tuscany/sca-java-2.x/trunk/modules/interface-java/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/interface-java/pom.xml?rev=986740&r1=986739&r2=986740&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/interface-java/pom.xml (original)
+++ tuscany/sca-java-2.x/trunk/modules/interface-java/pom.xml Wed Aug 18 15:28:56 2010
@@ -52,6 +52,12 @@
             <artifactId>tuscany-contribution</artifactId>
             <version>2.0-SNAPSHOT</version>
         </dependency>
+        
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-interface-wsdl</artifactId>
+            <version>2.0-SNAPSHOT</version>
+        </dependency>              
 
     </dependencies>
 

Modified: tuscany/sca-java-2.x/trunk/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java?rev=986740&r1=986739&r2=986740&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java Wed Aug 18 15:28:56 2010
@@ -43,10 +43,17 @@ import org.apache.tuscany.sca.contributi
 import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
 import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.core.FactoryExtensionPoint;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.Compatibility;
+import org.apache.tuscany.sca.interfacedef.IncompatibleInterfaceContractException;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
 import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
 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.wsdl.WSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
 import org.apache.tuscany.sca.monitor.Monitor;
 import org.apache.tuscany.sca.monitor.Problem;
 import org.apache.tuscany.sca.monitor.Problem.Severity;
@@ -77,13 +84,20 @@ public class JavaInterfaceProcessor impl
     private ExtensionPointRegistry extensionPoints;
     private PolicyFactory policyFactory;
     private PolicySubjectProcessor policyProcessor;
+    private WSDLFactory wsdlFactory;
+    private StAXArtifactProcessor<Object> extensionProcessor;
+    private transient InterfaceContractMapper interfaceContractMapper;
 
-    public JavaInterfaceProcessor(ExtensionPointRegistry extensionPoints) {
+    public JavaInterfaceProcessor(ExtensionPointRegistry extensionPoints,  StAXArtifactProcessor<?> staxProcessor) {
         this.extensionPoints = extensionPoints;
         FactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class);
         this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
         this.policyProcessor = new PolicySubjectProcessor(policyFactory);
         this.javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
+        this.wsdlFactory = modelFactories.getFactory(WSDLFactory.class);
+        this.extensionProcessor = (StAXArtifactProcessor<Object>)staxProcessor;
+        UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
+        this.interfaceContractMapper = utilities.getUtility(InterfaceContractMapper.class);
     }
     
     /**
@@ -212,6 +226,10 @@ public class JavaInterfaceProcessor impl
                     // Introspect the Java interface and populate the interface and
                     // operations
                     javaFactory.createJavaInterface(javaInterface, javaClass);
+                    
+                    // cache the contribution that was used to resolve the Java interface
+                    // in case we need it to reolve a referenced WSDL file
+                    javaInterface.setContributionContainingClass(classReference.getContributionContainingClass());
                 
                 } catch (InvalidInterfaceException e) {
                 	ContributionResolveException ce = new ContributionResolveException("Resolving Java interface " + javaInterface.getName(), e);
@@ -243,6 +261,8 @@ public class JavaInterfaceProcessor impl
             JavaInterface javaCallbackInterface =
                 resolveJavaInterface((JavaInterface)javaInterfaceContract.getCallbackInterface(), resolver, context);
             javaInterfaceContract.setCallbackInterface(javaCallbackInterface);
+            
+            postJAXWSProcessorResolve(javaInterfaceContract, resolver, context);
 	        
 	        checkForbiddenAnnotations(monitor, javaInterfaceContract);
 	        
@@ -367,4 +387,59 @@ public class JavaInterfaceProcessor impl
     public Class<JavaInterfaceContract> getModelType() {
         return JavaInterfaceContract.class;
     }
+    
+    private void postJAXWSProcessorResolve(JavaInterfaceContract javaInterfaceContract, ModelResolver resolver, ProcessorContext context)
+        throws ContributionResolveException, IncompatibleInterfaceContractException {
+        
+        JavaInterface javaInterface = (JavaInterface)javaInterfaceContract.getInterface();
+        
+        // the Java interface may now be marked as unresolved due to a new Java interface 
+        // name retrieved from JAXWS annotations. Resolve it again if it is.
+        if (javaInterface != null && javaInterface.isUnresolved()){
+            javaInterface = resolveJavaInterface(javaInterface, resolver, context);
+            javaInterfaceContract.setInterface(javaInterface);
+        }
+        
+        JavaInterface javaCallbackInterface = (JavaInterface)javaInterfaceContract.getCallbackInterface();
+        // the Java callback interface may now be marked as unresolved due to a new Java interface 
+        // name retrieved from JAXWS annotations. Resolve it again if it is.
+        if (javaCallbackInterface != null && javaCallbackInterface.isUnresolved()){
+            javaCallbackInterface = resolveJavaInterface(javaCallbackInterface, resolver, context);
+            javaInterfaceContract.setCallbackInterface(javaCallbackInterface);
+        }
+        
+        // the Java interface may be replaced by a WSDL contract picked up from JAXWS annotation
+        // if so we need to fluff up a WSDL contract and set it to be the normalized contract
+        // for the Java interface so it's used during contract mapping
+        if (javaInterface != null && javaInterface.getJAXWSWSDLLocation() != null){
+            WSDLInterface wsdlInterface = wsdlFactory.createWSDLInterface();
+            wsdlInterface.setUnresolved(true);
+            wsdlInterface.setRemotable(true);
+            
+            WSDLInterfaceContract wsdlInterfaceContract = wsdlFactory.createWSDLInterfaceContract();
+            wsdlInterfaceContract.setInterface(wsdlInterface);
+            wsdlInterfaceContract.setLocation(javaInterface.getJAXWSWSDLLocation());
+            javaInterfaceContract.setNormailizedWSDLContract(wsdlInterfaceContract);
+            
+            ProcessorContext wsdlContext = new ProcessorContext(javaInterface.getContributionContainingClass(), 
+                                                                context.getMonitor());
+            extensionProcessor.resolve(wsdlInterfaceContract, resolver, wsdlContext);
+            
+            // check that the Java and WSDL contracts are compatible
+            interfaceContractMapper.checkCompatibility(wsdlInterfaceContract,
+                                                       javaInterfaceContract, 
+                                                       Compatibility.SUBSET, 
+                                                       false, 
+                                                       false);
+            
+            // copy policy from the WSDL interface to the Java interface
+            javaInterface.getPolicySets().addAll(wsdlInterface.getPolicySets());
+            javaInterface.getRequiredIntents().addAll(wsdlInterface.getRequiredIntents());
+            
+           // TODO - is there anything else to be copied from the user specified WSDL?
+            
+        }
+        
+        // TODO - how to handle callbacks as the location is stored at the contract level?        
+    }      
 }

Modified: tuscany/sca-java-2.x/trunk/modules/interface-wsdl/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/interface-wsdl/pom.xml?rev=986740&r1=986739&r2=986740&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/interface-wsdl/pom.xml (original)
+++ tuscany/sca-java-2.x/trunk/modules/interface-wsdl/pom.xml Wed Aug 18 15:28:56 2010
@@ -59,12 +59,12 @@
             <version>2.0-SNAPSHOT</version>
         </dependency>
         
-        <dependency>
+        <!-- dependency>
             <groupId>org.apache.tuscany.sca</groupId>
             <artifactId>tuscany-binding-sca-runtime</artifactId>
             <version>2.0-SNAPSHOT</version>
             <scope>test</scope>
-        </dependency>        
+        </dependency-->        
 
     </dependencies>
 

Modified: tuscany/sca-java-2.x/trunk/modules/node-impl/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/node-impl/pom.xml?rev=986740&r1=986739&r2=986740&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/node-impl/pom.xml (original)
+++ tuscany/sca-java-2.x/trunk/modules/node-impl/pom.xml Wed Aug 18 15:28:56 2010
@@ -102,6 +102,13 @@
             <version>2.0-SNAPSHOT</version>
             <scope>test</scope>
         </dependency>  
+        
+       <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-binding-ws-wsdlgen</artifactId>
+            <version>2.0-SNAPSHOT</version>
+            <scope>test</scope>
+        </dependency>          
               
     </dependencies>