summaryrefslogtreecommitdiffstats
path: root/branches/sca-equinox/modules/xsd-xml/src/main/java/org/apache/tuscany/sca
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2008-09-29 01:09:22 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2008-09-29 01:09:22 +0000
commit49083619a0d9527d8797901735efac31bb3bcf5f (patch)
tree0b3dffa0b51e76b68d8d9f42164e6be583e6f670 /branches/sca-equinox/modules/xsd-xml/src/main/java/org/apache/tuscany/sca
parent04ef75e0a7e0e5928a90ca53a686665c2c634573 (diff)
Merged from trunk. 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@699937 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-equinox/modules/xsd-xml/src/main/java/org/apache/tuscany/sca')
-rw-r--r--branches/sca-equinox/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDModelResolver.java24
1 files changed, 23 insertions, 1 deletions
diff --git a/branches/sca-equinox/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDModelResolver.java b/branches/sca-equinox/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDModelResolver.java
index 652d9e8d83..3e22b49d31 100644
--- a/branches/sca-equinox/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDModelResolver.java
+++ b/branches/sca-equinox/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());