annotate WebServiceToolWorkflow/lib/SAWADLParser/src/edu/uga/cs/lsdis/meteors/wadls/extensions/schema/SchemaDeserializer.java @ 0:d5cd409b8a18 default tip

Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
author ganjoo
date Tue, 07 Jun 2011 18:00:50 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
1 /*
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
2 * (c) Copyright IBM Corp 2004, 2005
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
3 */
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
4
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
5 package edu.uga.cs.lsdis.meteors.wadls.extensions.schema;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
6
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
7 import java.io.Serializable;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
8 import java.util.Hashtable;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
9 import java.util.Map;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
10
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
11 import javax.wadls.Application;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
12 import javax.wadls.WADLSException;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
13 import javax.wadls.extensions.ExtensionDeserializer;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
14 import javax.wadls.extensions.schema.Schema;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
15 import javax.wadls.extensions.schema.SchemaImport;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
16 import javax.wadls.extensions.schema.SchemaReference;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
17 import javax.wadls.xml.WADLLocator;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
18 import javax.wadls.WADLSException;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
19 import javax.wadls.extensions.ExtensibilityElement;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
20 import javax.wadls.extensions.ExtensionRegistry;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
21 import javax.xml.namespace.QName;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
22
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
23 import org.w3c.dom.Element;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
24
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
25
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
26 import edu.uga.cs.lsdis.meteors.wadls.extensions.schema.SchemaConstants;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
27 import edu.uga.cs.lsdis.meteors.wadls.Constants;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
28 import edu.uga.cs.lsdis.meteors.wadls.util.xml.DOMUtils;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
29 import edu.uga.cs.lsdis.meteors.wadls.util.xml.QNameUtils;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
30
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
31 /**
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
32 * This class is used to deserialize <code>&lt;schema&gt;</code> elements into
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
33 * Schema instances.
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
34 *
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
35 * @see SchemaImpl
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
36 * @see SchemaSerializer
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
37 *
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
38 * @author Jeremy Hughes <hughesj@uk.ibm.com>
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
39 */
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
40 public class SchemaDeserializer implements Serializable
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
41 {
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
42
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
43 // Need to set this since a Definition is serializable and it contains an
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
44 // extension registry which contains one of these
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
45 public static final long serialVersionUID = 1;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
46
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
47 private final Map allReferencedSchemas = new Hashtable();
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
48
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
49 private static ThreadLocal wsdlLocator = new ThreadLocal();
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
50
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
51 /**
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
52 * Set the WSDLLocator to be used by the deserializer on this thread.
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
53 *
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
54 * @param loc The WSDLLocator to be used.
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
55 *
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
56 * @see WSDLLocator
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
57 */
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
58 public static void setLocator(WADLLocator loc)
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
59 {
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
60 wsdlLocator.set(loc);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
61 }
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
62 public Schema unmarshall(QName elementType,
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
63 Element el,
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
64 Application def)
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
65 throws WADLSException
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
66 {
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
67
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
68 Schema schema = new SchemaImpl();
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
69
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
70 schema.setElementType(elementType);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
71 schema.setElement(el);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
72 schema.setDocumentBaseURI(def.getDocumentBaseURI());
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
73
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
74 //TODO: check if the 'required' attribute needs to be set
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
75
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
76 // Go through the schema Element looking for child schemas
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
77 if(elementType.getLocalPart().equalsIgnoreCase("include")){
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
78
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
79 Element tempEl = el;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
80
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
81 QName tempElType = QNameUtils.newQName(tempEl);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
82
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
83 // Create the appropriate SchemaReference subclass to represent
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
84 // an <import>, an <include> or a <redefine>
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
85
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
86 SchemaReference sr = null;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
87 String locationURI = null;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
88
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
89
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
90 if (SchemaConstants.XSD_INCLUDE_QNAME_LIST.contains(tempElType))
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
91 {
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
92
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
93 // Create a new include. Don't use the
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
94 // ExtensionRegistry.createExtension()
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
95 // method as a Schema include is not a WSDL import.
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
96 sr = schema.createInclude();
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
97
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
98 sr.setId(DOMUtils.getAttribute(tempEl, SchemaConstants.ATTR_ID));
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
99
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
100 locationURI = DOMUtils.getAttribute(tempEl, SchemaConstants.ATTR_HREF);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
101
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
102 sr.setSchemaLocationURI(locationURI);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
103
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
104 // Now the include is set up except for the pointer to the
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
105 // referenced LWS, add the include to the LightWeightSchema.
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
106 schema.addInclude(sr);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
107 }
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
108
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
109 }
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
110 else{
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
111 Element tempEl = DOMUtils.getFirstChildElement(el);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
112
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
113
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
114 for (; tempEl != null; tempEl = DOMUtils.getNextSiblingElement(tempEl))
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
115 {
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
116
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
117 QName tempElType = QNameUtils.newQName(tempEl);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
118
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
119 // Create the appropriate SchemaReference subclass to represent
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
120 // an <import>, an <include> or a <redefine>
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
121
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
122 SchemaReference sr = null;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
123 String locationURI = null;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
124
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
125 if (SchemaConstants.XSD_IMPORT_QNAME_LIST.contains(tempElType))
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
126 {
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
127
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
128
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
129 // Create a new import. Don't use the
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
130 // ExtensionRegistry.createExtension()
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
131 // method as a Schema import is not a WSDL import.
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
132 SchemaImport im = schema.createImport();
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
133
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
134
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
135 im.setId(DOMUtils.getAttribute(tempEl, SchemaConstants.ATTR_ID));
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
136 im.setNamespaceURI(DOMUtils.getAttribute(tempEl, Constants.ATTR_NAMESPACE));
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
137
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
138 locationURI = DOMUtils.getAttribute(tempEl, SchemaConstants.ATTR_SCHEMA_LOCATION);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
139 im.setSchemaLocationURI(locationURI);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
140
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
141 // Now the import is set up except for the point to the
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
142 // referenced LWS, add the import to the LightWeightSchema.
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
143 schema.addImport(im);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
144 }
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
145 else
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
146 if (SchemaConstants.XSD_INCLUDE_QNAME_LIST.contains(tempElType))
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
147 {
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
148
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
149 // Create a new include. Don't use the
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
150 // ExtensionRegistry.createExtension()
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
151 // method as a Schema include is not a WSDL import.
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
152 sr = schema.createInclude();
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
153
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
154 sr.setId(DOMUtils.getAttribute(tempEl, SchemaConstants.ATTR_ID));
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
155
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
156 locationURI = DOMUtils.getAttribute(tempEl, SchemaConstants.ATTR_SCHEMA_LOCATION);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
157
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
158 sr.setSchemaLocationURI(locationURI);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
159
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
160 // Now the include is set up except for the pointer to the
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
161 // referenced LWS, add the include to the LightWeightSchema.
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
162 schema.addInclude(sr);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
163 }
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
164 else
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
165 if (SchemaConstants.XSD_REDEFINE_QNAME_LIST.contains(tempElType))
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
166 {
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
167 // Create a new redefine. Don't use the
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
168 // ExtensionRegistry.createExtension() method as a Schema redefine
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
169 // is not a WSDL import.
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
170 sr = schema.createRedefine();
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
171
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
172 sr.setId(DOMUtils.getAttribute(tempEl, SchemaConstants.ATTR_ID));
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
173
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
174 locationURI = DOMUtils.getAttribute(tempEl, SchemaConstants.ATTR_SCHEMA_LOCATION);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
175
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
176 sr.setSchemaLocationURI(locationURI);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
177
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
178 // Now the redefine is set up except for the pointer to the
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
179 // referenced LWS, add the redefine to the LightWeightSchema.
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
180 schema.addRedefine(sr);
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
181 }
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
182 else
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
183 {
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
184 // The element isn't one we're interested in so look at the next
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
185 // one
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
186 continue;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
187 }
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
188
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
189 } //end for
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
190 }
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
191
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
192 return schema;
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
193 }
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
194
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
195
d5cd409b8a18 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
ganjoo
parents:
diff changeset
196 }