diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2008-09-19 06:38:53 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2008-09-19 06:38:53 +0000 |
commit | 4140d84ab1259cc7500e36fb761f21c5ee01fba9 (patch) | |
tree | 149d212acf2b966ccd5c6be8fc752a4f2013dfe6 /java/sca/modules/xsd-xml/src/main | |
parent | e78d25f094fd8179557bc6fd8e448ca3c7c23f12 (diff) |
Upgrade to Axis2 1.4.1 and its transitive dependencies such as XmlSchema and Axiom based on the patches from Ram for TUSCANY-2606
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@696937 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/xsd-xml/src/main')
-rw-r--r-- | java/sca/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDModelResolver.java | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/java/sca/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDModelResolver.java b/java/sca/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDModelResolver.java index 652d9e8d83..3e22b49d31 100644 --- a/java/sca/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDModelResolver.java +++ b/java/sca/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDModelResolver.java @@ -49,6 +49,7 @@ import org.xml.sax.InputSource; * @version $Rev$ $Date$ */ public class XSDModelResolver implements ModelResolver { + private static final String AGGREGATED_XSD = "http://tuscany.apache.org/aggregated.xsd"; private XSDFactory factory; private Contribution contribution; private Map<String, List<XSDefinition>> map = new HashMap<String, List<XSDefinition>>(); @@ -166,6 +167,12 @@ public class XSDModelResolver implements ModelResolver { } // Read an XSD document InputSource xsd = XMLDocumentHelper.getInputSource(definition.getLocation().toURL()); + for (XmlSchema d : schemaCollection.getXmlSchemas()) { + if (d.getTargetNamespace().equals(definition.getNamespace())) { + if (d.getSourceURI().equals(definition.getLocation().toString())) + return; + } + } XmlSchema schema = schemaCollection.read(xsd, null); definition.setSchemaCollection(schemaCollection); definition.setSchema(schema); @@ -193,10 +200,25 @@ public class XSDModelResolver implements ModelResolver { loadOnDemand(d); } String ns = definitions.get(0).getNamespace(); - XmlSchema facade = new XmlSchema(ns, schemaCollection); + + XmlSchema facade = null; + // Check if the facade XSD is already in the collection + for (XmlSchema s : schemaCollection.getXmlSchema(AGGREGATED_XSD)) { + if (ns.equals(s.getTargetNamespace())) { + facade = s; + break; + } + } + if (facade == null) { + // This will add the facade into the collection + facade = new XmlSchema(ns, AGGREGATED_XSD, schemaCollection); + } for (XmlSchema d : schemaCollection.getXmlSchemas()) { if (ns.equals(d.getTargetNamespace())) { + if (d == facade) { + continue; + } XmlSchemaInclude include = new XmlSchemaInclude(); include.setSchema(d); include.setSourceURI(d.getSourceURI()); |