summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/xsd/src
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-05-11 18:40:54 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-05-11 18:40:54 +0000
commitb194aae6f8c2ed31a40439502d96c48ba1c51182 (patch)
tree3b831a85849f321201c48aaa1baa0337e82c4023 /sca-java-2.x/trunk/modules/xsd/src
parent11e1255139e74b2e7baaeaa80354b91d09fd80d9 (diff)
TUSCANY-3553 - add the SCA spec schema to the system contribution so that users can use SCA schema in property types. I don't know why people would want to do that but this capability seems to be the intention of the spec. This slows down the loading of any contributions that use these types, as the schema are loaded, but has little affect if you don't. I'm still looking at whether the local scheme optimization I added is effective but decided to check in as this fault is stopping the otests from running properly currently.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@943224 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/xsd/src')
-rw-r--r--sca-java-2.x/trunk/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDModelResolver.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/sca-java-2.x/trunk/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDModelResolver.java b/sca-java-2.x/trunk/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDModelResolver.java
index b9cb4cde2d..d87f1a3ef1 100644
--- a/sca-java-2.x/trunk/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDModelResolver.java
+++ b/sca-java-2.x/trunk/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDModelResolver.java
@@ -29,6 +29,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.apache.tuscany.sca.assembly.xsd.Constants;
import org.apache.tuscany.sca.common.xml.XMLDocumentHelper;
import org.apache.tuscany.sca.contribution.Artifact;
import org.apache.tuscany.sca.contribution.Contribution;
@@ -365,7 +366,14 @@ public class XSDModelResolver implements ModelResolver {
return new InputSource(schemaLocation);
}
} else {
- url = new URL(new URL(baseUri), schemaLocation);
+ // look to see whether Tuscany has a local version of the
+ // required schema. It can load the local version rather
+ // than going out to the network in order to improve performance
+ url = Constants.CACHED_XSDS.get(targetNamespace);
+
+ if (url == null) {
+ url = new URL(new URL(baseUri), schemaLocation);
+ }
}
return XMLDocumentHelper.getInputSource(url);
} catch (IOException e) {