summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/assembly-xsd
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-08-11 05:13:15 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-08-11 05:13:15 +0000
commitda54af6fa3cbdc88a5c07451697e071710a500ad (patch)
tree7a425b53d8439c8eecc7f9f85df14e6b73514e6a /java/sca/modules/assembly-xsd
parentd4bbe6fa031a26a4b3d86f455174a6cc0ed1cdd3 (diff)
Improve the XML schema validation to enable XSDs in other modules
Fix an issue to write to XMLStreamWriter from SUN JDK 1.6 git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@802988 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/assembly-xsd')
-rw-r--r--java/sca/modules/assembly-xsd/src/main/java/org/apache/tuscany/sca/assembly/xsd/Constants.java40
1 files changed, 40 insertions, 0 deletions
diff --git a/java/sca/modules/assembly-xsd/src/main/java/org/apache/tuscany/sca/assembly/xsd/Constants.java b/java/sca/modules/assembly-xsd/src/main/java/org/apache/tuscany/sca/assembly/xsd/Constants.java
index b265eb4c07..7498834a2c 100644
--- a/java/sca/modules/assembly-xsd/src/main/java/org/apache/tuscany/sca/assembly/xsd/Constants.java
+++ b/java/sca/modules/assembly-xsd/src/main/java/org/apache/tuscany/sca/assembly/xsd/Constants.java
@@ -19,6 +19,10 @@
package org.apache.tuscany.sca.assembly.xsd;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
import javax.xml.namespace.QName;
/**
@@ -98,4 +102,40 @@ public interface Constants {
String ZERO_N = "0..n";
String ONE_ONE = "1..1";
String ONE_N = "1..n";
+
+ /**
+ * Cache for public XSDs and DTDs
+ */
+ Map<String, URL> CACHED_XSDS = XSDCache.cache();
+
+ static class XSDCache {
+ static Map<String, URL> cache() {
+ Map<String, URL> cachedXSDs = new HashMap<String, URL>();
+ cachedXSDs.put(Constants.SCA11_NS, Constants.class.getResource("/sca-1.1-cd04.xsd"));
+ cachedXSDs
+ .put("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd",
+ Constants.class
+ .getResource("/org/apache/tuscany/sca/assembly/xsd/oasis-200401-wss-wssecurity-secext-1.0.xsd"));
+ cachedXSDs
+ .put("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd",
+ Constants.class
+ .getResource("/org/apache/tuscany/sca/assembly/xsd/oasis-200401-wss-wssecurity-utility-1.0.xsd"));
+ cachedXSDs.put("http://www.w3.org/2005/08/addressing", Constants.class
+ .getResource("/org/apache/tuscany/sca/assembly/xsd/ws-addr.xsd"));
+ cachedXSDs.put("http://www.w3.org/ns/ws-policy", Constants.class
+ .getResource("/org/apache/tuscany/sca/assembly/xsd/ws-policy.xsd"));
+ cachedXSDs.put("http://www.w3.org/ns/wsdl-instance", Constants.class
+ .getResource("/org/apache/tuscany/sca/assembly/xsd/wsdli.xsd"));
+ cachedXSDs.put("http://www.w3.org/XML/1998/namespace", Constants.class
+ .getResource("/org/apache/tuscany/sca/assembly/xsd/xml.xsd"));
+ cachedXSDs.put("http://www.w3.org/2000/09/xmldsig#", Constants.class
+ .getResource("/org/apache/tuscany/sca/assembly/xsd/xmldsig-core-schema.xsd"));
+
+ cachedXSDs.put("-//W3C//DTD XMLSCHEMA 200102//EN", Constants.class
+ .getResource("/org/apache/tuscany/sca/assembly/xsd/XMLSchema.dtd"));
+ cachedXSDs.put("datatypes", Constants.class
+ .getResource("/org/apache/tuscany/sca/assembly/xsd/datatypes.dtd"));
+ return cachedXSDs;
+ }
+ };
}