diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2009-08-26 10:18:26 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2009-08-26 10:18:26 +0000 |
commit | ad0d7c60d6323c981179c54e136b2028a575f361 (patch) | |
tree | 9e18662d0cccdc924c9793a98552688e8a3ee654 /java/sca/modules | |
parent | a034a1925cb95bcd4d6cbe3f03a620e78cde0db7 (diff) |
Initial code for ASM_5036 fix, note the TUSCANY-3236 TODO and also it might be better to find a place later on in processing to do this check
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@807951 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules')
2 files changed, 21 insertions, 1 deletions
diff --git a/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java b/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java index d47059bac5..b20a788027 100644 --- a/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java +++ b/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java @@ -994,6 +994,8 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt //for this that is resolved, the specified intents and policysets are safe in the //component and not lost implementation = resolveImplementation(implementation, resolver); + + validatePropertyTypes(component, implementation); component.setImplementation(implementation); } @@ -1019,6 +1021,24 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt } // end try } + /** + * ASM50036: The property type specified for the property element of a component MUST be + * compatible with the type of the property with the same @name declared in the component + * type of the implementation used by the component. + */ + private void validatePropertyTypes(Component component, Implementation implementation) { + for (Property cp : component.getProperties()) { + Property ip = implementation.getProperty(cp.getName()); + if (cp != null && ip != null && cp.getXSDType() != null && ip.getXSDType() != null) { + if (!cp.getXSDType().equals(ip.getXSDType())) { + // FIXME: how to test for incompatible instead of not equal + // TODO: TUSCANY-3236, should be error not warning + warning("IncompatiblePropertyType", component, component.getName(), cp.getName()); + } + } + } + } + public QName getArtifactType() { return COMPOSITE_QNAME; } diff --git a/java/sca/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties b/java/sca/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties index 94e462fc96..5a633ff22e 100644 --- a/java/sca/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties +++ b/java/sca/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties @@ -28,4 +28,4 @@ ContributionReadException = ContributionReadException occured due to : {0} ContributionWriteException = ContributionWriteException occured due to : {0} XMLStreamException = XMLStreamException occured due to : {0} DuplicateCompositeName = [ASM_6001] More than one composite with the same name {0} found in contribution {1} - +IncompatiblePropertyType = [ASM_5036] Component {0} property {1} type is not compatible with implementation property type |