Modified: tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositeComponentTypeBuilderImpl.java URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositeComponentTypeBuilderImpl.java?rev=963624&r1=963623&r2=963624&view=diff ============================================================================== --- tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositeComponentTypeBuilderImpl.java (original) +++ tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositeComponentTypeBuilderImpl.java Tue Jul 13 09:12:08 2010 @@ -42,6 +42,7 @@ import org.apache.tuscany.sca.assembly.S import org.apache.tuscany.sca.assembly.Service; import org.apache.tuscany.sca.assembly.builder.BuilderContext; import org.apache.tuscany.sca.assembly.builder.BuilderExtensionPoint; +import org.apache.tuscany.sca.assembly.builder.ContractBuilder; import org.apache.tuscany.sca.assembly.builder.Messages; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.FactoryExtensionPoint; @@ -51,6 +52,7 @@ import org.apache.tuscany.sca.interfaced import org.apache.tuscany.sca.interfacedef.IncompatibleInterfaceContractException; import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; +import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract; import org.apache.tuscany.sca.monitor.Monitor; import org.apache.tuscany.sca.policy.ExtensionType; import org.apache.tuscany.sca.policy.PolicySubject; @@ -73,6 +75,7 @@ public class CompositeComponentTypeBuild private SCABindingFactory scaBindingFactory; private InterfaceContractMapper interfaceContractMapper; private BuilderExtensionPoint builders; + private ContractBuilder contractBuilder; public CompositeComponentTypeBuilderImpl(ExtensionPointRegistry registry) { UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class); @@ -83,6 +86,7 @@ public class CompositeComponentTypeBuild interfaceContractMapper = utilities.getUtility(InterfaceContractMapper.class); builders = registry.getExtensionPoint(BuilderExtensionPoint.class); + contractBuilder = builders.getContractBuilder(); } public void setComponentBuilder(ComponentBuilderImpl componentBuilder) { @@ -434,7 +438,7 @@ public class CompositeComponentTypeBuild boolean isCompatible = true; String incompatibilityReason = ""; try{ - isCompatible = interfaceContractMapper.checkCompatibility(topInterfaceContract, bottomInterfaceContract, Compatibility.SUBSET, false, false); + isCompatible = checkSubsetCompatibility(topInterfaceContract, bottomInterfaceContract); } catch (IncompatibleInterfaceContractException ex){ isCompatible = false; incompatibilityReason = ex.getMessage(); @@ -447,6 +451,24 @@ public class CompositeComponentTypeBuild topContract.getName(), incompatibilityReason); } + + // TODO - there is an issue with the following code if the + // contracts of of different types. Need to use the + // normalized form + + // fix up the forward interface based on the promoted component + // Someone might have manually specified a callback interface but + // left out the forward interface + if (topInterfaceContract.getInterface() == null){ + topInterfaceContract.setInterface(bottomInterfaceContract.getInterface()); + } + + // fix up the callback interface based on the promoted component + // Someone might have manually specified a forward interface but + // left out the callback interface + if (topInterfaceContract.getCallbackInterface() == null){ + topInterfaceContract.setCallbackInterface(bottomInterfaceContract.getCallbackInterface()); + } } } @@ -472,7 +494,7 @@ public class CompositeComponentTypeBuild boolean isCompatible = true; String incompatibilityReason = ""; try{ - isCompatible = interfaceContractMapper.checkCompatibility(bottomInterfaceContract, topInterfaceContract, Compatibility.SUBSET, false, false); + isCompatible = checkSubsetCompatibility(bottomInterfaceContract, topInterfaceContract); } catch (IncompatibleInterfaceContractException ex){ isCompatible = false; incompatibilityReason = ex.getMessage(); @@ -485,6 +507,24 @@ public class CompositeComponentTypeBuild topContract.getName(), incompatibilityReason); } + + // TODO - there is an issue with the following code if the + // contracts of of different types. Need to use the + // normalized form + + // fix up the forward interface based on the promoted component + // Someone might have manually specified a callback interface but + // left out the forward interface + if (topInterfaceContract.getInterface() == null){ + topInterfaceContract.setInterface(bottomInterfaceContract.getInterface()); + } + + // fix up the callback interface based on the promoted component + // Someone might have manually specified a forward interface but + // left out the callback interface + if (topInterfaceContract.getCallbackInterface() == null){ + topInterfaceContract.setCallbackInterface(bottomInterfaceContract.getCallbackInterface()); + } } } @@ -616,4 +656,41 @@ public class CompositeComponentTypeBuild } } + /** + * A local wrapper for the interace contract mapper as we need to normalize the + * interface contracts if appropriate and the mapper doesn't have the right + * dependencies to be able to do it. + * + * Sometimes the two interfaces can be presented using different IDLs, for example + * Java and WSDL. In this case interfaces are converted so that they are both WSDL1.1 interfaces + * and they are then compared. The generated WSDL is cached on the interface object for + * any subsequent matching + * + * @param contractA + * @param contractB + * @return true if the interface contracts match + */ + private boolean checkSubsetCompatibility(InterfaceContract contractA, InterfaceContract contractB) + throws IncompatibleInterfaceContractException { + + if (contractA.getClass() != contractB.getClass()) { + + if (contractA instanceof JavaInterfaceContract){ + contractBuilder.build(contractA, null); + contractA = ((JavaInterfaceContract)contractA).getNormalizedWSDLContract(); + } + + if (contractB instanceof JavaInterfaceContract){ + contractBuilder.build(contractB, null); + contractB = ((JavaInterfaceContract)contractB).getNormalizedWSDLContract(); + } + } + + return interfaceContractMapper.checkCompatibility(contractA, + contractB, + Compatibility.SUBSET, + false, + false); + } + } //end class
Modified: tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeEndpoint.java URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeEndpoint.java?rev=963624&r1=963623&r2=963624&view=diff ============================================================================== --- tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeEndpoint.java (original) +++ tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeEndpoint.java Tue Jul 13 09:12:08 2010 @@ -58,10 +58,34 @@ public interface RuntimeEndpoint extends */ InterfaceContract getComponentTypeServiceInterfaceContract(); + + /** + * Check that endpoint has compatible interface at the component and binding ends. + * The user can specify the interfaces at both ends so there is a danger that they won't be compatible. + */ + void validateServiceInterfaceCompatibility(); + /** * Get the composite context for the composite that contains this endpoint. This * is useful for accessing various composite level objects from within the * runtime code */ CompositeContext getCompositeContext(); + + /** + * to allow for remote interface comparison we convert a Endpoint's Java interface + * to WSDL at build time. + * + * @param wsdlContract + */ +// void setGeneratedWSDLContract(InterfaceContract wsdlContract); + + /** + * to allow for remote interface comparison we convert a Endpoint's Java interface + * to WSDL at build time. + * + * @preturn wsdlContract + */ +// InterfaceContract getGeneratedWSDLContract(); + } Modified: tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeEndpointReference.java URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeEndpointReference.java?rev=963624&r1=963623&r2=963624&view=diff ============================================================================== --- tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeEndpointReference.java (original) +++ tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeEndpointReference.java Tue Jul 13 09:12:08 2010 @@ -49,6 +49,7 @@ public interface RuntimeEndpointReferenc */ InterfaceContract getBindingInterfaceContract(); + /** * Get the interface contract of the reference of the source component type, i.e., the * componentType.reference.interfaceContract. This represents the data types that the @@ -57,6 +58,30 @@ public interface RuntimeEndpointReferenc */ InterfaceContract getComponentTypeReferenceInterfaceContract(); + /** + * Check that endpoint reference has compatible interface at the component and binding ends. + * The user can specify the interfaces at both ends so there is a danger that they won't be compatible. + * There is checking in the activator but of course endpoint references may not have a binding assigned + * until final resolution. + */ + public void validateReferenceInterfaceCompatibility(); + + /** + * to allow for remote interface comparison we convert a Endpoint Reference's Java interface + * to WSDL at build time. + * + * @param wsdlContract + */ +// void setGeneratedWSDLContract(InterfaceContract wsdlContract); + + /** + * to allow for remote interface comparison we convert a Endpoint Reference's Java interface + * to WSDL at build time. + * + * @preturn wsdlContract + */ +// InterfaceContract getGeneratedWSDLContract(); + boolean isOutOfDate(); void rebuild(); boolean isStarted(); Modified: tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.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/CompositeActivatorImpl.java?rev=963624&r1=963623&r2=963624&view=diff ============================================================================== --- tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java (original) +++ tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java Tue Jul 13 09:12:08 2010 @@ -247,6 +247,10 @@ public class CompositeActivatorImpl impl public void activate(CompositeContext compositeContext, RuntimeEndpoint ep) { ep.bind(compositeContext); + + // Check that the service binding interface is compatible with the + // service interface + ep.validateServiceInterfaceCompatibility(); } public void deactivate(RuntimeComponent component, RuntimeComponentService service) { @@ -309,6 +313,13 @@ public class CompositeActivatorImpl impl } // endpointReference.setInterfaceContract(sourceContract.makeUnidirectional(false)); + + // if the reference already has a binding we can check the reference binding interface + // and reference interfaces for compatibility. If we can't check now compatibility + // will be checked when the endpoint reference is resolved. + if (epr.getStatus() == EndpointReference.Status.RESOLVED_BINDING){ + epr.validateReferenceInterfaceCompatibility(); + } } public void deactivate(RuntimeEndpointReference endpointReference) { 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=963624&r1=963623&r2=963624&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 Tue Jul 13 09:12:08 2010 @@ -187,6 +187,8 @@ public class RuntimeEndpointImpl extends this.phaseManager = utilities.getUtility(PhaseManager.class); this.serializer = utilities.getUtility(EndpointSerializer.class); this.providerFactories = registry.getExtensionPoint(ProviderFactoryExtensionPoint.class); + this.builders = registry.getExtensionPoint(BuilderExtensionPoint.class); + this.contractBuilder = builders.getContractBuilder(); } public void unbind() { @@ -224,7 +226,11 @@ public class RuntimeEndpointImpl extends for (InvocationChain chain : getInvocationChains()) { Operation op = chain.getTargetOperation(); - if (interfaceContractMapper.isCompatible(operation, op, Compatibility.SUBSET)) { + // We used to check compatibility here but this is now validated when the + // chain is created. As the chain operations are the real interface types + // they may be incompatible just because they are described in different + // IDLs + if (operation.getName().equals(op.getName())) { invocationChainMap.put(operation, chain); return chain; } @@ -304,6 +310,7 @@ public class RuntimeEndpointImpl extends // TODO - EPR - why is this looking at the component types. The endpoint should have the right interface contract by this time InterfaceContract targetContract = getComponentTypeServiceInterfaceContract(); // setInterfaceContract(targetContract); + validateServiceInterfaceCompatibility(); for (Operation operation : sourceContract.getInterface().getOperations()) { Operation targetOperation = interfaceContractMapper.map(targetContract.getInterface(), operation); if (targetOperation == null) { @@ -463,6 +470,47 @@ public class RuntimeEndpointImpl extends FactoryExtensionPoint modelFactories = registry.getExtensionPoint(FactoryExtensionPoint.class); return (RuntimeAssemblyFactory)modelFactories.getFactory(AssemblyFactory.class); } // end method RuntimeAssemblyFactory + + /** + * Check that endpoint has compatible interface at the component and binding ends. + * The user can specify the interfaces at both ends so there is a danger that they won't be compatible. + */ + public void validateServiceInterfaceCompatibility() { + + InterfaceContract serviceContract = getComponentServiceInterfaceContract(); + InterfaceContract bindingContract = getBindingInterfaceContract(); + + if ((serviceContract != null) && + (bindingContract != null)){ + try { + if ((serviceContract.getClass() != bindingContract.getClass()) && + (serviceContract instanceof JavaInterfaceContract)) { + interfaceContractMapper.checkCompatibility(getGeneratedWSDLContract(serviceContract), + bindingContract, + Compatibility.SUBSET, + true, // we ignore callbacks as binding iface won't have one + false); + } else { + interfaceContractMapper.checkCompatibility(serviceContract, + bindingContract, + Compatibility.SUBSET, + true, // we ignore callbacks as binding iface won't have one + false); + } + } catch (Exception ex){ + throw new ServiceRuntimeException("Component " + + this.getComponent().getName() + + " Service " + + getService().getName() + + " interface is incompatible with the interface of the reference binding - " + + getBinding().getName() + + " - " + + ex.getMessage() + + " - [" + this.toString() + "]"); + } + } + + } private void initServiceBindingInvocationChains() { @@ -744,5 +792,17 @@ public class RuntimeEndpointImpl extends } } } + public InterfaceContract getGeneratedWSDLContract(InterfaceContract interfaceContract) { + if ( interfaceContract.getNormalizedWSDLContract() == null){ + if (getComponentServiceInterfaceContract() instanceof JavaInterfaceContract){ + if (contractBuilder == null){ + throw new ServiceRuntimeException("Contract builder not found while calculating WSDL contract for " + this.toString()); + } + contractBuilder.build(getComponentServiceInterfaceContract(), null); + } + } + + return interfaceContract.getNormalizedWSDLContract(); + } } 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=963624&r1=963623&r2=963624&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 Tue Jul 13 09:12:08 2010 @@ -37,6 +37,8 @@ import org.apache.tuscany.sca.assembly.C import org.apache.tuscany.sca.assembly.CompositeService; import org.apache.tuscany.sca.assembly.Contract; import org.apache.tuscany.sca.assembly.EndpointReference; +import org.apache.tuscany.sca.assembly.builder.BuilderExtensionPoint; +import org.apache.tuscany.sca.assembly.builder.ContractBuilder; import org.apache.tuscany.sca.assembly.impl.EndpointReferenceImpl; import org.apache.tuscany.sca.context.CompositeContext; import org.apache.tuscany.sca.core.ExtensionPointRegistry; @@ -51,12 +53,15 @@ import org.apache.tuscany.sca.interfaced import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; 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.invocation.Interceptor; import org.apache.tuscany.sca.invocation.InvocationChain; import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.invocation.Message; import org.apache.tuscany.sca.invocation.MessageFactory; import org.apache.tuscany.sca.invocation.Phase; +import org.apache.tuscany.sca.monitor.Monitor; import org.apache.tuscany.sca.provider.BindingProviderFactory; import org.apache.tuscany.sca.provider.EndpointReferenceProvider; import org.apache.tuscany.sca.provider.PolicyProvider; @@ -99,6 +104,9 @@ public class RuntimeEndpointReferenceImp protected InterfaceContract bindingInterfaceContract; protected InterfaceContract referenceInterfaceContract; + + //protected InterfaceContract generatedReferenceWSDLInterfaceContract; + private String xml; private boolean started; @@ -169,6 +177,9 @@ public class RuntimeEndpointReferenceImp this.phaseManager = utilities.getUtility(PhaseManager.class); this.serializer = utilities.getUtility(EndpointSerializer.class); this.providerFactories = registry.getExtensionPoint(ProviderFactoryExtensionPoint.class); + + this.builders = registry.getExtensionPoint(BuilderExtensionPoint.class); + this.contractBuilder = builders.getContractBuilder(); } public synchronized List<InvocationChain> getInvocationChains() { @@ -191,7 +202,12 @@ public class RuntimeEndpointReferenceImp if (cached == null) { for (InvocationChain chain : getInvocationChains()) { Operation op = chain.getSourceOperation(); - if (interfaceContractMapper.isCompatible(operation, op, Compatibility.SUBSET)) { + + // We used to check compatibility here but this is now validated when the + // chain is created. As the chain operations are the real interface types + // they may be incompatible just because they are described in different + // IDLs + if (operation.getName().equals(op.getName())) { invocationChainMap.put(operation, chain); return chain; } @@ -266,6 +282,8 @@ public class RuntimeEndpointReferenceImp throw new IllegalStateException(e); } } + + validateReferenceInterfaceCompatibility(); List<InvocationChain> chainList = new ArrayList<InvocationChain>(); if(sourceContract != null && targetContract != null) { @@ -293,6 +311,51 @@ public class RuntimeEndpointReferenceImp chains = chainList; wireProcessor.process(this); } + + /** + * Check that endpoint reference has compatible interface at the component and binding ends. + * The user can specify the interfaces at both ends so there is a danger that they won't be compatible. + * There is checking in the activator but of course endpoint references may not have a binding assigned + * until final resolution. + */ + public void validateReferenceInterfaceCompatibility() { + + InterfaceContract referenceContract = getComponentReferenceInterfaceContract(); + InterfaceContract bindingContract = getBindingInterfaceContract(); + + if ((referenceContract != null) && + (bindingContract != null)){ + + try { + + if ((referenceContract.getClass() != bindingContract.getClass()) && + (referenceContract instanceof JavaInterfaceContract)) { + interfaceContractMapper.checkCompatibility(getGeneratedWSDLContract(referenceContract), + bindingContract, + Compatibility.SUBSET, + true, // we ignore callbacks as binding iface won't have one + false); + } else { + interfaceContractMapper.checkCompatibility(referenceContract, + bindingContract, + Compatibility.SUBSET, + true, // we ignore callbacks as binding iface won't have one + false); + } + + } catch (Exception ex){ + throw new ServiceRuntimeException("Component " + + this.getComponent().getName() + + " Reference " + + getReference().getName() + + " interface is incompatible with the interface of the reference binding " + + getBinding().getName() + + " - " + + ex.getMessage() + + " - [" + this.toString() + "]"); + } + } + } /** * This code used to be in the activator but has moved here as @@ -535,5 +598,18 @@ public class RuntimeEndpointReferenceImp public boolean isStarted() { return started; } + + public InterfaceContract getGeneratedWSDLContract(InterfaceContract interfaceContract) { + if ( interfaceContract.getNormalizedWSDLContract() == null){ + if (getComponentReferenceInterfaceContract() instanceof JavaInterfaceContract){ + if (contractBuilder == null){ + throw new ServiceRuntimeException("Contract builder not found while calculating WSDL contract for " + this.toString()); + } + contractBuilder.build(getComponentReferenceInterfaceContract(), null); + } + } + + return interfaceContract.getNormalizedWSDLContract(); + } } 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=963624&r1=963623&r2=963624&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 Tue Jul 13 09:12:08 2010 @@ -29,21 +29,26 @@ import javax.xml.namespace.QName; import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.assembly.Binding; +import org.apache.tuscany.sca.assembly.Component; import org.apache.tuscany.sca.assembly.ComponentReference; import org.apache.tuscany.sca.assembly.ComponentService; +import org.apache.tuscany.sca.assembly.Composite; import org.apache.tuscany.sca.assembly.Endpoint; import org.apache.tuscany.sca.assembly.EndpointReference; import org.apache.tuscany.sca.assembly.Multiplicity; +import org.apache.tuscany.sca.assembly.Reference; import org.apache.tuscany.sca.assembly.SCABinding; import org.apache.tuscany.sca.assembly.builder.BindingBuilder; import org.apache.tuscany.sca.assembly.builder.BuilderContext; import org.apache.tuscany.sca.assembly.builder.BuilderExtensionPoint; +import org.apache.tuscany.sca.assembly.builder.Messages; import org.apache.tuscany.sca.assembly.builder.PolicyBuilder; 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.core.assembly.impl.RuntimeEndpointReferenceImpl; import org.apache.tuscany.sca.definitions.Definitions; +import org.apache.tuscany.sca.interfacedef.Compatibility; import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; import org.apache.tuscany.sca.monitor.Monitor; import org.apache.tuscany.sca.monitor.MonitorFactory; @@ -56,6 +61,7 @@ import org.apache.tuscany.sca.runtime.Co import org.apache.tuscany.sca.runtime.EndpointReferenceBinder; import org.apache.tuscany.sca.runtime.EndpointRegistry; import org.apache.tuscany.sca.runtime.RuntimeEndpoint; +import org.apache.tuscany.sca.runtime.RuntimeEndpointReference; import org.oasisopen.sca.ServiceRuntimeException; /** @@ -292,7 +298,11 @@ public class EndpointReferenceBinderImpl throw new ServiceRuntimeException("Unable to bind " + monitor.getLastProblem().toString()); } - } + + // Now the endpoint reference is resolved check that the binding interfaces contract + // and the reference contract are compatible + ((RuntimeEndpointReference)endpointReference).validateReferenceInterfaceCompatibility(); + } /** * Returns true if the reference has a callback Modified: tuscany/sca-java-2.x/trunk/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceContract.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/JavaInterfaceContract.java?rev=963624&r1=963623&r2=963624&view=diff ============================================================================== --- tuscany/sca-java-2.x/trunk/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceContract.java (original) +++ tuscany/sca-java-2.x/trunk/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceContract.java Tue Jul 13 09:12:08 2010 @@ -29,5 +29,5 @@ import org.apache.tuscany.sca.interfaced * @tuscany.spi.extension.asclient */ public interface JavaInterfaceContract extends InterfaceContract { - + } Modified: tuscany/sca-java-2.x/trunk/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceContractImpl.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/impl/JavaInterfaceContractImpl.java?rev=963624&r1=963623&r2=963624&view=diff ============================================================================== --- tuscany/sca-java-2.x/trunk/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceContractImpl.java (original) +++ tuscany/sca-java-2.x/trunk/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceContractImpl.java Tue Jul 13 09:12:08 2010 @@ -18,6 +18,7 @@ */ package org.apache.tuscany.sca.interfacedef.java.impl; +import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractImpl; import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract; @@ -28,6 +29,10 @@ import org.apache.tuscany.sca.interfaced */ public class JavaInterfaceContractImpl extends InterfaceContractImpl implements JavaInterfaceContract { + // A cached WSDL version of the Java contract use during normalized + // interface comparison + private InterfaceContract normailizedWSDLInterfaceContract; + protected JavaInterfaceContractImpl() { } @@ -36,4 +41,13 @@ public class JavaInterfaceContractImpl e return (JavaInterfaceContractImpl) super.clone(); } + @Override + public InterfaceContract getNormalizedWSDLContract() { + return normailizedWSDLInterfaceContract; + } + + @Override + public void setNormailizedWSDLContract(InterfaceContract wsdlInterfaceContract) { + normailizedWSDLInterfaceContract = wsdlInterfaceContract; + } } Modified: tuscany/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceContractImpl.java URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceContractImpl.java?rev=963624&r1=963623&r2=963624&view=diff ============================================================================== --- tuscany/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceContractImpl.java (original) +++ tuscany/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceContractImpl.java Tue Jul 13 09:12:08 2010 @@ -18,6 +18,7 @@ */ package org.apache.tuscany.sca.interfacedef.wsdl.impl; +import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractImpl; import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract; @@ -44,4 +45,12 @@ public class WSDLInterfaceContractImpl e public WSDLInterfaceContractImpl clone() throws CloneNotSupportedException { return (WSDLInterfaceContractImpl) super.clone(); } + + public InterfaceContract getNormalizedWSDLContract() { + return this; + } + + public void setNormailizedWSDLContract(InterfaceContract wsdlInterfaceContract) { + // do nothing as this already is a WSDL contract + } }
