Author: slaws
Date: Mon Oct 31 10:40:42 2011
New Revision: 1195402
URL: http://svn.apache.org/viewvc?rev=1195402&view=rev
Log:
Push the builder context further down into WSDL gen so that error strings are
correctly reported.
Modified:
tuscany/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLContractBuilder.java
tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java
tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositeComponentTypeBuilderImpl.java
Modified:
tuscany/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLContractBuilder.java
URL:
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLContractBuilder.java?rev=1195402&r1=1195401&r2=1195402&view=diff
==============================================================================
---
tuscany/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLContractBuilder.java
(original)
+++
tuscany/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLContractBuilder.java
Mon Oct 31 10:40:42 2011
@@ -39,6 +39,7 @@ import org.apache.tuscany.sca.interfaced
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 impleme
}
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 impleme
wsdlFactory,
xsdFactory,
documentBuilderFactory,
- null);
+ monitor);
javaContract.setNormalizedWSDLContract(wsdlContract);
// BindingWSDLGenerator.printWSDL = false;
return true;
Modified:
tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java
URL:
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java?rev=1195402&r1=1195401&r2=1195402&view=diff
==============================================================================
---
tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java
(original)
+++
tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java
Mon Oct 31 10:40:42 2011
@@ -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();
}
}
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=1195402&r1=1195401&r2=1195402&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
Mon Oct 31 10:40:42 2011
@@ -236,7 +236,7 @@ public class CompositeComponentTypeBuild
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 CompositeComponentTypeBuild
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 CompositeComponentTypeBuild
* @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 CompositeComponentTypeBuild
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 CompositeComponentTypeBuild
* @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 CompositeComponentTypeBuild
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 CompositeComponentTypeBuild
* @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();
}
}