summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/trunk/modules')
-rw-r--r--sca-java-2.x/trunk/modules/assembly-xsd/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema3
-rw-r--r--sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java55
-rw-r--r--sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java6
3 files changed, 43 insertions, 21 deletions
diff --git a/sca-java-2.x/trunk/modules/assembly-xsd/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema b/sca-java-2.x/trunk/modules/assembly-xsd/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema
index a919c3f2c2..ad8ef70c3c 100644
--- a/sca-java-2.x/trunk/modules/assembly-xsd/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema
+++ b/sca-java-2.x/trunk/modules/assembly-xsd/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema
@@ -15,4 +15,5 @@
# specific language governing permissions and limitations
# under the License.
#
-tuscany-sca-1.1.xsd
+tuscany-sca-1.1.xsd
+sca-1.1-cd05.xsd
diff --git a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java
index 372a802036..846d45403f 100644
--- a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java
+++ b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentBuilderImpl.java
@@ -63,6 +63,7 @@ import org.apache.tuscany.sca.assembly.builder.BuilderContext;
import org.apache.tuscany.sca.assembly.builder.BuilderExtensionPoint;
import org.apache.tuscany.sca.assembly.builder.ImplementationBuilder;
import org.apache.tuscany.sca.assembly.builder.Messages;
+import org.apache.tuscany.sca.assembly.xsd.Constants;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.FactoryExtensionPoint;
import org.apache.tuscany.sca.core.UtilityExtensionPoint;
@@ -82,6 +83,7 @@ import org.apache.tuscany.sca.monitor.Monitor;
import org.apache.tuscany.sca.policy.ExtensionType;
import org.apache.tuscany.sca.policy.PolicySubject;
import org.apache.tuscany.sca.xsd.XSDefinition;
+import org.apache.ws.commons.schema.XmlSchema;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -690,7 +692,7 @@ public class ComponentBuilderImpl {
if (propertyXSDType != null){
if (propertyXSDType.getNamespaceURI().equals("http://www.w3.org/2001/XMLSchema")) {
- // The property has a simple schema type so we can uses the
+ // The property has a simple schema type so we can use the
// data binding framework to see if the XML value can be transformed
// into a simple Java value
Document source = (Document)componentProperty.getValue();
@@ -723,23 +725,42 @@ public class ComponentBuilderImpl {
Document schemaDom = xsdDefinition.getSchema().getSchemaDocument();
- String valueSchema = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> " +
- "<schema xmlns=\"http://www.w3.org/2001/XMLSchema\" "+
- "xmlns:sca=\"http://docs.oasis-open.org/ns/opencsa/sca/200912\" "+
- "xmlns:__tmp=\"" + componentProperty.getXSDType().getNamespaceURI() + "\" "+
- "targetNamespace=\"http://docs.oasis-open.org/ns/opencsa/sca/200912\" " +
- "elementFormDefault=\"qualified\">" +
- "<import namespace=\"" + componentProperty.getXSDType().getNamespaceURI() + "\"/>" +
- "<element name=\"value\" type=\"" + "__tmp:" + componentProperty.getXSDType().getLocalPart() + "\"/>" +
- "</schema>";
-
- Source sources[] = {new DOMSource(schemaDom), new StreamSource(new StringReader(valueSchema))};
-
- // create a schema for the property based on all the DOMs from the schema collection
- // of the namspace of the property type
- // TODO - only getting the top level document here
- Schema schema = factory.newSchema(sources);
+ String valueSchema = null;
+ Schema schema = null;
+ if (componentProperty.getXSDType().getNamespaceURI().equals(Constants.SCA11_NS)){
+ // include the referenced schema as it's already in the OASIS namespace
+ valueSchema = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> " +
+ "<schema xmlns=\"http://www.w3.org/2001/XMLSchema\" "+
+ "xmlns:sca=\"http://docs.oasis-open.org/ns/opencsa/sca/200912\" "+
+ "xmlns:__tmp=\"" + componentProperty.getXSDType().getNamespaceURI() + "\" "+
+ "targetNamespace=\"http://docs.oasis-open.org/ns/opencsa/sca/200912\" " +
+ "elementFormDefault=\"qualified\">" +
+ "<include schemaLocation=\"" + xsdDefinition.getLocation() + "\"/>" +
+// "<element name=\"value\" type=\"" + "__tmp:" + componentProperty.getXSDType().getLocalPart() + "\"/>" +
+ "</schema>";
+// Source sources[] = {new StreamSource(new StringReader(valueSchema))};
+ Source sources[] = {new DOMSource(schemaDom)};
+ schema = factory.newSchema(sources);
+
+ // The SCA schema already contains a "value" element so I can't create this schema
+ // the SCA value element is an any so return assuming that it validates.
+ return;
+ } else {
+ // import the referenced schema
+ valueSchema = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> " +
+ "<schema xmlns=\"http://www.w3.org/2001/XMLSchema\" "+
+ "xmlns:sca=\"http://docs.oasis-open.org/ns/opencsa/sca/200912\" "+
+ "xmlns:__tmp=\"" + componentProperty.getXSDType().getNamespaceURI() + "\" "+
+ "targetNamespace=\"http://docs.oasis-open.org/ns/opencsa/sca/200912\" " +
+ "elementFormDefault=\"qualified\">" +
+ "<import namespace=\"" + componentProperty.getXSDType().getNamespaceURI() + "\"/>" +
+ "<element name=\"value\" type=\"" + "__tmp:" + componentProperty.getXSDType().getLocalPart() + "\"/>" +
+ "</schema>";
+ Source sources[] = {new DOMSource(schemaDom), new StreamSource(new StringReader(valueSchema))};
+ schema = factory.newSchema(sources);
+ }
+
// get the value child of the property element
Document property = (Document)componentProperty.getValue();
Element value = (Element)property.getDocumentElement().getFirstChild();
diff --git a/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java b/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java
index b356df0f35..84f8ef63b2 100644
--- a/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java
+++ b/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java
@@ -404,10 +404,10 @@ public class DeployerImpl implements Deployer {
scaSchema.setLocation(scaSchemaURL.toURI());
scaSchema.setUnresolved(false);
// modelResolver.addModel(scaSchema, context);
-
+ } else if (namespace.equals(Constants.SCA11_NS)) {
// we know that the SCA schema's are referenced form the Tuscany schemas so
- // register the schema under the SCA namsepace too
- scaSchema = xsdFactory.createXSDefinition();
+ // register the schema under the SCA namespace too
+ XSDefinition scaSchema = xsdFactory.createXSDefinition();
scaSchema.setUnresolved(true);
scaSchema.setNamespace(Constants.SCA11_NS);
scaSchema.setLocation(scaSchemaURL.toURI());