You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2009/08/26 12:18:26 UTC

svn commit: r807951 - in /tuscany/java/sca/modules/assembly-xml/src/main: java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java resources/assembly-xml-validation-messages.properties

Author: antelder
Date: Wed Aug 26 10:18:26 2009
New Revision: 807951

URL: http://svn.apache.org/viewvc?rev=807951&view=rev
Log:
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

Modified:
    tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
    tuscany/java/sca/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties

Modified: tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java?rev=807951&r1=807950&r2=807951&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java (original)
+++ tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java Wed Aug 26 10:18:26 2009
@@ -994,6 +994,8 @@
 	                //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 @@
     	} // 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;
     }

Modified: tuscany/java/sca/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties?rev=807951&r1=807950&r2=807951&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties (original)
+++ tuscany/java/sca/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties Wed Aug 26 10:18:26 2009
@@ -28,4 +28,4 @@
 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