diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2011-10-31 10:40:42 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2011-10-31 10:40:42 +0000 |
commit | 46b3096e6f8edd8c43e664df5fb0413c4bf9669d (patch) | |
tree | c340dc74eab5a60da9375718372324af0e789e99 /sca-java-2.x/trunk/modules | |
parent | 1b903cae8b2c1920fbbef2904b0b4d4f014ec052 (diff) |
Push the builder context further down into WSDL gen so that error strings are correctly reported.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1195402 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules')
3 files changed, 31 insertions, 23 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLContractBuilder.java b/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLContractBuilder.java index 291d42d71c..8a8dfb03f8 100644 --- a/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLContractBuilder.java +++ b/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLContractBuilder.java @@ -39,6 +39,7 @@ import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
+import org.apache.tuscany.sca.monitor.Monitor;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
import org.apache.tuscany.sca.xsd.XSDFactory;
@@ -69,6 +70,11 @@ public class WSDLContractBuilder implements ContractBuilder { }
public boolean build(InterfaceContract interfaceContract, BuilderContext context){
+ Monitor monitor = null;
+
+ if (context != null){
+ monitor = context.getMonitor();
+ }
// Uncomment the printWSDL = lines to see the WSDL that is generated
// for interface matching purposes
// BindingWSDLGenerator.printWSDL = true;
@@ -81,7 +87,7 @@ public class WSDLContractBuilder implements ContractBuilder { wsdlFactory,
xsdFactory,
documentBuilderFactory,
- null);
+ monitor);
javaContract.setNormalizedWSDLContract(wsdlContract);
// BindingWSDLGenerator.printWSDL = false;
return true;
diff --git a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java index 2d22c2effe..23bd33e806 100644 --- a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java +++ b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java @@ -264,7 +264,7 @@ public class ComponentBuilderImpl { } // interface contracts - calculateServiceInterfaceContract(component, componentService, componentTypeService, monitor); + calculateServiceInterfaceContract(component, componentService, componentTypeService, context); // bindings calculateBindings(component, componentService, componentTypeService, context); @@ -306,7 +306,7 @@ public class ComponentBuilderImpl { reconcileReferenceMultiplicity(component, componentReference, componentTypeReference, monitor); // interface contracts - calculateReferenceInterfaceContract(component, componentReference, componentTypeReference, monitor); + calculateReferenceInterfaceContract(component, componentReference, componentTypeReference, context); // bindings calculateBindings(componentReference, componentTypeReference); @@ -1499,7 +1499,7 @@ public class ComponentBuilderImpl { * @param topContract the top contract * @param bottomContract the bottom contract */ - private void calculateServiceInterfaceContract(Component component, Service topContract, Service bottomContract, Monitor monitor) { + private void calculateServiceInterfaceContract(Component component, Service topContract, Service bottomContract, BuilderContext context) { // Use the interface contract from the bottom level contract if // none is specified on the top level contract @@ -1514,13 +1514,14 @@ public class ComponentBuilderImpl { String incompatibilityReason = ""; try{ isCompatible = checkSubsetCompatibility(topInterfaceContract, - bottomInterfaceContract); + bottomInterfaceContract, + context); } catch (IncompatibleInterfaceContractException ex){ isCompatible = false; incompatibilityReason = ex.getMessage(); } if (!isCompatible) { - Monitor.error(monitor, + Monitor.error(context.getMonitor(), this, Messages.ASSEMBLY_VALIDATION, "ServiceIncompatibleComponentInterface", @@ -1558,7 +1559,7 @@ public class ComponentBuilderImpl { * @param topContract the top contract * @param bottomContract the bottom contract */ - private void calculateReferenceInterfaceContract(Component component, Reference topContract, Reference bottomContract, Monitor monitor) { + private void calculateReferenceInterfaceContract(Component component, Reference topContract, Reference bottomContract, BuilderContext context) { // Use the interface contract from the bottom level contract if // none is specified on the top level contract @@ -1573,13 +1574,14 @@ public class ComponentBuilderImpl { String incompatibilityReason = ""; try{ isCompatible = checkSubsetCompatibility(bottomInterfaceContract, - topInterfaceContract); + topInterfaceContract, + context); } catch (IncompatibleInterfaceContractException ex){ isCompatible = false; incompatibilityReason = ex.getMessage(); } if (!isCompatible) { - Monitor.error(monitor, + Monitor.error(context.getMonitor(), this, Messages.ASSEMBLY_VALIDATION, "ReferenceIncompatibleComponentInterface", @@ -1690,18 +1692,18 @@ public class ComponentBuilderImpl { * @param contractB * @return true if the interface contracts match */ - private boolean checkSubsetCompatibility(InterfaceContract contractA, InterfaceContract contractB) + private boolean checkSubsetCompatibility(InterfaceContract contractA, InterfaceContract contractB, BuilderContext context) throws IncompatibleInterfaceContractException { if (contractA.getClass() != contractB.getClass()) { if (contractA instanceof JavaInterfaceContract){ - contractBuilder.build(contractA, null); + contractBuilder.build(contractA, context); contractA = ((JavaInterfaceContract)contractA).getNormalizedWSDLContract(); } if (contractB instanceof JavaInterfaceContract){ - contractBuilder.build(contractB, null); + contractBuilder.build(contractB, context); contractB = ((JavaInterfaceContract)contractB).getNormalizedWSDLContract(); } } diff --git a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositeComponentTypeBuilderImpl.java b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositeComponentTypeBuilderImpl.java index f87854cac4..83e007f39a 100644 --- a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositeComponentTypeBuilderImpl.java +++ b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositeComponentTypeBuilderImpl.java @@ -236,7 +236,7 @@ public class CompositeComponentTypeBuilderImpl { ComponentService promotedComponentService = compositeService.getPromotedService(); // promote interface contracts - calculatePromotedServiceInterfaceContract(compositeService, promotedComponentService, monitor); + calculatePromotedServiceInterfaceContract(compositeService, promotedComponentService, context); // promote bindings calculatePromotedBindings(compositeService, promotedComponentService); @@ -276,7 +276,7 @@ public class CompositeComponentTypeBuilderImpl { validateNonOverridable(componentType, compositeReference, promotedComponentReference, monitor); // promote interface contracts - calculatePromotedReferenceInterfaceContract(compositeReference, promotedComponentReference, monitor); + calculatePromotedReferenceInterfaceContract(compositeReference, promotedComponentReference, context); // promote bindings // Don't need to promote reference bindings as any lower level binding will @@ -425,7 +425,7 @@ public class CompositeComponentTypeBuilderImpl { * @param topContract the top contract * @param bottomContract the bottom contract */ - private void calculatePromotedServiceInterfaceContract(Service topContract, Service bottomContract, Monitor monitor) { + private void calculatePromotedServiceInterfaceContract(Service topContract, Service bottomContract, BuilderContext context) { // Use the interface contract from the bottom level contract if // none is specified on the top level contract InterfaceContract topInterfaceContract = topContract.getInterfaceContract(); @@ -438,13 +438,13 @@ public class CompositeComponentTypeBuilderImpl { boolean isCompatible = true; String incompatibilityReason = ""; try{ - isCompatible = checkSubsetCompatibility(topInterfaceContract, bottomInterfaceContract); + isCompatible = checkSubsetCompatibility(topInterfaceContract, bottomInterfaceContract, context); } catch (IncompatibleInterfaceContractException ex){ isCompatible = false; incompatibilityReason = ex.getMessage(); } if (!isCompatible) { - Monitor.error(monitor, + Monitor.error(context.getMonitor(), this, Messages.ASSEMBLY_VALIDATION, "ServiceInterfaceNotSubSet", @@ -481,7 +481,7 @@ public class CompositeComponentTypeBuilderImpl { * @param topContract the top contract * @param bottomContract the bottom contract */ - private void calculatePromotedReferenceInterfaceContract(Reference topContract, Reference bottomContract, Monitor monitor) { + private void calculatePromotedReferenceInterfaceContract(Reference topContract, Reference bottomContract, BuilderContext context) { // Use the interface contract from the bottom level contract if // none is specified on the top level contract InterfaceContract topInterfaceContract = topContract.getInterfaceContract(); @@ -494,13 +494,13 @@ public class CompositeComponentTypeBuilderImpl { boolean isCompatible = true; String incompatibilityReason = ""; try{ - isCompatible = checkSubsetCompatibility(bottomInterfaceContract, topInterfaceContract); + isCompatible = checkSubsetCompatibility(bottomInterfaceContract, topInterfaceContract, context); } catch (IncompatibleInterfaceContractException ex){ isCompatible = false; incompatibilityReason = ex.getMessage(); } if (!isCompatible) { - Monitor.error(monitor, + Monitor.error(context.getMonitor(), this, Messages.ASSEMBLY_VALIDATION, "ReferenceInterfaceNotSubSet", @@ -670,18 +670,18 @@ public class CompositeComponentTypeBuilderImpl { * @param contractB * @return true if the interface contracts match */ - private boolean checkSubsetCompatibility(InterfaceContract contractA, InterfaceContract contractB) + private boolean checkSubsetCompatibility(InterfaceContract contractA, InterfaceContract contractB, BuilderContext context) throws IncompatibleInterfaceContractException { if (contractA.getClass() != contractB.getClass()) { if (contractA instanceof JavaInterfaceContract){ - contractBuilder.build(contractA, null); + contractBuilder.build(contractA, context); contractA = ((JavaInterfaceContract)contractA).getNormalizedWSDLContract(); } if (contractB instanceof JavaInterfaceContract){ - contractBuilder.build(contractB, null); + contractBuilder.build(contractB, context); contractB = ((JavaInterfaceContract)contractB).getNormalizedWSDLContract(); } } |