From 286e08fe4d7d7ca853e1384e18bdbfbeb84d2cd3 Mon Sep 17 00:00:00 2001 From: rfeng Date: Tue, 18 Aug 2009 17:04:59 +0000 Subject: Fix for ASM_4008 git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@805498 13f79535-47bb-0310-9956-ffa450edef68 --- java/sca/modules/assembly-xml/pom.xml | 2 +- .../tuscany/sca/assembly/xml/BaseAssemblyProcessor.java | 8 +++++--- java/sca/modules/assembly/META-INF/MANIFEST.MF | 4 +--- java/sca/modules/assembly/pom.xml | 7 +------ .../sca/assembly/builder/impl/PropertyConfigurationUtil.java | 12 +++++------- .../main/resources/assembly-validation-messages.properties | 2 +- 6 files changed, 14 insertions(+), 21 deletions(-) (limited to 'java/sca') diff --git a/java/sca/modules/assembly-xml/pom.xml b/java/sca/modules/assembly-xml/pom.xml index dbefaf7292..adab44d15b 100644 --- a/java/sca/modules/assembly-xml/pom.xml +++ b/java/sca/modules/assembly-xml/pom.xml @@ -99,7 +99,7 @@ org.apache.tuscany.sca tuscany-assembly-xsd 2.0-SNAPSHOT - test + runtime diff --git a/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java b/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java index 32ea875e90..bab3b94ba4 100644 --- a/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java +++ b/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java @@ -606,9 +606,11 @@ abstract class BaseAssemblyProcessor extends BaseStAXArtifactProcessor { if (root.getChildNodes().getLength() == 0) { // Add an text as an if (isTextForProperty){ - Element valueElement = document.createElementNS(SCA11_NS, VALUE); - root.appendChild(valueElement); - valueElement.setTextContent(text.toString()); + if (text.length() > 0) { + Element valueElement = document.createElementNS(SCA11_NS, VALUE); + root.appendChild(valueElement); + valueElement.setTextContent(text.toString()); + } } } return document; diff --git a/java/sca/modules/assembly/META-INF/MANIFEST.MF b/java/sca/modules/assembly/META-INF/MANIFEST.MF index 51a858cda1..544337cd89 100644 --- a/java/sca/modules/assembly/META-INF/MANIFEST.MF +++ b/java/sca/modules/assembly/META-INF/MANIFEST.MF @@ -36,13 +36,11 @@ Import-Package: javax.xml.namespace, org.apache.tuscany.sca.assembly;version="2.0.0", org.apache.tuscany.sca.assembly.builder;version="2.0.0", org.apache.tuscany.sca.assembly.impl;version="2.0.0", - org.apache.tuscany.sca.assembly.xsd;version="2.0.0", org.apache.tuscany.sca.core;version="2.0.0", org.apache.tuscany.sca.definitions;version="2.0.0", org.apache.tuscany.sca.extensibility;version="2.0.0", org.apache.tuscany.sca.interfacedef;version="2.0.0", - org.apache.tuscany.sca.interfacedef.impl;version="2.0.0"; - resolution:=optional, + org.apache.tuscany.sca.interfacedef.impl;version="2.0.0";resolution:=optional, org.apache.tuscany.sca.monitor;version="2.0.0", org.apache.tuscany.sca.policy;version="2.0.0", org.apache.tuscany.sca.policy.util;version="2.0.0", diff --git a/java/sca/modules/assembly/pom.xml b/java/sca/modules/assembly/pom.xml index c351aa698d..5e9fc08eec 100644 --- a/java/sca/modules/assembly/pom.xml +++ b/java/sca/modules/assembly/pom.xml @@ -29,12 +29,7 @@ Apache Tuscany SCA Assembly Model - - org.apache.tuscany.sca - tuscany-assembly-xsd - 2.0-SNAPSHOT - - + org.apache.tuscany.sca tuscany-policy diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PropertyConfigurationUtil.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PropertyConfigurationUtil.java index abbcf5591d..b9da3301ea 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PropertyConfigurationUtil.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PropertyConfigurationUtil.java @@ -18,6 +18,8 @@ */ package org.apache.tuscany.sca.assembly.builder.impl; +import static org.apache.tuscany.sca.assembly.Base.SCA11_NS; + import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; @@ -52,10 +54,6 @@ import org.w3c.dom.Element; import org.w3c.dom.Node; import org.xml.sax.InputSource; -import static org.apache.tuscany.sca.assembly.xsd.Constants.PROPERTY; -import static org.apache.tuscany.sca.assembly.xsd.Constants.SCA11_NS; -import static org.apache.tuscany.sca.assembly.xsd.Constants.VALUE; - /** * Utility class to deal with processing of component properties that are taking values from the parent * composite's properties or an external file. @@ -92,14 +90,14 @@ abstract class PropertyConfigurationUtil { return (Document)result; } else { Document document = documentBuilderFactory.newDocumentBuilder().newDocument(); - Element newProperty = document.createElementNS(SCA11_NS, PROPERTY); + Element newProperty = document.createElementNS(SCA11_NS, "property"); - if( VALUE.equals(result.getLocalName()) ) { + if( "value".equals(result.getLocalName()) ) { // If the result is a element, use it directly in the result newProperty.appendChild(document.importNode(result, true)); } else { // If the result is not a element, create a element to contain the result - Element newValue = document.createElementNS(SCA11_NS, VALUE); + Element newValue = document.createElementNS(SCA11_NS, "value"); newValue.appendChild(document.importNode(result, true)); newProperty.appendChild(newValue); } // end if diff --git a/java/sca/modules/assembly/src/main/resources/assembly-validation-messages.properties b/java/sca/modules/assembly/src/main/resources/assembly-validation-messages.properties index b4e987df02..d5915393f7 100644 --- a/java/sca/modules/assembly/src/main/resources/assembly-validation-messages.properties +++ b/java/sca/modules/assembly/src/main/resources/assembly-validation-messages.properties @@ -30,7 +30,7 @@ DuplicateImplementationServiceName = Duplicate service name: Component = {0} Ser DuplicateImplementationReferenceName = Duplicate reference name: Component = {0} Reference = {1} PropertyNotFound = Property not found for component property: Component = {0} Property = {1} PropertyMustSupplyIncompatible = Component property mustSupply attribute incompatible with property: Component = {0} Property = {1} -PropertyMustSupplyNull = No value configured on a mustSupply property: Component = {0} Property = {1} +PropertyMustSupplyNull = [ASM_4008] No value configured on a mustSupply property: Component = {0} Property = {1} PropertyOverrideManyAttribute = Component property many attribute incompatible with property: Component = {0} Property = {1} ReferenceNotFound = Reference not found for component reference: Component = {0} Reference = {1} ReferenceIncompatibleMultiplicity = Component reference multiplicity incompatible with reference multiplicity: Component = {0} Reference = {1} -- cgit v1.2.3