diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2011-09-14 13:16:39 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2011-09-14 13:16:39 +0000 |
commit | 9d7c57a0e1c12472126c0888ef238c00d93e9001 (patch) | |
tree | be6c90453a62a63174113e3615981e1346a2bc55 /sca-java-2.x/trunk/modules/builder/src/main | |
parent | f0581d45620443a18a263018a49432f26c9027e2 (diff) |
TUSCANY-3937 - Further fixes on top of Michael's patch to get the properties itest working. Mainly, builder changes to ignore null types (generated for non-JAXB pojos), update Node2JAXB to report validation errors so things don't go wrong silently, ensure default XMLType doesn't get updated, correct properties test to match OASIS, put properties test in the build.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1170598 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/builder/src/main')
-rw-r--r-- | sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java | 40 |
1 files changed, 28 insertions, 12 deletions
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 c32968fd87..c525fd7b28 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 @@ -80,6 +80,7 @@ import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl; import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract; +import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper; import org.apache.tuscany.sca.interfacedef.util.XMLType; import org.apache.tuscany.sca.monitor.Monitor; import org.apache.tuscany.sca.policy.ExtensionType; @@ -97,7 +98,7 @@ import org.xml.sax.InputSource; public class ComponentBuilderImpl { protected static final String SCA11_NS = "http://docs.oasis-open.org/ns/opencsa/sca/200912"; protected static final String BINDING_SCA = "binding.sca"; - protected static final QName BINDING_SCA_QNAME = new QName(SCA11_NS, BINDING_SCA); + protected static final QName BINDING_SCA_QNAME = new QName(SCA11_NS, BINDING_SCA); private CompositeComponentTypeBuilderImpl componentTypeBuilder; protected ComponentPolicyBuilderImpl policyBuilder; @@ -348,6 +349,16 @@ public class ComponentBuilderImpl { // configure the property value based on the @file attribute processPropertyFileAttribute(component, componentProperty, monitor); + // Check that a type or element are specified + if (componentProperty.getXSDElement() == null && componentProperty.getXSDType() == null) { + Monitor.error(monitor, + this, + Messages.ASSEMBLY_VALIDATION, + "NoTypeForComponentProperty", + component.getName(), + componentProperty.getName()); + } + // Check that a value is supplied if (componentProperty.isMustSupply() && !isPropertyValueSet(componentProperty)) { Monitor.error(monitor, @@ -560,6 +571,13 @@ public class ComponentBuilderImpl { if (property != null) { componentProperty.setProperty(property); + // copy the types up if not specified at the component level + if (componentProperty.getXSDElement() == null){ + componentProperty.setXSDElement(property.getXSDElement()); + } + if (componentProperty.getXSDType() == null){ + componentProperty.setXSDType(property.getXSDType()); + } } else { Monitor.error(monitor, this, @@ -640,19 +658,10 @@ public class ComponentBuilderImpl { if (componentProperty.getXSDElement() == null) { componentProperty.setXSDElement(componentTypeProperty.getXSDElement()); } - - // Check that a type or element are specified - if (componentProperty.getXSDElement() == null && componentProperty.getXSDType() == null) { - Monitor.error(monitor, - this, - Messages.ASSEMBLY_VALIDATION, - "NoTypeForComponentProperty", - component.getName(), - componentProperty.getName()); - } // check that the types specified in the component type and component property match if ( componentProperty.getXSDElement() != null && + componentTypeProperty.getXSDElement() != null && !componentProperty.getXSDElement().equals(componentTypeProperty.getXSDElement())){ Monitor.error(monitor, this, @@ -665,7 +674,8 @@ public class ComponentBuilderImpl { } if ( componentProperty.getXSDType() != null && - !componentProperty.getXSDType().equals(componentTypeProperty.getXSDType())){ + componentTypeProperty.getXSDType() != null && + !componentProperty.getXSDType().equals(componentTypeProperty.getXSDType())){ Monitor.error(monitor, this, Messages.ASSEMBLY_VALIDATION, @@ -840,6 +850,12 @@ public class ComponentBuilderImpl { if (node != null) { componentProperty.setValue(node); + if(componentProperty.getXSDElement() == null){ + componentProperty.setXSDElement(sourceProp.getXSDElement()); + } + if(componentProperty.getXSDType() == null){ + componentProperty.setXSDType(sourceProp.getXSDType()); + } } else { Monitor.warning(monitor, this, |