summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/builder
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-10-09 16:13:41 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-10-09 16:13:41 +0000
commit2c4fb4511421e0e82c46f0e3297b2faf6a40418e (patch)
tree5e2dd053b211becf7235f6e179de7587edeb7106 /java/sca/modules/builder
parent89cf22690e705fbdac45455d82f94be22b8704c4 (diff)
TUSCANY-3231 fail if property has many values and many="false". Re-applied the fix from the base class to the new builders.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@823604 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/builder')
-rw-r--r--java/sca/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java28
1 files changed, 28 insertions, 0 deletions
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 8ba5e98f68..76d5a850d1 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
@@ -310,6 +310,17 @@ public class ComponentBuilderImpl {
component.getName(),
componentProperty.getName());
}
+
+ // check that not too many values are supplied
+ if (!componentProperty.isMany() && isPropertyManyValued(componentProperty)){
+ Monitor.error(monitor,
+ this,
+ Messages.ASSEMBLY_VALIDATION,
+ "PropertyHasManyValues",
+ component.getName(),
+ componentProperty.getName());
+ }
+
}
}
@@ -1003,6 +1014,23 @@ public class ComponentBuilderImpl {
return true;
}
+
+ /**
+ * Look to see is a property has more than one value
+ *
+ * @param property
+ * @return true is the property has more than one value
+ */
+ private boolean isPropertyManyValued(Property property) {
+
+ if (isPropertyValueSet(property)){
+ Document value = (Document)property.getValue();
+ if (value.getFirstChild().getChildNodes().getLength() > 1){
+ return true;
+ }
+ }
+ return false;
+ }
private boolean isValidMultiplicityOverride(Multiplicity definedMul, Multiplicity overridenMul) {
if (definedMul != overridenMul) {