diff options
Diffstat (limited to 'java/sca')
2 files changed, 31 insertions, 2 deletions
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 80bf4955f0..f1294c4e12 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 @@ -65,9 +65,10 @@ IllegalCompositeIncusion = Local Composite {0} cannot include a non-local compos PropertySourceNotFound = The property source {0} for property {1} in component {2} cannot be resolved to a composite property PropertySourceValueInvalid = The property source {0} for property {1} in component {2} has an invalid value. It should start with $ followed by the name of a composite property PropertySourceXPathInvalid = The property source {0} for property {1} in component {2} has an invalid XPath expression. The following error was returned while processing the XPath expression: {3} -PropertySourceXPathInvalid = The property file {0} for property {1} in component {2} is an invalid value. The following error was returned while processing the file name: {3} +PropertyFileValueInvalid = The property file {0} for property {1} in component {2} is an invalid value. The following error was returned while processing the file name: {3} PolicyRelatedException = Policy Related Exception occured due to : {0} 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
\ No newline at end of file +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 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) { |