From b194aae6f8c2ed31a40439502d96c48ba1c51182 Mon Sep 17 00:00:00 2001 From: slaws Date: Tue, 11 May 2010 18:40:54 +0000 Subject: 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 --- .../java/org/apache/tuscany/sca/xsd/xml/XSDModelResolver.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'sca-java-2.x/trunk/modules/xsd/src/main') 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) { -- cgit v1.2.3