summaryrefslogtreecommitdiffstats
path: root/java/sca/modules
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-10-09 17:59:57 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-10-09 17:59:57 +0000
commite2a82e1954ef1ac97c26d4f6bca4184494b541b9 (patch)
treee09045556ef5d683911c6476fa052c64ac1d6c56 /java/sca/modules
parent2c4fb4511421e0e82c46f0e3297b2faf6a40418e (diff)
TUSCANY-3258 raise an error when a component property type doesn't match the component type property type. This may need to be looked at further if we decide to consider if the types are compatible.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@823643 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules')
-rw-r--r--java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java20
-rw-r--r--java/sca/modules/assembly-xml/src/main/resources/org/apache/tuscany/sca/assembly/xml/assembly-xml-validation-messages.properties1
-rw-r--r--java/sca/modules/assembly/src/main/resources/org/apache/tuscany/sca/assembly/builder/assembly-validation-messages.properties4
-rw-r--r--java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java27
4 files changed, 28 insertions, 24 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 ffffd06404..ef039818cc 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
@@ -1019,8 +1019,6 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt
//component and not lost
implementation = resolveImplementation(implementation, resolver);
- validatePropertyTypes(component, implementation);
-
component.setImplementation(implementation);
}
@@ -1045,24 +1043,6 @@ 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/org/apache/tuscany/sca/assembly/xml/assembly-xml-validation-messages.properties b/java/sca/modules/assembly-xml/src/main/resources/org/apache/tuscany/sca/assembly/xml/assembly-xml-validation-messages.properties
index fe29a3be28..f12e94d968 100644
--- a/java/sca/modules/assembly-xml/src/main/resources/org/apache/tuscany/sca/assembly/xml/assembly-xml-validation-messages.properties
+++ b/java/sca/modules/assembly-xml/src/main/resources/org/apache/tuscany/sca/assembly/xml/assembly-xml-validation-messages.properties
@@ -29,4 +29,3 @@ ContributionResolveException = ContributionResolveException 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
diff --git a/java/sca/modules/assembly/src/main/resources/org/apache/tuscany/sca/assembly/builder/assembly-validation-messages.properties b/java/sca/modules/assembly/src/main/resources/org/apache/tuscany/sca/assembly/builder/assembly-validation-messages.properties
index f1294c4e12..020707b838 100644
--- a/java/sca/modules/assembly/src/main/resources/org/apache/tuscany/sca/assembly/builder/assembly-validation-messages.properties
+++ b/java/sca/modules/assembly/src/main/resources/org/apache/tuscany/sca/assembly/builder/assembly-validation-messages.properties
@@ -71,4 +71,6 @@ IntentNotFound = Intent {0} is not defined in SCA definitions
PolicySetNotFound = PolicySet {0} is not defined in SCA definitions
MutuallyExclusiveIntents = [POL40009] Intent {0} and {1} are mutually exclusive
PropertyXpathExpressionReturnedNull = The property XPath expression for component {0} property {1} expression {2} did not match anything in the source property
-PropertyHasManyValues = The property component {0} property {1} has many values but its "many" attribute is set to false \ No newline at end of file
+PropertyHasManyValues = The property component {0} property {1} has many values but its "many" attribute is set to false
+PropertXSDTypesDontMatch = [ASM_5036] The property component {0} property {1} has XSD type {2} while its component type property has the XSD type {3}
+PropertXSDElementsDontMatch = [ASM_5036] The property component {0} property {1} has XSD element {2} while its component type property has the XSD element {3} \ No newline at end of file
diff --git a/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java b/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java
index 76d5a850d1..971a64c91b 100644
--- a/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java
+++ b/java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java
@@ -568,8 +568,6 @@ public class ComponentBuilderImpl {
componentTypeProperty.setValue(componentProperty.getValue());
}
-
-
// Check that a component property does not override the
// many attribute
if (!componentTypeProperty.isMany() && componentProperty.isMany()) {
@@ -601,6 +599,31 @@ public class ComponentBuilderImpl {
component.getName(),
componentProperty.getName());
}
+
+ // check that the types specified in the component type and component property match
+ if ( componentProperty.getXSDElement() != null &&
+ !componentProperty.getXSDElement().equals(componentTypeProperty.getXSDElement())){
+ Monitor.error(monitor,
+ this,
+ Messages.ASSEMBLY_VALIDATION,
+ "PropertXSDElementsDontMatch",
+ component.getName(),
+ componentProperty.getName(),
+ componentProperty.getXSDElement().toString(),
+ componentTypeProperty.getXSDElement().toString());
+ }
+
+ if ( componentProperty.getXSDType() != null &&
+ !componentProperty.getXSDType().equals(componentTypeProperty.getXSDType())){
+ Monitor.error(monitor,
+ this,
+ Messages.ASSEMBLY_VALIDATION,
+ "PropertXSDTypesDontMatch",
+ component.getName(),
+ componentProperty.getName(),
+ componentProperty.getXSDType().toString(),
+ componentTypeProperty.getXSDType().toString());
+ }
}
}